aboutsummaryrefslogtreecommitdiff
path: root/engines/gnap
diff options
context:
space:
mode:
authorStrangerke2016-05-07 23:59:08 +0200
committerEugene Sandulenko2016-05-10 12:14:54 +0200
commit33ca09ae12a09df7d1367122eb8461f7b7a74572 (patch)
tree27282fb995a7d41b40a0a97d0e05e042ca392bc7 /engines/gnap
parenta508936349cd29ef2d89735699fac0b933ff9b7d (diff)
downloadscummvm-rg350-33ca09ae12a09df7d1367122eb8461f7b7a74572.tar.gz
scummvm-rg350-33ca09ae12a09df7d1367122eb8461f7b7a74572.tar.bz2
scummvm-rg350-33ca09ae12a09df7d1367122eb8461f7b7a74572.zip
GNAP: Remove useless redirections, move two more functions
Diffstat (limited to 'engines/gnap')
-rw-r--r--engines/gnap/character.cpp56
-rw-r--r--engines/gnap/character.h2
-rw-r--r--engines/gnap/gnap.cpp46
-rw-r--r--engines/gnap/gnap.h2
-rw-r--r--engines/gnap/scenes/group0.cpp12
5 files changed, 59 insertions, 59 deletions
diff --git a/engines/gnap/character.cpp b/engines/gnap/character.cpp
index ee8196138a..1ff76988f0 100644
--- a/engines/gnap/character.cpp
+++ b/engines/gnap/character.cpp
@@ -462,7 +462,7 @@ int PlayerGnap::getSequenceId(int kind, int gridX, int gridY) {
void PlayerGnap::useJointOnPlatypus() {
_vm->setGrabCursorSprite(-1);
- if (_vm->gnapPlatypusAction(1, 0, 0x107C1, 0)) {
+ if (doPlatypusAction(1, 0, 0x107C1, 0)) {
_actionStatus = 100;
_vm->_gameSys->setAnimation(0, 0, 1);
_vm->_gameSys->setAnimation(0x10876, _vm->_plat->_id, 0);
@@ -478,7 +478,7 @@ void PlayerGnap::useJointOnPlatypus() {
_vm->_plat->_sequenceId = 0x876;
_vm->_plat->_idleFacing = kDirNone;
playSequence(0x107B5);
- _vm->_gnap->walkStep();
+ walkStep();
while (_vm->_gameSys->getAnimationStatus(0) != 2) {
_vm->updateMouseCursor();
_vm->gameUpdateTick();
@@ -491,7 +491,7 @@ void PlayerGnap::useJointOnPlatypus() {
}
void PlayerGnap::kissPlatypus(int callback) {
- if (_vm->gnapPlatypusAction(-1, 0, 0x107D1, callback)) {
+ if (doPlatypusAction(-1, 0, 0x107D1, callback)) {
_actionStatus = 100;
_vm->_gameSys->setAnimation(0, 0, 1);
_vm->_gameSys->setAnimation(0x10847, _id, 0);
@@ -1100,6 +1100,52 @@ void PlayerGnap::playShowCurrItem(int gridX, int gridY, int gridLookX, int gridL
playShowItem(_vm->_grabCursorSpriteIndex, gridLookX, gridLookY);
}
+bool PlayerGnap::doPlatypusAction(int gridX, int gridY, int platSequenceId, int callback) {
+ bool result = false;
+
+ if (_actionStatus <= -1 && _vm->_plat->_actionStatus <= -1) {
+ _actionStatus = 100;
+ Common::Point checkPt = _vm->_plat->_pos + Common::Point(gridX, gridY);
+ if (_vm->isPointBlocked(checkPt) && (_pos != checkPt)) {
+ _vm->_plat->walkStep();
+ checkPt = _vm->_plat->_pos + Common::Point(gridX, gridY);
+ }
+
+ if (!_vm->isPointBlocked(checkPt) && (_pos != checkPt)) {
+ walkTo(checkPt, 0, 0x107B9, 1);
+ while (_vm->_gameSys->getAnimationStatus(0) != 2) {
+ _vm->updateMouseCursor();
+ _vm->doCallback(callback);
+ _vm->gameUpdateTick();
+ }
+ _vm->_gameSys->setAnimation(0, 0, 0);
+ if (_pos == _vm->_plat->_pos + Common::Point(gridX, gridY)) {
+ _vm->_gameSys->setAnimation(platSequenceId, _vm->_plat->_id, 1);
+ _vm->_plat->playSequence(platSequenceId);
+ while (_vm->_gameSys->getAnimationStatus(1) != 2) {
+ _vm->updateMouseCursor();
+ _vm->doCallback(callback);
+ _vm->gameUpdateTick();
+ }
+ result = true;
+ }
+ }
+ _actionStatus = -1;
+ }
+ return result;
+}
+
+void PlayerGnap::useDisguiseOnPlatypus() {
+ _vm->_gameSys->setAnimation(0x10846, _id, 0);
+ playSequence(0x10846);
+ while (_vm->_gameSys->getAnimationStatus(0) != 2)
+ _vm->gameUpdateTick();
+ _vm->_newSceneNum = 47;
+ _vm->_isLeavingScene = true;
+ _vm->_sceneDone = true;
+ _vm->setFlag(kGFPlatypusDisguised);
+}
+
/************************************************************************************************/
PlayerPlat::PlayerPlat(GnapEngine * vm) : Character(vm) {}
@@ -1156,7 +1202,7 @@ void PlayerPlat::updateIdleSequence() {
}
} else {
_vm->_timers[0] = _vm->getRandom(75) + 75;
- _vm->_plat->makeRoom();
+ makeRoom();
}
} else {
_vm->_timers[0] = 100;
@@ -1184,7 +1230,7 @@ void PlayerPlat::updateIdleSequence2() {
}
} else {
_vm->_timers[0] = _vm->getRandom(75) + 75;
- _vm->_plat->makeRoom();
+ makeRoom();
}
} else {
_vm->_timers[0] = 100;
diff --git a/engines/gnap/character.h b/engines/gnap/character.h
index d04c59462c..c7f97b72b2 100644
--- a/engines/gnap/character.h
+++ b/engines/gnap/character.h
@@ -89,6 +89,7 @@ public:
virtual bool walkTo(Common::Point gridPos, int animationIndex, int sequenceId, int flags);
void actionIdle(int sequenceId);
+ bool doPlatypusAction(int gridX, int gridY, int platSequenceId, int callback);
int getShowSequenceId(int index, int gridX, int gridY);
Facing getWalkFacing(int deltaX, int deltaY);
int getWalkStopSequenceId(int deltaX, int deltaY);
@@ -107,6 +108,7 @@ public:
void playShowItem(int itemIndex, int gridLookX, int gridLookY);
void playUseDevice(int gridX, int gridY);
void useDeviceOnPlatypus();
+ void useDisguiseOnPlatypus();
void useJointOnPlatypus();
int _brainPulseNum;
diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp
index 3b6f84af37..518dda26d2 100644
--- a/engines/gnap/gnap.cpp
+++ b/engines/gnap/gnap.cpp
@@ -965,52 +965,6 @@ void GnapEngine::doCallback(int callback) {
}
}
-bool GnapEngine::gnapPlatypusAction(int gridX, int gridY, int platSequenceId, int callback) {
- bool result = false;
-
- if (_gnap->_actionStatus <= -1 && _plat->_actionStatus <= -1) {
- _gnap->_actionStatus = 100;
- Common::Point checkPt = _plat->_pos + Common::Point(gridX, gridY);
- if (isPointBlocked(checkPt) && (_gnap->_pos != checkPt)) {
- _plat->walkStep();
- checkPt = _plat->_pos + Common::Point(gridX, gridY);
- }
-
- if (!isPointBlocked(checkPt) && (_gnap->_pos != checkPt)) {
- _gnap->walkTo(checkPt, 0, 0x107B9, 1);
- while (_gameSys->getAnimationStatus(0) != 2) {
- updateMouseCursor();
- doCallback(callback);
- gameUpdateTick();
- }
- _gameSys->setAnimation(0, 0, 0);
- if (_gnap->_pos == _plat->_pos + Common::Point(gridX, gridY)) {
- _gameSys->setAnimation(platSequenceId, _plat->_id, 1);
- _plat->playSequence(platSequenceId);
- while (_gameSys->getAnimationStatus(1) != 2) {
- updateMouseCursor();
- doCallback(callback);
- gameUpdateTick();
- }
- result = true;
- }
- }
- _gnap->_actionStatus = -1;
- }
- return result;
-}
-
-void GnapEngine::gnapUseDisguiseOnPlatypus() {
- _gameSys->setAnimation(0x10846, _gnap->_id, 0);
- _gnap->playSequence(0x10846);
- while (_gameSys->getAnimationStatus(0) != 2)
- gameUpdateTick();
- _newSceneNum = 47;
- _isLeavingScene = true;
- _sceneDone = true;
- setFlag(kGFPlatypusDisguised);
-}
-
////////////////////////////////////////////////////////////////////////////////
void GnapEngine::initGlobalSceneVars() {
diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h
index 8446454ba5..0bda4b4706 100644
--- a/engines/gnap/gnap.h
+++ b/engines/gnap/gnap.h
@@ -476,8 +476,6 @@ public:
// Gnap
void doCallback(int callback);
- bool gnapPlatypusAction(int gridX, int gridY, int platSequenceId, int callback);
- void gnapUseDisguiseOnPlatypus();
// Scenes
int _toyUfoNextSequenceId, _toyUfoSequenceId;
diff --git a/engines/gnap/scenes/group0.cpp b/engines/gnap/scenes/group0.cpp
index 780c4d2616..b693d3bda8 100644
--- a/engines/gnap/scenes/group0.cpp
+++ b/engines/gnap/scenes/group0.cpp
@@ -124,7 +124,7 @@ void Scene01::run() {
case kHS01Platypus:
if (_vm->_gnap->_actionStatus < 0 && _vm->isFlag(kGFPlatypus)) {
if (_vm->_grabCursorSpriteIndex == kItemDisguise) {
- _vm->gnapUseDisguiseOnPlatypus();
+ _vm->_gnap->useDisguiseOnPlatypus();
} else if (_vm->_grabCursorSpriteIndex >= 0) {
_vm->_gnap->playImpossible(0, 0);
} else {
@@ -474,7 +474,7 @@ void Scene02::run() {
case kHS02Platypus:
if (_vm->_gnap->_actionStatus < 0 && _vm->isFlag(kGFPlatypus)) {
if (_vm->_grabCursorSpriteIndex == kItemDisguise) {
- _vm->gnapUseDisguiseOnPlatypus();
+ _vm->_gnap->useDisguiseOnPlatypus();
} else if (_vm->_grabCursorSpriteIndex >= 0) {
_vm->_gnap->playImpossible(0, 0);
} else {
@@ -939,7 +939,7 @@ void Scene03::run() {
case kHS03Platypus:
if (_vm->_gnap->_actionStatus < 0 && _vm->isFlag(kGFPlatypus)) {
if (_vm->_grabCursorSpriteIndex == kItemDisguise) {
- _vm->gnapUseDisguiseOnPlatypus();
+ _vm->_gnap->useDisguiseOnPlatypus();
} else if (_vm->_grabCursorSpriteIndex >= 0) {
_vm->_gnap->playImpossible(0, 0);
} else {
@@ -1443,7 +1443,7 @@ void Scene04::run() {
case kHS04Platypus:
if (_vm->_gnap->_actionStatus < 0 && _vm->isFlag(kGFPlatypus)) {
if (_vm->_grabCursorSpriteIndex == kItemDisguise) {
- _vm->gnapUseDisguiseOnPlatypus();
+ _vm->_gnap->useDisguiseOnPlatypus();
} else if (_vm->_grabCursorSpriteIndex >= 0) {
_vm->_gnap->playImpossible(0, 0);
} else {
@@ -1918,7 +1918,7 @@ void Scene05::run() {
case kHS05Platypus:
if (_vm->_gnap->_actionStatus < 0 && _vm->isFlag(kGFPlatypus)) {
if (_vm->_grabCursorSpriteIndex == kItemDisguise) {
- _vm->gnapUseDisguiseOnPlatypus();
+ _vm->_gnap->useDisguiseOnPlatypus();
} else if (_vm->_grabCursorSpriteIndex >= 0) {
_vm->_gnap->playImpossible(0, 0);
} else {
@@ -2342,7 +2342,7 @@ void Scene06::run() {
case kHS06Platypus:
if (_vm->_gnap->_actionStatus < 0) {
if (_vm->_grabCursorSpriteIndex == kItemDisguise) {
- _vm->gnapUseDisguiseOnPlatypus();
+ _vm->_gnap->useDisguiseOnPlatypus();
} else if (_vm->_grabCursorSpriteIndex >= 0) {
_vm->_gnap->playImpossible(0, 0);
} else {