Add basic single slot load/save support for dimp/swampy for now
svn-id: r24086
This commit is contained in:
parent
d01420c344
commit
af21ec036f
4 changed files with 84 additions and 38 deletions
|
@ -569,7 +569,7 @@ void AGOSEngine::setupGame() {
|
||||||
#endif
|
#endif
|
||||||
_tableMemSize = 200000;
|
_tableMemSize = 200000;
|
||||||
_vgaBaseDelay = 5;
|
_vgaBaseDelay = 5;
|
||||||
_numVars = 256;
|
_numVars = 255;
|
||||||
} else if (getGameType() == GType_SIMON2) {
|
} else if (getGameType() == GType_SIMON2) {
|
||||||
gss = PTR(simon2_settings);
|
gss = PTR(simon2_settings);
|
||||||
_tableIndexBase = 1580 / 4;
|
_tableIndexBase = 1580 / 4;
|
||||||
|
@ -589,20 +589,8 @@ void AGOSEngine::setupGame() {
|
||||||
_musicIndexBase = 1128 / 4;
|
_musicIndexBase = 1128 / 4;
|
||||||
_soundIndexBase = 1660 / 4;
|
_soundIndexBase = 1660 / 4;
|
||||||
_vgaBaseDelay = 1;
|
_vgaBaseDelay = 1;
|
||||||
_numVars = 256;
|
_numVars = 255;
|
||||||
} else if (getGameType() == GType_ELVIRA) {
|
} else if (getGameType() == GType_SIMON1) {
|
||||||
gss = PTR(simon1_settings);
|
|
||||||
_numTextBoxes = 20;
|
|
||||||
_numVideoOpcodes = 56;
|
|
||||||
#ifndef PALMOS_68K
|
|
||||||
_vgaMemSize = 1000000;
|
|
||||||
#else
|
|
||||||
_vgaMemSize = gVars->memory[kMemSimon1Games];
|
|
||||||
#endif
|
|
||||||
_tableMemSize = 150000;
|
|
||||||
_vgaBaseDelay = 1;
|
|
||||||
_numVars = 512;
|
|
||||||
} else {
|
|
||||||
gss = PTR(simon1_settings);
|
gss = PTR(simon1_settings);
|
||||||
_tableIndexBase = 1576 / 4;
|
_tableIndexBase = 1576 / 4;
|
||||||
_textIndexBase = 1460 / 4;
|
_textIndexBase = 1460 / 4;
|
||||||
|
@ -617,7 +605,31 @@ void AGOSEngine::setupGame() {
|
||||||
_musicIndexBase = 1316 / 4;
|
_musicIndexBase = 1316 / 4;
|
||||||
_soundIndexBase = 0;
|
_soundIndexBase = 0;
|
||||||
_vgaBaseDelay = 1;
|
_vgaBaseDelay = 1;
|
||||||
_numVars = 256;
|
_numVars = 255;
|
||||||
|
} else if (getGameType() == GType_WW) {
|
||||||
|
gss = PTR(simon1_settings);
|
||||||
|
_numTextBoxes = 20;
|
||||||
|
_numVideoOpcodes = 64;
|
||||||
|
#ifndef PALMOS_68K
|
||||||
|
_vgaMemSize = 1000000;
|
||||||
|
#else
|
||||||
|
_vgaMemSize = gVars->memory[kMemSimon1Games];
|
||||||
|
#endif
|
||||||
|
_tableMemSize = 150000;
|
||||||
|
_vgaBaseDelay = 1;
|
||||||
|
_numVars = 255;
|
||||||
|
} else if (getGameType() == GType_ELVIRA) {
|
||||||
|
gss = PTR(simon1_settings);
|
||||||
|
_numTextBoxes = 20;
|
||||||
|
_numVideoOpcodes = 56;
|
||||||
|
#ifndef PALMOS_68K
|
||||||
|
_vgaMemSize = 1000000;
|
||||||
|
#else
|
||||||
|
_vgaMemSize = gVars->memory[kMemSimon1Games];
|
||||||
|
#endif
|
||||||
|
_tableMemSize = 150000;
|
||||||
|
_vgaBaseDelay = 1;
|
||||||
|
_numVars = 512;
|
||||||
}
|
}
|
||||||
|
|
||||||
allocItemHeap();
|
allocItemHeap();
|
||||||
|
|
|
@ -1196,7 +1196,7 @@ protected:
|
||||||
|
|
||||||
Item *getNextItemPtrStrange();
|
Item *getNextItemPtrStrange();
|
||||||
|
|
||||||
bool saveGame(uint slot, char *caption);
|
bool saveGame(uint slot, const char *caption);
|
||||||
bool loadGame(uint slot);
|
bool loadGame(uint slot);
|
||||||
|
|
||||||
void openTextWindow();
|
void openTextWindow();
|
||||||
|
|
|
@ -2548,10 +2548,28 @@ void AGOSEngine::o4_saveUserGame() {
|
||||||
if (_clockStopped != 0)
|
if (_clockStopped != 0)
|
||||||
_gameTime += time(NULL) - _clockStopped;
|
_gameTime += time(NULL) - _clockStopped;
|
||||||
_clockStopped = 0;
|
_clockStopped = 0;
|
||||||
|
|
||||||
|
if (getGameId() == GID_DIMP) {
|
||||||
|
saveGame(1, (const char *)"dimp");
|
||||||
|
} else if (!getBitFlag(110)) {
|
||||||
|
// Swampy adventures
|
||||||
|
saveGame(1, (const char *)"swampy");
|
||||||
|
}
|
||||||
|
|
||||||
|
//saveHiScores()
|
||||||
}
|
}
|
||||||
|
|
||||||
void AGOSEngine::o4_loadUserGame() {
|
void AGOSEngine::o4_loadUserGame() {
|
||||||
// 133: load usergame
|
// 133: load usergame
|
||||||
|
|
||||||
|
// NoPatience or Jumble
|
||||||
|
if (getBitFlag(110)) {
|
||||||
|
//getHiScoreName();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// XXX
|
||||||
|
loadGame(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AGOSEngine::o4_saveOopsPosition() {
|
void AGOSEngine::o4_saveOopsPosition() {
|
||||||
|
|
|
@ -110,7 +110,11 @@ int AGOSEngine::displaySaveGameList(int curpos, bool load, char *dst) {
|
||||||
char *AGOSEngine::genSaveName(int slot) {
|
char *AGOSEngine::genSaveName(int slot) {
|
||||||
static char buf[15];
|
static char buf[15];
|
||||||
|
|
||||||
if (getGameType() == GType_FF) {
|
if (getGameId() == GID_DIMP) {
|
||||||
|
sprintf(buf, "dimp.sav");
|
||||||
|
} else if (getGameType() == GType_PP) {
|
||||||
|
sprintf(buf, "swampy.sav");
|
||||||
|
} else if (getGameType() == GType_FF) {
|
||||||
if (slot == 999) {
|
if (slot == 999) {
|
||||||
// Restart state
|
// Restart state
|
||||||
if (getPlatform() == Common::kPlatformWindows)
|
if (getPlatform() == Common::kPlatformWindows)
|
||||||
|
@ -576,7 +580,7 @@ loop:;
|
||||||
undefineBox(0x7FFF);
|
undefineBox(0x7FFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AGOSEngine::saveGame(uint slot, char *caption) {
|
bool AGOSEngine::saveGame(uint slot, const char *caption) {
|
||||||
Common::WriteStream *f;
|
Common::WriteStream *f;
|
||||||
uint item_index, num_item, i, j;
|
uint item_index, num_item, i, j;
|
||||||
TimeEvent *te;
|
TimeEvent *te;
|
||||||
|
@ -592,7 +596,7 @@ bool AGOSEngine::saveGame(uint slot, char *caption) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getGameType() == GType_FF) {
|
if (getGameType() == GType_FF || getGameType() == GType_PP) {
|
||||||
f->write(caption, 100);
|
f->write(caption, 100);
|
||||||
curTime = time(NULL);
|
curTime = time(NULL);
|
||||||
} else {
|
} else {
|
||||||
|
@ -609,7 +613,7 @@ bool AGOSEngine::saveGame(uint slot, char *caption) {
|
||||||
i++;
|
i++;
|
||||||
f->writeUint32BE(i);
|
f->writeUint32BE(i);
|
||||||
|
|
||||||
if (_clockStopped)
|
if (getGameType() == GType_FF && _clockStopped)
|
||||||
gsc += ((uint32)time(NULL) - _clockStopped);
|
gsc += ((uint32)time(NULL) - _clockStopped);
|
||||||
for (te = _firstTimeStruct; te; te = te->next) {
|
for (te = _firstTimeStruct; te; te = te->next) {
|
||||||
f->writeUint32BE(te->time - curTime + gsc);
|
f->writeUint32BE(te->time - curTime + gsc);
|
||||||
|
@ -650,8 +654,8 @@ bool AGOSEngine::saveGame(uint slot, char *caption) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// write the 255 variables
|
// write the variables
|
||||||
for (i = 0; i != 255; i++) {
|
for (i = 0; i != _numVars; i++) {
|
||||||
f->writeUint16BE(readVariable(i));
|
f->writeUint16BE(readVariable(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -660,13 +664,19 @@ bool AGOSEngine::saveGame(uint slot, char *caption) {
|
||||||
f->writeUint16BE(itemPtrToID(_itemStore[i]));
|
f->writeUint16BE(itemPtrToID(_itemStore[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write the bits in array 1
|
if (getGameType() == GType_PP) {
|
||||||
for (i = 0; i != 16; i++)
|
// Write the bits in array 1
|
||||||
f->writeUint16BE(_bitArray[i]);
|
for (i = 0; i != 128; i++)
|
||||||
|
f->writeUint16BE(_bitArray[i]);
|
||||||
|
} else {
|
||||||
|
// Write the bits in array 1
|
||||||
|
for (i = 0; i != 16; i++)
|
||||||
|
f->writeUint16BE(_bitArray[i]);
|
||||||
|
|
||||||
// Write the bits in array 2
|
// Write the bits in array 2
|
||||||
for (i = 0; i != 16; i++)
|
for (i = 0; i != 16; i++)
|
||||||
f->writeUint16BE(_bitArrayTwo[i]);
|
f->writeUint16BE(_bitArrayTwo[i]);
|
||||||
|
}
|
||||||
|
|
||||||
// Write the bits in array 3
|
// Write the bits in array 3
|
||||||
if (getGameType() == GType_FF) {
|
if (getGameType() == GType_FF) {
|
||||||
|
@ -709,7 +719,7 @@ bool AGOSEngine::loadGame(uint slot) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getGameType() == GType_FF) {
|
if (getGameType() == GType_FF || getGameType() == GType_PP) {
|
||||||
f->read(ident, 100);
|
f->read(ident, 100);
|
||||||
} else {
|
} else {
|
||||||
f->read(ident, 18);
|
f->read(ident, 18);
|
||||||
|
@ -781,8 +791,8 @@ bool AGOSEngine::loadGame(uint slot) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// read the 255 variables
|
// read the variables
|
||||||
for (i = 0; i != 255; i++) {
|
for (i = 0; i != _numVars; i++) {
|
||||||
writeVariable(i, f->readUint16BE());
|
writeVariable(i, f->readUint16BE());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -791,13 +801,19 @@ bool AGOSEngine::loadGame(uint slot) {
|
||||||
_itemStore[i] = derefItem(f->readUint16BE());
|
_itemStore[i] = derefItem(f->readUint16BE());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read the bits in array 1
|
if (getGameType() == GType_PP) {
|
||||||
for (i = 0; i != 16; i++)
|
// Read the bits in array 1
|
||||||
_bitArray[i] = f->readUint16BE();
|
for (i = 0; i != 128; i++)
|
||||||
|
_bitArray[i] = f->readUint16BE();
|
||||||
|
} else {
|
||||||
|
// Read the bits in array 1
|
||||||
|
for (i = 0; i != 16; i++)
|
||||||
|
_bitArray[i] = f->readUint16BE();
|
||||||
|
|
||||||
// Read the bits in array 2
|
// Read the bits in array 2
|
||||||
for (i = 0; i != 16; i++)
|
for (i = 0; i != 16; i++)
|
||||||
_bitArrayTwo[i] = f->readUint16BE();
|
_bitArrayTwo[i] = f->readUint16BE();
|
||||||
|
}
|
||||||
|
|
||||||
// Read the bits in array 3
|
// Read the bits in array 3
|
||||||
if (getGameType() == GType_FF) {
|
if (getGameType() == GType_FF) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue