aboutsummaryrefslogtreecommitdiff
path: root/engines/bladerunner/script
diff options
context:
space:
mode:
authorPeter Kohaut2016-10-04 02:21:08 +0200
committerPeter Kohaut2016-10-04 18:15:57 +0200
commit6547c35e15252fd24f260ebd6b8f01d9edd01aa2 (patch)
tree89fec132f3325fed022c4f7bd7fd003942604352 /engines/bladerunner/script
parent281c19ab036f387a99192594aa645e696009f40b (diff)
downloadscummvm-rg350-6547c35e15252fd24f260ebd6b8f01d9edd01aa2.tar.gz
scummvm-rg350-6547c35e15252fd24f260ebd6b8f01d9edd01aa2.tar.bz2
scummvm-rg350-6547c35e15252fd24f260ebd6b8f01d9edd01aa2.zip
BLADERUNNER: trying to figure out walking, added structures for obstacles used for pathfinding, fixed bug in searching for walkboxes
Diffstat (limited to 'engines/bladerunner/script')
-rw-r--r--engines/bladerunner/script/nr03.cpp4
-rw-r--r--engines/bladerunner/script/nr05.cpp2
-rw-r--r--engines/bladerunner/script/rc01.cpp8
-rw-r--r--engines/bladerunner/script/script.cpp67
-rw-r--r--engines/bladerunner/script/script.h12
5 files changed, 60 insertions, 33 deletions
diff --git a/engines/bladerunner/script/nr03.cpp b/engines/bladerunner/script/nr03.cpp
index f0d2f359b5..a4afdd36ec 100644
--- a/engines/bladerunner/script/nr03.cpp
+++ b/engines/bladerunner/script/nr03.cpp
@@ -305,7 +305,7 @@ void ScriptNR03::sub_40259C(int frame) {
float z = -60.21f * s + 36.49f * c + -408.79f;
if (Actor_Query_Goal_Number(4) == 201) {
- facing = angle * (1024.0f / (2.0f * M_PI));
+ facing = angle * (512.0f / M_PI);
facing = facing + 144;
if (facing < 0) {
facing = facing + 1168;
@@ -315,7 +315,7 @@ void ScriptNR03::sub_40259C(int frame) {
}
Actor_Set_At_XYZ(4, x, -70.19f, z, facing);
} else {
- facing = angle * (1024.0f / (2.0f * M_PI));
+ facing = angle * (512.0f / M_PI);
facing = facing + 400;
if (facing < 0) {
facing = facing + 1424;
diff --git a/engines/bladerunner/script/nr05.cpp b/engines/bladerunner/script/nr05.cpp
index a62052bdfd..d686bce374 100644
--- a/engines/bladerunner/script/nr05.cpp
+++ b/engines/bladerunner/script/nr05.cpp
@@ -205,7 +205,7 @@ void ScriptNR05::sub_401F74(int frame) {
float x = 6.0f * s - 80.0f * c + -450.0f;
float z = 80.0f * s + 6.0f * c + -531.0f;
- int facing = angle * (1024.0f / (2.0f * M_PI));
+ int facing = angle * (512.0f / M_PI);
facing = facing + 765;
if (facing < 0) {
facing = facing + 1789;
diff --git a/engines/bladerunner/script/rc01.cpp b/engines/bladerunner/script/rc01.cpp
index 9d88d2dec3..d94f104403 100644
--- a/engines/bladerunner/script/rc01.cpp
+++ b/engines/bladerunner/script/rc01.cpp
@@ -215,7 +215,7 @@ bool ScriptRC01::ClickedOn3DObject(const char *objectName, bool a2) {
}
if (Object_Query_Click("HYDRANT02", objectName)) {
- if (!Loop_Actor_Walk_To_Scene_Object(0, "HYDRANT02", 60, 1, false)) {
+ if (!Loop_Actor_Walk_To_Scene_Object(0, "HYDRANT02", 60, true, false)) {
if (Actor_Clue_Query(0, 26)) {
Actor_Says(0, 6975, 3);
} else {
@@ -230,7 +230,7 @@ bool ScriptRC01::ClickedOn3DObject(const char *objectName, bool a2) {
}
if (Object_Query_Click("DOOR LEFT", objectName)) {
- if (!Loop_Actor_Walk_To_Scene_Object(0, "DOOR LEFT", 48, 1, false)) {
+ if (!Loop_Actor_Walk_To_Scene_Object(0, "DOOR LEFT", 48, true, false)) {
Actor_Face_Object(0, "DOOR LEFT", true);
if (!Actor_Clue_Query(0, 2) && Actor_Query_In_Set(23, 69) && Global_Variable_Query(1)) {
Actor_Set_Goal_Number(23, 0);
@@ -247,7 +247,7 @@ bool ScriptRC01::ClickedOn3DObject(const char *objectName, bool a2) {
}
if (Object_Query_Click("T-CAN01", objectName)) {
- if (!Loop_Actor_Walk_To_Scene_Object(0, "T-CAN01", 24, 1, false)) {
+ if (!Loop_Actor_Walk_To_Scene_Object(0, "T-CAN01", 24, true, false)) {
Actor_Face_Object(0, "T-CAN01", true);
Actor_Voice_Over(1810, 99);
Actor_Voice_Over(1820, 99);
@@ -530,7 +530,7 @@ bool ScriptRC01::ClickedOnExit(int exitId) {
}
void ScriptRC01::sub_403850() {
- if (!Game_Flag_Query(186) && !Loop_Actor_Walk_To_Scene_Object(0, "BARICADE03", 36, 1, false)) {
+ if (!Game_Flag_Query(186) && !Loop_Actor_Walk_To_Scene_Object(0, "BARICADE03", 36, true, false)) {
Actor_Set_Goal_Number(23, 0);
Actor_Face_Object(0, "BARICADE03", true);
Loop_Actor_Walk_To_Actor(23, 0, 36, 1, false);
diff --git a/engines/bladerunner/script/script.cpp b/engines/bladerunner/script/script.cpp
index 216428c2f8..180e8cb96e 100644
--- a/engines/bladerunner/script/script.cpp
+++ b/engines/bladerunner/script/script.cpp
@@ -540,48 +540,75 @@ int ScriptBase::Actor_Query_Animation_Mode(int actorId) {
return _vm->_actors[actorId]->getAnimationMode();
}
-bool ScriptBase::Loop_Actor_Walk_To_Actor(int actorId, int otherActorId, int a3, int a4, bool running) {
+bool ScriptBase::Loop_Actor_Walk_To_Actor(int actorId, int otherActorId, int a3, int a4, bool run) {
//TODO
- warning("Loop_Actor_Walk_To_Actor(%d, %d, %d, %d, %d)", actorId, otherActorId, a3, a4, running);
+ warning("Loop_Actor_Walk_To_Actor(%d, %d, %d, %d, %d)", actorId, otherActorId, a3, a4, run);
return false;
}
-bool ScriptBase::Loop_Actor_Walk_To_Item(int actorId, int itemId, int a3, int a4, bool running) {
+bool ScriptBase::Loop_Actor_Walk_To_Item(int actorId, int itemId, int a3, int a4, bool run) {
//TODO
- warning("Loop_Actor_Walk_To_Item(%d, %d, %d, %d, %d)", actorId, itemId, a3, a4, running);
+ warning("Loop_Actor_Walk_To_Item(%d, %d, %d, %d, %d)", actorId, itemId, a3, a4, run);
return false;
}
-bool ScriptBase::Loop_Actor_Walk_To_Scene_Object(int actorId, const char *objectName, int distance, int a4, bool running) {
+bool ScriptBase::Loop_Actor_Walk_To_Scene_Object(int actorId, const char *objectName, int destinationOffset, bool a4, bool run) {
_vm->gameWaitForActive();
- _vm->_actors[actorId]->loopWalkToSceneObject(objectName);
-
- return false;
+ if(_vm->_walkingActorId == actorId) {
+ run = true;
+ }
+ bool isRunning;
+ bool result = _vm->_actors[actorId]->loopWalkToSceneObject(objectName, destinationOffset, a4, run, true, &isRunning);
+ if(isRunning == 1) {
+ _vm->_walkingActorId = actorId;
+ }
+ Global_Variable_Set(37, actorId);
+ Global_Variable_Set(38, isRunning);
+ return result;
}
-bool ScriptBase::Loop_Actor_Walk_To_Waypoint(int actorId, int waypointId, int a3, int a4, bool running) {
+bool ScriptBase::Loop_Actor_Walk_To_Waypoint(int actorId, int waypointId, int destinationOffset, int a4, bool run) {
//TODO
- warning("Loop_Actor_Walk_To_Waypoint(%d, %d, %d, %d, %d)", actorId, waypointId, a3, a4, running);
+ warning("Loop_Actor_Walk_To_Waypoint(%d, %d, %d, %d, %d)", actorId, waypointId, destinationOffset, a4, run);
return false;
}
-bool ScriptBase::Loop_Actor_Walk_To_XYZ(int actorId, float x, float y, float z, int a4, int a5, bool running, int a7) {
+bool ScriptBase::Loop_Actor_Walk_To_XYZ(int actorId, float x, float y, float z, int destinationOffset, int a5, bool run, int a7) {
_vm->gameWaitForActive();
- _vm->_actors[actorId]->loopWalkToXYZ(x, y, z, a4, a5, running, 1);
-
- return false;
+ if(_vm->_walkingActorId == actorId) {
+ if(a7) {
+ _vm->_walkingActorId = -1;
+ } else {
+ run = true;
+ }
+ }
+ //TODO:
+ //PlayerActorIdle = 0;
+ bool isRunning;
+ bool result = _vm->_actors[actorId]->loopWalkToXYZ(Vector3(x, y, z), destinationOffset, a5, run, 1, &isRunning);
+
+// if (PlayerActorIdle == 1) {
+// result = 1;
+// PlayerActorIdle = 0;
+// }
+ if(isRunning) {
+ _vm->_walkingActorId = actorId;
+ }
+ Global_Variable_Set(37, actorId);
+ Global_Variable_Set(38, isRunning);
+ return result;
}
-void ScriptBase::Async_Actor_Walk_To_Waypoint(int actorId, int waypointId, int a3, int running) {
+void ScriptBase::Async_Actor_Walk_To_Waypoint(int actorId, int waypointId, int destinationOffset, int run) {
//TODO
- warning("Async_Actor_Walk_To_Waypoint(%d, %d, %d, %d)", actorId, waypointId, a3, running);
+ warning("Async_Actor_Walk_To_Waypoint(%d, %d, %d, %d)", actorId, waypointId, destinationOffset, run);
}
-void ScriptBase::Async_Actor_Walk_To_XYZ(int actorId, float x, float y, float z, int a5, bool running) {
+void ScriptBase::Async_Actor_Walk_To_XYZ(int actorId, float x, float y, float z, int destinationOffset, bool run) {
//TODO
- warning("Async_Actor_Walk_To_XYZ(%d, %f, %f, %f, %d, %d)", actorId, x, y, z, a5, running);
+ warning("Async_Actor_Walk_To_XYZ(%d, %f, %f, %f, %d, %d)", actorId, x, y, z, destinationOffset, run);
}
void ScriptBase::Actor_Force_Stop_Walking(int actorId) {
@@ -692,11 +719,11 @@ void ScriptBase::Delay(int miliseconds) {
}
void ScriptBase::Player_Loses_Control() {
- _vm->playerLosesControl();
+ _vm->playerLosesControl();
}
void ScriptBase::Player_Gains_Control() {
- _vm->playerGainsControl();
+ _vm->playerGainsControl();
}
void ScriptBase::Player_Set_Combat_Mode(bool activate) {
diff --git a/engines/bladerunner/script/script.h b/engines/bladerunner/script/script.h
index 0e4c0e9f62..fb38fdaf91 100644
--- a/engines/bladerunner/script/script.h
+++ b/engines/bladerunner/script/script.h
@@ -99,12 +99,12 @@ protected:
void Actor_Change_Animation_Mode(int actorId, int animationMode);
int Actor_Query_Animation_Mode(int actorId);
bool Loop_Actor_Walk_To_Actor(int actorId, int otherActorId, int a3, int a4, bool running);
- bool Loop_Actor_Walk_To_Item(int actorId, int itemId, int a3, int a4, bool running);
- bool Loop_Actor_Walk_To_Scene_Object(int actorId, const char *objectName, int distance, int a4, bool running);
- bool Loop_Actor_Walk_To_Waypoint(int actorId, int waypointId, int a3, int a4, bool running);
- bool Loop_Actor_Walk_To_XYZ(int actorId, float x, float y, float z, int a4, int a5, bool running, int a7);
- void Async_Actor_Walk_To_Waypoint(int actorId, int waypointId, int a3, int running);
- void Async_Actor_Walk_To_XYZ(int actorId, float x, float y, float z, int a5, bool running);
+ bool Loop_Actor_Walk_To_Item(int actorId, int itemId, int a3, int a4, bool run);
+ bool Loop_Actor_Walk_To_Scene_Object(int actorId, const char *objectName, int distance, bool a4, bool run);
+ bool Loop_Actor_Walk_To_Waypoint(int actorId, int waypointId, int a3, int a4, bool run);
+ bool Loop_Actor_Walk_To_XYZ(int actorId, float x, float y, float z, int a4, int a5, bool run, int a7);
+ void Async_Actor_Walk_To_Waypoint(int actorId, int waypointId, int a3, int run);
+ void Async_Actor_Walk_To_XYZ(int actorId, float x, float y, float z, int a5, bool run);
void Actor_Force_Stop_Walking(int actorId);
bool Loop_Actor_Travel_Stairs(int actorId, int a2, int a3, int a4);
bool Loop_Actor_Travel_Ladder(int actorId, int a2, int a3, int a4);