diff options
-rw-r--r-- | scumm/input.cpp | 5 | ||||
-rw-r--r-- | scumm/intern.h | 2 | ||||
-rw-r--r-- | scumm/script_c64.cpp | 16 | ||||
-rw-r--r-- | scumm/script_v5.cpp | 3 | ||||
-rw-r--r-- | scumm/scumm.cpp | 33 | ||||
-rw-r--r-- | scumm/sound.cpp | 3 | ||||
-rw-r--r-- | scumm/vars.cpp | 27 |
7 files changed, 46 insertions, 43 deletions
diff --git a/scumm/input.cpp b/scumm/input.cpp index 47dbb8d279..87946ed7fe 100644 --- a/scumm/input.cpp +++ b/scumm/input.cpp @@ -437,7 +437,8 @@ void ScummEngine::processKbd(bool smushMode) { // Ensure that the input script also sees the key press. // This is necessary so you can abort the airplane travel // in Zak. - VAR(VAR_KEYPRESS) = VAR(VAR_CUTSCENEEXIT_KEY); + if (VAR_KEYPRESS != 0xFF) + VAR(VAR_KEYPRESS) = VAR(VAR_CUTSCENEEXIT_KEY); } } else if (_lastKeyHit == saveloadkey) { if (VAR_SAVELOAD_SCRIPT != 0xFF && _currentRoom != 0) @@ -490,7 +491,7 @@ void ScummEngine::processKbd(bool smushMode) { // 1) Verb 2) Scene 3) Inv. 4) Key // 5) Sentence Bar - if (_lastKeyHit) { // Key Input + if (VAR_KEYPRESS != 0xFF && _lastKeyHit) { // Key Input VAR(VAR_KEYPRESS) = _lastKeyHit; } } diff --git a/scumm/intern.h b/scumm/intern.h index 336ad250bc..68bfb06c9d 100644 --- a/scumm/intern.h +++ b/scumm/intern.h @@ -426,6 +426,7 @@ protected: void o_getActorMoving(); void o_animateActor(); void o_putActorAtObject(); + void o_lockSound(); void o_lockActor(); void o_loadActor(); void o_loadRoom(); @@ -450,6 +451,7 @@ protected: void o_printEgo_c64(); void o_print_c64(); void o_unlockRoom(); + void o_unlockSound(); void o_beginOverride(); void o_isEqual(); void o_isGreater(); diff --git a/scumm/script_c64.cpp b/scumm/script_c64.cpp index c36157a360..4b21035c7f 100644 --- a/scumm/script_c64.cpp +++ b/scumm/script_c64.cpp @@ -139,7 +139,7 @@ void ScummEngine_c64::setupOpcodes() { OPCODE(o_nop), OPCODE(o_animateActor), OPCODE(o5_actorFollowCamera), - OPCODE(o5_startSound), + OPCODE(o_lockSound), /* 54 */ OPCODE(o5_setObjectName), OPCODE(o2_actorFromPos), @@ -299,7 +299,7 @@ void ScummEngine_c64::setupOpcodes() { OPCODE(o_nop), OPCODE(o_animateActor), OPCODE(o5_actorFollowCamera), - OPCODE(o5_stopSound), + OPCODE(o_unlockSound), /* D4 */ OPCODE(o5_setObjectName), OPCODE(o2_actorFromPos), @@ -487,6 +487,18 @@ void ScummEngine_c64::o_loadSound() { ensureResourceLoaded(rtSound, resid); } +void ScummEngine_c64::o_lockSound() { + int resid = fetchScriptByte(); + res.lock(rtSound, resid); + debug(0, "o_lockSound (%d)", resid); +} + +void ScummEngine_c64::o_unlockSound() { + int resid = fetchScriptByte(); + res.unlock(rtSound, resid); + debug(0, "o_unlockSound (%d)", resid); +} + void ScummEngine_c64::o_loadActor() { debug(0, "o_loadActor (%d)", getVarOrDirectByte(PARAM_1)); } diff --git a/scumm/script_v5.cpp b/scumm/script_v5.cpp index f7501c526b..beb1713778 100644 --- a/scumm/script_v5.cpp +++ b/scumm/script_v5.cpp @@ -2183,7 +2183,8 @@ void ScummEngine_v5::o5_startSound() { return; } - VAR(VAR_MUSIC_TIMER) = 0; + if (VAR_MUSIC_TIMER != 0xFF) + VAR(VAR_MUSIC_TIMER) = 0; _sound->addSoundToQueue(sound); } diff --git a/scumm/scumm.cpp b/scumm/scumm.cpp index bb1b7d0881..f52af14770 100644 --- a/scumm/scumm.cpp +++ b/scumm/scumm.cpp @@ -2233,7 +2233,10 @@ int ScummEngine::scummLoop(int delta) { } if (_version <= 7) VAR(VAR_HAVE_MSG) = (_haveMsg == 0xFE) ? 0xFF : _haveMsg; - if (_version <= 2) { + + if (_platform == Common::kPlatformC64 && _gameId == GID_MANIAC) { + // TODO + } else if (_version <= 2) { VAR(VAR_VIRT_MOUSE_X) = _virtualMouse.x / 8; VAR(VAR_VIRT_MOUSE_Y) = _virtualMouse.y / 2; @@ -2256,19 +2259,21 @@ int ScummEngine::scummLoop(int delta) { if (_features & GF_AUDIOTRACKS) { // Covered automatically by the Sound class - } else if (_musicEngine && VAR_MUSIC_TIMER != 0xFF) { - // The music engine generates the timer data for us. - VAR(VAR_MUSIC_TIMER) = _musicEngine->getMusicTimer(); - } else if (_features & GF_SMALL_HEADER) { - // Used for Money Island 1 (Amiga) - // TODO: The music delay (given in milliseconds) might have to be tuned a little - // to get it correct for all games. Without the ability to watch/listen to the - // original games, I can't do that myself. - const int MUSIC_DELAY = 350; - _tempMusic += delta * 15; // Convert delta to milliseconds - if (_tempMusic >= MUSIC_DELAY) { - _tempMusic -= MUSIC_DELAY; - VAR(VAR_MUSIC_TIMER) += 1; + } else if (VAR_MUSIC_TIMER != 0xFF) { + if (_musicEngine) { + // The music engine generates the timer data for us. + VAR(VAR_MUSIC_TIMER) = _musicEngine->getMusicTimer(); + } else { + // Used for Money Island 1 (Amiga) + // TODO: The music delay (given in milliseconds) might have to be tuned a little + // to get it correct for all games. Without the ability to watch/listen to the + // original games, I can't do that myself. + const int MUSIC_DELAY = 350; + _tempMusic += delta * 15; // Convert delta to milliseconds + if (_tempMusic >= MUSIC_DELAY) { + _tempMusic -= MUSIC_DELAY; + VAR(VAR_MUSIC_TIMER) += 1; + } } } diff --git a/scumm/sound.cpp b/scumm/sound.cpp index 984aca6f07..1a6b4cc300 100644 --- a/scumm/sound.cpp +++ b/scumm/sound.cpp @@ -90,7 +90,8 @@ Sound::~Sound() { } void Sound::addSoundToQueue(int sound, int heOffset, int heChannel, int heFlags) { - _vm->VAR(_vm->VAR_LAST_SOUND) = sound; + if (_vm->VAR_LAST_SOUND != 0xFF) + _vm->VAR(_vm->VAR_LAST_SOUND) = sound; // HE music resources are in separate file if (sound <= _vm->_numSounds) _vm->ensureResourceLoaded(rtSound, sound); diff --git a/scumm/vars.cpp b/scumm/vars.cpp index 35e34da584..da0fa66f6d 100644 --- a/scumm/vars.cpp +++ b/scumm/vars.cpp @@ -105,39 +105,20 @@ void ScummEngine::setupScummVars() { } void ScummEngine_c64::setupScummVars() { + // TODO VAR_EGO = 0; VAR_CAMERA_POS_X = 2; VAR_HAVE_MSG = 3; VAR_ROOM = 4; VAR_OVERRIDE = 6; - VAR_CHARCOUNT = 7; - VAR_ACTIVE_VERB = 8; - VAR_ACTIVE_OBJECT1 = 9; - VAR_ACTIVE_OBJECT2 = 10; - VAR_NUM_ACTOR = 11; + VAR_CHARCOUNT = 10; + + // FIXME: Should be removed VAR_CURRENT_LIGHTS = 12; - VAR_CURRENTDRIVE = 13; - VAR_MUSIC_TIMER = 17; - VAR_VERB_ALLOWED = 18; - VAR_ACTOR_RANGE_MIN = 19; - VAR_ACTOR_RANGE_MAX = 20; VAR_CURSORSTATE = 21; VAR_CAMERA_MIN_X = 23; VAR_CAMERA_MAX_X = 24; VAR_TIMER_NEXT = 25; - VAR_SENTENCE_VERB = 26; - VAR_SENTENCE_OBJECT1 = 27; - VAR_SENTENCE_OBJECT2 = 28; - VAR_SENTENCE_PREPOSITION = 29; - VAR_VIRT_MOUSE_X = 30; - VAR_VIRT_MOUSE_Y = 31; - VAR_CLICK_AREA = 32; - VAR_ROOM_RESOURCE = 36; - VAR_LAST_SOUND = 37; - VAR_BACKUP_VERB = 38; - VAR_KEYPRESS = 39; - VAR_CUTSCENEEXIT_KEY = 40; - VAR_TALK_ACTOR = 41; } void ScummEngine_v2::setupScummVars() { |