aboutsummaryrefslogtreecommitdiff
path: root/sky
diff options
context:
space:
mode:
authorRobert Göffringmann2003-07-12 05:26:23 +0000
committerRobert Göffringmann2003-07-12 05:26:23 +0000
commitcb48b4fca0b6a1fc816ba6cb49f497476ebcd534 (patch)
treec4d00b32183c1e6e2c7ed04dbfac1e6b5ea70870 /sky
parent8cc3d5e39c5b7eafca87366f6d4b9f70be9967f4 (diff)
downloadscummvm-rg350-cb48b4fca0b6a1fc816ba6cb49f497476ebcd534.tar.gz
scummvm-rg350-cb48b4fca0b6a1fc816ba6cb49f497476ebcd534.tar.bz2
scummvm-rg350-cb48b4fca0b6a1fc816ba6cb49f497476ebcd534.zip
implemented -x command line option
svn-id: r8926
Diffstat (limited to 'sky')
-rw-r--r--sky/control.cpp37
-rw-r--r--sky/control.h1
-rw-r--r--sky/sky.cpp22
-rw-r--r--sky/sky.h1
4 files changed, 54 insertions, 7 deletions
diff --git a/sky/control.cpp b/sky/control.cpp
index 0880a5b3c6..c398cb2ea5 100644
--- a/sky/control.cpp
+++ b/sky/control.cpp
@@ -1461,7 +1461,7 @@ uint16 SkyControl::restoreGameFromFile(bool autoSave) {
else
sprintf(fName, "SKY-VM%03d.ASD", SkyState::_systemVars.gameVersion);
} else
- sprintf(fName,"SKY-VM.%03d", _selectedGame);
+ sprintf(fName,"SKY-VM.%03d", _selectedGame);
File inf;
if (!inf.open(fName, _savePath)) {
@@ -1491,6 +1491,41 @@ uint16 SkyControl::restoreGameFromFile(bool autoSave) {
return res;
}
+uint16 SkyControl::quickXRestore(uint16 slot) {
+ uint16 result;
+ initPanel();
+ _mouseClicked = false;
+
+ _savedCharSet = _skyText->giveCurrentCharSet();
+ _skyText->fnSetFont(0);
+
+ if (SkyState::_systemVars.gameVersion < 331)
+ _skyScreen->setPalette(60509);
+ else
+ _skyScreen->setPalette(60510);
+
+ _savedMouse = _skyMouse->giveCurrentMouseType();
+ _skyMouse->spriteMouse(MOUSE_NORMAL,0,0);
+
+ if (slot == 0)
+ result = restoreGameFromFile(true);
+ else {
+ _selectedGame = slot - 1;
+ result = restoreGameFromFile(false);
+ }
+ if (result == GAME_RESTORED) {
+ memset(_skyScreen->giveCurrent(), 0, GAME_SCREEN_WIDTH * GAME_SCREEN_HEIGHT);
+ _skyScreen->showScreen(_skyScreen->giveCurrent());
+ _skyScreen->forceRefresh();
+ }
+ _skyScreen->setPaletteEndian((uint8 *)SkyState::fetchCompact(SkyState::_systemVars.currentPalette));
+ _skyMouse->spriteMouse(_savedMouse, 0, 0);
+ _skyText->fnSetFont(_savedCharSet);
+
+ removePanel();
+ return result;
+}
+
uint16 *SkyControl::lz77decode(uint16 *data) {
uint32 size = READ_LE_UINT32(data);
data += 2;
diff --git a/sky/control.h b/sky/control.h
index 7b23fe3d84..2b754e0a1c 100644
--- a/sky/control.h
+++ b/sky/control.h
@@ -173,6 +173,7 @@ public:
void restartGame(void);
void showGameQuitMsg(bool useScreen = true);
void doAutoSave(void);
+ uint16 quickXRestore(uint16 slot);
private:
void initPanel(void);
diff --git a/sky/sky.cpp b/sky/sky.cpp
index 3a444da83e..25e51c40a1 100644
--- a/sky/sky.cpp
+++ b/sky/sky.cpp
@@ -179,14 +179,15 @@ void SkyState::go() {
initialise();
- bool introSkipped;
- if (_systemVars.gameVersion != 267) // don't do intro for floppydemo
- introSkipped = !intro();
- else introSkipped = false;
+ bool introSkipped = false;
+ if (!_quickLaunch) {
+ if (_systemVars.gameVersion != 267) // don't do intro for floppydemo
+ introSkipped = !intro();
- _skyDisk->flushPrefetched();
+ _skyDisk->flushPrefetched();
- loadBase0();
+ loadBase0();
+ }
if (introSkipped)
_skyControl->restartGame();
@@ -266,6 +267,15 @@ void SkyState::initialise(void) {
if (_systemVars.gameVersion == 288)
SkyCompact::patchFor288();
+
+ uint16 result = 0;
+ if (_detector->_save_slot >= 0)
+ result = _skyControl->quickXRestore(_detector->_save_slot);
+
+ if (result == GAME_RESTORED)
+ _quickLaunch = true;
+ else
+ _quickLaunch = false;
}
void SkyState::initItemList() {
diff --git a/sky/sky.h b/sky/sky.h
index b536979953..ea119a43e9 100644
--- a/sky/sky.h
+++ b/sky/sky.h
@@ -62,6 +62,7 @@ protected:
byte _game;
byte _key_pressed;
static uint8 _languageTable[11];
+ bool _quickLaunch; // set when starting with -x
//intro related