GNAP: Add load from launcher

This commit is contained in:
Strangerke 2016-04-15 07:27:13 +02:00 committed by Eugene Sandulenko
parent d90b948b22
commit d6e4b67dca
3 changed files with 21 additions and 9 deletions

View File

@ -118,8 +118,14 @@ Common::Error GnapEngine::run() {
// >>>>> Variable initialization
_cursorIndex = -1;
_verbCursor = 1;
_loadGameSlot = -1;
if (ConfMan.hasKey("save_slot"))
_loadGameSlot = ConfMan.getInt("save_slot");
invClear();
clearFlags();
_grabCursorSprite = nullptr;
_newGrabCursorSpriteIndex = -1;
_backgroundSurface = nullptr;
@ -737,7 +743,6 @@ void GnapEngine::loadStockDat() {
}
void GnapEngine::mainLoop() {
_newCursorValue = 1;
_cursorValue = -1;
_newSceneNum = 0;
@ -748,14 +753,25 @@ void GnapEngine::mainLoop() {
_grabCursorSpriteIndex = -1;
_grabCursorSprite = nullptr;
#if 0
// > DEBUG BEGIN
_currentSceneNum = 0;
_newSceneNum = 1;
_newCursorValue = 1;
// < DEBUG END
#endif
loadStockDat();
if (_loadGameSlot != -1) {
// Load a savegame
int slot = _loadGameSlot;
_loadGameSlot = -1;
loadGameState(slot);
showCursor();
}
while (!_gameDone) {
debugC(kDebugBasic, "New scene: %d", _newSceneNum);

View File

@ -298,6 +298,8 @@ public:
private:
const ADGameDescription *_gameDescription;
Graphics::PixelFormat _pixelFormat;
int _loadGameSlot;
public:
Common::RandomSource *_random;

View File

@ -233,7 +233,6 @@ void GnapEngine::drawInventoryFrames() {
}
void GnapEngine::insertInventorySprites() {
for (int i = 0; i < 9; ++i) {
_menuInventoryIndices[i] = -1;
_gameSys->removeSpriteDrawItem(_menuInventorySprites[_sceneClickedHotspot], 261);
@ -258,7 +257,6 @@ void GnapEngine::insertInventorySprites() {
++_menuSpritesIndex;
}
}
}
void GnapEngine::removeInventorySprites() {
@ -313,7 +311,6 @@ void GnapEngine::runMenu() {
_timers[2] = 10;
while (!isKeyStatus1(8) && !isKeyStatus1(28) && !_sceneDone && !_menuDone) {
updateCursorByHotspot();
switch (_menuStatus) {
@ -335,7 +332,6 @@ void GnapEngine::runMenu() {
}
gameUpdateTick();
}
removeInventorySprites();
@ -385,7 +381,6 @@ void GnapEngine::runMenu() {
}
void GnapEngine::updateMenuStatusInventory() {
static const struct {
int item1, item2, resultItem;
} kCombineItems[] = {
@ -727,6 +722,7 @@ Common::Error GnapEngine::loadGameState(int slot) {
synchronize(s);
delete saveFile;
_loadGameSlot = slot;
return Common::kNoError;
}
@ -735,7 +731,7 @@ Common::String GnapEngine::generateSaveName(int slot) {
}
void GnapEngine::updateMenuStatusSaveGame() {
#if 1 // TODO
#if 0 // TODO
char v43[30];
int v46;
v43[0] = '\0';
@ -925,7 +921,6 @@ void GnapEngine::updateMenuStatusLoadGame() {
}
void GnapEngine::updateMenuStatusQueryQuit() {
_hotspots[0]._x1 = 311;
_hotspots[0]._y1 = 197;
_hotspots[0]._x2 = 377;
@ -964,7 +959,6 @@ void GnapEngine::updateMenuStatusQueryQuit() {
initMenuHotspots2();
_gameSys->insertSpriteDrawItem(_menuSprite1, 288, 79, 262);
}
}
} // End of namespace Gnap