From a284213aa0d54dda9677aac4f1d6946ddd4b3a3b Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 23 Mar 2018 21:44:37 +0100 Subject: BLADERUNNER: Implement PoliceMaze hooks --- engines/bladerunner/game_constants.h | 1 + engines/bladerunner/police_maze.cpp | 14 +++++++++++++ engines/bladerunner/police_maze.h | 7 ++++++- engines/bladerunner/script/scene/ps10.cpp | 6 +++--- engines/bladerunner/script/scene/ps11.cpp | 2 +- engines/bladerunner/script/scene/ps12.cpp | 4 ++-- engines/bladerunner/script/scene/ps13.cpp | 4 ++-- engines/bladerunner/script/script.cpp | 33 +++++++++++++++++++++---------- engines/bladerunner/script/script.h | 12 +++++------ 9 files changed, 58 insertions(+), 25 deletions(-) (limited to 'engines') diff --git a/engines/bladerunner/game_constants.h b/engines/bladerunner/game_constants.h index 4aa72c1bc6..cf5e3fb6e6 100644 --- a/engines/bladerunner/game_constants.h +++ b/engines/bladerunner/game_constants.h @@ -535,6 +535,7 @@ enum Flags { enum Variables { kVariableChapter = 1, kVariableChinyen = 2, + kVariablePoliceMazeScore = 9, kVariableGenericWalkerAModel = 32, kVariableGenericWalkerBModel = 33, kVariableGenericWalkerCModel = 34, diff --git a/engines/bladerunner/police_maze.cpp b/engines/bladerunner/police_maze.cpp index a4d95c7db5..8c79fc7e14 100644 --- a/engines/bladerunner/police_maze.cpp +++ b/engines/bladerunner/police_maze.cpp @@ -57,6 +57,15 @@ void PoliceMaze::reset() { _pm_var2 = 0; } +void PoliceMaze::activate() { + _needAnnouncement = true; + _announcementRead = false; +} + +void PoliceMaze::setPauseState(bool state) { + warning("PoliceMaze::setPauseState(%d)", state); +} + void PoliceMaze::tick() { } @@ -86,4 +95,9 @@ void PoliceMazeTargetTrack::reset() { _visible = true; } +void PoliceMazeTargetTrack::add(int trackId, float startX, float startY, float startZ, float endX, float endY, float endZ, int count, void *list, bool a11) { + warning("PoliceMazeTargetTrack::add(%d, %f, %f, %f, %f, %f, %f, %d, %p, %d)", trackId, startX, startY, startZ, endX, endY, endZ, count, (void *)list, a11); +} + + } // End of namespace BladeRunner diff --git a/engines/bladerunner/police_maze.h b/engines/bladerunner/police_maze.h index 20f22c3bf5..ef49161c24 100644 --- a/engines/bladerunner/police_maze.h +++ b/engines/bladerunner/police_maze.h @@ -58,24 +58,29 @@ public: ~PoliceMazeTargetTrack(); void reset(); + void add(int trackId, float startX, float startY, float startZ, float endX, float endY, float endZ, int count, void *list, bool a11); }; class PoliceMaze { BladeRunnerEngine *_vm; - PoliceMazeTargetTrack *_tracks[kNumMazeTracks]; bool _isActive; bool _needAnnouncement; bool _announcementRead; int _pm_var1; int _pm_var2; +public: + PoliceMazeTargetTrack *_tracks[kNumMazeTracks]; + public: PoliceMaze(BladeRunnerEngine *vm); ~PoliceMaze(); void tick(); void reset(); + void setPauseState(bool state); + void activate(); }; } // End of namespace BladeRunner diff --git a/engines/bladerunner/script/scene/ps10.cpp b/engines/bladerunner/script/scene/ps10.cpp index d45a4b8e67..8a1677fed3 100644 --- a/engines/bladerunner/script/scene/ps10.cpp +++ b/engines/bladerunner/script/scene/ps10.cpp @@ -25,7 +25,7 @@ namespace BladeRunner { void SceneScriptPS10::InitializeScene() { - Police_Maze_Set_Pause_State(1); + Police_Maze_Set_Pause_State(true); if (Game_Flag_Query(15)) { float x = World_Waypoint_Query_X(4); float y = World_Waypoint_Query_Y(4); @@ -211,7 +211,7 @@ void SceneScriptPS10::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bo void SceneScriptPS10::PlayerWalkedIn() { if (Game_Flag_Query(15)) { Loop_Actor_Walk_To_XYZ(kActorMcCoy, -352.09f, -9.23f, 267.95f, 0, 0, true, 0); - Police_Maze_Set_Pause_State(0); + Police_Maze_Set_Pause_State(false); Game_Flag_Reset(15); //return true; return; @@ -221,7 +221,7 @@ void SceneScriptPS10::PlayerWalkedIn() { Actor_Says(kActorAnsweringMachine, 280, 3); Actor_Says(kActorAnsweringMachine, 290, 3); Actor_Says(kActorAnsweringMachine, 300, 3); - Police_Maze_Set_Pause_State(0); + Police_Maze_Set_Pause_State(false); //return true; return; } diff --git a/engines/bladerunner/script/scene/ps11.cpp b/engines/bladerunner/script/scene/ps11.cpp index 1aa227b022..e6311b3ca1 100644 --- a/engines/bladerunner/script/scene/ps11.cpp +++ b/engines/bladerunner/script/scene/ps11.cpp @@ -254,7 +254,7 @@ void SceneScriptPS11::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bo } void SceneScriptPS11::PlayerWalkedIn() { - Police_Maze_Set_Pause_State(0); + Police_Maze_Set_Pause_State(false); } void SceneScriptPS11::PlayerWalkedOut() { diff --git a/engines/bladerunner/script/scene/ps12.cpp b/engines/bladerunner/script/scene/ps12.cpp index 2e6f54e247..d4d771a94f 100644 --- a/engines/bladerunner/script/scene/ps12.cpp +++ b/engines/bladerunner/script/scene/ps12.cpp @@ -25,7 +25,7 @@ namespace BladeRunner { void SceneScriptPS12::InitializeScene() { - Police_Maze_Set_Pause_State(1); + Police_Maze_Set_Pause_State(true); if (Game_Flag_Query(16)) { Scene_Loop_Start_Special(0, 0, 0); Scene_Loop_Set_Default(1); @@ -270,7 +270,7 @@ void SceneScriptPS12::PlayerWalkedIn() { Loop_Actor_Walk_To_XYZ(kActorMcCoy, -546.0f, -9.06f, 570.0f, 0, 1, false, 0); Game_Flag_Reset(16); } - Police_Maze_Set_Pause_State(0); + Police_Maze_Set_Pause_State(false); } void SceneScriptPS12::PlayerWalkedOut() { diff --git a/engines/bladerunner/script/scene/ps13.cpp b/engines/bladerunner/script/scene/ps13.cpp index 736df765a3..f525d48137 100644 --- a/engines/bladerunner/script/scene/ps13.cpp +++ b/engines/bladerunner/script/scene/ps13.cpp @@ -25,7 +25,7 @@ namespace BladeRunner { void SceneScriptPS13::InitializeScene() { - Police_Maze_Set_Pause_State(1); + Police_Maze_Set_Pause_State(true); if (Game_Flag_Query(18)) { Scene_Loop_Start_Special(0, 0, 0); Scene_Loop_Set_Default(1); @@ -255,7 +255,7 @@ void SceneScriptPS13::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bo } void SceneScriptPS13::PlayerWalkedIn() { - Police_Maze_Set_Pause_State(0); + Police_Maze_Set_Pause_State(false); } void SceneScriptPS13::PlayerWalkedOut() { diff --git a/engines/bladerunner/script/script.cpp b/engines/bladerunner/script/script.cpp index fc595bc3de..f4818b1e0f 100644 --- a/engines/bladerunner/script/script.cpp +++ b/engines/bladerunner/script/script.cpp @@ -39,6 +39,7 @@ #include "bladerunner/movement_track.h" #include "bladerunner/music.h" #include "bladerunner/overlays.h" +#include "bladerunner/police_maze.h" #include "bladerunner/regions.h" #include "bladerunner/set.h" #include "bladerunner/settings.h" @@ -1100,20 +1101,32 @@ 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, signed int data[], bool a10) { - //TODO - warning("Police_Maze_Target_Track_Add(%d, %f, %f, %f, %f, %f, %f, %d, %p, %d)", itemId, startX, startY, startZ, endX, endY, endZ, steps, (void *)data, a10); + _vm->_policeMaze->_tracks[itemId]->add(itemId, startX, startY, startZ, endX, endY, endZ, steps, data, a10); + _vm->_policeMaze->activate(); +} +int ScriptBase::Police_Maze_Query_Score() { + return Global_Variable_Query(kVariablePoliceMazeScore); } -// ScriptBase::Police_Maze_Query_Score -// ScriptBase::Police_Maze_Zero_Score -// ScriptBase::Police_Maze_Increment_Score -// ScriptBase::Police_Maze_Decrement_Score -// ScriptBase::Police_Maze_Set_Score +void ScriptBase::Police_Maze_Zero_Score() { + Global_Variable_Reset(kVariablePoliceMazeScore); +} -void ScriptBase::Police_Maze_Set_Pause_State(int a1) { - //TODO - warning("Police_Maze_Set_Pause_State(%d)", a1); +void ScriptBase::Police_Maze_Increment_Score(int delta) { + Global_Variable_Set(kVariablePoliceMazeScore, Global_Variable_Query(kVariablePoliceMazeScore) + delta); +} + +void ScriptBase::Police_Maze_Decrement_Score(int delta) { + Global_Variable_Set(kVariablePoliceMazeScore, Global_Variable_Query(kVariablePoliceMazeScore) - delta); +} + +void ScriptBase::Police_Maze_Set_Score(int value) { + Global_Variable_Set(kVariablePoliceMazeScore, value); +} + +void ScriptBase::Police_Maze_Set_Pause_State(bool state) { + _vm->_policeMaze->setPauseState(state); } void ScriptBase::CDB_Set_Crime(int clueId, int crimeId) { diff --git a/engines/bladerunner/script/script.h b/engines/bladerunner/script/script.h index 3940c457bc..07b503979a 100644 --- a/engines/bladerunner/script/script.h +++ b/engines/bladerunner/script/script.h @@ -208,12 +208,12 @@ protected: void Combat_Cover_Waypoint_Set_Data(int coverWaypointId, int a2, int setId, int a4, float x, float y, float z); void Combat_Flee_Waypoint_Set_Data(int fleeWaypointId, int a2, int setId, int a4, float x, float y, float z, int a8); void Police_Maze_Target_Track_Add(int itemId, float startX, float startY, float startZ, float endX, float endY, float endZ, int steps, signed int data[], bool a10); - // Police_Maze_Query_Score - // Police_Maze_Zero_Score - // Police_Maze_Increment_Score - // Police_Maze_Decrement_Score - // Police_Maze_Set_Score - void Police_Maze_Set_Pause_State(int a1); + int Police_Maze_Query_Score(); + void Police_Maze_Zero_Score(); + void Police_Maze_Increment_Score(int delta); + void Police_Maze_Decrement_Score(int delta); + void Police_Maze_Set_Score(int value); + void Police_Maze_Set_Pause_State(bool state); void CDB_Set_Crime(int clueId, int crimeId); void CDB_Set_Clue_Asset_Type(int clueId, int assetType); void SDB_Set_Actor(int suspectId, int actorId); -- cgit v1.2.3