TOUCHE works with the new GMM implementation

svn-id: r33046
This commit is contained in:
Christopher Page 2008-07-13 22:24:55 +00:00
parent 0175425109
commit c210f90a62
4 changed files with 22 additions and 23 deletions

View file

@ -297,7 +297,7 @@ void ToucheEngine::handleMenuAction(void *menu, int actionId) {
menuData->quit = true; menuData->quit = true;
break; break;
case kActionQuitGame: case kActionQuitGame:
_quit = 1; quitGame();
menuData->quit = true; menuData->quit = true;
break; break;
case kActionTextOnly: case kActionTextOnly:
@ -398,7 +398,6 @@ void ToucheEngine::handleOptions(int forceDisplay) {
case Common::EVENT_QUIT: case Common::EVENT_QUIT:
menuData.quit = true; menuData.quit = true;
menuData.exit = true; menuData.exit = true;
_quit = 1;
break; break;
case Common::EVENT_LBUTTONDOWN: case Common::EVENT_LBUTTONDOWN:
button = menuData.findButtonUnderCursor(event.mouse.x, event.mouse.y); button = menuData.findButtonUnderCursor(event.mouse.x, event.mouse.y);
@ -433,8 +432,9 @@ void ToucheEngine::handleOptions(int forceDisplay) {
_system->delayMillis(10); _system->delayMillis(10);
} }
_fullRedrawCounter = 2; _fullRedrawCounter = 2;
if (!menuData.exit && _quit != 0) { if (!menuData.exit && quit()) {
_quit = displayQuitDialog(); if (displayQuitDialog())
quitGame();
} }
} }
} }

View file

