some HE related cleanup

svn-id: r24163
This commit is contained in:
Max Horn 2006-10-07 11:54:50 +00:00
parent 05e7423ed8
commit ef30cdf78b
4 changed files with 74 additions and 60 deletions

View file

@ -444,27 +444,32 @@ protected:
int32 _curSpriteId; int32 _curSpriteId;
int32 _curSpriteGroupId; int32 _curSpriteGroupId;
public:
ScummEngine_v90he(OSystem *syst, const DetectorResult &dr);
~ScummEngine_v90he();
virtual void resetScumm();
LogicHE *_logicHE; LogicHE *_logicHE;
MoviePlayer *_moviePlay; MoviePlayer *_moviePlay;
Sprite *_sprite; Sprite *_sprite;
public:
ScummEngine_v90he(OSystem *syst, const DetectorResult &dr);
~ScummEngine_v90he();
protected: protected:
virtual void allocateArrays(); virtual void allocateArrays();
virtual void setupOpcodes(); virtual void setupOpcodes();
virtual void executeOpcode(byte i); virtual void executeOpcode(byte i);
virtual const char *getOpcodeDesc(byte i); virtual const char *getOpcodeDesc(byte i);
virtual void scummLoop_handleDrawing(); virtual void resetScumm();
virtual void setupScummVars(); virtual void setupScummVars();
virtual void resetScummVars(); 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 saveOrLoad(Serializer *s);
virtual void readMAXS(int blockSize); virtual void readMAXS(int blockSize);

View file

@ -194,14 +194,25 @@ void ScummEngine::parseEvents() {
} }
} }
#ifndef DISABLE_HE
void ScummEngine_v90he::clearClickedStatus() {
ScummEngine::clearClickedStatus();
if (_game.heversion >= 98) {
_logicHE->processKeyStroke(_keyPressed);
}
}
void ScummEngine_v90he::processKbd(bool smushMode) {
if (_game.heversion >= 98) {
_logicHE->processKeyStroke(_keyPressed);
}
ScummEngine::processKbd(smushMode);
}
#endif
void ScummEngine::clearClickedStatus() { void ScummEngine::clearClickedStatus() {
_keyPressed = 0; _keyPressed = 0;
#ifndef DISABLE_HE
if (_game.heversion >= 98) {
((ScummEngine_v90he *)this)->_logicHE->processKeyStroke(_keyPressed);
}
#endif
_mouseAndKeyboardStat = 0; _mouseAndKeyboardStat = 0;
_leftBtnPressed &= ~msClicked; _leftBtnPressed &= ~msClicked;
_rightBtnPressed &= ~msClicked; _rightBtnPressed &= ~msClicked;
@ -210,12 +221,6 @@ void ScummEngine::clearClickedStatus() {
void ScummEngine::processKbd(bool smushMode) { void ScummEngine::processKbd(bool smushMode) {
int saveloadkey; int saveloadkey;
#ifndef DISABLE_HE
if (_game.heversion >= 98) {
((ScummEngine_v90he *)this)->_logicHE->processKeyStroke(_keyPressed);
}
#endif
_lastKeyHit = _keyPressed; _lastKeyHit = _keyPressed;
_keyPressed = 0; _keyPressed = 0;
if (((_game.version <= 2) || (_game.platform == Common::kPlatformFMTowns && _game.version == 3)) && 315 <= _lastKeyHit && _lastKeyHit < 315+12) { if (((_game.version <= 2) || (_game.platform == Common::kPlatformFMTowns && _game.version == 3)) && 315 <= _lastKeyHit && _lastKeyHit < 315+12) {

View file

@ -1534,21 +1534,8 @@ int ScummEngine::go() {
// If requested, load a save game instead of running the boot script // If requested, load a save game instead of running the boot script
if (_saveLoadFlag != 2 || !loadState(_saveLoadSlot, _saveTemporaryState)) { if (_saveLoadFlag != 2 || !loadState(_saveLoadSlot, _saveTemporaryState)) {
int args[16];
memset(args, 0, sizeof(args));
args[0] = _bootParam;
_saveLoadFlag = 0; _saveLoadFlag = 0;
#ifndef DISABLE_HE runBootscript();
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);
} else { } else {
_saveLoadFlag = 0; _saveLoadFlag = 0;
} }
@ -1558,6 +1545,13 @@ int ScummEngine::go() {
while (!_quit) { 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(); diff -= _system->getMillis();
waitForTimer(delta * 15 + diff); waitForTimer(delta * 15 + diff);
diff = _system->getMillis(); diff = _system->getMillis();
@ -1595,21 +1589,6 @@ void ScummEngine::waitForTimer(int msec_delay) {
} }
int ScummEngine::scummLoop(int delta) { 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) { if (_game.version >= 3) {
VAR(VAR_TMR_1) += delta; VAR(VAR_TMR_1) += delta;
VAR(VAR_TMR_2) += delta; VAR(VAR_TMR_2) += delta;
@ -1783,21 +1762,30 @@ load_game:
/* show or hide mouse */ /* show or hide mouse */
CursorMan.showMouse(_cursor.state > 0); 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) if (VAR_TIMER != 0xFF)
VAR(VAR_TIMER) = 0; VAR(VAR_TIMER) = 0;
return (VAR_TIMER_NEXT != 0xFF) ? VAR(VAR_TIMER_NEXT) : 4; 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() { void ScummEngine::scummLoop_updateScummVars() {
if (_game.features & GF_NEW_CAMERA) { if (_game.features & GF_NEW_CAMERA) {
VAR(VAR_CAMERA_POS_X) = camera._cur.x; VAR(VAR_CAMERA_POS_X) = camera._cur.x;
@ -2031,6 +2019,10 @@ void ScummEngine::restart() {
_sound->setupSound(); _sound->setupSound();
// Re-run bootscript // Re-run bootscript
runBootscript();
}
void ScummEngine::runBootscript() {
int args[16]; int args[16];
memset(args, 0, sizeof(args)); memset(args, 0, sizeof(args));
args[0] = _bootParam; args[0] = _bootParam;
@ -2040,6 +2032,17 @@ void ScummEngine::restart() {
runScript(1, 0, 0, args); 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() { void ScummEngine::startManiac() {
debug(0, "stub 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."); 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.");

View file

@ -481,23 +481,24 @@ protected:
void setTalkspeed(int talkspeed); void setTalkspeed(int talkspeed);
int getTalkspeed(); int getTalkspeed();
protected:
// Scumm main loop & helper functions. // Scumm main loop & helper functions.
int scummLoop(int delta); virtual int scummLoop(int delta);
virtual void scummLoop_updateScummVars(); virtual void scummLoop_updateScummVars();
virtual void scummLoop_handleSaveLoad(); virtual void scummLoop_handleSaveLoad();
virtual void scummLoop_handleDrawing(); virtual void scummLoop_handleDrawing();
virtual void scummLoop_handleActors() = 0; virtual void scummLoop_handleActors() = 0;
virtual void scummLoop_handleEffects(); virtual void scummLoop_handleEffects();
virtual void scummLoop_handleSound(); virtual void scummLoop_handleSound();
virtual void runBootscript();
// Event handling // Event handling
public: public:
void parseEvents(); // Used by IMuseDigital::startSound void parseEvents(); // Used by IMuseDigital::startSound
protected: protected:
void waitForTimer(int msec_delay); void waitForTimer(int msec_delay);
void processKbd(bool smushMode); virtual void processKbd(bool smushMode);
void clearClickedStatus(); virtual void clearClickedStatus();
// Cursor/palette // Cursor/palette
void updateCursor(); void updateCursor();