Skip to content

Commit

Permalink
DREAMWEB: Move kQuitRequested out of data blob.
Browse files Browse the repository at this point in the history
  • Loading branch information
digitall committed Dec 27, 2011
1 parent 5511779 commit 5cfa189
Show file tree
Hide file tree
Showing 14 changed files with 38 additions and 42 deletions.
1 change: 1 addition & 0 deletions devtools/tasmrecover/tasm-recover
Expand Up @@ -59,6 +59,7 @@ p = parser(skip_binary_data = [
'id',
'place',
'blinktab',
'quitrequested',
# keypad.asm
'keypadlist',
'symbollist',
Expand Down
4 changes: 2 additions & 2 deletions engines/dreamweb/dreambase.h
Expand Up @@ -114,7 +114,8 @@ class DreamBase : public SegmentManager {
public:
DreamBase(DreamWeb::DreamWebEngine *en);

public:
bool _quitRequested;

// from backdrop.cpp
void doBlocks();
uint8 getXAd(const uint8 *setData, uint8 *result);
Expand Down Expand Up @@ -446,7 +447,6 @@ class DreamBase : public SegmentManager {
void readMouse();
uint16 readMouseState();
void hangOn(uint16 frameCount);
bool quitRequested();
void lockMon();
uint8 *textUnder();
void readKey();
Expand Down
2 changes: 1 addition & 1 deletion engines/dreamweb/dreamgen.cpp
Expand Up @@ -75,7 +75,7 @@ void DreamGenContext::__start() {
//0x0150: .... .... .... ....
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
//0x0160: .... .... .... ....
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, };
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, };
ds.assign(src, src + sizeof(src));
dreamweb();
}
Expand Down
5 changes: 2 additions & 3 deletions engines/dreamweb/dreamgen.h
Expand Up @@ -307,9 +307,8 @@ static const uint16 kCh1playing = 374;
static const uint16 kCh1blockstocopy = 375;
static const uint16 kCurrentsample = 377;
static const uint16 kRoomssample = 378;
static const uint16 kQuitrequested = 379;
static const uint16 kSubtitles = 380;
static const uint16 kForeignrelease = 381;
static const uint16 kSubtitles = 379;
static const uint16 kForeignrelease = 380;
static const uint16 kBlocktextdat = (0);
static const uint16 kPersonframes = (0);
static const uint16 kDebuglevel1 = (0);
Expand Down
5 changes: 3 additions & 2 deletions engines/dreamweb/dreamweb.cpp
Expand Up @@ -102,7 +102,7 @@ void DreamWebEngine::waitForVSync() {
}

void DreamWebEngine::quit() {
_base.data.byte(DreamGen::kQuitrequested) = 1;
_base._quitRequested = true;
_base.data.byte(DreamGen::kLasthardkey) = 1;
}

Expand Down Expand Up @@ -213,7 +213,7 @@ Common::Error DreamWebEngine::run() {

_timer->installTimerProc(vSyncInterrupt, 1000000 / 70, this, "dreamwebVSync");
_context.__start();
_base.data.byte(DreamGen::kQuitrequested) = 0;
_base._quitRequested = false;

_timer->removeTimerProc(vSyncInterrupt);

Expand Down Expand Up @@ -417,6 +417,7 @@ namespace DreamGen {
// FIXME/TODO: Move this to a better place.
DreamBase::DreamBase(DreamWeb::DreamWebEngine *en) : engine(en) {
_openChangeSize = kInventx+(4*kItempicsize);
_quitRequested = false;
}

} // End of namespace DreamGen
2 changes: 1 addition & 1 deletion engines/dreamweb/keypad.cpp
Expand Up @@ -139,7 +139,7 @@ void DreamBase::enterCode(uint8 digit0, uint8 digit1, uint8 digit2, uint8 digit3
dumpKeypad();
dumpTextLine();
checkCoords(keypadList);
if (quitRequested() || (data.byte(kGetback) == 1))
if (_quitRequested || (data.byte(kGetback) == 1))
break;
if (data.byte(kLightcount) == 1) {
if (data.byte(kLockstatus) == 0)
Expand Down
4 changes: 2 additions & 2 deletions engines/dreamweb/monitor.cpp
Expand Up @@ -86,7 +86,7 @@ void DreamBase::useMon() {
data.word(kMonadx) = oldMonadx;
data.word(kMonady) = oldMonady;
stop = execCommand();
if (quitRequested()) //TODO : Check why it crashes when put before the execcommand
if (_quitRequested) //TODO : Check why it crashes when put before the execcommand
break;
} while (!stop);
getRidOfTemp();
Expand Down Expand Up @@ -203,7 +203,7 @@ void DreamBase::input() {
vSync();
delCurs();
readKey();
if (quitRequested())
if (_quitRequested)
return;
uint8 currentKey = data.byte(kCurrentkey);
if (currentKey == 0)
Expand Down
4 changes: 2 additions & 2 deletions engines/dreamweb/newplace.cpp
Expand Up @@ -59,7 +59,7 @@ void DreamBase::selectLocation() {
data.byte(kNewlocation) = 255;

while (data.byte(kNewlocation) == 255) {
if (quitRequested())
if (_quitRequested)
break;

delPointer();
Expand All @@ -84,7 +84,7 @@ void DreamBase::selectLocation() {
checkCoords(destList);
}

if (quitRequested() || data.byte(kGetback) == 1 || data.byte(kNewlocation) == data.byte(kLocation)) {
if (_quitRequested || data.byte(kGetback) == 1 || data.byte(kNewlocation) == data.byte(kLocation)) {
data.byte(kNewlocation) = data.byte(kReallocation);
data.byte(kGetback) = 0;
}
Expand Down
2 changes: 1 addition & 1 deletion engines/dreamweb/object.cpp
Expand Up @@ -195,7 +195,7 @@ void DreamBase::examineOb(bool examineAgain) {
}
}

if (data.byte(kQuitrequested) != 0)
if (_quitRequested)
break;
if (data.byte(kExamagain) != 0)
examineAgain = true;
Expand Down
2 changes: 1 addition & 1 deletion engines/dreamweb/print.cpp
Expand Up @@ -103,7 +103,7 @@ uint8 DreamBase::printSlow(const uint8 *string, uint16 x, uint16 y, uint8 maxWid
data.word(kCharshift) = 0;
for (int i=0; i<2; ++i) {
uint16 mouseState = waitFrames();
if (data.byte(kQuitrequested))
if (_quitRequested)
return 0;
if (mouseState == 0)
continue;
Expand Down
10 changes: 5 additions & 5 deletions engines/dreamweb/saveload.cpp
Expand Up @@ -72,7 +72,7 @@ void DreamBase::doLoad(int savegameId) {
data.byte(kGetback) = 0;

while (data.byte(kGetback) == 0) {
if (quitRequested())
if (_quitRequested)
return;
delPointer();
readMouse();
Expand Down Expand Up @@ -166,7 +166,7 @@ void DreamBase::saveGame() {
data.byte(kGetback) = 0;

while (data.byte(kGetback) == 0) {
if (quitRequested())
if (_quitRequested)
return;
delPointer();
checkInput();
Expand Down Expand Up @@ -288,7 +288,7 @@ void DreamBase::doSaveLoad() {
data.byte(kGetback) = 0;

do { // wait ops
if (data.byte(kQuitrequested)) {
if (_quitRequested) {
data.byte(kManisoffscreen) = 0;
return;
}
Expand Down Expand Up @@ -376,7 +376,7 @@ void DreamBase::discOps() {
};

do {
if (data.byte(kQuitrequested) != 0)
if (_quitRequested)
return; // quitdiscops

delPointer();
Expand Down Expand Up @@ -637,7 +637,7 @@ void DreamBase::loadOld() {

doLoad(-1);

if (data.byte(kGetback) == 4 || quitRequested())
if (data.byte(kGetback) == 4 || _quitRequested)
return;

showDecisions();
Expand Down
31 changes: 13 additions & 18 deletions engines/dreamweb/stubs.cpp
Expand Up @@ -527,7 +527,7 @@ void DreamBase::dreamweb() {
cls();
setMode();
decide();
if (quitRequested())
if (_quitRequested)
goto done;

if (data.byte(kGetback) == 4)
Expand All @@ -544,17 +544,17 @@ void DreamBase::dreamweb() {
// TODO: In the demo version, titles() did nothing
clearPalette();
bibleQuote();
if (!quitRequested()) // "titlesearly"
if (!_quitRequested) // "titlesearly"
intro();

if (quitRequested())
if (_quitRequested)
goto done;

// "credits"
clearPalette();
realCredits();

if (quitRequested())
if (_quitRequested)
goto done;

clearChanges();
Expand All @@ -581,13 +581,12 @@ void DreamBase::dreamweb() {

// main loop
while (true) {

if (quitRequested())
if (_quitRequested)
goto done;

screenUpdate();

if (quitRequested())
if (_quitRequested)
goto done;

if (data.byte(kWongame) != 0) {
Expand Down Expand Up @@ -645,14 +644,10 @@ void DreamBase::dreamweb() {
engine->freeIcons2();
}

bool DreamBase::quitRequested() {
return data.byte(kQuitrequested);
}

void DreamBase::screenUpdate() {
newPlace();
mainScreen();
if (quitRequested())
if (_quitRequested)
return;
animPointer();

Expand Down Expand Up @@ -1742,7 +1737,7 @@ void DreamBase::hangOn(uint16 frameCount) {
while (frameCount) {
vSync();
--frameCount;
if (quitRequested())
if (_quitRequested)
break;
}
}
Expand All @@ -1756,7 +1751,7 @@ void DreamBase::hangOnW(uint16 frameCount) {
vSync();
dumpPointer();
--frameCount;
if (quitRequested())
if (_quitRequested)
break;
}
}
Expand All @@ -1782,7 +1777,7 @@ void DreamBase::hangOnP(uint16 count) {
showPointer();
vSync();
dumpPointer();
if (quitRequested())
if (_quitRequested)
break;
if (data.word(kMousebutton) != 0 && data.word(kMousebutton) != data.word(kOldbutton))
break;
Expand Down Expand Up @@ -1837,7 +1832,7 @@ void DreamBase::enterSymbol() {
{ 0xFFFF,0,0,0,0 }
};
checkCoords(symbolList);
} while ((data.byte(kGetback) == 0) && !quitRequested());
} while ((data.byte(kGetback) == 0) && !_quitRequested);
if ((data.byte(kSymbolbotnum) == 3) && (data.byte(kSymboltopnum) == 5)) {
removeSetObject(43);
placeSetObject(46);
Expand Down Expand Up @@ -2529,7 +2524,7 @@ void DreamBase::useMenu() {
{ 0xFFFF,0,0,0,0 }
};
checkCoords(menuList);
} while ((data.byte(kGetback) != 1) && !quitRequested());
} while ((data.byte(kGetback) != 1) && !_quitRequested);
data.byte(kManisoffscreen) = 0;
redrawMainScrn();
getRidOfTemp();
Expand Down Expand Up @@ -3125,7 +3120,7 @@ void DreamBase::decide() {
};

do {
if (data.byte(kQuitrequested) != 0)
if (_quitRequested)
return;

readMouse();
Expand Down
4 changes: 2 additions & 2 deletions engines/dreamweb/talk.cpp
Expand Up @@ -57,7 +57,7 @@ void DreamBase::talk() {
dumpTextLine();
data.byte(kGetback) = 0;
checkCoords(talkList);
if (data.byte(kQuitrequested))
if (_quitRequested)
break;
} while (!data.byte(kGetback));

Expand Down Expand Up @@ -216,7 +216,7 @@ bool DreamBase::hangOnPQ() {
dumpTextLine();
checkCoords(quitList);

if (data.byte(kGetback) == 1 || data.byte(kQuitrequested)) {
if (data.byte(kGetback) == 1 || _quitRequested) {
// Quit conversation
delPointer();
data.byte(kPointermode) = 0;
Expand Down
4 changes: 2 additions & 2 deletions engines/dreamweb/use.cpp
Expand Up @@ -199,7 +199,7 @@ void DreamBase::viewFolder() {
workToScreenM();
data.byte(kGetback) = 0;
do {
if (quitRequested())
if (_quitRequested)
break;
delPointer();
readMouse();
Expand Down Expand Up @@ -1288,7 +1288,7 @@ void DreamBase::useDiary() {
dumpDiaryKeys();
dumpTextLine();
checkCoords(diaryList);
} while (!data.byte(kGetback) && !quitRequested());
} while (!data.byte(kGetback) && !_quitRequested);


getRidOfTemp();
Expand Down

0 comments on commit 5cfa189

Please sign in to comment.