@ -409,7 +409,8 @@ void ToucheEngine::op_setFlag() {
_currentKeyCharNum = val; _currentKeyCharNum = val;
break; break;
case 611: case 611:
_quit = val != 0; if (val != 0)
quitGame();
break; break;
case 612: case 612:
_flagsTable[613] = getRandomNumber(val); _flagsTable[613] = getRandomNumber(val);

View file

@ -295,7 +295,7 @@ void ToucheEngine::loadGameStateData(Common::ReadStream *stream) {
if (stream->readUint32LE() != saveLoadEndMarker) { if (stream->readUint32LE() != saveLoadEndMarker) {
warning("Corrupted gamestate data"); warning("Corrupted gamestate data");
// if that ever happens, exit the game // if that ever happens, exit the game
_quit = 1; quitGame();
} }
_flagsTable[614] = roomOffsX; _flagsTable[614] = roomOffsX;
_flagsTable[615] = roomOffsY; _flagsTable[615] = roomOffsY;

View file

@ -115,7 +115,7 @@ int ToucheEngine::go() {
res_deallocateTables(); res_deallocateTables();
res_closeDataFile(); res_closeDataFile();
return _rtl; return _eventMan->shouldRTL();
} }
void ToucheEngine::restart() { void ToucheEngine::restart() {
@ -269,7 +269,7 @@ void ToucheEngine::mainLoop() {
} }
uint32 frameTimeStamp = _system->getMillis(); uint32 frameTimeStamp = _system->getMillis();
for (uint32 cycleCounter = 0; _quit == 0; ++cycleCounter) { for (uint32 cycleCounter = 0; !quit(); ++cycleCounter) {
if ((cycleCounter % 3) == 0) { if ((cycleCounter % 3) == 0) {
runCycle(); runCycle();
} }
@ -298,9 +298,6 @@ void ToucheEngine::processEvents(bool handleKeyEvents) {
Common::Event event; Common::Event event;
while (_eventMan->pollEvent(event)) { while (_eventMan->pollEvent(event)) {
switch (event.type) { switch (event.type) {
case Common::EVENT_QUIT:
_quit = 1;
break;
case Common::EVENT_KEYDOWN: case Common::EVENT_KEYDOWN:
if (!handleKeyEvents) { if (!handleKeyEvents) {
break; break;
@ -308,7 +305,8 @@ void ToucheEngine::processEvents(bool handleKeyEvents) {
_flagsTable[600] = event.kbd.keycode; _flagsTable[600] = event.kbd.keycode;
if (event.kbd.keycode == Common::KEYCODE_ESCAPE) { if (event.kbd.keycode == Common::KEYCODE_ESCAPE) {
if (_displayQuitDialog) { if (_displayQuitDialog) {
_quit = displayQuitDialog(); if (displayQuitDialog())
quitGame();
} }
} else if (event.kbd.keycode == Common::KEYCODE_F5) { } else if (event.kbd.keycode == Common::KEYCODE_F5) {
if (_flagsTable[618] == 0 && !_hideInventoryTexts) { if (_flagsTable[618] == 0 && !_hideInventoryTexts) {
@ -1839,7 +1837,7 @@ int ToucheEngine::handleActionMenuUnderCursor(const int16 *actions, int offs, in
_menuRedrawCounter = 2; _menuRedrawCounter = 2;
Common::Rect rect(0, y, kScreenWidth, y + h); Common::Rect rect(0, y, kScreenWidth, y + h);
i = -1; i = -1;
while (_inp_rightMouseButtonPressed && _quit == 0) { while (_inp_rightMouseButtonPressed && !quit()) {
Common::Point mousePos = getMousePos(); Common::Point mousePos = getMousePos();
if (rect.contains(mousePos)) { if (rect.contains(mousePos)) {
int c = (mousePos.y - y) / kTextHeight; int c = (mousePos.y - y) / kTextHeight;
@ -2702,10 +2700,10 @@ bool ToucheEngine::sortPointsData(int num1, int num2) {
const int md2 = _programWalkTable[num1].point2; const int md2 = _programWalkTable[num1].point2;
_programPointsTable[md2].order = 0; _programPointsTable[md2].order = 0;
} }
bool quit = false; bool quitLoop = false;
int order = 1; int order = 1;
while (!quit) { while (!quitLoop) {
quit = true; quitLoop = true;
for (uint i = 0; i < _programWalkTable.size(); ++i) { for (uint i = 0; i < _programWalkTable.size(); ++i) {
const int md1 = _programWalkTable[i].point1; const int md1 = _programWalkTable[i].point1;
const int md2 = _programWalkTable[i].point2; const int md2 = _programWalkTable[i].point2;
@ -2713,11 +2711,11 @@ bool ToucheEngine::sortPointsData(int num1, int num2) {
assert((md2 & 0x4000) == 0); assert((md2 & 0x4000) == 0);
if (_programPointsTable[md1].order == order - 1 && _programPointsTable[md2].order > order) { if (_programPointsTable[md1].order == order - 1 && _programPointsTable[md2].order > order) {
_programPointsTable[md2].order = order; _programPointsTable[md2].order = order;
quit = false; quitLoop = false;
} }
if (_programPointsTable[md2].order == order - 1 && _programPointsTable[md1].order > order) { if (_programPointsTable[md2].order == order - 1 && _programPointsTable[md1].order > order) {
_programPointsTable[md1].order = order; _programPointsTable[md1].order = order;
quit = false; quitLoop = false;
} }
} }
} }
@ -2949,9 +2947,9 @@ void ToucheEngine::markWalkPoints(int keyChar) {
resetPointsData(0); resetPointsData(0);
if (pointsDataNum != -1) { if (pointsDataNum != -1) {
_programPointsTable[pointsDataNum].order = 1; _programPointsTable[pointsDataNum].order = 1;
bool quit = false; bool quitLoop = false;
while (!quit) { while (!quitLoop) {
quit = true; quitLoop = true;
for (uint i = 0; i < _programWalkTable.size(); ++i) { for (uint i = 0; i < _programWalkTable.size(); ++i) {
int16 md1 = _programWalkTable[i].point1; int16 md1 = _programWalkTable[i].point1;
int16 md2 = _programWalkTable[i].point2; int16 md2 = _programWalkTable[i].point2;
@ -2959,11 +2957,11 @@ void ToucheEngine::markWalkPoints(int keyChar) {
assert((md2 & 0x4000) == 0); assert((md2 & 0x4000) == 0);
if (_programPointsTable[md1].order != 0 && _programPointsTable[md2].order == 0) { if (_programPointsTable[md1].order != 0 && _programPointsTable[md2].order == 0) {
_programPointsTable[md2].order = 1; _programPointsTable[md2].order = 1;
quit = false; quitLoop = false;
} }
if (_programPointsTable[md2].order != 0 && _programPointsTable[md1].order == 0) { if (_programPointsTable[md2].order != 0 && _programPointsTable[md1].order == 0) {
_programPointsTable[md1].order = 1; _programPointsTable[md1].order = 1;
quit = false; quitLoop = false;
} }
} }
} }