aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStrangerke2013-04-02 00:29:20 +0200
committerStrangerke2013-04-02 00:29:20 +0200
commit992aa0d7073634f7dbe039edf294fce36503e124 (patch)
treea2afc8ca45ade7384aa6e37fdd340749648edb64
parentdac4cb9e671033b44577e5cd1be06d357206ddcc (diff)
downloadscummvm-rg350-992aa0d7073634f7dbe039edf294fce36503e124.tar.gz
scummvm-rg350-992aa0d7073634f7dbe039edf294fce36503e124.tar.bz2
scummvm-rg350-992aa0d7073634f7dbe039edf294fce36503e124.zip
HOPKINS: Rework OPTI_ONE to make it more readable, rename it
-rw-r--r--engines/hopkins/objects.cpp10
-rw-r--r--engines/hopkins/objects.h2
-rw-r--r--engines/hopkins/script.cpp38
3 files changed, 24 insertions, 26 deletions
diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp
index fdfb926b98..227da29212 100644
--- a/engines/hopkins/objects.cpp
+++ b/engines/hopkins/objects.cpp
@@ -3040,12 +3040,10 @@ void ObjectsManager::doActionLeft(int idx) {
}
}
-void ObjectsManager::OPTI_ONE(int idx, int animIdx, int destPosi, int animAction) {
+void ObjectsManager::setAndPlayAnim(int idx, int animIdx, int destPosi, bool animAction) {
// Set Hopkins animation and position
- if (animAction != 3) {
- setBobAnimation(idx);
- setBobAnimDataIdx(idx, animIdx);
- }
+ setBobAnimation(idx);
+ setBobAnimDataIdx(idx, animIdx);
// Make Hopkins walk to the expected place
do {
@@ -3054,7 +3052,7 @@ void ObjectsManager::OPTI_ONE(int idx, int animIdx, int destPosi, int animAction
if (!animAction)
stopBobAnimation(idx);
- else if (animAction == 4) {
+ else {
_vm->_graphicsManager->fastDisplay(_bob[idx]._spriteData,
_bob[idx]._oldX, _bob[idx]._oldY, _bob[idx]._frameIndex);
stopBobAnimation(idx);
diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h
index 3b1375c2a1..d14e353840 100644
--- a/engines/hopkins/objects.h
+++ b/engines/hopkins/objects.h
@@ -324,12 +324,12 @@ public:
void quickDisplayBobSprite(int idx);
void initVbob(byte *src, int idx, int xp, int yp, int frameIndex);
void disableVbob(int idx);
+ void setAndPlayAnim(int idx, int animIdx, int destPosi, bool animAction);
void PERSONAGE(const Common::String &backgroundFile, const Common::String &linkFile,
const Common::String &animFile, const Common::String &s4, int soundNum, bool initializeScreen);
void PERSONAGE2(const Common::String &backgroundFile, const Common::String &linkFile,
const Common::String &animFile, const Common::String &s4, int soundNum, bool initializeScreen);
- void OPTI_ONE(int idx, int animIdx, int destPosi, int animAction);
void GOHOME();
void PARADISE();
};
diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp
index fec07e632e..d100403490 100644
--- a/engines/hopkins/script.cpp
+++ b/engines/hopkins/script.cpp
@@ -514,7 +514,7 @@ int ScriptManager::handleOpcode(byte *dataP) {
switch (READ_LE_INT16(dataP + 5)) {
case 6:
_vm->_objectsManager->removeSprite(0);
- _vm->_objectsManager->OPTI_ONE(20, 0, 14, 4);
+ _vm->_objectsManager->setAndPlayAnim(20, 0, 14, true);
break;
case 7:
@@ -894,7 +894,7 @@ int ScriptManager::handleOpcode(byte *dataP) {
case 50:
_vm->_soundManager->playSoundFile("SOUND46.WAv");
- _vm->_objectsManager->OPTI_ONE(11, 0, 23, 0);
+ _vm->_objectsManager->setAndPlayAnim(11, 0, 23, false);
break;
case 51: {
@@ -946,7 +946,7 @@ int ScriptManager::handleOpcode(byte *dataP) {
case 55:
_vm->_objectsManager->stopBobAnimation(1);
- _vm->_objectsManager->OPTI_ONE(15, 0, 12, 0);
+ _vm->_objectsManager->setAndPlayAnim(15, 0, 12, false);
_vm->_objectsManager->stopBobAnimation(15);
_vm->_objectsManager->loadLinkFile("IM19a", true);
break;
@@ -2102,7 +2102,7 @@ int ScriptManager::handleOpcode(byte *dataP) {
break;
}
_vm->_soundManager->playSoundFile("SOUND83.WAV");
- _vm->_objectsManager->OPTI_ONE(vbobFrameIndex, 26, 50, 0);
+ _vm->_objectsManager->setAndPlayAnim(vbobFrameIndex, 26, 50, false);
switch (_vm->_globals->_saveData->_data[svField341]) {
case 1:
@@ -2120,7 +2120,7 @@ int ScriptManager::handleOpcode(byte *dataP) {
}
}
_vm->_soundManager->playSoundFile("SOUND83.WAV");
- _vm->_objectsManager->OPTI_ONE(6, 0, 23, 0);
+ _vm->_objectsManager->setAndPlayAnim(6, 0, 23, false);
_vm->_graphicsManager->fastDisplay(_vm->_globals->_levelSpriteBuf, 27, 117, 1);
break;
}
@@ -2140,7 +2140,7 @@ int ScriptManager::handleOpcode(byte *dataP) {
if (_vm->_globals->_saveData->_data[svField341]) {
_vm->_soundManager->playSoundFile("SOUND83.WAV");
- _vm->_objectsManager->OPTI_ONE(vbobFrameIndex, 26, 50, 0);
+ _vm->_objectsManager->setAndPlayAnim(vbobFrameIndex, 26, 50, false);
switch (_vm->_globals->_saveData->_data[svField341]) {
case 1:
@@ -2159,7 +2159,7 @@ int ScriptManager::handleOpcode(byte *dataP) {
}
_vm->_soundManager->playSoundFile("SOUND83.WAV");
- _vm->_objectsManager->OPTI_ONE(5, 0, 23, 0);
+ _vm->_objectsManager->setAndPlayAnim(5, 0, 23, false);
_vm->_graphicsManager->fastDisplay(_vm->_globals->_levelSpriteBuf, 145, 166, 3);
break;
}
@@ -2179,7 +2179,7 @@ int ScriptManager::handleOpcode(byte *dataP) {
if (_vm->_globals->_saveData->_data[svField341]) {
_vm->_soundManager->playSoundFile("SOUND83.WAV");
- _vm->_objectsManager->OPTI_ONE(vbobFrameIndex, 26, 50, 0);
+ _vm->_objectsManager->setAndPlayAnim(vbobFrameIndex, 26, 50, false);
switch (_vm->_globals->_saveData->_data[svField341]) {
case 1:
_vm->_graphicsManager->fastDisplay(_vm->_globals->_levelSpriteBuf, 27, 117, 0);
@@ -2196,7 +2196,7 @@ int ScriptManager::handleOpcode(byte *dataP) {
}
}
_vm->_soundManager->playSoundFile("SOUND83.WAV");
- _vm->_objectsManager->OPTI_ONE(4, 0, 23, 0);
+ _vm->_objectsManager->setAndPlayAnim(4, 0, 23, false);
_vm->_graphicsManager->fastDisplay(_vm->_globals->_levelSpriteBuf, 296, 212, 5);
break;
}
@@ -2204,7 +2204,7 @@ int ScriptManager::handleOpcode(byte *dataP) {
case 239:
_vm->_objectsManager->removeSprite(0);
_vm->_soundManager->playSoundFile("SOUND84.WAV");
- _vm->_objectsManager->OPTI_ONE(16, 0, 10, 0);
+ _vm->_objectsManager->setAndPlayAnim(16, 0, 10, false);
break;
case 240: {
@@ -2297,13 +2297,13 @@ int ScriptManager::handleOpcode(byte *dataP) {
if (_vm->_globals->_saveData->_data[svField341] == 2) {
_vm->_animationManager->playSequence("RESU.SEQ", 2, 24, 2, false, true);
} else {
- _vm->_objectsManager->OPTI_ONE(7, 0, 14, 0);
+ _vm->_objectsManager->setAndPlayAnim(7, 0, 14, false);
}
break;
case 245:
_vm->_soundManager->playSoundFile("SOUND89.WAV");
- _vm->_objectsManager->OPTI_ONE(5, 0, 6, 0);
+ _vm->_objectsManager->setAndPlayAnim(5, 0, 6, false);
_vm->_linesManager->_zone[4]._destX = 276;
_vm->_objectsManager->enableVerb(4, 19);
_vm->_graphicsManager->fastDisplay(_vm->_globals->_levelSpriteBuf, 285, 379, 0);
@@ -2312,7 +2312,7 @@ int ScriptManager::handleOpcode(byte *dataP) {
case 246:
_vm->_objectsManager->removeSprite(0);
- _vm->_objectsManager->OPTI_ONE(6, 0, 15, 0);
+ _vm->_objectsManager->setAndPlayAnim(6, 0, 15, false);
_vm->_objectsManager->_charactersEnabledFl = true;
_vm->_graphicsManager->NB_SCREEN(true);
_vm->_animationManager->playSequence2("TUNNEL.SEQ", 1, 18, 20, true);
@@ -2339,17 +2339,17 @@ int ScriptManager::handleOpcode(byte *dataP) {
case 601:
_vm->_graphicsManager->fastDisplay(_vm->_globals->_levelSpriteBuf, 513, 163, 7, false);
- _vm->_objectsManager->OPTI_ONE(2, 0, 16, 4);
+ _vm->_objectsManager->setAndPlayAnim(2, 0, 16, true);
break;
case 602:
_vm->_graphicsManager->fastDisplay(_vm->_globals->_levelSpriteBuf, 513, 163, 7, false);
- _vm->_objectsManager->OPTI_ONE(4, 0, 16, 4);
+ _vm->_objectsManager->setAndPlayAnim(4, 0, 16, true);
break;
case 603:
_vm->_graphicsManager->fastDisplay(_vm->_globals->_levelSpriteBuf, 513, 163, 7, false);
- _vm->_objectsManager->OPTI_ONE(3, 0, 16, 4);
+ _vm->_objectsManager->setAndPlayAnim(3, 0, 16, true);
_vm->_soundManager->_specialSoundNum = 199;
_vm->_graphicsManager->_fadingFl = true;
_vm->_animationManager->playAnim("BOMBE2A.ANM", 50, 14, 500);
@@ -2361,7 +2361,7 @@ int ScriptManager::handleOpcode(byte *dataP) {
case 604:
_vm->_graphicsManager->fastDisplay(_vm->_globals->_levelSpriteBuf, 513, 163, 7, false);
- _vm->_objectsManager->OPTI_ONE(1, 0, 16, 4);
+ _vm->_objectsManager->setAndPlayAnim(1, 0, 16, true);
_vm->_soundManager->_specialSoundNum = 199;
_vm->_animationManager->playAnim("BOMBE2A.ANM", 50, 14, 500);
_vm->_soundManager->_specialSoundNum = 0;
@@ -2372,7 +2372,7 @@ int ScriptManager::handleOpcode(byte *dataP) {
case 605:
_vm->_graphicsManager->fastDisplay(_vm->_globals->_levelSpriteBuf, 513, 163, 7, false);
- _vm->_objectsManager->OPTI_ONE(5, 0, 16, 4);
+ _vm->_objectsManager->setAndPlayAnim(5, 0, 16, true);
_vm->_graphicsManager->fadeOutShort();
_vm->_soundManager->_specialSoundNum = 199;
_vm->_graphicsManager->_fadingFl = true;
@@ -2385,7 +2385,7 @@ int ScriptManager::handleOpcode(byte *dataP) {
case 606:
_vm->_graphicsManager->fastDisplay(_vm->_globals->_levelSpriteBuf, 513, 163, 7, false);
- _vm->_objectsManager->OPTI_ONE(6, 0, 16, 4);
+ _vm->_objectsManager->setAndPlayAnim(6, 0, 16, true);
if ((_vm->getPlatform() != Common::kPlatformWindows) || !_vm->getIsDemo()) {
_vm->_animationManager->playAnim("BOMBE3A.ANM", 50, 14, 500);
memset(_vm->_graphicsManager->_frontBuffer, 0, 614400);