cleanup
svn-id: r24654
This commit is contained in:
parent
e1efdfc7f6
commit
f6f1dac199
7 changed files with 139 additions and 116 deletions
|
@ -52,6 +52,7 @@ public:
|
||||||
void adjustVolume(int diff);
|
void adjustVolume(int diff);
|
||||||
void setVolume(int volume);
|
void setVolume(int volume);
|
||||||
int getVolume() const { return _masterVolume; }
|
int getVolume() const { return _masterVolume; }
|
||||||
|
void setLooping(bool loop) { _isLooping = loop; }
|
||||||
|
|
||||||
// MidiDriver interface
|
// MidiDriver interface
|
||||||
int open();
|
int open();
|
||||||
|
|
|
@ -155,7 +155,7 @@ void ToucheEngine::res_deallocateTables() {
|
||||||
free(_convKitData);
|
free(_convKitData);
|
||||||
_convKitData = 0;
|
_convKitData = 0;
|
||||||
|
|
||||||
for (int i = 0; i < 5; ++i) {
|
for (int i = 0; i < NUM_SEQUENCES; ++i) {
|
||||||
free(_sequenceDataTable[i]);
|
free(_sequenceDataTable[i]);
|
||||||
_sequenceDataTable[i] = 0;
|
_sequenceDataTable[i] = 0;
|
||||||
}
|
}
|
||||||
|
@ -429,9 +429,6 @@ void ToucheEngine::res_loadRoom(int num) {
|
||||||
_fullRedrawCounter = 1;
|
_fullRedrawCounter = 1;
|
||||||
_roomNeedRedraw = true;
|
_roomNeedRedraw = true;
|
||||||
|
|
||||||
// uint8 *p = _backdropBuffer + _currentBitmapWidth * _currentBitmapHeight;
|
|
||||||
// _spritesTable[5].ptr = p + 16384;
|
|
||||||
// _spritesTable[6].ptr = p + 145728 + 16384;
|
|
||||||
_sequenceEntryTable[5].sprNum = -1;
|
_sequenceEntryTable[5].sprNum = -1;
|
||||||
_sequenceEntryTable[5].seqNum = -1;
|
_sequenceEntryTable[5].seqNum = -1;
|
||||||
_sequenceEntryTable[6].sprNum = -1;
|
_sequenceEntryTable[6].sprNum = -1;
|
||||||
|
@ -447,6 +444,15 @@ void ToucheEngine::res_loadSprite(int num, int index) {
|
||||||
_fData.seek(offs);
|
_fData.seek(offs);
|
||||||
_currentImageWidth = _fData.readUint16LE();
|
_currentImageWidth = _fData.readUint16LE();
|
||||||
_currentImageHeight = _fData.readUint16LE();
|
_currentImageHeight = _fData.readUint16LE();
|
||||||
|
const uint32 size = _currentImageWidth * _currentImageHeight;
|
||||||
|
if (size > spr->size) {
|
||||||
|
warning("Reallocating memory for sprite %d (index %d), %d bytes needed", num, index, size - spr->size);
|
||||||
|
spr->size = size;
|
||||||
|
spr->ptr = (uint8 *)realloc(spr->ptr, size);
|
||||||
|
if (!spr->ptr) {
|
||||||
|
error("Unable to reallocate memory for sprite %d", index);
|
||||||
|
}
|
||||||
|
}
|
||||||
for (int i = 0; i < _currentImageHeight; ++i) {
|
for (int i = 0; i < _currentImageHeight; ++i) {
|
||||||
res_decodeScanLineImageRLE(spr->ptr + _currentImageWidth * i, _currentImageWidth);
|
res_decodeScanLineImageRLE(spr->ptr + _currentImageWidth * i, _currentImageWidth);
|
||||||
}
|
}
|
||||||
|
@ -457,9 +463,6 @@ void ToucheEngine::res_loadSprite(int num, int index) {
|
||||||
}
|
}
|
||||||
spr->w = _currentImageWidth;
|
spr->w = _currentImageWidth;
|
||||||
spr->h = _currentImageHeight;
|
spr->h = _currentImageHeight;
|
||||||
// Graphics::copyRect(_offscreenBuffer, 640, 0, 0,
|
|
||||||
// _backdropBuffer, _currentBitmapWidth, _flagsTable[614], _flagsTable[615],
|
|
||||||
// 640, 100);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ToucheEngine::res_loadSequence(int num, int index) {
|
void ToucheEngine::res_loadSequence(int num, int index) {
|
||||||
|
@ -562,6 +565,10 @@ void ToucheEngine::res_loadSound(int priority, int num) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ToucheEngine::res_stopSound() {
|
||||||
|
_mixer->stopHandle(_sfxHandle);
|
||||||
|
}
|
||||||
|
|
||||||
void ToucheEngine::res_loadMusic(int num) {
|
void ToucheEngine::res_loadMusic(int num) {
|
||||||
debugC(9, kDebugResource, "ToucheEngine::res_loadMusic() num=%d", num);
|
debugC(9, kDebugResource, "ToucheEngine::res_loadMusic() num=%d", num);
|
||||||
uint32 size;
|
uint32 size;
|
||||||
|
@ -573,7 +580,8 @@ void ToucheEngine::res_loadMusic(int num) {
|
||||||
void ToucheEngine::res_loadSpeech(int num) {
|
void ToucheEngine::res_loadSpeech(int num) {
|
||||||
debugC(9, kDebugResource, "ToucheEngine::res_loadSpeech() num=%d", num);
|
debugC(9, kDebugResource, "ToucheEngine::res_loadSpeech() num=%d", num);
|
||||||
if (num == -1) {
|
if (num == -1) {
|
||||||
// XXX stop all sounds currently playing
|
_mixer->stopHandle(_speechHandle);
|
||||||
|
_speechPlaying = false;
|
||||||
} else {
|
} else {
|
||||||
if (_compressedSpeechData < 0) { // uncompressed speech data
|
if (_compressedSpeechData < 0) { // uncompressed speech data
|
||||||
if (_fSpeech[0].isOpen()) {
|
if (_fSpeech[0].isOpen()) {
|
||||||
|
|
|
@ -233,7 +233,7 @@ void ToucheEngine::saveGameStateData(Common::WriteStream *stream) {
|
||||||
saveOrLoad(*stream, _programPointsTable[i]);
|
saveOrLoad(*stream, _programPointsTable[i]);
|
||||||
}
|
}
|
||||||
stream->write(_updatedRoomAreasTable, 200);
|
stream->write(_updatedRoomAreasTable, 200);
|
||||||
for (uint i = 0; i < 6; ++i) {
|
for (uint i = 0; i < NUM_SEQUENCES; ++i) {
|
||||||
saveOrLoad(*stream, _sequenceEntryTable[i]);
|
saveOrLoad(*stream, _sequenceEntryTable[i]);
|
||||||
}
|
}
|
||||||
for (uint i = 0; i < 1024; ++i) {
|
for (uint i = 0; i < 1024; ++i) {
|
||||||
|
@ -296,7 +296,7 @@ void ToucheEngine::loadGameStateData(Common::ReadStream *stream) {
|
||||||
for (uint i = 1; i <= _updatedRoomAreasTable[0]; ++i) {
|
for (uint i = 1; i <= _updatedRoomAreasTable[0]; ++i) {
|
||||||
updateRoomAreas(_updatedRoomAreasTable[i], -1);
|
updateRoomAreas(_updatedRoomAreasTable[i], -1);
|
||||||
}
|
}
|
||||||
for (uint i = 0; i < 6; ++i) {
|
for (uint i = 0; i < NUM_SEQUENCES; ++i) {
|
||||||
saveOrLoad(*stream, _sequenceEntryTable[i]);
|
saveOrLoad(*stream, _sequenceEntryTable[i]);
|
||||||
}
|
}
|
||||||
for (uint i = 0; i < 1024; ++i) {
|
for (uint i = 0; i < 1024; ++i) {
|
||||||
|
@ -333,15 +333,16 @@ void ToucheEngine::loadGameStateData(Common::ReadStream *stream) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_currentKeyCharNum = _flagsTable[104];
|
_currentKeyCharNum = _flagsTable[104];
|
||||||
_inventoryListCount[0] = 0;
|
_inventoryStateTable[0].displayOffset = 0;
|
||||||
_inventoryListCount[3] = 0;
|
_inventoryStateTable[1].displayOffset = 0;
|
||||||
_inventoryListCount[6] = 0;
|
_inventoryStateTable[2].displayOffset = 0;
|
||||||
drawInventory(_currentKeyCharNum, 1);
|
drawInventory(_currentKeyCharNum, 1);
|
||||||
Graphics::copyRect(_offscreenBuffer, 640, 0, 0, _backdropBuffer, _currentBitmapWidth, _flagsTable[614], _flagsTable[615], 640, 352);
|
Graphics::copyRect(_offscreenBuffer, 640, 0, 0, _backdropBuffer, _currentBitmapWidth, _flagsTable[614], _flagsTable[615], 640, 352);
|
||||||
updateEntireScreen();
|
updateEntireScreen();
|
||||||
if (_flagsTable[617] != 0) {
|
if (_flagsTable[617] != 0) {
|
||||||
res_loadSpeech(_flagsTable[617]);
|
res_loadSpeech(_flagsTable[617]);
|
||||||
}
|
}
|
||||||
|
debug(0, "Loaded state, current episode %d", _currentEpisodeNum);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ToucheEngine::saveGameState(int num, const char *description) {
|
bool ToucheEngine::saveGameState(int num, const char *description) {
|
||||||
|
@ -368,7 +369,7 @@ bool ToucheEngine::saveGameState(int num, const char *description) {
|
||||||
return saveOk;
|
return saveOk;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ToucheEngine::loadGameState(int num, const char *description) {
|
bool ToucheEngine::loadGameState(int num) {
|
||||||
bool loadOk = false;
|
bool loadOk = false;
|
||||||
char gameStateFileName[16];
|
char gameStateFileName[16];
|
||||||
generateGameStateFileName(num, gameStateFileName, 15);
|
generateGameStateFileName(num, gameStateFileName, 15);
|
||||||
|
|
|
@ -37,7 +37,7 @@ SpriteData ToucheEngine::_spritesTable[NUM_SPRITES] = {
|
||||||
{ 0x1E848, 0, 0, 0, 0, 0 } // room sprite 2
|
{ 0x1E848, 0, 0, 0, 0, 0 } // room sprite 2
|
||||||
};
|
};
|
||||||
|
|
||||||
const uint8 ToucheEngine::_directionsTable[] = {
|
const uint8 ToucheEngine::_directionsTable[NUM_DIRECTIONS] = {
|
||||||
0x7F, 0x7F, 0x7F, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x7F,
|
0x7F, 0x7F, 0x7F, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x7F,
|
||||||
0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F,
|
0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F,
|
||||||
0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F,
|
0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F,
|
||||||
|
|
|
@ -53,6 +53,7 @@ ToucheEngine::ToucheEngine(OSystem *system, Common::Language language)
|
||||||
|
|
||||||
_roomNeedRedraw = false;
|
_roomNeedRedraw = false;
|
||||||
_fastWalkMode = false;
|
_fastWalkMode = false;
|
||||||
|
_fastMode = false;
|
||||||
|
|
||||||
_currentObjectNum = -1;
|
_currentObjectNum = -1;
|
||||||
_objectDescriptionNum = 0;
|
_objectDescriptionNum = 0;
|
||||||
|
@ -193,27 +194,30 @@ void ToucheEngine::restart() {
|
||||||
|
|
||||||
void ToucheEngine::mainLoop() {
|
void ToucheEngine::mainLoop() {
|
||||||
restart();
|
restart();
|
||||||
|
|
||||||
_inp_mousePos.x = 640 / 2;
|
_inp_mousePos.x = 640 / 2;
|
||||||
_inp_mousePos.y = 352 / 2;
|
_inp_mousePos.y = 352 / 2;
|
||||||
_inp_mouseButtonClicked = false;
|
_inp_leftMouseButtonPressed = false;
|
||||||
_inp_mouseButtonPressed = false;
|
_inp_rightMouseButtonPressed = false;
|
||||||
_system->warpMouse(_inp_mousePos.x, _inp_mousePos.y);
|
_system->warpMouse(_inp_mousePos.x, _inp_mousePos.y);
|
||||||
setPalette(0, 255, 0, 0, 0);
|
setPalette(0, 255, 0, 0, 0);
|
||||||
#ifdef NORMAL_GAME_SPEED
|
|
||||||
|
if (ConfMan.hasKey("save_slot")) {
|
||||||
|
loadGameState(ConfMan.getInt("save_slot"));
|
||||||
|
_newEpisodeNum = _currentEpisodeNum;
|
||||||
|
}
|
||||||
|
|
||||||
const int cycleDelay = 1000 / (1193180 / 32768);
|
const int cycleDelay = 1000 / (1193180 / 32768);
|
||||||
#else
|
|
||||||
const int cycleDelay = 10;
|
|
||||||
#endif
|
|
||||||
uint32 frameTimeStamp = _system->getMillis();
|
uint32 frameTimeStamp = _system->getMillis();
|
||||||
for (uint32 cycleCounter = 0; _flagsTable[611] == 0; ++cycleCounter) {
|
for (uint32 cycleCounter = 0; _flagsTable[611] == 0; ++cycleCounter) {
|
||||||
if ((cycleCounter & 3) == 0) {
|
if ((cycleCounter & 2) == 0) {
|
||||||
runCycle();
|
runCycle();
|
||||||
}
|
}
|
||||||
if ((cycleCounter & 2) == 0) {
|
if ((cycleCounter & 1) == 0) {
|
||||||
fadePaletteFromFlags();
|
fadePaletteFromFlags();
|
||||||
}
|
}
|
||||||
int delay = _system->getMillis() - frameTimeStamp;
|
int delay = _system->getMillis() - frameTimeStamp;
|
||||||
delay = cycleDelay - delay;
|
delay = (_fastMode ? 10 : cycleDelay) - delay;
|
||||||
if (delay < 1) {
|
if (delay < 1) {
|
||||||
delay = 1;
|
delay = 1;
|
||||||
}
|
}
|
||||||
|
@ -235,31 +239,32 @@ void ToucheEngine::processEvents() {
|
||||||
if (_displayQuitDialog) {
|
if (_displayQuitDialog) {
|
||||||
_flagsTable[611] = ui_displayQuitDialog();
|
_flagsTable[611] = ui_displayQuitDialog();
|
||||||
}
|
}
|
||||||
}
|
} else if (event.kbd.keycode == 286) { // F5
|
||||||
if (event.kbd.keycode == 286) { // F5
|
|
||||||
if (_flagsTable[618] == 0 && !_hideInventoryTexts) {
|
if (_flagsTable[618] == 0 && !_hideInventoryTexts) {
|
||||||
ui_handleOptions(0);
|
ui_handleOptions(0);
|
||||||
}
|
}
|
||||||
}
|
} else if (event.kbd.keycode == 290) { // F9
|
||||||
if (event.kbd.keycode == 290) { // F9
|
|
||||||
_fastWalkMode = true;
|
_fastWalkMode = true;
|
||||||
}
|
} else if (event.kbd.keycode == 291) { // F10
|
||||||
if (event.kbd.keycode == 291) { // F10
|
|
||||||
_fastWalkMode = false;
|
_fastWalkMode = false;
|
||||||
}
|
}
|
||||||
if (event.kbd.ascii == 't') {
|
if (event.kbd.flags == OSystem::KBD_CTRL) {
|
||||||
++_talkTextMode;
|
if (event.kbd.keycode == 'd') {
|
||||||
if (_talkTextMode == kTalkModeCount) {
|
// enable debugging stuff ?
|
||||||
_talkTextMode = 0;
|
_flagsTable[777] = 1;
|
||||||
|
} else if (event.kbd.keycode == 'f') {
|
||||||
|
_fastMode = !_fastMode;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (event.kbd.ascii == 't') {
|
||||||
|
++_talkTextMode;
|
||||||
|
if (_talkTextMode == kTalkModeCount) {
|
||||||
|
_talkTextMode = 0;
|
||||||
|
}
|
||||||
|
ui_displayTextMode(-(92 + _talkTextMode));
|
||||||
|
} else if (event.kbd.ascii == ' ') {
|
||||||
|
updateKeyCharTalk(2);
|
||||||
}
|
}
|
||||||
ui_displayTextMode(-(92 + _talkTextMode));
|
|
||||||
}
|
|
||||||
if (event.kbd.ascii == 'd') {
|
|
||||||
// enable debugging stuff ?
|
|
||||||
_flagsTable[777] = 1;
|
|
||||||
}
|
|
||||||
if (event.kbd.ascii == ' ') {
|
|
||||||
updateKeyCharTalk(2);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case OSystem::EVENT_MOUSEMOVE:
|
case OSystem::EVENT_MOUSEMOVE:
|
||||||
|
@ -269,7 +274,7 @@ void ToucheEngine::processEvents() {
|
||||||
case OSystem::EVENT_LBUTTONDOWN:
|
case OSystem::EVENT_LBUTTONDOWN:
|
||||||
_inp_mousePos.x = event.mouse.x;
|
_inp_mousePos.x = event.mouse.x;
|
||||||
_inp_mousePos.y = event.mouse.y;
|
_inp_mousePos.y = event.mouse.y;
|
||||||
_inp_mouseButtonClicked = true;
|
_inp_leftMouseButtonPressed = true;
|
||||||
break;
|
break;
|
||||||
case OSystem::EVENT_LBUTTONUP:
|
case OSystem::EVENT_LBUTTONUP:
|
||||||
_inp_mousePos.x = event.mouse.x;
|
_inp_mousePos.x = event.mouse.x;
|
||||||
|
@ -278,12 +283,12 @@ void ToucheEngine::processEvents() {
|
||||||
case OSystem::EVENT_RBUTTONDOWN:
|
case OSystem::EVENT_RBUTTONDOWN:
|
||||||
_inp_mousePos.x = event.mouse.x;
|
_inp_mousePos.x = event.mouse.x;
|
||||||
_inp_mousePos.y = event.mouse.y;
|
_inp_mousePos.y = event.mouse.y;
|
||||||
_inp_mouseButtonPressed = true;
|
_inp_rightMouseButtonPressed = true;
|
||||||
break;
|
break;
|
||||||
case OSystem::EVENT_RBUTTONUP:
|
case OSystem::EVENT_RBUTTONUP:
|
||||||
_inp_mousePos.x = event.mouse.x;
|
_inp_mousePos.x = event.mouse.x;
|
||||||
_inp_mousePos.y = event.mouse.y;
|
_inp_mousePos.y = event.mouse.y;
|
||||||
_inp_mouseButtonPressed = false;
|
_inp_rightMouseButtonPressed = false;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -439,7 +444,8 @@ void ToucheEngine::setupNewEpisode() {
|
||||||
if (_newEpisodeNum == 91) {
|
if (_newEpisodeNum == 91) {
|
||||||
_displayQuitDialog = true;
|
_displayQuitDialog = true;
|
||||||
}
|
}
|
||||||
// flushDigitalSounds();
|
res_stopSound();
|
||||||
|
res_stopSpeech();
|
||||||
setupEpisode(_newEpisodeNum);
|
setupEpisode(_newEpisodeNum);
|
||||||
runCurrentKeyCharScript(1);
|
runCurrentKeyCharScript(1);
|
||||||
_newEpisodeNum = 0;
|
_newEpisodeNum = 0;
|
||||||
|
@ -824,11 +830,7 @@ void ToucheEngine::redrawRoom() {
|
||||||
void ToucheEngine::fadePalette(int firstColor, int lastColor, int scale, int scaleInc, int fadingStepsCount) {
|
void ToucheEngine::fadePalette(int firstColor, int lastColor, int scale, int scaleInc, int fadingStepsCount) {
|
||||||
for (int i = 0; i < fadingStepsCount; ++i) {
|
for (int i = 0; i < fadingStepsCount; ++i) {
|
||||||
scale += scaleInc;
|
scale += scaleInc;
|
||||||
if (scale > 255) {
|
scale = CLIP(scale, 0, 255);
|
||||||
scale = 0;
|
|
||||||
} else if (scale < 0) {
|
|
||||||
scale = 0;
|
|
||||||
}
|
|
||||||
setPalette(firstColor, lastColor, scale, scale, scale);
|
setPalette(firstColor, lastColor, scale, scale, scale);
|
||||||
_system->updateScreen();
|
_system->updateScreen();
|
||||||
_system->delayMillis(10);
|
_system->delayMillis(10);
|
||||||
|
@ -969,6 +971,7 @@ void ToucheEngine::moveKeyChar(uint8 *dst, int dstPitch, KeyChar *key) {
|
||||||
frameDir = READ_LE_UINT16(sequenceData + frameDir * 2);
|
frameDir = READ_LE_UINT16(sequenceData + frameDir * 2);
|
||||||
}
|
}
|
||||||
if (keyChar == 0) {
|
if (keyChar == 0) {
|
||||||
|
assert(frameDir < NUM_DIRECTIONS);
|
||||||
if (_directionsTable[frameDir] <= _flagsTable[176]) {
|
if (_directionsTable[frameDir] <= _flagsTable[176]) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1033,6 +1036,7 @@ void ToucheEngine::moveKeyChar(uint8 *dst, int dstPitch, KeyChar *key) {
|
||||||
frameDir = READ_LE_UINT16(sequenceData + frameDir * 2);
|
frameDir = READ_LE_UINT16(sequenceData + frameDir * 2);
|
||||||
}
|
}
|
||||||
if (keyChar == 0) {
|
if (keyChar == 0) {
|
||||||
|
assert(frameDir < NUM_DIRECTIONS);
|
||||||
if (_directionsTable[frameDir] <= _flagsTable[176]) {
|
if (_directionsTable[frameDir] <= _flagsTable[176]) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1373,7 +1377,7 @@ void ToucheEngine::updateCursor(int num) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ToucheEngine::handleMouseButtonClicked() {
|
void ToucheEngine::handleLeftMouseButtonClickOnInventory() {
|
||||||
for (int area = 0; area < ARRAYSIZE(_inventoryAreasTable); ++area) {
|
for (int area = 0; area < ARRAYSIZE(_inventoryAreasTable); ++area) {
|
||||||
if (_inventoryAreasTable[area].contains(_inp_mousePos)) {
|
if (_inventoryAreasTable[area].contains(_inp_mousePos)) {
|
||||||
if (area >= kInventoryObject1 && area <= kInventoryObject6) {
|
if (area >= kInventoryObject1 && area <= kInventoryObject6) {
|
||||||
|
@ -1457,7 +1461,7 @@ void ToucheEngine::handleMouseButtonClicked() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ToucheEngine::handleMouseButtonPressed() {
|
void ToucheEngine::handleRightMouseButtonClickOnInventory() {
|
||||||
for (int area = kInventoryObject1; area <= kInventoryObject6; ++area) {
|
for (int area = kInventoryObject1; area <= kInventoryObject6; ++area) {
|
||||||
const Common::Rect &r = _inventoryAreasTable[area];
|
const Common::Rect &r = _inventoryAreasTable[area];
|
||||||
if (r.contains(_inp_mousePos)) {
|
if (r.contains(_inp_mousePos)) {
|
||||||
|
@ -1480,16 +1484,16 @@ void ToucheEngine::handleMouseButtonPressed() {
|
||||||
|
|
||||||
void ToucheEngine::handleMouseInput(int flag) {
|
void ToucheEngine::handleMouseInput(int flag) {
|
||||||
if (_disabledInputCounter != 0 || _flagsTable[618] != 0) {
|
if (_disabledInputCounter != 0 || _flagsTable[618] != 0) {
|
||||||
_inp_mouseButtonPressed = false;
|
_inp_rightMouseButtonPressed = false;
|
||||||
}
|
}
|
||||||
if (_inp_mousePos.y < _roomAreaRect.height()) {
|
if (_inp_mousePos.y < _roomAreaRect.height()) {
|
||||||
handleMouseInputRoomArea(flag);
|
handleMouseClickOnRoom(flag);
|
||||||
} else {
|
} else {
|
||||||
handleMouseInputInventoryArea(flag);
|
handleMouseClickOnInventory(flag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ToucheEngine::handleMouseInputRoomArea(int flag) {
|
void ToucheEngine::handleMouseClickOnRoom(int flag) {
|
||||||
if (_hideInventoryTexts && _conversationReplyNum != -1 && !_conversationAreaCleared) {
|
if (_hideInventoryTexts && _conversationReplyNum != -1 && !_conversationAreaCleared) {
|
||||||
drawConversationString(_conversationReplyNum, 0xD6);
|
drawConversationString(_conversationReplyNum, 0xD6);
|
||||||
}
|
}
|
||||||
|
@ -1539,8 +1543,8 @@ void ToucheEngine::handleMouseInputRoomArea(int flag) {
|
||||||
if (_giveItemToCounter == 0 && !_hideInventoryTexts) {
|
if (_giveItemToCounter == 0 && !_hideInventoryTexts) {
|
||||||
if (hitBox->contains(hitPosX, hitPosY)) {
|
if (hitBox->contains(hitPosX, hitPosY)) {
|
||||||
if (!itemDisabled) {
|
if (!itemDisabled) {
|
||||||
if (_inp_mouseButtonClicked && _currentCursorObject != 0) {
|
if (_inp_leftMouseButtonPressed && _currentCursorObject != 0) {
|
||||||
_inp_mouseButtonClicked = false;
|
_inp_leftMouseButtonPressed = false;
|
||||||
itemSelected = true;
|
itemSelected = true;
|
||||||
_flagsTable[119] = _currentCursorObject;
|
_flagsTable[119] = _currentCursorObject;
|
||||||
if (_currentCursorObject == 1) {
|
if (_currentCursorObject == 1) {
|
||||||
|
@ -1590,8 +1594,8 @@ void ToucheEngine::handleMouseInputRoomArea(int flag) {
|
||||||
_programHitBoxTable[i].hitBoxes[1] = Common::Rect(strPosX, strPosY, strPosX + strWidth, strPosY + 16);
|
_programHitBoxTable[i].hitBoxes[1] = Common::Rect(strPosX, strPosY, strPosX + strWidth, strPosY + 16);
|
||||||
_programHitBoxTable[i].state |= 0x8000;
|
_programHitBoxTable[i].state |= 0x8000;
|
||||||
}
|
}
|
||||||
if (_inp_mouseButtonClicked) {
|
if (_inp_leftMouseButtonPressed) {
|
||||||
_inp_mouseButtonClicked = false;
|
_inp_leftMouseButtonPressed = false;
|
||||||
if (_currentCursorObject != 0) {
|
if (_currentCursorObject != 0) {
|
||||||
updateCursor(_currentKeyCharNum);
|
updateCursor(_currentKeyCharNum);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1601,9 +1605,9 @@ void ToucheEngine::handleMouseInputRoomArea(int flag) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (_inp_mouseButtonPressed && !itemDisabled && !itemSelected) {
|
if (_inp_rightMouseButtonPressed && !itemDisabled && !itemSelected) {
|
||||||
int act = handleActionMenuUnderCursor(_programHitBoxTable[i].actions, _inp_mousePos.x, _inp_mousePos.y, str);
|
int act = handleActionMenuUnderCursor(_programHitBoxTable[i].actions, _inp_mousePos.x, _inp_mousePos.y, str);
|
||||||
_inp_mouseButtonPressed = false;
|
_inp_rightMouseButtonPressed = false;
|
||||||
int16 facing = (keyCharNewPosX <= _keyCharsTable[_currentKeyCharNum].xPos) ? 3 : 0;
|
int16 facing = (keyCharNewPosX <= _keyCharsTable[_currentKeyCharNum].xPos) ? 3 : 0;
|
||||||
_keyCharsTable[_currentKeyCharNum].facingDirection = facing;
|
_keyCharsTable[_currentKeyCharNum].facingDirection = facing;
|
||||||
if (act != 0) {
|
if (act != 0) {
|
||||||
|
@ -1622,8 +1626,8 @@ void ToucheEngine::handleMouseInputRoomArea(int flag) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (_inp_mouseButtonClicked) {
|
if (_inp_leftMouseButtonPressed) {
|
||||||
_inp_mouseButtonClicked = false;
|
_inp_leftMouseButtonPressed = false;
|
||||||
if (_currentCursorObject != 0) {
|
if (_currentCursorObject != 0) {
|
||||||
if (_currentCursorObject != 1) {
|
if (_currentCursorObject != 1) {
|
||||||
addItemToInventory(_currentKeyCharNum, _currentCursorObject);
|
addItemToInventory(_currentKeyCharNum, _currentCursorObject);
|
||||||
|
@ -1642,7 +1646,7 @@ void ToucheEngine::handleMouseInputRoomArea(int flag) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ToucheEngine::handleMouseInputInventoryArea(int flag) {
|
void ToucheEngine::handleMouseClickOnInventory(int flag) {
|
||||||
if (flag) {
|
if (flag) {
|
||||||
drawHitBoxes();
|
drawHitBoxes();
|
||||||
}
|
}
|
||||||
|
@ -1661,8 +1665,8 @@ void ToucheEngine::handleMouseInputInventoryArea(int flag) {
|
||||||
drawConversationString(replyNum, 0xFF);
|
drawConversationString(replyNum, 0xFF);
|
||||||
_conversationReplyNum = replyNum;
|
_conversationReplyNum = replyNum;
|
||||||
}
|
}
|
||||||
if (_inp_mouseButtonClicked) {
|
if (_inp_leftMouseButtonPressed) {
|
||||||
_inp_mouseButtonClicked = false;
|
_inp_leftMouseButtonPressed = false;
|
||||||
setupConversationScript(replyNum);
|
setupConversationScript(replyNum);
|
||||||
_conversationReplyNum = -1;
|
_conversationReplyNum = -1;
|
||||||
}
|
}
|
||||||
|
@ -1672,25 +1676,25 @@ void ToucheEngine::handleMouseInputInventoryArea(int flag) {
|
||||||
drawConversationString(_conversationReplyNum, 0xD6);
|
drawConversationString(_conversationReplyNum, 0xD6);
|
||||||
}
|
}
|
||||||
_conversationReplyNum = -1;
|
_conversationReplyNum = -1;
|
||||||
if (_inp_mouseButtonClicked) {
|
if (_inp_leftMouseButtonPressed) {
|
||||||
int replyNum = _inp_mousePos.y - _roomAreaRect.height();
|
int replyNum = _inp_mousePos.y - _roomAreaRect.height();
|
||||||
if (replyNum < 40) {
|
if (replyNum < 40) {
|
||||||
drawCharacterConversationRepeat();
|
drawCharacterConversationRepeat();
|
||||||
} else {
|
} else {
|
||||||
drawCharacterConversationRepeat2();
|
drawCharacterConversationRepeat2();
|
||||||
}
|
}
|
||||||
_inp_mouseButtonClicked = false;
|
_inp_leftMouseButtonPressed = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (_disabledInputCounter == 0 && !_hideInventoryTexts) {
|
} else if (_disabledInputCounter == 0 && !_hideInventoryTexts) {
|
||||||
if (_inp_mouseButtonClicked) {
|
if (_inp_leftMouseButtonPressed) {
|
||||||
handleMouseButtonClicked();
|
handleLeftMouseButtonClickOnInventory();
|
||||||
_inp_mouseButtonClicked = false;
|
_inp_leftMouseButtonPressed = false;
|
||||||
}
|
}
|
||||||
if (_inp_mouseButtonPressed) {
|
if (_inp_rightMouseButtonPressed) {
|
||||||
handleMouseButtonPressed();
|
handleRightMouseButtonClickOnInventory();
|
||||||
_inp_mouseButtonPressed = false;
|
_inp_rightMouseButtonPressed = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1707,7 +1711,7 @@ void ToucheEngine::clearRoomArea() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ToucheEngine::startNewMusic() {
|
void ToucheEngine::startNewMusic() {
|
||||||
// bool loopMusic = _flagsTable[619] != 0; // ?
|
// _midiPlayer->setLooping(_flagsTable[619] != 0);
|
||||||
if (_newMusicNum != 0 && _newMusicNum != _currentMusicNum) {
|
if (_newMusicNum != 0 && _newMusicNum != _currentMusicNum) {
|
||||||
res_loadMusic(_newMusicNum);
|
res_loadMusic(_newMusicNum);
|
||||||
_currentMusicNum = _newMusicNum;
|
_currentMusicNum = _newMusicNum;
|
||||||
|
@ -1795,7 +1799,7 @@ int ToucheEngine::handleActionMenuUnderCursor(const int16 *actions, int offs, in
|
||||||
_redrawScreenCounter1 = 2;
|
_redrawScreenCounter1 = 2;
|
||||||
Common::Rect rect(0, y, 640, y + h);
|
Common::Rect rect(0, y, 640, y + h);
|
||||||
i = -1;
|
i = -1;
|
||||||
while (_inp_mouseButtonPressed) {
|
while (_inp_rightMouseButtonPressed) {
|
||||||
if (rect.contains(_inp_mousePos)) {
|
if (rect.contains(_inp_mousePos)) {
|
||||||
int c = (_inp_mousePos.y - y) / 16;
|
int c = (_inp_mousePos.y - y) / 16;
|
||||||
if (c != i) {
|
if (c != i) {
|
||||||
|
@ -1829,12 +1833,12 @@ int ToucheEngine::handleActionMenuUnderCursor(const int16 *actions, int offs, in
|
||||||
case OSystem::EVENT_RBUTTONDOWN:
|
case OSystem::EVENT_RBUTTONDOWN:
|
||||||
_inp_mousePos.x = event.mouse.x;
|
_inp_mousePos.x = event.mouse.x;
|
||||||
_inp_mousePos.y = event.mouse.y;
|
_inp_mousePos.y = event.mouse.y;
|
||||||
_inp_mouseButtonPressed = true;
|
_inp_rightMouseButtonPressed = true;
|
||||||
break;
|
break;
|
||||||
case OSystem::EVENT_RBUTTONUP:
|
case OSystem::EVENT_RBUTTONUP:
|
||||||
_inp_mousePos.x = event.mouse.x;
|
_inp_mousePos.x = event.mouse.x;
|
||||||
_inp_mousePos.y = event.mouse.y;
|
_inp_mousePos.y = event.mouse.y;
|
||||||
_inp_mouseButtonPressed = false;
|
_inp_rightMouseButtonPressed = false;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -2005,24 +2009,24 @@ void ToucheEngine::initInventoryObjectsTable() {
|
||||||
void ToucheEngine::initInventoryLists() {
|
void ToucheEngine::initInventoryLists() {
|
||||||
memset(_inventoryList1, 0, sizeof(_inventoryList1));
|
memset(_inventoryList1, 0, sizeof(_inventoryList1));
|
||||||
_inventoryList1[100] = -1;
|
_inventoryList1[100] = -1;
|
||||||
_inventoryListPtrs[0] = _inventoryList1;
|
_inventoryStateTable[0].displayOffset = 0;
|
||||||
_inventoryListCount[3 * 0 + 0] = 0; // start offset
|
_inventoryStateTable[0].lastItem = 100;
|
||||||
_inventoryListCount[3 * 0 + 1] = 100; // max number of items
|
_inventoryStateTable[0].itemsPerLine = 6;
|
||||||
_inventoryListCount[3 * 0 + 2] = 6; // items per inventory line
|
_inventoryStateTable[0].itemsList = _inventoryList1;
|
||||||
|
|
||||||
memset(_inventoryList2, 0, sizeof(_inventoryList2));
|
memset(_inventoryList2, 0, sizeof(_inventoryList2));
|
||||||
_inventoryList2[100] = -1;
|
_inventoryList2[100] = -1;
|
||||||
_inventoryListPtrs[1] = _inventoryList2;
|
_inventoryStateTable[1].displayOffset = 0;
|
||||||
_inventoryListCount[3 * 1 + 0] = 0;
|
_inventoryStateTable[1].lastItem = 100;
|
||||||
_inventoryListCount[3 * 1 + 1] = 100;
|
_inventoryStateTable[1].itemsPerLine = 6;
|
||||||
_inventoryListCount[3 * 1 + 2] = 6;
|
_inventoryStateTable[1].itemsList = _inventoryList2;
|
||||||
|
|
||||||
memset(_inventoryList3, 0, sizeof(_inventoryList3));
|
memset(_inventoryList3, 0, sizeof(_inventoryList3));
|
||||||
_inventoryList3[6] = -1;
|
_inventoryList3[6] = -1;
|
||||||
_inventoryListPtrs[2] = _inventoryList3;
|
_inventoryStateTable[2].displayOffset = 0;
|
||||||
_inventoryListCount[3 * 2 + 0] = 0;
|
_inventoryStateTable[2].lastItem = 6;
|
||||||
_inventoryListCount[3 * 2 + 1] = 6;
|
_inventoryStateTable[2].itemsPerLine = 6;
|
||||||
_inventoryListCount[3 * 2 + 2] = 6;
|
_inventoryStateTable[2].itemsList = _inventoryList3;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ToucheEngine::setupInventoryAreas() {
|
void ToucheEngine::setupInventoryAreas() {
|
||||||
|
@ -2049,8 +2053,8 @@ void ToucheEngine::drawInventory(int index, int flag) {
|
||||||
if (_objectDescriptionNum == index && flag == 0) {
|
if (_objectDescriptionNum == index && flag == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_inventoryVar1 = _inventoryListPtrs[index];
|
_inventoryVar1 = _inventoryStateTable[index].itemsList;
|
||||||
_inventoryVar2 = &_inventoryListCount[index * 3];
|
_inventoryVar2 = &_inventoryStateTable[index].displayOffset;
|
||||||
_objectDescriptionNum = index;
|
_objectDescriptionNum = index;
|
||||||
uint8 *dst = _offscreenBuffer + 640 * 352;
|
uint8 *dst = _offscreenBuffer + 640 * 352;
|
||||||
res_loadSpriteImage(index + 12, dst);
|
res_loadSpriteImage(index + 12, dst);
|
||||||
|
@ -2088,7 +2092,7 @@ void ToucheEngine::drawAmountOfMoneyInInventory() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ToucheEngine::packInventoryItems(int index) {
|
void ToucheEngine::packInventoryItems(int index) {
|
||||||
int16 *p = _inventoryListPtrs[index];
|
int16 *p = _inventoryStateTable[index].itemsList;
|
||||||
for (int i = 0; *p != -1; ++i, ++p) {
|
for (int i = 0; *p != -1; ++i, ++p) {
|
||||||
if (p[0] == 0 && p[1] != -1) {
|
if (p[0] == 0 && p[1] != -1) {
|
||||||
p[0] = p[1];
|
p[0] = p[1];
|
||||||
|
@ -2098,8 +2102,8 @@ void ToucheEngine::packInventoryItems(int index) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ToucheEngine::appendItemToInventoryList(int index) {
|
void ToucheEngine::appendItemToInventoryList(int index) {
|
||||||
int last = _inventoryListCount[index * 3 + 1] - 1;
|
int last = _inventoryStateTable[index].lastItem - 1;
|
||||||
int16 *p = _inventoryListPtrs[index];
|
int16 *p = _inventoryStateTable[index].itemsList;
|
||||||
if (p[last] != 0) {
|
if (p[last] != 0) {
|
||||||
warning("Inventory %d Full", index);
|
warning("Inventory %d Full", index);
|
||||||
} else {
|
} else {
|
||||||
|
@ -2119,7 +2123,7 @@ void ToucheEngine::addItemToInventory(int inventory, int16 item) {
|
||||||
} else {
|
} else {
|
||||||
appendItemToInventoryList(inventory);
|
appendItemToInventoryList(inventory);
|
||||||
assert(inventory >= 0 && inventory < 3);
|
assert(inventory >= 0 && inventory < 3);
|
||||||
int16 *p = _inventoryListPtrs[inventory];
|
int16 *p = _inventoryStateTable[inventory].itemsList;
|
||||||
for (int i = 0; *p != -1; ++i, ++p) {
|
for (int i = 0; *p != -1; ++i, ++p) {
|
||||||
if (*p == 0) {
|
if (*p == 0) {
|
||||||
*p = item;
|
*p = item;
|
||||||
|
@ -2138,7 +2142,7 @@ void ToucheEngine::removeItemFromInventory(int inventory, int16 item) {
|
||||||
drawAmountOfMoneyInInventory();
|
drawAmountOfMoneyInInventory();
|
||||||
} else {
|
} else {
|
||||||
assert(inventory >= 0 && inventory < 3);
|
assert(inventory >= 0 && inventory < 3);
|
||||||
int16 *p = _inventoryListPtrs[inventory];
|
int16 *p = _inventoryStateTable[inventory].itemsList;
|
||||||
for (int i = 0; *p != -1; ++i, ++p) {
|
for (int i = 0; *p != -1; ++i, ++p) {
|
||||||
if (*p == item) {
|
if (*p == item) {
|
||||||
*p = 0;
|
*p = 0;
|
||||||
|
|
|
@ -197,6 +197,13 @@ struct SpriteData {
|
||||||
uint16 h;
|
uint16 h;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct InventoryState {
|
||||||
|
int16 displayOffset;
|
||||||
|
int16 lastItem;
|
||||||
|
int16 itemsPerLine;
|
||||||
|
int16 *itemsList;
|
||||||
|
};
|
||||||
|
|
||||||
struct ProgramPointData {
|
struct ProgramPointData {
|
||||||
int16 x, y, z;
|
int16 x, y, z;
|
||||||
int16 priority;
|
int16 priority;
|
||||||
|
@ -322,7 +329,8 @@ public:
|
||||||
NUM_ANIMATION_ENTRIES = 4,
|
NUM_ANIMATION_ENTRIES = 4,
|
||||||
NUM_INVENTORY_ITEMS = 100,
|
NUM_INVENTORY_ITEMS = 100,
|
||||||
NUM_DIRTY_RECTS = 50,
|
NUM_DIRTY_RECTS = 50,
|
||||||
NUM_GAMESTATE_FILES = 100
|
NUM_GAMESTATE_FILES = 100,
|
||||||
|
NUM_DIRECTIONS = 135
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef void (ToucheEngine::*OpcodeProc)();
|
typedef void (ToucheEngine::*OpcodeProc)();
|
||||||
|
@ -382,11 +390,11 @@ protected:
|
||||||
void drawHitBoxes();
|
void drawHitBoxes();
|
||||||
void setCursor(int num);
|
void setCursor(int num);
|
||||||
void updateCursor(int num);
|
void updateCursor(int num);
|
||||||
void handleMouseButtonClicked();
|
void handleLeftMouseButtonClickOnInventory();
|
||||||
void handleMouseButtonPressed();
|
void handleRightMouseButtonClickOnInventory();
|
||||||
void handleMouseInput(int flag);
|
void handleMouseInput(int flag);
|
||||||
void handleMouseInputRoomArea(int flag);
|
void handleMouseClickOnRoom(int flag);
|
||||||
void handleMouseInputInventoryArea(int flag);
|
void handleMouseClickOnInventory(int flag);
|
||||||
void scrollScreenToPos(int num);
|
void scrollScreenToPos(int num);
|
||||||
void clearRoomArea();
|
void clearRoomArea();
|
||||||
void startNewMusic();
|
void startNewMusic();
|
||||||
|
@ -462,7 +470,7 @@ protected:
|
||||||
void saveGameStateData(Common::WriteStream *stream);
|
void saveGameStateData(Common::WriteStream *stream);
|
||||||
void loadGameStateData(Common::ReadStream *stream);
|
void loadGameStateData(Common::ReadStream *stream);
|
||||||
bool saveGameState(int num, const char *description);
|
bool saveGameState(int num, const char *description);
|
||||||
bool loadGameState(int num, const char *description);
|
bool loadGameState(int num);
|
||||||
void readGameStateDescription(int num, char *description, int len);
|
void readGameStateDescription(int num, char *description, int len);
|
||||||
void generateGameStateFileName(int num, char *dst, int len, bool prefixOnly = false) const;
|
void generateGameStateFileName(int num, char *dst, int len, bool prefixOnly = false) const;
|
||||||
|
|
||||||
|
@ -570,6 +578,7 @@ protected:
|
||||||
void res_loadImage(int num, uint8 *dst);
|
void res_loadImage(int num, uint8 *dst);
|
||||||
void res_loadImageHelper(uint8 *imgData, int imgWidth, int imgHeight);
|
void res_loadImageHelper(uint8 *imgData, int imgWidth, int imgHeight);
|
||||||
void res_loadSound(int flag, int num);
|
void res_loadSound(int flag, int num);
|
||||||
|
void res_stopSound();
|
||||||
void res_loadMusic(int num);
|
void res_loadMusic(int num);
|
||||||
void res_loadSpeech(int num);
|
void res_loadSpeech(int num);
|
||||||
void res_loadSpeechSegment(int num);
|
void res_loadSpeechSegment(int num);
|
||||||
|
@ -604,8 +613,8 @@ protected:
|
||||||
Common::RandomSource _rnd;
|
Common::RandomSource _rnd;
|
||||||
|
|
||||||
Common::Point _inp_mousePos;
|
Common::Point _inp_mousePos;
|
||||||
bool _inp_mouseButtonClicked;
|
bool _inp_leftMouseButtonPressed;
|
||||||
bool _inp_mouseButtonPressed;
|
bool _inp_rightMouseButtonPressed;
|
||||||
int _disabledInputCounter;
|
int _disabledInputCounter;
|
||||||
bool _hideInventoryTexts;
|
bool _hideInventoryTexts;
|
||||||
|
|
||||||
|
@ -629,8 +638,7 @@ protected:
|
||||||
int16 _inventoryList1[101];
|
int16 _inventoryList1[101];
|
||||||
int16 _inventoryList2[101];
|
int16 _inventoryList2[101];
|
||||||
int16 _inventoryList3[7];
|
int16 _inventoryList3[7];
|
||||||
int16 *_inventoryListPtrs[3];
|
InventoryState _inventoryStateTable[3];
|
||||||
int16 _inventoryListCount[9];
|
|
||||||
int16 _inventoryItemsInfoTable[NUM_INVENTORY_ITEMS];
|
int16 _inventoryItemsInfoTable[NUM_INVENTORY_ITEMS];
|
||||||
int16 *_inventoryVar1;
|
int16 *_inventoryVar1;
|
||||||
int16 *_inventoryVar2;
|
int16 *_inventoryVar2;
|
||||||
|
@ -690,6 +698,7 @@ protected:
|
||||||
int16 _spriteScalingTable[1000];
|
int16 _spriteScalingTable[1000];
|
||||||
|
|
||||||
bool _fastWalkMode;
|
bool _fastWalkMode;
|
||||||
|
bool _fastMode;
|
||||||
|
|
||||||
AnimationEntry _animationTable[NUM_ANIMATION_ENTRIES];
|
AnimationEntry _animationTable[NUM_ANIMATION_ENTRIES];
|
||||||
|
|
||||||
|
@ -741,7 +750,7 @@ protected:
|
||||||
uint8 _paletteBuffer[256 * 4];
|
uint8 _paletteBuffer[256 * 4];
|
||||||
|
|
||||||
static SpriteData _spritesTable[NUM_SPRITES];
|
static SpriteData _spritesTable[NUM_SPRITES];
|
||||||
static const uint8 _directionsTable[];
|
static const uint8 _directionsTable[NUM_DIRECTIONS];
|
||||||
static char _saveLoadDescriptionsTable[10][33];
|
static char _saveLoadDescriptionsTable[10][33];
|
||||||
|
|
||||||
void setupUIRect();
|
void setupUIRect();
|
||||||
|
|
|
@ -108,7 +108,7 @@ bool ToucheEngine::ui_processEvents() {
|
||||||
case OSystem::EVENT_LBUTTONDOWN:
|
case OSystem::EVENT_LBUTTONDOWN:
|
||||||
_inp_mousePos.x = event.mouse.x;
|
_inp_mousePos.x = event.mouse.x;
|
||||||
_inp_mousePos.y = event.mouse.y;
|
_inp_mousePos.y = event.mouse.y;
|
||||||
_inp_mouseButtonClicked = true;
|
_inp_leftMouseButtonPressed = true;
|
||||||
break;
|
break;
|
||||||
case OSystem::EVENT_LBUTTONUP:
|
case OSystem::EVENT_LBUTTONUP:
|
||||||
_inp_mousePos.x = event.mouse.x;
|
_inp_mousePos.x = event.mouse.x;
|
||||||
|
@ -288,7 +288,7 @@ int ToucheEngine::ui_handleSaveLoad(SaveLoadMode mode) {
|
||||||
int button = -1;
|
int button = -1;
|
||||||
while (button == -1 && !quitMenu) {
|
while (button == -1 && !quitMenu) {
|
||||||
button = ui_getButtonPressed(buttonsRectTable1, 15);
|
button = ui_getButtonPressed(buttonsRectTable1, 15);
|
||||||
if (!_inp_mouseButtonClicked) {
|
if (!_inp_leftMouseButtonPressed) {
|
||||||
button = -1;
|
button = -1;
|
||||||
}
|
}
|
||||||
if (mode == kSaveGameState) {
|
if (mode == kSaveGameState) {
|
||||||
|
@ -300,7 +300,7 @@ int ToucheEngine::ui_handleSaveLoad(SaveLoadMode mode) {
|
||||||
}
|
}
|
||||||
quitMenu = ui_processEvents();
|
quitMenu = ui_processEvents();
|
||||||
}
|
}
|
||||||
_inp_mouseButtonClicked = false;
|
_inp_leftMouseButtonPressed = false;
|
||||||
switch (button) {
|
switch (button) {
|
||||||
case 10:
|
case 10:
|
||||||
_saveLoadCurrentPage -= 10;
|
_saveLoadCurrentPage -= 10;
|
||||||
|
@ -320,7 +320,7 @@ int ToucheEngine::ui_handleSaveLoad(SaveLoadMode mode) {
|
||||||
ret = 2;
|
ret = 2;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (loadGameState(_saveLoadCurrentSlot, _saveLoadDescriptionsTable[_saveLoadCurrentSlot % 10])) {
|
if (loadGameState(_saveLoadCurrentSlot)) {
|
||||||
ret = 2;
|
ret = 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -353,7 +353,7 @@ void ToucheEngine::ui_handleOptions(int forceDisplay) {
|
||||||
ui_drawOptionsMenu();
|
ui_drawOptionsMenu();
|
||||||
int button = -1;
|
int button = -1;
|
||||||
while (button == -1 && !quitMenu) {
|
while (button == -1 && !quitMenu) {
|
||||||
if (_inp_mouseButtonClicked) {
|
if (_inp_leftMouseButtonPressed) {
|
||||||
button = ui_getButtonPressed(buttonsRectTable1, 15);
|
button = ui_getButtonPressed(buttonsRectTable1, 15);
|
||||||
if (button < 10) {
|
if (button < 10) {
|
||||||
button = ui_getButtonPressed(buttonsRectTable2, 10) + 20;
|
button = ui_getButtonPressed(buttonsRectTable2, 10) + 20;
|
||||||
|
@ -361,7 +361,7 @@ void ToucheEngine::ui_handleOptions(int forceDisplay) {
|
||||||
}
|
}
|
||||||
quitMenu = ui_processEvents();
|
quitMenu = ui_processEvents();
|
||||||
}
|
}
|
||||||
_inp_mouseButtonClicked = false;
|
_inp_leftMouseButtonPressed = false;
|
||||||
switch (button) {
|
switch (button) {
|
||||||
case 10:
|
case 10:
|
||||||
if (ui_handleSaveLoad(kLoadGameState) == 2) {
|
if (ui_handleSaveLoad(kLoadGameState) == 2) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue