From: Laszlo T. <ave...@us...> - 2005-03-19 17:30:24
|
Update of /cvsroot/gemrb/gemrb/gemrb/plugins/Core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18937 Modified Files: GameScript.cpp GameScript.h SoundMgr.h Log Message: Added some gamescript actions dealing with movies, animations, ambients Index: GameScript.cpp =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/Core/GameScript.cpp,v retrieving revision 1.246 retrieving revision 1.247 diff -C2 -d -r1.246 -r1.247 *** GameScript.cpp 15 Mar 2005 17:53:13 -0000 1.246 --- GameScript.cpp 19 Mar 2005 17:30:09 -0000 1.247 *************** *** 315,318 **** --- 315,319 ---- {"createitem", GameScript::CreateItem,0}, {"createitemglobal", GameScript::CreateItemNumGlobal,0}, + {"createitemnumglobal", GameScript::CreateItemNumGlobal,0}, {"createpartygold", GameScript::CreatePartyGold,0}, {"createvisualeffect", GameScript::CreateVisualEffect,0}, *************** *** 324,327 **** --- 325,329 ---- {"debugoutput", GameScript::Debug,0}, {"deletejournalentry", GameScript::RemoveJournalEntry,0}, + {"demoend", GameScript::QuitGame, 0}, //same for now {"destroyalldestructableequipment", GameScript::DestroyAllDestructableEquipment,0}, {"destroyallequipment", GameScript::DestroyAllEquipment,0}, *************** *** 338,349 **** --- 340,354 ---- {"displaystringheadowner", GameScript::DisplayStringHeadOwner,0}, {"displaystringheaddead", GameScript::DisplayStringHead,0}, //same? + {"displaystringnoname", GameScript::DisplayStringNoName,0}, {"displaystringnonamehead", GameScript::DisplayStringNoNameHead,0}, {"displaystringwait", GameScript::DisplayStringWait,AF_BLOCKING}, {"dropinventory", GameScript::DropInventory, 0}, {"dropitem", GameScript::DropItem, AF_BLOCKING}, + {"endcredits", GameScript::EndCredits, 0},//movie {"endcutscenemode", GameScript::EndCutSceneMode,0}, {"enemy", GameScript::Enemy,0}, {"equipitem", GameScript::EquipItem, AF_BLOCKING}, {"erasejournalentry", GameScript::RemoveJournalEntry,0}, + {"expansionendcredits", GameScript::QuitGame, 0},//ends game too {"explore", GameScript::Explore,0}, {"exploremapchunk", GameScript::ExploreMapChunk,0}, *************** *** 394,397 **** --- 399,403 ---- {"globalxor", GameScript::GlobalXor,AF_MERGESTRINGS}, {"globalxorglobal", GameScript::GlobalXorGlobal,AF_MERGESTRINGS}, + {"gotostartscreen", GameScript::QuitGame, 0}, {"help", GameScript::Help,0}, {"hideareaonmap", GameScript::HideAreaOnMap,0}, *************** *** 475,478 **** --- 481,485 ---- {"reputationinc", GameScript::ReputationInc,0}, {"reputationset", GameScript::ReputationSet,0}, + {"resetfogofwar", GameScript::UndoExplore,0}, //pst {"restorepartylocations", GameScript:: RestorePartyLocation,0}, //this is in iwd2, same as movetosavedlocation, with a default variable *************** *** 537,540 **** --- 544,548 ---- {"sinisterpoof", GameScript::CreateVisualEffect,0}, {"smallwait", GameScript::SmallWait,AF_BLOCKING}, + {"soundactivate", GameScript::SoundActivate,0}, {"startcutscene", GameScript::StartCutScene,0}, {"startcutscenemode", GameScript::StartCutSceneMode,0}, *************** *** 6102,6105 **** --- 6110,6118 ---- } + void GameScript::DisplayStringNoName(Scriptable* Sender, Action* parameters) + { + DisplayStringCore( Sender, parameters->int0Parameter, DS_CONSOLE|DS_NONAME); + } + void GameScript::DisplayStringNoNameHead(Scriptable* Sender, Action* parameters) { *************** *** 6549,6552 **** --- 6562,6577 ---- } + // not in IESDP but this one should affect ambients + void GameScript::SoundActivate(Scriptable* /*Sender*/, Action* parameters) + { + AmbientMgr * ambientmgr = core->GetSoundMgr()->GetAmbientMgr(); + if(ambientmgr->isActive(parameters->objects[1]->objectName) != parameters->int0Parameter) { + ambientmgr->activate(parameters->objects[1]->objectName); + } else { + ambientmgr->deactivate(parameters->objects[1]->objectName); + } + } + + // according to IESDP this action is about animations void GameScript::AmbientActivate(Scriptable* /*Sender*/, Action* parameters) { *************** *** 6560,6563 **** --- 6585,6630 ---- } + void GameScript::StaticStart(Scriptable* /*Sender*/, Action* parameters) + { + Animation *anim = core->GetGame()->GetCurrentMap()->GetAnimation(parameters->objects[1]->objectName); + if (!anim) { + printf( "Script error: No Animation Named \"%s\"\n", + parameters->objects[1]->objectName ); + return; + } + anim->Active = true; + } + + void GameScript::StaticStop(Scriptable* /*Sender*/, Action* parameters) + { + Animation *anim = core->GetGame()->GetCurrentMap()->GetAnimation(parameters->objects[1]->objectName); + if (!anim) { + printf( "Script error: No Animation Named \"%s\"\n", + parameters->objects[1]->objectName ); + return; + } + anim->Active = false; + } + + void GameScript::StaticPalette(Scriptable* /*Sender*/, Action* parameters) + { + Animation *anim = core->GetGame()->GetCurrentMap()->GetAnimation(parameters->objects[1]->objectName); + if (!anim) { + printf( "Script error: No Animation Named \"%s\"\n", + parameters->objects[1]->objectName ); + return; + } + ImageMgr *bmp = (ImageMgr *) core->GetInterface( IE_BMP_CLASS_ID); + if (!bmp) { + return; + } + DataStream* s = core->GetResourceMgr()->GetResource( parameters->string0Parameter, IE_BMP_CLASS_ID ); + bmp->Open( s, true ); + Color *pal = (Color *) malloc( sizeof(Color*) * 256 ); + bmp->GetPalette( 0, 256, pal ); + core->FreeInterface( bmp ); + anim->SetPalette( pal ); + } + void GameScript::WaitAnimation(Scriptable* Sender, Action* parameters) { *************** *** 8333,8336 **** --- 8400,8413 ---- } + void GameScript::EndCredits(Scriptable* /*Sender*/, Action* /*parameters*/) + { + core->PlayMovie("credits"); + } + + void GameScript::ExpansionEndCredits(Scriptable* /*Sender*/, Action* /*parameters*/) + { + core->PlayMovie("ecredit"); + } + void GameScript::QuitGame(Scriptable* /*Sender*/, Action* /*parameters*/) { Index: GameScript.h =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/Core/GameScript.h,v retrieving revision 1.163 retrieving revision 1.164 diff -C2 -d -r1.163 -r1.164 *** GameScript.h 14 Mar 2005 09:08:57 -0000 1.163 --- GameScript.h 19 Mar 2005 17:30:10 -0000 1.164 *************** *** 978,988 **** --- 978,991 ---- static void DisplayStringHead(Scriptable* Sender, Action* parameters); static void DisplayStringHeadOwner(Scriptable* Sender, Action* parameters); + static void DisplayStringNoName(Scriptable* Sender, Action* parameters); static void DisplayStringNoNameHead(Scriptable* Sender, Action* parameters); static void DisplayStringWait(Scriptable* Sender, Action* parameters); static void DropInventory(Scriptable* Sender, Action* parameters); static void DropItem(Scriptable* Sender, Action* parameters); + static void EndCredits(Scriptable* Sender, Action* parameters); static void EndCutSceneMode(Scriptable* Sender, Action* parameters); static void Enemy(Scriptable* Sender, Action* parameters); static void EquipItem(Scriptable *Sender, Action *parameters); + static void ExpansionEndCredits(Scriptable* Sender, Action* parameters); static void Explore(Scriptable *Sender, Action *parameters); static void ExploreMapChunk(Scriptable *Sender, Action *parameters); *************** *** 1145,1148 **** --- 1148,1152 ---- static void Shout(Scriptable* Sender, Action* parameters); static void SmallWait(Scriptable* Sender, Action* parameters); + static void SoundActivate(Scriptable* Sender, Action* parameters); static void StartCutScene(Scriptable* Sender, Action* parameters); static void StartCutSceneMode(Scriptable* Sender, Action* parameters); *************** *** 1159,1162 **** --- 1163,1169 ---- static void StartSong(Scriptable* Sender, Action* parameters); static void StartStore(Scriptable* Sender, Action* parameters); + static void StaticPalette(Scriptable* Sender, Action* parameters); + static void StaticStart(Scriptable* Sender, Action* parameters); + static void StaticStop(Scriptable* Sender, Action* parameters); static void StopMoving(Scriptable* Sender, Action* parameters); static void StorePartyLocation(Scriptable *Sender, Action* parameters); Index: SoundMgr.h =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/Core/SoundMgr.h,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** SoundMgr.h 23 Feb 2005 20:47:01 -0000 1.17 --- SoundMgr.h 19 Mar 2005 17:30:11 -0000 1.18 *************** *** 24,29 **** #include "Plugin.h" ! ! class AmbientMgr; #define GEM_SND_RELATIVE 1 --- 24,28 ---- #include "Plugin.h" ! #include "AmbientMgr.h" #define GEM_SND_RELATIVE 1 |