SCUMM: (LOOM/VGA Talkie) - improve verb handling

- get rid of weird hackery in o5_verbOps
- make sure the verbs are properly restored after loading a savegame
This commit is contained in:
athrxx 2022-08-10 02:03:01 +02:00
parent d4ad27547e
commit 319e50fc35
5 changed files with 38 additions and 50 deletions

View file

@ -150,6 +150,11 @@ void ScummEngine::startScene(int room, Actor *a, int objectNr) {
_ENCD_offs = _EXCD_offs = 0;
_numObjectsInRoom = 0;
return;
} else if (_game.id == GID_LOOM && _game.version == 4) {
// This is specific for LOOM VGA Talkie. It forces a
// redraw of the verbs screen. The original interpreter
// does this here...
VAR(66) = 1;
}
setupRoomSubBlocks();

View file

@ -37,7 +37,7 @@ namespace Scumm {
/* Start executing script 'script' with the given parameters */
void ScummEngine::runScript(int script, bool freezeResistant, bool recursive, int *lvarptr, int cycle) {
ScriptSlot *s;
//byte *scriptPtr;
uint32 scriptOffs;
byte scriptType;
int slot;

View file

@ -2874,33 +2874,6 @@ void ScummEngine_v5::o5_verbOps() {
default:
break;
}
} else if (_game.id == GID_LOOM && _game.version == 4) {
// FIXME: hack loom notes into right spot
if ((verb >= 90) && (verb <= 97)) { // Notes
switch (verb) {
case 90:
case 91:
vs->curRect.top -= 7;
break;
case 92:
vs->curRect.top -= 6;
break;
case 93:
vs->curRect.top -= 4;
break;
case 94:
vs->curRect.top -= 3;
break;
case 95:
vs->curRect.top -= 1;
break;
case 97:
vs->curRect.top -= 5;
break;
default:
break;
}
}
} else if (_game.platform == Common::kPlatformFMTowns && ConfMan.getBool("trim_fmtowns_to_200_pixels")) {
if (_game.id == GID_ZAK && verb == 116)
// WORKAROUND: FM-TOWNS Zak used the extra 40 pixels at the bottom to increase the inventory to 10 items

View file

@ -2468,17 +2468,6 @@ load_game:
scummLoop_handleSaveLoad();
if (_completeScreenRedraw) {
clearCharsetMask();
_charset->_hasMask = false;
if (_game.version > 3) {
if (_townsPlayer)
_townsPlayer->restoreAfterLoad();
for (int i = 0; i < _numVerbs; i++)
drawVerb(i, 0);
}
// Update volume settings
syncSoundSettings();
@ -2689,7 +2678,7 @@ void ScummEngine::scummLoop_handleSaveLoad() {
}
void ScummEngine_v3::scummLoop_handleSaveLoad() {
bool processIQPoints = (_game.id == GID_INDY3) && (_saveLoadFlag == 2 || _loadFromLauncher);
bool processIQPoints = (_game.id == GID_INDY3 && (_saveLoadFlag == 2 || _loadFromLauncher));
_loadFromLauncher = false;
ScummEngine::scummLoop_handleSaveLoad();
@ -2805,7 +2794,7 @@ void ScummEngine_v3::scummLoop_handleSaveLoad() {
}
void ScummEngine_v5::scummLoop_handleSaveLoad() {
bool processIQPoints = (_game.id == GID_INDY4) && (_saveLoadFlag == 2 || _loadFromLauncher);
bool processIQPoints = (_game.id == GID_INDY4 && (_saveLoadFlag == 2 || _loadFromLauncher));
_loadFromLauncher = false;
ScummEngine::scummLoop_handleSaveLoad();
@ -2847,15 +2836,27 @@ void ScummEngine_v5::scummLoop_handleSaveLoad() {
runScript(VAR(VAR_ENTRY_SCRIPT2), 0, 0, nullptr);
}
}
bool redrawDistaff = (_game.id == GID_LOOM && _saveLoadFlag == 2 && VAR(150) == 2);
if (redrawDistaff) {
// Restore distaff and notes for LOOM VGA Talkie.
int args[NUM_SCRIPT_LOCAL];
memset(args, 0, sizeof(args));
args[0] = 2;
runScript(18, 0, 0, args);
//VAR(152) = VAR(153) = 0;
if (_completeScreenRedraw) {
clearCharsetMask();
_charset->_hasMask = false;
if (_townsPlayer)
_townsPlayer->restoreAfterLoad();
redrawVerbs();
// For LOOM VGA Talkie, we restore the text glyphs on top of the note verbs
// and also restore the text description on top of the image of the selected
// object in the bottom right corner.
// These text parts are not actually connected to the verbs (which are image
// verbs only). redrawVerbs() will not restore them. They require some script
// work. The original interpreter just sets this variable after loading.
// Apparently, this is the trigger for all necessary steps to happen...
if (_game.id == GID_LOOM)
VAR(66) = 1;
}
// update IQ points after loading
if (processIQPoints)
runScript(145, 0, 0, nullptr);
@ -2892,6 +2893,12 @@ void ScummEngine_v6::scummLoop_handleSaveLoad() {
}
}
}
if (_completeScreenRedraw) {
clearCharsetMask();
_charset->_hasMask = false;
redrawVerbs();
}
}
#ifdef ENABLE_SCUMM_7_8

View file

@ -1181,6 +1181,9 @@ void ScummEngine::drawVerbBitmap(int verb, int x, int y) {
xstrip = x / 8;
ydiff = y - vs->topline;
if (_game.version == 4)
ydiff &= ~7;
obim = getResourceAddress(rtVerb, verb);
assert(obim);
if (_game.features & GF_OLD_BUNDLE) {