cleanup and make script_v2 use o5_saveLoadGame

svn-id: r9941
This commit is contained in:
Jonathan Gray 2003-08-31 15:39:27 +00:00
parent f77faa2313
commit b5ece53748
3 changed files with 48 additions and 51 deletions

View File

@ -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();

View File

@ -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();

View File

@ -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() {