HYPNO: save and load flashback mode field in boyz

This commit is contained in:
neuromancer 2022-06-13 09:05:42 +02:00
parent cfc7f40753
commit 01b15ef4d5
3 changed files with 18 additions and 2 deletions

View File

@ -29,8 +29,11 @@ namespace Hypno {
void BoyzEngine::runBeforeArcade(ArcadeShooting *arc) {
_checkpoint = _currentLevel;
_lastStats = _stats;
if (!_name.empty()) // if name is name, then we are testing some level
if (!_name.empty() && !_flashbackMode) {
// if name is empty or we are flashback mode,
// then we are testing some level
saveProfile(_name, int(arc->id));
}
if (arc->mode == "YM") {
assert(!arc->player.empty());
@ -82,6 +85,11 @@ void BoyzEngine::runAfterArcade(ArcadeShooting *arc) {
}
_playerFrames.clear();
if (_flashbackMode) {
resetStatistics();
_nextLevel = "<select_t1>";
return;
}
if (_health <= 0) {
if (_arcadeMode == "YS")

View File

@ -1039,6 +1039,7 @@ Common::Error BoyzEngine::saveGameStream(Common::WriteStream *stream, bool isAut
stream->writeUint32LE(_globalStats.friendliesEncountered);
stream->writeUint32LE(_globalStats.infoReceived);
stream->writeUint32LE(_flashbackMode);
saveSceneState(stream);
return Common::kNoError;
}
@ -1068,6 +1069,7 @@ Common::Error BoyzEngine::loadGameStream(Common::SeekableReadStream *stream) {
_globalStats.friendliesEncountered = stream->readUint32LE();
_globalStats.infoReceived = stream->readUint32LE();
_flashbackMode = stream->readUint32LE();
loadSceneState(stream);
if (_unlockAllLevels) {
_nextLevel = "<select_t1>";

View File

@ -52,6 +52,7 @@ void BoyzEngine::runMainMenu(Code *code) {
resetSceneState();
resetStatistics();
_globalStats = ArcadeStats();
_flashbackMode = false;
Common::Event event;
byte *palette;
@ -116,6 +117,8 @@ void BoyzEngine::runMainMenu(Code *code) {
_nextLevel = code->levelIfWin;
} else if (_unlockAllLevels) {
_nextLevel = "<select_t1>";
unlockAllLevels();
_flashbackMode = true;
}
assert(!_nextLevel.empty());
@ -194,6 +197,7 @@ void BoyzEngine::runDifficultyMenu(Code *code) {
if (_unlockAllLevels) {
_nextLevel = "<select_t1>";
unlockAllLevels();
_flashbackMode = true;
} else
_nextLevel = code->levelIfWin;
}
@ -330,8 +334,10 @@ void BoyzEngine::runCheckHo(Code *code) {
}
void BoyzEngine::endCredits(Code *code) {
_flashbackMode = true;
saveProfile(_name, 59);
showCredits();
_nextLevel = "<main_menu>";
_nextLevel = "<select_t1>";
}
void BoyzEngine::showCredits() {