From: Laszlo T. <ave...@us...> - 2004-09-13 21:04:28
|
Update of /cvsroot/gemrb/gemrb/gemrb/plugins/DLGImporter In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21040/DLGImporter Modified Files: DLGImp.cpp DLGImp.h Log Message: Some more mods on AREImporter and DLGImporter to use ReadResRef Index: DLGImp.cpp =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/DLGImporter/DLGImp.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** DLGImp.cpp 2 Aug 2004 21:41:04 -0000 1.13 --- DLGImp.cpp 13 Sep 2004 21:04:17 -0000 1.14 *************** *** 63,76 **** Version = 10; } ! str->Read( &StatesCount, 4 ); ! str->Read( &StatesOffset, 4 ); ! str->Read( &TransitionsCount, 4 ); ! str->Read( &TransitionsOffset, 4 ); ! str->Read( &StateTriggersOffset, 4 ); ! str->Read( &StateTriggersCount, 4 ); ! str->Read( &TransitionTriggersOffset, 4 ); ! str->Read( &TransitionTriggersCount, 4 ); ! str->Read( &ActionsOffset, 4 ); ! str->Read( &ActionsCount, 4 ); if (Version == 109) { str->Seek( 4, GEM_CURRENT_POS ); --- 63,76 ---- Version = 10; } ! str->ReadDword( &StatesCount ); ! str->ReadDword( &StatesOffset ); ! str->ReadDword( &TransitionsCount ); ! str->ReadDword( &TransitionsOffset ); ! str->ReadDword( &StateTriggersOffset ); ! str->ReadDword( &StateTriggersCount ); ! str->ReadDword( &TransitionTriggersOffset ); ! str->ReadDword( &TransitionTriggersCount ); ! str->ReadDword( &ActionsOffset ); ! str->ReadDword( &ActionsCount ); if (Version == 109) { str->Seek( 4, GEM_CURRENT_POS ); *************** *** 95,111 **** { DialogState* ds = new DialogState(); ! str->Seek( StatesOffset + ( index * sizeof( State ) ), GEM_STREAM_START ); ! State state; ! str->Read( &state, sizeof( State ) ); ! ds->StrRef = state.StrRef; ! ds->trigger = GetStateTrigger( state.TriggerIndex ); ! ds->transitions = GetTransitions( state.FirstTransitionIndex, ! state.TransitionsCount ); ! ds->transitionsCount = state.TransitionsCount; return ds; } ! DialogTransition** DLGImp::GetTransitions(unsigned int firstIndex, ! unsigned int count) { DialogTransition** trans = ( DialogTransition** ) --- 95,112 ---- { DialogState* ds = new DialogState(); ! //16 = sizeof(State) ! str->Seek( StatesOffset + ( index * 16 ), GEM_STREAM_START ); ! ieDword FirstTransitionIndex; ! ieDword TriggerIndex; ! str->ReadDword( &ds->StrRef ); ! str->ReadDword( &TriggerIndex ); ! str->ReadDword( &FirstTransitionIndex ); ! ds->trigger = GetStateTrigger( TriggerIndex ); ! str->ReadDword( &ds->transitionsCount ); ! ds->transitions = GetTransitions( FirstTransitionIndex, ds->transitionsCount ); return ds; } ! DialogTransition** DLGImp::GetTransitions(unsigned int firstIndex, unsigned int count) { DialogTransition** trans = ( DialogTransition** ) *************** *** 122,138 **** return NULL; } ! str->Seek( TransitionsOffset + ( index * sizeof( Transition ) ), ! GEM_STREAM_START ); ! Transition trans; ! str->Read( &trans, sizeof( Transition ) ); DialogTransition* dt = new DialogTransition(); ! dt->Flags = trans.Flags; ! dt->textStrRef = trans.AnswerStrRef; ! dt->journalStrRef = trans.JournalStrRef; ! dt->trigger = GetTransitionTrigger( trans.TriggerIndex ); ! dt->action = GetAction( trans.ActionIndex ); ! strncpy( dt->Dialog, trans.DLGResRef, 8 ); ! dt->Dialog[8] = 0; ! dt->stateIndex = trans.NextStateIndex; return dt; } --- 123,140 ---- return NULL; } ! //32 = sizeof(Transition) ! str->Seek( TransitionsOffset + ( index * 32 ), GEM_STREAM_START ); DialogTransition* dt = new DialogTransition(); ! str->ReadDword( &dt->Flags ); ! str->ReadDword( &dt->textStrRef ); ! str->ReadDword( &dt->journalStrRef ); ! ieDword TriggerIndex; ! str->ReadDword( &TriggerIndex ); ! dt->trigger = GetTransitionTrigger( TriggerIndex ); ! ieDword ActionIndex; ! str->ReadDword( &ActionIndex ); ! dt->action = GetAction( ActionIndex ); ! str->ReadResRef( dt->Dialog ); ! str->ReadDword( &dt->stateIndex ); return dt; } *************** *** 143,155 **** return NULL; } ! str->Seek( StateTriggersOffset + ( index * sizeof( VarOffset ) ), ! GEM_STREAM_START ); ! VarOffset offset; ! str->Read( &offset, sizeof( VarOffset ) ); DialogString* ds = new DialogString(); ! str->Seek( offset.Offset, GEM_STREAM_START ); ! char* string = ( char* ) malloc( offset.Length + 1 ); ! str->Read( string, offset.Length ); ! string[offset.Length] = 0; ds->strings = GetStrings( string, ds->count ); free( string ); --- 145,158 ---- return NULL; } ! //8 = sizeof(VarOffset) ! str->Seek( StateTriggersOffset + ( index * 8 ), GEM_STREAM_START ); ! ieDword Offset, Length; ! str->ReadDword( &Offset ); ! str->ReadDword( &Length ); DialogString* ds = new DialogString(); ! str->Seek( Offset, GEM_STREAM_START ); ! char* string = ( char* ) malloc( Length + 1 ); ! str->Read( string, Length ); ! string[Length] = 0; ds->strings = GetStrings( string, ds->count ); free( string ); *************** *** 162,174 **** return NULL; } ! str->Seek( TransitionTriggersOffset + ( index * sizeof( VarOffset ) ), ! GEM_STREAM_START ); ! VarOffset offset; ! str->Read( &offset, sizeof( VarOffset ) ); DialogString* ds = new DialogString(); ! str->Seek( offset.Offset, GEM_STREAM_START ); ! char* string = ( char* ) malloc( offset.Length + 1 ); ! str->Read( string, offset.Length ); ! string[offset.Length] = 0; ds->strings = GetStrings( string, ds->count ); free( string ); --- 165,177 ---- return NULL; } ! str->Seek( TransitionTriggersOffset + ( index * 8 ), GEM_STREAM_START ); ! ieDword Offset, Length; ! str->ReadDword( &Offset ); ! str->ReadDword( &Length ); DialogString* ds = new DialogString(); ! str->Seek( Offset, GEM_STREAM_START ); ! char* string = ( char* ) malloc( Length + 1 ); ! str->Read( string, Length ); ! string[Length] = 0; ds->strings = GetStrings( string, ds->count ); free( string ); *************** *** 181,193 **** return NULL; } ! str->Seek( ActionsOffset + ( index * sizeof( VarOffset ) ), ! GEM_STREAM_START ); ! VarOffset offset; ! str->Read( &offset, sizeof( VarOffset ) ); DialogString* ds = new DialogString(); ! str->Seek( offset.Offset, GEM_STREAM_START ); ! char* string = ( char* ) malloc( offset.Length + 1 ); ! str->Read( string, offset.Length ); ! string[offset.Length] = 0; ds->strings = GetStrings( string, ds->count ); free( string ); --- 184,196 ---- return NULL; } ! str->Seek( ActionsOffset + ( index * 8 ), GEM_STREAM_START ); ! ieDword Offset, Length; ! str->ReadDword( &Offset ); ! str->ReadDword( &Length ); DialogString* ds = new DialogString(); ! str->Seek( Offset, GEM_STREAM_START ); ! char* string = ( char* ) malloc( Length + 1 ); ! str->Read( string, Length ); ! string[Length] = 0; ds->strings = GetStrings( string, ds->count ); free( string ); *************** *** 241,253 **** count = 0; while (*poi) { - /* maybe we don't need this at all - while (MyIsSpace( *poi )) - poi++; - //i think we need this, - //think of an empty line containing only whitespace - if(!poi) { - break; - } - */ switch (*poi++) { case '/': --- 244,247 ---- Index: DLGImp.h =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/DLGImporter/DLGImp.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** DLGImp.h 2 Aug 2004 21:41:04 -0000 1.7 --- DLGImp.h 13 Sep 2004 21:04:17 -0000 1.8 *************** *** 26,29 **** --- 26,30 ---- #include "../../includes/globals.h" + /* typedef struct State { ieStrRef StrRef; *************** *** 32,36 **** ieDword TriggerIndex; } State; ! typedef struct Transition { ieDword Flags; --- 33,38 ---- ieDword TriggerIndex; } State; ! */ ! /* typedef struct Transition { ieDword Flags; *************** *** 42,51 **** ieDword NextStateIndex; } Transition; ! typedef struct VarOffset { ieDword Offset; ieDword Length; } VarOffset; ! class DLGImp : public DialogMgr { private: --- 44,54 ---- ieDword NextStateIndex; } Transition; ! */ ! /* typedef struct VarOffset { ieDword Offset; ieDword Length; } VarOffset; ! */ class DLGImp : public DialogMgr { private: |