diff options
author | Jonathan Gray | 2003-08-31 15:39:27 +0000 |
---|---|---|
committer | Jonathan Gray | 2003-08-31 15:39:27 +0000 |
commit | b5ece53748f8aa5e0a29d1ebbec68c80bf36d621 (patch) | |
tree | 84d94a88cc15850ef5a2d6bbf7609c9816ffa478 /scumm | |
parent | f77faa2313deed248cf1dd9fcbeb842cb9a52b59 (diff) | |
download | scummvm-rg350-b5ece53748f8aa5e0a29d1ebbec68c80bf36d621.tar.gz scummvm-rg350-b5ece53748f8aa5e0a29d1ebbec68c80bf36d621.tar.bz2 scummvm-rg350-b5ece53748f8aa5e0a29d1ebbec68c80bf36d621.zip |
cleanup and make script_v2 use o5_saveLoadGame
svn-id: r9941
Diffstat (limited to 'scumm')
-rw-r--r-- | scumm/intern.h | 2 | ||||
-rw-r--r-- | scumm/script_v2.cpp | 12 | ||||
-rw-r--r-- | scumm/script_v5.cpp | 85 |
3 files changed, 48 insertions, 51 deletions
diff --git a/scumm/intern.h b/scumm/intern.h index 7596569815..2d902399a1 100644 --- a/scumm/intern.h +++ b/scumm/intern.h @@ -134,6 +134,7 @@ protected: void o5_quitPauseRestart(); void o5_resourceRoutines(); void o5_roomOps(); + void o5_saveLoadGame(); void o5_saveLoadVars(); void o5_saveRestoreVerbs(); void o5_setCameraAt(); @@ -273,7 +274,6 @@ protected: void o2_resourceRoutines(); void o2_restart(); void o2_roomOps(); - void o2_saveLoadGame(); void o2_getActorElevation(); void o2_setActorElevation(); void o2_setBitVar(); diff --git a/scumm/script_v2.cpp b/scumm/script_v2.cpp index d6bf6f3a80..ed7fa33a5b 100644 --- a/scumm/script_v2.cpp +++ b/scumm/script_v2.cpp @@ -75,7 +75,7 @@ void Scumm_v2::setupOpcodes() { /* 20 */ OPCODE(o5_stopMusic), OPCODE(o2_putActor), - OPCODE(o2_saveLoadGame), + OPCODE(o5_saveLoadGame), OPCODE(o2_getActorY), /* 24 */ OPCODE(o2_loadRoomWithEgo), @@ -235,7 +235,7 @@ void Scumm_v2::setupOpcodes() { /* A0 */ OPCODE(o5_stopObjectCode), OPCODE(o2_putActor), - OPCODE(o2_saveLoadGame), + OPCODE(o5_saveLoadGame), OPCODE(o2_getActorY), /* A4 */ OPCODE(o2_loadRoomWithEgo), @@ -1159,14 +1159,6 @@ void Scumm_v2::o2_findObject() { setResult(findObject(x, y)); } -void Scumm_v2::o2_saveLoadGame() { - getResultPos(); - byte a = getVarOrDirectByte(0x80); - - warning("TODO: o2_saveLoadGame(%d)", a); - setResult(0); -} - void Scumm_v2::o2_getActorX() { int a; getResultPos(); diff --git a/scumm/script_v5.cpp b/scumm/script_v5.cpp index 6531b599e6..6be5aeae78 100644 --- a/scumm/script_v5.cpp +++ b/scumm/script_v5.cpp @@ -1083,50 +1083,55 @@ void Scumm_v5::o5_getActorY() { setResult(getObjY(a)); } -void Scumm_v5::o5_getAnimCounter() { +void Scumm_v5::o5_saveLoadGame() { getResultPos(); - // Loom uses this opcode in its load/save screen. - //if (_gameId == GID_LOOM) { - if (_version <= 3) { - byte a = getVarOrDirectByte(0x80); - byte slot = a & 0x1F; - byte result = 0; + byte a = getVarOrDirectByte(0x80); + byte slot = a & 0x1F; + byte result = 0; - switch(a & 0xE0) { - case 0x00: // num slots available - result = 100; - break; - case 0x20: // dos drive? + switch(a & 0xE0) { + case 0x00: // num slots available + result = 100; + break; + case 0x20: // dos drive? + result = 0; + break; + case 0x40: // load + if (loadState(slot, _saveLoadCompatible)) + result = 3; // sucess + else + result = 5; // failed to load + break; + case 0x80: // save + if (saveState(slot, _saveLoadCompatible)) result = 0; - break; - case 0x40: // load - if (loadState(slot, _saveLoadCompatible)) - result = 3; // sucess - else - result = 5; // failed to load - break; - case 0x80: // save - if (saveState(slot, _saveLoadCompatible)) - result = 0; - else - result = 2; - case 0xC0: // test if save exists - bool avail_saves[100]; - SaveFileManager *mgr = _system->get_savefile_manager(); - listSavegames(avail_saves, ARRAYSIZE(avail_saves), mgr); - delete mgr; - if (avail_saves[slot]) - result = 6; // save file exists - else - result = 7; // save file does not exist - break; - } - setResult(result); - } else { - int act = getVarOrDirectByte(0x80); - Actor *a = derefActor(act, "o5_getAnimCounter"); - setResult(a->cost.animCounter); + else + result = 2; + case 0xC0: // test if save exists + bool avail_saves[100]; + SaveFileManager *mgr = _system->get_savefile_manager(); + listSavegames(avail_saves, ARRAYSIZE(avail_saves), mgr); + delete mgr; + if (avail_saves[slot]) + result = 6; // save file exists + else + result = 7; // save file does not exist + break; + } + setResult(result); +} + +void Scumm_v5::o5_getAnimCounter() { + if (_version == 3) { + o5_saveLoadGame(); + return; } + + getResultPos(); + + int act = getVarOrDirectByte(0x80); + Actor *a = derefActor(act, "o5_getAnimCounter"); + setResult(a->cost.animCounter); } void Scumm_v5::o5_getClosestObjActor() { |