aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSven Hesse2009-07-05 11:29:30 +0000
committerSven Hesse2009-07-05 11:29:30 +0000
commit14172febf717702421332dc599e4970a578336cb (patch)
tree5b277dbbb86d90e3bc6f888da890b0b18a4d9e35
parent7be3530ffbc0485d56564e8ff015b4979d90b7ad (diff)
downloadscummvm-rg350-14172febf717702421332dc599e4970a578336cb.tar.gz
scummvm-rg350-14172febf717702421332dc599e4970a578336cb.tar.bz2
scummvm-rg350-14172febf717702421332dc599e4970a578336cb.zip
Merging playTot()
svn-id: r42129
-rw-r--r--engines/gob/game.cpp134
-rw-r--r--engines/gob/game.h12
-rw-r--r--engines/gob/game_v1.cpp114
-rw-r--r--engines/gob/game_v2.cpp132
-rw-r--r--engines/gob/game_v6.cpp2
5 files changed, 138 insertions, 256 deletions
diff --git a/engines/gob/game.cpp b/engines/gob/game.cpp
index 97a4c265fd..731a76e712 100644
--- a/engines/gob/game.cpp
+++ b/engines/gob/game.cpp
@@ -37,6 +37,7 @@
#include "gob/inter.h"
#include "gob/draw.h"
#include "gob/mult.h"
+#include "gob/scenery.h"
#include "gob/videoplayer.h"
#include "gob/sound/sound.h"
@@ -241,6 +242,137 @@ void Game::prepareStart() {
_startTimeKey = _vm->_util->getTimeKey();
}
+void Game::playTot(int16 skipPlay) {
+ char savedTotName[20];
+ int16 *oldCaptureCounter;
+ int16 *oldBreakFrom;
+ int16 *oldNestLevel;
+ int16 _captureCounter;
+ int16 breakFrom;
+ int16 nestLevel;
+
+ oldNestLevel = _vm->_inter->_nestLevel;
+ oldBreakFrom = _vm->_inter->_breakFromLevel;
+ oldCaptureCounter = _vm->_scenery->_pCaptureCounter;
+
+ _script->push();
+
+ _vm->_inter->_nestLevel = &nestLevel;
+ _vm->_inter->_breakFromLevel = &breakFrom;
+ _vm->_scenery->_pCaptureCounter = &_captureCounter;
+ strcpy(savedTotName, _curTotFile);
+
+ if (skipPlay <= 0) {
+ while (!_vm->shouldQuit()) {
+ if (_vm->_inter->_variables)
+ _vm->_draw->animateCursor(4);
+
+ if (skipPlay != -1) {
+ _vm->_inter->initControlVars(1);
+
+ for (int i = 0; i < 4; i++) {
+ _vm->_draw->_fontToSprite[i].sprite = -1;
+ _vm->_draw->_fontToSprite[i].base = -1;
+ _vm->_draw->_fontToSprite[i].width = -1;
+ _vm->_draw->_fontToSprite[i].height = -1;
+ }
+
+ _vm->_mult->initAll();
+ _vm->_mult->zeroMultData();
+
+ _vm->_draw->_spritesArray[20] = _vm->_draw->_frontSurface;
+ _vm->_draw->_spritesArray[21] = _vm->_draw->_backSurface;
+ _vm->_draw->_cursorSpritesBack = _vm->_draw->_cursorSprites;
+ } else
+ _vm->_inter->initControlVars(0);
+
+ _vm->_draw->_cursorHotspotXVar = -1;
+ _totToLoad[0] = 0;
+
+ if ((_curTotFile[0] == 0) && (!_script->isLoaded()))
+ break;
+
+ if (skipPlay == -2) {
+ _vm->_vidPlayer->primaryClose();
+ skipPlay = 0;
+ }
+
+ if (!_script->load(_curTotFile)) {
+ _vm->_draw->blitCursor();
+ _vm->_inter->_terminate = 2;
+ break;
+ }
+
+ _resources->load(_curTotFile);
+
+ _vm->_global->_inter_animDataSize = _script->getAnimDataSize();
+ if (!_vm->_inter->_variables)
+ _vm->_inter->allocateVars(_script->getVariablesCount() & 0xFFFF);
+
+ _script->seek(_script->getFunctionOffset(TOTFile::kFunctionStart));
+
+ _vm->_inter->renewTimeInVars();
+
+ WRITE_VAR(13, _vm->_global->_useMouse);
+ WRITE_VAR(14, _vm->_global->_soundFlags);
+ WRITE_VAR(15, _vm->_global->_fakeVideoMode);
+ WRITE_VAR(16, _vm->_global->_language);
+
+ _vm->_inter->callSub(2);
+
+ if (_totToLoad[0] != 0)
+ _vm->_inter->_terminate = 0;
+
+ _vm->_draw->blitInvalidated();
+
+ _script->unload();
+
+ _resources->unload();
+
+ for (int i = 0; i < *_vm->_scenery->_pCaptureCounter; i++)
+ capturePop(0);
+
+ if (skipPlay != -1) {
+ _vm->_goblin->freeObjects();
+
+ _vm->_sound->blasterStop(0);
+
+ for (int i = 0; i < Sound::kSoundsCount; i++) {
+ SoundDesc *sound = _vm->_sound->sampleGetBySlot(i);
+
+ if (sound &&
+ ((sound->getType() == SOUND_SND) || (sound->getType() == SOUND_WAV)))
+ _vm->_sound->sampleFree(sound);
+ }
+ }
+
+ if (_totToLoad[0] == 0)
+ break;
+
+ strcpy(_curTotFile, _totToLoad);
+ }
+ } else {
+ _vm->_inter->initControlVars(0);
+ _vm->_scenery->_pCaptureCounter = oldCaptureCounter;
+ _script->seek(_script->getFunctionOffset(skipPlay + 1));
+
+ _menuLevel++;
+ _vm->_inter->callSub(2);
+ _menuLevel--;
+
+ if (_vm->_inter->_terminate != 0)
+ _vm->_inter->_terminate = 2;
+ }
+
+ strcpy(_curTotFile, savedTotName);
+
+ _vm->_inter->_nestLevel = oldNestLevel;
+ _vm->_inter->_breakFromLevel = oldBreakFrom;
+ _vm->_scenery->_pCaptureCounter = oldCaptureCounter;
+
+ _script->pop();
+}
+
void Game::capturePush(int16 left, int16 top, int16 width, int16 height) {
int16 right;
@@ -394,7 +526,7 @@ int16 Game::checkKeys(int16 *pMouseX, int16 *pMouseY,
return _vm->_util->checkKey();
}
-void Game::start(void) {
+void Game::start() {
prepareStart();
playTot(-2);
diff --git a/engines/gob/game.h b/engines/gob/game.h
index 7f4f9e2cd2..4a8008a504 100644
--- a/engines/gob/game.h
+++ b/engines/gob/game.h
@@ -94,6 +94,8 @@ public:
virtual void prepareStart();
+ void playTot(int16 skipPlay);
+
void capturePush(int16 left, int16 top, int16 width, int16 height);
void capturePop(char doDraw);
@@ -103,13 +105,11 @@ public:
int16 checkKeys(int16 *pMousex = 0, int16 *pMouseY = 0,
MouseButtons *pButtons = 0, char handleMouse = 0);
- void start(void);
+ void start();
void totSub(int8 flags, const char *newTotFile);
void switchTotSub(int16 index, int16 skipPlay);
- virtual void playTot(int16 skipPlay) = 0;
-
protected:
uint32 _menuLevel;
@@ -133,16 +133,12 @@ class Game_v1 : public Game {
public:
Game_v1(GobEngine *vm);
virtual ~Game_v1() {}
-
- virtual void playTot(int16 skipPlay);
};
class Game_v2 : public Game_v1 {
public:
Game_v2(GobEngine *vm);
virtual ~Game_v2() {}
-
- virtual void playTot(int16 skipPlay);
};
class Game_v6 : public Game_v2 {
@@ -150,7 +146,7 @@ public:
Game_v6(GobEngine *vm);
virtual ~Game_v6() {}
- virtual void prepareStart(void);
+ virtual void prepareStart();
};
} // End of namespace Gob
diff --git a/engines/gob/game_v1.cpp b/engines/gob/game_v1.cpp
index 936311a986..84a3544ffd 100644
--- a/engines/gob/game_v1.cpp
+++ b/engines/gob/game_v1.cpp
@@ -46,118 +46,4 @@ namespace Gob {
Game_v1::Game_v1(GobEngine *vm) : Game(vm) {
}
-void Game_v1::playTot(int16 skipPlay) {
- int16 _captureCounter;
- int16 breakFrom;
- int16 nestLevel;
-
- int16 *oldNestLevel = _vm->_inter->_nestLevel;
- int16 *oldBreakFrom = _vm->_inter->_breakFromLevel;
- int16 *oldCaptureCounter = _vm->_scenery->_pCaptureCounter;
-
- _script->push();
-
- _vm->_inter->_nestLevel = &nestLevel;
- _vm->_inter->_breakFromLevel = &breakFrom;
- _vm->_scenery->_pCaptureCounter = &_captureCounter;
-
- char savedTotName[20];
- strcpy(savedTotName, _curTotFile);
-
- if (skipPlay <= 0) {
- while (!_vm->shouldQuit()) {
- for (int i = 0; i < 4; i++) {
- _vm->_draw->_fontToSprite[i].sprite = -1;
- _vm->_draw->_fontToSprite[i].base = -1;
- _vm->_draw->_fontToSprite[i].width = -1;
- _vm->_draw->_fontToSprite[i].height = -1;
- }
-
- if ((_vm->getPlatform() == Common::kPlatformMacintosh)||
- (_vm->getPlatform() == Common::kPlatformWindows))
- _vm->_sound->adlibStop();
- else
- _vm->_sound->cdStop();
-
- _vm->_draw->animateCursor(4);
- _vm->_inter->initControlVars(1);
- _vm->_mult->initAll();
- _vm->_mult->zeroMultData();
-
- for (int i = 0; i < SPRITES_COUNT; i++)
- _vm->_draw->freeSprite(i);
-
- _vm->_draw->_spritesArray[20] = _vm->_draw->_frontSurface;
- _vm->_draw->_spritesArray[21] = _vm->_draw->_backSurface;
- _vm->_draw->_spritesArray[23] = _vm->_draw->_cursorSprites;
-
- for (int i = 0; i < 20; i++)
- freeSoundSlot(i);
-
- _totToLoad[0] = 0;
-
- if ((_curTotFile[0] == 0) && !_script->isLoaded())
- break;
-
- if (!_script->load(_curTotFile)) {
- _vm->_draw->blitCursor();
- break;
- }
-
- _resources->load(_curTotFile);
-
- _vm->_global->_inter_animDataSize = _script->getAnimDataSize();
- if (!_vm->_inter->_variables)
- _vm->_inter->allocateVars(_script->getVariablesCount() & 0xFFFF);
-
- _script->seek(_script->getFunctionOffset(TOTFile::kFunctionStart));
-
- _vm->_inter->renewTimeInVars();
-
- WRITE_VAR(13, _vm->_global->_useMouse);
- WRITE_VAR(14, _vm->_global->_soundFlags);
- WRITE_VAR(15, _vm->_global->_videoMode);
- WRITE_VAR(16, _vm->_global->_language);
-
- _vm->_inter->callSub(2);
- _script->setFinished(false);
-
- if (_totToLoad[0] != 0)
- _vm->_inter->_terminate = 0;
-
- _vm->_draw->blitInvalidated();
-
- _script->unload();
-
- _resources->unload();
-
- for (int i = 0; i < *_vm->_scenery->_pCaptureCounter; i++)
- capturePop(0);
-
- _vm->_mult->checkFreeMult();
- _vm->_mult->freeAll();
-
- for (int i = 0; i < SPRITES_COUNT; i++)
- _vm->_draw->freeSprite(i);
- _vm->_sound->blasterStop(0);
-
- for (int i = 0; i < 20; i++)
- freeSoundSlot(i);
-
- if (_totToLoad[0] == 0)
- break;
-
- strcpy(_curTotFile, _totToLoad);
- }
- }
-
- strcpy(_curTotFile, savedTotName);
-
- _vm->_inter->_nestLevel = oldNestLevel;
- _vm->_inter->_breakFromLevel = oldBreakFrom;
- _vm->_scenery->_pCaptureCounter = oldCaptureCounter;
-
- _script->pop();
-}
-
} // End of namespace Gob
diff --git a/engines/gob/game_v2.cpp b/engines/gob/game_v2.cpp
index 725a66e4d6..3cad49a0f9 100644
--- a/engines/gob/game_v2.cpp
+++ b/engines/gob/game_v2.cpp
@@ -38,7 +38,6 @@
#include "gob/goblin.h"
#include "gob/inter.h"
#include "gob/mult.h"
-#include "gob/scenery.h"
#include "gob/video.h"
#include "gob/videoplayer.h"
#include "gob/sound/sound.h"
@@ -48,135 +47,4 @@ namespace Gob {
Game_v2::Game_v2(GobEngine *vm) : Game_v1(vm) {
}
-void Game_v2::playTot(int16 skipPlay) {
- char savedTotName[20];
- int16 *oldCaptureCounter;
- int16 *oldBreakFrom;
- int16 *oldNestLevel;
- int16 _captureCounter;
- int16 breakFrom;
- int16 nestLevel;
-
- oldNestLevel = _vm->_inter->_nestLevel;
- oldBreakFrom = _vm->_inter->_breakFromLevel;
- oldCaptureCounter = _vm->_scenery->_pCaptureCounter;
-
- _script->push();
-
- _vm->_inter->_nestLevel = &nestLevel;
- _vm->_inter->_breakFromLevel = &breakFrom;
- _vm->_scenery->_pCaptureCounter = &_captureCounter;
- strcpy(savedTotName, _curTotFile);
-
- if (skipPlay <= 0) {
- while (!_vm->shouldQuit()) {
- if (_vm->_inter->_variables)
- _vm->_draw->animateCursor(4);
-
- if (skipPlay != -1) {
- _vm->_inter->initControlVars(1);
-
- for (int i = 0; i < 4; i++) {
- _vm->_draw->_fontToSprite[i].sprite = -1;
- _vm->_draw->_fontToSprite[i].base = -1;
- _vm->_draw->_fontToSprite[i].width = -1;
- _vm->_draw->_fontToSprite[i].height = -1;
- }
-
- _vm->_mult->initAll();
- _vm->_mult->zeroMultData();
-
- _vm->_draw->_spritesArray[20] = _vm->_draw->_frontSurface;
- _vm->_draw->_spritesArray[21] = _vm->_draw->_backSurface;
- _vm->_draw->_cursorSpritesBack = _vm->_draw->_cursorSprites;
- } else
- _vm->_inter->initControlVars(0);
-
- _vm->_draw->_cursorHotspotXVar = -1;
- _totToLoad[0] = 0;
-
- if ((_curTotFile[0] == 0) && (!_script->isLoaded()))
- break;
-
- if (skipPlay == -2) {
- _vm->_vidPlayer->primaryClose();
- skipPlay = 0;
- }
-
- if (!_script->load(_curTotFile)) {
- _vm->_draw->blitCursor();
- _vm->_inter->_terminate = 2;
- break;
- }
-
- _resources->load(_curTotFile);
-
- _vm->_global->_inter_animDataSize = _script->getAnimDataSize();
- if (!_vm->_inter->_variables)
- _vm->_inter->allocateVars(_script->getVariablesCount() & 0xFFFF);
-
- _script->seek(_script->getFunctionOffset(TOTFile::kFunctionStart));
-
- _vm->_inter->renewTimeInVars();
-
- WRITE_VAR(13, _vm->_global->_useMouse);
- WRITE_VAR(14, _vm->_global->_soundFlags);
- WRITE_VAR(15, _vm->_global->_fakeVideoMode);
- WRITE_VAR(16, _vm->_global->_language);
-
- _vm->_inter->callSub(2);
-
- if (_totToLoad[0] != 0)
- _vm->_inter->_terminate = 0;
-
- _vm->_draw->blitInvalidated();
-
- _script->unload();
-
- _resources->unload();
-
- for (int i = 0; i < *_vm->_scenery->_pCaptureCounter; i++)
- capturePop(0);
-
- if (skipPlay != -1) {
- _vm->_goblin->freeObjects();
-
- _vm->_sound->blasterStop(0);
-
- for (int i = 0; i < Sound::kSoundsCount; i++) {
- SoundDesc *sound = _vm->_sound->sampleGetBySlot(i);
-
- if (sound &&
- ((sound->getType() == SOUND_SND) || (sound->getType() == SOUND_WAV)))
- _vm->_sound->sampleFree(sound);
- }
- }
-
- if (_totToLoad[0] == 0)
- break;
-
- strcpy(_curTotFile, _totToLoad);
- }
- } else {
- _vm->_inter->initControlVars(0);
- _vm->_scenery->_pCaptureCounter = oldCaptureCounter;
- _script->seek(_script->getFunctionOffset(skipPlay + 1));
-
- _menuLevel++;
- _vm->_inter->callSub(2);
- _menuLevel--;
-
- if (_vm->_inter->_terminate != 0)
- _vm->_inter->_terminate = 2;
- }
-
- strcpy(_curTotFile, savedTotName);
-
- _vm->_inter->_nestLevel = oldNestLevel;
- _vm->_inter->_breakFromLevel = oldBreakFrom;
- _vm->_scenery->_pCaptureCounter = oldCaptureCounter;
-
- _script->pop();
-}
-
} // End of namespace Gob
diff --git a/engines/gob/game_v6.cpp b/engines/gob/game_v6.cpp
index be6bdff5b0..814b973ed9 100644
--- a/engines/gob/game_v6.cpp
+++ b/engines/gob/game_v6.cpp
@@ -42,7 +42,7 @@ namespace Gob {
Game_v6::Game_v6(GobEngine *vm) : Game_v2(vm) {
}
-void Game_v6::prepareStart(void) {
+void Game_v6::prepareStart() {
_noCd = false;
if (Common::File::exists("cd1.itk") && Common::File::exists("cd2.itk") &&