aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2006-10-07 11:54:50 +0000
committerMax Horn2006-10-07 11:54:50 +0000
commitef30cdf78bcb685fea823c6e95b6490ffd66823f (patch)
treec121dfa4f24888d4fa171ed1adff9d595b845592
parent05e7423ed8edc62f6a0268c817711ab74eeee92d (diff)
downloadscummvm-rg350-ef30cdf78bcb685fea823c6e95b6490ffd66823f.tar.gz
scummvm-rg350-ef30cdf78bcb685fea823c6e95b6490ffd66823f.tar.bz2
scummvm-rg350-ef30cdf78bcb685fea823c6e95b6490ffd66823f.zip
some HE related cleanup
svn-id: r24163
-rw-r--r--engines/scumm/he/intern_he.h19
-rw-r--r--engines/scumm/input.cpp25
-rw-r--r--engines/scumm/scumm.cpp79
-rw-r--r--engines/scumm/scumm.h9
4 files changed, 73 insertions, 59 deletions
diff --git a/engines/scumm/he/intern_he.h b/engines/scumm/he/intern_he.h
index f7e56eb45d..75fecbc021 100644
--- a/engines/scumm/he/intern_he.h
+++ b/engines/scumm/he/intern_he.h
@@ -444,27 +444,32 @@ protected:
int32 _curSpriteId;
int32 _curSpriteGroupId;
-public:
- ScummEngine_v90he(OSystem *syst, const DetectorResult &dr);
- ~ScummEngine_v90he();
-
- virtual void resetScumm();
-
LogicHE *_logicHE;
MoviePlayer *_moviePlay;
Sprite *_sprite;
+public:
+ ScummEngine_v90he(OSystem *syst, const DetectorResult &dr);
+ ~ScummEngine_v90he();
+
protected:
virtual void allocateArrays();
virtual void setupOpcodes();
virtual void executeOpcode(byte i);
virtual const char *getOpcodeDesc(byte i);
- virtual void scummLoop_handleDrawing();
+ virtual void resetScumm();
virtual void setupScummVars();
virtual void resetScummVars();
+ virtual int scummLoop(int delta);
+ virtual void scummLoop_handleDrawing();
+ virtual void runBootscript();
+
+ virtual void processKbd(bool smushMode);
+ virtual void clearClickedStatus();
+
virtual void saveOrLoad(Serializer *s);
virtual void readMAXS(int blockSize);
diff --git a/engines/scumm/input.cpp b/engines/scumm/input.cpp
index eb814b2819..6516262c8b 100644
--- a/engines/scumm/input.cpp
+++ b/engines/scumm/input.cpp
@@ -194,14 +194,25 @@ void ScummEngine::parseEvents() {
}
}
-void ScummEngine::clearClickedStatus() {
- _keyPressed = 0;
-
#ifndef DISABLE_HE
+void ScummEngine_v90he::clearClickedStatus() {
+ ScummEngine::clearClickedStatus();
if (_game.heversion >= 98) {
- ((ScummEngine_v90he *)this)->_logicHE->processKeyStroke(_keyPressed);
+ _logicHE->processKeyStroke(_keyPressed);
}
+}
+
+void ScummEngine_v90he::processKbd(bool smushMode) {
+ if (_game.heversion >= 98) {
+ _logicHE->processKeyStroke(_keyPressed);
+ }
+ ScummEngine::processKbd(smushMode);
+}
#endif
+
+void ScummEngine::clearClickedStatus() {
+ _keyPressed = 0;
+
_mouseAndKeyboardStat = 0;
_leftBtnPressed &= ~msClicked;
_rightBtnPressed &= ~msClicked;
@@ -210,12 +221,6 @@ void ScummEngine::clearClickedStatus() {
void ScummEngine::processKbd(bool smushMode) {
int saveloadkey;
-#ifndef DISABLE_HE
- if (_game.heversion >= 98) {
- ((ScummEngine_v90he *)this)->_logicHE->processKeyStroke(_keyPressed);
- }
-#endif
-
_lastKeyHit = _keyPressed;
_keyPressed = 0;
if (((_game.version <= 2) || (_game.platform == Common::kPlatformFMTowns && _game.version == 3)) && 315 <= _lastKeyHit && _lastKeyHit < 315+12) {
diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp
index 56964071f6..04a2318a65 100644
--- a/engines/scumm/scumm.cpp
+++ b/engines/scumm/scumm.cpp
@@ -1534,21 +1534,8 @@ int ScummEngine::go() {
// If requested, load a save game instead of running the boot script
if (_saveLoadFlag != 2 || !loadState(_saveLoadSlot, _saveTemporaryState)) {
- int args[16];
- memset(args, 0, sizeof(args));
- args[0] = _bootParam;
-
_saveLoadFlag = 0;
-#ifndef DISABLE_HE
- if (_game.heversion >= 98) {
- ((ScummEngine_v90he *)this)->_logicHE->initOnce();
- ((ScummEngine_v90he *)this)->_logicHE->beforeBootScript();
- }
-#endif
- if (_game.id == GID_MANIAC && (_game.features & GF_DEMO))
- runScript(9, 0, 0, args);
- else
- runScript(1, 0, 0, args);
+ runBootscript();
} else {
_saveLoadFlag = 0;
}
@@ -1558,6 +1545,13 @@ int ScummEngine::go() {
while (!_quit) {
+ if (_debugger->isAttached())
+ _debugger->onFrame();
+
+ // Randomize the PRNG by calling it at regular intervals. This ensures
+ // that it will be in a different state each time you run the program.
+ _rnd.getRandomNumber(2);
+
diff -= _system->getMillis();
waitForTimer(delta * 15 + diff);
diff = _system->getMillis();
@@ -1595,21 +1589,6 @@ void ScummEngine::waitForTimer(int msec_delay) {
}
int ScummEngine::scummLoop(int delta) {
- if (_debugger->isAttached())
- _debugger->onFrame();
-
- // Randomize the PRNG by calling it at regular intervals. This ensures
- // that it will be in a different state each time you run the program.
- _rnd.getRandomNumber(2);
-
-#ifndef DISABLE_HE
- if (_game.heversion >= 90) {
- ((ScummEngine_v90he *)this)->_moviePlay->handleNextFrame();
- }
- if (_game.heversion >= 98) {
- ((ScummEngine_v90he *)this)->_logicHE->startOfFrame();
- }
-#endif
if (_game.version >= 3) {
VAR(VAR_TMR_1) += delta;
VAR(VAR_TMR_2) += delta;
@@ -1783,21 +1762,30 @@ load_game:
/* show or hide mouse */
CursorMan.showMouse(_cursor.state > 0);
-#ifndef DISABLE_HE
- if (_game.heversion >= 90) {
- ((ScummEngine_v90he *)this)->_sprite->updateImages();
- }
- if (_game.heversion >= 98) {
- ((ScummEngine_v90he *)this)->_logicHE->endOfFrame();
- }
-#endif
-
if (VAR_TIMER != 0xFF)
VAR(VAR_TIMER) = 0;
return (VAR_TIMER_NEXT != 0xFF) ? VAR(VAR_TIMER_NEXT) : 4;
}
+#ifndef DISABLE_HE
+int ScummEngine_v90he::scummLoop(int delta) {
+ _moviePlay->handleNextFrame();
+ if (_game.heversion >= 98) {
+ _logicHE->startOfFrame();
+ }
+
+ int ret = ScummEngine::scummLoop(delta);
+
+ _sprite->updateImages();
+ if (_game.heversion >= 98) {
+ _logicHE->endOfFrame();
+ }
+
+ return ret;
+}
+#endif
+
void ScummEngine::scummLoop_updateScummVars() {
if (_game.features & GF_NEW_CAMERA) {
VAR(VAR_CAMERA_POS_X) = camera._cur.x;
@@ -2031,6 +2019,10 @@ void ScummEngine::restart() {
_sound->setupSound();
// Re-run bootscript
+ runBootscript();
+}
+
+void ScummEngine::runBootscript() {
int args[16];
memset(args, 0, sizeof(args));
args[0] = _bootParam;
@@ -2040,6 +2032,17 @@ void ScummEngine::restart() {
runScript(1, 0, 0, args);
}
+#ifndef DISABLE_HE
+void ScummEngine_v90he::runBootscript() {
+ if (_game.heversion >= 98) {
+ _logicHE->initOnce();
+ _logicHE->beforeBootScript();
+ }
+
+ ScummEngine::runBootscript();
+}
+#endif
+
void ScummEngine::startManiac() {
debug(0, "stub startManiac()");
displayMessage(0, "Usually, Maniac Mansion would start now. But ScummVM doesn't do that yet. To play it, go to 'Add Game' in the ScummVM start menu and select the 'Maniac' directory inside the Tentacle game directory.");
diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h
index 20da240470..f630ad52af 100644
--- a/engines/scumm/scumm.h
+++ b/engines/scumm/scumm.h
@@ -481,23 +481,24 @@ protected:
void setTalkspeed(int talkspeed);
int getTalkspeed();
-protected:
// Scumm main loop & helper functions.
- int scummLoop(int delta);
+ virtual int scummLoop(int delta);
virtual void scummLoop_updateScummVars();
virtual void scummLoop_handleSaveLoad();
virtual void scummLoop_handleDrawing();
virtual void scummLoop_handleActors() = 0;
virtual void scummLoop_handleEffects();
virtual void scummLoop_handleSound();
+
+ virtual void runBootscript();
// Event handling
public:
void parseEvents(); // Used by IMuseDigital::startSound
protected:
void waitForTimer(int msec_delay);
- void processKbd(bool smushMode);
- void clearClickedStatus();
+ virtual void processKbd(bool smushMode);
+ virtual void clearClickedStatus();
// Cursor/palette
void updateCursor();