From: Laszlo T. <ave...@us...> - 2005-11-30 19:47:12
|
Update of /cvsroot/gemrb/gemrb/gemrb/plugins/Core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15142/Core Modified Files: Actor.cpp Actor.h GSUtils.cpp Game.cpp Game.h GameControl.cpp GameScript.h Log Message: playing animation specific attack/death sounds (needs much more work) fixed a portrait problem in CREImp Index: Actor.cpp =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/Core/Actor.cpp,v retrieving revision 1.137 retrieving revision 1.138 diff -C2 -d -r1.137 -r1.138 *** Actor.cpp 26 Nov 2005 20:33:48 -0000 1.137 --- Actor.cpp 30 Nov 2005 19:47:02 -0000 1.138 *************** *** 29,33 **** #include "Game.h" #include "GameScript.h" ! extern Interface* core; --- 29,33 ---- #include "Game.h" #include "GameScript.h" ! #include "GSUtils.h" //needed for DisplayStringCore extern Interface* core; *************** *** 705,708 **** --- 705,709 ---- ClearPath(); SetModal( 0 ); + DisplayStringCore(this, VB_DIE, DS_CONSOLE|DS_CONST ); if (!InParty) { Actor *act=NULL; *************** *** 1066,1067 **** --- 1067,1097 ---- NULL, IE_FONT_ALIGN_CENTER | IE_FONT_ALIGN_TOP, false ); } + + void Actor::ResolveStringConstant(ieResRef Sound, unsigned int index) + { + TableMgr * tab; + + Sound[0]=0; + int table=core->LoadTable( anims->ResRef ); + + if (table<0) { + return; + } + tab = core->GetTable( table ); + if (!tab) { + goto end; + } + + switch (index) { + case VB_ATTACK: + index = 0; + break; + case VB_DIE: + index = 10; + break; + } + strnuprcpy(Sound, tab->QueryField (index, 0), 8); + end: + core->DelTable( table ); + + } Index: Actor.h =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/Core/Actor.h,v retrieving revision 1.88 retrieving revision 1.89 diff -C2 -d -r1.88 -r1.89 *** Actor.h 24 Nov 2005 17:53:27 -0000 1.88 --- Actor.h 30 Nov 2005 19:47:02 -0000 1.89 *************** *** 323,326 **** --- 323,328 ---- /* re/draws overhead text on the map screen */ void DrawOverheadText(Region &screen); + /* resolve string constant */ + void ResolveStringConstant(ieResRef sound, unsigned int index); }; #endif Index: Game.h =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/Core/Game.h,v retrieving revision 1.69 retrieving revision 1.70 diff -C2 -d -r1.69 -r1.70 *** Game.h 27 Nov 2005 23:21:16 -0000 1.69 --- Game.h 30 Nov 2005 19:47:02 -0000 1.70 *************** *** 271,274 **** --- 271,276 ---- } void ShareXP(int XP, bool divide); + /** returns true if we should start the party overflow window */ + bool PartyOverflow(); /** returns true if the party death condition is true */ bool EveryoneDead() const; Index: GSUtils.cpp =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/Core/GSUtils.cpp,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** GSUtils.cpp 24 Nov 2005 17:44:08 -0000 1.33 --- GSUtils.cpp 30 Nov 2005 19:47:02 -0000 1.34 *************** *** 235,249 **** void DisplayStringCore(Scriptable* Sender, int Strref, int flags) { printf( "Displaying string on: %s\n", Sender->GetScriptName() ); ! if (flags & DS_CONST ) { Actor* actor = ( Actor* ) Sender; ! Strref=actor->StrRefs[Strref]; ! } ! StringBlock sb = core->strings->GetStringBlock( Strref ); ! if (flags & DS_HEAD) { ! Sender->DisplayHeadText( sb.text ); } ! if (flags & DS_CONSOLE) { ! core->DisplayString( sb.text ); } if (sb.Sound[0] ) { --- 235,257 ---- void DisplayStringCore(Scriptable* Sender, int Strref, int flags) { + StringBlock sb; + printf( "Displaying string on: %s\n", Sender->GetScriptName() ); ! if ((flags & DS_CONST) && (Sender->Type==ST_ACTOR) ) { Actor* actor = ( Actor* ) Sender; ! int tmp=actor->StrRefs[Strref]; ! if (tmp == -1) { ! actor->ResolveStringConstant( sb.Sound, (unsigned int) Strref); ! } ! Strref = tmp; } ! if (Strref != -1) { ! sb = core->strings->GetStringBlock( Strref ); ! if (flags & DS_HEAD) { ! Sender->DisplayHeadText( sb.text ); ! } ! if (flags & DS_CONSOLE) { ! core->DisplayString( sb.text ); ! } } if (sb.Sound[0] ) { Index: GameScript.h =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/Core/GameScript.h,v retrieving revision 1.223 retrieving revision 1.224 diff -C2 -d -r1.223 -r1.224 *** GameScript.h 27 Nov 2005 23:21:17 -0000 1.223 --- GameScript.h 30 Nov 2005 19:47:02 -0000 1.224 *************** *** 41,46 **** #define DS_NONAME 16 ! //verbal constant #define VB_ATTACK 9 //diffmode (iwd2) --- 41,47 ---- #define DS_NONAME 16 ! //verbal constant (bg2), we need a lookup table for other games #define VB_ATTACK 9 + #define VB_DIE 19 //diffmode (iwd2) Index: GameControl.cpp =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/Core/GameControl.cpp,v retrieving revision 1.265 retrieving revision 1.266 diff -C2 -d -r1.265 -r1.266 *** GameControl.cpp 27 Nov 2005 23:21:16 -0000 1.265 --- GameControl.cpp 30 Nov 2005 19:47:02 -0000 1.266 *************** *** 642,645 **** --- 642,654 ---- break; + case 'q': //joins actor + if (lastActor && !lastActor->InParty) { + lastActor->ClearActions(); + lastActor->ClearPath(); + char Tmp[40]; + strncpy(Tmp,"JoinParty()",sizeof(Tmp) ); + lastActor->AddAction( GenerateAction(Tmp) ); + } + break; case 'y': //kills actor if (lastActor) { Index: Game.cpp =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/Core/Game.cpp,v retrieving revision 1.98 retrieving revision 1.99 diff -C2 -d -r1.98 -r1.99 *** Game.cpp 27 Nov 2005 23:21:16 -0000 1.98 --- Game.cpp 30 Nov 2005 19:47:02 -0000 1.99 *************** *** 836,839 **** --- 836,855 ---- } + //returns true if there are excess players in the team + bool Game::PartyOverflow() + { + GameControl *gc = core->GetGameControl(); + if (!gc) { + return false; + } + //don't start this screen when the gui is busy + if (gc->GetDialogueFlags() & (DF_IN_DIALOG|DF_IN_CONTAINER|DF_FREEZE_SCRIPTS) ) { + return false; + } + if (!partysize) { + return false; + } + return (PCs.size()>partysize); + } //returns true if the protagonist (or the whole party died) bool Game::EveryoneDead() const *************** *** 877,882 **** return; } ! if (PCs.size()>partysize) { ! core->GetGUIScriptEngine()->RunFunction("ReformPartyWindow"); return; } --- 893,899 ---- return; } ! if (PartyOverflow()) { ! partysize = 0; ! core->GetGUIScriptEngine()->RunFunction("OpenReformPartyWindow"); return; } *************** *** 891,895 **** void Game::SetPartySize(int size) { ! if (size<1) { return; } --- 908,913 ---- void Game::SetPartySize(int size) { ! // 0 size means no party size control ! if (size<0) { return; } |