aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjohndoe1232012-11-19 23:37:20 +0000
committerWillem Jan Palenstijn2013-05-08 20:47:38 +0200
commit9a1d9883ad8a8f56b6c7397efe07a17625a03970 (patch)
treea2d33cc06c1960077aa7c0b2956cc24d4f7c89f8
parentb2934eb166ba5b442a93969ad8b4dfbbc6ef3314 (diff)
downloadscummvm-rg350-9a1d9883ad8a8f56b6c7397efe07a17625a03970.tar.gz
scummvm-rg350-9a1d9883ad8a8f56b6c7397efe07a17625a03970.tar.bz2
scummvm-rg350-9a1d9883ad8a8f56b6c7397efe07a17625a03970.zip
NEVERHOOD: Fix AsCommonCar turning
-rw-r--r--engines/neverhood/gamemodule.cpp8
-rw-r--r--engines/neverhood/module1600.cpp34
-rw-r--r--engines/neverhood/module1600.h2
-rw-r--r--engines/neverhood/module2800.cpp5
4 files changed, 15 insertions, 34 deletions
diff --git a/engines/neverhood/gamemodule.cpp b/engines/neverhood/gamemodule.cpp
index 5cb9198898..dacac9861e 100644
--- a/engines/neverhood/gamemodule.cpp
+++ b/engines/neverhood/gamemodule.cpp
@@ -362,7 +362,7 @@ void GameModule::startup() {
setGlobalVar(V_SHRINK_LIGHTS_ON, 0);
// <<<DEBUG
-#if 0
+#if 1
/*
//DEBUG>>>
createScene(_vm->gameState().sceneNum, _vm->gameState().which);
@@ -371,10 +371,10 @@ void GameModule::startup() {
*/
_vm->gameState().which = 0;
- _vm->gameState().sceneNum = 2;
- createModule(2800, -1);
+ _vm->gameState().sceneNum = 14;
+ createModule(2700, -1);
#endif
-#if 1
+#if 0
_vm->gameState().sceneNum = 5;
_vm->gameState().which = 0;
createModule(2800, -1);
diff --git a/engines/neverhood/module1600.cpp b/engines/neverhood/module1600.cpp
index ca4d2e5322..41fc415cfb 100644
--- a/engines/neverhood/module1600.cpp
+++ b/engines/neverhood/module1600.cpp
@@ -210,6 +210,7 @@ AsCommonCar::AsCommonCar(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16
_newDeltaXType = -1;
_soundCounter = 0;
_pathPoints = NULL;
+ _currMoveDirection = 0;
startAnimation(0xD4220027, 0, -1);
setDoDeltaX(getGlobalVar(V_CAR_DELTA_X));
@@ -496,21 +497,6 @@ void AsCommonCar::stIdleBlink() {
NextState(&AsCommonCar::stLeanForwardIdle);
}
-void AsCommonCar::stHandleRect() {
- _isBusy = true;
- gotoNextState();
- startAnimation(0x9C220DA4, 0, -1);
- SetUpdateHandler(&AsCommonCar::update);
- SetMessageHandler(&AsCommonCar::hmAnimation);
- FinalizeState(&AsCommonCar::evHandleRectDone);
-}
-
-void AsCommonCar::evHandleRectDone() {
- _isBusy = false;
- _newMoveDirection = 0;
- stUpdateMoveDirection();
-}
-
void AsCommonCar::stUpdateMoveDirection() {
_isMoving = true;
if (_currMoveDirection == 1)
@@ -532,12 +518,13 @@ void AsCommonCar::moveToNextPoint() {
} else {
NPoint nextPt = pathPoint(_currPointIndex + 1);
NPoint currPt = pathPoint(_currPointIndex);
- if (ABS(nextPt.y - currPt.y) <= ABS(nextPt.x - currPt.x) && nextPt.x >= currPt.x &&
- (_currMoveDirection == 4 || _currMoveDirection == 2)) {
- if (_currMoveDirection == 4)
- _currMoveDirection = 2;
- else if (_currMoveDirection == 2)
+ if (ABS(nextPt.y - currPt.y) <= ABS(nextPt.x - currPt.x) &&
+ ((_currMoveDirection == 2 && nextPt.x < currPt.x) ||
+ (_currMoveDirection == 4 && nextPt.x >= currPt.x))) {
+ if (_currMoveDirection == 2)
_currMoveDirection = 4;
+ else if (_currMoveDirection == 4)
+ _currMoveDirection = 2;
if (_isIdle)
stTurnCarMoveToNextPoint();
else
@@ -619,8 +606,9 @@ void AsCommonCar::moveToPrevPoint() {
prevPt = pathPoint(_currPointIndex);
currPt = pathPoint(_currPointIndex + 1);
}
- if (ABS(prevPt.y - currPt.y) <= ABS(prevPt.x - currPt.x) && currPt.x >= prevPt.x &&
- (_currMoveDirection == 2 || _currMoveDirection == 4)) {
+ if (ABS(prevPt.y - currPt.y) <= ABS(prevPt.x - currPt.x) &&
+ ((_currMoveDirection == 2 && prevPt.x < currPt.x) ||
+ (_currMoveDirection == 4 && prevPt.x >= currPt.x))) {
if (_currMoveDirection == 2)
_currMoveDirection = 4;
else if (_currMoveDirection == 4)
@@ -657,8 +645,8 @@ void AsCommonCar::stBrakeMoveToPrevPoint() {
void AsCommonCar::evTurnCarDone() {
_isBusy = false;
- _newMoveDirection = 0;
setDoDeltaX(2);
+ _newMoveDirection = 0;
stUpdateMoveDirection();
}
diff --git a/engines/neverhood/module1600.h b/engines/neverhood/module1600.h
index 2a7d547551..0c567e693f 100644
--- a/engines/neverhood/module1600.h
+++ b/engines/neverhood/module1600.h
@@ -89,8 +89,6 @@ protected:
void stLeanForwardIdle();
void evIdleDone();
void stIdleBlink();
- void stHandleRect();
- void evHandleRectDone();
void stUpdateMoveDirection();
void stTurnCar();
void moveToNextPoint();
diff --git a/engines/neverhood/module2800.cpp b/engines/neverhood/module2800.cpp
index fb437fd86f..f97d0719f0 100644
--- a/engines/neverhood/module2800.cpp
+++ b/engines/neverhood/module2800.cpp
@@ -1736,8 +1736,6 @@ Scene2804::Scene2804(NeverhoodEngine *vm, Module *parentModule, int which)
SetMessageHandler(&Scene2804::handleMessage);
SetUpdateHandler(&Scene2804::update);
- //setGlobalVar(V_SHRINK_LIGHTS_ON, 1); // DEBUG Set lights on
-
if (getGlobalVar(V_SHRINK_LIGHTS_ON)) {
setBackground(0xA1D03005);
setPalette(0xA1D03005);
@@ -2019,9 +2017,6 @@ Scene2806::Scene2806(NeverhoodEngine *vm, Module *parentModule, int which)
_clipRects[2].x2 = 640;
_clipRects[3].x2 = 640;
- for (uint i = 0; i < 4; i++)
- debug("clipRect[%d] (%d, %d, %d, %d)", i, _clipRects[i].x1, _clipRects[i].y1, _clipRects[i].x2, _clipRects[i].y2);
-
if (which < 0) {
insertKlayman<KmScene2806>(441, 423, false, _clipRects, 4);
setMessageList(0x004AF098);