diff options
| author | Jordi Vilalta Prat | 2008-01-27 19:47:41 +0000 |
|---|---|---|
| committer | Jordi Vilalta Prat | 2008-01-27 19:47:41 +0000 |
| commit | 66e9d4f5e8f35b28f8abd9ce53a0da4da3ce8985 (patch) | |
| tree | e27aadabecd8dd910884280e6559ff9c94c3d73c /engines/lure | |
| parent | 278857698dc7b1623096fe1ad12511dc4c886c7e (diff) | |
| download | scummvm-rg350-66e9d4f5e8f35b28f8abd9ce53a0da4da3ce8985.tar.gz scummvm-rg350-66e9d4f5e8f35b28f8abd9ce53a0da4da3ce8985.tar.bz2 scummvm-rg350-66e9d4f5e8f35b28f8abd9ce53a0da4da3ce8985.zip | |
Removed trailing spaces.
svn-id: r30664
Diffstat (limited to 'engines/lure')
29 files changed, 684 insertions, 684 deletions
diff --git a/engines/lure/animseq.cpp b/engines/lure/animseq.cpp index aaba884a62..2af02b0374 100644 --- a/engines/lure/animseq.cpp +++ b/engines/lure/animseq.cpp @@ -48,7 +48,7 @@ AnimAbortType AnimationSequence::delay(uint32 milliseconds) { else return ABORT_NEXT_SCENE; } else if (events.type() == Common::EVENT_LBUTTONDOWN) return ABORT_NEXT_SCENE; - else if (events.type() == Common::EVENT_QUIT) + else if (events.type() == Common::EVENT_QUIT) return ABORT_END_INTRO; } @@ -64,7 +64,7 @@ AnimAbortType AnimationSequence::delay(uint32 milliseconds) { void AnimationSequence::egaDecodeFrame(byte *&pPixels) { Screen &screen = Screen::getReference(); - byte *screenData = screen.screen_raw(); + byte *screenData = screen.screen_raw(); // Skip over the list of blocks that are changed int numBlocks = *pPixels++; @@ -72,7 +72,7 @@ void AnimationSequence::egaDecodeFrame(byte *&pPixels) { // Loop through the list of same/changed pixel ranges int len = *pPixels++; - int offset = MENUBAR_Y_SIZE * FULL_SCREEN_WIDTH * + int offset = MENUBAR_Y_SIZE * FULL_SCREEN_WIDTH * EGA_NUM_LAYERS / EGA_PIXELS_PER_BYTE; while ((offset += len) < FULL_SCREEN_WIDTH * FULL_SCREEN_HEIGHT / 2) { @@ -80,7 +80,7 @@ void AnimationSequence::egaDecodeFrame(byte *&pPixels) { if (repeatLen > 0) { byte *pDest = screenData + (offset / EGA_NUM_LAYERS) * EGA_PIXELS_PER_BYTE; - // Copy over the following bytes - each four bytes contain the four + // Copy over the following bytes - each four bytes contain the four // planes worth of data for 8 sequential pixels while (repeatLen-- > 0) { int planeNum = offset % EGA_NUM_LAYERS; @@ -107,7 +107,7 @@ void AnimationSequence::egaDecodeFrame(byte *&pPixels) { void AnimationSequence::vgaDecodeFrame(byte *&pPixels, byte *&pLines) { Screen &screen = Screen::getReference(); - byte *screenData = screen.screen_raw(); + byte *screenData = screen.screen_raw(); uint16 screenPos = 0; uint16 len; @@ -118,7 +118,7 @@ void AnimationSequence::vgaDecodeFrame(byte *&pPixels, byte *&pLines) { len = READ_LE_UINT16(pLines); pLines += 2; } - + // Move the splice over memcpy(screenData, pPixels, len); screenData += len; @@ -137,14 +137,14 @@ void AnimationSequence::vgaDecodeFrame(byte *&pPixels, byte *&pLines) { } } -AnimationSequence::AnimationSequence(uint16 screenId, Palette &palette, bool fadeIn, int frameDelay, - const AnimSoundSequence *soundList): _screenId(screenId), _palette(palette), +AnimationSequence::AnimationSequence(uint16 screenId, Palette &palette, bool fadeIn, int frameDelay, + const AnimSoundSequence *soundList): _screenId(screenId), _palette(palette), _frameDelay(frameDelay), _soundList(soundList) { Screen &screen = Screen::getReference(); PictureDecoder decoder; Disk &d = Disk::getReference(); - // Get the data and decode it. Note that VGA decompression is used + // Get the data and decode it. Note that VGA decompression is used // even if the decompressed contents is actually EGA data MemoryBlock *data = d.getEntry(_screenId); _decodedData = decoder.vgaDecode(data, MAX_ANIM_DECODER_BUFFER_SIZE); @@ -158,14 +158,14 @@ AnimationSequence::AnimationSequence(uint16 screenId, Palette &palette, bool fa // Reset the palette and clear the screen for EGA decoding screen.setPaletteEmpty(RES_PALETTE_ENTRIES); screen.screen().empty(); - + // Load the screen - each four bytes contain the four planes // worth of data for 8 sequential pixels byte *pSrc = _decodedData->data(); byte *pDest = screen.screen().data().data() + (FULL_SCREEN_WIDTH * MENUBAR_Y_SIZE); - for (int ctr = 0; ctr < FULL_SCREEN_WIDTH * (FULL_SCREEN_HEIGHT - + for (int ctr = 0; ctr < FULL_SCREEN_WIDTH * (FULL_SCREEN_HEIGHT - MENUBAR_Y_SIZE) / 8; ++ctr, pDest += EGA_PIXELS_PER_BYTE) { for (int planeCtr = 0; planeCtr < EGA_NUM_LAYERS; ++planeCtr, ++pSrc) { byte v = *pSrc; @@ -225,10 +225,10 @@ AnimAbortType AnimationSequence::show() { while (_pPixels < _pPixelsEnd) { if ((soundFrame != NULL) && (frameCtr == 0)) Sound.musicInterface_Play( - Sound.isRoland() ? soundFrame->rolandSoundId : soundFrame->adlibSoundId, + Sound.isRoland() ? soundFrame->rolandSoundId : soundFrame->adlibSoundId, soundFrame->channelNum); - if (_isEGA) + if (_isEGA) egaDecodeFrame(_pPixels); else { if (_pLines >= _pLinesEnd) break; @@ -254,8 +254,8 @@ AnimAbortType AnimationSequence::show() { bool AnimationSequence::step() { Screen &screen = Screen::getReference(); if (_pPixels >= _pPixelsEnd) return false; - - if (_isEGA) + + if (_isEGA) egaDecodeFrame(_pPixels); else { if (_pLines >= _pLinesEnd) return false; diff --git a/engines/lure/animseq.h b/engines/lure/animseq.h index a4e8034f5c..3609837dba 100644 --- a/engines/lure/animseq.h +++ b/engines/lure/animseq.h @@ -55,7 +55,7 @@ private: void egaDecodeFrame(byte *&pPixels); void vgaDecodeFrame(byte *&pPixels, byte *&pLines); public: - AnimationSequence(uint16 screenId, Palette &palette, bool fadeIn, int frameDelay = 7, + AnimationSequence(uint16 screenId, Palette &palette, bool fadeIn, int frameDelay = 7, const AnimSoundSequence *soundList = NULL); ~AnimationSequence(); diff --git a/engines/lure/debugger.cpp b/engines/lure/debugger.cpp index 63955003a4..e5d1995861 100644 --- a/engines/lure/debugger.cpp +++ b/engines/lure/debugger.cpp @@ -557,13 +557,13 @@ bool Debugger::cmd_saveStrings(int argc, const char **argv) { strings.getString(id, buffer, NULL, NULL); DebugPrintf("%s\n", buffer); -/* Commented out code for saving all text strings - note that 0x1000 is chosen +/* Commented out code for saving all text strings - note that 0x1000 is chosen * arbitrarily, so there'll be a bunch of garbage at the end, or the game will crash - // Save all the strings to a text file - this + // Save all the strings to a text file - this FILE *f = fopen("strings.txt", "w"); - + for (int index = 0; index < 0x1000; ++index) { strings.getString(index, buffer); fprintf(f, "%.4xh - %s\n", index, buffer); diff --git a/engines/lure/decode.cpp b/engines/lure/decode.cpp index 53a5157c7a..26eec5ba6d 100644 --- a/engines/lure/decode.cpp +++ b/engines/lure/decode.cpp @@ -38,13 +38,13 @@ namespace Lure { /*--------------------------------------------------------------------------*/ void PictureDecoder::writeByte(MemoryBlock *dest, byte v) { - if (outputOffset == dest->size()) + if (outputOffset == dest->size()) error("Decoded data exceeded allocated output buffer size"); dest->data()[outputOffset++] = v; } void PictureDecoder::writeBytes(MemoryBlock *dest, byte v, uint16 numBytes) { - if (outputOffset + numBytes > dest->size()) + if (outputOffset + numBytes > dest->size()) error("Decoded data exceeded allocated output buffer size"); dest->setBytes(v, outputOffset, numBytes); outputOffset += numBytes; @@ -110,7 +110,7 @@ MemoryBlock *PictureDecoder::egaDecode(MemoryBlock *src, uint32 maxOutputSize) { uint16 dx = READ_BE_UINT16(src->data() + dataPos); dataPos += sizeof(uint16); int bitCtr = 8; - + // Decode the colour popularity table for (int nibbleCtr = 0; nibbleCtr < 32; ++nibbleCtr) { @@ -180,7 +180,7 @@ MemoryBlock *PictureDecoder::egaDecode(MemoryBlock *src, uint32 maxOutputSize) { writeBytes(dest, tableOffset, dx >> 11); READ_BITS(5); continue; - + } else { // It's a new colour v = al; @@ -308,15 +308,15 @@ void AnimationDecoder::rcl(uint16 &value, bool &carry) { #define SET_HI_BYTE(x,v) x = (x & 0xff) | ((v) << 8); #define SET_LO_BYTE(x,v) x = (x & 0xff00) | (v); -void AnimationDecoder::decode_data_2(MemoryBlock *src, byte *&pSrc, uint16 &currData, +void AnimationDecoder::decode_data_2(MemoryBlock *src, byte *&pSrc, uint16 &currData, uint16 &bitCtr, uint16 &dx, bool &carry) { SET_HI_BYTE(dx, currData >> 8); - + for (int v = 0; v < 8; ++v) { rcl(currData, carry); if (--bitCtr == 0) { uint32 offset = (uint32) (pSrc - src->data()); - if (offset >= src->size()) + if (offset >= src->size()) // Beyond end of source, so read in a 0 value currData &= 0xff00; else @@ -346,7 +346,7 @@ uint32 AnimationDecoder::decode_data(MemoryBlock *src, MemoryBlock *dest, uint32 currData = *pSrc++; *(pDest + 0x30) = currData & 0xf; *(pDest + 0x20) = (currData >> 4) & 0xf; - } + } pDest = (byte *) (dest->data() + 0x40); currData = READ_BE_UINT16(pSrc); @@ -424,14 +424,14 @@ loc_1441: tempReg1 = bitCtr; tempReg2 = dx; decode_data_2(src, pSrc, currData, bitCtr, dx, carry); - + SET_LO_BYTE(dx, dx >> 8); decode_data_2(src, pSrc, currData, bitCtr, dx, carry); SET_HI_BYTE(bitCtr, dx & 0xff); SET_LO_BYTE(bitCtr, dx >> 8); dx = tempReg2; - if (bitCtr == 0) + if (bitCtr == 0) // Exit out of infinite loop break; @@ -453,7 +453,7 @@ loc_1441: tempReg1 = bitCtr; bitCtr = dx >> 8; - + } else if (dxHigh == BX_VAL(0x30)) { SET_HI_BYTE(dx, currData >> 11); diff --git a/engines/lure/decode.h b/engines/lure/decode.h index c127d95dbd..9cc594df64 100644 --- a/engines/lure/decode.h +++ b/engines/lure/decode.h @@ -58,7 +58,7 @@ class AnimationDecoder { public: static void rcl(uint16 &value, bool &carry); static uint32 decode_data(MemoryBlock *src, MemoryBlock *dest, uint32 srcPos); - static void decode_data_2(MemoryBlock *src, byte *&pSrc, uint16 &currData, + static void decode_data_2(MemoryBlock *src, byte *&pSrc, uint16 &currData, uint16 &bitCtr, uint16 &dx, bool &carry); }; diff --git a/engines/lure/fights.cpp b/engines/lure/fights.cpp index 9b28c0e0b8..dcf09ba50d 100644 --- a/engines/lure/fights.cpp +++ b/engines/lure/fights.cpp @@ -47,7 +47,7 @@ FightsManager::FightsManager() { reset(); } -FightsManager::~FightsManager() { +FightsManager::~FightsManager() { if (_fightData != NULL) // Release the fight data delete _fightData; @@ -131,7 +131,7 @@ void FightsManager::fightLoop() { if (game.debugger().isAttached()) game.debugger().onFrame(); - g_system->delayMillis(10); + g_system->delayMillis(10); } } @@ -169,7 +169,7 @@ void FightsManager::reset() { _fighterList[2] = initialFighterList[2]; } -const CursorType moveList[] = {CURSOR_LEFT_ARROW, CURSOR_FIGHT_UPPER, +const CursorType moveList[] = {CURSOR_LEFT_ARROW, CURSOR_FIGHT_UPPER, CURSOR_FIGHT_MIDDLE, CURSOR_FIGHT_LOWER, CURSOR_RIGHT_ARROW}; struct KeyMapping { @@ -178,9 +178,9 @@ struct KeyMapping { }; const KeyMapping keyList[] = { - {Common::KEYCODE_LEFT, 10}, {Common::KEYCODE_RIGHT, 14}, - {Common::KEYCODE_KP7, 11}, {Common::KEYCODE_KP4, 12}, {Common::KEYCODE_KP1, 13}, - {Common::KEYCODE_KP9, 6}, {Common::KEYCODE_KP6, 7}, {Common::KEYCODE_KP3, 8}, + {Common::KEYCODE_LEFT, 10}, {Common::KEYCODE_RIGHT, 14}, + {Common::KEYCODE_KP7, 11}, {Common::KEYCODE_KP4, 12}, {Common::KEYCODE_KP1, 13}, + {Common::KEYCODE_KP9, 6}, {Common::KEYCODE_KP6, 7}, {Common::KEYCODE_KP3, 8}, {Common::KEYCODE_INVALID, 0}}; void FightsManager::checkEvents() { @@ -224,7 +224,7 @@ void FightsManager::checkEvents() { } else if (events.type() == Common::EVENT_MOUSEMOVE) { Point mPos = events.event().mouse; - if (mPos.x < rec.fwtrue_x - 12) + if (mPos.x < rec.fwtrue_x - 12) mouse.setCursorNum(CURSOR_LEFT_ARROW); else if (mPos.x > rec.fwtrue_x + player->width()) mouse.setCursorNum(CURSOR_RIGHT_ARROW); @@ -232,9 +232,9 @@ void FightsManager::checkEvents() { mouse.setCursorNum(CURSOR_FIGHT_UPPER); else if (mPos.y < player->y() + 38) mouse.setCursorNum(CURSOR_FIGHT_MIDDLE); - else + else mouse.setCursorNum(CURSOR_FIGHT_LOWER); - + } else if ((events.type() == Common::EVENT_LBUTTONDOWN) || (events.type() == Common::EVENT_RBUTTONDOWN) || (events.type() == Common::EVENT_LBUTTONUP) || @@ -261,11 +261,11 @@ void FightsManager::checkEvents() { rec.fwmove_number = moveNumber; - if (_keyDown == KS_KEYDOWN_1) + if (_keyDown == KS_KEYDOWN_1) _keyDown = KS_KEYDOWN_2; if (rec.fwmove_number >= 5) - debugC(ERROR_INTERMEDIATE, kLureDebugFights, + debugC(ERROR_INTERMEDIATE, kLureDebugFights, "Player fight move number=%d", rec.fwmove_number); } @@ -293,14 +293,14 @@ void FightsManager::fighterAnimHandler(Hotspot &h) { offset += 4; v = getWord(offset); } - + if (v == 0) { // No sequence match found seqNum = getFighterMove(fighter, fighter.fwattack_table); } else { v = getWord(offset + 2); seqNum = getFighterMove(fighter, fighter.fwdefend_table); - + if (seqNum == 0) seqNum = getFighterMove(fighter, fighter.fwattack_table); else if (seqNum == 0xff) @@ -331,11 +331,11 @@ void FightsManager::fightHandler(Hotspot &h, uint16 moveOffset) { // Player is doing nothing, so check the move number moveOffset = getWord(FIGHT_PLAYER_MOVE_TABLE + (fighter.fwmove_number << 1)); - debugC(ERROR_DETAILED, kLureDebugFights, - "Hotspot %xh fight move=%d, new offset=%xh", + debugC(ERROR_DETAILED, kLureDebugFights, + "Hotspot %xh fight move=%d, new offset=%xh", h.hotspotId(), fighter.fwmove_number, moveOffset); - if (moveOffset == 0) + if (moveOffset == 0) return; fighter.fwseq_no = fighter.fwmove_number; @@ -343,15 +343,15 @@ void FightsManager::fightHandler(Hotspot &h, uint16 moveOffset) { } uint16 moveValue = getWord(moveOffset); - debugC(ERROR_DETAILED, kLureDebugFights, - "Hotspot %xh script offset=%xh value=%xh", + debugC(ERROR_DETAILED, kLureDebugFights, + "Hotspot %xh script offset=%xh value=%xh", h.hotspotId(), moveOffset, moveValue); moveOffset += sizeof(uint16); if ((moveValue & 0x8000) == 0) { // Set frame to specified number h.setFrameNumber(moveValue); - + // Set the new fighter position int16 newX, newY; newX = h.x() + (int16)getWord(moveOffset); @@ -363,7 +363,7 @@ void FightsManager::fightHandler(Hotspot &h, uint16 moveOffset) { if (fighter.fwweapon != 0) { Hotspot *weaponHotspot = res.getActiveHotspot(fighter.fwweapon); assert(weaponHotspot); - + uint16 newFrameNumber = getWord(moveOffset + 4); int16 xChange = (int16)getWord(moveOffset + 6); int16 yChange = (int16)getWord(moveOffset + 8); @@ -408,7 +408,7 @@ void FightsManager::fightHandler(Hotspot &h, uint16 moveOffset) { moveOffset = 0; } break; - + case 0xFFF9: // Walk right if ((fighter.fwmove_number == 9) || (fighter.fwmove_number == 14)) { @@ -419,8 +419,8 @@ void FightsManager::fightHandler(Hotspot &h, uint16 moveOffset) { h.setPosition(h.x() + 4, h.y()); fighter.fwtrue_x = h.x(); fighter.fwtrue_y = h.y(); - - fighter.fwwalk_roll = (fighter.fwwalk_roll == 0) ? 7 : + + fighter.fwwalk_roll = (fighter.fwwalk_roll == 0) ? 7 : fighter.fwwalk_roll - 1; fighter.fwseq_ad = moveOffset; h.setFrameNumber(fighter.fwwalk_roll); @@ -450,7 +450,7 @@ void FightsManager::fightHandler(Hotspot &h, uint16 moveOffset) { fighter.fwseq_ad = moveOffset; } return; - + case 0xFFFB: // End of sequence breakFlag = true; @@ -463,10 +463,10 @@ void FightsManager::fightHandler(Hotspot &h, uint16 moveOffset) { case 0xFFFF: case 0xFFFE: - if (moveValue == 0xffff) + if (moveValue == 0xffff) // Set the animation record h.setAnimation(getWord(moveOffset)); - else + else // New set animation record h.setAnimation(getWord(fighter.fwheader_list + (getWord(moveOffset) << 1))); h.setFrameNumber(0); @@ -480,7 +480,7 @@ void FightsManager::fightHandler(Hotspot &h, uint16 moveOffset) { else moveOffset += 2 * sizeof(uint16); break; - + case 0xFFF6: // Not hold if (getWord(moveOffset) == fighter.fwmove_number) @@ -488,7 +488,7 @@ void FightsManager::fightHandler(Hotspot &h, uint16 moveOffset) { else moveOffset = getWord(moveOffset + 2); break; - + case 0xFFF4: // End sequence fighter.fwseq_no = 0; @@ -525,7 +525,7 @@ void FightsManager::fightHandler(Hotspot &h, uint16 moveOffset) { opponent.fwseq_ad = v1; if (++opponent.fwhit_value != opponent.fwhit_rate) { opponent.fwhit_value = 0; - if (++opponent.fwhits == 5) + if (++opponent.fwhits == 5) opponent.fwseq_ad = opponent.fwdie_seq; } } @@ -589,7 +589,7 @@ uint16 FightsManager::fetchFighterDistance(FighterRecord &f1, FighterRecord &f2) void FightsManager::enemyKilled() { Resources &res = Resources::getReference(); - Hotspot *playerHotspot = res.getActiveHotspot(PLAYER_ID); + Hotspot *playerHotspot = res.getActiveHotspot(PLAYER_ID); FighterRecord &playerRec = getDetails(PLAYER_ID); playerHotspot->setTickProc(PLAYER_TICK_PROC_ID); @@ -601,7 +601,7 @@ void FightsManager::enemyKilled() { playerHotspot->setAnimationIndex(PLAYER_ANIM_INDEX); playerHotspot->setPosition(playerHotspot->x(), playerHotspot->y() + 5); playerHotspot->setDirection(LEFT); - + if (playerHotspot->roomNumber() == 6) { Dialog::show(0xc9f); HotspotData *axeHotspot = res.getHotspot(0x2738); @@ -610,7 +610,7 @@ void FightsManager::enemyKilled() { // Prevent the weapon animation being drawn axeHotspot = res.getHotspot(0x440); - axeHotspot->layer = 0; + axeHotspot->layer = 0; } } diff --git a/engines/lure/game.cpp b/engines/lure/game.cpp index 5d5407886c..dfdcbfe956 100644 --- a/engines/lure/game.cpp +++ b/engines/lure/game.cpp @@ -63,7 +63,7 @@ Game::~Game() { void Game::tick() { // Call the tick method for each hotspot - this is somewaht complicated // by the fact that a tick proc can unload both itself and/or others, - // so we first get a list of the Ids, and call the tick proc for each + // so we first get a list of the Ids, and call the tick proc for each // id in sequence if it's still active Resources &res = Resources::getReference(); ValueTableData &fields = res.fieldList(); @@ -74,7 +74,7 @@ void Game::tick() { for (i = res.activeHotspots().begin(); i != res.activeHotspots().end(); ++i) { Hotspot *hotspot = *i; - if (!_preloadFlag || ((hotspot->layer() != 0xff) && + if (!_preloadFlag || ((hotspot->layer() != 0xff) && (hotspot->hotspotId() < FIRST_NONCHARACTER_ID))) // Add hotspot to list to execute idList[idSize++] = hotspot->hotspotId(); @@ -100,7 +100,7 @@ void Game::tickCheck() { _state |= GS_TICK; if ((room.roomNumber() == ROOMNUM_VILLAGE_SHOP) && !remoteFlag && ((_state & GS_TICK) != 0)) { - // In the village shop, + // In the village shop, bool tockFlag = (_state & GS_TOCK) != 0; Sound.addSound(tockFlag ? 16 : 50); @@ -112,7 +112,7 @@ void Game::nextFrame() { Resources &res = Resources::getReference(); Room &room = Room::getReference(); - if (Fights.isFighting()) + if (Fights.isFighting()) Fights.fightLoop(); res.pausedList().countdown(); @@ -139,11 +139,11 @@ void Game::execute() { screen.setPaletteEmpty(); // Flag for starting game - setState(GS_RESTART); + setState(GS_RESTART); bool initialRestart = true; while (!events.quitFlag) { - + if ((_state & GS_RESTART) != 0) { res.reset(); Fights.reset(); @@ -208,8 +208,8 @@ void Game::execute() { case Common::KEYCODE_KP_PLUS: if (_debugFlag) { - while (++roomNum <= 51) - if (res.getRoom(roomNum) != NULL) break; + while (++roomNum <= 51) + if (res.getRoom(roomNum) != NULL) break; if (roomNum == 52) roomNum = 1; room.setRoomNumber(roomNum); } @@ -224,14 +224,14 @@ void Game::execute() { break; case Common::KEYCODE_KP_MULTIPLY: - if (_debugFlag) + if (_debugFlag) res.getActiveHotspot(PLAYER_ID)->setRoomNumber( room.roomNumber()); break; case Common::KEYCODE_KP_DIVIDE: case Common::KEYCODE_SLASH: - if (_debugFlag) + if (_debugFlag) room.setShowInfo(!room.showInfo()); break; @@ -247,7 +247,7 @@ void Game::execute() { } if ((events.type() == Common::EVENT_LBUTTONDOWN) || - (events.type() == Common::EVENT_RBUTTONDOWN)) + (events.type() == Common::EVENT_RBUTTONDOWN)) handleClick(); } @@ -287,7 +287,7 @@ void Game::execute() { // If the Restart/Restore dialog is needed, show it if ((_state & GS_RESTORE) != 0) { - // Show the Restore/Restart dialog + // Show the Restore/Restart dialog bool restartFlag = RestartRestoreDialog::show(); if (restartFlag) @@ -307,7 +307,7 @@ void Game::handleMenuResponse(uint8 selection) { doShowCredits(); break; - case MENUITEM_RESTART_GAME: + case MENUITEM_RESTART_GAME: doRestart(); break; @@ -315,7 +315,7 @@ void Game::handleMenuResponse(uint8 selection) { SaveRestoreDialog::show(true); break; - case MENUITEM_RESTORE_GAME: + case MENUITEM_RESTORE_GAME: SaveRestoreDialog::show(false); break; @@ -355,7 +355,7 @@ void Game::playerChangeRoom() { displayChuteAnimation(); else if (animFlag != 0) displayBarrelAnimation(); - + fields.setField(ROOM_EXIT_ANIMATION, 0); roomData->exitTime = g_system->getMillis(); @@ -373,7 +373,7 @@ void Game::playerChangeRoom() { if (v != 0) { --v; fields.setField(29, v); - if (v == 0) + if (v == 0) res.delayList().add(2, 0xCB7, false); } } @@ -395,12 +395,12 @@ void Game::displayChuteAnimation() { AnimationSequence *anim = new AnimationSequence(CHUTE_ANIM_ID, palette, false); anim->show(); delete anim; - - anim = new AnimationSequence(CHUTE2_ANIM_ID, palette, false); + + anim = new AnimationSequence(CHUTE2_ANIM_ID, palette, false); anim->show(); delete anim; - anim = new AnimationSequence(CHUTE3_ANIM_ID, palette, false); + anim = new AnimationSequence(CHUTE3_ANIM_ID, palette, false); anim->show(); delete anim; @@ -442,7 +442,7 @@ void Game::handleClick() { // Viewing a room remotely - handle returning to prior room if ((room.roomNumber() != 35) || (fields.getField(87) == 0)) { // Reset player tick proc and signal to change back to the old room - res.getActiveHotspot(PLAYER_ID)->setTickProc(PLAYER_TICK_PROC_ID); + res.getActiveHotspot(PLAYER_ID)->setTickProc(PLAYER_TICK_PROC_ID); fields.setField(NEW_ROOM_NUMBER, oldRoomNumber); fields.setField(OLD_ROOM_NUMBER, 0); } @@ -454,7 +454,7 @@ void Game::handleClick() { if (response != MENUITEM_NONE) handleMenuResponse(response); } else if ((room.cursorState() == CS_SEQUENCE) || - (room.cursorState() == CS_BUMPED)) { + (room.cursorState() == CS_BUMPED)) { // No action necessary } else { if (mouse.lButton()) @@ -489,7 +489,7 @@ void Game::handleRightClickMenu() { } // If no inventory items remove entries that require them - if (res.numInventoryItems() == 0) + if (res.numInventoryItems() == 0) actions &= 0xFEF3F9FD; // If the player hasn't any money, remove any bribe entry @@ -556,16 +556,16 @@ void Game::handleRightClickMenu() { hotspot = res.getHotspot(room.hotspotId()); itemId = PopupMenu::ShowInventory(); breakFlag = (itemId != 0xffff); - if (breakFlag) { + if (breakFlag) { fields.setField(USE_HOTSPOT_ID, itemId); if ((action == GIVE) || (action == USE)) { // Add in the "X to " or "X on " section of give/use action useHotspot = res.getHotspot(itemId); assert(useHotspot); strings.getString(useHotspot->nameId, statusLine); - if (action == GIVE) + if (action == GIVE) strcat(statusLine, stringList.getString(S_TO)); - else + else strcat(statusLine, stringList.getString(S_ON)); statusLine += strlen(statusLine); } @@ -621,7 +621,7 @@ void Game::handleLeftClick() { player->setActionCtr(0); strcpy(room.statusLine(), ""); - if ((room.destRoomNumber() == 0) && (room.hotspotId() != 0)) { + if ((room.destRoomNumber() == 0) && (room.hotspotId() != 0)) { // Handle look at hotspot sprintf(room.statusLine(), "%s ", stringList.getString(LOOK_AT)); HotspotData *hotspot = res.getHotspot(room.hotspotId()); @@ -631,10 +631,10 @@ void Game::handleLeftClick() { } else if (room.destRoomNumber() != 0) { // Walk to another room - RoomExitCoordinateData &exitData = + RoomExitCoordinateData &exitData = res.coordinateList().getEntry(room.roomNumber()).getData(room.destRoomNumber()); - player->walkTo((exitData.x & 0xfff8) | 5, (exitData.y & 0xfff8), + player->walkTo((exitData.x & 0xfff8) | 5, (exitData.y & 0xfff8), room.hotspotId() == 0 ? 0xffff : room.hotspotId()); } else { // Walking within room @@ -670,7 +670,7 @@ bool Game::GetTellActions() { while ((_numTellCommands >= 0) && (_numTellCommands < MAX_TELL_COMMANDS)) { - // Loop for each sub-part of commands: Action, up to two params, and + // Loop for each sub-part of commands: Action, up to two params, and // a "and then" selection to allow for more commands while ((paramIndex >= 0) && (paramIndex <= 4)) { @@ -687,7 +687,7 @@ bool Game::GetTellActions() { if (action == NONE) { // Move backwards to prior specified action --_numTellCommands; - if (_numTellCommands < 0) + if (_numTellCommands < 0) paramIndex = -1; else { paramIndex = 3; @@ -709,10 +709,10 @@ bool Game::GetTellActions() { case 1: // First parameter - action = (Action) commands[_numTellCommands * 3]; + action = (Action) commands[_numTellCommands * 3]; if (action != RETURN) { // Prompt for selection - if ((action != USE) && (action != DRINK) && (action != GIVE)) + if ((action != USE) && (action != DRINK) && (action != GIVE)) selectionId = PopupMenu::ShowItems(action, *roomList.begin()); else selectionId = PopupMenu::ShowItems(GET, *roomList.begin()); @@ -724,7 +724,7 @@ bool Game::GetTellActions() { *statusLine = '\0'; break; } - + if (selectionId < NOONE_ID) { // Must be a room selection strings.getString(selectionId, selectionName); @@ -745,7 +745,7 @@ bool Game::GetTellActions() { case 2: // Second parameter - action = (Action) commands[_numTellCommands * 3]; + action = (Action) commands[_numTellCommands * 3]; if (action == ASK) strcat(statusLine, stringList.getString(S_FOR)); else if (action == GIVE) @@ -803,7 +803,7 @@ bool Game::GetTellActions() { default: // Move to end of just completed command - action = (Action) commands[_numTellCommands * 3]; + action = (Action) commands[_numTellCommands * 3]; if (action == RETURN) paramIndex = 0; else if ((action == ASK) || (action == GIVE) || (action == USE)) @@ -870,18 +870,18 @@ void Game::doShowCredits() { Sound.pause(); mouse.cursorOff(); - + Surface *s = Surface::getScreen(CREDITS_RESOURCE_ID); - + if (isEGA) { s->copyToScreen(0, 0); } else { Palette p(CREDITS_RESOURCE_ID - 1); screen.setPaletteEmpty(); s->copyToScreen(0, 0); - screen.setPalette(&p); + screen.setPalette(&p); } - + delete s; events.waitForPress(); @@ -892,7 +892,7 @@ void Game::doShowCredits() { void Game::doQuit() { Sound.pause(); - if (getYN()) + if (getYN()) Events::getReference().quitFlag = true; Sound.resume(); } @@ -944,7 +944,7 @@ void Game::handleBootParam(int value) { h->setPosition(140, 120); h->currentActions().top().setSupportData(0x1400); fields.setField(11, 1); - + // Set up player h = res.getActiveHotspot(PLAYER_ID); h->setRoomNumber(4); @@ -978,7 +978,7 @@ bool Game::getYN() { Events &events = Events::getReference(); Screen &screen = Screen::getReference(); Resources &res = Resources::getReference(); - + Common::Language l = LureEngine::getReference().getLanguage(); Common::KeyCode y = Common::KEYCODE_y; if (l == FR_FRA) y = Common::KEYCODE_o; @@ -996,7 +996,7 @@ bool Game::getYN() { delete s; bool breakFlag = false; - bool result = false; + bool result = false; do { while (events.pollEvent()) { @@ -1035,11 +1035,11 @@ bool Game::isMenuAvailable() { Room &room = Room::getReference(); uint16 oldRoomNumber = res.fieldList().getField(OLD_ROOM_NUMBER); - if (oldRoomNumber != 0) + if (oldRoomNumber != 0) // Viewing a room remotely - so the menu isn't available return false; - - else if ((room.cursorState() == CS_TALKING) || (res.getTalkState() != TALK_NONE)) + + else if ((room.cursorState() == CS_TALKING) || (res.getTalkState() != TALK_NONE)) return false; return true; diff --git a/engines/lure/hotspots.cpp b/engines/lure/hotspots.cpp index 9dba7a55f4..cd9daa3265 100644 --- a/engines/lure/hotspots.cpp +++ b/engines/lure/hotspots.cpp @@ -151,7 +151,7 @@ Hotspot::Hotspot(Hotspot *character, uint16 objType): _pathFinder(this) { _tickHandler = HotspotTickHandlers::getHandler(PUZZLED_TICK_PROC_ID); setAnimationIndex(VOICE_ANIM_INDEX); setFrameNumber(objType == PUZZLED_ANIM_IDX ? 1 : 2); - + character->setFrameCtr(_voiceCtr); break; @@ -209,14 +209,14 @@ void Hotspot::setAnimation(uint16 newAnimId) { if (_data) _data->animRecordId = newAnimId; - if (newAnimId == 0) + if (newAnimId == 0) tempAnim = NULL; else { - tempAnim = r.getAnimation(newAnimId); + tempAnim = r.getAnimation(newAnimId); if (tempAnim == NULL) error("Hotspot %xh tried to set non-existant Animation Id: %xh", _hotspotId, newAnimId); } - + setAnimation(tempAnim); } @@ -225,7 +225,7 @@ void Hotspot::setAnimationIndex(int animIndex) { // Get the animation specified HotspotAnimData *tempAnim = r.animRecords()[animIndex]; - + _animId = tempAnim->animRecordId; if (_data) _data->animRecordId = tempAnim->animRecordId; @@ -270,7 +270,7 @@ void Hotspot::setAnimation(HotspotAnimData *newRecord) { _anim = newRecord; MemoryBlock *src = Disk::getReference().getEntry(_anim->animId); - + uint16 numEntries = READ_LE_UINT16(src->data()); uint16 *headerEntry = (uint16 *) (src->data() + 2); assert((numEntries >= 1) && (numEntries < 100)); @@ -288,7 +288,7 @@ void Hotspot::setAnimation(HotspotAnimData *newRecord) { _numFrames = numEntries; _frameNumber = 0; - + // Special handling need if (_hotspotId == RACK_SERF_ID) { _frameStartsUsed = true; @@ -303,7 +303,7 @@ void Hotspot::setAnimation(HotspotAnimData *newRecord) { byte *pDest; headerEntry = (uint16 *) (src->data() + 2); MemoryBlock &mDest = _frames->data(); - uint16 frameOffset = 0x40; + uint16 frameOffset = 0x40; uint16 *offsetPtr = (uint16 *) src->data(); tempWidth = _width; @@ -315,9 +315,9 @@ void Hotspot::setAnimation(HotspotAnimData *newRecord) { // For animations with an offset table, set the source pointer pSrc = dest->data() + frameOffset; } - + if (_hotspotId == RACK_SERF_ID) { - // Save the start of each frame for serf, since the size varies + // Save the start of each frame for serf, since the size varies xStart = (frameNumCtr == 0) ? 0 : _frameStarts[frameNumCtr - 1] + tempWidth; _frameStarts[frameNumCtr] = xStart; @@ -358,7 +358,7 @@ void Hotspot::setAnimation(HotspotAnimData *newRecord) { } } - if ((newRecord->flags & PIXELFLAG_HAS_TABLE) != 0) + if ((newRecord->flags & PIXELFLAG_HAS_TABLE) != 0) frameOffset += (READ_LE_UINT16(++offsetPtr) >> 1); } @@ -391,14 +391,14 @@ void Hotspot::copyTo(Surface *dest) { r.left += -xPos; xPos = 0; } - else if (xPos >= FULL_SCREEN_WIDTH) + else if (xPos >= FULL_SCREEN_WIDTH) return; else if (xPos + hWidth > FULL_SCREEN_WIDTH) r.right = r.left + (FULL_SCREEN_WIDTH - xPos - 1); // Handle clipping for Y position if (yPos < 0) { - if (yPos + hHeight <= MENUBAR_Y_SIZE) + if (yPos + hHeight <= MENUBAR_Y_SIZE) // Completely off screen, so don't display return; @@ -420,7 +420,7 @@ void Hotspot::copyTo(Surface *dest) { void Hotspot::incFrameNumber() { ++_frameNumber; - if (_frameNumber >= _numFrames) + if (_frameNumber >= _numFrames) _frameNumber = 0; } @@ -431,7 +431,7 @@ bool Hotspot::isActiveAnimation() { uint16 Hotspot::nameId() { if (_data == NULL) return 0; - else + else return _data->nameId; } @@ -476,7 +476,7 @@ void Hotspot::setTickProc(uint16 newVal) { if (_data) _data->tickProcId = newVal; - _tickHandler = HotspotTickHandlers::getHandler(newVal); + _tickHandler = HotspotTickHandlers::getHandler(newVal); } void Hotspot::walkTo(int16 endPosX, int16 endPosY, uint16 destHotspot) { @@ -557,7 +557,7 @@ void Hotspot::faceHotspot(HotspotData *hotspot) { } else { // Visual hotspot int xp, yp; - + HotspotOverrideData *hsEntry = res.getHotspotOverride(hotspot->hotspotId); if (hsEntry != NULL) { xp = x() - hsEntry->xs; @@ -605,7 +605,7 @@ void Hotspot::setRandomDest() { currentActions().top().setAction(START_WALKING); _walkFlag = true; - // Try up to 20 times to find an unoccupied destination + // Try up to 20 times to find an unoccupied destination for (int tryCtr = 0; tryCtr < 20; ++tryCtr) { xp = rect.left + rnd.getRandomNumber(rect.right - rect.left); yp = rect.top + rnd.getRandomNumber(rect.bottom - rect.top); @@ -613,7 +613,7 @@ void Hotspot::setRandomDest() { setDestHotspot(0); // Check if three sequential blocks at chosen destination are unoccupied - if (!roomData->paths.isOccupied(xp, yp, 3)) + if (!roomData->paths.isOccupied(xp, yp, 3)) break; } } @@ -729,7 +729,7 @@ void Hotspot::resetPosition() { setDirection(direction()); } -void Hotspot::converse(uint16 destCharacterId, uint16 messageId, bool srcStandStill, +void Hotspot::converse(uint16 destCharacterId, uint16 messageId, bool srcStandStill, bool destStandStill) { assert(_data); _data->talkDestCharacterId = destCharacterId; @@ -780,7 +780,7 @@ void Hotspot::showMessage(uint16 messageId, uint16 destCharacterId) { // default response if a specific response not found - if (idVal == 0xffff) idVal = 0x8c4; + if (idVal == 0xffff) idVal = 0x8c4; debugC(ERROR_DETAILED, kLureDebugStrings, "Hotspot::showMessage idVal=%xh", idVal); if (idVal == 0x76) { @@ -802,11 +802,11 @@ void Hotspot::showMessage(uint16 messageId, uint16 destCharacterId) { StringData::getReference().getString(hotspotData->nameId, nameBuffer); itemName = nameBuffer; } - + Dialog::show(idVal, itemName, this->getName()); - + } else if (idVal != 0) { - // Handle message as a talking dialog + // Handle message as a talking dialog converse(destCharacterId, idVal, true, false); } } @@ -836,7 +836,7 @@ void Hotspot::handleTalkDialog() { destCharacter->setDelayCtr(destCharacter->delayCtr() + 2); } } - return; + return; } // Time to set up the dialog for the character @@ -910,7 +910,7 @@ void Hotspot::startTalkDialog() { if (room.roomNumber() != roomNumber()) return; - room.setTalkDialog(hotspotId(), _data->talkDestCharacterId, _data->useHotspotId, + room.setTalkDialog(hotspotId(), _data->talkDestCharacterId, _data->useHotspotId, _data->talkMessageId); } @@ -924,7 +924,7 @@ static const uint16 validRoomExitHotspots[] = {0x2711, 0x2712, 0x2714, 0x2715, 0 0x2729, 0x272A, 0x272B, 0x272C, 0x272D, 0x272E, 0x272F, 0}; bool Hotspot::isRoomExit(uint16 id) { - for (const uint16 *p = &validRoomExitHotspots[0]; *p != 0; ++p) + for (const uint16 *p = &validRoomExitHotspots[0]; *p != 0; ++p) if (*p == id) return true; return false; } @@ -952,9 +952,9 @@ HotspotPrecheckResult Hotspot::actionPrecheck(HotspotData *hotspot) { setActionCtr(0); showMessage(13, NOONE_ID); return PC_EXCESS; - } + } - if ((hotspot->hotspotId >= FIRST_NONCHARACTER_ID) || + if ((hotspot->hotspotId >= FIRST_NONCHARACTER_ID) || (hotspot->characterMode == CHARMODE_INTERACTING) || (hotspot->characterMode == CHARMODE_WAIT_FOR_PLAYER) || (hotspot->characterMode == CHARMODE_WAIT_FOR_INTERACT)) { @@ -971,7 +971,7 @@ HotspotPrecheckResult Hotspot::actionPrecheck(HotspotData *hotspot) { setActionCtr(1); if ((hotspot->hotspotId >= FIRST_NONCHARACTER_ID) || - ((hotspot->actionHotspotId != _hotspotId) && + ((hotspot->actionHotspotId != _hotspotId) && (hotspot->characterMode == CHARMODE_WAIT_FOR_PLAYER))) { // loc_880 if (characterWalkingCheck(hotspot->hotspotId)) @@ -986,7 +986,7 @@ HotspotPrecheckResult Hotspot::actionPrecheck(HotspotData *hotspot) { hotspot->talkGate = GENERAL_MAGIC_ID; hotspot->talkerId = _hotspotId; return PC_WAIT; - } + } } // loc_888 @@ -996,9 +996,9 @@ HotspotPrecheckResult Hotspot::actionPrecheck(HotspotData *hotspot) { hotspot->delayCtr = 30; hotspot->actionHotspotId = _hotspotId; } - + // If the player had called out to someone to wait, close down that talk dialog - if ((_hotspotId == PLAYER_ID) && (res.getTalkingCharacter() == PLAYER_ID)) + if ((_hotspotId == PLAYER_ID) && (res.getTalkingCharacter() == PLAYER_ID)) Room::getReference().setTalkDialog(0, 0, 0, 0); return PC_EXECUTE; @@ -1009,10 +1009,10 @@ BarPlaceResult Hotspot::getBarPlace() { BarEntry &barEntry = res.barmanLists().getDetails(roomNumber()); if (actionCtr() != 0) { - // Already at bar + // Already at bar // Find the character's slot in the bar entry list for (int index = 0; index < NUM_SERVE_CUSTOMERS; ++index) { - if (barEntry.customers[index].hotspotId == hotspotId()) + if (barEntry.customers[index].hotspotId == hotspotId()) return ((barEntry.customers[index].serveFlags & 0x80) == 0) ? BP_GOT_THERE : BP_KEEP_TRYING; } @@ -1027,14 +1027,14 @@ BarPlaceResult Hotspot::getBarPlace() { // First scan for any existing entry for the character int index = -1; while (++index < NUM_SERVE_CUSTOMERS) { - if (barEntry.customers[index].hotspotId == hotspotId()) + if (barEntry.customers[index].hotspotId == hotspotId()) break; } if (index == NUM_SERVE_CUSTOMERS) { // Not already present - so scan for an empty slot index = -1; while (++index < NUM_SERVE_CUSTOMERS) { - if (barEntry.customers[index].hotspotId == 0) + if (barEntry.customers[index].hotspotId == 0) break; } @@ -1057,12 +1057,12 @@ bool Hotspot::findClearBarPlace() { // Check if character has reached the bar Resources &res = Resources::getReference(); BarEntry &barEntry = res.barmanLists().getDetails(roomNumber()); - if ((y() + heightCopy()) < ((barEntry.gridLine << 3) + 24)) + if ((y() + heightCopy()) < ((barEntry.gridLine << 3) + 24)) return true; RoomPathsData &paths = res.getRoom(roomNumber())->paths; - - // Scan backwards from the right side for 4 free blocks along the bar line block + + // Scan backwards from the right side for 4 free blocks along the bar line block int numFree = 0; for (int xp = ROOM_PATHS_WIDTH - 1; xp >= 0; --xp) { if (paths.isOccupied(xp, barEntry.gridLine)) @@ -1083,7 +1083,7 @@ bool Hotspot::characterWalkingCheck(uint16 id) { bool altFlag; HotspotData *hotspot; - // Note that several invalid hotspot Ids are used to identify special walk to + // Note that several invalid hotspot Ids are used to identify special walk to // coordinates used throughout the game _walkFlag = true; @@ -1124,7 +1124,7 @@ bool Hotspot::characterWalkingCheck(uint16 id) { if (altFlag) { // Alternate walking check - if (((x() >> 3) != (xp >> 3)) || + if (((x() >> 3) != (xp >> 3)) || ((((y() + heightCopy()) >> 3) - 1) != (yp >> 3))) { // Walk to the specified destination walkTo(xp, yp); @@ -1152,7 +1152,7 @@ bool Hotspot::doorCloseCheck(uint16 doorId) { return true; } - Rect bounds(doorHotspot->x(), doorHotspot->y() + doorHotspot->heightCopy() + Rect bounds(doorHotspot->x(), doorHotspot->y() + doorHotspot->heightCopy() - doorHotspot->yCorrection() - doorHotspot->charRectY(), doorHotspot->x() + doorHotspot->widthCopy(), doorHotspot->y() + doorHotspot->heightCopy() + doorHotspot->charRectY()); @@ -1165,14 +1165,14 @@ bool Hotspot::doorCloseCheck(uint16 doorId) { // Skip entry if it's the door or the character if ((hsCurrent->hotspotId() == hotspotId()) || - (hsCurrent->hotspotId() == doorHotspot->hotspotId())) + (hsCurrent->hotspotId() == doorHotspot->hotspotId())) continue; // Skip entry if it doesn't meet certain criteria if ((hsCurrent->layer() == 0) || (hsCurrent->roomNumber() != doorHotspot->roomNumber()) || (hsCurrent->hotspotId() < PLAYER_ID) || - ((hsCurrent->hotspotId() >= 0x408) && (hsCurrent->hotspotId() < 0x2710))) + ((hsCurrent->hotspotId() >= 0x408) && (hsCurrent->hotspotId() < 0x2710))) continue; // Also skip entry if special Id @@ -1238,7 +1238,7 @@ void Hotspot::doAction() { void Hotspot::doAction(Action action, HotspotData *hotspot) { StringList &stringList = Resources::getReference().stringList(); - debugC(ERROR_INTERMEDIATE, kLureDebugHotspots, "Action charId=%xh Action=%d/%s", + debugC(ERROR_INTERMEDIATE, kLureDebugHotspots, "Action charId=%xh Action=%d/%s", _hotspotId, (int)action, (action > EXAMINE) ? NULL : stringList.getString((int)action)); // Set the ACTIVE_HOTSPOT_ID and USE_HOTSPOT_ID fields @@ -1246,58 +1246,58 @@ void Hotspot::doAction(Action action, HotspotData *hotspot) { ValueTableData &fields = Resources::getReference().fieldList(); fields.setField(ACTIVE_HOTSPOT_ID, hotspot->hotspotId); - if (action == USE) + if (action == USE) fields.setField(USE_HOTSPOT_ID, currentActions().top().supportData().param(0)); - else if ((action == GIVE) || (action == ASK)) + else if ((action == GIVE) || (action == ASK)) fields.setField(USE_HOTSPOT_ID, currentActions().top().supportData().param(1)); - else + else fields.setField(USE_HOTSPOT_ID, hotspot->hotspotId); } ActionProcPtr actionProcList[NPC_JUMP_ADDRESS + 1] = { - &Hotspot::doNothing, - &Hotspot::doGet, - NULL, - &Hotspot::doOperate, - &Hotspot::doOperate, - &Hotspot::doOperate, - &Hotspot::doOpen, + &Hotspot::doNothing, + &Hotspot::doGet, + NULL, + &Hotspot::doOperate, + &Hotspot::doOperate, + &Hotspot::doOperate, + &Hotspot::doOpen, &Hotspot::doClose, - &Hotspot::doLockUnlock, - &Hotspot::doLockUnlock, - &Hotspot::doUse, - &Hotspot::doGive, - &Hotspot::doTalkTo, - &Hotspot::doTell, + &Hotspot::doLockUnlock, + &Hotspot::doLockUnlock, + &Hotspot::doUse, + &Hotspot::doGive, + &Hotspot::doTalkTo, + &Hotspot::doTell, + NULL, + &Hotspot::doLook, + &Hotspot::doLookAt, + &Hotspot::doLookThrough, + &Hotspot::doAsk, NULL, - &Hotspot::doLook, - &Hotspot::doLookAt, - &Hotspot::doLookThrough, - &Hotspot::doAsk, - NULL, &Hotspot::doDrink, - &Hotspot::doStatus, - &Hotspot::doGoto, - &Hotspot::doReturn, - &Hotspot::doBribe, - &Hotspot::doExamine, + &Hotspot::doStatus, + &Hotspot::doGoto, + &Hotspot::doReturn, + &Hotspot::doBribe, + &Hotspot::doExamine, NULL, NULL, - &Hotspot::npcSetRoomAndBlockedOffset, - &Hotspot::npcHeySir, - &Hotspot::npcExecScript, - &Hotspot::npcResetPausedList, + &Hotspot::npcSetRoomAndBlockedOffset, + &Hotspot::npcHeySir, + &Hotspot::npcExecScript, + &Hotspot::npcResetPausedList, &Hotspot::npcSetRandomDest, - &Hotspot::npcWalkingCheck, + &Hotspot::npcWalkingCheck, &Hotspot::npcSetSupportOffset, &Hotspot::npcSupportOffsetConditional, - &Hotspot::npcDispatchAction, - &Hotspot::npcTalkNpcToNpc, - &Hotspot::npcPause, + &Hotspot::npcDispatchAction, + &Hotspot::npcTalkNpcToNpc, + &Hotspot::npcPause, &Hotspot::npcStartTalking, &Hotspot::npcJumpAddress}; (this->*actionProcList[action])(hotspot); - debugC(ERROR_DETAILED, kLureDebugHotspots, "Action charId=%xh Action=%d/%s Complete", + debugC(ERROR_DETAILED, kLureDebugHotspots, "Action charId=%xh Action=%d/%s Complete", _hotspotId, (int)action, (action > EXAMINE) ? NULL : stringList.getString((int)action)); } @@ -1311,7 +1311,7 @@ void Hotspot::doNothing(HotspotData *hotspot) { } } - if (hotspotId() == PLAYER_ID) + if (hotspotId() == PLAYER_ID) Room::getReference().setCursorState(CS_NONE); } @@ -1332,8 +1332,8 @@ void Hotspot::doGet(HotspotData *hotspot) { if (sequenceOffset >= 0x8000) { showMessage(sequenceOffset); return; - } - + } + if (sequenceOffset != 0) { uint16 execResult = Script::execute(sequenceOffset); @@ -1345,7 +1345,7 @@ void Hotspot::doGet(HotspotData *hotspot) { } // Move hotspot into characters's inventory - hotspot->roomNumber = hotspotId(); + hotspot->roomNumber = hotspotId(); if (hotspot->hotspotId < START_NONVISUAL_HOTSPOT_ID) { // Deactive hotspot animation @@ -1417,7 +1417,7 @@ void Hotspot::doOpen(HotspotData *hotspot) { if (sequenceOffset == 1) return; if (sequenceOffset != 0) { - if (_exitCtr != 0) + if (_exitCtr != 0) _exitCtr = 4; showMessage(sequenceOffset); return; @@ -1525,7 +1525,7 @@ void Hotspot::doUse(HotspotData *hotspot) { showMessage(17); } else { sequenceOffset = Script::execute(sequenceOffset); - if (sequenceOffset != 0) + if (sequenceOffset != 0) showMessage(sequenceOffset); } } @@ -1553,7 +1553,7 @@ void Hotspot::doGive(HotspotData *hotspot) { faceHotspot(hotspot); endAction(); - if ((hotspot->hotspotId != PRISONER_ID) || (usedId != BOTTLE_HOTSPOT_ID)) + if ((hotspot->hotspotId != PRISONER_ID) || (usedId != BOTTLE_HOTSPOT_ID)) showMessage(7, hotspot->hotspotId); uint16 sequenceOffset = res.getHotspotAction(hotspot->actionsOffset, GIVE); @@ -1586,7 +1586,7 @@ void Hotspot::doTalkTo(HotspotData *hotspot) { fields.setField(ACTIVE_HOTSPOT_ID, hotspot->hotspotId); fields.setField(USE_HOTSPOT_ID, hotspot->hotspotId); - if ((hotspot->hotspotId != SKORL_ID) && ((hotspot->roomNumber != 28) || + if ((hotspot->hotspotId != SKORL_ID) && ((hotspot->roomNumber != 28) || (hotspot->hotspotId != BLACKSMITH_ID))) { HotspotPrecheckResult result = actionPrecheck(hotspot); @@ -1664,7 +1664,7 @@ void Hotspot::doLook(HotspotData *hotspot) { Dialog::show(Room::getReference().descId()); } -static const uint16 hotspotLookAtList[] = {0x411, 0x412, 0x41F, 0x420, 0x421, 0x422, 0x426, +static const uint16 hotspotLookAtList[] = {0x411, 0x412, 0x41F, 0x420, 0x421, 0x422, 0x426, 0x427, 0x428, 0x429, 0x436, 0x437, 0}; void Hotspot::doLookAt(HotspotData *hotspot) { @@ -1704,7 +1704,7 @@ void Hotspot::doLookAction(HotspotData *hotspot, Action action) { if (sequenceOffset >= 0x8000) { showMessage(sequenceOffset); } else { - if (sequenceOffset != 0) + if (sequenceOffset != 0) sequenceOffset = Script::execute(sequenceOffset); if (sequenceOffset == 0) { @@ -1793,7 +1793,7 @@ void Hotspot::doStatus(HotspotData *hotspot) { StringList &stringList = res.stringList(); StringData &strings = StringData::getReference(); Room &room = Room::getReference(); - + room.update(); endAction(); @@ -1870,7 +1870,7 @@ void Hotspot::doBribe(HotspotData *hotspot) { endAction(); return; } - + const uint16 *tempId = &bribe_hotspot_list[0]; uint16 sequenceOffset = 0x14B; // Default sequence offset while (*tempId != 0) { @@ -1882,7 +1882,7 @@ void Hotspot::doBribe(HotspotData *hotspot) { } ++tempId; // Move over entry's sequence offset } - + faceHotspot(hotspot); setActionCtr(0); endAction(); @@ -1909,7 +1909,7 @@ void Hotspot::doExamine(HotspotData *hotspot) { if (sequenceOffset >= 0x8000) { showMessage(sequenceOffset); } else { - if (sequenceOffset != 0) + if (sequenceOffset != 0) sequenceOffset = Script::execute(sequenceOffset); if (sequenceOffset == 0) { @@ -1934,13 +1934,13 @@ void Hotspot::doLockUnlock(HotspotData *hotspot) { faceHotspot(hotspot); endAction(); - + uint16 sequenceOffset = res.getHotspotAction(hotspot->actionsOffset, action); if (sequenceOffset >= 0x8000) { showMessage(sequenceOffset); } else { - if (sequenceOffset != 0) + if (sequenceOffset != 0) Script::execute(sequenceOffset); } } @@ -2063,8 +2063,8 @@ void Hotspot::npcDispatchAction(HotspotData *hotspot) { CharacterScheduleEntry *newEntry = Resources::getReference(). charSchedules().getEntry(entry.param(0), entry.parent()); currentActions().top().setSupportData(newEntry); - - HotspotData *hotspotData = (newEntry->numParams() == 0) ? NULL : + + HotspotData *hotspotData = (newEntry->numParams() == 0) ? NULL : res.getHotspot(newEntry->param((newEntry->action() == USE) ? 1 : 0)); doAction(newEntry->action(), hotspotData); } @@ -2085,7 +2085,7 @@ void Hotspot::npcTalkNpcToNpc(HotspotData *hotspot) { } // If dest is already talking, keep exiting until they're free - if (hotspot->talkCountdown != 0) + if (hotspot->talkCountdown != 0) return; // Handle the source's talk message @@ -2175,7 +2175,7 @@ uint16 Hotspot::getTalkId(HotspotData *charHotspot) { // Get offset of talk set to use headerEntry = res.getTalkHeader(charHotspot->hotspotId); - // Check whether character is a stranger + // Check whether character is a stranger if ((isEnglish && (charHotspot->nameId == 378)) || (!isEnglish && ((charHotspot->nameId == 381) || (charHotspot->nameId == 382)))) // Is a stranger, so force talk Index to be 0 (initial talk) @@ -2191,19 +2191,19 @@ void Hotspot::startTalk(HotspotData *charHotspot, uint16 id) { Resources &res = Resources::getReference(); // Set for providing talk listing - setTickProc(TALK_TICK_PROC_ID); - + setTickProc(TALK_TICK_PROC_ID); + // Signal the character that they're being talked to charHotspot->talkerId = _hotspotId; charHotspot->talkGate = 0; charHotspot->talkDestCharacterId = _hotspotId; _data->talkDestCharacterId = charHotspot->hotspotId; _data->talkGate = 0; - + // Set the active talk data res.setTalkStartEntry(0); res.setTalkData(id); - if (!res.getTalkData()) + if (!res.getTalkData()) error("Talk failed - invalid offset: Character=%xh, offset=%xh", charHotspot->hotspotId, id); } @@ -2375,7 +2375,7 @@ void HotspotTickHandlers::defaultHandler(Hotspot &h) { void HotspotTickHandlers::standardAnimHandler(Hotspot &h) { Resources &res = Resources::getReference(); - if (h.frameCtr() > 0) + if (h.frameCtr() > 0) h.decrFrameCtr(); else { if (h.executeScript()) { @@ -2406,7 +2406,7 @@ void HotspotTickHandlers::standardCharacterAnimHandler(Hotspot &h) { if (h.currentActions().action() != WALKING) { char buffer[MAX_DESC_SIZE]; h.currentActions().list(buffer); - debugC(ERROR_DETAILED, kLureDebugAnimations, "Hotspot standard character p=(%d,%d,%d) bs=%d\n%s", + debugC(ERROR_DETAILED, kLureDebugAnimations, "Hotspot standard character p=(%d,%d,%d) bs=%d\n%s", h.x(), h.y(), h.roomNumber(), h.blockedState(), buffer); } @@ -2495,7 +2495,7 @@ void HotspotTickHandlers::standardCharacterAnimHandler(Hotspot &h) { debugC(ERROR_DETAILED, kLureDebugAnimations, "Hotspot standard character point 5"); if (h.characterMode() != CHARMODE_NONE) { - debugC(ERROR_DETAILED, kLureDebugAnimations, "char mode = %d, delay ctr = %d", + debugC(ERROR_DETAILED, kLureDebugAnimations, "char mode = %d, delay ctr = %d", h.characterMode(), h.delayCtr()); if (h.characterMode() == CHARMODE_PLAYER_WAIT) { @@ -2534,10 +2534,10 @@ void HotspotTickHandlers::standardCharacterAnimHandler(Hotspot &h) { return; } - /* interactHotspotId never seems to be set + /* interactHotspotId never seems to be set if ((h.resource()->interactHotspotId != 0) && !player->currentActions().isEmpty()) { h.setActionCtr(99); - if (!actions.isEmpty()) + if (!actions.isEmpty()) actions.top().setAction(DISPATCH_ACTION); } */ @@ -2579,11 +2579,11 @@ void HotspotTickHandlers::standardCharacterAnimHandler(Hotspot &h) { case START_WALKING: // Start the player walking to the given destination - - debugC(ERROR_DETAILED, kLureDebugAnimations, + + debugC(ERROR_DETAILED, kLureDebugAnimations, "Hotspot standard character exec start walking => (%d,%d)", h.destX(), h.destY()); - h.setOccupied(false); + h.setOccupied(false); pathFinder.reset(paths); h.currentActions().top().setAction(PROCESSING_PATH); @@ -2593,15 +2593,15 @@ void HotspotTickHandlers::standardCharacterAnimHandler(Hotspot &h) { // Handle processing pathfinding debugC(ERROR_DETAILED, kLureDebugAnimations, "Hotspot standard character processing path"); res.pausedList().scan(h); - + pfResult = pathFinder.process(); if (pfResult == PF_UNFINISHED) break; - debugC(ERROR_DETAILED, kLureDebugAnimations, + debugC(ERROR_DETAILED, kLureDebugAnimations, "pathFinder done: result = %d", pfResult); // Post-processing checks - if ((pfResult == PF_OK) || + if ((pfResult == PF_OK) || ((h.destHotspotId() == 0) && (pfResult == PF_DEST_OCCUPIED))) { // Standard processing debugC(ERROR_DETAILED, kLureDebugAnimations, "Standard result handling"); @@ -2629,7 +2629,7 @@ void HotspotTickHandlers::standardCharacterAnimHandler(Hotspot &h) { h.setCharacterMode(CHARMODE_PAUSED); h.setDelayCtr(2); - if (h.currentActions().isEmpty() || + if (h.currentActions().isEmpty() || (h.currentActions().top().roomNumber() != h.roomNumber())) h.setDestHotspot(0xffff); @@ -2640,8 +2640,8 @@ void HotspotTickHandlers::standardCharacterAnimHandler(Hotspot &h) { debugC(ERROR_DETAILED, kLureDebugAnimations, "Character is blocked from moving"); CharacterScheduleEntry *newEntry = res.charSchedules().getEntry(RETURN_SUPPORT_ID); assert(newEntry); - - // Increment the blocked state + + // Increment the blocked state h.setBlockedState((BlockedState) ((int) h.blockedState() + 1)); if (!h.blockedFlag()) { // Not already handling blocked, so add a new dummy action so that the new @@ -2655,8 +2655,8 @@ void HotspotTickHandlers::standardCharacterAnimHandler(Hotspot &h) { entry.setAction(DISPATCH_ACTION); entry.setSupportData(newEntry); entry.setRoomNumber(h.roomNumber()); - } - + } + // If the top action is now walking, deliberately fall through to the case entry; // otherwise break out to exit method if (h.currentActions().isEmpty() || h.currentActions().top().action() != WALKING) @@ -2665,7 +2665,7 @@ void HotspotTickHandlers::standardCharacterAnimHandler(Hotspot &h) { case WALKING: // The character is currently moving debugC(ERROR_DETAILED, kLureDebugAnimations, "Hotspot standard character walking"); - h.setOccupied(false); + h.setOccupied(false); // If the character is walking to an exit hotspot, make sure it's still open if ((h.destHotspotId() != 0) && (h.destHotspotId() != 0xffff)) { @@ -2680,10 +2680,10 @@ void HotspotTickHandlers::standardCharacterAnimHandler(Hotspot &h) { } if (res.pausedList().check(h.hotspotId(), numImpinging, impingingList) == 0) { - if (h.walkingStep()) + if (h.walkingStep()) // Walking done h.currentActions().top().setAction(DISPATCH_ACTION); - + if (h.destHotspotId() != 0) { // Walking to an exit, check for any required room change if (Support::checkRoomChange(h)) @@ -2699,12 +2699,12 @@ void HotspotTickHandlers::standardCharacterAnimHandler(Hotspot &h) { void HotspotTickHandlers::voiceBubbleAnimHandler(Hotspot &h) { Resources &res = Resources::getReference(); - debugC(ERROR_DETAILED, kLureDebugAnimations, - "Voice Bubble anim handler: char = %xh, ctr = %d, char speaking ctr = %d", - h.hotspotId(), h.voiceCtr(), + debugC(ERROR_DETAILED, kLureDebugAnimations, + "Voice Bubble anim handler: char = %xh, ctr = %d, char speaking ctr = %d", + h.hotspotId(), h.voiceCtr(), res.getHotspot(res.getTalkingCharacter())->talkCountdown); - if (h.voiceCtr() != 0) + if (h.voiceCtr() != 0) h.setVoiceCtr(h.voiceCtr() - 1); if (h.voiceCtr() != 0) { @@ -2756,7 +2756,7 @@ void HotspotTickHandlers::roomExitAnimHandler(Hotspot &h) { RoomExitJoinData *rec = res.getExitJoin(h.hotspotId()); if (!rec) return; - RoomExitJoinStruct &rs = (rec->hotspots[0].hotspotId == h.hotspotId()) ? + RoomExitJoinStruct &rs = (rec->hotspots[0].hotspotId == h.hotspotId()) ? rec->hotspots[0] : rec->hotspots[1]; if ((rec->blocked != 0) && (rs.currentFrame != rs.destFrame)) { @@ -2774,7 +2774,7 @@ void HotspotTickHandlers::roomExitAnimHandler(Hotspot &h) { --rs.currentFrame; if ((rs.currentFrame == rs.destFrame) && (h.hotspotId() == room.roomNumber())) { Sound.addSound(rs.openSound); - + // If in the outside village, trash reverb if (fields.getField(AREA_FLAG) == 1) Sound.musicInterface_TrashReverb(); @@ -2799,8 +2799,8 @@ void HotspotTickHandlers::playerAnimHandler(Hotspot &h) { char buffer[MAX_DESC_SIZE]; h.currentActions().list(buffer); - debugC(ERROR_DETAILED, kLureDebugAnimations, - "Hotspot player anim handler p=(%d,%d,%d) bs=%d\n%s", + debugC(ERROR_DETAILED, kLureDebugAnimations, + "Hotspot player anim handler p=(%d,%d,%d) bs=%d\n%s", h.x(), h.y(), h.roomNumber(), h.blockedState(), buffer); h.handleTalkDialog(); @@ -2816,12 +2816,12 @@ void HotspotTickHandlers::playerAnimHandler(Hotspot &h) { if (h.skipFlag()) { debugC(ERROR_DETAILED, kLureDebugAnimations, "Skip flag set: numImpinging = %d", numImpinging); - if (numImpinging > 0) + if (numImpinging > 0) return; h.setSkipFlag(false); } - /* interactHotspotId never seems to be set + /* interactHotspotId never seems to be set if (h.resource()->interactHotspotId != 0) { h.resource()->interactHotspotId = 0; Hotspot *hotspot = res.getActiveHotspot(h.resource()->interactHotspotId); @@ -2894,7 +2894,7 @@ void HotspotTickHandlers::playerAnimHandler(Hotspot &h) { if (actions.top().supportData().numParams() > 0) { hotspotId = actions.top().supportData().param((hsAction == USE) ? 1 : 0); hotspot = res.getHotspot(hotspotId); - } + } } else { hsAction = NONE; } @@ -2912,7 +2912,7 @@ void HotspotTickHandlers::playerAnimHandler(Hotspot &h) { case START_WALKING: // Start the player walking to the given destination - h.setOccupied(false); + h.setOccupied(false); // Reset the path finder / walking sequence pathFinder.reset(paths); @@ -2929,14 +2929,14 @@ void HotspotTickHandlers::playerAnimHandler(Hotspot &h) { pfResult = pathFinder.process(); if (pfResult == PF_UNFINISHED) break; - // Pathfinding is now complete + // Pathfinding is now complete pathFinder.list(buffer); - debugC(ERROR_DETAILED, kLureDebugAnimations, - "Pathfind processing done; result=%d, walkFlag=%d\n%s", + debugC(ERROR_DETAILED, kLureDebugAnimations, + "Pathfind processing done; result=%d, walkFlag=%d\n%s", pfResult, h.walkFlag(), buffer); - if ((pfResult != PF_OK) && (h.walkFlag() || (pfResult != PF_DEST_OCCUPIED))) { - + if ((pfResult != PF_OK) && (h.walkFlag() || (pfResult != PF_DEST_OCCUPIED))) { + debugC(ERROR_DETAILED, kLureDebugAnimations, "Blocked state checking"); if (h.blockedState() == BS_FINAL) { res.pausedList().reset(h.hotspotId()); @@ -2968,7 +2968,7 @@ void HotspotTickHandlers::playerAnimHandler(Hotspot &h) { h.currentActions().top().setAction(WALKING); if (mouse.getCursorNum() != CURSOR_CAMERA) mouse.setCursorNum(CURSOR_ARROW); - + // Deliberate fall through to walking case WALKING: @@ -3020,14 +3020,14 @@ void HotspotTickHandlers::followerAnimHandler(Hotspot &h) { if ((h.resource()->tickProcId == FOLLOWER_TICK_PROC_2) || (fields.getField(37) == 0)) { if (h.currentActions().isEmpty() && (h.roomNumber() != player->roomNumber())) { // Character in different room than player - if (h.hotspotId() == GOEWIN_ID) + if (h.hotspotId() == GOEWIN_ID) h.currentActions().addFront(DISPATCH_ACTION, player->roomNumber()); else { // Scan through the translation list for an alternate destination room const RoomTranslationRecord *p = &roomTranslations[0]; while ((p->srcRoom != 0) && (p->srcRoom != player->roomNumber())) ++p; - h.currentActions().addFront(DISPATCH_ACTION, + h.currentActions().addFront(DISPATCH_ACTION, (p->srcRoom != 0) ? p->destRoom : player->roomNumber()); } } @@ -3074,7 +3074,7 @@ void HotspotTickHandlers::followerAnimHandler(Hotspot &h) { standardCharacterAnimHandler(h); return; } - + // Flag the action as having been done, so it won't be repeated set->setDone(actionIndex); } @@ -3124,7 +3124,7 @@ void HotspotTickHandlers::sonicRatAnimHandler(Hotspot &h) { } void HotspotTickHandlers::droppingTorchAnimHandler(Hotspot &h) { - if (h.frameCtr() > 0) + if (h.frameCtr() > 0) h.setFrameCtr(h.frameCtr() - 1); else { bool result = h.executeScript(); @@ -3135,7 +3135,7 @@ void HotspotTickHandlers::droppingTorchAnimHandler(Hotspot &h) { res.activateHotspot(0x41C); // Add sound - Sound.addSound(8); + Sound.addSound(8); // Enable the fire and activate its animation HotspotData *fire = res.getHotspot(0x418); @@ -3291,7 +3291,7 @@ void HotspotTickHandlers::morkusAnimHandler(Hotspot &h) { Common::RandomSource rnd; g_system->getEventManager()->registerRandomSource(rnd, "lureHotspots"); - h.setHotspotScript(rnd.getRandomNumber(100) >= 50 ? 0x54 : 0); + h.setHotspotScript(rnd.getRandomNumber(100) >= 50 ? 0x54 : 0); h.setFrameCtr(20 + rnd.getRandomNumber(63)); } } @@ -3309,7 +3309,7 @@ void HotspotTickHandlers::talkAnimHandler(Hotspot &h) { Mouse &mouse = Mouse::getReference(); TalkSelections &talkSelections = res.getTalkSelections(); TalkData *data = res.getTalkData(); - TalkEntryList &entries = data->entries; + TalkEntryList &entries = data->entries; Hotspot *charHotspot; char buffer[MAX_DESC_SIZE]; Rect r; @@ -3337,7 +3337,7 @@ void HotspotTickHandlers::talkAnimHandler(Hotspot &h) { // Reset talk entry pointer list for (lineNum = 0; lineNum < MAX_TALK_SELECTIONS; ++lineNum) talkSelections[lineNum] = NULL; - + // Loop through list to find entries to display _talkResponse = NULL; numLines = 0; @@ -3350,14 +3350,14 @@ void HotspotTickHandlers::talkAnimHandler(Hotspot &h) { for (; i != entries.end(); ++i) { entry = *i; uint8 flags = (uint8) (entry->descId >> 14); - if (flags == 3) + if (flags == 3) // Skip the entry continue; uint16 sequenceOffset = entry->preSequenceId & 0x3fff; bool showLine = sequenceOffset == 0; if (!showLine) { - debugC(ERROR_DETAILED, kLureDebugAnimations, + debugC(ERROR_DETAILED, kLureDebugAnimations, "Checking whether to display line: script=%xh, descId=%d", sequenceOffset, entry->descId); showLine = Script::execute(sequenceOffset) != 0; @@ -3386,7 +3386,7 @@ void HotspotTickHandlers::talkAnimHandler(Hotspot &h) { case TALK_SELECT: r.left = 0; r.right = FULL_SCREEN_WIDTH - 1; selectedLine = mouse.y() / MENUBAR_Y_SIZE; - if ((selectedLine > MAX_TALK_SELECTIONS) || ((selectedLine != 0) && + if ((selectedLine > MAX_TALK_SELECTIONS) || ((selectedLine != 0) && !talkSelections[selectedLine-1])) selectedLine = 0; @@ -3411,7 +3411,7 @@ void HotspotTickHandlers::talkAnimHandler(Hotspot &h) { if (mouse.mButton() || mouse.rButton()) { // Abort the conversation talkEndConversation(); - + // Have destination character show question speech bubble charHotspot = res.getActiveHotspot(talkDestCharacter); if (charHotspot != NULL) @@ -3454,7 +3454,7 @@ void HotspotTickHandlers::talkAnimHandler(Hotspot &h) { case TALK_RESPOND_2: // Wait until the question dialog is no longer active h.handleTalkDialog(); - debugC(ERROR_DETAILED, kLureDebugAnimations, "Player talk dialog countdown %d", + debugC(ERROR_DETAILED, kLureDebugAnimations, "Player talk dialog countdown %d", h.resource()->talkCountdown); if (res.getTalkingCharacter() != 0) @@ -3493,7 +3493,7 @@ void HotspotTickHandlers::talkAnimHandler(Hotspot &h) { if (charHotspot != NULL) charHotspot->converse(PLAYER_ID, descId, true); - } + } res.setTalkState(TALK_RESPONSE_WAIT); break; @@ -3503,7 +3503,7 @@ void HotspotTickHandlers::talkAnimHandler(Hotspot &h) { charHotspot = res.getActiveHotspot(talkDestCharacter); assert(charHotspot); - debugC(ERROR_DETAILED, kLureDebugAnimations, "Player talk dialog countdown %d", + debugC(ERROR_DETAILED, kLureDebugAnimations, "Player talk dialog countdown %d", (charHotspot) ? charHotspot->resource()->talkCountdown : 0); if ((charHotspot->resource()->talkCountdown > 0) || (res.getTalkingCharacter() != 0)) @@ -3515,7 +3515,7 @@ void HotspotTickHandlers::talkAnimHandler(Hotspot &h) { if (result == 0xffff) keepTalkingFlag = false; else { - if ((result & 0x8000) == 0) + if ((result & 0x8000) == 0) keepTalkingFlag = true; else { result = Script::execute(result & 0x7fff); @@ -3596,7 +3596,7 @@ void HotspotTickHandlers::barmanAnimHandler(Hotspot &h) { h.setDelayCtr(h.delayCtr() - 1); return; } - + if (h.frameCtr() == 0) { // Barman not currently doing something if (barEntry.currentCustomer != NULL) { @@ -3632,7 +3632,7 @@ void HotspotTickHandlers::barmanAnimHandler(Hotspot &h) { h.setFrameCtr(2); } } - + return; } } @@ -3703,7 +3703,7 @@ void HotspotTickHandlers::barmanAnimHandler(Hotspot &h) { if (h.hotspotId() == EWAN_ID) xp = rnd.getRandomNumber(51) + 94; else - xp = rnd.getRandomNumber(85) + 117; + xp = rnd.getRandomNumber(85) + 117; h.setSupportValue(xp); h.setFrameCtr(0x83); @@ -3761,7 +3761,7 @@ void HotspotTickHandlers::barmanAnimHandler(Hotspot &h) { // Make sure Ewan is back to his standard animation h.setWidth(16); h.setAnimationIndex(EWAN_ANIM_INDEX); - + if (ewanXOffset) { h.setPosition(h.x() + 8, h.y()); ewanXOffset = false; @@ -3823,7 +3823,7 @@ void HotspotTickHandlers::goewinShopAnimHandler(Hotspot &h) { if ((talkIndex == 12) || (talkIndex == 13) || (talkIndex == 14) || (playerHotspot->roomNumber() == 34)) h.setDelayCtr(1500); - else + else Script::normalGoewin(0, 0, 0); } } @@ -3846,7 +3846,7 @@ void HotspotTickHandlers::skullAnimHandler(Hotspot &h) { } void HotspotTickHandlers::dragonFireAnimHandler(Hotspot &h) { - if (h.executeScript()) + if (h.executeScript()) // Script is finished - player is dead Game::getReference().setState(GS_RESTORE_RESTART); } @@ -3943,7 +3943,7 @@ void HotspotTickHandlers::npcRoomChange(Hotspot &h) { h.currentActions().top().setRoomNumber(h.roomNumber()); } else if ((h.blockedOffset() != 0) && (h.blockedOffset() != 0xffff)) { - // Only current action on stack - and there is a block handler + // Only current action on stack - and there is a block handler CharacterScheduleEntry *entry = res.charSchedules().getEntry(h.blockedOffset()); h.currentActions().top().setSupportData(entry); h.currentActions().top().setRoomNumber(h.roomNumber()); @@ -3964,7 +3964,7 @@ void HotspotTickHandlers::npcRoomChange(Hotspot &h) { for (i = list.begin(); i != list.end(); ++i) { if ((h.roomNumber() == (exitData.roomNumber & 0xff)) && (h.layer() != 0) && - (h.hotspotId() >= PLAYER_ID) && (h.hotspotId() < FIRST_NONCHARACTER_ID)) + (h.hotspotId() >= PLAYER_ID) && (h.hotspotId() < FIRST_NONCHARACTER_ID)) ++numCharacters; } @@ -3972,7 +3972,7 @@ void HotspotTickHandlers::npcRoomChange(Hotspot &h) { uint16 dataId = res.getCharOffset(0); CharacterScheduleEntry *entry = res.charSchedules().getEntry(dataId); h.currentActions().addFront(DISPATCH_ACTION, entry, h.roomNumber()); - + return; } } @@ -3992,7 +3992,7 @@ void HotspotTickHandlers::npcRoomChange(Hotspot &h) { } // No exit hotspot, or it has one that's not blocked. So start the walking - h.currentActions().top().setAction(START_WALKING); + h.currentActions().top().setAction(START_WALKING); h.setWalkFlag(true); } @@ -4021,11 +4021,11 @@ int WalkingActionEntry::numSteps() { // PathFinder class -PathFinder::PathFinder(Hotspot *h) { +PathFinder::PathFinder(Hotspot *h) { _hotspot = h; _inUse = false; - _list.clear(); - _stepCtr = 0; + _list.clear(); + _stepCtr = 0; } void PathFinder::clear() { @@ -4068,9 +4068,9 @@ PathFinderResult PathFinder::process() { _xDestCurrent >>= 3; _yDestCurrent >>= 3; if ((_xCurrent == _xDestCurrent) && (_yCurrent == _yDestCurrent)) { // Very close move - if (_xDestPos > 0) + if (_xDestPos > 0) add(RIGHT, _xDestPos); - else if (_xDestPos < 0) + else if (_xDestPos < 0) add(LEFT, -_xDestPos); _inProgress = false; @@ -4091,7 +4091,7 @@ PathFinderResult PathFinder::process() { result = _destOccupied ? PF_DEST_OCCUPIED : PF_OK; *_pDest = 0; - // Set up the current pointer, adjusting away from edges if necessary + // Set up the current pointer, adjusting away from edges if necessary if (_xCurrent >= _xDestCurrent) { _xChangeInc = -1; @@ -4161,7 +4161,7 @@ PathFinderResult PathFinder::process() { scanLine(_destX, -1, pTemp, v); scanLine(ROOM_PATHS_WIDTH - _destX, 1, pTemp, v); scanLine(_destY, -DECODED_PATHS_WIDTH, pTemp, v); - scanLine(ROOM_PATHS_HEIGHT - _destY, DECODED_PATHS_WIDTH, pTemp, v); + scanLine(ROOM_PATHS_HEIGHT - _destY, DECODED_PATHS_WIDTH, pTemp, v); if (pTemp == _pDest) { clear(); @@ -4177,7 +4177,7 @@ PathFinderResult PathFinder::process() { Room::getReference().tempLayer[ctr] = _layer[ctr]; } - // Determine the walk path by working backwards from the destination, adding in the + // Determine the walk path by working backwards from the destination, adding in the // walking steps in reverse order until source is reached int stageCtr; for (stageCtr = 0; stageCtr < 3; ++stageCtr) { @@ -4192,7 +4192,7 @@ PathFinderResult PathFinder::process() { while (1) { v = *pCurrent - 1; if (v == 0) break; - + newDirection = NO_DIRECTION; if (!altFlag && (currDirection != LEFT) && (currDirection != RIGHT)) { // Standard order direction checking @@ -4207,7 +4207,7 @@ PathFinderResult PathFinder::process() { else if (*(pCurrent - DECODED_PATHS_WIDTH) == v) newDirection = DOWN; else if (*(pCurrent + DECODED_PATHS_WIDTH) == v) newDirection = UP; } - if (newDirection == NO_DIRECTION) + if (newDirection == NO_DIRECTION) error("Path finding process failed"); // Process for the specified direction @@ -4239,7 +4239,7 @@ PathFinderResult PathFinder::process() { currDirection = newDirection; } - if (stageCtr == 0) + if (stageCtr == 0) // Save the number of steps needed savedSteps = numSteps; if ((stageCtr == 1) && (numSteps <= savedSteps)) @@ -4250,12 +4250,12 @@ PathFinderResult PathFinder::process() { // Add a final move if necessary if (result == PF_OK) { - if (_xDestPos < 0) + if (_xDestPos < 0) addBack(LEFT, -_xDestPos); - else if (_xDestPos > 0) + else if (_xDestPos > 0) addBack(RIGHT, _xDestPos); } - + final_step: if (_xPos < 0) add(RIGHT, -_xPos); else if (_xPos > 0) add(LEFT, _xPos); @@ -4271,7 +4271,7 @@ void PathFinder::list(char *buffer) { else { printf("Pathfinder::list\n"); } - + ManagedList<WalkingActionEntry *>::iterator i; for (i = _list.begin(); i != _list.end(); ++i) { WalkingActionEntry *e = *i; @@ -4429,7 +4429,7 @@ void PathFinder::loadFromStream(Common::ReadStream *stream) { /* */ /*-------------------------------------------------------------------------*/ -// finds a list of character animations whose base area are impinging +// finds a list of character animations whose base area are impinging // that of the specified character (ie. are bumping into them) int Support::findIntersectingCharacters(Hotspot &h, uint16 *charList) { @@ -4446,10 +4446,10 @@ int Support::findIntersectingCharacters(Hotspot &h, uint16 *charList) { HotspotList::iterator i; for (i = res.activeHotspots().begin(); i != res.activeHotspots().end(); ++i) { Hotspot &hotspot = **i; - + // Check for basic reasons to skip checking the animation if ((h.hotspotId() == hotspot.hotspotId()) || (hotspot.layer() == 0) || - (h.roomNumber() != hotspot.roomNumber()) || + (h.roomNumber() != hotspot.roomNumber()) || (hotspot.hotspotId() >= FIRST_NONCHARACTER_ID) || hotspot.skipFlag()) continue; // TODO: See why si+ANIM_HOTSPOT_OFFSET compared aganst di+ANIM_VOICE_CTR @@ -4491,7 +4491,7 @@ bool Support::checkRoomChange(Hotspot &h) { if (exitRec->sequenceOffset != 0xffff) { Script::execute(exitRec->sequenceOffset); } else { - Support::characterChangeRoom(h, exitRec->roomNumber, + Support::characterChangeRoom(h, exitRec->roomNumber, exitRec->x, exitRec->y, exitRec->direction); } } @@ -4499,7 +4499,7 @@ bool Support::checkRoomChange(Hotspot &h) { return (exitRec != NULL); } -void Support::characterChangeRoom(Hotspot &h, uint16 roomNumber, +void Support::characterChangeRoom(Hotspot &h, uint16 roomNumber, int16 newX, int16 newY, Direction dir) { Resources &res = Resources::getReference(); Room &room = Room::getReference(); @@ -4554,12 +4554,12 @@ bool Support::charactersIntersecting(HotspotData *hotspot1, HotspotData *hotspot (hotspot2->startX + hotspot2->widthCopy + 4 < hotspot1->startX) || (hotspot2->startY + hotspot2->heightCopy - hotspot2->yCorrection - 2 >= hotspot1->startY + hotspot1->heightCopy + 2) || - (hotspot2->startY + hotspot2->heightCopy + 2 < + (hotspot2->startY + hotspot2->heightCopy + 2 < hotspot1->startY + hotspot1->heightCopy - hotspot1->yCorrection - 2)); } bool Support::isCharacterInList(uint16 *lst, int numEntries, uint16 charId) { - while (numEntries-- > 0) + while (numEntries-- > 0) if (*lst++ == charId) return true; return false; } diff --git a/engines/lure/hotspots.h b/engines/lure/hotspots.h index d07939c368..fcbaae1a13 100644 --- a/engines/lure/hotspots.h +++ b/engines/lure/hotspots.h @@ -41,10 +41,10 @@ class Support { private: static bool changeRoomCheckBumped(Hotspot &h); public: - static int findIntersectingCharacters(Hotspot &h, uint16 *charList); + static int findIntersectingCharacters(Hotspot &h, uint16 *charList); static bool checkForIntersectingCharacter(Hotspot &h); static bool checkRoomChange(Hotspot &h); - static void characterChangeRoom(Hotspot &h, uint16 roomNumber, + static void characterChangeRoom(Hotspot &h, uint16 roomNumber, int16 newX, int16 newY, Direction dir); static bool charactersIntersecting(HotspotData *hotspot1, HotspotData *hotspot2); static bool isCharacterInList(uint16 *lst, int numEntries, uint16 charId); @@ -133,11 +133,11 @@ private: void processCell(uint16 *p); void scanLine(int numScans, int changeAmount, uint16 *&pEnd, int &v); - void add(Direction dir, int steps) { - _list.push_front(new WalkingActionEntry(dir, steps)); + void add(Direction dir, int steps) { + _list.push_front(new WalkingActionEntry(dir, steps)); } - void addBack(Direction dir, int steps) { - _list.push_back(new WalkingActionEntry(dir, steps)); + void addBack(Direction dir, int steps) { + _list.push_back(new WalkingActionEntry(dir, steps)); } public: PathFinder(Hotspot *h); @@ -209,8 +209,8 @@ private: uint8 _exitCtr; bool _walkFlag; uint16 _startRoomNumber; - uint16 _supportValue; - + uint16 _supportValue; + // Support methods uint16 getTalkId(HotspotData *charHotspot); void startTalk(HotspotData *charHotspot, uint16 id); @@ -245,19 +245,19 @@ private: void doBribe(HotspotData *hotspot); void doExamine(HotspotData *hotspot); void npcSetRoomAndBlockedOffset(HotspotData *hotspot); - void npcHeySir(HotspotData *hotspot); - void npcExecScript(HotspotData *hotspot); - void npcResetPausedList(HotspotData *hotspot); + void npcHeySir(HotspotData *hotspot); + void npcExecScript(HotspotData *hotspot); + void npcResetPausedList(HotspotData *hotspot); void npcSetRandomDest(HotspotData *hotspot); - void npcWalkingCheck(HotspotData *hotspot); - void npcSetSupportOffset(HotspotData *hotspot); + void npcWalkingCheck(HotspotData *hotspot); + void npcSetSupportOffset(HotspotData *hotspot); void npcSupportOffsetConditional(HotspotData *hotspot); - void npcDispatchAction(HotspotData *hotspot); - void npcTalkNpcToNpc(HotspotData *hotspot); - void npcPause(HotspotData *hotspot); + void npcDispatchAction(HotspotData *hotspot); + void npcTalkNpcToNpc(HotspotData *hotspot); + void npcPause(HotspotData *hotspot); void npcStartTalking(HotspotData *hotspot); void npcJumpAddress(HotspotData *hotspot); - + // Auxillaries void doLookAction(HotspotData *hotspot, Action action); public: @@ -276,9 +276,9 @@ public: HotspotData *resource() { return _data; } uint16 numFrames() { return _numFrames; } uint16 frameNumber() { return _frameNumber; } - void setFrameNumber(uint16 frameNum) { + void setFrameNumber(uint16 frameNum) { assert(frameNum < _numFrames); - _frameNumber = frameNum; + _frameNumber = frameNum; } void incFrameNumber(); Direction direction() { return _direction; } @@ -301,9 +301,9 @@ public: uint16 yCorrection() { return _yCorrection; } uint16 charRectY() { return _charRectY; } uint16 roomNumber() { return _roomNumber; } - uint16 talkScript() { + uint16 talkScript() { assert(_data); - return _data->talkScriptOffset; + return _data->talkScriptOffset; } uint16 hotspotScript() { return _hotspotScriptOffset; } uint8 layer() { return _layer; } @@ -313,8 +313,8 @@ public: void setPersistant(bool value) { _persistant = value; } uint8 colourOffset() { return _colourOffset; } void setColourOffset(uint8 value) { _colourOffset = value; } - void setRoomNumber(uint16 roomNum) { - _roomNumber = roomNum; + void setRoomNumber(uint16 roomNum) { + _roomNumber = roomNum; if (_data) _data->roomNumber = roomNum; } uint16 nameId(); @@ -324,13 +324,13 @@ public: void setDestPosition(int16 newX, int16 newY) { _destX = newX; _destY = newY; } void setDestHotspot(uint16 id) { _destHotspotId = id; } void setExitCtr(uint8 value) { _exitCtr = value; } - BlockedState blockedState() { + BlockedState blockedState() { assert(_data); - return _data->blockedState; + return _data->blockedState; } - void setBlockedState(BlockedState newState) { + void setBlockedState(BlockedState newState) { assert(_data); - _data->blockedState = newState; + _data->blockedState = newState; } bool blockedFlag() { assert(_data); @@ -347,20 +347,20 @@ public: _width = newWidth; _frameWidth = newWidth; } - void setHeight(uint16 newHeight) { + void setHeight(uint16 newHeight) { _height = newHeight; } void setHotspotScript(uint16 offset) { assert(_data != NULL); _hotspotScriptOffset = offset; - _data->hotspotScriptOffset = offset; + _data->hotspotScriptOffset = offset; } void setLayer(uint8 newLayer) { assert(_data != NULL); _layer = newLayer; _data->layer = newLayer; } - void setActions(uint32 newActions) { + void setActions(uint32 newActions) { assert(_data); _data->actions = newActions; } @@ -374,33 +374,33 @@ public: assert(_data != NULL); _data->characterMode = value; } - uint16 delayCtr() { + uint16 delayCtr() { assert(_data); - return _data->delayCtr; + return _data->delayCtr; } - void setDelayCtr(uint16 value) { + void setDelayCtr(uint16 value) { assert(_data); - _data->delayCtr = value; + _data->delayCtr = value; } - uint16 pauseCtr() { + uint16 pauseCtr() { assert(_data); return _data->pauseCtr; } - void setPauseCtr(uint16 value) { + void setPauseCtr(uint16 value) { assert(_data); _data->pauseCtr = value; } - VariantBool coveredFlag() { + VariantBool coveredFlag() { assert(_data); return _data->coveredFlag; } - void setCoveredFlag(VariantBool value) { + void setCoveredFlag(VariantBool value) { assert(_data); _data->coveredFlag = value; } - uint16 useHotspotId() { + uint16 useHotspotId() { assert(_data); - return _data->useHotspotId; + return _data->useHotspotId; } void setUseHotspotId(uint16 value) { assert(_data); @@ -438,29 +438,29 @@ public: void doAction(); void doAction(Action action, HotspotData *hotspot); - CurrentActionStack ¤tActions() { + CurrentActionStack ¤tActions() { assert(_data); - return _data->npcSchedule; + return _data->npcSchedule; } PathFinder &pathFinder() { return _pathFinder; } DestStructure &tempDest() { return _tempDest; } uint16 frameCtr() { return _frameCtr; } void setFrameCtr(uint16 value) { _frameCtr = value; } void decrFrameCtr() { if (_frameCtr > 0) --_frameCtr; } - uint8 actionCtr() { + uint8 actionCtr() { assert(_data); - return _data->actionCtr; + return _data->actionCtr; } - void setActionCtr(uint8 v) { + void setActionCtr(uint8 v) { assert(_data); - _data->actionCtr = v; + _data->actionCtr = v; } uint8 voiceCtr() { return _voiceCtr; } void setVoiceCtr(uint8 v) { _voiceCtr = v; } // Miscellaneous void doNothing(HotspotData *hotspot); - void converse(uint16 destCharacterId, uint16 messageId, bool srcStandStill = false, + void converse(uint16 destCharacterId, uint16 messageId, bool srcStandStill = false, bool destStandStill = false); void showMessage(uint16 messageId, uint16 destCharacterId = NOONE_ID); void scheduleConverse(uint16 destHotspot, uint16 messageId); diff --git a/engines/lure/intro.cpp b/engines/lure/intro.cpp index 2dd657e4b8..4d3e172dc5 100644 --- a/engines/lure/intro.cpp +++ b/engines/lure/intro.cpp @@ -60,10 +60,10 @@ bool Introduction::showScreen(uint16 screenId, uint16 paletteId, uint16 delaySiz screen.screen().loadScreen(screenId); screen.update(); Palette p(paletteId); - + if (isEGA) screen.setPalette(&p); else screen.paletteFadeIn(&p); - + bool result = interruptableDelay(delaySize); if (events.quitFlag) return true; @@ -81,7 +81,7 @@ bool Introduction::interruptableDelay(uint32 milliseconds) { Events &events = Events::getReference(); if (events.interruptableDelay(milliseconds)) { - if (events.type() == Common::EVENT_KEYDOWN) + if (events.type() == Common::EVENT_KEYDOWN) return events.event().kbd.keycode == 27; else if (events.type() == Common::EVENT_LBUTTONDOWN) return false; @@ -101,8 +101,8 @@ bool Introduction::show() { // Initial game company and then game screen for (int ctr = 0; start_screens[ctr]; ++ctr) - if (showScreen(start_screens[ctr], start_screens[ctr] + 1, 5000)) - return true; + if (showScreen(start_screens[ctr], start_screens[ctr] + 1, 5000)) + return true; PaletteCollection coll(0x32); Palette EgaPalette(0x1D); @@ -116,19 +116,19 @@ bool Introduction::show() { for (; curr_anim->resourceId; ++curr_anim) { // Handle sound selection if (curr_anim->soundNumber != 0xff) { - if (currentSound != 0xff) + if (currentSound != 0xff) // Stop the previous sound Sound.musicInterface_KillAll(); - + currentSound = curr_anim->soundNumber; Sound.musicInterface_Play(currentSound, 0); } bool fadeIn = curr_anim == anim_screens; - anim = new AnimationSequence(curr_anim->resourceId, - isEGA ? EgaPalette : coll.getPalette(curr_anim->paletteIndex), fadeIn, + anim = new AnimationSequence(curr_anim->resourceId, + isEGA ? EgaPalette : coll.getPalette(curr_anim->paletteIndex), fadeIn, (curr_anim->resourceId == 0x44) ? 4 : 7); - if (curr_anim->initialPause != 0) + if (curr_anim->initialPause != 0) if (interruptableDelay(curr_anim->initialPause * 1000 / 50)) return true; result = false; @@ -149,7 +149,7 @@ bool Introduction::show() { delete anim; if (result) { - Sound.musicInterface_KillAll(); + Sound.musicInterface_KillAll(); return true; } } @@ -165,7 +165,7 @@ bool Introduction::show() { if (result) break; } while (anim->step()); delete anim; - + if (!result) { // Show final introduction animation if (!isEGA) diff --git a/engines/lure/lure.cpp b/engines/lure/lure.cpp index 5ea6ed63dc..a798116ff7 100644 --- a/engines/lure/lure.cpp +++ b/engines/lure/lure.cpp @@ -67,9 +67,9 @@ int LureEngine::init() { // Check the version of the lure.dat file Common::File f; VersionStructure version; - if (!f.open(SUPPORT_FILENAME)) + if (!f.open(SUPPORT_FILENAME)) GUIError("Could not locate Lure support file"); - + f.seek(0xbf * 8); f.read(&version, sizeof(VersionStructure)); f.close(); @@ -78,7 +78,7 @@ int LureEngine::init() { GUIError("Error validating %s - file is invalid or out of date", SUPPORT_FILENAME); else if ((version.vMajor != LURE_DAT_MAJOR) || (version.vMinor != LURE_DAT_MINOR)) GUIError("Incorrect version of %s file - expected %d.%d but got %d.%d", - SUPPORT_FILENAME, LURE_DAT_MAJOR, LURE_DAT_MINOR, + SUPPORT_FILENAME, LURE_DAT_MAJOR, LURE_DAT_MINOR, version.vMajor, version.vMinor); _disk = new Disk(); @@ -164,7 +164,7 @@ const char *LureEngine::generateSaveName(int slotNumber) { bool LureEngine::saveGame(uint8 slotNumber, Common::String &caption) { Common::WriteStream *f = this->_saveFileMan->openForSaving( generateSaveName(slotNumber)); - if (f == NULL) + if (f == NULL) return false; f->write("lure", 5); @@ -188,7 +188,7 @@ bool LureEngine::saveGame(uint8 slotNumber, Common::String &caption) { bool LureEngine::loadGame(uint8 slotNumber) { Common::ReadStream *f = this->_saveFileMan->openForLoading( generateSaveName(slotNumber)); - if (f == NULL) + if (f == NULL) return false; // Check for header @@ -230,7 +230,7 @@ void LureEngine::GUIError(const char *msg, ...) { // Generate the full error message va_start(va, msg); vsnprintf(buffer, STRINGBUFLEN, msg, va); - va_end(va); + va_end(va); Engine::GUIErrorMessage(buffer); exit(1); diff --git a/engines/lure/lure.h b/engines/lure/lure.h index 576e85f725..b4a131ed62 100644 --- a/engines/lure/lure.h +++ b/engines/lure/lure.h @@ -65,7 +65,7 @@ public: LureEngine(OSystem *system, const LureGameDescription *gameDesc); ~LureEngine(); static LureEngine &getReference(); - + virtual int init(); virtual int go(); void quitGame(); diff --git a/engines/lure/luredefs.h b/engines/lure/luredefs.h index 5940c1ea41..603102a099 100644 --- a/engines/lure/luredefs.h +++ b/engines/lure/luredefs.h @@ -123,7 +123,7 @@ enum Action { // Palette colour increment amouns for palette fade in/outs #define PALETTE_FADE_INC_SIZE 4 -// EGA constants +// EGA constants #define EGA_PALETTE_SIZE 16 #define EGA_NUM_LAYERS 4 #define EGA_PIXELS_PER_BYTE 8 diff --git a/engines/lure/menu.cpp b/engines/lure/menu.cpp index 40eae20693..9e5f0e6f23 100644 --- a/engines/lure/menu.cpp +++ b/engines/lure/menu.cpp @@ -45,7 +45,7 @@ MenuRecord::MenuRecord(const MenuRecordBounds *bounds, int numParams, ...) { va_list params; _numEntries = numParams; - _entries = (const char **) malloc(sizeof(const char *) * _numEntries); + _entries = (const char **) malloc(sizeof(const char *) * _numEntries); va_start(params, numParams); for (int index = 0; index < _numEntries; ++index) @@ -86,13 +86,13 @@ Menu::Menu() { delete data; const MenuRecordLanguage *rec = &menuList[0]; - while ((rec->language != UNK_LANG) && (rec->language != language)) + while ((rec->language != UNK_LANG) && (rec->language != language)) ++rec; if (rec->language == UNK_LANG) error("Unknown language encountered in top line handler"); _menus[0] = new MenuRecord(&rec->menus[0], 1, sl.getString(S_CREDITS)); - _menus[1] = new MenuRecord(&rec->menus[1], 3, + _menus[1] = new MenuRecord(&rec->menus[1], 3, sl.getString(S_RESTART_GAME), sl.getString(S_SAVE_GAME), sl.getString(S_RESTORE_GAME)); _menus[2] = new MenuRecord(&rec->menus[2], 3, sl.getString(S_QUIT), sl.getString(S_SLOW_TEXT), sl.getString(S_SOUND_ON)); @@ -116,7 +116,7 @@ uint8 Menu::execute() { Screen &screen = Screen::getReference(); mouse.setCursorNum(CURSOR_ARROW); - system.copyRectToScreen(_menu->data(), FULL_SCREEN_WIDTH, 0, 0, + system.copyRectToScreen(_menu->data(), FULL_SCREEN_WIDTH, 0, 0, FULL_SCREEN_WIDTH, MENUBAR_Y_SIZE); _selectedMenu = NULL; @@ -138,7 +138,7 @@ uint8 Menu::execute() { delete _surfaceMenu; _surfaceMenu = NULL; _selectedIndex = 0; - } + } _selectedMenu = p; @@ -146,12 +146,12 @@ uint8 Menu::execute() { if (_selectedMenu) { toggleHighlight(_selectedMenu); _surfaceMenu = Surface::newDialog( - _selectedMenu->width(), _selectedMenu->numEntries(), + _selectedMenu->width(), _selectedMenu->numEntries(), _selectedMenu->entries(), false, DEFAULT_TEXT_COLOUR, false); _surfaceMenu->copyToScreen(_selectedMenu->xstart(), MENUBAR_Y_SIZE); } - system.copyRectToScreen(_menu->data(), FULL_SCREEN_WIDTH, 0, 0, + system.copyRectToScreen(_menu->data(), FULL_SCREEN_WIDTH, 0, 0, FULL_SCREEN_WIDTH, MENUBAR_Y_SIZE); } } @@ -172,12 +172,12 @@ uint8 Menu::execute() { if (_surfaceMenu) delete _surfaceMenu; // Deselect the currently selected menu header - if (_selectedMenu) + if (_selectedMenu) toggleHighlight(_selectedMenu); // Restore the previous screen screen.update(); - + if ((_selectedMenu == NULL) || (_selectedIndex == 0)) return MENUITEM_NONE; else if (_selectedMenu == _menus[0]) return MENUITEM_CREDITS; @@ -201,11 +201,11 @@ uint8 Menu::execute() { } } return MENUITEM_NONE; -} +} MenuRecord *Menu::getMenuAt(int x) { for (int ctr = 0; ctr < NUM_MENUS; ++ctr) - if ((x >= _menus[ctr]->hsxstart()) && (x <= _menus[ctr]->hsxend())) + if ((x >= _menus[ctr]->hsxstart()) && (x <= _menus[ctr]->hsxend())) return _menus[ctr]; return NULL; @@ -244,7 +244,7 @@ void Menu::toggleHighlightItem(uint8 index) { const byte colourList[4] = {EGA_DIALOG_TEXT_COLOUR, EGA_DIALOG_WHITE_COLOUR, VGA_DIALOG_TEXT_COLOUR, VGA_DIALOG_WHITE_COLOUR}; const byte *colours = LureEngine::getReference().isEGA() ? &colourList[0] : &colourList[2]; - byte *p = _surfaceMenu->data().data() + (Surface::textY() + + byte *p = _surfaceMenu->data().data() + (Surface::textY() + ((index - 1) * FONT_HEIGHT)) * _surfaceMenu->width() + Surface::textX(); int numBytes =_surfaceMenu->width() - Surface::textX() * 2; @@ -280,7 +280,7 @@ uint16 PopupMenu::ShowInventory() { strings.getString(hotspot->nameId, hotspotName); } } - + uint16 result = Show(numItems, const_cast<const char **>(itemNames)); if (result != 0xffff) result = idList[result]; @@ -336,16 +336,16 @@ uint16 PopupMenu::ShowItems(Action contextAction, uint16 roomNumber) { for (ih = hotspots.begin(); ih != hotspots.end(); ++ih) { HotspotData *hotspot = *ih; - if ((hotspot->headerFlags != 15) && + if ((hotspot->headerFlags != 15) && ((hotspot->headerFlags & fields.hdrFlagMask()) == 0)) continue; if (((hotspot->flags & HOTSPOTFLAG_MENU_EXCLUSION) != 0) || ((hotspot->flags & HOTSPOTFLAG_FOUND) == 0)) - // Skip the current hotspot + // Skip the current hotspot continue; // If the hotspot is room specific, skip if the character will not be in the specified room - if (((hotspot->flags & HOTSPOTFLAG_ROOM_SPECIFIC) != 0) && + if (((hotspot->flags & HOTSPOTFLAG_ROOM_SPECIFIC) != 0) && (hotspot->roomNumber != roomNumber)) continue; @@ -374,7 +374,7 @@ uint16 PopupMenu::ShowItems(Action contextAction, uint16 roomNumber) { ++numItems; } - if (numItems == 0) + if (numItems == 0) // No items, so add a 'nothing' to the statusLine strcat(room.statusLine(), "(nothing)"); @@ -454,7 +454,7 @@ Action PopupMenu::Show(int numEntries, Action *actions) { for (int index = 0; index < numEntries; ++index) strList[index] = stringList.getString(*actionPtr++); uint16 result = Show(numEntries, strList); - + delete strList; if (result == 0xffff) return NONE; else return actions[result]; @@ -524,7 +524,7 @@ uint16 PopupMenu::Show(int numEntries, const char *actions[]) { #endif if ((actionIndex >= 0) && (actionIndex < numEntries)) { s->writeString(Surface::textX(), Surface::textY() + index * FONT_HEIGHT, - actions[actionIndex], true, + actions[actionIndex], true, #ifndef LURE_CLICKABLE_MENUS (index == (numLines / 2)) ? whiteColour : textColour, #else @@ -562,7 +562,7 @@ uint16 PopupMenu::Show(int numEntries, const char *actions[]) { if (((keycode == Common::KEYCODE_KP8) || (keycode == Common::KEYCODE_UP)) && (selectedIndex > 0)) { --selectedIndex; refreshFlag = true; - } else if (((keycode == Common::KEYCODE_KP2) || (keycode == Common::KEYCODE_DOWN)) && + } else if (((keycode == Common::KEYCODE_KP2) || (keycode == Common::KEYCODE_DOWN)) && (selectedIndex < numEntries-1)) { ++selectedIndex; refreshFlag = true; diff --git a/engines/lure/module.mk b/engines/lure/module.mk index e508684344..6b8bf35b77 100644 --- a/engines/lure/module.mk +++ b/engines/lure/module.mk @@ -29,6 +29,6 @@ ifdef BUILD_PLUGINS PLUGIN := 1 endif -# Include common rules +# Include common rules include $(srcdir)/rules.mk diff --git a/engines/lure/palette.cpp b/engines/lure/palette.cpp index 48bfb60db7..03161032c0 100644 --- a/engines/lure/palette.cpp +++ b/engines/lure/palette.cpp @@ -46,7 +46,7 @@ Palette::Palette(uint16 srcNumEntries, const byte *srcData, PaletteSource palett _palette = Memory::allocate(_numEntries * 4); if (srcData) { - if (paletteSource == RGB64) + if (paletteSource == RGB64) convertRgb64Palette(srcData, _numEntries); else if (paletteSource == EGA) { assert((srcNumEntries == 16) || (srcNumEntries == 17)); @@ -74,7 +74,7 @@ Palette::Palette(Palette &src) { Palette::Palette(uint16 resourceId, PaletteSource paletteSource) { Disk &disk = Disk::getReference(); bool isEGA = LureEngine::getReference().isEGA(); - MemoryBlock *srcData = disk.getEntry(resourceId); + MemoryBlock *srcData = disk.getEntry(resourceId); if (paletteSource == DEFAULT) paletteSource = isEGA ? EGA : RGB64; @@ -84,7 +84,7 @@ Palette::Palette(uint16 resourceId, PaletteSource paletteSource) { // Handle EGA palette if ((srcData->size() != 16) && (srcData->size() != 17)) error("Specified resource %d is not a palette", resourceId); - + _numEntries = 16; _palette = Memory::allocate(_numEntries * 4); convertEGAPalette(srcData->data()); @@ -159,7 +159,7 @@ uint32 Palette::getEntry(uint8 index) { return *entry; } -void Palette::copyFrom(Palette *src) { +void Palette::copyFrom(Palette *src) { _palette->copyFrom(src->palette()); } diff --git a/engines/lure/palette.h b/engines/lure/palette.h index bf8b8e50e2..1481e22775 100644 --- a/engines/lure/palette.h +++ b/engines/lure/palette.h @@ -52,7 +52,7 @@ public: uint16 numEntries() { return _palette->size() / 4; } void setEntry(uint8 index, uint32 value); uint32 getEntry(uint8 index); - void copyFrom(Palette *src); + void copyFrom(Palette *src); }; class PaletteCollection { diff --git a/engines/lure/res.cpp b/engines/lure/res.cpp index a957fcf22f..ec8d95676c 100644 --- a/engines/lure/res.cpp +++ b/engines/lure/res.cpp @@ -116,7 +116,7 @@ void Resources::reloadData() { // Get the palette subset data _paletteSubset = isEGA ? NULL : new Palette(ALT_PALETTE_RESOURCE_ID); - // Load room data + // Load room data mb = d.getEntry(ROOM_DATA_RESOURCE_ID); paths = d.getEntry(ROOM_PATHS_RESOURCE_ID); @@ -150,11 +150,11 @@ void Resources::reloadData() { for (;;) { offsetVal = READ_LE_UINT16(mb->data() + (ctr * 2)); if (offsetVal == 0xffff) break; - + if (offsetVal != 0) { RoomData *room = getRoom(ctr); if (room) { - RoomExitHotspotResource *re = (RoomExitHotspotResource *) + RoomExitHotspotResource *re = (RoomExitHotspotResource *) (mb->data() + offsetVal); while (READ_LE_UINT16(&re->hotspotId) != 0xffff) { RoomExitHotspotData *newEntry = new RoomExitHotspotData(re); @@ -187,7 +187,7 @@ void Resources::reloadData() { while (READ_LE_UINT16(offset++) != 0xffff) ++numCharOffsets; _charOffsets = new uint16[numCharOffsets]; offset = (uint16 *) mb->data(); - for (ctr = 0; ctr < numCharOffsets; ++ctr, ++offset) + for (ctr = 0; ctr < numCharOffsets; ++ctr, ++offset) _charOffsets[ctr] = READ_LE_UINT16(offset); // Next load up the list of random actions your follower can do in each room @@ -262,7 +262,7 @@ void Resources::reloadData() { mb = d.getEntry(HOTSPOT_SCRIPT_LIST_RESOURCE_ID); uint16 numEntries = mb->size() / 2; uint16 *srcVal = (uint16 *) mb->data(); - uint16 *destVal = _hotspotScriptData = (uint16 *) + uint16 *destVal = _hotspotScriptData = (uint16 *) Memory::alloc(numEntries * sizeof(uint16)); for (ctr = 0; ctr < numEntries; ++ctr, ++srcVal, ++destVal) { *destVal = READ_LE_UINT16(srcVal); @@ -298,7 +298,7 @@ void Resources::reloadData() { // Read in the talk data entries mb = d.getEntry(TALK_DATA_RESOURCE_ID); - + // First get the list of give talk Ids v = (uint16 *) mb->data(); @@ -334,7 +334,7 @@ void Resources::reloadData() { // Load in the list of room exit coordinates mb = d.getEntry(EXIT_COORDINATES_RESOURCE_ID); - RoomExitCoordinateEntryResource *coordRec = (RoomExitCoordinateEntryResource *) mb->data(); + RoomExitCoordinateEntryResource *coordRec = (RoomExitCoordinateEntryResource *) mb->data(); while (READ_LE_UINT16(coordRec) != 0xffff) { RoomExitCoordinates *newEntry = new RoomExitCoordinates(coordRec); _coordinateList.push_back(newEntry); @@ -371,7 +371,7 @@ void Resources::reloadData() { RoomExitJoinData *Resources::getExitJoin(uint16 hotspotId) { RoomExitJoinList::iterator i; - + for (i = _exitJoins.begin(); i != _exitJoins.end(); ++i) { RoomExitJoinData *rec = *i; if ((rec->hotspots[0].hotspotId == hotspotId) || (rec->hotspots[1].hotspotId == hotspotId)) @@ -400,7 +400,7 @@ RoomData *Resources::getRoom(uint16 roomNumber) { bool Resources::checkHotspotExtent(HotspotData *hotspot) { uint16 roomNum = hotspot->roomNumber; RoomData *room = getRoom(roomNum); - return (hotspot->startX >= room->clippingXStart) && ((room->clippingXEnd == 0) || + return (hotspot->startX >= room->clippingXStart) && ((room->clippingXEnd == 0) || (hotspot->startX + 32 < room->clippingXEnd)); } @@ -409,7 +409,7 @@ void Resources::insertPaletteSubset(Palette &p) { p.palette()->copyFrom(_paletteSubset->palette(), 60*4, 220*4, 8*4); } -byte *Resources::getCursor(uint8 cursorNum) { +byte *Resources::getCursor(uint8 cursorNum) { if (!LureEngine::getReference().isEGA()) return _cursors->data() + (cursorNum * CURSOR_SIZE); @@ -503,7 +503,7 @@ int Resources::getAnimationIndex(HotspotAnimData *animData) { uint16 Resources::getHotspotAction(uint16 actionsOffset, Action action) { HotspotActionList *list = _actionsList.getActions(actionsOffset); uint16 offset = (!list) ? 0 : list->getActionOffset(action); - debugC(ERROR_DETAILED, kLureDebugHotspots, + debugC(ERROR_DETAILED, kLureDebugHotspots, "Resources::getHotspotAction actionsOffset=%xh result=%xh", actionsOffset, offset); return offset; } @@ -530,12 +530,12 @@ void Resources::setTalkingCharacter(uint16 id) { assert(charHotspot); charHotspot->talkDestCharacterId = 0; - if (_talkingCharacter != id) + if (_talkingCharacter != id) charHotspot->talkCountdown = 0; } - _talkingCharacter = id; - + _talkingCharacter = id; + if (_talkingCharacter != 0) { Hotspot *character = getActiveHotspot(id); assert(character); @@ -591,7 +591,7 @@ Hotspot *Resources::activateHotspot(uint16 hotspotId) { loadFlag = false; else // Make the notice be on-screen - res->startY = 85; + res->startY = 85; break; case 6: @@ -612,7 +612,7 @@ Hotspot *Resources::activateHotspot(uint16 hotspotId) { // Special post-load handling if (res->loadOffset == 3) hotspot->setPersistant(true); if (res->loadOffset == 5) hotspot->handleTalkDialog(); - + // TODO: Figure out why there's a room set in the animation decode for a range of characters, // particularly since it doesn't seem to match what happens in-game /* @@ -639,7 +639,7 @@ Hotspot *Resources::addHotspot(uint16 hotspotId) { Hotspot *hotspot = new Hotspot(hData); _activeHotspots.push_back(hotspot); - if (hotspotId < FIRST_NONCHARACTER_ID) { + if (hotspotId < FIRST_NONCHARACTER_ID) { // Default characters to facing upwards until they start moving hotspot->setDirection(UP); hotspot->setCharRectY(0); @@ -662,7 +662,7 @@ void Resources::deactivateHotspot(uint16 hotspotId, bool isDestId) { _activeHotspots.erase(i); break; } - + i++; } } @@ -676,7 +676,7 @@ void Resources::deactivateHotspot(Hotspot *hotspot) { _activeHotspots.erase(i); break; } - + i++; } } @@ -794,7 +794,7 @@ void Resources::loadFromStream(Common::ReadStream *stream) { debugC(ERROR_DETAILED, kLureDebugScripts, "Loading walkable paths"); _roomData.loadFromStream(stream); debugC(ERROR_DETAILED, kLureDebugScripts, "Loading delay list"); - _delayList.loadFromStream(stream); + _delayList.loadFromStream(stream); if (saveVersion >= 32) { debugC(ERROR_DETAILED, kLureDebugScripts, "Loading talk data"); diff --git a/engines/lure/res.h b/engines/lure/res.h index ac0430e32d..8e54135868 100644 --- a/engines/lure/res.h +++ b/engines/lure/res.h @@ -135,12 +135,12 @@ public: PausedCharacterList &pausedList() { return _pausedList; } BarmanLists &barmanLists() { return _barmanLists; } StringList &stringList() { return _stringList; } - uint16 getCharOffset(int index) { - if (index >= numCharOffsets) + uint16 getCharOffset(int index) { + if (index >= numCharOffsets) error("Invalid index %d passed to script engine support data offset list", index); if (index == 1) error("support data list index #1 was referenced - special handlng TODO"); - return _charOffsets[index]; + return _charOffsets[index]; } void copyCursorTo(Surface *s, uint8 cursorNum, int16 x, int16 y); @@ -149,7 +149,7 @@ public: TalkData *getTalkData() { return _activeTalkData; } void setTalkState(TalkState state) { _talkState = state; } TalkState getTalkState() { return _talkState; } - TalkSelections &getTalkSelections() { return _talkSelections; } + TalkSelections &getTalkSelections() { return _talkSelections; } TalkDialogDetails &getTalkDetails() { return _talkDetails; } void setTalkSelection(int index) { _talkSelection = index; } int getTalkSelection() { return _talkSelection; } @@ -164,8 +164,8 @@ public: } void setCurrentAction(Action action) { _currentAction = action; } Action getCurrentAction() { return _currentAction; } - const char *getCurrentActionStr() { - if (_currentAction > EXAMINE) + const char *getCurrentActionStr() { + if (_currentAction > EXAMINE) error("Invalid current action %d", _currentAction); return _stringList.getString(_currentAction); } diff --git a/engines/lure/res_struct.cpp b/engines/lure/res_struct.cpp index db2207445c..8ce8a14f69 100644 --- a/engines/lure/res_struct.cpp +++ b/engines/lure/res_struct.cpp @@ -32,7 +32,7 @@ namespace Lure { -extern const int actionNumParams[NPC_JUMP_ADDRESS+1] = {0, +extern const int actionNumParams[NPC_JUMP_ADDRESS+1] = {0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 2, 0, 1, 0, 1, 1, 1, 1, 0, 0, 2, 1, 1, 0, 0, 1, 1, 2, 2, 5, 2, 2, 1}; @@ -64,19 +64,19 @@ static const uint16 ewanExtraGraphic2[] = { static const BarEntry default_barList[3] = { {29, SID_ID, {{0, 0}, {0, 0}, {0, 0}, {0, 0}}, {&basicPolish[0], &sidsFetch[0], NULL, NULL}, 13, NULL}, {32, NELLIE_ID, {{0, 0}, {0, 0}, {0, 0}, {0, 0}}, {&nelliesScratch[0], &nelliesFetch[0], NULL, NULL}, 14, NULL}, - {35, EWAN_ID, {{0, 0}, {0, 0}, {0, 0}, {0, 0}}, {&ewansFetch[0], &ewansFetch[0], + {35, EWAN_ID, {{0, 0}, {0, 0}, {0, 0}, {0, 0}}, {&ewansFetch[0], &ewansFetch[0], &ewanExtraGraphic1[0], &ewanExtraGraphic2[0]}, 16, NULL} }; extern const RoomTranslationRecord roomTranslations[] = { - {0x1E, 0x13}, {0x07, 0x08}, {0x1C, 0x12}, {0x26, 0x0F}, - {0x27, 0x0F}, {0x28, 0x0F}, {0x29, 0x0F}, {0x22, 0x0A}, + {0x1E, 0x13}, {0x07, 0x08}, {0x1C, 0x12}, {0x26, 0x0F}, + {0x27, 0x0F}, {0x28, 0x0F}, {0x29, 0x0F}, {0x22, 0x0A}, {0x23, 0x13}, {0x24, 0x14}, {0x31, 0x2C}, {0x2F, 0x2C}, {0, 0}}; // Room data holding class -RoomData::RoomData(RoomResource *rec, MemoryBlock *pathData) { +RoomData::RoomData(RoomResource *rec, MemoryBlock *pathData) { roomNumber = READ_LE_UINT16(&rec->roomNumber); hdrFlags = rec->hdrFlags; @@ -116,7 +116,7 @@ RoomExitHotspotData::RoomExitHotspotData(RoomExitHotspotResource *rec) { // Room exit class RoomExitData::RoomExitData(RoomExitResource *rec) { - xs = READ_LE_INT16(&rec->xs); + xs = READ_LE_INT16(&rec->xs); ys = READ_LE_INT16(&rec->ys); xe = READ_LE_INT16(&rec->xe); ye = READ_LE_INT16(&rec->ye); @@ -126,16 +126,16 @@ RoomExitData::RoomExitData(RoomExitResource *rec) { y = READ_LE_INT16(&rec->newRoomY); switch (rec->direction) { - case 0x80: + case 0x80: direction = UP; break; - case 0x40: + case 0x40: direction = DOWN; break; - case 0x20: + case 0x20: direction = LEFT; break; - case 0x10: + case 0x10: direction = RIGHT; break; default: @@ -235,7 +235,7 @@ void RoomPathsData::decompress(RoomPathsDecompressedData &dataOut, int character for (int x = 0; x < (ROOM_PATHS_WIDTH / 8); ++x) { // Get next byte, which containing bits for 8 blocks - v = *pIn--; + v = *pIn--; for (int bitCtr = 0; bitCtr < 8; ++bitCtr) { bool isSet = (v & 1) != 0; @@ -243,7 +243,7 @@ void RoomPathsData::decompress(RoomPathsDecompressedData &dataOut, int character if (charState) { // Handling occupied characters adjusted for character width - if (isSet) + if (isSet) // Reset character counter charCtr = charWidth; @@ -345,7 +345,7 @@ void RoomExitJoinList::loadFromStream(ReadStream *stream) { if (hotspot1Id == 0xffff) error("Invalid room exit join list"); uint16 hotspot2Id = stream->readUint16LE(); - if ((rec->hotspots[0].hotspotId != hotspot1Id) || + if ((rec->hotspots[0].hotspotId != hotspot1Id) || (rec->hotspots[1].hotspotId != hotspot2Id)) break; @@ -578,7 +578,7 @@ MovementData::MovementData(MovementResource *rec) { // List of movement frames -bool MovementDataList::getFrame(uint16 currentFrame, int16 &xChange, +bool MovementDataList::getFrame(uint16 currentFrame, int16 &xChange, int16 &yChange, uint16 &nextFrame) { if (empty()) return false; bool foundFlag = false; @@ -619,8 +619,8 @@ HotspotActionList::HotspotActionList(uint16 id, byte *data) { data += 2; HotspotActionResource *actionRec = (HotspotActionResource *) data; - - for (int actionCtr = 0; actionCtr < numItems; ++actionCtr, + + for (int actionCtr = 0; actionCtr < numItems; ++actionCtr, GET_NEXT(actionRec, HotspotActionResource)) { HotspotActionData *actionEntry = new HotspotActionData(actionRec); @@ -662,8 +662,8 @@ TalkHeaderData::~TalkHeaderData() { } uint16 TalkHeaderData::getEntry(int index) { - if (index >= _numEntries) - error("Invalid talk index %d specified for hotspot %xh", + if (index >= _numEntries) + error("Invalid talk index %d specified for hotspot %xh", _numEntries, characterId); return _data[index]; } @@ -692,7 +692,7 @@ TalkEntryData *TalkData::getResponse(int index) { TalkEntryList::iterator i = responses.begin(); int v = index; while (v-- > 0) { - if (i == responses.end()) + if (i == responses.end()) error("Invalid talk response index %d specified", index); ++i; } @@ -707,7 +707,7 @@ void TalkDataList::saveToStream(WriteStream *stream) { for (i = begin(); i != end(); ++i) { TalkData *rec = *i; TalkEntryList::iterator i2; - + for (i2 = rec->entries.begin(); i2 != rec->entries.end(); ++i2) { TalkEntryData *entry = *i2; stream->writeUint16LE(entry->descId); @@ -720,7 +720,7 @@ void TalkDataList::loadFromStream(ReadStream *stream) { for (i = begin(); i != end(); ++i) { TalkData *rec = *i; TalkEntryList::iterator i2; - + for (i2 = rec->entries.begin(); i2 != rec->entries.end(); ++i2) { TalkEntryData *entry = *i2; entry->descId = stream->readUint16LE(); @@ -742,13 +742,13 @@ RoomExitCoordinates::RoomExitCoordinates(RoomExitCoordinateEntryResource *rec) { _entries[ctr].hotspotIndexId = (tempY >> 12) << 4; } - for (ctr = 0; ctr < ROOM_EXIT_COORDINATES_NUM_ROOMS; ++ctr) + for (ctr = 0; ctr < ROOM_EXIT_COORDINATES_NUM_ROOMS; ++ctr) _roomIndex[ctr] = rec->roomIndex[ctr]; } RoomExitCoordinates &RoomExitCoordinatesList::getEntry(uint16 roomNumber) { RoomExitCoordinatesList::iterator i = begin(); - while (--roomNumber > 0) + while (--roomNumber > 0) ++i; return **i; } @@ -822,7 +822,7 @@ void SequenceDelayList::saveToStream(WriteStream *stream) { for (i = begin(); i != end(); ++i) { SequenceDelayData *entry = *i; stream->writeUint16LE(entry->sequenceOffset); - stream->writeUint32LE((currTime > entry->timeoutCtr ) ? 0 : + stream->writeUint32LE((currTime > entry->timeoutCtr ) ? 0 : entry->timeoutCtr - currTime); stream->writeByte(entry->canClear); } @@ -851,14 +851,14 @@ CharacterScheduleEntry::CharacterScheduleEntry(Action theAction, ...) { va_list u_Arg; va_start(u_Arg, theAction); - for (int paramCtr = 0; paramCtr < actionNumParams[_action]; ++paramCtr) + for (int paramCtr = 0; paramCtr < actionNumParams[_action]; ++paramCtr) _params[paramCtr] = (uint16) va_arg(u_Arg, int); va_end(u_Arg); _numParams = actionNumParams[_action]; } -CharacterScheduleEntry::CharacterScheduleEntry(CharacterScheduleSet *parentSet, +CharacterScheduleEntry::CharacterScheduleEntry(CharacterScheduleSet *parentSet, CharacterScheduleResource *&rec) { _parent = parentSet; @@ -867,10 +867,10 @@ CharacterScheduleEntry::CharacterScheduleEntry(CharacterScheduleSet *parentSet, _action = (Action) READ_LE_UINT16(&rec->action); _numParams = actionNumParams[_action]; - for (int index = 0; index < _numParams; ++index) + for (int index = 0; index < _numParams; ++index) _params[index] = READ_LE_UINT16(&rec->params[index]); - rec = (CharacterScheduleResource *) ((byte *) rec + + rec = (CharacterScheduleResource *) ((byte *) rec + (_numParams + 1) * sizeof(uint16)); } @@ -894,7 +894,7 @@ void CharacterScheduleEntry::setDetails(Action theAction, ...) { va_list list; va_start(list, theAction); - for (int paramCtr = 0; paramCtr < actionNumParams[_action]; ++paramCtr) + for (int paramCtr = 0; paramCtr < actionNumParams[_action]; ++paramCtr) _params[paramCtr] = (uint16) va_arg(list, int); va_end(list); @@ -960,7 +960,7 @@ CharacterScheduleEntry *CharacterScheduleList::getEntry(uint16 id, CharacterSche --index; } - if (i == end()) + if (i == end()) error("Invalid index %d specified for support data set", id >> 8); currentSet = *i; } @@ -979,12 +979,12 @@ CharacterScheduleEntry *CharacterScheduleList::getEntry(uint16 id, CharacterSche } uint16 CharacterScheduleSet::getId(CharacterScheduleEntry *rec) { - // Return an Id for the entry based on the id of the set combined with the + // Return an Id for the entry based on the id of the set combined with the // index of the specific entry uint16 result = _id << 10; iterator i; - for (i = begin(); i != end(); ++i, ++result) + for (i = begin(); i != end(); ++i, ++result) if (*i == rec) break; if (i == end()) error("Parent child relationship missing in character schedule set"); @@ -1037,12 +1037,12 @@ void RandomActionSet::loadFromStream(Common::ReadStream *stream) { void RandomActionList::saveToStream(Common::WriteStream *stream) { - for (iterator i = begin(); i != end(); ++i) + for (iterator i = begin(); i != end(); ++i) (*i)->saveToStream(stream); } void RandomActionList::loadFromStream(Common::ReadStream *stream) { - for (iterator i = begin(); i != end(); ++i) + for (iterator i = begin(); i != end(); ++i) (*i)->loadFromStream(stream); } @@ -1098,13 +1098,13 @@ void PausedCharacterList::countdown() { --rec->counter; // Handle reflecting counter to hotspot - if (rec->destCharId < START_EXIT_ID) + if (rec->destCharId < START_EXIT_ID) rec->charHotspot->pauseCtr = rec->counter + 1; // If counter has reached zero, remove entry from list - if (rec->counter == 0) + if (rec->counter == 0) i = erase(i); - else + else ++i; } } @@ -1119,8 +1119,8 @@ void PausedCharacterList::scan(Hotspot &h) { if (rec->srcCharId == h.hotspotId()) { rec->counter = IDLE_COUNTDOWN_SIZE; - - if (rec->destCharId < START_EXIT_ID) + + if (rec->destCharId < START_EXIT_ID) rec->charHotspot->pauseCtr = IDLE_COUNTDOWN_SIZE; } } @@ -1138,7 +1138,7 @@ int PausedCharacterList::check(uint16 charId, int numImpinging, uint16 *impingin Hotspot *hotspot = res.getActiveHotspot(impingingList[index]); if ((!hotspot) || (!hotspot->currentActions().isEmpty() && (hotspot->currentActions().top().action() == EXEC_HOTSPOT_SCRIPT))) - // Entry is skipped if hotspot not present or is executing hotspot script + // Entry is skipped if hotspot not present or is executing hotspot script continue; // Scan through the pause list to see if there's a record for the @@ -1146,7 +1146,7 @@ int PausedCharacterList::check(uint16 charId, int numImpinging, uint16 *impingin bool foundEntry = false; for (i = res.pausedList().begin(); !foundEntry && (i != res.pausedList().end()); ++i) { PausedCharacter *rec = *i; - foundEntry = (rec->srcCharId == charId) && + foundEntry = (rec->srcCharId == charId) && (rec->destCharId == hotspot->hotspotId()); } @@ -1162,11 +1162,11 @@ int PausedCharacterList::check(uint16 charId, int numImpinging, uint16 *impingin // Add a new paused character entry PausedCharacter *entry = new PausedCharacter(charId, hotspot->hotspotId()); res.pausedList().push_back(entry); - charHotspot->setBlockedState(BS_INITIAL); + charHotspot->setBlockedState(BS_INITIAL); if (hotspot->hotspotId() < START_EXIT_ID) { - if ((charHotspot->characterMode() == CHARMODE_PAUSED) || - ((charHotspot->pauseCtr() == 0) && + if ((charHotspot->characterMode() == CHARMODE_PAUSED) || + ((charHotspot->pauseCtr() == 0) && (charHotspot->characterMode() == CHARMODE_NONE))) { if (hotspot->characterMode() != CHARMODE_WAIT_FOR_INTERACT) hotspot->resource()->scriptHotspotId = charId; @@ -1193,7 +1193,7 @@ BarmanLists::BarmanLists() { } void BarmanLists::reset() { - for (int index = 0; index < 3; ++index) + for (int index = 0; index < 3; ++index) _barList[index] = default_barList[index]; } @@ -1244,7 +1244,7 @@ void StringList::load(MemoryBlock *data) { for (int index = 0; index < _numEntries; ++index) { _entries[index] = p; - p += strlen(p) + 1; + p += strlen(p) + 1; } } @@ -1267,7 +1267,7 @@ void ValueTableData::reset() { _playerNewPos.roomNumber = 0; _playerNewPos.position.x = 0; _playerNewPos.position.y = 0; - _hdrFlagMask = 1; + _hdrFlagMask = 1; for (uint16 index = 0; index < NUM_VALUE_FIELDS; ++index) _fieldList[index] = 0; @@ -1309,7 +1309,7 @@ void ValueTableData::saveToStream(Common::WriteStream *stream) { stream->writeSint16LE(_playerNewPos.position.y); stream->writeUint16LE(_playerNewPos.roomNumber); stream->writeByte(_hdrFlagMask); - + // Write out the special fields for (int index = 0; index < NUM_VALUE_FIELDS; ++index) stream->writeUint16LE(_fieldList[index]); @@ -1322,7 +1322,7 @@ void ValueTableData::loadFromStream(Common::ReadStream *stream) { _playerNewPos.position.y = stream->readSint16LE(); _playerNewPos.roomNumber = stream->readUint16LE(); _hdrFlagMask = stream->readByte(); - + // Read in the field list for (int index = 0; index < NUM_VALUE_FIELDS; ++index) _fieldList[index] = stream->readUint16LE(); @@ -1333,16 +1333,16 @@ void ValueTableData::loadFromStream(Common::ReadStream *stream) { // Current action entry class methods CurrentActionEntry::CurrentActionEntry(CurrentAction newAction, uint16 roomNum) { - _action = newAction; - _supportData = NULL; + _action = newAction; + _supportData = NULL; _dynamicSupportData = false; _roomNumber = roomNum; } -CurrentActionEntry::CurrentActionEntry(CurrentAction newAction, CharacterScheduleEntry *data, uint16 roomNum) { +CurrentActionEntry::CurrentActionEntry(CurrentAction newAction, CharacterScheduleEntry *data, uint16 roomNum) { assert(data->parent() != NULL); - _action = newAction; - _supportData = data; + _action = newAction; + _supportData = data; _dynamicSupportData = false; _roomNumber = roomNum; } @@ -1360,7 +1360,7 @@ CurrentActionEntry::CurrentActionEntry(CurrentActionEntry *src) { _action = src->_action; _dynamicSupportData = src->_dynamicSupportData; _roomNumber = src->_roomNumber; - if (!_dynamicSupportData) + if (!_dynamicSupportData) _supportData = src->_supportData; else if (src->_supportData == NULL) _supportData = NULL; @@ -1426,7 +1426,7 @@ CurrentActionEntry *CurrentActionEntry::loadFromStream(ReadStream *stream) { uint16 *paramList = new uint16[numParams]; for (int index = 0; index < numParams; ++index) paramList[index] = stream->readUint16LE(); - + result->_supportData->setDetails2(action, numParams, paramList); delete paramList; } else { @@ -1459,7 +1459,7 @@ void CurrentActionStack::list(char *buffer) { } else printf("style=%d room#=%d", entry->action(), entry->roomNumber()); - + if (entry->hasSupportData()) { CharacterScheduleEntry &rec = entry->supportData(); @@ -1470,7 +1470,7 @@ void CurrentActionStack::list(char *buffer) { else printf(", action=%d params=", rec.action()); - if (rec.numParams() == 0) + if (rec.numParams() == 0) if (buffer) { strcat(buffer, "none"); buffer += strlen(buffer); @@ -1491,7 +1491,7 @@ void CurrentActionStack::list(char *buffer) { if (buffer) { sprintf(buffer, "%d", rec.param(ctr)); buffer += strlen(buffer); - } else + } else printf("%d", rec.param(ctr)); } } diff --git a/engines/lure/res_struct.h b/engines/lure/res_struct.h index bf518bf307..dca23add78 100644 --- a/engines/lure/res_struct.h +++ b/engines/lure/res_struct.h @@ -237,7 +237,7 @@ struct RoomExitIndexedHotspotResource { enum SoundDescFlags {SF_IN_USE = 1, SF_RESTORE = 2}; -// In desc entry, numChannels: bits 0-1 # roland, bits 2-3 #adlib, bits 4-5 #internal +// In desc entry, numChannels: bits 0-1 # roland, bits 2-3 #adlib, bits 4-5 #internal struct SoundDescResource { uint8 soundNumber; @@ -279,7 +279,7 @@ public: return result; } - typename Common_List::iterator erase(typename Common_List::iterator first, + typename Common_List::iterator erase(typename Common_List::iterator first, typename Common_List::iterator last) { while (first != last) @@ -290,7 +290,7 @@ public: T operator[](int index) { typename Common_List::iterator i = Common_List::begin(); - while (index-- > 0) + while (index-- > 0) ++i; return *i; } @@ -432,14 +432,14 @@ public: }; enum CharacterMode {CHARMODE_NONE, CHARMODE_HESITATE, CHARMODE_IDLE, CHARMODE_PAUSED, - CHARMODE_WAIT_FOR_PLAYER, CHARMODE_CONVERSING, CHARMODE_PLAYER_WAIT, + CHARMODE_WAIT_FOR_PLAYER, CHARMODE_CONVERSING, CHARMODE_PLAYER_WAIT, CHARMODE_WAIT_FOR_INTERACT, CHARMODE_INTERACTING, CHARMODE_SPECIAL_PLAYER}; enum BlockedState {BS_NONE, BS_INITIAL, BS_FINAL}; enum VariantBool {VB_INITIAL, VB_FALSE, VB_TRUE}; -enum CurrentAction {NO_ACTION, START_WALKING, DISPATCH_ACTION, EXEC_HOTSPOT_SCRIPT, +enum CurrentAction {NO_ACTION, START_WALKING, DISPATCH_ACTION, EXEC_HOTSPOT_SCRIPT, PROCESSING_PATH, WALKING}; class CharacterScheduleSet; @@ -453,7 +453,7 @@ private: public: CharacterScheduleEntry() { _action = NONE; _parent = NULL; } CharacterScheduleEntry(Action theAction, ...); - CharacterScheduleEntry(CharacterScheduleSet *parentSet, + CharacterScheduleEntry(CharacterScheduleSet *parentSet, CharacterScheduleResource *&rec); CharacterScheduleEntry(CharacterScheduleEntry *src); @@ -483,7 +483,7 @@ public: } CurrentAction action() { return _action; } - CharacterScheduleEntry &supportData() { + CharacterScheduleEntry &supportData() { if (!_supportData) error("Access made to non-defined action support record"); return *_supportData; } @@ -491,9 +491,9 @@ public: uint16 roomNumber() { return _roomNumber; } void setAction(CurrentAction newAction) { _action = newAction; } void setRoomNumber(uint16 roomNum) { _roomNumber = roomNum; } - void setSupportData(CharacterScheduleEntry *newRec) { + void setSupportData(CharacterScheduleEntry *newRec) { assert((newRec == NULL) || (newRec->parent() != NULL)); - _supportData = newRec; + _supportData = newRec; } void setSupportData(uint16 entryId); @@ -504,8 +504,8 @@ public: class CurrentActionStack { private: ManagedList<CurrentActionEntry *> _actions; - void validateStack() { - if (_actions.size() > 20) + void validateStack() { + if (_actions.size() > 20) error("NPC character got an excessive number of pending actions"); } public: @@ -554,7 +554,7 @@ class HotspotData { public: CurrentActionStack npcSchedule; HotspotData(HotspotResource *rec); - + uint16 hotspotId; uint16 nameId; uint16 descId; @@ -599,7 +599,7 @@ public: uint16 talkDestCharacterId; uint16 talkCountdown; uint16 pauseCtr; - uint16 useHotspotId; + uint16 useHotspotId; uint16 talkGate; uint16 actionHotspotId; uint16 talkOverride; @@ -639,7 +639,7 @@ public: class MovementDataList: public ManagedList<MovementData *> { public: - bool getFrame(uint16 currentFrame, int16 &xChange, int16 &yChange, + bool getFrame(uint16 currentFrame, int16 &xChange, int16 &yChange, uint16 &nextFrame); }; @@ -773,7 +773,7 @@ class CharacterScheduleSet: public ManagedList<CharacterScheduleEntry *> { private: uint16 _id; public: - CharacterScheduleSet(CharacterScheduleResource *rec, uint16 setId); + CharacterScheduleSet(CharacterScheduleResource *rec, uint16 setId); uint16 getId(CharacterScheduleEntry *rec); uint16 id() { return _id; } }; @@ -880,12 +880,12 @@ struct RoomTranslationRecord { extern const RoomTranslationRecord roomTranslations[]; -enum StringEnum {S_CREDITS = 25, S_RESTART_GAME = 26, S_SAVE_GAME = 27, S_RESTORE_GAME = 28, - S_QUIT = 29, S_FAST_TEXT = 30, S_SLOW_TEXT = 31, S_SOUND_ON = 32, S_SOUND_OFF = 33, - S_ACTION_NOTHING = 34, S_FOR = 35, S_TO = 36, S_ON = 37, S_AND_THEN = 38, S_FINISH = 39, - S_CONFIRM_YN = 40, S_YOU_ARE_CARRYING = 41, S_INV_NOTHING = 42, S_YOU_HAVE = 43, +enum StringEnum {S_CREDITS = 25, S_RESTART_GAME = 26, S_SAVE_GAME = 27, S_RESTORE_GAME = 28, + S_QUIT = 29, S_FAST_TEXT = 30, S_SLOW_TEXT = 31, S_SOUND_ON = 32, S_SOUND_OFF = 33, + S_ACTION_NOTHING = 34, S_FOR = 35, S_TO = 36, S_ON = 37, S_AND_THEN = 38, S_FINISH = 39, + S_CONFIRM_YN = 40, S_YOU_ARE_CARRYING = 41, S_INV_NOTHING = 42, S_YOU_HAVE = 43, S_GROAT = 44, S_GROATS = 45, - S_ARTICLE_LIST = 46}; + S_ARTICLE_LIST = 46}; class StringList { private: @@ -907,14 +907,14 @@ public: const char *getString(StringEnum sEnum) { return getString((int) sEnum); } }; -// The following class holds the field list used by the script engine as -// well as miscellaneous fields used by the game. +// The following class holds the field list used by the script engine as +// well as miscellaneous fields used by the game. #define NUM_VALUE_FIELDS 90 enum FieldName { - ROOM_NUMBER = 0, - CHARACTER_HOTSPOT_ID = 1, + ROOM_NUMBER = 0, + CHARACTER_HOTSPOT_ID = 1, USE_HOTSPOT_ID = 2, ACTIVE_HOTSPOT_ID = 3, SEQUENCE_RESULT = 4, diff --git a/engines/lure/room.cpp b/engines/lure/room.cpp index e13b5564bf..8fe9b85d1c 100644 --- a/engines/lure/room.cpp +++ b/engines/lure/room.cpp @@ -34,7 +34,7 @@ namespace Lure { static Room *int_room; -RoomLayer::RoomLayer(uint16 screenId, bool backgroundLayer): +RoomLayer::RoomLayer(uint16 screenId, bool backgroundLayer): Surface(FULL_SCREEN_WIDTH, FULL_SCREEN_HEIGHT) { Disk &disk = Disk::getReference(); byte *screenData = data().data(); @@ -76,7 +76,7 @@ RoomLayer::RoomLayer(uint16 screenId, bool backgroundLayer): // Check the cell for (int yP = 0; yP < RECT_SIZE; ++yP) { if (hasPixels) break; - byte *linePos = screenData + (cellY * RECT_SIZE + yP + MENUBAR_Y_SIZE) + byte *linePos = screenData + (cellY * RECT_SIZE + yP + MENUBAR_Y_SIZE) * FULL_SCREEN_WIDTH + (cellX * RECT_SIZE); for (int xP = 0; xP < RECT_SIZE; ++xP) { @@ -86,7 +86,7 @@ RoomLayer::RoomLayer(uint16 screenId, bool backgroundLayer): } } - _cells[cellY + NUM_EDGE_RECTS][cellX + NUM_EDGE_RECTS] = + _cells[cellY + NUM_EDGE_RECTS][cellX + NUM_EDGE_RECTS] = hasPixels ? cellIndex++ : 0xff; } } @@ -133,7 +133,7 @@ Room &Room::getReference() { void Room::leaveRoom() { Resources &r = Resources::getReference(); - // Scan through the hotspot list and remove any uneeded entries + // Scan through the hotspot list and remove any uneeded entries HotspotList &list = r.activeHotspots(); HotspotList::iterator i = list.begin(); @@ -155,7 +155,7 @@ void Room::loadRoomHotspots() { for (i = list.begin(); i != list.end(); ++i) { HotspotData *rec = *i; - if ((rec->hotspotId < 0x7530) && (rec->roomNumber == _roomNumber) && + if ((rec->hotspotId < 0x7530) && (rec->roomNumber == _roomNumber) && (rec->layer != 0)) r.activateHotspot(rec->hotspotId); } @@ -185,7 +185,7 @@ void Room::checkRoomHotspots() { bool skipFlag = (entry->roomNumber != _roomNumber); if (!skipFlag) { - skipFlag = (((entry->flags & HOTSPOTFLAG_FOUND) == 0) && + skipFlag = (((entry->flags & HOTSPOTFLAG_FOUND) == 0) && ((entry->flags & HOTSPOTFLAG_SKIP) != 0)) || ((entry->flags & HOTSPOTFLAG_MENU_EXCLUSION) != 0); } @@ -193,11 +193,11 @@ void Room::checkRoomHotspots() { if ((!skipFlag) && (entry->hotspotId < 0x409)) // For character hotspots, validate they're in clipping range skipFlag = !res.checkHotspotExtent(entry); - + if (!skipFlag && (entry->hotspotId >= 0x2710) && (entry->hotspotId <= 0x27ff)) { RoomExitJoinData *rec = res.getExitJoin(entry->hotspotId); if ((rec) && (!rec->blocked)) - // Hotspot is over a room exit, and it's not blocked, so don't + // Hotspot is over a room exit, and it's not blocked, so don't // register it as an active hotspot skipFlag = true; } @@ -215,15 +215,15 @@ void Room::checkRoomHotspots() { } else { // Check whether cursor is in default hospot area if ((currentX >= entry->startX) && (currentY >= entry->startY) && - (currentX < entry->startX + entry->widthCopy) && - (currentY < entry->startY + entry->height)) + (currentX < entry->startX + entry->widthCopy) && + (currentY < entry->startY + entry->height)) // Found hotspot entry break; } } } - if (i != list.end()) + if (i != list.end()) break; } @@ -292,9 +292,9 @@ void Room::addAnimation(Hotspot &h) { if (_showInfo) { int16 x = h.x(); int16 y = h.y(); - if ((x >= 0) && (x < FULL_SCREEN_WIDTH) && (y >= 0) && (y < FULL_SCREEN_HEIGHT)) + if ((x >= 0) && (x < FULL_SCREEN_WIDTH) && (y >= 0) && (y < FULL_SCREEN_HEIGHT)) sprintf(buffer, "%xh", h.hotspotId()); - + } } @@ -308,7 +308,7 @@ void Room::addLayers(Hotspot &h) { int16 yStart = hsY / RECT_SIZE; int16 yEnd = (hsY + h.heightCopy() - 1) / RECT_SIZE; int16 numY = yEnd - yStart + 1; - + if ((xStart < 0) || (yEnd < 0)) return; @@ -384,8 +384,8 @@ void Room::blockMerge() { } } } - } - } + } + } } void Room::layersPostProcess() { @@ -450,7 +450,7 @@ void Room::update() { List<Hotspot *>::iterator iTemp; for (i = hotspots.begin(); i != hotspots.end(); ++i) { Hotspot *h = i.operator*(); - if ((h->layer() != 1) || (h->roomNumber() != _roomNumber) || + if ((h->layer() != 1) || (h->roomNumber() != _roomNumber) || h->skipFlag() || !h->isActiveAnimation()) continue; int16 endY = h->y() + h->heightCopy(); @@ -458,7 +458,7 @@ void Room::update() { for (iTemp = tempList.begin(); iTemp != tempList.end(); ++iTemp) { Hotspot *hTemp = iTemp.operator*(); int16 tempY = hTemp->y() + hTemp->heightCopy(); - if (endY < tempY) break; + if (endY < tempY) break; } tempList.insert(iTemp, h); } @@ -477,18 +477,18 @@ void Room::update() { } } - // Show any active talk dialog + // Show any active talk dialog if (_talkDialog) { // Make sure the character is still active and in the viewing room Hotspot *talkCharacter = res.getActiveHotspot(res.getTalkingCharacter()); - if ((talkCharacter != NULL) && (talkCharacter->roomNumber() == _roomNumber)) + if ((talkCharacter != NULL) && (talkCharacter->roomNumber() == _roomNumber)) _talkDialog->copyTo(&s, _talkDialogX, _talkDialogY); } // Handle showing the status line if (!*_statusLine) { // No current status action being display - if (_hotspotId != 0) + if (_hotspotId != 0) s.writeString(0, 0, _hotspotName, false); } else { // Word wrap (if necessary) the status line and dispaly it @@ -507,7 +507,7 @@ void Room::update() { // Debug - if the bottle object is on layer 0FEh, then display it's surface Hotspot *displayHotspot = res.getActiveHotspot(BOTTLE_HOTSPOT_ID); - if ((displayHotspot != NULL) && (displayHotspot->layer() == 0xfe)) + if ((displayHotspot != NULL) && (displayHotspot->layer() == 0xfe)) displayHotspot->frames().copyTo(&s); // If show information is turned on, show extra debugging information @@ -518,7 +518,7 @@ void Room::update() { for (int yctr = 0; yctr < ROOM_PATHS_HEIGHT; ++yctr) { for (int xctr = 0; xctr < ROOM_PATHS_WIDTH; ++xctr) { /* - if (_roomData->paths.isOccupied(xctr, yctr)) + if (_roomData->paths.isOccupied(xctr, yctr)) s.fillRect(Rect(xctr * 8, yctr * 8 + 8, xctr * 8 + 7, yctr * 8 + 15), 255); */ uint16 v = tempLayer[(yctr + 1) * DECODED_PATHS_WIDTH + xctr + 1]; @@ -585,7 +585,7 @@ void Room::setRoomNumber(uint16 newRoomNumber, bool showOverlay) { _numLayers = _roomData->numLayers; if (showOverlay) ++_numLayers; - for (uint8 layerNum = 0; layerNum < _numLayers; ++layerNum) + for (uint8 layerNum = 0; layerNum < _numLayers; ++layerNum) _layers[layerNum] = new RoomLayer(_roomData->layers[layerNum], layerNum == 0); @@ -612,7 +612,7 @@ void Room::setRoomNumber(uint16 newRoomNumber, bool showOverlay) { loadRoomHotspots(); if (leaveFlag) { - // A previous room has been left - check if there are any seconds worth + // A previous room has been left - check if there are any seconds worth // of animations that need to be done in 'fast forward' if ((_roomData->exitTime != 0xffff) && (_roomData->exitTime != 0)) { // If time has passed, animation ticks needed before room is displayed @@ -667,7 +667,7 @@ void Room::checkCursor() { } else if (mouse.y() < MENUBAR_Y_SIZE) { // If viewing a room remotely, then don't change to the menu cursor if (oldRoomNumber != 0) return; - + newCursor = CURSOR_MENUBAR; } else if (_cursorState != CS_NONE) { // Currently in a special mode @@ -676,18 +676,18 @@ void Room::checkCursor() { } else { // Check for a highlighted hotspot checkRoomHotspots(); - + if (_hotspotId != 0) { newCursor = CURSOR_CROSS; } else { newCursor = checkRoomExits(); } - if (oldHotspotId != _hotspotId) + if (oldHotspotId != _hotspotId) StringData::getReference().getString(_hotspotNameId, _hotspotName); } - if (mouse.getCursorNum() != newCursor) + if (mouse.getCursorNum() != newCursor) mouse.setCursorNum(newCursor); } @@ -725,7 +725,7 @@ void Room::setTalkDialog(uint16 srcCharacterId, uint16 destCharacterId, uint16 u if (_talkDialogX < 0) _talkDialogX = 0; if (_talkDialogX + TALK_DIALOG_WIDTH >= FULL_SCREEN_WIDTH - 10) - _talkDialogX = FULL_SCREEN_WIDTH - 10 - TALK_DIALOG_WIDTH; + _talkDialogX = FULL_SCREEN_WIDTH - 10 - TALK_DIALOG_WIDTH; _talkDialogY = TALK_DIALOG_Y; debugC(ERROR_DETAILED, kLureDebugAnimations, "Room::setTalkDialog end"); @@ -737,11 +737,11 @@ void Room::setTalkDialog(uint16 srcCharacterId, uint16 destCharacterId, uint16 u bool Room::checkInTalkDialog() { // Make sure there is a talk dialog active if (!_talkDialog) return false; - + // Don't allow dialog close if it's still in progress if (_talkDialog->isBuilding()) return false; - // Only allow the dialog to be closable if it's the player talking, or + // Only allow the dialog to be closable if it's the player talking, or // someone talking to the player Resources &res = Resources::getReference(); uint16 talkerId = res.getTalkingCharacter(); @@ -763,9 +763,9 @@ bool Room::checkInTalkDialog() { } void Room::saveToStream(Common::WriteStream *stream) { - if (_talkDialog == NULL) + if (_talkDialog == NULL) stream->writeUint16LE(0); - else + else _talkDialog->saveToStream(stream); stream->writeUint16LE(_roomNumber); @@ -799,8 +799,8 @@ void Room::loadFromStream(Common::ReadStream *stream) { _cursorState = (CursorState) stream->readUint16LE(); } -void Room::reset() { - _roomNumber = 999; +void Room::reset() { + _roomNumber = 999; setTalkDialog(0, 0, 0, 0); _hotspotId = 0; diff --git a/engines/lure/screen.cpp b/engines/lure/screen.cpp index 15bd6d4913..35039be1a7 100644 --- a/engines/lure/screen.cpp +++ b/engines/lure/screen.cpp @@ -38,8 +38,8 @@ Screen &Screen::getReference() { return *int_disk; } -Screen::Screen(OSystem &system): _system(system), - _screen(new Surface(FULL_SCREEN_WIDTH, FULL_SCREEN_HEIGHT)), +Screen::Screen(OSystem &system): _system(system), + _screen(new Surface(FULL_SCREEN_WIDTH, FULL_SCREEN_HEIGHT)), _disk(Disk::getReference()), _palette(new Palette(GAME_PALETTE_RESOURCE_ID, RGB64)) { int_disk = this; @@ -105,7 +105,7 @@ void Screen::paletteFadeIn(Palette *p) { bool isDifferent = *pCurrent < *pFinal; if (isDifferent) { - if ((*pFinal - *pCurrent) < PALETTE_FADE_INC_SIZE) + if ((*pFinal - *pCurrent) < PALETTE_FADE_INC_SIZE) *pCurrent = *pFinal; else *pCurrent += PALETTE_FADE_INC_SIZE; @@ -136,7 +136,7 @@ void Screen::paletteFadeOut(int numEntries) { changed = false; for (uint32 palCtr = 0; palCtr < (uint32)(numEntries * PALETTE_FADE_INC_SIZE); ++palCtr, ++pTemp) { - if (palCtr % PALETTE_FADE_INC_SIZE == (PALETTE_FADE_INC_SIZE - 1)) + if (palCtr % PALETTE_FADE_INC_SIZE == (PALETTE_FADE_INC_SIZE - 1)) continue; bool isDifferent = *pTemp > 0; if (isDifferent) { diff --git a/engines/lure/scripts.cpp b/engines/lure/scripts.cpp index 1949ae5ad0..34b1dd3757 100644 --- a/engines/lure/scripts.cpp +++ b/engines/lure/scripts.cpp @@ -36,20 +36,20 @@ namespace Lure { -// This list of hotspot Ids are used by sequence method #5 to deallocate a set +// This list of hotspot Ids are used by sequence method #5 to deallocate a set // of hotspot Ids at once static const uint16 dealloc_list_1[] = {0x13F2, 0x418, 0x2711, 0x2712, 0x40D, 0x3EA, 0x411, 0}; static const uint16 dealloc_list_2[] = {0x2729, 0x272A, 0x272B, 0x272C, 0x272E, 0x272E, 0x272F, 0}; -static const uint16 dealloc_list_3[] = {0x3EF, 0x3E9, 0x3EB, 0x3EC, 0x3ED, 0x3EE, 0x3F0, 0x3F1, - 0x420, 0x429, 0x436, 0x2715, 0x2716, 0x2717, 0x2718, 0x2719, 0x271A, 0x271E, +static const uint16 dealloc_list_3[] = {0x3EF, 0x3E9, 0x3EB, 0x3EC, 0x3ED, 0x3EE, 0x3F0, 0x3F1, + 0x420, 0x429, 0x436, 0x2715, 0x2716, 0x2717, 0x2718, 0x2719, 0x271A, 0x271E, 0x271F, 0x2720, 0x2721, 0x2722, 0x2725, 0x2726, 0}; static const uint16 *hotspot_dealloc_set[4] = {&dealloc_list_1[0], &dealloc_list_2[0], &dealloc_list_3[1], &dealloc_list_3[0]}; // Details used for co-ordination of sounds during the endgame sequence static const AnimSoundSequence soundList[] = { - {9, 0x45, 2, 0}, {27, 0x48, 5, 0}, {24, 0x46, 3, 0}, {24, 0x37, 1, 0}, {3, 0x37, 1, 1}, - {3, 0x37, 1, 2}, {3, 0x37, 1, 3}, {3, 0x37, 1, 4}, {4, 0x37, 1, 5}, {7, 0x47, 4, 6}, + {9, 0x45, 2, 0}, {27, 0x48, 5, 0}, {24, 0x46, 3, 0}, {24, 0x37, 1, 0}, {3, 0x37, 1, 1}, + {3, 0x37, 1, 2}, {3, 0x37, 1, 3}, {3, 0x37, 1, 4}, {4, 0x37, 1, 5}, {7, 0x47, 4, 6}, {31, 0x00, 6, 0}, {0, 0, 0, 0} }; @@ -103,7 +103,7 @@ void Script::clearSequenceDelayList(uint16 v1, uint16 scriptIndex, uint16 v3) { // Deactivates a set of predefined of hotspots in a given list index void Script::deactivateHotspotSet(uint16 listIndex, uint16 v2, uint16 v3) { - if (listIndex > 3) + if (listIndex > 3) error("Script::deactiveHotspotSet - Invalid list index"); Resources &res = Resources::getReference(); const uint16 *hotspotId = hotspot_dealloc_set[listIndex]; @@ -130,12 +130,12 @@ void Script::resetPathfinder(uint16 v1, uint16 v2, uint16 v3) { void Script::deactivateHotspot(uint16 hotspotId, uint16 v2, uint16 v3) { Resources &rsc = Resources::getReference(); - if (hotspotId < START_NONVISUAL_HOTSPOT_ID) + if (hotspotId < START_NONVISUAL_HOTSPOT_ID) rsc.deactivateHotspot(hotspotId); HotspotData *hs = rsc.getHotspot(hotspotId); hs->roomNumber = 0xffff; hs->flags |= 0x20; - if (hotspotId < START_NONVISUAL_HOTSPOT_ID) + if (hotspotId < START_NONVISUAL_HOTSPOT_ID) hs->layer = 0xff; } @@ -321,7 +321,7 @@ void Script::characterChangeRoom(uint16 y, uint16 x, uint16 roomNumber) { uint16 newRoomNumber = roomNumber & 0xff; Direction newDirection = (Direction)(roomNumber >> 8); - Support::characterChangeRoom(*charHotspot, newRoomNumber, + Support::characterChangeRoom(*charHotspot, newRoomNumber, (int16) (x - 0x80), (int16) (y - 0x80), newDirection); } @@ -335,7 +335,7 @@ void Script::pauseRatpouch(uint16 v1, uint16 v2, uint16 v3) { ratpouch->setDelayCtr(0x7fff); } -// Sets a character to a given hotspot script, and sets the character's current +// Sets a character to a given hotspot script, and sets the character's current // action to executing a script void Script::setBlockingHotspotScript(uint16 charId, uint16 scriptIndex, uint16 v3) { @@ -361,7 +361,7 @@ void Script::decrInventoryItems(uint16 v1, uint16 v2, uint16 v3) { void Script::setTalking(uint16 characterId, uint16 destHotspot, uint16 messageId) { Hotspot *hotspot = Resources::getReference().getActiveHotspot(characterId); if (hotspot) - hotspot->converse(destHotspot, messageId, true, false); + hotspot->converse(destHotspot, messageId, true, false); } // Sets the current action ctr value for the given hotspot @@ -383,7 +383,7 @@ void Script::startSpeaking(uint16 characterId, uint16 destHotspot, uint16 messag void Script::disableHotspot(uint16 hotspotId, uint16 v2, uint16 v3) { HotspotData *hotspot = Resources::getReference().getHotspot(hotspotId); - hotspot->flags |= 0x20; + hotspot->flags |= 0x20; } // Called when the sack is cut with the knife @@ -437,7 +437,7 @@ void Script::transformPlayer(uint16 v1, uint16 v2, uint16 v3) { hotspot->roomNumber = player->roomNumber; hotspot->startX = player->startX - 14; hotspot->startY = player->startY - 10; - + Hotspot *activeHotspot = res.activateHotspot(TRANSFORM_ID); activeHotspot->setActionCtr(0); activeHotspot->setHotspotScript(0x630); @@ -450,7 +450,7 @@ void Script::townHallClose(uint16 v1, uint16 v2, uint16 v3) { joinRec->blocked = 1; } -// Sets the sequence result to 1 if the given secondary description for a +// Sets the sequence result to 1 if the given secondary description for a // hotspot is empty (for inventory items, this gives the description before // the item is initially picked up) @@ -471,7 +471,7 @@ void Script::makeGoewinFollow(uint16 v1, uint16 v2, uint16 v3) { hotspot->currentActions().clear(); CharacterScheduleEntry *entry = res.charSchedules().getEntry(GOEWIN_CAVE_SUPPORT_ID); hotspot->currentActions().addFront(DISPATCH_ACTION, entry, ROOMNUM_CAVE); - + hotspot->setActions(hotspot->resource()->actions | (1 << (TELL - 1))); hotspot->setActionCtr(0); hotspot->setDelayCtr(0); @@ -493,7 +493,7 @@ void Script::fixGoewin(uint16 v1, uint16 v2, uint16 v3) { Hotspot *hotspot = res.getActiveHotspot(GOEWIN_ID); assert(hotspot); hotspot->setTickProc(STANDARD_CHARACTER_TICK_PROC); - + CharacterScheduleEntry *entry = res.charSchedules().getEntry(GOEWIN_STANDARD_SUPPORT_ID); assert(entry); hotspot->currentActions().clear(); @@ -529,9 +529,9 @@ void Script::checkWakeBrenda(uint16 v1, uint16 v2, uint16 v3) { ValueTableData &fields = res.fieldList(); Room &room = Room::getReference(); - if ((fields.getField(TALK_INDEX) < 3) && + if ((fields.getField(TALK_INDEX) < 3) && (room.roomNumber() == ROOMNUM_DINING_HALL) && - (fields.getField(67) == 0)) + (fields.getField(67) == 0)) // Wake up Brenda Script::execute(0x1E15); } @@ -561,7 +561,7 @@ void Script::setNewSupportData(uint16 index, uint16 hotspotId, uint16 v3) { void Script::setSupportData(uint16 hotspotId, uint16 index, uint16 v3) { Resources &res = Resources::getReference(); - + // WORKAROUND: In room #45, the script for the Skorl noticing you gets // the parameters back to front. If this the case, just ignore it if (index == CASTLE_SKORL_ID) return; @@ -592,7 +592,7 @@ void Script::decreaseNumGroats(uint16 characterId, uint16 numGroats, uint16 v3) fields.numGroats() -= numGroats; } -// Makes Goewin work +// Makes Goewin work void Script::makeGoewinWork(uint16 v1, uint16 v2, uint16 v3) { Resources &res = Resources::getReference(); @@ -615,7 +615,7 @@ void Script::moveCharacterToPlayer(uint16 characterId, uint16 v2, uint16 v3) { Resources &res = Resources::getReference(); Hotspot *playerHotspot = res.getActiveHotspot(PLAYER_ID); Hotspot *charHotspot = res.getActiveHotspot(characterId); - assert(charHotspot); + assert(charHotspot); // If character in same room as player, then no need to do anything if (!charHotspot->currentActions().isEmpty() && @@ -623,7 +623,7 @@ void Script::moveCharacterToPlayer(uint16 characterId, uint16 v2, uint16 v3) { return; uint16 destRoom = playerHotspot->roomNumber(); - const RoomTranslationRecord *rec; + const RoomTranslationRecord *rec; for (rec = &roomTranslations[0]; rec->srcRoom != 0; ++rec) { if (rec->srcRoom == destRoom) { destRoom = rec->destRoom; @@ -660,7 +660,7 @@ void Script::barmanServe(uint16 v1, uint16 v2, uint16 v3) { Resources &res = Resources::getReference(); Hotspot *player = res.getActiveHotspot(PLAYER_ID); BarEntry &barEntry = res.barmanLists().getDetails(player->roomNumber()); - + for (int index = 0; index < NUM_SERVE_CUSTOMERS; ++index) { if (barEntry.customers[index].hotspotId == PLAYER_ID) { barEntry.customers[index].serveFlags |= 5; @@ -681,7 +681,7 @@ void Script::checkHasBook(uint16 v1, uint16 v2, uint16 v3) { HotspotData *bookHotspot = res.getHotspot(BOOK_ID); res.fieldList().setField(SEQUENCE_RESULT, (bookHotspot->roomNumber == PLAYER_ID) ? 1 : 0); } - + // Enables the talk action on the two gargoyles void Script::enableGargoylesTalk(uint16 v1, uint16 v2, uint16 v3) { @@ -767,7 +767,7 @@ struct SequenceMethodRecord { }; static const SequenceMethodRecord scriptMethods[] = { - {0, Script::activateHotspot}, + {0, Script::activateHotspot}, {1, Script::setHotspotScript}, {2, Script::addSound2}, {3, Script::setHotspotFlagMask}, @@ -844,31 +844,31 @@ static const char *scriptOpcodes[] = { }; static const char *scriptMethodNames[67] = { - "ACTIVATE HOTSPOT", "SET HOTSPOT SCRIPT", "ADD SOUND 2", "SET HOTSPOT FLAG MASK", - "CLEAR SEQUENCE DELAY LIST", "DEACTIVATE HOTSPOT SET", "DEACTIVATE HOTSPOT", + "ACTIVATE HOTSPOT", "SET HOTSPOT SCRIPT", "ADD SOUND 2", "SET HOTSPOT FLAG MASK", + "CLEAR SEQUENCE DELAY LIST", "DEACTIVATE HOTSPOT SET", "DEACTIVATE HOTSPOT", "RESET PATHFINDER", "ADD DELAYED SCRIPT", "KILL SOUND", "IS CHARACTER IN ROOM", "SET HOTSPOT DESC", "SET HOTSPOT NAME", - "ADD SOUND", "ENDGAME SEQUENCE", "SETUP PIG FIGHT", "DISPLAY DIALOG", "SETUP SKORL FIGHT", + "ADD SOUND", "ENDGAME SEQUENCE", "SETUP PIG FIGHT", "DISPLAY DIALOG", "SETUP SKORL FIGHT", "REMOTE ROOM VIEW SETUP", "SET CHAR SPEAKING TO ITSELF", "CHECK CELL DOOR", "PLAY MUSIC", "IS DOOR BLOCKED", "IS SKORL IN CELL", - "PUSH BRICKS", "CHARACTER CHANGE ROOM", "PAUSE RATPOUCH", "SET BLOCKING HOTSPOT SCRIPT", + "PUSH BRICKS", "CHARACTER CHANGE ROOM", "PAUSE RATPOUCH", "SET BLOCKING HOTSPOT SCRIPT", "DECREMENT # INVENTORY ITEMS", "SET TALKING", "SET ACTION CTR", "START SPEAKING", "DISABLE HOTSPOT", "CUT SACK", "INCREASE # GROATS", "ENABLE HOTSPOT", "DISPLAY MESSAGE 2", "START OIL BURNER", "TRANSFORM PLAYER", "JAIL CLOSE", - "CHECK DROPPED DESC", "MAKE GOEWIN FOLLOW", "CLOSE DOOR", "FIX GOEWIN", "OPEN DOOR", - "NPC WAIT", "BRENDA BODGE", "DISPLAY MESSAGE", "SET NEW ACTION SUPPORT DATA", + "CHECK DROPPED DESC", "MAKE GOEWIN FOLLOW", "CLOSE DOOR", "FIX GOEWIN", "OPEN DOOR", + "NPC WAIT", "BRENDA BODGE", "DISPLAY MESSAGE", "SET NEW ACTION SUPPORT DATA", "SET ACTION SUPPORT DATA", - + "GIVE PLAYER ITEM", "DECREASE # GROATS", "MAKE GOEWIN WORK", "MOVE CHAR TO PLAYER", - "SET VILLAGE SKORL TICK PROC", "FREE GOEWIN", "BARMAN SERVE", "GET # GROATS", + "SET VILLAGE SKORL TICK PROC", "FREE GOEWIN", "BARMAN SERVE", "GET # GROATS", "CHECK HAS BOOK", "ENABLE GARGOYLE TALK", - "NORMAL GOEWIN", "KILL PLAYER", "ANIMATION LOAD", "ADD ACTIONS", "RANDOM TO GENERAL", + "NORMAL GOEWIN", "KILL PLAYER", "ANIMATION LOAD", "ADD ACTIONS", "RANDOM TO GENERAL", "CHECK CELL DOOR", "METHOD 66" }; @@ -905,7 +905,7 @@ uint16 Script::execute(uint16 startOffset) { strcpy(debugInfo, ""); while (!breakFlag) { - if (offset >= scriptData->size()) + if (offset >= scriptData->size()) error("Script failure in script %d - invalid offset %d", startOffset, offset); if (gDebugLevel >= ERROR_DETAILED) @@ -922,14 +922,14 @@ uint16 Script::execute(uint16 startOffset) { if (hasParam) { // Flag to read next two bytes as active parameter - if (offset >= scriptData->size()-2) + if (offset >= scriptData->size()-2) error("Script failure in script %d - invalid offset %d", startOffset, offset); param = READ_LE_UINT16(scripts + offset); offset += 2; if (gDebugLevel >= ERROR_DETAILED) - sprintf(debugInfo + strlen(debugInfo), " [%d]", + sprintf(debugInfo + strlen(debugInfo), " [%d]", ((opcode == S_OPCODE_GET_FIELD) || (opcode == S_OPCODE_SET_FIELD)) ? param >> 1 : param); } @@ -950,10 +950,10 @@ uint16 Script::execute(uint16 startOffset) { case S_OPCODE_OR: case S_OPCODE_LOGICAL_AND: case S_OPCODE_LOGICAL_OR: - sprintf(debugInfo + strlen(debugInfo), + sprintf(debugInfo + strlen(debugInfo), " %d, %d", stack[stack.size() - 1], stack[stack.size() - 2]); break; - + case S_OPCODE_SET_FIELD: sprintf(debugInfo + strlen(debugInfo), " <= ST (%d)", stack[stack.size() - 1]); break; @@ -1091,7 +1091,7 @@ uint16 Script::execute(uint16 startOffset) { else if (stack.size() == 1) sprintf(debugInfo + strlen(debugInfo), " (%d)", stack[stack.size()-1]); strcat(debugInfo, ")"); - + debugC(ERROR_DETAILED, kLureDebugScripts, debugInfo); } @@ -1100,7 +1100,7 @@ uint16 Script::execute(uint16 startOffset) { if (!stack.empty()) param2 = stack.pop(); if (!stack.empty()) param3 = stack.pop(); - if (rec->methodIndex == 0xff) + if (rec->methodIndex == 0xff) warning("Undefined script method %d", param); else { ptr = rec->proc; @@ -1123,7 +1123,7 @@ uint16 Script::execute(uint16 startOffset) { case S_OPCODE_END: // Signal to end the execution - if (!methodStack.empty()) + if (!methodStack.empty()) offset = methodStack.pop(); else breakFlag = true; @@ -1167,7 +1167,7 @@ uint16 Script::execute(uint16 startOffset) { } uint16 result = fields.getField(SEQUENCE_RESULT); - debugC(ERROR_DETAILED, kLureDebugScripts, "Script result = %d", result); + debugC(ERROR_DETAILED, kLureDebugScripts, "Script result = %d", result); return result; } @@ -1177,7 +1177,7 @@ uint16 Script::execute(uint16 startOffset) { /*------------------------------------------------------------------------*/ int16 HotspotScript::nextVal(MemoryBlock *data, uint16 &offset) { - if (offset >= data->size() - 1) + if (offset >= data->size() - 1) error("Script failure - invalid offset"); int16 value = READ_LE_UINT16(data->data() + offset); offset += 2; @@ -1194,7 +1194,7 @@ bool HotspotScript::execute(Hotspot *h) { uint32 actions; bool breakFlag = false; - debugC(ERROR_BASIC, kLureDebugScripts, "Executing hotspot %xh script pos=%xh", + debugC(ERROR_BASIC, kLureDebugScripts, "Executing hotspot %xh script pos=%xh", h->hotspotId(), offset); while (!breakFlag) { @@ -1213,16 +1213,16 @@ bool HotspotScript::execute(Hotspot *h) { case S2_OPCODE_POSITION: param1 = nextVal(scriptData, offset); param2 = nextVal(scriptData, offset); - debugC(ERROR_DETAILED, kLureDebugScripts, "SET POSITION = (%d,%d)", + debugC(ERROR_DETAILED, kLureDebugScripts, "SET POSITION = (%d,%d)", param1 - 0x80, param2 - 0x80); h->setPosition(param1 - 0x80, param2 - 0x80); break; - + case S2_OPCODE_CHANGE_POS: param1 = nextVal(scriptData, offset); param2 = nextVal(scriptData, offset); - debugC(ERROR_DETAILED, kLureDebugScripts, "CHANGE POSITION BY = (%d,%d)", + debugC(ERROR_DETAILED, kLureDebugScripts, "CHANGE POSITION BY = (%d,%d)", param1, param2); h->setPosition(h->x() + param1, h->y() + param2); diff --git a/engines/lure/sound.cpp b/engines/lure/sound.cpp index afb2928bf8..0a0ae3d34d 100644 --- a/engines/lure/sound.cpp +++ b/engines/lure/sound.cpp @@ -202,10 +202,10 @@ void SoundManager::addSound(uint8 soundIndex, bool tidyFlag) { ++channelCtr2; } - if (foundSpace) + if (foundSpace) break; } - + ++channelCtr; } @@ -229,7 +229,7 @@ void SoundManager::addSound(uint8 soundIndex, bool tidyFlag) { // Map each two channels to four of the 16 available channels byte innerChannel = (channelCtr / 2) * 4; musicInterface_Play(rec.soundNumber, innerChannel); - setVolume(rec.soundNumber, rec.volume); + setVolume(rec.soundNumber, rec.volume); } void SoundManager::addSound2(uint8 soundIndex) { @@ -261,12 +261,12 @@ void SoundManager::killSound(uint8 soundNumber) { } void SoundManager::setVolume(uint8 soundNumber, uint8 volume) { - debugC(ERROR_BASIC, kLureDebugSounds, "SoundManager::setVolume soundNumber=%d, volume=%d", + debugC(ERROR_BASIC, kLureDebugSounds, "SoundManager::setVolume soundNumber=%d, volume=%d", soundNumber, volume); musicInterface_TidySounds(); SoundDescResource *entry = findSound(soundNumber); - if (entry) + if (entry) musicInterface_SetVolume(entry->channel, volume); } @@ -281,7 +281,7 @@ void SoundManager::setVolume(uint8 volume) { uint8 SoundManager::descIndexOf(uint8 soundNumber) { SoundDescResource *rec = soundDescs(); - + for (uint8 index = 0; index < _numDescs; ++index, ++rec) { if (rec->soundNumber == soundNumber) return index; @@ -321,7 +321,7 @@ void SoundManager::tidySounds() { else { // Mark the channels that it used as now being free Common::set_to(_channelsInUse+rec->channel, _channelsInUse+rec->channel+rec->numChannels, false); - + i = _activeSounds.erase(i); } } @@ -336,7 +336,7 @@ void SoundManager::removeSounds() { while (i != _activeSounds.end()) { SoundDescResource *rec = *i; - if ((rec->flags & SF_IN_USE) != 0) + if ((rec->flags & SF_IN_USE) != 0) musicInterface_Stop(rec->soundNumber); ++i; @@ -396,7 +396,7 @@ void SoundManager::fadeOut() { // Play the specified sound void SoundManager::musicInterface_Play(uint8 soundNumber, uint8 channelNumber) { - debugC(ERROR_INTERMEDIATE, kLureDebugSounds, "musicInterface_Play soundNumber=%d, channel=%d", + debugC(ERROR_INTERMEDIATE, kLureDebugSounds, "musicInterface_Play soundNumber=%d, channel=%d", soundNumber, channelNumber); Game &game = Game::getReference(); @@ -404,7 +404,7 @@ void SoundManager::musicInterface_Play(uint8 soundNumber, uint8 channelNumber) { error("Sound section has not been specified"); uint8 soundNum = soundNumber & 0x7f; - if (soundNum > _soundsTotal) + if (soundNum > _soundsTotal) error("Invalid sound index %d requested", soundNum); if (_driver == NULL) @@ -430,10 +430,10 @@ void SoundManager::musicInterface_Play(uint8 soundNumber, uint8 channelNumber) { } g_system->lockMutex(_soundMutex); - MidiMusic *sound = new MidiMusic(_driver, _channelsInner, channelNumber, soundNumber, + MidiMusic *sound = new MidiMusic(_driver, _channelsInner, channelNumber, soundNumber, isMusic, soundStart, dataSize); sound->setVolume(volume); - _playingSounds.push_back(sound); + _playingSounds.push_back(sound); g_system->unlockMutex(_soundMutex); } @@ -484,7 +484,7 @@ bool SoundManager::musicInterface_CheckPlaying(uint8 soundNumber) { // Sets the volume of the specified channel void SoundManager::musicInterface_SetVolume(uint8 channelNum, uint8 volume) { - debugC(ERROR_INTERMEDIATE, kLureDebugSounds, "musicInterface_SetVolume channel=%d, volume=%d", + debugC(ERROR_INTERMEDIATE, kLureDebugSounds, "musicInterface_SetVolume channel=%d, volume=%d", channelNum, volume); musicInterface_TidySounds(); @@ -539,10 +539,10 @@ void SoundManager::musicInterface_TidySounds() { debugC(ERROR_DETAILED, kLureDebugSounds, "musicInterface_TidySounds"); g_system->lockMutex(_soundMutex); - ManagedList<MidiMusic *>::iterator i = _playingSounds.begin(); + ManagedList<MidiMusic *>::iterator i = _playingSounds.begin(); while (i != _playingSounds.end()) { MidiMusic *music = *i; - if (!music->isPlaying()) + if (!music->isPlaying()) i = _playingSounds.erase(i); else ++i; @@ -564,7 +564,7 @@ void SoundManager::doTimer() { ManagedList<MidiMusic *>::iterator i; for (i = _playingSounds.begin(); i != _playingSounds.end(); ++i) { MidiMusic *music = *i; - if (music->isPlaying()) + if (music->isPlaying()) music->onTimer(); } @@ -573,7 +573,7 @@ void SoundManager::doTimer() { /*------------------------------------------------------------------------*/ -MidiMusic::MidiMusic(MidiDriver *driver, ChannelEntry channels[NUM_CHANNELS_INNER], +MidiMusic::MidiMusic(MidiDriver *driver, ChannelEntry channels[NUM_CHANNELS_INNER], uint8 channelNum, uint8 soundNum, bool isMusic, void *soundData, uint32 size) { Game &game = Game::getReference(); _driver = driver; @@ -600,9 +600,9 @@ MidiMusic::MidiMusic(MidiDriver *driver, ChannelEntry channels[NUM_CHANNELS_INNE _soundData = (uint8 *) soundData; _soundSize = size; - // Check whether the music data is compressed - if so, decompress it for the duration + // Check whether the music data is compressed - if so, decompress it for the duration // of playing the sound - + _decompressedSound = NULL; if ((*_soundData == 'C') || (*_soundData == 'c')) { uint32 packedSize = size - 0x201; @@ -630,7 +630,7 @@ MidiMusic::~MidiMusic() { _parser->unloadMusic(); delete _parser; this->close(); - if (_decompressedSound != NULL) + if (_decompressedSound != NULL) delete _decompressedSound; } diff --git a/engines/lure/sound.h b/engines/lure/sound.h index eda0e42711..fb1fcf6f16 100644 --- a/engines/lure/sound.h +++ b/engines/lure/sound.h @@ -65,7 +65,7 @@ private: bool _passThrough; public: - MidiMusic(MidiDriver *driver, ChannelEntry channels[NUM_CHANNELS_INNER], + MidiMusic(MidiDriver *driver, ChannelEntry channels[NUM_CHANNELS_INNER], uint8 channelNum, uint8 soundNum, bool isMusic, void *soundData, uint32 size); ~MidiMusic(); void setVolume(int volume); diff --git a/engines/lure/strings.cpp b/engines/lure/strings.cpp index 787f20f258..4f7d47d004 100644 --- a/engines/lure/strings.cpp +++ b/engines/lure/strings.cpp @@ -79,13 +79,13 @@ void StringData::add(const char *sequence, char ascii) { uint32 value = 0; for (uint8 index = 0; index < strlen(sequence); ++index) { - if (sequence[index] == '1') + if (sequence[index] == '1') value |= (1 << index); - else if (sequence[index] != '0') + else if (sequence[index] != '0') error("Invalid character in string bit-stream sequence"); } - if (_numChars == MAX_NUM_CHARS) + if (_numChars == MAX_NUM_CHARS) error("Max characters too lower in string decoder"); _chars[_numChars++] = new CharacterEntry(strlen(sequence), value, ascii); } @@ -103,10 +103,10 @@ byte StringData::readBit() { bool StringData::initPosition(uint16 stringId) { uint16 roomNumber = Room::getReference().roomNumber(); - - if ((roomNumber >= 0x2A) && (stringId >= STRING_ID_RANGE) && (stringId < STRING_ID_UPPER)) + + if ((roomNumber >= 0x2A) && (stringId >= STRING_ID_RANGE) && (stringId < STRING_ID_UPPER)) stringId = 0x76; - if ((roomNumber < 0x2A) && (stringId >= STRING_ID_UPPER)) + if ((roomNumber < 0x2A) && (stringId >= STRING_ID_UPPER)) stringId = 0x76; if (stringId < STRING_ID_RANGE) @@ -120,7 +120,7 @@ bool StringData::initPosition(uint16 stringId) { } _srcPos = _stringTable + 4; - + uint32 total = 0; int numLoops = stringId >> 5; for (int ctr = 0; ctr < numLoops; ++ctr) { @@ -131,7 +131,7 @@ bool StringData::initPosition(uint16 stringId) { numLoops = stringId & 0x1f; if (numLoops!= 0) { byte *tempPtr = _stringTable + (stringId & 0xffe0) + READ_LE_UINT16(_stringTable); - + for (int ctr = 0; ctr < numLoops; ++ctr) { byte v = *tempPtr++; if ((v & 0x80) == 0) { @@ -170,8 +170,8 @@ char StringData::readCharacter() { // Scan through list for a match for (int index = 0; _chars[index] != NULL; ++index) { - if ((_chars[index]->_numBits == numBits) && - (_chars[index]->_sequence == searchValue)) + if ((_chars[index]->_numBits == numBits) && + (_chars[index]->_sequence == searchValue)) return _chars[index]->_ascii; } } @@ -181,9 +181,9 @@ char StringData::readCharacter() { return 0; } -void StringData::getString(uint16 stringId, char *dest, const char *hotspotName, +void StringData::getString(uint16 stringId, char *dest, const char *hotspotName, const char *characterName, int hotspotArticle, int characterArticle) { - debugC(ERROR_INTERMEDIATE, kLureDebugStrings, + debugC(ERROR_INTERMEDIATE, kLureDebugStrings, "StringData::getString stringId=%xh hotspot=%d,%s character=%d,%s", stringId, hotspotArticle, hotspotName, characterArticle, characterName); StringList &stringList = Resources::getReference().stringList(); @@ -201,7 +201,7 @@ void StringData::getString(uint16 stringId, char *dest, const char *hotspotName, while (ch != '\0') { if (ch == '%') { - // Copy over hotspot or action + // Copy over hotspot or action ch = readCharacter(); const char *p = (ch == '1') ? hotspotName : characterName; int article = !includeArticles ? 0 : ((ch == '1') ? hotspotArticle : characterArticle); @@ -234,7 +234,7 @@ void StringData::getString(uint16 stringId, char *dest, const char *hotspotName, charBitMask = _bitMask; // WORKAROUND: Italian version had an unterminated Look description for Prisoner after cutting sack - if ((charOffset == 0x1a08) && (charBitMask == 1) && + if ((charOffset == 0x1a08) && (charBitMask == 1) && (LureEngine::getReference().getLanguage() == IT_ITA)) // Hardcode for end of string ch = '\0'; @@ -243,7 +243,7 @@ void StringData::getString(uint16 stringId, char *dest, const char *hotspotName, ch = readCharacter(); } - debugC(ERROR_DETAILED, kLureDebugStrings, "String data %xh/%.2xh val=%.2xh EOS", + debugC(ERROR_DETAILED, kLureDebugStrings, "String data %xh/%.2xh val=%.2xh EOS", charOffset, charBitMask, ch); *destPos = '\0'; } @@ -253,7 +253,7 @@ void StringData::getString(uint16 stringId, char *dest, const char *hotspotName, char *StringData::getName(uint8 nameIndex) { uint16 numNames = READ_LE_UINT16(_names->data()) / 2; - if (nameIndex >= numNames) + if (nameIndex >= numNames) error("Invalid name index was passed to getCharacterName"); uint16 nameStart = READ_LE_UINT16(_names->data() + (nameIndex * 2)); diff --git a/engines/lure/surface.cpp b/engines/lure/surface.cpp index dd72ba31c9..e1ab0c2b0b 100644 --- a/engines/lure/surface.cpp +++ b/engines/lure/surface.cpp @@ -72,7 +72,7 @@ void Surface::initialise() { byte v = *pChar++; for (int xp = 0; xp < FONT_WIDTH; ++xp) { - if ((v & 0x80) && (xp > fontSize[ctr])) + if ((v & 0x80) && (xp > fontSize[ctr])) fontSize[ctr] = xp; v = (v << 1) & 0xff; } @@ -90,7 +90,7 @@ void Surface::deinitialise() { /*--------------------------------------------------------------------------*/ -Surface::Surface(MemoryBlock *src, uint16 wdth, uint16 hght): _data(src), +Surface::Surface(MemoryBlock *src, uint16 wdth, uint16 hght): _data(src), _width(wdth), _height(hght) { if ((uint32) (wdth * hght) != src->size()) error("Surface dimensions do not match size of passed data"); @@ -128,12 +128,12 @@ void Surface::egaCreateDialog(bool blackFlag) { // Surface contents data().setBytes(blackFlag ? 0 : EGA_DIALOG_BG_COLOUR, 0, data().size()); - + // Top/bottom lines for (int y = 2; y >= 0; --y) { data().setBytes(lineColours1[y], y * width(), width()); data().setBytes(lineColours2[y], (height() - y - 1) * width(), width()); - + for (int p = y + 1; p < height() - y; ++p) { byte *line = data().data() + p * width(); *(line + y) = lineColours2[y]; @@ -147,14 +147,14 @@ void Surface::egaCreateDialog(bool blackFlag) { void copyLine(byte *pSrc, byte *pDest, uint16 leftSide, uint16 center, uint16 rightSide) { // Left area - memcpy(pDest, pSrc, leftSide); - pSrc += leftSide; pDest += leftSide; + memcpy(pDest, pSrc, leftSide); + pSrc += leftSide; pDest += leftSide; // Center area memset(pDest, *pSrc, center); - ++pSrc; pDest += center; + ++pSrc; pDest += center; // Right side - memcpy(pDest, pSrc, rightSide); - pSrc += rightSide; pDest += rightSide; + memcpy(pDest, pSrc, rightSide); + pSrc += rightSide; pDest += rightSide; } #define VGA_DIALOG_EDGE_WIDTH 9 @@ -189,7 +189,7 @@ void Surface::vgaCreateDialog(bool blackFlag) { // Final processing - if black flag set, clear dialog inside area if (blackFlag) { - Rect r = Rect(VGA_DIALOG_EDGE_WIDTH, VGA_DIALOG_EDGE_WIDTH, + Rect r = Rect(VGA_DIALOG_EDGE_WIDTH, VGA_DIALOG_EDGE_WIDTH, _width - VGA_DIALOG_EDGE_WIDTH, _height-VGA_DIALOG_EDGE_WIDTH); fillRect(r, 0); } @@ -207,7 +207,7 @@ void Surface::loadScreen(MemoryBlock *rawData) { bool is5Bit = (v & 0xfffe) == 0x140; MemoryBlock *tmpScreen; - if (is5Bit) + if (is5Bit) // 5-bit decompression tmpScreen = decoder.egaDecode(rawData, FULL_SCREEN_HEIGHT * FULL_SCREEN_WIDTH + 1); else @@ -215,19 +215,19 @@ void Surface::loadScreen(MemoryBlock *rawData) { tmpScreen = decoder.vgaDecode(rawData, FULL_SCREEN_HEIGHT * FULL_SCREEN_WIDTH + 1); empty(); - _data->copyFrom(tmpScreen, 0, MENUBAR_Y_SIZE * FULL_SCREEN_WIDTH, + _data->copyFrom(tmpScreen, 0, MENUBAR_Y_SIZE * FULL_SCREEN_WIDTH, (FULL_SCREEN_HEIGHT - MENUBAR_Y_SIZE) * FULL_SCREEN_WIDTH); delete tmpScreen; } int Surface::writeChar(uint16 x, uint16 y, uint8 ascii, bool transparent, int colour) { byte *const addr = _data->data() + (y * _width) + x; - if (colour == DEFAULT_TEXT_COLOUR) + if (colour == DEFAULT_TEXT_COLOUR) colour = LureEngine::getReference().isEGA() ? EGA_DIALOG_TEXT_COLOUR : VGA_DIALOG_TEXT_COLOUR; if ((ascii < 32) || (ascii >= 32 + numFontChars)) error("Invalid ascii character passed for display '%d'", ascii); - + uint8 v; byte *pFont = int_font->data() + ((ascii - 32) * 8); byte *pDest; @@ -250,16 +250,16 @@ int Surface::writeChar(uint16 x, uint16 y, uint8 ascii, bool transparent, int co return charWidth; } -void Surface::writeString(uint16 x, uint16 y, Common::String line, bool transparent, +void Surface::writeString(uint16 x, uint16 y, Common::String line, bool transparent, int colour, bool varLength) { writeSubstring(x, y, line, line.size(), transparent, colour, varLength); } -void Surface::writeSubstring(uint16 x, uint16 y, Common::String line, int len, +void Surface::writeSubstring(uint16 x, uint16 y, Common::String line, int len, bool transparent, int colour, bool varLength) { const char *sPtr = line.c_str(); - if (colour == DEFAULT_TEXT_COLOUR) + if (colour == DEFAULT_TEXT_COLOUR) colour = LureEngine::getReference().isEGA() ? EGA_DIALOG_TEXT_COLOUR : VGA_DIALOG_TEXT_COLOUR; for (int index = 0; (index < len) && (*sPtr != '\0'); ++index, ++sPtr) { @@ -277,7 +277,7 @@ void Surface::writeSubstring(uint16 x, uint16 y, Common::String line, int len, } void Surface::transparentCopyTo(Surface *dest) { - if (dest->width() != _width) + if (dest->width() != _width) error("Incompatible surface sizes for transparent copy"); byte *pSrc = _data->data(); @@ -286,7 +286,7 @@ void Surface::transparentCopyTo(Surface *dest) { while (numBytes-- > 0) { if (*pSrc) *pDest = *pSrc; - + ++pSrc; ++pDest; } @@ -311,7 +311,7 @@ void Surface::copyTo(Surface *dest, uint16 x, uint16 y) { } } -void Surface::copyTo(Surface *dest, const Rect &srcBounds, +void Surface::copyTo(Surface *dest, const Rect &srcBounds, uint16 destX, uint16 destY, int transparentColour) { int numBytes = srcBounds.right - srcBounds.left + 1; if (destX + numBytes > dest->width()) @@ -372,7 +372,7 @@ void Surface::copyToScreen(uint16 x, uint16 y) { void Surface::centerOnScreen() { OSystem &system = *g_system; - system.copyRectToScreen(_data->data(), _width, + system.copyRectToScreen(_data->data(), _width, (FULL_SCREEN_WIDTH - _width) / 2, (FULL_SCREEN_HEIGHT - _height) / 2, _width, _height); system.updateScreen(); @@ -451,7 +451,7 @@ void Surface::wordWrap(char *text, uint16 width, char **&lines, uint8 &numLines) s = wordEnd+1; } - // Set up a list for the start of each line + // Set up a list for the start of each line lines = (char **) Memory::alloc(sizeof(char *) * numLines); lines[0] = text; debugC(ERROR_DETAILED, kLureDebugStrings, "wordWrap lines[0]='%s'", lines[0]); @@ -463,7 +463,7 @@ void Surface::wordWrap(char *text, uint16 width, char **&lines, uint8 &numLines) debugC(ERROR_INTERMEDIATE, kLureDebugStrings, "wordWrap end - numLines=%d", numLines); } -Surface *Surface::newDialog(uint16 width, uint8 numLines, const char **lines, bool varLength, +Surface *Surface::newDialog(uint16 width, uint8 numLines, const char **lines, bool varLength, int colour, bool squashedLines) { Point size; Surface::getDialogBounds(size, 0, numLines, squashedLines); @@ -486,7 +486,7 @@ Surface *Surface::newDialog(uint16 width, const char *line, int colour) { uint8 numLines; wordWrap(lineCopy, width - (Surface::textX() * 2), lines, numLines); - // Create the dialog + // Create the dialog Surface *result = newDialog(width, numLines, const_cast<const char **>(lines), true, colour); // Deallocate used resources @@ -651,9 +651,9 @@ struct GermanLanguageArticle { }; const GermanLanguageArticle germanArticles[] = { - {&german_pre_k_type[0], &german_pre_k_type_tl[0]}, + {&german_pre_k_type[0], &german_pre_k_type_tl[0]}, {&german_pre_d[0], &german_pre_d_tl[0]}, - {&german_pre_d_type[0], &german_pre_d_type_tl[0]}, + {&german_pre_d_type[0], &german_pre_d_type_tl[0]}, {&german_pre_e_type[0], &german_pre_e_type_tl[0]} }; @@ -676,7 +676,7 @@ int TalkDialog::getArticle(uint16 msgId, uint16 objId) { if (msgFound) { // Scan against possible bit combinations for (const uint16 *p = germanArticles[sectionIndex].translations; *p != 0; p += 2) { - if (*p == id) + if (*p == id) // Return the article index to use return *++p + 1; } @@ -684,17 +684,17 @@ int TalkDialog::getArticle(uint16 msgId, uint16 objId) { return 0; } } - + return 0; } else if (language == ES_ESP) { // Special handling for Spanish langugae const uint16 *tlData = (msgId == 158) ? spanish_pre_e1_type_tl : spanish_others_tl; - + // Scan through the list of article bitflag mappings for (const uint16 *p = tlData; *p != 0; p += 2) { - if (*p == id) + if (*p == id) // Return the article index to use return *++p + 1; } @@ -718,7 +718,7 @@ void TalkDialog::vgaTalkDialog(Surface *s) { *pDest++ = *pSrc++; *pDest++ = *pSrc++; - for (xPos = 0; xPos < TALK_DIALOG_WIDTH - TALK_DIALOG_EDGE_SIZE - 2; ++xPos) + for (xPos = 0; xPos < TALK_DIALOG_WIDTH - TALK_DIALOG_EDGE_SIZE - 2; ++xPos) *pDest++ = *pSrc; ++pSrc; @@ -733,7 +733,7 @@ void TalkDialog::vgaTalkDialog(Surface *s) { // Left edge for (xPos = 0; xPos < TALK_DIALOG_EDGE_SIZE; ++xPos) *pDest++ = *pSrcTemp++; - + // Middle section for (xPos = 0; xPos < _surface->width() - TALK_DIALOG_EDGE_SIZE * 2; ++xPos) *pDest++ = *pSrcTemp; @@ -750,7 +750,7 @@ void TalkDialog::vgaTalkDialog(Surface *s) { for (xPos = 0; xPos < TALK_DIALOG_EDGE_SIZE; ++xPos) *pDest++ = *pSrc++; - for (xPos = 0; xPos < TALK_DIALOG_WIDTH - TALK_DIALOG_EDGE_SIZE - 2; ++xPos) + for (xPos = 0; xPos < TALK_DIALOG_WIDTH - TALK_DIALOG_EDGE_SIZE - 2; ++xPos) *pDest++ = *pSrc; ++pSrc; @@ -760,7 +760,7 @@ void TalkDialog::vgaTalkDialog(Surface *s) { } TalkDialog::TalkDialog(uint16 characterId, uint16 destCharacterId, uint16 activeItemId, uint16 descId) { - debugC(ERROR_DETAILED, kLureDebugAnimations, "TalkDialog(chars=%xh/%xh, item=%d, str=%d", + debugC(ERROR_DETAILED, kLureDebugAnimations, "TalkDialog(chars=%xh/%xh, item=%d, str=%d", characterId, destCharacterId, activeItemId, descId); StringData &strings = StringData::getReference(); Resources &res = Resources::getReference(); @@ -777,7 +777,7 @@ TalkDialog::TalkDialog(uint16 characterId, uint16 destCharacterId, uint16 active _descId = descId; HotspotData *talkingChar = res.getHotspot(characterId); - HotspotData *destCharacter = (destCharacterId == 0) ? NULL : + HotspotData *destCharacter = (destCharacterId == 0) ? NULL : res.getHotspot(destCharacterId); HotspotData *itemHotspot = (activeItemId == 0) ? NULL : res.getHotspot(activeItemId); @@ -805,7 +805,7 @@ TalkDialog::TalkDialog(uint16 characterId, uint16 destCharacterId, uint16 active debugC(ERROR_DETAILED, kLureDebugAnimations, "Creating talk dialog for %d lines", _numLines); - _surface = new Surface(TALK_DIALOG_WIDTH, + _surface = new Surface(TALK_DIALOG_WIDTH, (_numLines + 1) * FONT_HEIGHT + TALK_DIALOG_EDGE_SIZE * 4); if (isEGA) @@ -849,7 +849,7 @@ void TalkDialog::copyTo(Surface *dest, uint16 x, uint16 y) { } // Write out the completed portion of the current line - _surface->writeSubstring(TALK_DIALOG_EDGE_SIZE + 2, + _surface->writeSubstring(TALK_DIALOG_EDGE_SIZE + 2, TALK_DIALOG_EDGE_SIZE + 4 + (_endLine + 1) * FONT_HEIGHT, _lines[_endLine], _endIndex, true); @@ -882,7 +882,7 @@ TalkDialog *TalkDialog::loadFromStream(Common::ReadStream *stream) { uint16 destCharacterId = stream->readUint16LE(); uint16 activeItemId = stream->readUint16LE(); - uint16 descId = stream->readUint16LE(); + uint16 descId = stream->readUint16LE(); TalkDialog *dialog = new TalkDialog(characterId, destCharacterId, activeItemId, descId); dialog->_endLine = stream->readSint16LE(); @@ -929,11 +929,11 @@ bool SaveRestoreDialog::show(bool saveDialog) { // Figure out a list of present savegames String **saveNames = (String **)Memory::alloc(sizeof(String *) * MAX_SAVEGAME_SLOTS); int numSaves = 0; - while ((numSaves < MAX_SAVEGAME_SLOTS) && + while ((numSaves < MAX_SAVEGAME_SLOTS) && ((saveNames[numSaves] = engine.detectSave(numSaves + 1)) != NULL)) ++numSaves; - // For the save dialog, if all the slots have not been used up, create a + // For the save dialog, if all the slots have not been used up, create a // blank entry for a new savegame if (saveDialog && (numSaves < MAX_SAVEGAME_SLOTS)) saveNames[numSaves++] = new String(); @@ -944,7 +944,7 @@ bool SaveRestoreDialog::show(bool saveDialog) { return false; } - Surface *s = new Surface(INFO_DIALOG_WIDTH, SR_SAVEGAME_NAMES_Y + + Surface *s = new Surface(INFO_DIALOG_WIDTH, SR_SAVEGAME_NAMES_Y + numSaves * FONT_HEIGHT + FONT_HEIGHT + 2); // Create the outer dialog and dividing line @@ -973,7 +973,7 @@ bool SaveRestoreDialog::show(bool saveDialog) { bool doneFlag = false; while (!abortFlag && !doneFlag) { // Provide highlighting of lines to select a save slot - while (!abortFlag && !(mouse.lButton() && (selectedLine != -1)) + while (!abortFlag && !(mouse.lButton() && (selectedLine != -1)) && !mouse.rButton() && !mouse.mButton()) { abortFlag = events.quitFlag; if (abortFlag) break; @@ -984,7 +984,7 @@ bool SaveRestoreDialog::show(bool saveDialog) { abortFlag = true; break; } - if (events.type() == Common::EVENT_MOUSEMOVE || + if (events.type() == Common::EVENT_MOUSEMOVE || events.type() == Common::EVENT_WHEELUP || events.type() == Common::EVENT_WHEELDOWN) { // Mouse movement int lineNum = 0; @@ -1011,7 +1011,7 @@ bool SaveRestoreDialog::show(bool saveDialog) { if (lineNum != selectedLine) { if (selectedLine != -1) // Deselect previously selected line - toggleHightlight(SAVE_DIALOG_X + Surface::textX(), + toggleHightlight(SAVE_DIALOG_X + Surface::textX(), SAVE_DIALOG_X + s->width() - Surface::textX(), SAVE_DIALOG_Y + SR_SAVEGAME_NAMES_Y + selectedLine * FONT_HEIGHT, SAVE_DIALOG_Y + SR_SAVEGAME_NAMES_Y + (selectedLine + 1) * FONT_HEIGHT - 1); @@ -1019,7 +1019,7 @@ bool SaveRestoreDialog::show(bool saveDialog) { // Highlight new line selectedLine = lineNum; if (selectedLine != -1) - toggleHightlight(SAVE_DIALOG_X + Surface::textX(), + toggleHightlight(SAVE_DIALOG_X + Surface::textX(), SAVE_DIALOG_X + s->width() - Surface::textX(), SAVE_DIALOG_Y + SR_SAVEGAME_NAMES_Y + selectedLine * FONT_HEIGHT, SAVE_DIALOG_Y + SR_SAVEGAME_NAMES_Y + (selectedLine + 1) * FONT_HEIGHT - 1); @@ -1032,8 +1032,8 @@ bool SaveRestoreDialog::show(bool saveDialog) { } // Deselect selected row - if (selectedLine != -1) - toggleHightlight(SAVE_DIALOG_X + Surface::textX(), + if (selectedLine != -1) + toggleHightlight(SAVE_DIALOG_X + Surface::textX(), SAVE_DIALOG_X + s->width() - Surface::textX(), SAVE_DIALOG_Y + SR_SAVEGAME_NAMES_Y + selectedLine * FONT_HEIGHT, SAVE_DIALOG_Y + SR_SAVEGAME_NAMES_Y + (selectedLine + 1) * FONT_HEIGHT - 1); @@ -1046,14 +1046,14 @@ bool SaveRestoreDialog::show(bool saveDialog) { // If in save mode, allow the entry of a new savename if (saveDialog) { - if (!screen.screen().getString(*saveNames[selectedLine], - INFO_DIALOG_WIDTH - (Surface::textX() * 2), - false, true, SAVE_DIALOG_X + Surface::textX(), + if (!screen.screen().getString(*saveNames[selectedLine], + INFO_DIALOG_WIDTH - (Surface::textX() * 2), + false, true, SAVE_DIALOG_X + Surface::textX(), SAVE_DIALOG_Y + SR_SAVEGAME_NAMES_Y + selectedLine * FONT_HEIGHT)) { - // Aborted out of name selection, so restore old name and + // Aborted out of name selection, so restore old name and // go back to slot selection screen.screen().writeString( - SAVE_DIALOG_X + Surface::textX(), + SAVE_DIALOG_X + Surface::textX(), SAVE_DIALOG_Y + SR_SAVEGAME_NAMES_Y + selectedLine * FONT_HEIGHT, saveNames[selectedLine]->c_str(), true); selectedLine = -1; @@ -1140,7 +1140,7 @@ bool RestartRestoreDialog::show() { // Get the correct button bounds record to use const RestartRecord *btnRecord = &buttonBounds[0]; - while ((btnRecord->Language != engine.getLanguage()) && + while ((btnRecord->Language != engine.getLanguage()) && (btnRecord->Language != UNK_LANG)) ++btnRecord; @@ -1257,7 +1257,7 @@ struct ItemDesc { static const ItemDesc copyProtectElements[] = { {UNK_LANG, 104, 96, 32, 48, PROT_SPR_HEADER, 0}, {UNK_LANG, 179, 96, 32, 48, PROT_SPR_HEADER, 0}, - + {EN_ANY, 57, 40, 208, 40, WORDING_HEADER, 32}, {FR_FRA, 57, 40, 208, 40, WORDING_HEADER, 32}, {DE_DEU, 39, 30, 240, 53, WORDING_HEADER, 32}, @@ -1330,7 +1330,7 @@ bool CopyProtectionDialog::show() { while (!events.quitFlag) { while (events.pollEvent() && (_charIndex < 4)) { - if (events.type() == Common::EVENT_KEYDOWN) { + if (events.type() == Common::EVENT_KEYDOWN) { if ((events.event().kbd.keycode == Common::KEYCODE_BACKSPACE) && (_charIndex > 0)) { // Remove the last number typed --_charIndex; @@ -1362,7 +1362,7 @@ bool CopyProtectionDialog::show() { // At this point, two page numbers have been entered - validate them int page1 = (_hotspots[3]->frameNumber() * 10) + _hotspots[4]->frameNumber(); int page2 = (_hotspots[5]->frameNumber() * 10) + _hotspots[6]->frameNumber(); - + if ((page1 == pageNumbers[_hotspots[0]->frameNumber()]) && (page2 == pageNumbers[_hotspots[1]->frameNumber()])) return true; diff --git a/engines/lure/surface.h b/engines/lure/surface.h index 6ca24bd5f4..73b7090287 100644 --- a/engines/lure/surface.h +++ b/engines/lure/surface.h @@ -65,7 +65,7 @@ public: int writeChar(uint16 x, uint16 y, uint8 ascii, bool transparent, int colour); void writeString(uint16 x, uint16 y, Common::String line, bool transparent, int colour = DEFAULT_TEXT_COLOUR, bool varLength = true); - void writeSubstring(uint16 x, uint16 y, Common::String line, int len, + void writeSubstring(uint16 x, uint16 y, Common::String line, int len, bool transparent, int colour = DEFAULT_TEXT_COLOUR, bool varLength = true); void transparentCopyTo(Surface *dest); void copyTo(Surface *dest); @@ -82,7 +82,7 @@ public: static uint16 textWidth(const char *s, int numChars = 0); static void wordWrap(char *text, uint16 width, char **&lines, uint8 &numLines); - static Surface *newDialog(uint16 width, uint8 numLines, const char **lines, bool varLength = true, + static Surface *newDialog(uint16 width, uint8 numLines, const char **lines, bool varLength = true, int colour = DEFAULT_TEXT_COLOUR, bool squashedLines = true); static Surface *newDialog(uint16 width, const char *lines, int colour = DEFAULT_TEXT_COLOUR); static Surface *getScreen(uint16 resourceId); |
