From 0c7077cab93131a0902ccb3b5e1a85e2b5557908 Mon Sep 17 00:00:00 2001 From: Peter Kohaut Date: Sat, 12 Jan 2019 18:11:38 +0100 Subject: BLADERUNNER: Added debugging output for scripts Also added last few missing script commands. --- engines/bladerunner/ambient_sounds.cpp | 5 + engines/bladerunner/ambient_sounds.h | 1 + engines/bladerunner/bladerunner.cpp | 3 + engines/bladerunner/bladerunner.h | 4 + engines/bladerunner/dialogue_menu.cpp | 16 ++ engines/bladerunner/dialogue_menu.h | 1 + engines/bladerunner/game_constants.h | 4 + engines/bladerunner/script/ai/howie_lee.cpp | 4 +- engines/bladerunner/script/ai/mutant1.cpp | 4 +- engines/bladerunner/script/ai/mutant2.cpp | 4 +- engines/bladerunner/script/ai/mutant3.cpp | 4 +- engines/bladerunner/script/ai/steele.cpp | 2 +- engines/bladerunner/script/ai/transient.cpp | 12 +- engines/bladerunner/script/scene/ct04.cpp | 34 ++-- engines/bladerunner/script/scene/ps04.cpp | 2 +- engines/bladerunner/script/scene/ug13.cpp | 6 +- engines/bladerunner/script/script.cpp | 246 ++++++++++++++++++++++++++-- engines/bladerunner/script/script.h | 4 +- 18 files changed, 304 insertions(+), 52 deletions(-) diff --git a/engines/bladerunner/ambient_sounds.cpp b/engines/bladerunner/ambient_sounds.cpp index c21f8d8b84..9485de339e 100644 --- a/engines/bladerunner/ambient_sounds.cpp +++ b/engines/bladerunner/ambient_sounds.cpp @@ -117,6 +117,11 @@ void AmbientSounds::playSound(int sfxId, int volume, int panStart, int panEnd, i _vm->_audioPlayer->playAud(_vm->_gameInfo->getSfxTrack(sfxId), volume * _ambientVolume / 100, panStart, panEnd, priority, kAudioPlayerOverrideVolume); } +void AmbientSounds::playSpeech(int actorId, int sentenceId, int volume, int panStart, int panEnd, int priority) { + Common::String name = Common::String::format( "%02d-%04d%s.AUD", actorId, sentenceId, _vm->_languageCode.c_str()); + _vm->_audioPlayer->playAud(name, volume * _ambientVolume / 100, panStart, panEnd, priority, kAudioPlayerOverrideVolume); +} + void AmbientSounds::addLoopingSound(int sfxId, int volume, int pan, int delay) { const Common::String &name = _vm->_gameInfo->getSfxTrack(sfxId); int32 hash = MIXArchive::getHash(name); diff --git a/engines/bladerunner/ambient_sounds.h b/engines/bladerunner/ambient_sounds.h index de08965a11..f52bdd443c 100644 --- a/engines/bladerunner/ambient_sounds.h +++ b/engines/bladerunner/ambient_sounds.h @@ -93,6 +93,7 @@ public: int panEndMin, int panEndMax, int priority, int unk); void playSound(int sfxId, int volume, int panStart, int panEnd, int priority); + void playSpeech(int actorId, int sentenceId, int volume, int panStart, int panEnd, int priority); void addLoopingSound(int sfxId, int volume, int pan, int delay); void adjustLoopingSound(int sfxId, int volume, int pan, int delay); diff --git a/engines/bladerunner/bladerunner.cpp b/engines/bladerunner/bladerunner.cpp index 08848190f3..5ac67acae7 100644 --- a/engines/bladerunner/bladerunner.cpp +++ b/engines/bladerunner/bladerunner.cpp @@ -81,6 +81,7 @@ #include "common/events.h" #include "common/savefile.h" #include "common/system.h" +#include "common/debug-channels.h" #include "engines/util.h" #include "engines/advancedDetector.h" @@ -93,6 +94,8 @@ BladeRunnerEngine::BladeRunnerEngine(OSystem *syst, const ADGameDescription *des : Engine(syst), _rnd("bladerunner") { + DebugMan.addDebugChannel(kDebugScript, "Script", "Debug the scripts"); + _windowIsActive = true; _gameIsRunning = true; diff --git a/engines/bladerunner/bladerunner.h b/engines/bladerunner/bladerunner.h index bb721c8736..6218aa44cd 100644 --- a/engines/bladerunner/bladerunner.h +++ b/engines/bladerunner/bladerunner.h @@ -51,6 +51,10 @@ struct ADGameDescription; namespace BladeRunner { +enum DebugLevels { + kDebugScript = 1 << 0 +}; + class Actor; class ActorDialogueQueue; class ScreenEffects; diff --git a/engines/bladerunner/dialogue_menu.cpp b/engines/bladerunner/dialogue_menu.cpp index 4f82326564..4491a94080 100644 --- a/engines/bladerunner/dialogue_menu.cpp +++ b/engines/bladerunner/dialogue_menu.cpp @@ -146,6 +146,22 @@ bool DialogueMenu::addToListNeverRepeatOnceSelected(int answer, int priorityPoli return addToList(answer, false, priorityPolite, priorityNormal, prioritySurly); } +bool DialogueMenu::removeFromList(int answer) { + int index = getAnswerIndex(answer); + if (index != -1) { + return false; + } + if (index < _listSize - 1) { + for (int i = index; i < _listSize; ++i) { + _items[index] = _items[index + 1]; + } + } + --_listSize; + + calculatePosition(); + return true; +} + int DialogueMenu::queryInput() { if (!_isVisible || _listSize == 0) { return -1; diff --git a/engines/bladerunner/dialogue_menu.h b/engines/bladerunner/dialogue_menu.h index 4029fe465b..d4c1ac0d0f 100644 --- a/engines/bladerunner/dialogue_menu.h +++ b/engines/bladerunner/dialogue_menu.h @@ -89,6 +89,7 @@ public: bool hide(); bool addToList(int answer, bool done, int priorityPolite, int priorityNormal, int prioritySurly); bool addToListNeverRepeatOnceSelected(int answer, int priorityPolite, int priorityNormal, int prioritySurly); + bool removeFromList(int answer); bool clearList(); int queryInput(); int listSize() const; diff --git a/engines/bladerunner/game_constants.h b/engines/bladerunner/game_constants.h index b584a801c9..68cbdef2be 100644 --- a/engines/bladerunner/game_constants.h +++ b/engines/bladerunner/game_constants.h @@ -505,6 +505,7 @@ enum Flags { kFlagPS02toPS03 = 132, kFlagPS02toPS09 = 133, kFlagPS05toPS06 = 136, + kFlagHomelessTalkedTo = 137, kFlagKleinInsulted = 138, kFlagRC02LucyDeskAvailable = 141, kFlagCT07toCT06 = 144, @@ -516,6 +517,7 @@ enum Flags { kFlagGuzzaTalkZubenRetired = 159, kFlagGuzzaTalkZubenEscaped = 160, kFlagChromeDebrisTaken = 163, + kFlagHomelessShot = 169, kFlagRC01PoliceDone = 186, kFlagShellCasingsTaken = 190, kFlagBoughtHowieLeeFood = 192, @@ -542,6 +544,7 @@ enum Flags { kFlagGenericWalkerWaiting = 443, kFlagMaggieIsHurt = 461, kFlagKIAPrivacyAddon = 487, + kFlagCT04HomelessTrashFinish = 492, kFlagCT07ZubenAttack = 516, kFlagKIAPrivacyAddonIntro = 599, kFlagMcCoySleeping = 647, @@ -962,6 +965,7 @@ enum GoalMcCoy { enum GoalTransient { kGoalTransientDefault = 0, + kGoalTransientCT04Leave = 2, }; enum GoalZuben { diff --git a/engines/bladerunner/script/ai/howie_lee.cpp b/engines/bladerunner/script/ai/howie_lee.cpp index f6d4d2cf48..27be2bd995 100644 --- a/engines/bladerunner/script/ai/howie_lee.cpp +++ b/engines/bladerunner/script/ai/howie_lee.cpp @@ -100,11 +100,11 @@ void AIScriptHowieLee::ClickedByPlayer() { void AIScriptHowieLee::EnteredScene(int sceneId) { if (Actor_Query_Goal_Number(kActorHowieLee) == 4 && Actor_Query_In_Set(kActorHowieLee, kSetCT03_CT04)) { - if (Game_Flag_Query(169) && !Game_Flag_Query(170) && !Game_Flag_Query(171)) { + if (Game_Flag_Query(kFlagHomelessShot) && !Game_Flag_Query(170) && !Game_Flag_Query(171)) { Game_Flag_Set(171); // return false; } - if (!Game_Flag_Query(169) && Game_Flag_Query(170) && !Game_Flag_Query(171) && Random_Query(1, 10) == 1) { + if (!Game_Flag_Query(kFlagHomelessShot) && Game_Flag_Query(170) && !Game_Flag_Query(171) && Random_Query(1, 10) == 1) { Game_Flag_Set(171); // return true; } diff --git a/engines/bladerunner/script/ai/mutant1.cpp b/engines/bladerunner/script/ai/mutant1.cpp index eb1c0562af..d9b309813d 100644 --- a/engines/bladerunner/script/ai/mutant1.cpp +++ b/engines/bladerunner/script/ai/mutant1.cpp @@ -178,7 +178,7 @@ bool AIScriptMutant1::GoalChanged(int currentGoalNumber, int newGoalNumber) { AI_Movement_Track_Append(kActorMutant1, 39, 0); AI_Movement_Track_Repeat(kActorMutant1); - if (Game_Flag_Query(169) == 1) { + if (Game_Flag_Query(kFlagHomelessShot)) { Actor_Set_Combat_Aggressiveness(kActorMutant1, 70); Actor_Set_Friendliness_To_Other(kActorMutant1, kActorMcCoy, 20); } @@ -352,7 +352,7 @@ bool AIScriptMutant1::GoalChanged(int currentGoalNumber, int newGoalNumber) { Actor_Set_Intelligence(kActorMutant1, 40); Actor_Set_Health(kActorMutant1, 10 * Query_Difficulty_Level() + 30, 10 * Query_Difficulty_Level() + 30); - if (Game_Flag_Query(169) == 1) { + if (Game_Flag_Query(kFlagHomelessShot)) { Actor_Set_Combat_Aggressiveness(kActorMutant1, 70); Actor_Set_Friendliness_To_Other(kActorMutant1, kActorMcCoy, 20); } else { diff --git a/engines/bladerunner/script/ai/mutant2.cpp b/engines/bladerunner/script/ai/mutant2.cpp index 6317311088..94be111865 100644 --- a/engines/bladerunner/script/ai/mutant2.cpp +++ b/engines/bladerunner/script/ai/mutant2.cpp @@ -162,7 +162,7 @@ bool AIScriptMutant2::GoalChanged(int currentGoalNumber, int newGoalNumber) { AI_Movement_Track_Append(kActorMutant2, 39, 0); AI_Movement_Track_Repeat(kActorMutant2); - if (Game_Flag_Query(169) == 1) { + if (Game_Flag_Query(kFlagHomelessShot)) { Actor_Set_Combat_Aggressiveness(kActorMutant2, 60); Actor_Set_Friendliness_To_Other(kActorMutant2, kActorMcCoy, 30); } @@ -334,7 +334,7 @@ bool AIScriptMutant2::GoalChanged(int currentGoalNumber, int newGoalNumber) { Actor_Set_Intelligence(kActorMutant2, 20); Actor_Set_Health(71, 10 * Query_Difficulty_Level() + 50, 10 * Query_Difficulty_Level() + 50); - if (Game_Flag_Query(169) == 1) { + if (Game_Flag_Query(kFlagHomelessShot)) { Actor_Set_Combat_Aggressiveness(kActorMutant2, 60); Actor_Set_Friendliness_To_Other(kActorMutant2, kActorMcCoy, 30); } else { diff --git a/engines/bladerunner/script/ai/mutant3.cpp b/engines/bladerunner/script/ai/mutant3.cpp index db161d8d5a..ff31d22061 100644 --- a/engines/bladerunner/script/ai/mutant3.cpp +++ b/engines/bladerunner/script/ai/mutant3.cpp @@ -175,7 +175,7 @@ bool AIScriptMutant3::GoalChanged(int currentGoalNumber, int newGoalNumber) { AI_Movement_Track_Append(kActorMutant3, 39, 0); AI_Movement_Track_Repeat(kActorMutant3); - if (Game_Flag_Query(169) == 1) { + if (Game_Flag_Query(kFlagHomelessShot)) { Actor_Set_Combat_Aggressiveness(kActorMutant3, 80); Actor_Set_Friendliness_To_Other(kActorMutant3, kActorMcCoy, 20); } @@ -345,7 +345,7 @@ bool AIScriptMutant3::GoalChanged(int currentGoalNumber, int newGoalNumber) { Actor_Set_Intelligence(kActorMutant3, 40); Actor_Set_Health(kActorMutant3, 10 * Query_Difficulty_Level() + 50, 10 * Query_Difficulty_Level() + 50); - if (Game_Flag_Query(169) == 1) { + if (Game_Flag_Query(kFlagHomelessShot)) { Actor_Set_Combat_Aggressiveness(kActorMutant3, 80); Actor_Set_Friendliness_To_Other(kActorMutant3, kActorMcCoy, 20); } else { diff --git a/engines/bladerunner/script/ai/steele.cpp b/engines/bladerunner/script/ai/steele.cpp index 830a9aaa73..9da49b259b 100644 --- a/engines/bladerunner/script/ai/steele.cpp +++ b/engines/bladerunner/script/ai/steele.cpp @@ -386,7 +386,7 @@ void AIScriptSteele::EnteredScene(int sceneId) { if (Actor_Query_Goal_Number(kActorSteele) != 5 || !Actor_Query_In_Set(kActorSteele, kSetCT03_CT04) - || Game_Flag_Query(169) != 1 + || !Game_Flag_Query(kFlagHomelessShot) || Game_Flag_Query(170) || Game_Flag_Query(171)) { return; //false; diff --git a/engines/bladerunner/script/ai/transient.cpp b/engines/bladerunner/script/ai/transient.cpp index 3c76e86e29..a8ff812c4b 100644 --- a/engines/bladerunner/script/ai/transient.cpp +++ b/engines/bladerunner/script/ai/transient.cpp @@ -47,14 +47,14 @@ bool AIScriptTransient::Update() { if (Global_Variable_Query(kVariableChapter) == 2 && (Actor_Query_Goal_Number(kActorTransient) == kGoalTransientDefault || Actor_Query_Goal_Number(kActorTransient) == 10)) { Actor_Set_Goal_Number(kActorTransient, 200); } - if (Global_Variable_Query(kVariableChapter) == 3 && Game_Flag_Query(169) && Game_Flag_Query(170) && !Game_Flag_Query(171) && !Game_Flag_Query(172)) { + if (Global_Variable_Query(kVariableChapter) == 3 && Game_Flag_Query(kFlagHomelessShot) && Game_Flag_Query(170) && !Game_Flag_Query(171) && !Game_Flag_Query(172)) { Game_Flag_Set(172); } if (Global_Variable_Query(kVariableChapter) < 4 && Game_Flag_Query(171) && Actor_Query_Goal_Number(kActorTransient) != 6 && Actor_Query_Goal_Number(kActorTransient) != 599) { Actor_Set_Goal_Number(kActorTransient, 6); } - if (Player_Query_Current_Scene() == kSceneCT04 && !Game_Flag_Query(492)) { - Game_Flag_Set(492); + if (Player_Query_Current_Scene() == kSceneCT04 && !Game_Flag_Query(kFlagCT04HomelessTrashFinish)) { + Game_Flag_Set(kFlagCT04HomelessTrashFinish); AI_Countdown_Timer_Reset(kActorTransient, 1); AI_Countdown_Timer_Start(kActorTransient, 1, 12); } @@ -142,7 +142,7 @@ bool AIScriptTransient::ShotAtAndHit() { Actor_Set_Goal_Number(kActorTransient, 599); } - Game_Flag_Set(169); + Game_Flag_Set(kFlagHomelessShot); return false; } @@ -161,7 +161,7 @@ int AIScriptTransient::GetFriendlinessModifierIfGetsClue(int otherActorId, int c bool AIScriptTransient::GoalChanged(int currentGoalNumber, int newGoalNumber) { switch (newGoalNumber) { - case 2: + case kGoalTransientCT04Leave: AI_Movement_Track_Flush(kActorTransient); AI_Movement_Track_Append(kActorTransient, 51, 0); AI_Movement_Track_Append(kActorTransient, 105, 0); @@ -312,7 +312,7 @@ bool AIScriptTransient::UpdateAnimation(int *animation, int *frame) { Actor_Set_Goal_Number(kActorTransient, 3); _animationState = 15; _animationFrame = Slice_Animation_Query_Number_Of_Frames(489) - 1; - Actor_Set_Targetable(kActorTransient, 0); + Actor_Set_Targetable(kActorTransient, false); Actor_Retired_Here(kActorTransient, 120, 24, 1, -1); } break; diff --git a/engines/bladerunner/script/scene/ct04.cpp b/engines/bladerunner/script/scene/ct04.cpp index fbc9c14b08..34480c7279 100644 --- a/engines/bladerunner/script/scene/ct04.cpp +++ b/engines/bladerunner/script/scene/ct04.cpp @@ -72,12 +72,12 @@ bool SceneScriptCT04::MouseClick(int x, int y) { } bool SceneScriptCT04::ClickedOn3DObject(const char *objectName, bool a2) { - if (objectName) { - if (!Game_Flag_Query(137) && !Game_Flag_Query(169) && !Actor_Query_Goal_Number(kActorTransient)) { - Game_Flag_Set(137); - Actor_Set_Goal_Number(kActorTransient, 2); + if (objectName) { // this can be only "DUMPSTER" + if (!Game_Flag_Query(kFlagHomelessTalkedTo) && !Game_Flag_Query(kFlagHomelessShot) && Actor_Query_Goal_Number(kActorTransient) == kGoalTransientDefault) { + Game_Flag_Set(kFlagHomelessTalkedTo); + Actor_Set_Goal_Number(kActorTransient, kGoalTransientCT04Leave); } - if (Game_Flag_Query(169) && !Game_Flag_Query(170) && !Game_Flag_Query(171) && !Game_Flag_Query(172) && Global_Variable_Query(kVariableChapter) == 1) { + if (Game_Flag_Query(kFlagHomelessShot) && !Game_Flag_Query(170) && !Game_Flag_Query(171) && !Game_Flag_Query(172) && Global_Variable_Query(kVariableChapter) == 1) { if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, -147.41f, -621.3f, 724.57f, 0, 1, false, 0)) { Player_Loses_Control(); Actor_Face_Heading(kActorMcCoy, 792, false); @@ -143,7 +143,7 @@ void SceneScriptCT04::dialogueWithHomeless() { Actor_Says(kActorTransient, 20, 14); Actor_Modify_Friendliness_To_Other(kActorTransient, kActorMcCoy, 5); if (Query_Difficulty_Level() != 0) { - Global_Variable_Decrement(2, 10); + Global_Variable_Decrement(kVariableChinyen, 10); } } else if (answer == 420) { Actor_Says(kActorMcCoy, 430, 3); @@ -154,28 +154,28 @@ void SceneScriptCT04::dialogueWithHomeless() { bool SceneScriptCT04::ClickedOnActor(int actorId) { if (actorId == kActorTransient) { - if (Game_Flag_Query(169)) { - if (!Loop_Actor_Walk_To_Actor(kActorMcCoy, kActorTransient, 36, 1, false)) { + if (Game_Flag_Query(kFlagHomelessShot)) { + if (!Loop_Actor_Walk_To_Actor(kActorMcCoy, kActorTransient, 36, true, false)) { Actor_Voice_Over(290, kActorVoiceOver); Actor_Voice_Over(300, kActorVoiceOver); Actor_Voice_Over(310, kActorVoiceOver); } } else { Actor_Set_Targetable(kActorTransient, false); - if (!Loop_Actor_Walk_To_Actor(kActorMcCoy, kActorTransient, 36, 1, false)) { + if (!Loop_Actor_Walk_To_Actor(kActorMcCoy, kActorTransient, 36, true, false)) { Actor_Face_Actor(kActorMcCoy, kActorTransient, true); - if (!Game_Flag_Query(137)) { + if (!Game_Flag_Query(kFlagHomelessTalkedTo)) { if (Game_Flag_Query(kFlagZubenRetired)) { Actor_Says(kActorMcCoy, 435, 3); - Actor_Set_Goal_Number(kActorTransient, 2); + Actor_Set_Goal_Number(kActorTransient, kGoalTransientCT04Leave); } else { Music_Stop(3); Actor_Says(kActorMcCoy, 425, 3); Actor_Says(kActorTransient, 0, 13); dialogueWithHomeless(); - Actor_Set_Goal_Number(kActorTransient, 2); + Actor_Set_Goal_Number(kActorTransient, kGoalTransientCT04Leave); } - Game_Flag_Set(137); + Game_Flag_Set(kFlagHomelessTalkedTo); } else { Actor_Face_Actor(kActorMcCoy, kActorTransient, true); Actor_Says(kActorMcCoy, 435, 3); @@ -194,10 +194,10 @@ bool SceneScriptCT04::ClickedOnItem(int itemId, bool a2) { bool SceneScriptCT04::ClickedOnExit(int exitId) { if (exitId == 1) { if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, -82.86f, -621.3f, 769.03f, 0, 1, false, 0)) { - Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Non_Looping_Sounds(true); Ambient_Sounds_Remove_All_Looping_Sounds(1); - if (!Actor_Query_Goal_Number(kActorTransient)) { - Actor_Set_Goal_Number(kActorTransient, 2); + if (Actor_Query_Goal_Number(kActorTransient) == kGoalTransientDefault) { + Actor_Set_Goal_Number(kActorTransient, kGoalTransientCT04Leave); } Game_Flag_Set(kFlagCT04toCT05); Set_Enter(kSetCT05, kSceneCT05); @@ -206,7 +206,7 @@ bool SceneScriptCT04::ClickedOnExit(int exitId) { } if (exitId == 0) { if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, -187.0f, -621.3f, 437.0f, 0, 1, false, 0)) { - Ambient_Sounds_Remove_All_Non_Looping_Sounds(1); + Ambient_Sounds_Remove_All_Non_Looping_Sounds(true); Ambient_Sounds_Remove_All_Looping_Sounds(1); Game_Flag_Set(kFlagCT04toCT03); Set_Enter(kSetCT03_CT04, kSceneCT03); diff --git a/engines/bladerunner/script/scene/ps04.cpp b/engines/bladerunner/script/scene/ps04.cpp index ac8f2dc66b..86f40f39b7 100644 --- a/engines/bladerunner/script/scene/ps04.cpp +++ b/engines/bladerunner/script/scene/ps04.cpp @@ -145,7 +145,7 @@ void SceneScriptPS04::sub_4017E4() { DM_Add_To_List_Never_Repeat_Once_Selected(150, 7, 6, 5); } } - if (Game_Flag_Query(169) == 1) { + if (Game_Flag_Query(kFlagHomelessShot)) { DM_Add_To_List_Never_Repeat_Once_Selected(140, 3, -1, -1); } DM_Add_To_List(130, 1, 1, 1); diff --git a/engines/bladerunner/script/scene/ug13.cpp b/engines/bladerunner/script/scene/ug13.cpp index cdfa8ad806..d2ae3b69d6 100644 --- a/engines/bladerunner/script/scene/ug13.cpp +++ b/engines/bladerunner/script/scene/ug13.cpp @@ -46,7 +46,7 @@ void SceneScriptUG13::InitializeScene() { Ambient_Sounds_Add_Sound(369, 2, 120, 11, 12, -100, 100, -100, 100, 0, 0); Ambient_Sounds_Add_Sound(397, 2, 120, 11, 12, -100, 100, -100, 100, 0, 0); Ambient_Sounds_Add_Sound(398, 2, 120, 11, 12, -100, 100, -100, 100, 0, 0); - if (Global_Variable_Query(kVariableChapter) == 4 && !Game_Flag_Query(169)) { + if (Global_Variable_Query(kVariableChapter) == 4 && !Game_Flag_Query(kFlagHomelessShot)) { Actor_Set_Goal_Number(kActorTransient, 390); } if (Actor_Query_Goal_Number(kActorTransient) == 599) { @@ -72,7 +72,7 @@ void SceneScriptUG13::SceneLoaded() { Clickable_Object("BASKET"); Clickable_Object("BOLLARD"); Unclickable_Object("BASKET"); - if (Global_Variable_Query(kVariableChapter) >= 3 && !Actor_Clue_Query(kActorMcCoy, kClueOriginalRequisitionForm) && Game_Flag_Query(169) && (Actor_Clue_Query(kActorMcCoy, kClueShippingForm) || Actor_Clue_Query(kActorMcCoy, kClueWeaponsOrderForm))) { + if (Global_Variable_Query(kVariableChapter) >= 3 && !Actor_Clue_Query(kActorMcCoy, kClueOriginalRequisitionForm) && Game_Flag_Query(kFlagHomelessShot) && (Actor_Clue_Query(kActorMcCoy, kClueShippingForm) || Actor_Clue_Query(kActorMcCoy, kClueWeaponsOrderForm))) { Item_Add_To_World(111, 958, 85, -209.01f, 70.76f, -351.79f, 0, 16, 12, false, true, false, true); } } @@ -234,7 +234,7 @@ void SceneScriptUG13::PlayerWalkedIn() { Game_Flag_Reset(429); Player_Gains_Control(); } - if (Actor_Query_Goal_Number(kActorTransient) >= 390 && !Game_Flag_Query(169)) { + if (Actor_Query_Goal_Number(kActorTransient) >= 390 && !Game_Flag_Query(kFlagHomelessShot)) { if (Game_Flag_Query(553)) { if (Random_Query(1, 3) == 1) { Actor_Set_Goal_Number(kActorTransient, 395); diff --git a/engines/bladerunner/script/script.cpp b/engines/bladerunner/script/script.cpp index a154269dcf..dbc193301a 100644 --- a/engines/bladerunner/script/script.cpp +++ b/engines/bladerunner/script/script.cpp @@ -60,6 +60,8 @@ #include "bladerunner/vector.h" #include "bladerunner/waypoints.h" +#include "common/debug-channels.h" + namespace BladeRunner { ScriptBase::ScriptBase(BladeRunnerEngine *vm) { @@ -67,37 +69,46 @@ ScriptBase::ScriptBase(BladeRunnerEngine *vm) { } void ScriptBase::Preload(int animationId) { + debugC(8, kDebugScript, "Preload(%d)", animationId); _vm->_sliceRenderer->preload(animationId); } void ScriptBase::Actor_Put_In_Set(int actorId, int setId) { + debugC(kDebugScript, "Actor_Put_In_Set(%d, %d)", actorId, setId); _vm->_actors[actorId]->setSetId(setId); } void ScriptBase::Actor_Set_At_XYZ(int actorId, float x, float y, float z, int direction) { + debugC(kDebugScript, "Actor_Set_At_XYZ(%d, %f, %f, %f, %d)", actorId, x, y, z, direction); _vm->_actors[actorId]->setAtXYZ(Vector3(x, y, z), direction); } void ScriptBase::Actor_Set_At_Waypoint(int actorId, int waypointId, int angle) { + debugC(kDebugScript, "Actor_Set_At_Waypoint(%d, %d, %d)", actorId, waypointId, angle); _vm->_actors[actorId]->setAtWaypoint(waypointId, angle, 0, false); } bool ScriptBase::Region_Check(int left, int top, int right, int down) { + debugC(kDebugScript, "Region_Check(%d, %d, %d, %d)", left, top, right, down); //TODO: return _vm->_mouse.x >= left && _vm->_mouse.y >= top && _vm->_mouse.x <= right && _vm->_mouse.y <= down; warning("Region_Check(%d, %d, %d, %d)", left, top, right, down); + return false; } bool ScriptBase::Object_Query_Click(const char *objectName1, const char *objectName2) { + debugC(8, kDebugScript, "Object_Query_Click(%s, %s)", objectName1, objectName2); return strcmp(objectName1, objectName2) == 0; } void ScriptBase::Object_Do_Ground_Click() { + debugC(kDebugScript, "Object_Do_Ground_Click()"); //This is not implemented in game return; } bool ScriptBase::Object_Mark_For_Hot_Mouse(const char *objectName) { + debugC(kDebugScript, "Object_Mark_For_Hot_Mouse(%s)", objectName); int objectId = _vm->_scene->findObject(objectName); if (objectId == -1) return false; @@ -105,146 +116,181 @@ bool ScriptBase::Object_Mark_For_Hot_Mouse(const char *objectName) { } void ScriptBase::Actor_Face_Actor(int actorId, int otherActorId, bool animate) { + debugC(kDebugScript, "Actor_Face_Actor(%d, %d, %d)", actorId, otherActorId, animate); _vm->_actors[actorId]->faceActor(otherActorId, animate); } void ScriptBase::Actor_Face_Object(int actorId, const char *objectName, bool animate) { + debugC(kDebugScript, "Actor_Face_Object(%d, %s, %d)", actorId, objectName, animate); _vm->_actors[actorId]->faceObject(objectName, animate); } void ScriptBase::Actor_Face_Item(int actorId, int itemId, bool animate) { + debugC(kDebugScript, "Actor_Face_Item(%d, %d, %d)", actorId, itemId, animate); _vm->_actors[actorId]->faceItem(itemId, animate); } void ScriptBase::Actor_Face_Waypoint(int actorId, int waypointId, bool animate) { + debugC(kDebugScript, "Actor_Face_Waypoint(%d, %d, %d)", actorId, waypointId, animate); _vm->_actors[actorId]->faceWaypoint(waypointId, animate); } void ScriptBase::Actor_Face_XYZ(int actorId, float x, float y, float z, bool animate) { + debugC(kDebugScript, "Actor_Face_XYZ(%d, %f, %f, %f, %d)", actorId, x, y, z, animate); _vm->_actors[actorId]->faceXYZ(x, y, z, animate); } void ScriptBase::Actor_Face_Current_Camera(int actorId, bool animate) { + debugC(kDebugScript, "Actor_Face_Current_Camera(%d, %d)", actorId, animate); _vm->_actors[actorId]->faceCurrentCamera(animate); } void ScriptBase::Actor_Face_Heading(int actorId, int heading, bool animate) { + debugC(kDebugScript, "Actor_Face_Heading(%d, %d, %d)", actorId, heading, animate); _vm->_actors[actorId]->faceHeading(heading, true); } int ScriptBase::Actor_Query_Friendliness_To_Other(int actorId, int otherActorId) { + debugC(8, kDebugScript, "Actor_Query_Friendliness_To_Other(%d, %d)", actorId, otherActorId); return _vm->_actors[actorId]->getFriendlinessToOther(otherActorId); } void ScriptBase::Actor_Modify_Friendliness_To_Other(int actorId, int otherActorId, signed int change) { + debugC(kDebugScript, "Actor_Modify_Friendliness_To_Other(%d, %d, %d)", actorId, otherActorId, change); _vm->_actors[actorId]->modifyFriendlinessToOther(otherActorId, change); } void ScriptBase::Actor_Set_Friendliness_To_Other(int actorId, int otherActorId, int friendliness) { + debugC(kDebugScript, "Actor_Set_Friendliness_To_Other(%d, %d, %d)", actorId, otherActorId, friendliness); _vm->_actors[actorId]->setFriendlinessToOther(otherActorId, friendliness); } void ScriptBase::Actor_Set_Honesty(int actorId, int honesty) { + debugC(kDebugScript, "Actor_Set_Honesty(%d, %d)", actorId, honesty); _vm->_actors[actorId]->setHonesty(honesty); } void ScriptBase::Actor_Set_Intelligence(int actorId, int intelligence) { + debugC(kDebugScript, "Actor_Set_Intelligence(%d, %d)", actorId, intelligence); _vm->_actors[actorId]->setIntelligence(intelligence); } void ScriptBase::Actor_Set_Stability(int actorId, int stability) { + debugC(kDebugScript, "Actor_Set_Stability(%d, %d)", actorId, stability); _vm->_actors[actorId]->setStability(stability); } void ScriptBase::Actor_Set_Combat_Aggressiveness(int actorId, int combatAggressiveness) { + debugC(kDebugScript, "Actor_Set_Combat_Aggressiveness(%d, %d)", actorId, combatAggressiveness); _vm->_actors[actorId]->setCombatAggressiveness(combatAggressiveness); } int ScriptBase::Actor_Query_Current_HP(int actorId) { + debugC(8, kDebugScript, "Actor_Query_Current_HP(%d)", actorId); return _vm->_actors[actorId]->getCurrentHP(); } int ScriptBase::Actor_Query_Max_HP(int actorId) { + debugC(8, kDebugScript, "Actor_Query_Max_HP(%d)", actorId); return _vm->_actors[actorId]->getMaxHP(); } int ScriptBase::Actor_Query_Combat_Aggressiveness(int actorId) { + debugC(8, kDebugScript, "Actor_Query_Combat_Aggressiveness(%d)", actorId); return _vm->_actors[actorId]->getCombatAggressiveness(); } int ScriptBase::Actor_Query_Honesty(int actorId) { + debugC(8, kDebugScript, "Actor_Query_Honesty(%d)", actorId); return _vm->_actors[actorId]->getHonesty(); } int ScriptBase::Actor_Query_Intelligence(int actorId) { + debugC(8, kDebugScript, "Actor_Query_Intelligence(%d)", actorId); return _vm->_actors[actorId]->getIntelligence(); } int ScriptBase::Actor_Query_Stability(int actorId) { + debugC(8, kDebugScript, "Actor_Query_Stability(%d)", actorId); return _vm->_actors[actorId]->getStability(); } void ScriptBase::Actor_Modify_Current_HP(int actorId, signed int change) { + debugC(kDebugScript, "Actor_Modify_Current_HP(%d, %d)", actorId, change); _vm->_actors[actorId]->modifyCurrentHP(change); } void ScriptBase::Actor_Modify_Max_HP(int actorId, signed int change) { + debugC(kDebugScript, "Actor_Modify_Max_HP(%d, %d)", actorId, change); _vm->_actors[actorId]->modifyMaxHP(change); } void ScriptBase::Actor_Modify_Combat_Aggressiveness(int actorId, signed int change) { + debugC(kDebugScript, "Actor_Modify_Combat_Aggressiveness(%d, %d)", actorId, change); _vm->_actors[actorId]->modifyCombatAggressiveness(change); } void ScriptBase::Actor_Modify_Honesty(int actorId, signed int change) { + debugC(kDebugScript, "Actor_Modify_Honesty(%d, %d)", actorId, change); _vm->_actors[actorId]->modifyHonesty(change); } void ScriptBase::Actor_Modify_Intelligence(int actorId, signed int change) { + debugC(kDebugScript, "Actor_Modify_Intelligence(%d, %d)", actorId, change); _vm->_actors[actorId]->modifyIntelligence(change); } void ScriptBase::Actor_Modify_Stability(int actorId, signed int change) { + debugC(kDebugScript, "Actor_Modify_Stability(%d, %d)", actorId, change); _vm->_actors[actorId]->modifyStability(change); } void ScriptBase::Actor_Set_Flag_Damage_Anim_If_Moving(int actorId, bool value) { + debugC(kDebugScript, "Actor_Set_Flag_Damage_Anim_If_Moving(%d, %d)", actorId, value); _vm->_actors[actorId]->setFlagDamageAnimIfMoving(value); } bool ScriptBase::Actor_Query_Flag_Damage_Anim_If_Moving(int actorId) { + debugC(8, kDebugScript, "Actor_Query_Flag_Damage_Anim_If_Moving(%d)", actorId); return _vm->_actors[actorId]->getFlagDamageAnimIfMoving(); } void ScriptBase::Actor_Combat_AI_Hit_Attempt(int actorId) { - if (_vm->_actors[actorId]->inCombat()) + debugC(kDebugScript, "Actor_Combat_AI_Hit_Attempt(%d)", actorId); + if (_vm->_actors[actorId]->inCombat()) { _vm->_actors[actorId]->_combatInfo->hitAttempt(); + } } void ScriptBase::Non_Player_Actor_Combat_Mode_On(int actorId, int initialState, bool rangedAttack, int enemyId, int waypointType, int animationModeCombatIdle, int animationModeCombatWalk, int animationModeCombatRun, int fleeRatio, int coverRatio, int actionRatio, int damage, int range, bool unstoppable) { + debugC(kDebugScript, "Non_Player_Actor_Combat_Mode_On(%d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d)", actorId, initialState, rangedAttack, enemyId, waypointType, animationModeCombatIdle, animationModeCombatWalk, animationModeCombatRun, fleeRatio, coverRatio, actionRatio, damage, range, unstoppable); _vm->_actors[actorId]->combatModeOn(initialState, rangedAttack, enemyId, waypointType, animationModeCombatIdle, animationModeCombatWalk, animationModeCombatRun, fleeRatio, coverRatio, actionRatio, damage, range, unstoppable); } void ScriptBase::Non_Player_Actor_Combat_Mode_Off(int actorId) { + debugC(kDebugScript, "Non_Player_Actor_Combat_Mode_Off(%d)", actorId); _vm->_actors[actorId]->combatModeOff(); } void ScriptBase::Actor_Set_Health(int actorId, int hp, int maxHp) { + debugC(kDebugScript, "Actor_Set_Health(%d, %d, %d)", actorId, hp, maxHp); _vm->_actors[actorId]->setHealth(hp, maxHp); } void ScriptBase::Actor_Set_Targetable(int actorId, bool targetable) { + debugC(kDebugScript, "Actor_Set_Targetable(%d, %d)", actorId, targetable); _vm->_actors[actorId]->setTarget(targetable); - } -void ScriptBase::Actor_Says(int actorId, int sentenceId, int animationMode){ +void ScriptBase::Actor_Says(int actorId, int sentenceId, int animationMode) { + debugC(kDebugScript, "Actor_Says(%d, %d, %d)", actorId, sentenceId, animationMode); _vm->loopActorSpeaking(); _vm->_actorDialogueQueue->flush(1, true); Actor_Says_With_Pause(actorId, sentenceId, 0.5f, animationMode); } void ScriptBase::Actor_Says_With_Pause(int actorId, int sentenceId, float pause, int animationMode) { + debugC(kDebugScript, "Actor_Says_With_Pause(%d, %d, %f, %d)", actorId, sentenceId, pause, animationMode); _vm->gameWaitForActive(); _vm->loopActorSpeaking(); _vm->_actorDialogueQueue->flush(1, true); @@ -296,6 +342,7 @@ void ScriptBase::Actor_Says_With_Pause(int actorId, int sentenceId, float pause, } void ScriptBase::Actor_Voice_Over(int sentenceId, int actorId) { + debugC(kDebugScript, "Actor_Voice_Over(%d, %d)", sentenceId, actorId); assert(actorId < BladeRunnerEngine::kActorCount); _vm->gameWaitForActive(); @@ -318,29 +365,35 @@ void ScriptBase::Actor_Voice_Over(int sentenceId, int actorId) { } void ScriptBase::Actor_Start_Speech_Sample(int actorId, int sentenceId) { + debugC(kDebugScript, "Actor_Start_Speech_Sample(%d, %d)", actorId, sentenceId); _vm->loopActorSpeaking(); _vm->_actors[actorId]->speechPlay(sentenceId, false); } void ScriptBase::Actor_Start_Voice_Over_Sample(int sentenceId) { + debugC(kDebugScript, "Actor_Start_Voice_Over_Sample(%d)", sentenceId); _vm->loopActorSpeaking(); _vm->_actors[kActorVoiceOver]->speechPlay(sentenceId, true); } int ScriptBase::Actor_Query_Which_Set_In(int actorId) { + debugC(8, kDebugScript, "Actor_Query_Which_Set_In(%d)", actorId); return _vm->_actors[actorId]->getSetId(); } bool ScriptBase::Actor_Query_Is_In_Current_Set(int actorId) { + debugC(8, kDebugScript, "Actor_Query_Is_In_Current_Set(%d)", actorId); int actorSetId = _vm->_actors[actorId]->getSetId(); return actorSetId >= 0 && actorSetId == _vm->_scene->getSetId(); } bool ScriptBase::Actor_Query_In_Set(int actorId, int setId) { + debugC(8, kDebugScript, "Actor_Query_In_Set(%d, %d)", actorId, setId); return _vm->_actors[actorId]->getSetId() == setId; } int ScriptBase::Actor_Query_Inch_Distance_From_Actor(int actorId, int otherActorId) { + debugC(8, kDebugScript, "Actor_Query_Inch_Distance_From_Actor(%d, %d)", actorId, otherActorId); if (_vm->_actors[actorId]->getSetId() != _vm->_actors[otherActorId]->getSetId()) { return 0.0f; } @@ -348,6 +401,7 @@ int ScriptBase::Actor_Query_Inch_Distance_From_Actor(int actorId, int otherActor } int ScriptBase::Actor_Query_Inch_Distance_From_Waypoint(int actorId, int waypointId) { + debugC(8, kDebugScript, "Actor_Query_Inch_Distance_From_Waypoint(%d, %d)", actorId, waypointId); if (_vm->_actors[actorId]->getSetId() != _vm->_waypoints->getSetId(waypointId)) return 0; @@ -363,6 +417,7 @@ int ScriptBase::Actor_Query_Inch_Distance_From_Waypoint(int actorId, int waypoin } bool ScriptBase::Actor_Query_In_Between_Two_Actors(int actorId, int otherActor1Id, int otherActor2Id) { + debugC(8, kDebugScript, "Actor_Query_In_Between_Two_Actors(%d, %d, %d)", actorId, otherActor1Id, otherActor2Id); float x1 = _vm->_actors[otherActor1Id]->getX(); float z1 = _vm->_actors[otherActor1Id]->getZ(); float x2 = _vm->_actors[otherActor2Id]->getX(); @@ -375,40 +430,49 @@ bool ScriptBase::Actor_Query_In_Between_Two_Actors(int actorId, int otherActor1I } void ScriptBase::Actor_Set_Goal_Number(int actorId, int goalNumber) { + debugC(kDebugScript, "Actor_Set_Goal_Number(%d, %d)", actorId, goalNumber); _vm->_actors[actorId]->setGoal(goalNumber); } int ScriptBase::Actor_Query_Goal_Number(int actorId) { + debugC(8, kDebugScript, "Actor_Query_Goal_Number(%d)", actorId); return _vm->_actors[actorId]->getGoal(); } void ScriptBase::Actor_Query_XYZ(int actorId, float *x, float *y, float *z) { + debugC(8, kDebugScript, "Actor_Query_XYZ(%d, ptr, ptr, ptr)", actorId); *x = _vm->_actors[actorId]->getX(); *y = _vm->_actors[actorId]->getY(); *z = _vm->_actors[actorId]->getZ(); } int ScriptBase::Actor_Query_Facing_1024(int actorId) { + debugC(8, kDebugScript, "Actor_Query_Facing_1024(%d)", actorId); return _vm->_actors[actorId]->getFacing(); } void ScriptBase::Actor_Set_Frame_Rate_FPS(int actorId, int fps) { + debugC(kDebugScript, "Actor_Set_Frame_Rate_FPS(%d, %d)", actorId, fps); _vm->_actors[actorId]->setFPS(fps); } int ScriptBase::Slice_Animation_Query_Number_Of_Frames(int animation) { + debugC(8, kDebugScript, "Slice_Animation_Query_Number_Of_Frames(%d)", animation); return _vm->_sliceAnimations->getFrameCount(animation); } void ScriptBase::Actor_Change_Animation_Mode(int actorId, int animationMode) { + debugC(kDebugScript, "Actor_Change_Animation_Mode(%d, %d)", actorId, animationMode); _vm->_actors[actorId]->changeAnimationMode(animationMode, false); } int ScriptBase::Actor_Query_Animation_Mode(int actorId) { + debugC(8, kDebugScript, "Actor_Query_Animation_Mode(%d)", actorId); return _vm->_actors[actorId]->getAnimationMode(); } bool ScriptBase::Loop_Actor_Walk_To_Actor(int actorId, int otherActorId, int distance, bool interruptible, bool run) { + debugC(kDebugScript, "Loop_Actor_Walk_To_Actor(%d, %d, %d, %d, %d)", actorId, otherActorId, distance, interruptible, run); _vm->gameWaitForActive(); if (_vm->_runningActorId == actorId) { @@ -433,6 +497,7 @@ bool ScriptBase::Loop_Actor_Walk_To_Actor(int actorId, int otherActorId, int dis } bool ScriptBase::Loop_Actor_Walk_To_Item(int actorId, int itemId, int destinationOffset, bool interruptible, bool run) { + debugC(kDebugScript, "Loop_Actor_Walk_To_Item(%d, %d, %d, %d, %d)", actorId, itemId, destinationOffset, interruptible, run); _vm->gameWaitForActive(); if (_vm->_runningActorId == actorId) { @@ -457,6 +522,7 @@ bool ScriptBase::Loop_Actor_Walk_To_Item(int actorId, int itemId, int destinatio } bool ScriptBase::Loop_Actor_Walk_To_Scene_Object(int actorId, const char *objectName, int destinationOffset, bool interruptible, bool run) { + debugC(kDebugScript, "Loop_Actor_Walk_To_Scene_Object(%d, %s, %d, %d, %d)", actorId, objectName, destinationOffset, interruptible, run); _vm->gameWaitForActive(); if (_vm->_runningActorId == actorId) { @@ -481,6 +547,7 @@ bool ScriptBase::Loop_Actor_Walk_To_Scene_Object(int actorId, const char *object } bool ScriptBase::Loop_Actor_Walk_To_Waypoint(int actorId, int waypointId, int destinationOffset, bool interruptible, bool run) { + debugC(kDebugScript, "Loop_Actor_Walk_To_Waypoint(%d, %d, %d, %d, %d)", actorId, waypointId, destinationOffset, interruptible, run); _vm->gameWaitForActive(); if (_vm->_runningActorId == actorId) { @@ -505,6 +572,7 @@ bool ScriptBase::Loop_Actor_Walk_To_Waypoint(int actorId, int waypointId, int de } bool ScriptBase::Loop_Actor_Walk_To_XYZ(int actorId, float x, float y, float z, int destinationOffset, bool interruptible, bool run, int a7) { + debugC(kDebugScript, "Loop_Actor_Walk_To_XYZ(%d, %f, %f, %f, %d, %d, %d, %d)", actorId, x, y, z, destinationOffset, interruptible, run, a7); _vm->gameWaitForActive(); if (_vm->_runningActorId == actorId) { @@ -532,6 +600,7 @@ bool ScriptBase::Loop_Actor_Walk_To_XYZ(int actorId, float x, float y, float z, } void ScriptBase::Async_Actor_Walk_To_Waypoint(int actorId, int waypointId, int destinationOffset, bool run) { + debugC(kDebugScript, "Async_Actor_Walk_To_Waypoint(%d, %d, %d, %d)", actorId, waypointId, destinationOffset, run); _vm->gameWaitForActive(); if (_vm->_runningActorId == actorId) { @@ -542,6 +611,7 @@ void ScriptBase::Async_Actor_Walk_To_Waypoint(int actorId, int waypointId, int d } void ScriptBase::Async_Actor_Walk_To_XYZ(int actorId, float x, float y, float z, int destinationOffset, bool run) { + debugC(kDebugScript, "Async_Actor_Walk_To_XYZ(%d, %f, %f, %f, %d, %d)", actorId, x, y, z, destinationOffset, run); _vm->gameWaitForActive(); if (_vm->_runningActorId == actorId) { @@ -552,11 +622,12 @@ void ScriptBase::Async_Actor_Walk_To_XYZ(int actorId, float x, float y, float z, } void ScriptBase::Actor_Force_Stop_Walking(int actorId) { - //TODO - warning("Loop_Actor_Travel_Stairs(%d)", actorId); + debugC(kDebugScript, "Actor_Force_Stop_Walking(%d)", actorId); + _vm->_actors[actorId]->stopWalking(true); } void ScriptBase::Loop_Actor_Travel_Stairs(int actorId, int stepCount, bool up, int animationModeEnd) { + debugC(kDebugScript, "Loop_Actor_Travel_Stairs(%d, %d, %d, %d)", actorId, stepCount, up, animationModeEnd); _vm->gameWaitForActive(); Player_Loses_Control(); @@ -600,6 +671,7 @@ void ScriptBase::Loop_Actor_Travel_Stairs(int actorId, int stepCount, bool up, i } void ScriptBase::Loop_Actor_Travel_Ladder(int actorId, int stepCount, bool up, int animationModeEnd) { + debugC(kDebugScript, "Loop_Actor_Travel_Ladder(%d, %d, %d, %d)", actorId, stepCount, up, animationModeEnd); _vm->gameWaitForActive(); Player_Loses_Control(); @@ -643,46 +715,57 @@ void ScriptBase::Loop_Actor_Travel_Ladder(int actorId, int stepCount, bool up, i } void ScriptBase::Actor_Clue_Add_To_Database(int actorId, int clueId, int weight, bool clueAcquired, bool unknownFlag, int fromActorId) { + debugC(kDebugScript, "Actor_Clue_Add_To_Database(%d, %d, %d, %d, %d, %d)", actorId, clueId, weight, clueAcquired, unknownFlag, fromActorId); _vm->_actors[actorId]->addClueToDatabase(clueId, weight, clueAcquired, unknownFlag, fromActorId); } void ScriptBase::Actor_Clue_Acquire(int actorId, int clueId, bool unknownFlag, int fromActorId) { + debugC(kDebugScript, "Actor_Clue_Acquire(%d, %d, %d, %d)", actorId, clueId, unknownFlag, fromActorId); _vm->_actors[actorId]->acquireClue(clueId, unknownFlag, fromActorId); } void ScriptBase::Actor_Clue_Lose(int actorId, int clueId) { + debugC(kDebugScript, "Actor_Clue_Lose(%d, %d)", actorId, clueId); _vm->_actors[actorId]->loseClue(clueId); } bool ScriptBase::Actor_Clue_Query(int actorId, int clueId) { + debugC(8, kDebugScript, "Actor_Clue_Query(%d, %d)", actorId, clueId); return _vm->_actors[actorId]->hasClue(clueId); } void ScriptBase::Actor_Clues_Transfer_New_To_Mainframe(int actorId) { + debugC(kDebugScript, "Actor_Clues_Transfer_New_To_Mainframe(%d)", actorId); _vm->_actors[actorId]->copyClues(kActorVoiceOver); } void ScriptBase::Actor_Clues_Transfer_New_From_Mainframe(int actorId) { + debugC(kDebugScript, "Actor_Clues_Transfer_New_From_Mainframe(%d)", actorId); _vm->_actors[kActorVoiceOver]->copyClues(actorId); } void ScriptBase::Actor_Set_Invisible(int actorId, bool isInvisible) { + debugC(kDebugScript, "Actor_Set_Invisible(%d, %d)", actorId, isInvisible); _vm->_actors[actorId]->setInvisible(isInvisible); } void ScriptBase::Actor_Set_Immunity_To_Obstacles(int actorId, bool isImmune) { + debugC(kDebugScript, "Actor_Set_Immunity_To_Obstacles(%d, %d)", actorId, isImmune); _vm->_actors[actorId]->setImmunityToObstacles(isImmune); } void ScriptBase::Item_Add_To_World(int itemId, int animationId, int setId, float x, float y, float z, signed int facing, int height, int width, bool isTargetable, bool isObstacle, bool isPoliceMazeEnemy, bool updateOnly) { + debugC(kDebugScript, "Item_Add_To_World(%d, %d, %d, %f, %f, %f, %d, %d, %d, %d, %d, %d, %d)", itemId, animationId, setId, x, y, z, facing, height, width, isTargetable, isObstacle, isPoliceMazeEnemy, updateOnly); _vm->_items->addToWorld(itemId, animationId, setId, Vector3(x, y, z), facing, height, width, isTargetable, isObstacle, isPoliceMazeEnemy, updateOnly == 0); } void ScriptBase::Item_Remove_From_World(int itemId) { + debugC(kDebugScript, "Item_Remove_From_World(%d)", itemId); _vm->_items->remove(itemId); } void ScriptBase::Item_Spin_In_World(int itemId) { + debugC(kDebugScript, "Item_Spin_In_World(%d)", itemId); _vm->_items->spinInWorld(itemId); if (_vm->_items->isPoliceMazeEnemy(itemId)) { Police_Maze_Increment_Score(1); @@ -692,14 +775,17 @@ void ScriptBase::Item_Spin_In_World(int itemId) { } void ScriptBase::Item_Flag_As_Target(int itemId) { + debugC(kDebugScript, "Item_Flag_As_Target(%d)", itemId); _vm->_items->setIsTarget(itemId, true); } void ScriptBase::Item_Flag_As_Non_Target(int itemId) { + debugC(kDebugScript, "Item_Flag_As_Non_Target(%d)", itemId); _vm->_items->setIsTarget(itemId, false); } void ScriptBase::Item_Pickup_Spin_Effect(int animationId, int x, int y) { + debugC(kDebugScript, "Item_Pickup_Spin_Effect(%d, %d, %d)", animationId, x, y); _vm->_itemPickup->setup(animationId, x, y); } @@ -729,6 +815,7 @@ int ScriptBase::Animation_Skip_To_Frame() { } void ScriptBase::Delay(int miliseconds) { + debugC(kDebugScript, "Delay(%d)", miliseconds); Player_Loses_Control(); int endTime = _vm->_time->current() + miliseconds; while (_vm->_gameIsRunning && (_vm->_time->current() < endTime)) { @@ -738,14 +825,17 @@ void ScriptBase::Delay(int miliseconds) { } void ScriptBase::Player_Loses_Control() { + debugC(kDebugScript, "Player_Loses_Control()"); _vm->playerLosesControl(); } void ScriptBase::Player_Gains_Control() { + debugC(kDebugScript, "Player_Gains_Control()"); _vm->playerGainsControl(); } void ScriptBase::Player_Set_Combat_Mode(bool activate) { + debugC(kDebugScript, "Player_Set_Combat_Mode(%d)", activate); if (!_vm->_combat->isActive() || activate) { if (!_vm->_combat->isActive() && activate) { _vm->_combat->activate(); @@ -756,10 +846,12 @@ void ScriptBase::Player_Set_Combat_Mode(bool activate) { } bool ScriptBase::Player_Query_Combat_Mode() { + debugC(8, kDebugScript, "Player_Query_Combat_Mode()"); return _vm->_combat->isActive(); } void ScriptBase::Player_Set_Combat_Mode_Access(bool enable) { + debugC(kDebugScript, "Player_Set_Combat_Mode_Access(%d)", enable); if (enable) { _vm->_combat->enable(); } else { @@ -768,80 +860,98 @@ void ScriptBase::Player_Set_Combat_Mode_Access(bool enable) { } int ScriptBase::Player_Query_Current_Set() { + debugC(8, kDebugScript, "Player_Query_Current_Set()"); return _vm->_scene->getSetId(); } int ScriptBase::Player_Query_Current_Scene() { + debugC(8, kDebugScript, "Player_Query_Current_Scene()"); return _vm->_scene->getSceneId(); } int ScriptBase::Player_Query_Agenda() { + debugC(8, kDebugScript, "Player_Query_Agenda()"); return _vm->_settings->getPlayerAgenda(); } void ScriptBase::Player_Set_Agenda(int agenda) { + debugC(kDebugScript, "Player_Set_Agenda(%d)", agenda); _vm->_settings->setPlayerAgenda(agenda); } int ScriptBase::Query_Difficulty_Level() { + debugC(8, kDebugScript, "Query_Difficulty_Level()"); return _vm->_settings->getDifficulty(); } - void ScriptBase::Game_Flag_Set(int flag) { + debugC(kDebugScript, "Game_Flag_Set(%d)", flag); _vm->_gameFlags->set(flag); } void ScriptBase::Game_Flag_Reset(int flag) { + debugC(kDebugScript, "Game_Flag_Reset(%d)", flag); _vm->_gameFlags->reset(flag); } bool ScriptBase::Game_Flag_Query(int flag) { + debugC(8, kDebugScript, "Game_Flag_Query(%d)", flag); return _vm->_gameFlags->query(flag); } void ScriptBase::Set_Enter(int setId, int sceneId) { + debugC(kDebugScript, "Set_Enter(%d, %d)", setId, sceneId); _vm->_settings->setNewSetAndScene(setId, sceneId); } void ScriptBase::Chapter_Enter(int chapter, int setId, int sceneId) { + debugC(kDebugScript, "Chapter_Enter(%d, %d, %d)", chapter, setId, sceneId); _vm->_settings->setChapter(chapter); Set_Enter(setId, sceneId); } int ScriptBase::Global_Variable_Set(int var, int value) { + debugC(kDebugScript, "Global_Variable_Set(%d, %d)", var, value); return _vm->_gameVars[var] = value; } int ScriptBase::Global_Variable_Reset(int var) { + debugC(kDebugScript, "Global_Variable_Reset(%d)", var); return _vm->_gameVars[var] = 0; } int ScriptBase::Global_Variable_Query(int var) { + debugC(8, kDebugScript, "Global_Variable_Query(%d)", var); return _vm->_gameVars[var]; } int ScriptBase::Global_Variable_Increment(int var, int inc) { + debugC(kDebugScript, "Global_Variable_Increment(%d, %d)", var, inc); return _vm->_gameVars[var] += inc; } int ScriptBase::Global_Variable_Decrement(int var, int dec) { + debugC(kDebugScript, "Global_Variable_Decrement(%d, %d)", var, dec); return _vm->_gameVars[var] -= dec; } int ScriptBase::Random_Query(int min, int max) { + debugC(9, kDebugScript, "Random_Query(%d, %d)", min, max); return _vm->_rnd.getRandomNumberRng(min, max); } void ScriptBase::Sound_Play(int id, int volume, int panFrom, int panTo, int priority) { + debugC(6, kDebugScript, "Sound_Play(%d, %d, %d, %d, %d)", id, volume, panFrom, panTo, priority); _vm->_audioPlayer->playAud(_vm->_gameInfo->getSfxTrack(id), volume, panFrom, panTo, priority); } void ScriptBase::Sound_Play_Speech_Line(int actorId, int sentenceId, int volume, int a4, int priority) { + debugC(kDebugScript, "Sound_Play_Speech_Line(%d, %d, %d, %d, %d)", actorId, sentenceId, volume, a4, priority); _vm->_audioSpeech->playSpeechLine(actorId, sentenceId, volume, a4, priority); } void ScriptBase::Sound_Left_Footstep_Walk(int actorId) { + debugC(6, kDebugScript, "Sound_Left_Footstep_Walk(%d)", actorId); int walkboxId = _vm->_actors[actorId]->getWalkbox(); if (walkboxId < 0) { walkboxId = 0; @@ -853,6 +963,7 @@ void ScriptBase::Sound_Left_Footstep_Walk(int actorId) { } void ScriptBase::Sound_Right_Footstep_Walk(int actorId) { + debugC(6, kDebugScript, "Sound_Right_Footstep_Walk(%d)", actorId); int walkboxId = _vm->_actors[actorId]->getWalkbox(); if (walkboxId < 0) { walkboxId = 0; @@ -864,6 +975,7 @@ void ScriptBase::Sound_Right_Footstep_Walk(int actorId) { } void ScriptBase::Sound_Left_Footstep_Run(int actorId) { + debugC(6, kDebugScript, "Sound_Left_Footstep_Run(%d)", actorId); int walkboxId = _vm->_actors[actorId]->getWalkbox(); if (walkboxId < 0) { walkboxId = 0; @@ -875,6 +987,7 @@ void ScriptBase::Sound_Left_Footstep_Run(int actorId) { } void ScriptBase::Sound_Right_Footstep_Run(int actorId) { + debugC(6, kDebugScript, "Sound_Right_Footstep_Run(%d)", actorId); int walkboxId = _vm->_actors[actorId]->getWalkbox(); if (walkboxId < 0) { walkboxId = 0; @@ -888,46 +1001,57 @@ void ScriptBase::Sound_Right_Footstep_Run(int actorId) { // ScriptBase::Sound_Walk_Shuffle_Stop void ScriptBase::Footstep_Sounds_Set(int walkboxId, int stepSound) { + debugC(kDebugScript, "Footstep_Sounds_Set(%d, %d)", walkboxId, stepSound); _vm->_scene->_set->setWalkboxStepSound(walkboxId, stepSound); } void ScriptBase::Footstep_Sound_Override_On(int footstepSoundOverride) { + debugC(kDebugScript, "Footstep_Sound_Override_On(%d)", footstepSoundOverride); _vm->_scene->_set->setFoodstepSoundOverride(footstepSoundOverride); } void ScriptBase::Footstep_Sound_Override_Off() { + debugC(kDebugScript, "Footstep_Sound_Override_Off()"); _vm->_scene->_set->resetFoodstepSoundOverride(); } bool ScriptBase::Music_Play(int musicId, int volume, int pan, int timeFadeIn, int timePlay, int loop, int timeFadeOut) { + debugC(kDebugScript, "Music_Play(%d, %d, %d, %d, %d, %d, %d)", musicId, volume, pan, timeFadeIn, timePlay, loop, timeFadeOut); return _vm->_music->play(_vm->_gameInfo->getMusicTrack(musicId), volume, pan, timeFadeIn, timePlay, loop, timeFadeOut); } void ScriptBase::Music_Adjust(int volume, int pan, int delay) { + debugC(kDebugScript, "Music_Adjust(%d, %d, %d)", volume, pan, delay); _vm->_music->adjust(volume, pan, delay); } void ScriptBase::Music_Stop(int delay) { + debugC(kDebugScript, "Music_Stop(%d)", delay); _vm->_music->stop(delay); } bool ScriptBase::Music_Is_Playing() { + debugC(8, kDebugScript, "Music_Is_Playing()"); return _vm->_music->isPlaying(); } void ScriptBase::Overlay_Play(const char *overlay, int loopId, bool loopForever, bool startNow, int a5) { + debugC(kDebugScript, "Overlay_Play(%s, %d, %d, %d, %d)", overlay, loopId, loopForever, startNow, a5); _vm->_overlays->play(overlay, loopId, loopForever, startNow, a5); } void ScriptBase::Overlay_Remove(const char *overlay) { + debugC(kDebugScript, "Overlay_Remove(%s)", overlay); _vm->_overlays->remove(overlay); } void ScriptBase::Scene_Loop_Set_Default(int loopId) { + debugC(kDebugScript, "Scene_Loop_Set_Default(%d)", loopId); _vm->_scene->loopSetDefault(loopId); } void ScriptBase::Scene_Loop_Start_Special(int sceneLoopMode, int loopId, bool immediately) { + debugC(kDebugScript, "Scene_Loop_Start_Special(%d, %d, %d)", sceneLoopMode, loopId, immediately); if (sceneLoopMode == kSceneLoopModeOnce) { immediately = true; } @@ -938,56 +1062,69 @@ void ScriptBase::Scene_Loop_Start_Special(int sceneLoopMode, int loopId, bool im } void ScriptBase::Outtake_Play(int id, int noLocalization, int container) { + debugC(kDebugScript, "Outtake_Play(%d, %d, %d)", id, noLocalization, container); _vm->outtakePlay(id, noLocalization, container); } void ScriptBase::Ambient_Sounds_Add_Sound(int sfxId, int timeMin, int timeMax, int volumeMin, int volumeMax, int panStartMin, int panStartMax, int panEndMin, int panEndMax, int priority, int unk) { + debugC(kDebugScript, "Ambient_Sounds_Add_Sound(%d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d)", sfxId, timeMin, timeMax, volumeMin, volumeMax, panStartMin, panStartMax, panEndMin, panEndMax, priority, unk); _vm->_ambientSounds->addSound(sfxId, timeMin, timeMax, volumeMin, volumeMax, panStartMin, panStartMax, panEndMin, panEndMax, priority, unk); } void ScriptBase::Ambient_Sounds_Remove_Sound(int sfxId, bool stopPlaying) { + debugC(kDebugScript, "Ambient_Sounds_Remove_Sound(%d, %d)", sfxId, stopPlaying); _vm->_ambientSounds->removeNonLoopingSound(sfxId, stopPlaying); } void ScriptBase::Ambient_Sounds_Add_Speech_Sound(int actorId, int sentenceId, int timeMin, int timeMax, int volumeMin, int volumeMax, int panStartMin, int panStartMax, int panEndMin, int panEndMax, int priority, int unk){ + debugC(kDebugScript, "Ambient_Sounds_Add_Speech_Sound(%d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d)", actorId, sentenceId, timeMin, timeMax, volumeMin, volumeMax, panStartMin, panStartMax, panEndMin, panEndMax, priority, unk); _vm->_ambientSounds->addSpeech(actorId, sentenceId, timeMin, timeMax, volumeMin, volumeMax, panStartMin, panStartMax, panEndMin, panEndMax, priority, unk); } // ScriptBase::Ambient_Sounds_Remove_Speech_Sound void ScriptBase::Ambient_Sounds_Play_Sound(int sfxId, int volume, int panStart, int panEnd, int priority) { + debugC(kDebugScript, "Ambient_Sounds_Play_Sound(%d, %d, %d, %d, %d)", sfxId, volume, panStart, panEnd, priority); _vm->_ambientSounds->playSound(sfxId, volume, panStart, panEnd, priority); } -void ScriptBase::Ambient_Sounds_Play_Speech_Sound(int actorId, int sfxId, int volume, int panStart, int panEnd, int priority) { - warning("STIB: Ambient_Sounds_Play_Speech_Sound()"); +void ScriptBase::Ambient_Sounds_Play_Speech_Sound(int actorId, int sentenceId, int volume, int panStart, int panEnd, int priority) { + debugC(kDebugScript, "Ambient_Sounds_Play_Speech_Sound(%d, %d, %d, %d, %d, %d)", actorId, sentenceId, volume, panStart, panEnd, priority); + _vm->_ambientSounds->playSpeech(actorId, sentenceId, volume, panStart, panEnd, priority); } void ScriptBase::Ambient_Sounds_Remove_All_Non_Looping_Sounds(bool stopPlaying) { + debugC(kDebugScript, "Ambient_Sounds_Remove_All_Non_Looping_Sounds(%d)", stopPlaying); _vm->_ambientSounds->removeAllNonLoopingSounds(stopPlaying); } void ScriptBase::Ambient_Sounds_Add_Looping_Sound(int sfxId, int volume, int pan, int delay) { + debugC(kDebugScript, "Ambient_Sounds_Add_Looping_Sound(%d, %d, %d, %d)", sfxId, volume, pan, delay); _vm->_ambientSounds->addLoopingSound(sfxId, volume, pan, delay); } void ScriptBase::Ambient_Sounds_Adjust_Looping_Sound(int sfxId, int volume, int pan, int delay) { + debugC(kDebugScript, "Ambient_Sounds_Adjust_Looping_Sound(%d, %d, %d, %d)", sfxId, volume, pan, delay); _vm->_ambientSounds->adjustLoopingSound(sfxId, volume, pan, delay); } void ScriptBase::Ambient_Sounds_Remove_Looping_Sound(int sfxId, int delay){ + debugC(kDebugScript, "Ambient_Sounds_Remove_Looping_Sound(%d, %d)", sfxId, delay); _vm->_ambientSounds->removeLoopingSound(sfxId, delay); } void ScriptBase::Ambient_Sounds_Remove_All_Looping_Sounds(int delay) { + debugC(kDebugScript, "Ambient_Sounds_Remove_All_Looping_Sounds(%d)", delay); _vm->_ambientSounds->removeAllLoopingSounds(delay); } void ScriptBase::Setup_Scene_Information(float actorX, float actorY, float actorZ, int actorFacing) { + debugC(kDebugScript, "Setup_Scene_Information(%f, %f, %f, %d)", actorX, actorY, actorZ, actorFacing); _vm->_scene->setActorStart(Vector3(actorX, actorY, actorZ), actorFacing); } bool ScriptBase::Dialogue_Menu_Appear(int x, int y) { + debugC(kDebugScript, "Dialogue_Menu_Appear(%d, %d)", x, y); if (!_vm->_dialogueMenu->isVisible()) { return _vm->_dialogueMenu->show(); } @@ -995,6 +1132,7 @@ bool ScriptBase::Dialogue_Menu_Appear(int x, int y) { } bool ScriptBase::Dialogue_Menu_Disappear() { + debugC(kDebugScript, "Dialogue_Menu_Disappear()"); if (_vm->_dialogueMenu->isVisible()) { return _vm->_dialogueMenu->hide(); } @@ -1002,87 +1140,105 @@ bool ScriptBase::Dialogue_Menu_Disappear() { } bool ScriptBase::Dialogue_Menu_Clear_List() { + debugC(kDebugScript, "Dialogue_Menu_Clear_List()"); _vm->_dialogueMenu->clearList(); return false; } bool ScriptBase::Dialogue_Menu_Add_To_List(int answer) { + debugC(kDebugScript, "Dialogue_Menu_Add_To_List(%d)", answer); _vm->_dialogueMenu->addToList(answer, false, 5, 5, 5); return false; } -bool ScriptBase::Dialogue_Menu_Add_DONE_To_List(int answerValue) { - _vm->_dialogueMenu->addToList(answerValue, 1, 0, 0, 0); +bool ScriptBase::Dialogue_Menu_Add_DONE_To_List(int answer) { + debugC(kDebugScript, "Dialogue_Menu_Add_DONE_To_List(%d)", answer); + _vm->_dialogueMenu->addToList(answer, 1, 0, 0, 0); return false; } bool ScriptBase::Dialogue_Menu_Add_To_List_Never_Repeat_Once_Selected(int answer) { + debugC(kDebugScript, "Dialogue_Menu_Add_To_List_Never_Repeat_Once_Selected(%d)", answer); return _vm->_dialogueMenu->addToListNeverRepeatOnceSelected(answer, 5, 5, 5); } bool ScriptBase::DM_Add_To_List(int answer, int priorityPolite, int priorityNormal, int prioritySurly) { + debugC(kDebugScript, "DM_Add_To_List(%d, %d, %d, %d)", answer, priorityPolite, priorityNormal, prioritySurly); return _vm->_dialogueMenu->addToList(answer, false, priorityPolite, priorityNormal, prioritySurly); } bool ScriptBase::DM_Add_To_List_Never_Repeat_Once_Selected(int answer, int priorityPolite, int priorityNormal, int prioritySurly) { + debugC(kDebugScript, "DM_Add_To_List_Never_Repeat_Once_Selected(%d, %d, %d, %d)", answer, priorityPolite, priorityNormal, prioritySurly); return _vm->_dialogueMenu->addToListNeverRepeatOnceSelected(answer, priorityPolite, priorityNormal, prioritySurly); } -void ScriptBase::Dialogue_Menu_Remove_From_List(int answer) { - //TODO - warning("Dialogue_Menu_Remove_From_List(%d)", answer); +bool ScriptBase::Dialogue_Menu_Remove_From_List(int answer) { + debugC(kDebugScript, "Dialogue_Menu_Remove_From_List(%d)", answer); + return _vm->_dialogueMenu->removeFromList(answer); } int ScriptBase::Dialogue_Menu_Query_Input() { - //TODO + debugC(kDebugScript, "Dialogue_Menu_Query_Input()"); return _vm->_dialogueMenu->queryInput(); } int ScriptBase::Dialogue_Menu_Query_List_Size() { + debugC(8, kDebugScript, "Dialogue_Menu_Query_List_Size()"); return _vm->_dialogueMenu->listSize(); } void ScriptBase::Scene_Exit_Add_2D_Exit(int index, int left, int top, int right, int down, int type) { + debugC(kDebugScript, "Scene_Exit_Add_2D_Exit(%d, %d, %d, %d, %d, %d)", index, left, top, right, down, type); _vm->_scene->_exits->add(index, Common::Rect(left, top, right, down), type); } void ScriptBase::Scene_Exit_Remove(int index) { + debugC(kDebugScript, "Scene_Exit_Remove(%d)", index); _vm->_scene->_exits->remove(index); } void ScriptBase::Scene_Exits_Disable() { + debugC(kDebugScript, "Scene_Exits_Disable()"); _vm->_scene->_exits->setEnabled(false); } void ScriptBase::Scene_Exits_Enable() { + debugC(kDebugScript, "Scene_Exits_Enable()"); _vm->_scene->_exits->setEnabled(true); } void ScriptBase::Scene_2D_Region_Add(int index, int left, int top, int right, int down) { + debugC(kDebugScript, "Scene_2D_Region_Add(%d, %d, %d, %d, %d)", index, left, top, right, down); _vm->_scene->_regions->add(index, Common::Rect(left, top, right, down), 0); } void ScriptBase::Scene_2D_Region_Remove(int index) { + debugC(kDebugScript, "Scene_2D_Region_Remove(%d)", index); _vm->_scene->_regions->remove(index); } void ScriptBase::World_Waypoint_Set(int waypointId, int setId, float x, float y, float z) { + debugC(kDebugScript, "World_Waypoint_Set(%d, %d, %f, %f, %f)", waypointId, setId, x, y, z); _vm->_waypoints->set(waypointId, setId, Vector3(x, y, z)); } // ScriptBase::World_Waypoint_Reset float ScriptBase::World_Waypoint_Query_X(int waypointId) { + debugC(8, kDebugScript, "World_Waypoint_Query_X(%d)", waypointId); return _vm->_waypoints->getX(waypointId); } float ScriptBase::World_Waypoint_Query_Y(int waypointId) { + debugC(8, kDebugScript, "World_Waypoint_Query_Y(%d)", waypointId); return _vm->_waypoints->getY(waypointId); } float ScriptBase::World_Waypoint_Query_Z(int waypointId) { + debugC(8, kDebugScript, "World_Waypoint_Query_Z(%d)", waypointId); return _vm->_waypoints->getZ(waypointId); } void ScriptBase::Combat_Cover_Waypoint_Set_Data(int coverWaypointId, int type, int setId, int sceneId, float x, float y, float z) { + debugC(kDebugScript, "Combat_Cover_Waypoint_Set_Data(%d, %d, %d, %d, %f, %f, %f)", coverWaypointId, type, setId, sceneId, x, y, z); assert(coverWaypointId < (int)_vm->_combat->_coverWaypoints.size()); _vm->_combat->_coverWaypoints[coverWaypointId].type = type; @@ -1094,6 +1250,7 @@ void ScriptBase::Combat_Cover_Waypoint_Set_Data(int coverWaypointId, int type, i } void ScriptBase::Combat_Flee_Waypoint_Set_Data(int fleeWaypointId, int type, int setId, int sceneId, float x, float y, float z, int a8) { + debugC(kDebugScript, "Combat_Flee_Waypoint_Set_Data(%d, %d, %d, %d, %f, %f, %f)", fleeWaypointId, type, setId, sceneId, x, y, z); assert(fleeWaypointId < (int)_vm->_combat->_fleeWaypoints.size()); _vm->_combat->_fleeWaypoints[fleeWaypointId].type = type; @@ -1106,47 +1263,58 @@ void ScriptBase::Combat_Flee_Waypoint_Set_Data(int fleeWaypointId, int type, int } void ScriptBase::Police_Maze_Target_Track_Add(int itemId, float startX, float startY, float startZ, float endX, float endY, float endZ, int steps, const int* instructions, bool isActive) { + debugC(kDebugScript, "Police_Maze_Target_Track_Add(%d, %f, %f, %f, %f, %f, %f, %d, ptr, %d)", itemId, startX, startY, startZ, endX, endY, endZ, steps, isActive); _vm->_policeMaze->_tracks[itemId]->add(itemId, startX, startY, startZ, endX, endY, endZ, steps, instructions, isActive); _vm->_policeMaze->activate(); } int ScriptBase::Police_Maze_Query_Score() { + debugC(kDebugScript, "Police_Maze_Query_Score()"); return Global_Variable_Query(kVariablePoliceMazeScore); } void ScriptBase::Police_Maze_Zero_Score() { + debugC(kDebugScript, "Police_Maze_Zero_Score()"); Global_Variable_Reset(kVariablePoliceMazeScore); } void ScriptBase::Police_Maze_Increment_Score(int delta) { + debugC(kDebugScript, "Police_Maze_Increment_Score(%d)", delta); Global_Variable_Set(kVariablePoliceMazeScore, Global_Variable_Query(kVariablePoliceMazeScore) + delta); } void ScriptBase::Police_Maze_Decrement_Score(int delta) { + debugC(kDebugScript, "Police_Maze_Decrement_Score(%d)", delta); Global_Variable_Set(kVariablePoliceMazeScore, Global_Variable_Query(kVariablePoliceMazeScore) - delta); } void ScriptBase::Police_Maze_Set_Score(int value) { + debugC(kDebugScript, "Police_Maze_Set_Score(%d)", value); Global_Variable_Set(kVariablePoliceMazeScore, value); } void ScriptBase::Police_Maze_Set_Pause_State(bool state) { + debugC(kDebugScript, "Police_Maze_Set_Pause_State(%d)", state); _vm->_policeMaze->setPauseState(state); } void ScriptBase::CDB_Set_Crime(int clueId, int crimeId) { + debugC(kDebugScript, "CDB_Set_Crime(%d, %d)", clueId, crimeId); _vm->_crimesDatabase->setCrime(clueId, crimeId); } void ScriptBase::CDB_Set_Clue_Asset_Type(int clueId, int assetType) { + debugC(kDebugScript, "CDB_Set_Clue_Asset_Type(%d, %d)", clueId, assetType); _vm->_crimesDatabase->setAssetType(clueId, assetType); } void ScriptBase::SDB_Set_Actor(int suspectId, int actorId) { + debugC(kDebugScript, "SDB_Set_Actor(%d, %d)", suspectId, actorId); _vm->_suspectsDatabase->get(suspectId)->setActor(actorId); } bool ScriptBase::SDB_Add_Photo_Clue(int suspectId, int clueId, int shapeId) { + debugC(kDebugScript, "SDB_Add_Photo_Clue(%d, %d, %d)", suspectId, clueId, shapeId); return _vm->_suspectsDatabase->get(suspectId)->addPhotoClue(shapeId, clueId); } @@ -1155,44 +1323,54 @@ void ScriptBase::SDB_Set_Name(int actorId) { } void ScriptBase::SDB_Set_Sex(int suspectId, int sex) { + debugC(kDebugScript, "SDB_Set_Sex(%d, %d)", suspectId, sex); _vm->_suspectsDatabase->get(suspectId)->setSex(sex); } bool ScriptBase::SDB_Add_Identity_Clue(int suspectId, int clueId) { + debugC(kDebugScript, "SDB_Add_Identity_Clue(%d, %d)", suspectId, clueId); return _vm->_suspectsDatabase->get(suspectId)->addIdentityClue(clueId); } bool ScriptBase::SDB_Add_MO_Clue(int suspectId, int clueId) { + debugC(kDebugScript, "SDB_Add_MO_Clue(%d, %d)", suspectId, clueId); return _vm->_suspectsDatabase->get(suspectId)->addMOClue(clueId); } bool ScriptBase::SDB_Add_Whereabouts_Clue(int suspectId, int clueId) { + debugC(kDebugScript, "SDB_Add_Whereabouts_Clue(%d, %d)", suspectId, clueId); return _vm->_suspectsDatabase->get(suspectId)->addWhereaboutsClue(clueId); } bool ScriptBase::SDB_Add_Replicant_Clue(int suspectId, int clueId) { + debugC(kDebugScript, "SDB_Add_Replicant_Clue(%d, %d)", suspectId, clueId); return _vm->_suspectsDatabase->get(suspectId)->addReplicantClue(clueId); } bool ScriptBase::SDB_Add_Non_Replicant_Clue(int suspectId, int clueId) { + debugC(kDebugScript, "SDB_Add_Non_Replicant_Clue(%d, %d)", suspectId, clueId); return _vm->_suspectsDatabase->get(suspectId)->addNonReplicantClue(clueId); } bool ScriptBase::SDB_Add_Other_Clue(int suspectId, int clueId) { + debugC(kDebugScript, "SDB_Add_Other_Clue(%d, %d)", suspectId, clueId); return _vm->_suspectsDatabase->get(suspectId)->addOtherClue(clueId); } void ScriptBase::Spinner_Set_Selectable_Destination_Flag(int destination, bool selectable) { + debugC(kDebugScript, "Spinner_Set_Selectable_Destination_Flag(%d, %d)", destination, selectable); _vm->_spinner->setSelectableDestinationFlag(destination, selectable); } // ScriptBase::Spinner_Query_Selectable_Destination_Flag int ScriptBase::Spinner_Interface_Choose_Dest(int loopId, bool immediately) { + debugC(kDebugScript, "Spinner_Interface_Choose_Dest(%d, %d)", loopId, immediately); return _vm->_spinner->chooseDestination(loopId, immediately); } void ScriptBase::ESPER_Flag_To_Activate() { + debugC(kDebugScript, "ESPER_Flag_To_Activate()"); if (!_vm->_esper->isOpen()) { _vm->_esper->open(&_vm->_surfaceBack); while (_vm->_esper->isOpen() && _vm->_gameIsRunning) { @@ -1202,6 +1380,7 @@ void ScriptBase::ESPER_Flag_To_Activate() { } void ScriptBase::Voight_Kampff_Activate(int actorId, int calibrationRatio){ + debugC(kDebugScript, "Voight_Kampff_Activate(%d, %d)", actorId, calibrationRatio); _vm->_vk->open(actorId, calibrationRatio); while (_vm->_vk->isOpen() && _vm->_gameIsRunning) { _vm->gameTick(); @@ -1209,46 +1388,56 @@ void ScriptBase::Voight_Kampff_Activate(int actorId, int calibrationRatio){ } int ScriptBase::Elevator_Activate(int elevatorId) { + debugC(kDebugScript, "Elevator_Activate(%d)", elevatorId); return _vm->_elevator->activate(elevatorId); } void ScriptBase::View_Score_Board() { + debugC(kDebugScript, "View_Score_Board()"); _vm->_scores->open(); } int ScriptBase::Query_Score(int index) { + debugC(8, kDebugScript, "Query_score(%d)", index); return _vm->_scores->query(index); } void ScriptBase::Set_Score(int index, int value) { + debugC(kDebugScript, "Set_Score(%d, %d)", index, value); _vm->_scores->set(index, value); } void ScriptBase::Give_McCoy_Ammo(int ammoType, int ammo) { + debugC(kDebugScript, "Give_McCoy_Ammo(%d, %d)", ammoType, ammo); _vm->_settings->addAmmo(ammoType, ammo); } void ScriptBase::Assign_Player_Gun_Hit_Sounds(int ammoType, int soundId1, int soundId2, int soundId3) { + debugC(kDebugScript, "Assign_Player_Gun_Hit_Sounds(%d, %d, %d, %d)", ammoType, soundId1, soundId2, soundId3); _vm->_combat->setHitSound(ammoType, 0, soundId1); _vm->_combat->setHitSound(ammoType, 1, soundId2); _vm->_combat->setHitSound(ammoType, 2, soundId3); } void ScriptBase::Assign_Player_Gun_Miss_Sounds(int ammoType, int soundId1, int soundId2, int soundId3) { + debugC(kDebugScript, "Assign_Player_Gun_Miss_Sounds(%d, %d, %d, %d)", ammoType, soundId1, soundId2, soundId3); _vm->_combat->setMissSound(ammoType, 0, soundId1); _vm->_combat->setMissSound(ammoType, 1, soundId2); _vm->_combat->setMissSound(ammoType, 2, soundId3); } void ScriptBase::Disable_Shadows(int animationsIdsList[], int listSize) { + debugC(kDebugScript, "Disable_Shadows(list, %d)", listSize); _vm->_sliceRenderer->disableShadows(animationsIdsList, listSize); } bool ScriptBase::Query_System_Currently_Loading_Game() { + debugC(8, kDebugScript, "Query_System_Currently_Loading_Game()"); return _vm->_gameIsLoading; } void ScriptBase::Actor_Retired_Here(int actorId, int width, int height, int retired, int retiredByActorId) { + debugC(kDebugScript, "Actor_Retired_Here(%d, %d, %d, %d, %d)", actorId, width, height, retired, retiredByActorId); Actor *actor = _vm->_actors[actorId]; actor->retire(retired, width, height, retiredByActorId); actor->setAtXYZ(actor->getXYZ(), actor->getFacing(), true, false, true); @@ -1256,6 +1445,7 @@ void ScriptBase::Actor_Retired_Here(int actorId, int width, int height, int reti } void ScriptBase::Clickable_Object(const char *objectName) { + debugC(kDebugScript, "Clickable_Object(%s)", objectName); int objectId = _vm->_scene->findObject(objectName); if (objectId == -1) return; @@ -1263,6 +1453,7 @@ void ScriptBase::Clickable_Object(const char *objectName) { } void ScriptBase::Unclickable_Object(const char *objectName) { + debugC(kDebugScript, "Unclickable_Object(%s)", objectName); int objectId = _vm->_scene->findObject(objectName); if (objectId == -1) return; @@ -1270,6 +1461,7 @@ void ScriptBase::Unclickable_Object(const char *objectName) { } void ScriptBase::Obstacle_Object(const char *objectName, bool updateWalkpath) { + debugC(kDebugScript, "Obstacle_Object(%s, %d)", objectName, updateWalkpath); int objectId = _vm->_scene->findObject(objectName); if (objectId == -1) return; @@ -1277,6 +1469,7 @@ void ScriptBase::Obstacle_Object(const char *objectName, bool updateWalkpath) { } void ScriptBase::Unobstacle_Object(const char *objectName, bool updateWalkpath) { + debugC(kDebugScript, "Unobstacle_Object(%s, %d)", objectName, updateWalkpath); int objectId = _vm->_scene->findObject(objectName); if (objectId == -1) return; @@ -1284,10 +1477,12 @@ void ScriptBase::Unobstacle_Object(const char *objectName, bool updateWalkpath) } void ScriptBase::Obstacle_Flag_All_Objects(bool isObstacle) { + debugC(kDebugScript, "Obstacle_Flag_All_Objects(%d)", isObstacle); _vm->_scene->objectSetIsObstacleAll(isObstacle, !_vm->_sceneIsLoading); } void ScriptBase::Combat_Target_Object(const char *objectName) { + debugC(kDebugScript, "Combat_Target_Object(%s)", objectName); int objectId = _vm->_scene->findObject(objectName); if (objectId == -1) return; @@ -1295,6 +1490,7 @@ void ScriptBase::Combat_Target_Object(const char *objectName) { } void ScriptBase::Un_Combat_Target_Object(const char *objectName) { + debugC(kDebugScript, "Un_Combat_Target_Object(%s)", objectName); int objectId = _vm->_scene->findObject(objectName); if (objectId == -1) return; @@ -1302,89 +1498,111 @@ void ScriptBase::Un_Combat_Target_Object(const char *objectName) { } void ScriptBase::Set_Fade_Color(float r, float g, float b) { + debugC(kDebugScript, "Set_Fade_Color(%f, %f, %f)", r, g, b); _vm->_scene->_set->_effects->setFadeColor(r, g, b); } void ScriptBase::Set_Fade_Density(float density) { + debugC(kDebugScript, "Set_Fade_Density(%f)", density); _vm->_scene->_set->_effects->setFadeDensity(density); } void ScriptBase::Set_Fog_Color(const char *fogName, float r, float g, float b) { + debugC(kDebugScript, "Set_Fog_Color(%s, %f, %f, %f)", fogName, r, g, b); _vm->_scene->_set->_effects->setFogColor(fogName, r, g, b); } void ScriptBase::Set_Fog_Density(const char *fogName, float density) { + debugC(kDebugScript, "Set_Fog_Density(%s, %f)", fogName, density); _vm->_scene->_set->_effects->setFogDensity(fogName, density); } void ScriptBase::ADQ_Flush() { + debugC(kDebugScript, "ADQ_Flush()"); _vm->_actorDialogueQueue->flush(0, true); } void ScriptBase::ADQ_Add(int actorId, int sentenceId, int animationMode) { + debugC(kDebugScript, "ADQ_Add(%d, %d, %d)", actorId, sentenceId, animationMode); _vm->_actorDialogueQueue->add(actorId, sentenceId, animationMode); } void ScriptBase::ADQ_Add_Pause(int delay) { + debugC(kDebugScript, "ADQ_Add_Pause(%d)", delay); _vm->_actorDialogueQueue->addPause(delay); } bool ScriptBase::Game_Over() { + debugC(kDebugScript, "Game_Over()"); _vm->_gameIsRunning = false; _vm->_gameOver = true; return true; } void ScriptBase::Autosave_Game(int textId) { + debugC(kDebugScript, "Autosave_Game(%d)", textId); _vm->_gameAutoSave = textId; + // TODO + warning("Autosave not yet implemented"); } void ScriptBase::I_Sez(const char *str) { + debugC(kDebugScript, "I_Sez(%s)", str); _vm->ISez(str); } void ScriptBase::AI_Countdown_Timer_Start(int actorId, signed int timer, int seconds) { + debugC(kDebugScript, "AI_Countdown_Timer_Start(%d, %d, %d)", actorId, timer, seconds); if (timer >= 0 && timer <= 2) { _vm->_actors[actorId]->timerStart(timer, 1000 * seconds); } } void ScriptBase::AI_Countdown_Timer_Reset(int actorId, int timer) { + debugC(kDebugScript, "AI_Countdown_Timer_Reset(%d, %d)", actorId, timer); if (timer >= 0 && timer <= 2) { _vm->_actors[actorId]->timerReset(timer); } } void ScriptBase::AI_Movement_Track_Unpause(int actorId) { + debugC(kDebugScript, "AI_Movement_Track_Unpause(%d)", actorId); _vm->_actors[actorId]->movementTrackUnpause(); } void ScriptBase::AI_Movement_Track_Pause(int actorId) { + debugC(kDebugScript, "AI_Movement_Track_Pause(%d)", actorId); _vm->_actors[actorId]->movementTrackPause(); } void ScriptBase::AI_Movement_Track_Repeat(int actorId) { + debugC(kDebugScript, "AI_Movement_Track_Repeat(%d)", actorId); _vm->_actors[actorId]->_movementTrack->repeat(); _vm->_actors[actorId]->movementTrackNext(true); } void ScriptBase::AI_Movement_Track_Append_Run_With_Facing(int actorId, int waypointId, int delay, int angle) { + debugC(kDebugScript, "AI_Movement_Track_Append_Run_With_Facing(%d, %d, %d, %d)", actorId, waypointId, delay, angle); _vm->_actors[actorId]->_movementTrack->append(waypointId, delay * 1000, angle, true); } void ScriptBase::AI_Movement_Track_Append_With_Facing(int actorId, int waypointId, int delay, int angle) { + debugC(kDebugScript, "AI_Movement_Track_Append_With_Facing(%d, %d, %d, %d)", actorId, waypointId, delay, angle); _vm->_actors[actorId]->_movementTrack->append(waypointId, delay * 1000, angle, false); } void ScriptBase::AI_Movement_Track_Append_Run(int actorId, int waypointId, int delay) { + debugC(kDebugScript, "AI_Movement_Track_Append_Run(%d, %d, %d)", actorId, waypointId, delay); _vm->_actors[actorId]->_movementTrack->append(waypointId, delay * 1000, true); } void ScriptBase::AI_Movement_Track_Append(int actorId, int waypointId, int delay) { + debugC(kDebugScript, "AI_Movement_Track_Append(%d, %d, %d)", actorId, waypointId, delay); _vm->_actors[actorId]->_movementTrack->append(waypointId, delay * 1000, false); } void ScriptBase::AI_Movement_Track_Flush(int actorId) { + debugC(kDebugScript, "AI_Movement_Track_Flush(%d)", actorId); _vm->_actors[actorId]->_movementTrack->flush(); _vm->_actors[actorId]->stopWalking(false); } diff --git a/engines/bladerunner/script/script.h b/engines/bladerunner/script/script.h index 09c372d009..f5ce3d63b0 100644 --- a/engines/bladerunner/script/script.h +++ b/engines/bladerunner/script/script.h @@ -192,8 +192,8 @@ protected: bool Dialogue_Menu_Add_DONE_To_List(int answer); bool Dialogue_Menu_Add_To_List_Never_Repeat_Once_Selected(int answer); bool DM_Add_To_List(int answer, int priorityPolite, int priorityNormal, int prioritySurly); - bool DM_Add_To_List_Never_Repeat_Once_Selected(int answer, int priorityPolite, int priorityNormal, int prioritySurly4); - void Dialogue_Menu_Remove_From_List(int answer); + bool DM_Add_To_List_Never_Repeat_Once_Selected(int answer, int priorityPolite, int priorityNormal, int prioritySurly); + bool Dialogue_Menu_Remove_From_List(int answer); int Dialogue_Menu_Query_Input(); int Dialogue_Menu_Query_List_Size(); void Scene_Exit_Add_2D_Exit(int index, int left, int top, int right, int down, int type); -- cgit v1.2.3