fixed save/restore grid problems

svn-id: r8703
This commit is contained in:
Robert Göffringmann 2003-07-02 01:46:25 +00:00
parent 14cfa71ab7
commit 1b5ea45887
7 changed files with 44 additions and 12 deletions

View File

@ -195,13 +195,13 @@
#define LOAD_NEW_VOICE(num) ( free (vocBuffer), vocBuffer = _skyDisk->loadFile(num, NULL), loadedVocSize = _skyDisk->_lastLoadedFileSize )
#define LOAD_NEW_BG(num) ( free (bgVocBuffer), bgVocBuffer = _skyDisk->loadFile(num, NULL), bgVocSize = _skyDisk->_lastLoadedFileSize )
#define WAIT_VOICE while (_skySound->_voiceHandle != 0) { delay(50); CHECK_ESC }
#define CHECK_ESC if (_key_pressed == 27) { _skyScreen->stopSequence(); _mixer->stopAll(); return; }
#define CHECK_ESC if (_key_pressed == 27) { _skyScreen->stopSequence(); _mixer->stopAll(); return false; }
#define WAIT_SEQUENCE while (_skyScreen->sequenceRunning()) { delay(50); CHECK_ESC }
#define WAIT_RELATIVE(x) ( delay(20 * (x)) )
#define NORMAL_CD_INTRO
void SkyState::doCDIntro() {
bool SkyState::doCDIntro() {
uint32 loadedVocSize, bgVocSize;
byte *vocBuffer, *bgVocBuffer;
@ -794,4 +794,5 @@ void SkyState::doCDIntro() {
WAIT_SEQUENCE; //104
_skyScreen->startSequence(cd_105);
WAIT_SEQUENCE; //105
return true;
}

View File

@ -292,6 +292,18 @@ void SkyControl::drawMainPanel(void) {
_bodge->drawToScreen(WITH_MASK);
}
void SkyControl::restartGame(void) {
if (SkyState::isDemo() && (!SkyState::isCDVersion()))
return; // I don't think this can happen
/*parseSaveData(_restartData);
_skyScreen->forceRefresh();
_skyScreen->setPalette((uint8*)SkyState::fetchCompact(SkyState::_systemVars.currentPalette));
_skyMouse->spriteMouse(_savedMouse, 0, 0);
SkyState::_systemVars.pastIntro = true;*/
}
void SkyControl::doLoadSavePanel(void) {
if (SkyState::isDemo())
return; // I don't think this can even happen

View File

@ -148,6 +148,7 @@ public:
SkyControl(SkyScreen *screen, SkyDisk *disk, SkyMouse *mouse, SkyText *text, SkyMusicBase *music, SkyLogic *logic, OSystem *system, const char *savePath);
void doControlPanel(void);
void doLoadSavePanel(void);
void restartGame(void);
void showGameQuitMsg(bool useScreen = true);
private:
@ -191,6 +192,7 @@ private:
uint16 parseSaveData(uint8 *srcBuf);
static Compact *_saveLoadCpts[833]; // moved to sky/compacts/savedata.cpp
//static uint8 _restartData[0xCC10];
const char *_savePath;
AllocedMem *_memListRoot;

View File

@ -30,7 +30,7 @@
FREE_IF_NOT_0(_introTextSpace) \
FREE_IF_NOT_0(_introTextSave) \
_mixer->stopAll();
#define CHECK_ESC if (_key_pressed == 27) { _skyScreen->stopSequence(); REMOVE_INTRO return; }
#define CHECK_ESC if (_key_pressed == 27) { _skyScreen->stopSequence(); REMOVE_INTRO return false; }
#define WAIT_SEQUENCE while (_skyScreen->sequenceRunning()) { checkCommands(commandPtr); delay(50); CHECK_ESC }
#define INTRO_TEXT_WIDTH 128
@ -201,7 +201,7 @@ void SkyState::escDelay(uint32 pDelay) {
}
}
void SkyState::intro(void) {
bool SkyState::intro(void) {
uint32 *commandPtr = (uint32 *)zeroCommands;
@ -243,7 +243,7 @@ void SkyState::intro(void) {
if (isCDVersion()) {
doCDIntro();
return doCDIntro();
} else {
_skyDisk->prefetchFile(FN_A_PAL);
_skyDisk->prefetchFile(FN_1A_LOG);
@ -303,7 +303,7 @@ void SkyState::intro(void) {
delay(40);
if (_key_pressed == 27) {
REMOVE_INTRO;
return;
return false;
}
//non-scrolling frame update
@ -366,6 +366,7 @@ void SkyState::intro(void) {
commandPtr = (uint32 *)anim6bCommands;
WAIT_SEQUENCE; //6b
}
return true;
}
void SkyState::introFrame(uint8 **diffPtr, uint8 **vgaPtr, uint8 *screenData) {

View File

@ -2156,6 +2156,8 @@ bool SkyLogic::fnLeaveSection(uint32 sectionNo, uint32 b, uint32 c) {
if (sectionNo == 5) //linc section - has different mouse icons
_skyMouse->replaceMouseCursors(60302);
_currentSection = 0xFF; // force music-, sound- and gridreload
return true;
}
@ -2191,7 +2193,10 @@ bool SkyLogic::fnRestoreGame(uint32 a, uint32 b, uint32 c) {
}
bool SkyLogic::fnRestartGame(uint32 a, uint32 b, uint32 c) {
error("Stub: fnRestartGame");
error("Stub: fnRestartGame()");
//_skyControl->restartGame();
return false;
}
bool SkyLogic::fnNewSwingSeq(uint32 a, uint32 b, uint32 c) {
@ -2210,7 +2215,7 @@ bool SkyLogic::fnWaitSwingEnd(uint32 a, uint32 b, uint32 c) {
}
bool SkyLogic::fnSkipIntroCode(uint32 a, uint32 b, uint32 c) {
warning("Stub: fnSkipIntroCode");
SkyState::_systemVars.pastIntro = true;
return true;
}

View File

@ -54,7 +54,7 @@ Engine *Engine_SKY_create(GameDetector *detector, OSystem *syst) {
void **SkyState::_itemList[300];
SystemVars SkyState::_systemVars = {0, 0, 0, 0, 4316, 0};
SystemVars SkyState::_systemVars = {0, 0, 0, 0, 4316, 0, false};
SkyState::SkyState(GameDetector *detector, OSystem *syst)
: Engine(detector, syst) {
@ -96,8 +96,10 @@ void SkyState::go() {
initialise();
bool introSkipped;
if (!isDemo() || isCDVersion())
intro();
introSkipped = !intro();
else introSkipped = false;
_skyDisk->flushPrefetched();
@ -105,6 +107,9 @@ void SkyState::go() {
_paintGrid = false;
/*if (introSkipped)
_skyControl->restartGame();*/
while (1) {
delay(_systemVars.gameSpeed);
if (_key_pressed == 'r') {
@ -119,10 +124,15 @@ void SkyState::go() {
_skyScreen->forceRefresh();
_key_pressed = 0;
}
if (_key_pressed == 63) {
_key_pressed = 0;
_skyControl->doControlPanel();
}
/*if ((_key_pressed == 27) && (!_systemVars.pastIntro))
_skyControl->restartGame();*/
_skyMouse->mouseEngine((uint16)_sdl_mouse_x, (uint16)_sdl_mouse_y);
_skyLogic->engine();
if (!_skyLogic->checkProtection()) { // don't let copy prot. screen flash up

View File

@ -47,6 +47,7 @@ struct SystemVars {
uint16 language;
uint32 currentPalette;
uint16 gameSpeed;
bool pastIntro;
};
class SkyLogic;
@ -127,8 +128,8 @@ protected:
void initItemList();
void initVirgin();
void intro();
void doCDIntro();
bool intro();
bool doCDIntro();
void startTimerSequence(byte *sequence);
static void timerHandler(void *ptr);
void gotTimerTick();