From: Laszlo T. <ave...@us...> - 2005-04-10 19:04:55
|
Update of /cvsroot/gemrb/gemrb/gemrb/plugins/Core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5476/plugins/Core Modified Files: Interface.cpp GameControl.cpp Log Message: Reload screen state from saved game (messagewindow size, left/right panes), this also fixes a memory problem when modifying messagewindow size (destructed textarea was referenced) Index: Interface.cpp =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/Core/Interface.cpp,v retrieving revision 1.295 retrieving revision 1.296 diff -C2 -d -r1.295 -r1.296 *** Interface.cpp 9 Apr 2005 19:13:42 -0000 1.295 --- Interface.cpp 10 Apr 2005 19:04:26 -0000 1.296 *************** *** 157,161 **** std::vector<type>::iterator i; \ for(i = variable.begin(); i != variable.end(); ++i) { \ ! if(!(*i).free) { \ FreeInterface((*i).member); \ (*i).free = true; \ --- 157,161 ---- std::vector<type>::iterator i; \ for(i = variable.begin(); i != variable.end(); ++i) { \ ! if (!(*i).free) { \ FreeInterface((*i).member); \ (*i).free = true; \ *************** *** 168,172 **** unsigned int i=variable.size(); \ while(i--) { \ ! if(variable[i]) { \ delete variable[i]; \ } \ --- 168,172 ---- unsigned int i=variable.size(); \ while(i--) { \ ! if (variable[i]) { \ delete variable[i]; \ } \ *************** *** 243,248 **** if (Cursors) { for (int i = 0; i < CursorCount; i++) { ! if (Cursors[i]) ! delete( Cursors[i] ); } delete[] Cursors; --- 243,248 ---- if (Cursors) { for (int i = 0; i < CursorCount; i++) { ! //freesprite doesn't free NULL ! video->FreeSprite( Cursors[i] ); } delete[] Cursors; *************** *** 301,311 **** FreeInterfaceVector( Symbol, symbols, sm ); ! if(INIquests) { FreeInterface(INIquests); } ! if(INIbeasts) { FreeInterface(INIbeasts); } ! if(INIparty) { FreeInterface(INIparty); } --- 301,311 ---- FreeInterfaceVector( Symbol, symbols, sm ); ! if (INIquests) { FreeInterface(INIquests); } ! if (INIbeasts) { FreeInterface(INIbeasts); } ! if (INIparty) { FreeInterface(INIparty); } *************** *** 321,329 **** int table=LoadTable("strings"); memset(strref_table,-1,sizeof(strref_table) ); ! if(table<0) { return false; } tab = GetTable(table); ! if(!tab) { goto end; } --- 321,329 ---- int table=LoadTable("strings"); memset(strref_table,-1,sizeof(strref_table) ); ! if (table<0) { return false; } tab = GetTable(table); ! if (!tab) { goto end; } *************** *** 407,411 **** return GEM_ERROR; } ! if(!LoadGemRBINI()) { printf( "Cannot Load INI\nTermination in Progress...\n" ); --- 407,411 ---- return GEM_ERROR; } ! if (!LoadGemRBINI()) { printf( "Cannot Load INI\nTermination in Progress...\n" ); *************** *** 550,554 **** printMessage( "Core", "Initializing Tooltips...", WHITE ); str = key->GetResource( TooltipBackResRef, IE_BAM_CLASS_ID ); ! if(!anim->Open( str, true )) { printStatus( "ERROR", LIGHT_RED ); goto end_of_init; --- 550,554 ---- printMessage( "Core", "Initializing Tooltips...", WHITE ); str = key->GetResource( TooltipBackResRef, IE_BAM_CLASS_ID ); ! if (!anim->Open( str, true )) { printStatus( "ERROR", LIGHT_RED ); goto end_of_init; *************** *** 598,602 **** console->SetFont( fonts[0] ); str = key->GetResource( CursorBam, IE_BAM_CLASS_ID ); ! if(anim->Open(str, true) ) { console->SetCursor( anim->GetFrameFromCycle( 0,0 ) ); printStatus( "OK", LIGHT_GREEN ); --- 598,602 ---- console->SetFont( fonts[0] ); str = key->GetResource( CursorBam, IE_BAM_CLASS_ID ); ! if (anim->Open(str, true) ) { console->SetCursor( anim->GetFrameFromCycle( 0,0 ) ); printStatus( "OK", LIGHT_GREEN ); *************** *** 710,714 **** str = key->GetResource( "CURSORS", IE_BAM_CLASS_ID ); ! if(anim->Open( str, true )) { CursorCount = anim->GetCycleCount(); --- 710,714 ---- str = key->GetResource( "CURSORS", IE_BAM_CLASS_ID ); ! if (anim->Open( str, true )) { CursorCount = anim->GetCycleCount(); *************** *** 818,822 **** printMessage( "Core", "Initializing Inventory Management...", WHITE ); ret = InitItemTypes(); ! if(ret) { printStatus( "OK", LIGHT_GREEN ); } --- 818,822 ---- printMessage( "Core", "Initializing Inventory Management...", WHITE ); ret = InitItemTypes(); ! if (ret) { printStatus( "OK", LIGHT_GREEN ); } *************** *** 827,831 **** printMessage( "Core", "Initializing string constants...", WHITE ); ret = ReadStrrefs(); ! if(ret) { printStatus( "OK", LIGHT_GREEN ); } --- 827,831 ---- printMessage( "Core", "Initializing string constants...", WHITE ); ret = ReadStrrefs(); ! if (ret) { printStatus( "OK", LIGHT_GREEN ); } *************** *** 836,840 **** printMessage( "Core", "Initializing random treasure...", WHITE ); ret = ReadRandomItems(); ! if(ret) { printStatus( "OK", LIGHT_GREEN ); } --- 836,840 ---- printMessage( "Core", "Initializing random treasure...", WHITE ); ret = ReadRandomItems(); ! if (ret) { printStatus( "OK", LIGHT_GREEN ); } *************** *** 1167,1170 **** --- 1167,1172 ---- } else if (stricmp( name, "GemRBPath" ) == 0) { strcpy( GemRBPath, value ); + } else if (stricmp( name, "ScriptDebugMode" ) == 0) { + SetScriptDebugMode(atoi(value)); } else if (stricmp( name, "CachePath" ) == 0) { strcpy( CachePath, value ); *************** *** 1322,1326 **** } - SetScriptDebugMode(ini->GetKeyAsInt( "resources", "ScriptDebugMode", 0)); TooltipMargin = ini->GetKeyAsInt( "resources", "TooltipMargin", TooltipMargin ); --- 1324,1327 ---- *************** *** 1355,1359 **** if (s) { char *s2 = strchr(s,','); ! if(s2) { upperlower(atoi(s), atoi(s2+1) ); printMessage("Core"," ",WHITE); --- 1356,1360 ---- if (s) { char *s2 = strchr(s,','); ! if (s2) { upperlower(atoi(s), atoi(s2+1) ); printMessage("Core"," ",WHITE); *************** *** 1488,1492 **** } Actor* actor = GetCreature(stream); ! if( !actor ) { return -1; } --- 1489,1493 ---- } Actor* actor = GetCreature(stream); ! if ( !actor ) { return -1; } *************** *** 1501,1505 **** actor->SetOrientation( 0 ); ! if( InParty ) { return game->JoinParty( actor ); } --- 1502,1506 ---- actor->SetOrientation( 0 ); ! if ( InParty ) { return game->JoinParty( actor ); } *************** *** 1796,1803 **** return -1; } ! if(Status&0x80) { evntmgr->SetFocused( win, ctrl); } ! switch ((Status >> 24) & 0xff) { case IE_GUI_BUTTON: //Button --- 1797,1807 ---- return -1; } ! if (Status&IE_GUI_CONTROL_FOCUSED) { evntmgr->SetFocused( win, ctrl); } ! if (ctrl->ControlType != ((Status >> 24) & 0xff) ) { ! return -2; ! } ! switch (ctrl->ControlType) { case IE_GUI_BUTTON: //Button *************** *** 1857,1865 **** { GameControl *gc = GetGameControl(); ! if(!gc) { GSUpdate(false); } else { GSUpdate(!(gc->GetDialogueFlags()&DF_FREEZE_SCRIPTS)); } --- 1861,1879 ---- { GameControl *gc = GetGameControl(); ! if (!gc) { GSUpdate(false); } else { GSUpdate(!(gc->GetDialogueFlags()&DF_FREEZE_SCRIPTS)); + + //updating panes according to the saved game + ieDword index; + + if (!vars->Lookup( "MessageWindowSize", index ) || (index!=game->ControlStatus) ) { + vars->SetAt( "MessageWindowSize", game->ControlStatus); + guiscript->RunFunction( "UpdateControlStatus" ); + //giving control back to GameControl + SetControlStatus(0,0,0xff000000|IE_GUI_CONTROL_FOCUSED); + } } *************** *** 1942,1946 **** int Interface::DelWindow(unsigned short WindowIndex) { ! if(WindowIndex == 0xffff) { vars->SetAt("MessageWindow", (ieDword) ~0); vars->SetAt("OptionsWindow", (ieDword) ~0); --- 1956,1960 ---- int Interface::DelWindow(unsigned short WindowIndex) { ! if (WindowIndex == 0xffff) { vars->SetAt("MessageWindow", (ieDword) ~0); vars->SetAt("OptionsWindow", (ieDword) ~0); *************** *** 1952,1956 **** for(unsigned int WindowIndex=0; WindowIndex<windows.size();WindowIndex++) { Window* win = windows[WindowIndex]; ! if(win) { evntmgr->DelWindow( win->WindowID ); delete( win ); --- 1966,1970 ---- for(unsigned int WindowIndex=0; WindowIndex<windows.size();WindowIndex++) { Window* win = windows[WindowIndex]; ! if (win) { evntmgr->DelWindow( win->WindowID ); delete( win ); *************** *** 2093,2097 **** bool Interface::DelTable(unsigned int index) { ! if(index==0xffffffff) { FreeInterfaceVector( Table, tables, tm ); tables.clear(); --- 2107,2111 ---- bool Interface::DelTable(unsigned int index) { ! if (index==0xffffffff) { FreeInterfaceVector( Table, tables, tm ); tables.clear(); *************** *** 2207,2215 **** //shutting down music and ambients before movie ! if(music) music->HardEnd(); soundmgr->GetAmbientMgr()->deactivate(); mp->Play(); //restarting music ! if(music) music->Start(); soundmgr->GetAmbientMgr()->activate(); if (gc) gc->UnhideGUI(); --- 2221,2229 ---- //shutting down music and ambients before movie ! if (music) music->HardEnd(); soundmgr->GetAmbientMgr()->deactivate(); mp->Play(); //restarting music ! if (music) music->Start(); soundmgr->GetAmbientMgr()->activate(); if (gc) gc->UnhideGUI(); *************** *** 2324,2328 **** } GameControl *gc=GetGameControl(); ! if(gc) { gc->SetCutSceneMode( active ); } --- 2338,2342 ---- } GameControl *gc=GetGameControl(); ! if (gc) { gc->SetCutSceneMode( active ); } *************** *** 2348,2364 **** //delete game, worldmap ! if(game) { delete game; game=NULL; } ! if(worldmap) { delete worldmap; worldmap=NULL; } //shutting down ingame music ! if(music) music->HardEnd(); // stop any ambients which are still enqueued soundmgr->GetAmbientMgr()->deactivate(); ! if(BackToMain) { strcpy(NextScript, "Start"); ChangeScript = true; --- 2362,2378 ---- //delete game, worldmap ! if (game) { delete game; game=NULL; } ! if (worldmap) { delete worldmap; worldmap=NULL; } //shutting down ingame music ! if (music) music->HardEnd(); // stop any ambients which are still enqueued soundmgr->GetAmbientMgr()->deactivate(); ! if (BackToMain) { strcpy(NextScript, "Start"); ChangeScript = true; *************** *** 2444,2448 **** if (sav_str) { ArchiveImporter * ai = (ArchiveImporter*)GetInterface(IE_BIF_CLASS_ID); ! if(ai) { ai->DecompressSaveGame(sav_str); FreeInterface( ai ); --- 2458,2462 ---- if (sav_str) { ArchiveImporter * ai = (ArchiveImporter*)GetInterface(IE_BIF_CLASS_ID); ! if (ai) { ai->DecompressSaveGame(sav_str); FreeInterface( ai ); *************** *** 2495,2499 **** Control* gc = window->GetControl(0); ! if(gc->ControlType!=IE_GUI_GAMECONTROL) { return NULL; } --- 2509,2513 ---- Control* gc = window->GetControl(0); ! if (gc->ControlType!=IE_GUI_GAMECONTROL) { return NULL; } *************** *** 2510,2514 **** ItemTypes = 0; ! if(it) { ItemTypes = it->GetRowCount(); //number of itemtypes if (ItemTypes<0) { --- 2524,2528 ---- ItemTypes = 0; ! if (it) { ItemTypes = it->GetRowCount(); //number of itemtypes if (ItemTypes<0) { *************** *** 2542,2546 **** } SlotTypes = 0; ! if(st) { SlotTypes = st->GetRowCount(); //make sure unsigned int is 32 bits --- 2556,2560 ---- } SlotTypes = 0; ! if (st) { SlotTypes = st->GetRowCount(); //make sure unsigned int is 32 bits *************** *** 2565,2569 **** int Interface::QuerySlotType(int idx) const { ! if(idx>=SlotTypes) { return 0; } --- 2579,2583 ---- int Interface::QuerySlotType(int idx) const { ! if (idx>=SlotTypes) { return 0; } *************** *** 2573,2577 **** int Interface::QuerySlotID(int idx) const { ! if(idx>=SlotTypes) { return 0; } --- 2587,2591 ---- int Interface::QuerySlotID(int idx) const { ! if (idx>=SlotTypes) { return 0; } *************** *** 2581,2585 **** int Interface::QuerySlottip(int idx) const { ! if(idx>=SlotTypes) { return 0; } --- 2595,2599 ---- int Interface::QuerySlottip(int idx) const { ! if (idx>=SlotTypes) { return 0; } *************** *** 2589,2593 **** const char *Interface::QuerySlotResRef(int idx) const { ! if(idx>=SlotTypes) { return ""; } --- 2603,2607 ---- const char *Interface::QuerySlotResRef(int idx) const { ! if (idx>=SlotTypes) { return ""; } *************** *** 2597,2605 **** int Interface::CanUseItemType(int itype, int slottype) const { ! if( !slottype ) { //inventory slot, can hold any item, including invalid return 1; } ! if( itype>=ItemTypes ) { //invalid itemtype return 0; --- 2611,2619 ---- int Interface::CanUseItemType(int itype, int slottype) const { ! if ( !slottype ) { //inventory slot, can hold any item, including invalid return 1; } ! if ( itype>=ItemTypes ) { //invalid itemtype return 0; *************** *** 2609,2613 **** } ! void Interface::DisplayString(const char* Text) { ieDword WinIndex, TAIndex; --- 2623,2627 ---- } ! TextArea *Interface::GetMessageTextArea() { ieDword WinIndex, TAIndex; *************** *** 2618,2633 **** Window* win = GetWindow( WinIndex ); if (win) { ! TextArea* ta = ( TextArea* ) win->GetControl( TAIndex ); ! ta->AppendText( Text, -1 ); } } } ! static const char* DisplayFormatName = "[color=%lX]%s - [/color][p][color=%lX]%s[/color][/p]"; static const char* DisplayFormat = "[/color][p][color=%lX]%s[/color][/p]"; void Interface::DisplayConstantString(int stridx, unsigned int color) { ! char* text = GetString( strref_table[stridx] ); int newlen = (int)(strlen( DisplayFormat ) + strlen( text ) + 10); char* newstr = ( char* ) malloc( newlen ); --- 2632,2656 ---- Window* win = GetWindow( WinIndex ); if (win) { ! Control *ctrl = win->GetControl( TAIndex ); ! if (ctrl->ControlType==IE_GUI_TEXTAREA) ! return (TextArea *) ctrl; } } + return NULL; } ! void Interface::DisplayString(const char* Text) ! { ! TextArea *ta = GetMessageTextArea(); ! if (ta) ! ta->AppendText( Text, -1 ); ! } ! ! static const char* DisplayFormatName = "[color=%lX]%s - [/color][p][color=%lX]%s[/color][/p]"; static const char* DisplayFormat = "[/color][p][color=%lX]%s[/color][/p]"; void Interface::DisplayConstantString(int stridx, unsigned int color) { ! char* text = GetString( strref_table[stridx], IE_STR_SOUND ); int newlen = (int)(strlen( DisplayFormat ) + strlen( text ) + 10); char* newstr = ( char* ) malloc( newlen ); *************** *** 2657,2661 **** } ! char* text = GetString( strref_table[stridx] ); int newlen = (int)(strlen( DisplayFormatName ) + strlen( name ) + + strlen( text ) + 18); --- 2680,2684 ---- } ! char* text = GetString( strref_table[stridx], IE_STR_SOUND|IE_STR_SPEECH ); int newlen = (int)(strlen( DisplayFormatName ) + strlen( name ) + + strlen( text ) + 18); *************** *** 2704,2711 **** { char *str=strchr(filename,'.'); ! if(!str) return false; int i=0; while(saved_extensions[i]) { ! if(!stricmp(saved_extensions[i], str) ) return true; i++; } --- 2727,2734 ---- { char *str=strchr(filename,'.'); ! if (!str) return false; int i=0; while(saved_extensions[i]) { ! if (!stricmp(saved_extensions[i], str) ) return true; i++; } *************** *** 2767,2780 **** int table=LoadTable(TableName); ! if(table<0) { return false; } tab = GetTable(table); ! if(!tab) { goto end; } i=tab->GetRowCount(); for(j=0;j<i;j++) { ! if(Prefix) { snprintf(ItemName,sizeof(ItemName),"%s%02d",Prefix, j+1); } else { --- 2790,2803 ---- int table=LoadTable(TableName); ! if (table<0) { return false; } tab = GetTable(table); ! if (!tab) { goto end; } i=tab->GetRowCount(); for(j=0;j<i;j++) { ! if (Prefix) { snprintf(ItemName,sizeof(ItemName),"%s%02d",Prefix, j+1); } else { *************** *** 2809,2831 **** int difflev=0; //rt norm or rt fury ! if(RtRows) { RtRows->RemoveAll(); } else { RtRows=new Variables(10, 17); //block size, hash table size ! if(!RtRows) { return false; } RtRows->SetType( GEM_VARIABLES_STRING ); } ! if(table<0) { return false; } tab = GetTable( table ); ! if(!tab) { goto end; } strncpy( GoldResRef, tab->QueryField((unsigned int) 0,(unsigned int) 0), sizeof(ieResRef) ); //gold ! if( GoldResRef[0]=='*' ) { DelTable( table ); return false; --- 2832,2854 ---- int difflev=0; //rt norm or rt fury ! if (RtRows) { RtRows->RemoveAll(); } else { RtRows=new Variables(10, 17); //block size, hash table size ! if (!RtRows) { return false; } RtRows->SetType( GEM_VARIABLES_STRING ); } ! if (table<0) { return false; } tab = GetTable( table ); ! if (!tab) { goto end; } strncpy( GoldResRef, tab->QueryField((unsigned int) 0,(unsigned int) 0), sizeof(ieResRef) ); //gold ! if ( GoldResRef[0]=='*' ) { DelTable( table ); return false; *************** *** 2833,2841 **** strncpy( RtResRef, tab->QueryField( 1, difflev ), sizeof(ieResRef) ); i=atoi( RtResRef ); ! if(i<1) { ReadItemTable( RtResRef, 0 ); //reading the table itself goto end; } ! if(i>5) { i=5; } --- 2856,2864 ---- strncpy( RtResRef, tab->QueryField( 1, difflev ), sizeof(ieResRef) ); i=atoi( RtResRef ); ! if (i<1) { ReadItemTable( RtResRef, 0 ); //reading the table itself goto end; } ! if (i>5) { i=5; } *************** *** 2859,2863 **** str->ReadWord( &itm->Usages[2] ); str->ReadDword( &itm->Flags ); ! if(ResolveRandomItem(itm) ) { return itm; --- 2882,2886 ---- str->ReadWord( &itm->Usages[2] ); str->ReadDword( &itm->Flags ); ! if (ResolveRandomItem(itm) ) { return itm; *************** *** 2873,2877 **** bool Interface::ResolveRandomItem(CREItem *itm) { ! if(!RtRows) return true; for(int loop=0;loop<MAX_LOOP;loop++) { --- 2896,2900 ---- bool Interface::ResolveRandomItem(CREItem *itm) { ! if (!RtRows) return true; for(int loop=0;loop<MAX_LOOP;loop++) { *************** *** 2881,2885 **** char *itemlist=NULL; ! if( (!RtRows->Lookup( itm->ItemResRef, itemlist )) ) { return true; --- 2904,2908 ---- char *itemlist=NULL; ! if ( (!RtRows->Lookup( itm->ItemResRef, itemlist )) ) { return true; *************** *** 2888,2892 **** strncpy( NewItem, ((ieResRef *) itemlist)[i], sizeof(ieResRef) ); char *p=(char *) strchr(NewItem,'*'); ! if(p) { *p=0; //doing this so endptr is ok --- 2911,2915 ---- strncpy( NewItem, ((ieResRef *) itemlist)[i], sizeof(ieResRef) ); char *p=(char *) strchr(NewItem,'*'); ! if (p) { *p=0; //doing this so endptr is ok *************** *** 2897,2909 **** } j=strtol(NewItem,&endptr,10); ! if(*endptr) strnuprcpy(itm->ItemResRef,NewItem,sizeof(ieResRef) ); else { strnuprcpy(itm->ItemResRef, GoldResRef, sizeof(ieResRef) ); itm->Usages[0]=Roll(j,k,0); } ! if( !memcmp( itm->ItemResRef,"NO_DROP",8 ) ) { itm->ItemResRef[0]=0; } ! if(!itm->ItemResRef[0]) return false; } printf("Loop detected while generating random item:%s",itm->ItemResRef); --- 2920,2932 ---- } j=strtol(NewItem,&endptr,10); ! if (*endptr) strnuprcpy(itm->ItemResRef,NewItem,sizeof(ieResRef) ); else { strnuprcpy(itm->ItemResRef, GoldResRef, sizeof(ieResRef) ); itm->Usages[0]=Roll(j,k,0); } ! if ( !memcmp( itm->ItemResRef,"NO_DROP",8 ) ) { itm->ItemResRef[0]=0; } ! if (!itm->ItemResRef[0]) return false; } printf("Loop detected while generating random item:%s",itm->ItemResRef); *************** *** 3038,3042 **** int Interface::CloseCurrentStore() { ! if( !CurrentStore ) { return -1; } --- 3061,3065 ---- int Interface::CloseCurrentStore() { ! if ( !CurrentStore ) { return -1; } *************** *** 3055,3060 **** Store *Interface::SetCurrentStore( ieResRef resname ) { ! if( CurrentStore ) { ! if( !strnicmp(CurrentStore->Name, resname, 8) ) { return CurrentStore; } --- 3078,3083 ---- Store *Interface::SetCurrentStore( ieResRef resname ) { ! if ( CurrentStore ) { ! if ( !strnicmp(CurrentStore->Name, resname, 8) ) { return CurrentStore; } *************** *** 3148,3152 **** { if (Exists( effect, IE_VVC_CLASS_ID ) ) { ! DataStream *ds = key->GetResource( effect, IE_VVC_CLASS_ID ); return new ScriptedAnimation( ds, position, true); } --- 3171,3175 ---- { if (Exists( effect, IE_VVC_CLASS_ID ) ) { ! DataStream *ds = key->GetResource( effect, IE_VVC_CLASS_ID ); return new ScriptedAnimation( ds, position, true); } Index: GameControl.cpp =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/Core/GameControl.cpp,v retrieving revision 1.217 retrieving revision 1.218 diff -C2 -d -r1.217 -r1.218 *** GameControl.cpp 9 Apr 2005 19:13:39 -0000 1.217 --- GameControl.cpp 10 Apr 2005 19:04:27 -0000 1.218 *************** *** 175,178 **** --- 175,182 ---- GameControl::~GameControl(void) { + if (formations) { + free( formations ); + formations = NULL; + } free( InfoTextPalette ); for (unsigned int i = 0; i < infoTexts.size(); i++) { *************** *** 295,299 **** std::vector< Scriptable*>::iterator m; m = infoTexts.begin() + i; ! ( *m )->MySelf->textDisplaying = 0; delete( *m ); infoTexts.erase( m ); --- 299,303 ---- std::vector< Scriptable*>::iterator m; m = infoTexts.begin() + i; ! ( *m )->CutSceneId->textDisplaying = 0; delete( *m ); infoTexts.erase( m ); *************** *** 1094,1098 **** } ScreenFlags &=~SF_GUIENABLED; - HandleWindowHide("MessageWindow", "MessagePosition"); HandleWindowHide("OptionsWindow", "OptionsPosition"); HandleWindowHide("PortraitWindow", "PortraitPosition"); --- 1098,1101 ---- *************** *** 1100,1103 **** --- 1103,1107 ---- HandleWindowHide("TopWindow", "TopPosition"); HandleWindowHide("OtherWindow", "OtherPosition"); + HandleWindowHide("MessageWindow", "MessagePosition"); //FloatWindow doesn't affect gamecontrol, so it is special Variables* dict = core->GetDictionary(); *************** *** 1144,1150 **** HandleWindowReveal("MessageWindow", "MessagePosition"); HandleWindowReveal("OptionsWindow", "OptionsPosition"); HandleWindowReveal("PortraitWindow", "PortraitPosition"); - HandleWindowReveal("ActionsWindow", "ActionsPosition"); HandleWindowReveal("TopWindow", "TopPosition"); HandleWindowReveal("OtherWindow", "OtherPosition"); --- 1148,1154 ---- HandleWindowReveal("MessageWindow", "MessagePosition"); + HandleWindowReveal("ActionsWindow", "ActionsPosition"); HandleWindowReveal("OptionsWindow", "OptionsPosition"); HandleWindowReveal("PortraitWindow", "PortraitPosition"); HandleWindowReveal("TopWindow", "TopPosition"); HandleWindowReveal("OtherWindow", "OtherPosition"); *************** *** 1316,1331 **** DialogueFlags |= DF_FREEZE_SCRIPTS; } ! ieDword index; ! core->GetDictionary()->Lookup( "MessageWindowSize", index ); ! if (index == 0) { ! // FIXME: should use RunEventHandler() ! core->GetGUIScriptEngine()->RunFunction( "OnIncreaseSize" ); ! core->GetGUIScriptEngine()->RunFunction( "OnIncreaseSize" ); ! } else { ! if (index == 1) { ! // FIXME: should use RunEventHandler() ! core->GetGUIScriptEngine()->RunFunction( "OnIncreaseSize" ); ! } ! } DialogChoose( (unsigned int) -1 ); } --- 1320,1326 ---- DialogueFlags |= DF_FREEZE_SCRIPTS; } ! //opening control size to maximum ! ieDword index = core->GetGame()->ControlStatus&~3; ! core->GetGame()->SetControlStatus(index + 2, BM_SET); DialogChoose( (unsigned int) -1 ); } *************** *** 1344,1350 **** ((Actor *) target)->TalkCount++; } ! } else { ! printf("Ending dialog with target %s but no talkcount increase*****\n", ((Actor *) target)->LongName); ! } //this could be wrong target->CurrentAction = NULL; --- 1339,1343 ---- ((Actor *) target)->TalkCount++; } ! } //this could be wrong target->CurrentAction = NULL; *************** *** 1360,1366 **** dlg = NULL; } ! // FIXME: should use RunEventHandler() ! core->GetGUIScriptEngine()->RunFunction( "OnDecreaseSize" ); ! core->GetGUIScriptEngine()->RunFunction( "OnDecreaseSize" ); ScreenFlags &=~(SF_DISABLEMOUSE|SF_LOCKSCROLL); DialogueFlags = 0; --- 1353,1359 ---- dlg = NULL; } ! //minimizing size ! ieDword index = core->GetGame()->ControlStatus&~3; ! core->GetGame()->SetControlStatus(index, BM_SET); ScreenFlags &=~(SF_DISABLEMOUSE|SF_LOCKSCROLL); DialogueFlags = 0; *************** *** 1370,1383 **** { char Tmp[256]; - ieDword index; ! if (!core->GetDictionary()->Lookup( "MessageWindow", index )) { ! return; ! } ! Window* win = core->GetWindow( index ); ! if (!core->GetDictionary()->Lookup( "MessageTextArea", index )) { return; ! } ! TextArea* ta = ( TextArea* ) win->GetControl( index ); //get the first state with true triggers! if (choose == (unsigned int) -1) { --- 1363,1371 ---- { char Tmp[256]; ! TextArea* ta = core->GetMessageTextArea(); ! if (!ta) return; ! //get the first state with true triggers! if (choose == (unsigned int) -1) { *************** *** 1405,1408 **** --- 1393,1404 ---- } core->GetGame()->AddJournalEntry(tr->journalStrRef, Section, tr->Flags>>16); + /* is this + char *string = core->GetString( tr->journalStrRef ); + core->DisplayString( string ); + free( string ); + */ + /* or this + core->DisplayConstantString(STR_JOURNALCHANGE,0xffff00); + */ // your journal has changed... // JournalChanged = true; *************** *** 1411,1419 **** ta->PopLines( ds->transitionsCount + 1 ); if (tr->textStrRef != 0xffffffff) { - /* - char *string = core->GetString( tr->textStrRef ); - AddTalk( ta, speaker, "A0A0FF", string, "8080FF" ); - free( string ); - */ core->DisplayStringName( tr->textStrRef, 0x8080FF, speaker); } --- 1407,1410 ---- *************** *** 1443,1447 **** //increasing talkcount here if we switched talker if (DialogueFlags&DF_TALKCOUNT) { ! printf("Increasing talkcount\n"); if (target->Type == ST_ACTOR) { ((Actor *) target)->TalkCount++; --- 1434,1438 ---- //increasing talkcount here if we switched talker if (DialogueFlags&DF_TALKCOUNT) { ! DialogueFlags&=~DF_TALKCOUNT; if (target->Type == ST_ACTOR) { ((Actor *) target)->TalkCount++; *************** *** 1457,1461 **** } // we have to make a backup, tr->Dialog is freed ! char tmpresref[9]; strnuprcpy(tmpresref,tr->Dialog, 8); InitDialog( speaker, target, tmpresref ); --- 1448,1452 ---- } // we have to make a backup, tr->Dialog is freed ! ieResRef tmpresref; strnuprcpy(tmpresref,tr->Dialog, 8); InitDialog( speaker, target, tmpresref ); *************** *** 1463,1471 **** ds = dlg->GetState( si ); } - /* - char* string = core->GetString( ds->StrRef, IE_STR_SOUND|IE_STR_SPEECH); - AddTalk( ta, target, "FF0000", string, "70FF70" ); - free( string ); - */ core->DisplayStringName( ds->StrRef, 0x70FF70, target ); int i; --- 1454,1457 ---- *************** *** 1509,1513 **** scr->timeStartDisplaying = 0; scr->Pos = p; ! scr->MySelf = NULL; infoTexts.push_back( scr ); } --- 1495,1499 ---- scr->timeStartDisplaying = 0; scr->Pos = p; ! scr->CutSceneId = NULL; infoTexts.push_back( scr ); } *************** *** 1522,1526 **** scr->timeStartDisplaying = target->timeStartDisplaying; scr->Pos = target->Pos; ! scr->MySelf = target; infoTexts.push_back( scr ); } --- 1508,1512 ---- scr->timeStartDisplaying = target->timeStartDisplaying; scr->Pos = target->Pos; ! scr->CutSceneId = target; infoTexts.push_back( scr ); } |