aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThanasis Antoniou2019-05-26 17:15:52 +0300
committerThanasis Antoniou2019-05-26 17:17:05 +0300
commit605e21953d161ca043bedebb56994676f4902fe3 (patch)
treefc7e8fe6055454e20eed3c0236c271b17da595eb
parent93768c33073129237109a056d219623ae9f6d712 (diff)
downloadscummvm-rg350-605e21953d161ca043bedebb56994676f4902fe3.tar.gz
scummvm-rg350-605e21953d161ca043bedebb56994676f4902fe3.tar.bz2
scummvm-rg350-605e21953d161ca043bedebb56994676f4902fe3.zip
BLADERUNNER: Fix for View::calculateScreenPosition
Draw objects in debugger no longer draws mishappen rectangles
-rw-r--r--engines/bladerunner/game_constants.h2
-rw-r--r--engines/bladerunner/script/scene/ug18.cpp4
-rw-r--r--engines/bladerunner/view.cpp5
3 files changed, 6 insertions, 5 deletions
diff --git a/engines/bladerunner/game_constants.h b/engines/bladerunner/game_constants.h
index 0e8307a73f..1fe3767b2a 100644
--- a/engines/bladerunner/game_constants.h
+++ b/engines/bladerunner/game_constants.h
@@ -1862,7 +1862,7 @@ enum GameModelAnimations {
kModelAnimationWeaponsOrderForm = 965,
kModelAnimationShellCasings = 966,
kModelAnimationSlug = 967,
-// kModelAnimationKnife = 968, // unused - a knife? - spins badly
+// kModelAnimationKnife = 968, // unused - 3 frames - a knife? - spins badly
kModelAnimationStrangeScale = 969,
kModelAnimationHysteriaToken = 970,
kModelAnimationToyDog = 971,
diff --git a/engines/bladerunner/script/scene/ug18.cpp b/engines/bladerunner/script/scene/ug18.cpp
index 8b6c1da281..4201d3b0e7 100644
--- a/engines/bladerunner/script/scene/ug18.cpp
+++ b/engines/bladerunner/script/scene/ug18.cpp
@@ -229,8 +229,8 @@ void SceneScriptUG18::SceneFrameAdvanced(int frame) {
Ambient_Sounds_Play_Sound(kSfxSUBWAY1, 24, 30, 0, 50);
}
- if (frame == 119 // end of main loop unloading // works better the using the 120 value
- || frame == 240 // end of main loop no trains
+ if (frame == 119 // end of main loop unloading // works better than using the 120 value
+ || frame == 240 // end of main loop no trains
) {
if (Global_Variable_Query(kVariableUG18CountUpForNextTrainAction) < kUG18TrainsCountUpTargetRegular) {
if (Global_Variable_Query(kVariableUG18StateOfTrains) == kUG18NoTrains) {
diff --git a/engines/bladerunner/view.cpp b/engines/bladerunner/view.cpp
index cb14f51ee5..f2f9749982 100644
--- a/engines/bladerunner/view.cpp
+++ b/engines/bladerunner/view.cpp
@@ -24,6 +24,7 @@
#include "common/debug.h"
#include "common/stream.h"
+#include "common/util.h"
namespace BladeRunner {
@@ -73,8 +74,8 @@ void View::calculateCameraPosition() {
Vector3 View::calculateScreenPosition(Vector3 worldPosition) {
Vector3 viewPosition = _frameViewMatrix * worldPosition;
return Vector3(
- _viewportPosition.x - viewPosition.x / viewPosition.z * _viewportPosition.z,
- _viewportPosition.y - viewPosition.y / viewPosition.z * _viewportPosition.z,
+ _viewportPosition.x - ((viewPosition.x / ABS(viewPosition.z)) * ABS(_viewportPosition.z)),
+ _viewportPosition.y - ((viewPosition.y / ABS(viewPosition.z)) * ABS(_viewportPosition.z)),
viewPosition.z
);
}