summaryrefslogtreecommitdiffstats
path: root/src/control/Script4.cpp
diff options
context:
space:
mode:
authorNikolay Korolev <nickvnuk@gmail.com>2020-11-28 19:26:38 +0100
committerNikolay Korolev <nickvnuk@gmail.com>2020-11-28 19:26:38 +0100
commit8cb3c071510e7675e35d59c73fc0c86ca30d51a9 (patch)
tree00e78192e09ca5f130ea4bbfed5f46464e72ec2a /src/control/Script4.cpp
parentUpdate Script.cpp (diff)
downloadre3-8cb3c071510e7675e35d59c73fc0c86ca30d51a9.tar
re3-8cb3c071510e7675e35d59c73fc0c86ca30d51a9.tar.gz
re3-8cb3c071510e7675e35d59c73fc0c86ca30d51a9.tar.bz2
re3-8cb3c071510e7675e35d59c73fc0c86ca30d51a9.tar.lz
re3-8cb3c071510e7675e35d59c73fc0c86ca30d51a9.tar.xz
re3-8cb3c071510e7675e35d59c73fc0c86ca30d51a9.tar.zst
re3-8cb3c071510e7675e35d59c73fc0c86ca30d51a9.zip
Diffstat (limited to '')
-rw-r--r--src/control/Script4.cpp27
1 files changed, 24 insertions, 3 deletions
diff --git a/src/control/Script4.cpp b/src/control/Script4.cpp
index 880e4279..b2e2aaa5 100644
--- a/src/control/Script4.cpp
+++ b/src/control/Script4.cpp
@@ -40,6 +40,23 @@
#include "Zones.h"
#include "Bike.h"
+#ifdef FIX_BUGS
+static bool IsSlideObjectUsedWrongByScript(const CVector& posTarget, const CVector& slideBy)
+{
+ if (posTarget == CVector(-559.476f, 784.807f, 23.279f) && slideBy == CVector(0.0f, 10.0f, 0.0f))
+ return true; // G-Spotlight bottom elevator, east side
+ if (posTarget == CVector(-559.476f, 779.64f, 23.279f) && slideBy == CVector(0.0f, 10.0f, 0.0f))
+ return true; // G-Spotlight bottom elevator, west side
+ if (posTarget == CVector(-553.563f, 790.595f, 97.917f) && slideBy == CVector(0.0f, 10.0f, 0.0f))
+ return true; // G-Spotlight top elevator, east side
+ if (posTarget == CVector(-553.563f, 785.427f, 97.917f) && slideBy == CVector(0.0f, 10.0f, 0.0f))
+ return true; // G-Spotlight top elevator, west side
+ if (posTarget == CVector(-866.689f, -572.095f, 15.573f) && slideBy == CVector(0.0f, 0.0f, 4.5f))
+ return true; // Cherry Popper garage door
+ return false;
+}
+#endif
+
int8 CRunningScript::ProcessCommands800To899(int32 command)
{
CMatrix tmp_matrix;
@@ -514,10 +531,14 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
script_assert(pObject);
CVector pos = pObject->GetPosition();
CVector posTarget = *(CVector*)&ScriptParams[1];
-#ifdef FIX_BUGS
- CVector slideBy = *(CVector*)&ScriptParams[4] * CTimer::GetTimeStepFix();
-#else
CVector slideBy = *(CVector*)&ScriptParams[4];
+#ifdef FIX_BUGS
+ // the check is a hack for original script, where some objects are moved
+ // via SLIDE_OBJECT instead of SET_OBJECT_POSITION
+ // assuming the slide will take exactly one frame, which is true
+ // only without accounting time step (which is a bug)
+ if (!IsSlideObjectUsedWrongByScript(posTarget, slideBy))
+ slideBy *= CTimer::GetTimeStepFix();
#endif
if (posTarget == pos) { // using direct comparasion here is fine
UpdateCompareFlag(true);