From 66e9d4f5e8f35b28f8abd9ce53a0da4da3ce8985 Mon Sep 17 00:00:00 2001 From: Jordi Vilalta Prat Date: Sun, 27 Jan 2008 19:47:41 +0000 Subject: Removed trailing spaces. svn-id: r30664 --- engines/agi/agi.cpp | 2 +- engines/agi/menu.h | 2 +- engines/agi/preagi_mickey.cpp | 4 +- engines/agi/preagi_mickey.h | 12 +- engines/agi/preagi_troll.cpp | 32 +-- engines/agi/preagi_troll.h | 2 +- engines/agi/preagi_winnie.cpp | 32 +-- engines/agi/predictive.cpp | 6 +- engines/agi/sound.h | 4 +- engines/agi/sprite.cpp | 2 +- engines/agi/sprite.h | 6 +- engines/agi/text.cpp | 2 +- engines/agi/view.cpp | 2 +- engines/agi/wagparser.h | 38 +-- engines/agos/agos.cpp | 2 +- engines/agos/agos.h | 6 +- engines/agos/animation.h | 2 +- engines/agos/intern.h | 2 +- engines/agos/module.mk | 2 +- engines/agos/script_e2.cpp | 2 +- engines/cine/module.mk | 2 +- engines/cruise/actor.cpp | 6 +- engines/cruise/background.cpp | 2 +- engines/cruise/backgroundIncrust.cpp | 6 +- engines/cruise/cell.cpp | 2 +- engines/cruise/cruise_main.cpp | 16 +- engines/cruise/ctp.cpp | 6 +- engines/cruise/dataLoader.cpp | 4 +- engines/cruise/decompiler.cpp | 8 +- engines/cruise/function.cpp | 6 +- engines/cruise/mainDraw.cpp | 18 +- engines/cruise/module.mk | 2 +- engines/cruise/mouse.cpp | 2 +- engines/cruise/overlay.cpp | 12 +- engines/cruise/perso.cpp | 2 +- engines/cruise/saveload.cpp | 2 +- engines/cruise/vars.h | 2 +- engines/drascula/drascula.cpp | 242 +++++++++---------- engines/gob/coktelvideo.h | 4 +- engines/gob/game.h | 2 +- engines/gob/goblin.cpp | 4 +- engines/gob/map.h | 4 +- engines/gob/module.mk | 2 +- engines/gob/mult.h | 2 +- engines/gob/music.h | 2 +- engines/gob/parse.h | 2 +- engines/gob/scenery.h | 4 +- engines/gob/sound.h | 4 +- engines/igor/parts/part_05.cpp | 2 +- engines/igor/parts/part_17.cpp | 2 +- engines/igor/parts/part_21.cpp | 4 +- engines/kyra/animator_v1.h | 4 +- engines/kyra/animator_v2.cpp | 30 +-- engines/kyra/debugger.cpp | 2 +- engines/kyra/gui_v1.cpp | 86 +++---- engines/kyra/gui_v2.cpp | 40 ++-- engines/kyra/items_v1.cpp | 150 ++++++------ engines/kyra/items_v2.cpp | 22 +- engines/kyra/kyra.cpp | 2 +- engines/kyra/kyra.h | 38 +-- engines/kyra/kyra_v1.cpp | 108 ++++----- engines/kyra/kyra_v1.h | 88 +++---- engines/kyra/kyra_v2.cpp | 12 +- engines/kyra/kyra_v2.h | 2 +- engines/kyra/kyra_v3.cpp | 60 ++--- engines/kyra/kyra_v3.h | 6 +- engines/kyra/module.mk | 2 +- engines/kyra/resource.cpp | 6 +- engines/kyra/scene.cpp | 48 ++-- engines/kyra/scene_v1.cpp | 200 ++++++++-------- engines/kyra/scene_v2.cpp | 232 +++++++++--------- engines/kyra/screen.cpp | 4 +- engines/kyra/screen.h | 22 +- engines/kyra/screen_v1.h | 8 +- engines/kyra/screen_v2.cpp | 12 +- engines/kyra/screen_v2.h | 26 +- engines/kyra/script.h | 16 +- engines/kyra/script_v2.cpp | 48 ++-- engines/kyra/seqplayer.h | 2 +- engines/kyra/sequences_v1.cpp | 216 ++++++++--------- engines/kyra/sequences_v2.cpp | 12 +- engines/kyra/sound.cpp | 4 +- engines/kyra/sound_digital.cpp | 48 ++-- engines/kyra/sound_v1.cpp | 2 +- engines/kyra/sprites.h | 4 +- engines/kyra/staticres.cpp | 8 +- engines/kyra/text.h | 2 +- engines/kyra/text_v1.cpp | 24 +- engines/kyra/text_v2.cpp | 60 ++--- engines/kyra/timer.cpp | 24 +- engines/kyra/timer.h | 20 +- engines/kyra/timer_v1.cpp | 12 +- engines/kyra/timer_v2.cpp | 6 +- engines/kyra/util.h | 8 +- engines/kyra/wsamovie.h | 14 +- engines/lure/animseq.cpp | 30 +-- engines/lure/animseq.h | 2 +- engines/lure/debugger.cpp | 6 +- engines/lure/decode.cpp | 22 +- engines/lure/decode.h | 2 +- engines/lure/fights.cpp | 64 ++--- engines/lure/game.cpp | 92 ++++---- engines/lure/hotspots.cpp | 380 +++++++++++++++--------------- engines/lure/hotspots.h | 94 ++++---- engines/lure/intro.cpp | 24 +- engines/lure/lure.cpp | 12 +- engines/lure/lure.h | 2 +- engines/lure/luredefs.h | 2 +- engines/lure/menu.cpp | 40 ++-- engines/lure/module.mk | 2 +- engines/lure/palette.cpp | 8 +- engines/lure/palette.h | 2 +- engines/lure/res.cpp | 40 ++-- engines/lure/res.h | 12 +- engines/lure/res_struct.cpp | 118 +++++----- engines/lure/res_struct.h | 48 ++-- engines/lure/room.cpp | 72 +++--- engines/lure/screen.cpp | 8 +- engines/lure/scripts.cpp | 96 ++++---- engines/lure/sound.cpp | 40 ++-- engines/lure/sound.h | 2 +- engines/lure/strings.cpp | 32 +-- engines/lure/surface.cpp | 112 ++++----- engines/lure/surface.h | 4 +- engines/module.mk | 2 +- engines/queen/defs.h | 2 +- engines/queen/display.cpp | 4 +- engines/queen/xref.txt | 6 +- engines/saga/actor.cpp | 28 +-- engines/saga/actor.h | 2 +- engines/saga/actor_path.cpp | 8 +- engines/saga/actor_walk.cpp | 6 +- engines/saga/animation.cpp | 12 +- engines/saga/console.cpp | 2 +- engines/saga/detection.cpp | 6 +- engines/saga/detection_tables.h | 2 +- engines/saga/font.cpp | 2 +- engines/saga/font.h | 4 +- engines/saga/ihnm_introproc.cpp | 4 +- engines/saga/interface.cpp | 20 +- engines/saga/ite_introproc.cpp | 4 +- engines/saga/module.mk | 2 +- engines/saga/music.cpp | 6 +- engines/saga/objectmap.cpp | 2 +- engines/saga/puzzle.cpp | 2 +- engines/saga/rscfile.cpp | 20 +- engines/saga/rscfile.h | 2 +- engines/saga/saga.h | 8 +- engines/saga/sagaresnames.h | 2 +- engines/saga/scene.cpp | 4 +- engines/saga/script.cpp | 8 +- engines/saga/sfuncs.cpp | 8 +- engines/saga/sndres.cpp | 6 +- engines/saga/sprite.cpp | 2 +- engines/saga/xref.txt | 2 +- engines/scumm/cursor.cpp | 2 +- engines/scumm/detection.h | 12 +- engines/scumm/dialogs.cpp | 2 +- engines/scumm/dialogs.h | 4 +- engines/scumm/file_nes.cpp | 2 +- engines/scumm/gfx.cpp | 2 +- engines/scumm/he/animation_he.h | 2 +- engines/scumm/he/resource_he.h | 2 +- engines/scumm/he/script_v72he.cpp | 2 +- engines/scumm/he/sound_he.h | 2 +- engines/scumm/imuse_digi/dimuse_track.cpp | 2 +- engines/scumm/imuse_digi/dimuse_track.h | 2 +- engines/scumm/intern.h | 10 +- engines/scumm/module.mk | 2 +- engines/scumm/object.h | 2 +- engines/scumm/saveload.cpp | 6 +- engines/scumm/script_v6.cpp | 2 +- engines/scumm/scumm.h | 6 +- engines/scumm/sound.cpp | 4 +- engines/scumm/verbs.cpp | 2 +- engines/sky/module.mk | 2 +- engines/sky/music/adlibchannel.h | 4 +- engines/sky/music/gmchannel.cpp | 2 +- engines/sky/music/mt32music.cpp | 8 +- engines/sky/music/musicbase.cpp | 6 +- engines/sword1/animation.h | 4 +- engines/sword1/module.mk | 2 +- engines/sword1/resman.h | 2 +- engines/sword2/header.h | 2 +- engines/sword2/module.mk | 2 +- engines/sword2/mouse.h | 2 +- engines/sword2/object.h | 2 +- 187 files changed, 1972 insertions(+), 1972 deletions(-) (limited to 'engines') diff --git a/engines/agi/agi.cpp b/engines/agi/agi.cpp index 59beb087f2..f0c3f62e30 100644 --- a/engines/agi/agi.cpp +++ b/engines/agi/agi.cpp @@ -235,7 +235,7 @@ void AgiEngine::processEvents() { // When used with a debug CRT library, isalpha will display a CRT assert // if passed a parameter that isn't EOF or in the range of 0 through 0xFF. if (key >= 0 && key <= 0xFF && isalpha(key)) { - // Key is A-Z. + // Key is A-Z. // Map Ctrl-A to 1, Ctrl-B to 2, etc. if (event.kbd.flags & Common::KBD_CTRL) { key = toupper(key) - 'A' + 1; diff --git a/engines/agi/menu.h b/engines/agi/menu.h index 0196c75583..d27dfa497d 100644 --- a/engines/agi/menu.h +++ b/engines/agi/menu.h @@ -81,7 +81,7 @@ private: void drawMenuOptionHilite(int hMenu, int vMenu); void newMenuSelected(int i); bool mouseOverText(unsigned int line, unsigned int col, char *s); - + }; } // End of namespace Agi diff --git a/engines/agi/preagi_mickey.cpp b/engines/agi/preagi_mickey.cpp index faf46f5a93..6944eee9f2 100644 --- a/engines/agi/preagi_mickey.cpp +++ b/engines/agi/preagi_mickey.cpp @@ -676,7 +676,7 @@ void Mickey::drawObj(ENUM_MSA_OBJECT iObj, int x0, int y0) { if (iObj == IDI_MSA_OBJECT_CRYSTAL) _vm->_picture->setPictureFlags(kPicFStep); - + _vm->_picture->setOffset(x0, y0); _vm->_picture->decodePicture(buffer, size, false, IDI_MSA_PIC_WIDTH, IDI_MSA_PIC_HEIGHT); _vm->_picture->setOffset(0, 0); @@ -892,7 +892,7 @@ void Mickey::drawLogo() { } _vm->_picture->showPic(10, 10, w, h); - + delete [] buffer; } diff --git a/engines/agi/preagi_mickey.h b/engines/agi/preagi_mickey.h index 5e421d24ac..8d982dc401 100644 --- a/engines/agi/preagi_mickey.h +++ b/engines/agi/preagi_mickey.h @@ -43,7 +43,7 @@ namespace Agi { #define IDS_MSA_CRYSTALS "%s CRYSTALS" const char IDS_MSA_CRYSTAL_NO[][3] = { - "NO", " 1", " 2", " 3", " 4", " 5", " 6", " 7", " 8", " 9" + "NO", " 1", " 2", " 3", " 4", " 5", " 6", " 7", " 8", " 9" }; const char IDS_MSA_TEMP_C[][5] = { " 20 ", " 480", "-200", " 430", "-185", "-230", "-130", "-150", "-215" @@ -52,7 +52,7 @@ const char IDS_MSA_TEMP_F[][5] = { " 68 ", " 897", "-328", " 807", "-301", "-382", "-202", "-238", "-355" }; const char IDS_MSA_PLANETS[][10] = { - "EARTH. ", "VENUS. ", "TRITON. ", "MERCURY.", "TITAN. ", + "EARTH. ", "VENUS. ", "TRITON. ", "MERCURY.", "TITAN. ", "PLUTO. ", "IO. ", "MARS. ", "OBERON. " }; @@ -111,7 +111,7 @@ const char IDS_MSA_INSERT_DISK[][40] = { #define IDI_MSA_MSG_STAR_MAP_2 48 #define IDI_MSA_MSG_SPACESUIT_WEAR 11 #define IDI_MSA_MSG_SPACESUIT_REMOVE 13 -#define IDI_MSA_MSG_SPACESUIT_0 3 +#define IDI_MSA_MSG_SPACESUIT_0 3 #define IDI_MSA_MSG_SPACESUIT_CANT_WEAR_ON_EARTH 12 #define IDI_MSA_MSG_SHIP_LAUNCH 16 #define IDI_MSA_MSG_SHIP_LAND 22 @@ -387,7 +387,7 @@ const char IDS_MSA_NAME_DAT[][13] = { }; const char IDS_MSA_NAME_PLANET[][10] = { - "EARTH", "VENUS", "TRITON", "MERCURY", "TITAN", + "EARTH", "VENUS", "TRITON", "MERCURY", "TITAN", "PLUTO", "IO", "MARS", "OBERON" }; @@ -397,7 +397,7 @@ const char IDS_MSA_NAME_PLANET_2[][10] = { }; const char IDS_MSA_ADDR_PLANET[][7] = { - "OB", "B", "OOBBB", "O", "OOBB", + "OB", "B", "OOBBB", "O", "OOBB", "OOOBBB", "OBB", "OOB", "OOOBB" }; @@ -429,7 +429,7 @@ enum ENUM_MSA_ITEM { }; const char IDS_MSA_NAME_ITEM[][15] = { - "A FLASHLIGHT", "A ROPE ", "A BONE ", "A LETTER", "A CROWBAR", "A WRENCH", + "A FLASHLIGHT", "A ROPE ", "A BONE ", "A LETTER", "A CROWBAR", "A WRENCH", "A MATTRESS", "A SCARF", "SUNGLASSES", "A SCALE ", "A ROCK " }; diff --git a/engines/agi/preagi_troll.cpp b/engines/agi/preagi_troll.cpp index 89dfe23781..d4ec193376 100644 --- a/engines/agi/preagi_troll.cpp +++ b/engines/agi/preagi_troll.cpp @@ -55,7 +55,7 @@ void Troll::drawMenu(const char *szMenu, int iSel) { bool Troll::getMenuSel(const char *szMenu, int *iSel, int nSel) { Common::Event event; int y; - + drawMenu(szMenu, *iSel); for (;;) { @@ -122,7 +122,7 @@ bool Troll::getMenuSel(const char *szMenu, int *iSel, int nSel) { _vm->_system->updateScreen(); _vm->_system->delayMillis(10); } - + return true; } @@ -193,7 +193,7 @@ void Troll::inventory() { sprintf(tmp, IDS_TRO_TREASURE_4, _treasuresLeft); _vm->drawStr(20, 10, kColorDefault, tmp); break; - } + } pressAnyKey(6); } @@ -258,7 +258,7 @@ void Troll::credits() { _vm->drawStr(15, 8, 10, IDS_TRO_CREDITS_4); _vm->drawStr(17, 7, 12, IDS_TRO_CREDITS_5); _vm->drawStr(19, 2, 14, IDS_TRO_CREDITS_6); - + _vm->_gfx->doUpdate(); pressAnyKey(); @@ -274,7 +274,7 @@ void Troll::tutorial() { _vm->printStr(IDS_TRO_TUTORIAL_0); _vm->getSelection(kSelSpace); - + _vm->clearScreen(0x55); _vm->setDefaultTextColor(0x0F); @@ -317,25 +317,25 @@ void Troll::tutorial() { _vm->drawStr(6, 1, kColorDefault, IDS_TRO_TUTORIAL_9); _vm->_gfx->doUpdate(); pressAnyKey(); - + _vm->clearScreen(0x19); _vm->drawStr(7, 1, kColorDefault, IDS_TRO_TUTORIAL_10); _vm->drawStr(8, 1, kColorDefault, IDS_TRO_TUTORIAL_11); _vm->_gfx->doUpdate(); pressAnyKey(); - + _vm->clearScreen(0x6E); _vm->drawStr(9, 1, kColorDefault, IDS_TRO_TUTORIAL_12); _vm->drawStr(10, 1, kColorDefault, IDS_TRO_TUTORIAL_13); _vm->_gfx->doUpdate(); pressAnyKey(); - + _vm->clearScreen(0x4C); _vm->drawStr(11, 1, kColorDefault, IDS_TRO_TUTORIAL_14); _vm->drawStr(12, 1, kColorDefault, IDS_TRO_TUTORIAL_15); _vm->_gfx->doUpdate(); pressAnyKey(); - + _vm->clearScreen(0x5D); _vm->drawStr(13, 1, kColorDefault, IDS_TRO_TUTORIAL_16); _vm->drawStr(14, 1, kColorDefault, IDS_TRO_TUTORIAL_17); @@ -369,7 +369,7 @@ void Troll::intro() { _vm->setDefaultTextColor(0x0f); drawPic(45, false, true); _vm->_gfx->doUpdate(); - + // wait for keypress and alternate message waitAnyKeyIntro(); @@ -377,7 +377,7 @@ void Troll::intro() { _vm->drawStr(22, 3, kColorDefault, IDS_TRO_INTRO_4); _vm->drawStr(23, 6, kColorDefault, IDS_TRO_INTRO_5); _vm->_gfx->doUpdate(); - + if (!_vm->getSelection(kSelYesNo)) tutorial(); @@ -391,7 +391,7 @@ void Troll::gameOver() { drawPic(42, true, true); playTune(4, 25); - + printUserMessage(16); printUserMessage(33); @@ -533,7 +533,7 @@ void Troll::printUserMessage(int msgId) { for (i = 0; i < _userMessages[msgId - 1].num; i++) { _vm->drawStr(21 + i, 1, kColorDefault, _userMessages[msgId - 1].msg[i]); } - + if (msgId == 34) { for (i = 0; i < 2; i++) playTune(5, 11); @@ -559,10 +559,10 @@ void Troll::gameLoop() { memset(_roomStates, 0, sizeof(_roomStates)); memset(_inventory, 0, sizeof(_inventory)); - + while (!done) { *menu = 0; - + currentOption = 0; numberOfOptions = drawRoom(menu); @@ -614,7 +614,7 @@ void Troll::gameLoop() { if (roomParam == 1) haveFlashlight = true; - _locMessagesIdx[_currentRoom] = IDO_TRO_LOCMESSAGES + + _locMessagesIdx[_currentRoom] = IDO_TRO_LOCMESSAGES + (roomParam + 42) * 39; pickupTreasure(roomParam); diff --git a/engines/agi/preagi_troll.h b/engines/agi/preagi_troll.h index 8519925e0a..b2764bcdb3 100644 --- a/engines/agi/preagi_troll.h +++ b/engines/agi/preagi_troll.h @@ -178,7 +178,7 @@ private: int _moves; bool _isTrollAway; - + int _inventory[IDI_TRO_MAX_TREASURE]; bool _soundOn; diff --git a/engines/agi/preagi_winnie.cpp b/engines/agi/preagi_winnie.cpp index af653d34c8..87d13bff3d 100644 --- a/engines/agi/preagi_winnie.cpp +++ b/engines/agi/preagi_winnie.cpp @@ -162,7 +162,7 @@ void Winnie::randomize() { } _game.iUsedObj[i] = iObj; - + done = false; while (!done) { iRoom = _vm->rnd(IDI_WTP_MAX_ROOM_NORMAL); @@ -201,8 +201,8 @@ void Winnie::intro() { } int Winnie::getObjInRoom(int iRoom) { - for (int iObj = 1; iObj < IDI_WTP_MAX_ROOM_OBJ; iObj++) - if (_game.iObjRoom[iObj] == iRoom) + for (int iObj = 1; iObj < IDI_WTP_MAX_ROOM_OBJ; iObj++) + if (_game.iObjRoom[iObj] == iRoom) return iObj; return 0; } @@ -267,12 +267,12 @@ int Winnie::parser(int pc, int index, uint8 *buffer) { // check if NSEW directions should be displayed if (hdr.roomNew[0]) - fCanSel[IDI_WTP_SEL_NORTH] = fCanSel[IDI_WTP_SEL_SOUTH] = + fCanSel[IDI_WTP_SEL_NORTH] = fCanSel[IDI_WTP_SEL_SOUTH] = fCanSel[IDI_WTP_SEL_EAST] = fCanSel[IDI_WTP_SEL_WEST] = true; // check if object in room or player carrying one setTakeDrop(); - + // check which rows have a menu option for (iSel = 0; iSel < IDI_WTP_MAX_OPTION; iSel++) { opcode = *(buffer + pc++); @@ -291,7 +291,7 @@ int Winnie::parser(int pc, int index, uint8 *buffer) { printStrWinnie((char *)(buffer + pc)); if (_vm->getSelection(kSelBackspace) == 1) return IDI_WTP_PAR_OK; - else + else return IDI_WTP_PAR_BACK; } @@ -558,7 +558,7 @@ void Winnie::dropObj(int iRoom) { // increase amount of objects returned, decrease amount of objects missing _game.nObjMiss--; _game.nObjRet++; - + // xor the dropped object with 0x80 to signify it has been dropped in the right place for (int i = 0; i < IDI_WTP_MAX_OBJ_MISSING; i++) { if (_game.iUsedObj[i] == _game.iObjHave) { @@ -569,10 +569,10 @@ void Winnie::dropObj(int iRoom) { // set flag according to dropped object's id _game.fGame[iCode] = 1; - + // player is carrying nothing _game.iObjHave = 0; - + if (!_game.nObjMiss) { // all objects returned, tell player to find party playSound(IDI_WTP_SND_FANFARE); @@ -605,7 +605,7 @@ void Winnie::dropObj(int iRoom) { void Winnie::dropObjRnd() { if (!_game.iObjHave) return; - + int iRoom = 0; bool done = false; @@ -708,7 +708,7 @@ void Winnie::drawMenu(char *szMenu, int iSel, int fCanSel[]) { _vm->drawStr(IDI_WTP_ROW_OPTION_4, IDI_WTP_COL_TAKE, IDA_DEFAULT, IDS_WTP_TAKE); if (fCanSel[IDI_WTP_SEL_DROP]) _vm->drawStr(IDI_WTP_ROW_OPTION_4, IDI_WTP_COL_DROP, IDA_DEFAULT, IDS_WTP_DROP); - + switch(iSel) { case IDI_WTP_SEL_OPT_1: case IDI_WTP_SEL_OPT_2: @@ -812,7 +812,7 @@ void Winnie::getMenuSel(char *szMenu, int *iSel, int fCanSel[]) { if (fCanSel[IDI_WTP_SEL_NORTH] && hotspotNorth.contains(event.mouse.x, event.mouse.y)) { _vm->_gfx->setCursorPalette(true); } else if (fCanSel[IDI_WTP_SEL_SOUTH] && hotspotSouth.contains(event.mouse.x, event.mouse.y)) { - _vm->_gfx->setCursorPalette(true); + _vm->_gfx->setCursorPalette(true); } else if (fCanSel[IDI_WTP_SEL_WEST] && hotspotWest.contains(event.mouse.x, event.mouse.y)) { _vm->_gfx->setCursorPalette(true); } else if (fCanSel[IDI_WTP_SEL_EAST] && hotspotEast.contains(event.mouse.x, event.mouse.y)) { @@ -974,7 +974,7 @@ void Winnie::getMenuSel(char *szMenu, int *iSel, int fCanSel[]) { } break; } - default: + default: if (!event.kbd.flags) { // if the control/alt/shift keys are not pressed keyHelp(); clrMenuSel(iSel, fCanSel); @@ -1062,7 +1062,7 @@ void Winnie::drawObjPic(int iObj, int x0, int y0) { uint8 *buffer = (uint8 *)malloc(2048); uint32 objSize = readObj(iObj, buffer); parseObjHeader(&objhdr, buffer, sizeof(WTP_OBJ_HDR)); - + _vm->_picture->setOffset(x0, y0); _vm->_picture->decodePicture(buffer + objhdr.ofsPic - _objOffset, objSize, 0, IDI_WTP_PIC_WIDTH, IDI_WTP_PIC_HEIGHT); _vm->_picture->setOffset(0, 0); @@ -1191,7 +1191,7 @@ void Winnie::loadGame() { // Note that the original saves variables as 16-bit integers, but only 8 bits are used. // Since we read the save file data as little-endian, we skip the first byte of each // variable - + infile->seek(0); // Jump back to the beginning of the file infile->readUint16LE(); // skip unused field @@ -1222,7 +1222,7 @@ void Winnie::loadGame() { for(i = 0; i < IDI_WTP_MAX_ROOM_OBJ; i++) _game.iObjRoom[i] = infile->readByte(); - // Note that saved games from the original interpreter have 2 more 16-bit fields here + // Note that saved games from the original interpreter have 2 more 16-bit fields here // which are ignored delete infile; diff --git a/engines/agi/predictive.cpp b/engines/agi/predictive.cpp index 7f41c27a6a..d96a5f3a0a 100644 --- a/engines/agi/predictive.cpp +++ b/engines/agi/predictive.cpp @@ -49,7 +49,7 @@ uint8 countWordsInString(char *str) { if (!str) return 0; - ptr = strchr(str, ' '); + ptr = strchr(str, ' '); if (!ptr) { debug("Invalid dictionary line"); return 0; @@ -111,7 +111,7 @@ bool AgiEngine::predictiveDialog(void) { "(7)pqrs", "(8)tuv", "(9)wxyz", "(#)next", "add", "<", - "Cancel", "OK", + "Cancel", "OK", "Pre", "(0) ", NULL }; const int colors[] = { @@ -198,7 +198,7 @@ bool AgiEngine::predictiveDialog(void) { || (mode == kModeAbc && _currentWord.size() && _currentWord.lastChar() != ' '))) { // Next color2 = 7; } - + // needs fixing, or remove it! bool _addIsActive = false; // FIXME: word adding is not implemented if (i == 10 && !_addIsActive) { // Add diff --git a/engines/agi/sound.h b/engines/agi/sound.h index 5d9bfda445..2e6902111c 100644 --- a/engines/agi/sound.h +++ b/engines/agi/sound.h @@ -129,9 +129,9 @@ struct IIgsOscillatorList { IIgsOscillator osc[MAX_OSCILLATORS]; ///< The oscillators /** Indexing operators for easier access to the oscillators. */ - const IIgsOscillator &operator()(uint index) const { return osc[index]; } + const IIgsOscillator &operator()(uint index) const { return osc[index]; } IIgsOscillator &operator()(uint index) { return osc[index]; } - + /** Reads an Apple IIGS oscillator list from the given stream. */ bool read(Common::SeekableReadStream &stream, uint oscillatorCount, bool ignoreAddr = false); bool finalize(Common::SeekableReadStream &uint8Wave); diff --git a/engines/agi/sprite.cpp b/engines/agi/sprite.cpp index 3126fb66af..2735809ac5 100644 --- a/engines/agi/sprite.cpp +++ b/engines/agi/sprite.cpp @@ -57,7 +57,7 @@ void *SpritesMgr::poolAlloc(int size) { uint8 *x; /* Adjust size to 32-bit boundary to prevent data misalignment - * errors. + * errors. */ size = (size + 3) & ~3; diff --git a/engines/agi/sprite.h b/engines/agi/sprite.h index 401446249b..3f9b329076 100644 --- a/engines/agi/sprite.h +++ b/engines/agi/sprite.h @@ -59,7 +59,7 @@ private: int blitCel(int x, int y, int spr, ViewCel *c, bool agi256_2); void objsSaveArea(Sprite *s); void objsRestoreArea(Sprite *s); - + FORCEINLINE int prioToY(int p); Sprite *newSprite(VtEntry *v); void sprAddlist(SpriteList &l, VtEntry *v); @@ -69,10 +69,10 @@ private: void freeList(SpriteList &l); void commitSprites(SpriteList &l); void eraseSprites(SpriteList &l); - void blitSprites(SpriteList &l); + void blitSprites(SpriteList &l); static bool testUpdating(VtEntry *v, AgiEngine *); static bool testNotUpdating(VtEntry *v, AgiEngine *); - + public: SpritesMgr(AgiEngine *agi, GfxMgr *gfx); ~SpritesMgr(); diff --git a/engines/agi/text.cpp b/engines/agi/text.cpp index aea1468dcb..abaf763872 100644 --- a/engines/agi/text.cpp +++ b/engines/agi/text.cpp @@ -91,7 +91,7 @@ void AgiEngine::printText2(int l, const char *msg, int foff, int xoff, int yoff, } x1++; - + /* DF: changed the len-1 to len... */ if (x1 == len && m[1] != '\n') y1++, x1 = foff = 0; diff --git a/engines/agi/view.cpp b/engines/agi/view.cpp index 2eb11c9b91..07387161e8 100644 --- a/engines/agi/view.cpp +++ b/engines/agi/view.cpp @@ -45,7 +45,7 @@ void AgiEngine::lSetCel(VtEntry *v, int n) { // WORKAROUND: This is a very nasty hack to fix a bug in the KQ4 introduction // In its original form, it caused a lot of regressions, including KQ4 bugs and crashes // Refer to Sarien bug #588899 for the original issue - // Modifying this workaround to only work for a specific view in the KQ4 intro fixes several + // Modifying this workaround to only work for a specific view in the KQ4 intro fixes several // ScummVM bugs. Refer to bugs #1660486, #1660169, #1660192, #1660162 and #1660354 // FIXME: Remove this workaround and investigate the reason for the erroneous actor behavior // in the KQ4 introduction diff --git a/engines/agi/wagparser.h b/engines/agi/wagparser.h index 1fc554d522..2f4003315f 100644 --- a/engines/agi/wagparser.h +++ b/engines/agi/wagparser.h @@ -26,7 +26,7 @@ namespace Agi { /** - * WagProperty represents a single property from WinAGI's *.wag file. + * WagProperty represents a single property from WinAGI's *.wag file. * A property consists of a header and of data. * The header consists of the following: * - Property code (Integer/Enumeration, 1 byte) @@ -62,7 +62,7 @@ public: PC_VIEW = 240, PC_UNDEFINED = 0x100 ///< An undefined property code (Added for ScummVM). }; - + /** * Property types taken from WinAGI 1.1.21's source code file WinAGI/AGIObjects.bas. * At the moment these aren't really at all needed by ScummVM. Just here if anyone decides to use them. @@ -97,7 +97,7 @@ public: * No property header or property data in it. */ WagProperty(); - + /** * Destructor. Releases allocated memory if any etc. The usual. */ @@ -119,7 +119,7 @@ protected: * Sets the default values for member variables. */ void setDefaults(); - + /** * Delete's the property's data from memory if we have it, otherwise does nothing. */ @@ -138,7 +138,7 @@ public: * @return True if reading was a success, false otherwise. */ bool read(Common::SeekableReadStream &stream); - + /** * Clears the property. * After this the property is empty. No header or data. @@ -146,7 +146,7 @@ public: void clear(); // Public access functions -public: +public: /** * Was the property read ok from the source stream? */ @@ -157,25 +157,25 @@ public: * @return The property's code if readOk(), PC_UNDEFINED otherwise. */ enum WagPropertyCode getCode() const { return _propCode; }; - + /** * Return the property's type. * @return The property's type if readOk(), PT_UNDEFINED otherwise. - */ + */ enum WagPropertyType getType() const { return _propType; }; - + /** * Return the property's number. * @return The property's number if readOk(), 0 otherwise. - */ + */ byte getNumber() const { return _propNum; }; - + /** * Return the property's data's length. * @return The property's data's length if readOk(), 0 otherwise. */ uint16 getSize() const { return _propSize; } - + /** * Return property's data. Constant access version. * Can be used as a C-style string (i.e. this is guaranteed to have a trailing zero). @@ -200,16 +200,16 @@ protected: */ class WagFileParser { // Constants, type definitions, enumerations etc. -public: - static const uint WINAGI_VERSION_LENGTH = 16; ///< WinAGI's version string's length (Always 16) +public: + static const uint WINAGI_VERSION_LENGTH = 16; ///< WinAGI's version string's length (Always 16) typedef Common::Array PropertyList; ///< A type definition for an array of *.wag file properties - + public: /** * Constructor. Creates a WagFileParser object in a default state. */ WagFileParser(); - + /** * Destructor. */ @@ -220,7 +220,7 @@ public: * @note After this you can access the loaded properties using getProperty() and getProperties() etc. * @param filename Name of the file to be parsed. * @return True if parsed successfully, false otherwise. - */ + */ bool parse(const char *filename); /** @@ -229,7 +229,7 @@ public: * @return The list of loaded properties. */ const PropertyList &getProperties() const { return _propList; }; - + /** * Get property with the given property code. * @note Use only after a call to parse() first. @@ -257,7 +257,7 @@ public: * @return AGI interpreter version number if successful, 0 otherwise. */ uint16 convertToAgiVersionNumber(const WagProperty &version); - + /** * Was the file parsed successfully? * @return True if file was parsed successfully, false otherwise. diff --git a/engines/agos/agos.cpp b/engines/agos/agos.cpp index bccd515e0b..7e5613f027 100644 --- a/engines/agos/agos.cpp +++ b/engines/agos/agos.cpp @@ -523,7 +523,7 @@ AGOSEngine::AGOSEngine(OSystem *syst) File::addDefaultDirectory(_gameDataPath + "SFX"); File::addDefaultDirectory(_gameDataPath + "speech"); File::addDefaultDirectory(_gameDataPath + "SPEECH"); - + syst->getEventManager()->registerRandomSource(_rnd, "agos"); } diff --git a/engines/agos/agos.h b/engines/agos/agos.h index bccd5d9032..2e8a20f6fd 100644 --- a/engines/agos/agos.h +++ b/engines/agos/agos.h @@ -592,7 +592,7 @@ protected: void setUserItem(Item *item, int n, int m); void paletteFadeOut(byte *palPtr, uint num, uint size); - + byte *allocateItem(uint size); byte *allocateTable(uint size); void alignTableMem(); @@ -795,7 +795,7 @@ protected: virtual void drawIconArray(uint i, Item *item_ptr, int line, int classMask); void removeIconArray(uint num); - void loadIconData(); + void loadIconData(); void loadIconFile(); void loadMenuFile(); @@ -1054,7 +1054,7 @@ public: void o_setDollar(); void o_isBox(); - int16 levelOf(Item *item); + int16 levelOf(Item *item); int16 moreText(Item *i); void lobjFunc(Item *i, const char *f); uint confirmYesOrNo(uint16 x, uint16 y); diff --git a/engines/agos/animation.h b/engines/agos/animation.h index 6776395ab7..4e8f15e33a 100644 --- a/engines/agos/animation.h +++ b/engines/agos/animation.h @@ -51,7 +51,7 @@ class MoviePlayer : public Graphics::DXAPlayer { bool _leftButtonDown; bool _rightButtonDown; uint32 _ticks; - + char baseName[40]; static const char *_sequenceList[90]; uint8 _sequenceNum; diff --git a/engines/agos/intern.h b/engines/agos/intern.h index a6d843d183..6becd8fc73 100644 --- a/engines/agos/intern.h +++ b/engines/agos/intern.h @@ -38,7 +38,7 @@ enum ChildType { kContainerType = 7, kChainType = 8, kUserFlagType = 9, - + kInheritType = 255 }; diff --git a/engines/agos/module.mk b/engines/agos/module.mk index 33a40bbbfb..d217dd7cfb 100644 --- a/engines/agos/module.mk +++ b/engines/agos/module.mk @@ -51,5 +51,5 @@ ifdef BUILD_PLUGINS PLUGIN := 1 endif -# Include common rules +# Include common rules include $(srcdir)/rules.mk diff --git a/engines/agos/script_e2.cpp b/engines/agos/script_e2.cpp index e1ee4d4c3e..9bbcbf15b3 100644 --- a/engines/agos/script_e2.cpp +++ b/engines/agos/script_e2.cpp @@ -654,7 +654,7 @@ void AGOSEngine_Elvira2::oe2_isAdjNoun() { int16 a = getNextWord(), b = getNextWord(); if (getGameType() == GType_ELVIRA2) { - // WORKAROUND bug #1745996: A NULL item can occur when + // WORKAROUND bug #1745996: A NULL item can occur when // interacting with items in the dinning room if (item == NULL) { setScriptCondition(false); diff --git a/engines/cine/module.mk b/engines/cine/module.mk index 07e267289f..23792a17b9 100644 --- a/engines/cine/module.mk +++ b/engines/cine/module.mk @@ -25,5 +25,5 @@ ifdef BUILD_PLUGINS PLUGIN := 1 endif -# Include common rules +# Include common rules include $(srcdir)/rules.mk diff --git a/engines/cruise/actor.cpp b/engines/cruise/actor.cpp index 50ab7e1656..943ffa5c8d 100644 --- a/engines/cruise/actor.cpp +++ b/engines/cruise/actor.cpp @@ -89,7 +89,7 @@ void getPixel(int x, int y) { tableau+=u*2; x_min = *tableau++; x_max = *tableau++; - + if ( (x>=x_min && x<=x_max) ) { flag_obstacle = walkboxColor[computedVar14]; @@ -1001,8 +1001,8 @@ void processAnimation(void) { /* * if (pl->next_dir!=pl->start_dir) * { - * pl->phase=PHASE_STATIC; - * pl->cnt=0; + * pl->phase=PHASE_STATIC; + * pl->cnt=0; * break; * } */ diff --git a/engines/cruise/background.cpp b/engines/cruise/background.cpp index 9d1bf61267..15b4c91e47 100644 --- a/engines/cruise/background.cpp +++ b/engines/cruise/background.cpp @@ -162,7 +162,7 @@ int loadBackground(const char *name, int idx) { { uint8* inPtr = ptr2 + i * 2; uint8* outPtr = palScreen[idx] +i * 3; - + outPtr[2] = ((inPtr[1])&0x0F) * 17; outPtr[1] = (((inPtr[1])&0xF0) >> 4) * 17; outPtr[0] = ((inPtr[0])&0x0F) * 17; diff --git a/engines/cruise/backgroundIncrust.cpp b/engines/cruise/backgroundIncrust.cpp index e4a716b25a..c66fb9eb9b 100644 --- a/engines/cruise/backgroundIncrust.cpp +++ b/engines/cruise/backgroundIncrust.cpp @@ -165,7 +165,7 @@ backgroundIncrustStruct *addBackgroundIncrust(int16 overlayIdx, int16 objectIdx, int newY; int newScale; char *newFrame; - + int sizeTable[4]; // 0 = left, 1 = right, 2 = bottom, 3 = top // this function checks if the dataPtr is not 0, else it retrives the data for X, Y, scale and DataPtr again (OLD: mainDrawSub1Sub1) @@ -202,7 +202,7 @@ void saveIncrust(Common::OutSaveFile& currentSaveFile) { char dummy[4] = {0, 0, 0, 0}; currentSaveFile.write(dummy, 2); currentSaveFile.write(dummy, 2); - + currentSaveFile.writeSint16LE(pl->objectIdx); currentSaveFile.writeSint16LE(pl->type); currentSaveFile.writeSint16LE(pl->overlayIdx); @@ -249,7 +249,7 @@ void loadBackgroundIncrustFromSave(Common::InSaveFile& currentSaveFile) { currentSaveFile.skip(2); currentSaveFile.skip(2); - + pl2->objectIdx = currentSaveFile.readSint16LE(); pl2->type = currentSaveFile.readSint16LE(); pl2->overlayIdx = currentSaveFile.readSint16LE(); diff --git a/engines/cruise/cell.cpp b/engines/cruise/cell.cpp index a716d0b61f..2c990817eb 100644 --- a/engines/cruise/cell.cpp +++ b/engines/cruise/cell.cpp @@ -135,7 +135,7 @@ void loadSavegameDataSub2(Common::InSaveFile& currentSaveFile) { t->animCounter = currentSaveFile.readSint16LE(); t->animLoop = currentSaveFile.readSint16LE(); currentSaveFile.skip(2); - + t->next = NULL; p->next = t; t->prev = cellHead.prev; diff --git a/engines/cruise/cruise_main.cpp b/engines/cruise/cruise_main.cpp index 1c0f1fd8ab..5d16c6e68a 100644 --- a/engines/cruise/cruise_main.cpp +++ b/engines/cruise/cruise_main.cpp @@ -899,7 +899,7 @@ bool createDialog(int objOvl, int objIdx, int x, int y) { if (!verbeOvl) verbeOvl=j; if (!obj1Ovl) obj1Ovl=j; if (!obj2Ovl) obj2Ovl=j; - + char verbe_name[80]; char obj1_name[80]; char obj2_name[80]; @@ -999,7 +999,7 @@ bool findRelation(int objOvl, int objIdx, int x, int y) { if (!verbeOvl) verbeOvl=j; if (!obj1Ovl) obj1Ovl=j; if (!obj2Ovl) obj2Ovl=j; - + char verbe_name[80]; char obj1_name[80]; char obj2_name[80]; @@ -1282,7 +1282,7 @@ void callRelation(menuElementSubStruct *pMenuElement, int nObj2) { { createTextObject(&cellHead, ovlIdx, pHeader->id, x, y, 200, findHighColor(), masterScreen, 0, 0); } - + userWait = 1; autoOvl = ovlIdx; autoMsg = pHeader->id; @@ -1393,7 +1393,7 @@ int processInput(void) { } if (dialogueEnabled) { - + if( menuDown || selectDown || linkedRelation ) { closeAllMenu(); menuDown = 0; @@ -1818,17 +1818,17 @@ void mainLoop(void) { static int16 oldMouseY = -1; getMouseStatus(&main10, &mouseX, &mouseButton, &mouseY); - + if (mouseX != oldMouseX && mouseY != oldMouseY) { int objectType; int newCursor1; int newCursor2; - + oldMouseX = mouseX; oldMouseY = mouseY; - + objectType = findObject(mouseX, mouseY, &newCursor1, &newCursor2); - + if (objectType == 9) { changeCursor(CURSOR_EXIT); } else if (objectType != -1) { diff --git a/engines/cruise/ctp.cpp b/engines/cruise/ctp.cpp index de14dba761..6c7be713ef 100644 --- a/engines/cruise/ctp.cpp +++ b/engines/cruise/ctp.cpp @@ -192,7 +192,7 @@ void makeCtStruct(uint8* str, int16 table[][40], int num, int z) { int getNode(int nodeResult[2], int nodeId){ if (nodeId < 0 || nodeId >= ctp_routeCoordCount) return -1; - + nodeResult[0] = ctp_routeCoords[nodeId][0]; nodeResult[1] = ctp_routeCoords[nodeId][1]; @@ -206,7 +206,7 @@ int setNodeColor(int nodeIdx, int nodeColor) { int oldColor = walkboxColor[nodeIdx]; if(nodeColor == -1) - return + return walkboxColor[nodeIdx] = nodeColor; @@ -220,7 +220,7 @@ int setNodeState(int nodeIdx, int nodeState) { int oldState = walkboxState[nodeIdx]; if(nodeState == -1) - return + return walkboxState[nodeIdx] = nodeState; diff --git a/engines/cruise/dataLoader.cpp b/engines/cruise/dataLoader.cpp index e0bfe70dc0..7ce69448a6 100644 --- a/engines/cruise/dataLoader.cpp +++ b/engines/cruise/dataLoader.cpp @@ -257,7 +257,7 @@ int loadFile(const char* name, int idx, int destIdx) int numMaxEntriesInSet = getNumMaxEntiresInSet(ptr); if (idx > numMaxEntriesInSet) { - return 0; // exit if limit is reached + return 0; // exit if limit is reached } return loadSetEntry(name, ptr, idx, destIdx ); @@ -296,7 +296,7 @@ int loadFileRange(const char *name, int startIdx, int currentEntryIdx, int numId for (i = 0; i < numIdx; i++) { if ((startIdx + i) > numMaxEntriesInSet) { - return 0; // exit if limit is reached + return 0; // exit if limit is reached } loadSetEntry(name, ptr, startIdx + i, currentEntryIdx + i ); } diff --git a/engines/cruise/decompiler.cpp b/engines/cruise/decompiler.cpp index 97515f751e..7eca816ec7 100644 --- a/engines/cruise/decompiler.cpp +++ b/engines/cruise/decompiler.cpp @@ -281,11 +281,11 @@ void addDecomp(char *string, ...) { va_list va; /* fprintf(fHandle,"%d: ",currentLineIdx); - * + * * va_start(va,string); * vfprintf(fHandle,string,va); * va_end(va); - * + * * fprintf(fHandle,"\n"); */ struct decompileLineStruct *pLineStruct = @@ -305,11 +305,11 @@ void addDecomp(char *string, ...) { currentLineType = 0; /*printf("%d: ",currentOffset); - * + * * va_start(va,string); * vprintf(string,va); * va_end(va); - * + * * printf("\n"); */ } diff --git a/engines/cruise/function.cpp b/engines/cruise/function.cpp index 7adc358bee..b15c8fdb4f 100644 --- a/engines/cruise/function.cpp +++ b/engines/cruise/function.cpp @@ -950,7 +950,7 @@ int16 Op_ComputeLine(void) { int x2 = popVar(); int y1 = popVar(); int x1 = popVar(); - + point* pDest = (point*)popPtr(); int maxValue = cor_droite( x1, y1, x2, y2, pDest); @@ -1382,7 +1382,7 @@ int16 Op_Strcat(void) { while(*pSource) *(pDest++) = *(pSource++); *(pDest++) = '\0'; - + return 0; } @@ -1559,7 +1559,7 @@ int16 Op_UserWait(void) return 0; } -opcodeFunction opcodeTablePtr[] = +opcodeFunction opcodeTablePtr[] = { NULL, // 0x00 Op_FadeIn, diff --git a/engines/cruise/mainDraw.cpp b/engines/cruise/mainDraw.cpp index 5a519dbd02..1a1be3940b 100644 --- a/engines/cruise/mainDraw.cpp +++ b/engines/cruise/mainDraw.cpp @@ -408,7 +408,7 @@ void buildSegment(void) { int Y2 = di[3]; int Y1 = di[1]; - + int tempAX = Y1; int tempDX = Y2; if (tempAX > tempDX) { @@ -750,9 +750,9 @@ void buildPolyModel(int positionX, int positionY, int scale, char *pMask, char * /* * NOTE: - * + * * The original code continues here with using X, Y instead of startX and StartY. - * + * * Original code: * positionX -= (upscaleValue(startX, m_scaleValue) + 0x8000) >> 16; * positionY -= (upscaleValue(startX, m_scaleValue) + 0x8000) >> 16; @@ -836,7 +836,7 @@ void buildPolyModel(int positionX, int positionY, int scale, char *pMask, char * flipShort(&minimumScale); - if ((minimumScale <= scale)) { + if ((minimumScale <= scale)) { if (m_flipLeftRight) { drawPolyMode1((unsigned char *)dataPointer, linesToDraw); } else { @@ -911,9 +911,9 @@ bool findPoly(char* dataPtr, int positionX, int positionY, int scale, int mouseX /* * NOTE: - * + * * The original code continues here with using X, Y instead of startX and StartY. - * + * * Original code: * positionX -= (upscaleValue(startX, m_scaleValue) + 0x8000) >> 16; * positionY -= (upscaleValue(startX, m_scaleValue) + 0x8000) >> 16; @@ -997,7 +997,7 @@ bool findPoly(char* dataPtr, int positionX, int positionY, int scale, int mouseX flipShort(&minimumScale); - if ((minimumScale <= scale)) { + if ((minimumScale <= scale)) { if (m_flipLeftRight) { drawPolyMode1((unsigned char *)dataPointer, linesToDraw); } else { @@ -1065,7 +1065,7 @@ void mainDrawPolygons(int fileIndex, cellStruct *plWork, int X, int scale, int Y int newY; int newScale; char *newFrame; - + int var_8; // unused int sizeTable[4]; // 0 = left, 1 = right, 2 = bottom, 3 = top @@ -1284,7 +1284,7 @@ void drawCtp(void) { void drawMenu(menuStruct *pMenu) { if (pMenu == NULL) return; - + if(pMenu->numElements == 0) return; diff --git a/engines/cruise/module.mk b/engines/cruise/module.mk index 0af8678b4a..2d5062dc38 100644 --- a/engines/cruise/module.mk +++ b/engines/cruise/module.mk @@ -37,6 +37,6 @@ ifdef BUILD_PLUGINS PLUGIN := 1 endif -# Include common rules +# Include common rules include $(srcdir)/rules.mk diff --git a/engines/cruise/mouse.cpp b/engines/cruise/mouse.cpp index 20616a72ee..a5e6c12be2 100644 --- a/engines/cruise/mouse.cpp +++ b/engines/cruise/mouse.cpp @@ -119,7 +119,7 @@ int16 main10; int hotspotY; const byte *bitmap; }; - + static const MouseCursor mouseCursors[] = { { 1, 1, mouseCursorNormal }, { 0, 0, mouseCursorDisk }, diff --git a/engines/cruise/overlay.cpp b/engines/cruise/overlay.cpp index 67f9bbab6e..d3cb93c37c 100644 --- a/engines/cruise/overlay.cpp +++ b/engines/cruise/overlay.cpp @@ -279,7 +279,7 @@ int loadOverlay(const char *scriptName) { if (!ptr) { /* releaseScript(scriptIdx,scriptName); - * + * * if (freeIsNeeded) * { * freePtr(unpackedBuffer); @@ -328,7 +328,7 @@ int loadOverlay(const char *scriptName) { if (!ptr) { /* releaseScript(scriptIdx,scriptName); - * + * * if (freeIsNeeded) * { * freePtr(unpackedBuffer); @@ -494,7 +494,7 @@ int loadOverlay(const char *scriptName) { } if (ovlData-> - specialString1Length /*|| ovlData->specialString2Length */ + specialString1Length /*|| ovlData->specialString2Length */ || ovlData->stringTable) { int i; //int unpackedSize; @@ -549,7 +549,7 @@ int loadOverlay(const char *scriptName) { if (!ovlData->nameVerbGlob) { /* releaseScript(scriptIdx,scriptName); - * + * * if (freeIsNeeded) * { * freePtr(unpackedBuffer); @@ -572,7 +572,7 @@ int loadOverlay(const char *scriptName) { if (!ovlData->arrayNameObj) { /* releaseScript(scriptIdx,scriptName); - * + * * if (freeIsNeeded) * { * freePtr(unpackedBuffer); @@ -598,7 +598,7 @@ int loadOverlay(const char *scriptName) { if (!ovlData->stringTable[i].string) { /* releaseScript(scriptIdx,scriptName); - * + * * if (freeIsNeeded) * { * freePtr(unpackedBuffer); diff --git a/engines/cruise/perso.cpp b/engines/cruise/perso.cpp index e899fa0d1c..c25476ee2a 100644 --- a/engines/cruise/perso.cpp +++ b/engines/cruise/perso.cpp @@ -196,7 +196,7 @@ void processActorWalk(int16 resx_y[4], int16 *inc_droite, int16 *inc_droite0, return; } - + *inc_droite0 = cor_droite(x1, y1, x2, y2, cor_joueur); *dir_perso = resx_y[2] = direction(x1, y1, x2, y2, *inc_jo1, *inc_jo2); *inc_jo0 = inc_jo; diff --git a/engines/cruise/saveload.cpp b/engines/cruise/saveload.cpp index 77cd904973..63edf7cb36 100644 --- a/engines/cruise/saveload.cpp +++ b/engines/cruise/saveload.cpp @@ -564,7 +564,7 @@ int saveSavegameData(int saveGameIdx) { currentSaveFile->write(workpal, sizeof(int16) * NBCOLORS); currentSaveFile->write(musicName, 15); - + const char dummy[6] = { 0, 0, 0, 0, 0, 0 }; currentSaveFile->write(dummy, 6); diff --git a/engines/cruise/vars.h b/engines/cruise/vars.h index 04568337d6..a325de3f36 100644 --- a/engines/cruise/vars.h +++ b/engines/cruise/vars.h @@ -270,7 +270,7 @@ extern int16 ctp_routeCoords[20][2]; // ctpVar3 // path-finding coordinates extern int16 ctp_routes[20][10]; // path-finding line information /* ctp_routes: - + correct size would be: ctp_routes[routeCoordCount * 20 * 2] array is seperate in 20 * 2 bytes slices. first 2 bytes of the slice indicate how many coordinates/lines are following (lineCount) diff --git a/engines/drascula/drascula.cpp b/engines/drascula/drascula.cpp index 2624039fd1..84f154b7c0 100644 --- a/engines/drascula/drascula.cpp +++ b/engines/drascula/drascula.cpp @@ -5337,7 +5337,7 @@ void DrasculaEngine::pantalla_0() { } else if (num_ejec == 4) { if (objeto_que_lleva == MIRAR) { hablar(mirar_t[c_mirar], mirar_v[c_mirar]); - c_mirar++; + c_mirar++; if (c_mirar == 3) c_mirar = 0; } else if (objeto_que_lleva == MOVER) @@ -6208,29 +6208,29 @@ void DrasculaEngine::actualiza_datos() { } else if (num_ejec == 3) { // nothing } else if (num_ejec == 4) { - if (!strcmp(num_room, "23.alg") && flags[0] == 0 && flags[11] == 0) + if (!strcmp(num_room, "23.alg") && flags[0] == 0 && flags[11] == 0) visible[2] = 1; - if (!strcmp(num_room, "23.alg") && flags[0] == 1 && flags[11] == 0) + if (!strcmp(num_room, "23.alg") && flags[0] == 1 && flags[11] == 0) visible[2] = 0; - if (!strcmp(num_room, "21.alg") && flags[10] == 1) + if (!strcmp(num_room, "21.alg") && flags[10] == 1) visible[2] = 0; if (!strcmp(num_room, "22.alg") && flags[26] == 1) { - visible[2] = 0; + visible[2] = 0; visible[1] = 1; } - if (!strcmp(num_room, "22.alg") && flags[27] == 1) + if (!strcmp(num_room, "22.alg") && flags[27] == 1) visible[3] = 0; - if (!strcmp(num_room, "26.alg") && flags[21] == 0) + if (!strcmp(num_room, "26.alg") && flags[21] == 0) strcpy(nombre_obj[2], "HUNCHBACKED"); - if (!strcmp(num_room, "26.alg") && flags[18] == 1) + if (!strcmp(num_room, "26.alg") && flags[18] == 1) visible[2] = 0; - if (!strcmp(num_room, "26.alg") && flags[12] == 1) + if (!strcmp(num_room, "26.alg") && flags[12] == 1) visible[1] = 0; - if (!strcmp(num_room, "35.alg") && flags[14] == 1) + if (!strcmp(num_room, "35.alg") && flags[14] == 1) visible[2] = 0; - if (!strcmp(num_room, "35.alg") && flags[17] == 1) + if (!strcmp(num_room, "35.alg") && flags[17] == 1) visible[3] = 1; - if (!strcmp(num_room, "35.alg") && flags[15] == 1) + if (!strcmp(num_room, "35.alg") && flags[15] == 1) visible[1] = 0; } else if (num_ejec == 5) { if (!strcmp(num_room,"49.alg") && flags[6] == 1) @@ -6256,7 +6256,7 @@ void DrasculaEngine::actualiza_datos() { espuerta[1] = 0; if (!strcmp(num_room, "60.alg")) { sentido_dr = 0; - x_dr = 155; + x_dr = 155; y_dr = 69; } } @@ -9964,7 +9964,7 @@ void DrasculaEngine::pantalla_3(int fl) { else if (objeto_que_lleva == CERRAR && fl == 129) hablar(TEXT10, "10.als"); else if (objeto_que_lleva == HABLAR && fl == 129) { - hablar(TEXT23, "23.als"); + hablar(TEXT23, "23.als"); pausa(6); hablar_sinc(TEXT50, "50.als", "11111111111144432554433"); } else if (objeto_que_lleva == MIRAR && fl == 131) @@ -9978,7 +9978,7 @@ void DrasculaEngine::pantalla_3(int fl) { else if (objeto_que_lleva == CERRAR && fl == 131) hablar(TEXT10, "10.als"); else if (objeto_que_lleva == HABLAR && fl == 131) - hablar(TEXT23, "23.als"); + hablar(TEXT23, "23.als"); else if (objeto_que_lleva == MIRAR && fl == 132) hablar(TEXT28, "28.als"); else if (objeto_que_lleva == COGER && fl == 132) @@ -9990,7 +9990,7 @@ void DrasculaEngine::pantalla_3(int fl) { else if (objeto_que_lleva == CERRAR && fl == 132) hablar(TEXT10, "10.als"); else if (objeto_que_lleva == HABLAR && fl == 132) - hablar(TEXT23, "23.als"); + hablar(TEXT23, "23.als"); else if (objeto_que_lleva == MIRAR && fl == 133) hablar(TEXT321, "321.als"); else if (objeto_que_lleva == COGER && fl == 133) @@ -10002,7 +10002,7 @@ void DrasculaEngine::pantalla_3(int fl) { else if (objeto_que_lleva == CERRAR && fl == 133) hablar(TEXT10, "10.als"); else if (objeto_que_lleva == HABLAR && fl == 133) { - hablar_sinc(TEXT322, "322.als", "13333334125433333333"); + hablar_sinc(TEXT322, "322.als", "13333334125433333333"); refresca_pantalla(); VUELCA_PANTALLA(0, 0, 0, 0, 320, 200, dir_zona_pantalla); pausa(25); @@ -10038,7 +10038,7 @@ void DrasculaEngine::pantalla_3(int fl) { hay_respuesta = 0; } -void DrasculaEngine::pantalla_4(int fl) { +void DrasculaEngine::pantalla_4(int fl) { if (objeto_que_lleva == MOVER && fl == 189 && flags[34] == 0) { hablar(TEXT327, "327.als"); agarra_objeto(13); @@ -10064,7 +10064,7 @@ void DrasculaEngine::pantalla_4(int fl) { } void DrasculaEngine::pantalla_5(int fl) { - if (objeto_que_lleva == MIRAR && fl == 136 && flags[8]==0) hablar(TEXT14, "14.als"); + if (objeto_que_lleva == MIRAR && fl == 136 && flags[8]==0) hablar(TEXT14, "14.als"); else if (objeto_que_lleva == MOVER && fl == 136) hablar(TEXT13, "13.als"); else if (objeto_que_lleva == ABRIR && fl == 136) @@ -10088,7 +10088,7 @@ void DrasculaEngine::pantalla_5(int fl) { void DrasculaEngine::pantalla_6(int fl){ if (objeto_que_lleva == MIRAR && fl==144) { - hablar(TEXT41, "41.als"); + hablar(TEXT41, "41.als"); hablar(TEXT42, "42.als"); } else if (objeto_que_lleva == COGER && fl == 144) hablar(TEXT43, "43.als"); @@ -10101,7 +10101,7 @@ void DrasculaEngine::pantalla_6(int fl){ else if (objeto_que_lleva == HABLAR && fl == 138) hablar(TEXT6, "6.als"); else if (objeto_que_lleva == MIRAR && fl == 143) - hablar(TEXT37, "37.als"); + hablar(TEXT37, "37.als"); else if (objeto_que_lleva == COGER && fl == 143) hablar(TEXT7, "7.als"); else if (objeto_que_lleva == MOVER && fl == 143) @@ -10124,14 +10124,14 @@ void DrasculaEngine::pantalla_6(int fl){ DIBUJA_BLOQUE(228, 102, hare_x + 5, hare_y - 1, 47, 73, dir_dibujo3, dir_zona_pantalla); VUELCA_PANTALLA(0, 0, 0, 0, 320, 200, dir_zona_pantalla); pausa(5); - comienza_sound("s4.als"); + comienza_sound("s4.als"); refresca_pantalla(); VUELCA_PANTALLA(0, 0, 0, 0, 320, 200, dir_zona_pantalla); fin_sound(); } else if (objeto_que_lleva == HABLAR && fl == 143) hablar(TEXT38, "38.als"); else if (objeto_que_lleva == MIRAR && fl == 139) - hablar(TEXT36, "36.als"); + hablar(TEXT36, "36.als"); else if (objeto_que_lleva == ABRIR && fl == 139 && flags[1] == 0) { DIBUJA_FONDO(0, 0, 0, 0, 320, 200, dir_dibujo1, dir_zona_pantalla); actualiza_refresco_antes(); @@ -10139,14 +10139,14 @@ void DrasculaEngine::pantalla_6(int fl){ VUELCA_PANTALLA(0, 0, 0, 0, 320, 200, dir_zona_pantalla); pausa(19); comienza_sound("s3.als"); - flags[1] = 1; + flags[1] = 1; visible[4] = 1; visible[2] = 0; refresca_pantalla(); VUELCA_PANTALLA(0, 0, 0, 0, 320, 200, dir_zona_pantalla); fin_sound(); } else if (objeto_que_lleva == MIRAR && fl == 140) - hablar(TEXT147, "147.als"); + hablar(TEXT147, "147.als"); else if (objeto_que_lleva == COGER && fl == 140) { DIBUJA_FONDO(0, 0, 0, 0, 320, 200, dir_dibujo1, dir_zona_pantalla); actualiza_refresco_antes(); @@ -10192,11 +10192,11 @@ void DrasculaEngine::pantalla_8(int fl) { void DrasculaEngine::pantalla_9(int fl){ if (objeto_que_lleva == MIRAR && fl == 150) - hablar(TEXT35, "35.als"); + hablar(TEXT35, "35.als"); else if (objeto_que_lleva == HABLAR && fl == 150) hablar(TEXT6, "6.als"); else if (objeto_que_lleva == MIRAR && fl == 51) - hablar(TEXT60, "60.als"); + hablar(TEXT60, "60.als"); else if (objeto_que_lleva == HABLAR && fl == 51 && flags[4] == 0) animacion_4_2(); else if (objeto_que_lleva == HABLAR && fl == 51 && flags[4] == 1) @@ -10211,7 +10211,7 @@ void DrasculaEngine::pantalla_9(int fl){ void DrasculaEngine::pantalla_12(int fl){ if (objeto_que_lleva == MIRAR && fl == 154) - hablar(TEXT329, "329.als"); + hablar(TEXT329, "329.als"); else if (objeto_que_lleva == HABLAR && fl == 154) hablar(TEXT330, "330.als"); else if (objeto_que_lleva == MOVER && fl == 155) @@ -10219,7 +10219,7 @@ void DrasculaEngine::pantalla_12(int fl){ else if (objeto_que_lleva == HABLAR && fl == 155) hablar(TEXT331, "331.als"); else if (objeto_que_lleva == MIRAR && fl == 156) - hablar(TEXT35, "35.als"); + hablar(TEXT35, "35.als"); else if (objeto_que_lleva == MOVER && fl == 156) hablar(TEXT48, "48.als"); else if (objeto_que_lleva == HABLAR && fl == 156) @@ -10233,18 +10233,18 @@ void DrasculaEngine::pantalla_12(int fl){ } void DrasculaEngine::pantalla_14(int fl) { - if (objeto_que_lleva == HABLAR && fl == 54 && flags[39] == 0) - animacion_12_2(); - else if (objeto_que_lleva == HABLAR && fl == 54 && flags[39] == 1) - hablar(TEXT109, "109.als"); + if (objeto_que_lleva == HABLAR && fl == 54 && flags[39] == 0) + animacion_12_2(); + else if (objeto_que_lleva == HABLAR && fl == 54 && flags[39] == 1) + hablar(TEXT109, "109.als"); else if (objeto_que_lleva == 12 && fl == 54) - animacion_26_2(); + animacion_26_2(); else if (objeto_que_lleva == HABLAR && fl == 52 && flags[5] == 0) - animacion_11_2(); + animacion_11_2(); else if (objeto_que_lleva == HABLAR && fl == 52 && flags[5] == 1) - animacion_36_2(); + animacion_36_2(); else if (objeto_que_lleva == HABLAR && fl == 53) - animacion_13_2(); + animacion_13_2(); else if (objeto_que_lleva == MIRAR && fl == 200) hablar(TEXT165, "165.als"); else if (objeto_que_lleva == MIRAR && fl == 201) @@ -10267,15 +10267,15 @@ void DrasculaEngine::pantalla_14(int fl) { void DrasculaEngine::pantalla_15(int fl) { if (objeto_que_lleva == HABLAR && fl == 188) - hablar(TEXT333, "333.als"); + hablar(TEXT333, "333.als"); else if (objeto_que_lleva == MIRAR && fl == 188) - hablar(TEXT334, "334.als"); + hablar(TEXT334, "334.als"); else if (objeto_que_lleva == 19 && fl == 188 && flags[27] == 0) - hablar(TEXT335, "335.als"); - else if (objeto_que_lleva == 19 && fl == 188 && flags[27] == 1) { - hablar(TEXT336, "336.als"); + hablar(TEXT335, "335.als"); + else if (objeto_que_lleva == 19 && fl == 188 && flags[27] == 1) { + hablar(TEXT336, "336.als"); sentido_hare = 3; - hablar(TEXT337, "337.als"); + hablar(TEXT337, "337.als"); hablar_sinc(TEXT46, "46.als", "4442444244244"); sentido_hare = 1; } else if (objeto_que_lleva == 18 && fl == 188 && flags[26] == 0) { @@ -10316,7 +10316,7 @@ void DrasculaEngine::pantalla_16(int fl) { else if (objeto_que_lleva == CERRAR && fl == 163) cierra_puerta(17, 0); else if (objeto_que_lleva == MIRAR && fl == 183) - hablar(TEXT340, "340.als"); + hablar(TEXT340, "340.als"); else if (objeto_que_lleva == HABLAR && fl == 183) { hablar(TEXT341, "341.als"); pausa(10); @@ -10336,7 +10336,7 @@ void DrasculaEngine::pantalla_16(int fl) { } else if (objeto_que_lleva == CERRAR && fl == 183) cierra_puerta(19, NO_PUERTA); else if (objeto_que_lleva == MIRAR && fl == 185) - hablar(TEXT37, "37.als"); + hablar(TEXT37, "37.als"); else if (objeto_que_lleva == COGER && fl == 185) hablar(TEXT7, "7.als"); else if (objeto_que_lleva == MOVER && fl == 185) @@ -10344,11 +10344,11 @@ void DrasculaEngine::pantalla_16(int fl) { else if (objeto_que_lleva == HABLAR && fl == 185) hablar(TEXT38, "38.als"); else if (objeto_que_lleva == MIRAR && fl == 187) { - hablar(TEXT343, "343.als"); + hablar(TEXT343, "343.als"); sentido_hare = 3; refresca_pantalla(); VUELCA_PANTALLA(0, 0, 0, 0, 320, 200, dir_zona_pantalla); - hablar(TEXT344, "344.als"); + hablar(TEXT344, "344.als"); } else if (objeto_que_lleva == HABLAR && fl == 187) hablar(TEXT345, "345.als"); else @@ -10357,7 +10357,7 @@ void DrasculaEngine::pantalla_16(int fl) { void DrasculaEngine::pantalla_17(int fl) { if (objeto_que_lleva == MIRAR && fl == 177) - hablar(TEXT35, "35.als"); + hablar(TEXT35, "35.als"); else if (objeto_que_lleva == HABLAR && fl == 177 && flags[18] == 0) hablar(TEXT6, "6.als"); else if (objeto_que_lleva == HABLAR && fl == 177 && flags[18] == 1) @@ -10381,11 +10381,11 @@ void DrasculaEngine::pantalla_17(int fl) { void DrasculaEngine::pantalla_18(int fl) { if (objeto_que_lleva == HABLAR && fl == 55 && flags[36] == 0) - animacion_24_2(); + animacion_24_2(); else if (objeto_que_lleva == HABLAR && fl == 55 && flags[36] == 1) - hablar(TEXT109, "109.als"); + hablar(TEXT109, "109.als"); else if (objeto_que_lleva == MIRAR && fl == 181) - hablar(TEXT348, "348.als"); + hablar(TEXT348, "348.als"); else if (objeto_que_lleva == COGER && fl == 182) { DIBUJA_FONDO(0, 0, 0, 0, 320, 200, dir_dibujo1, dir_zona_pantalla); actualiza_refresco_antes(); @@ -10393,8 +10393,8 @@ void DrasculaEngine::pantalla_18(int fl) { actualiza_refresco(); VUELCA_PANTALLA(0, 0, 0, 0, 320, 200, dir_zona_pantalla); pausa(4); - agarra_objeto(12); - visible[2] = 0; + agarra_objeto(12); + visible[2] = 0; flags[28] = 1; } else if (objeto_que_lleva == MIRAR && fl == 182) hablar(TEXT154, "154.als"); @@ -10411,13 +10411,13 @@ void DrasculaEngine::pantalla_18(int fl) { else if (objeto_que_lleva == 8 && fl == 55 && flags[38] == 1 && flags[33] == 1) animacion_24_2(); else if (objeto_que_lleva == 13 && fl == 55 && flags[38] == 1 && flags[33] == 1) - animacion_24_2(); + animacion_24_2(); else if (objeto_que_lleva == 15 && fl == 55 && flags[38] == 1 && flags[33] == 1) - animacion_24_2(); + animacion_24_2(); else if (objeto_que_lleva == 16 && fl == 55 && flags[38] == 1 && flags[33] == 1) - animacion_24_2(); + animacion_24_2(); else if (objeto_que_lleva == 17 && fl == 55 && flags[38] == 1 && flags[33] == 1) - animacion_24_2(); + animacion_24_2(); else if (objeto_que_lleva == 11 && fl == 50 && flags[22] == 0) { sentido_hare = 3; refresca_pantalla(); @@ -10429,8 +10429,8 @@ void DrasculaEngine::pantalla_18(int fl) { VUELCA_PANTALLA(0, 0, 0, 0, 320, 200, dir_zona_pantalla); pausa(6); hablar(TEXT347, "347.als"); - flags[29] = 1; - agarra_objeto(23); + flags[29] = 1; + agarra_objeto(23); resta_objeto(11); } else hay_respuesta = 0; @@ -10533,7 +10533,7 @@ bucless: if (key != 0) ctvd_stop(); buffer_teclado(); - if (hay_sb == 1) { + if (hay_sb == 1) { if (LookForFree() != 0) goto bucless; delete sku; @@ -10595,16 +10595,16 @@ bucless: if (key != 0) ctvd_stop(); buffer_teclado(); - if (hay_sb == 1) { + if (hay_sb == 1) { if (LookForFree() != 0) goto bucless; delete sku; ctvd_terminate(); } else { - longitud = longitud - 2; + longitud = longitud - 2; if (longitud > 0) goto bucless; - } + } flags[19] = cara_antes; refresca_pantalla(); @@ -10649,7 +10649,7 @@ void DrasculaEngine::animacion_12_2() { flags[11] = 1; habla_pianista(TEXTP5, "P5.als"); - conversa("op_1.cal"); + conversa("op_1.cal"); flags[11] = 0; lee_dibujos("974.alg"); @@ -10763,7 +10763,7 @@ void DrasculaEngine::animacion_13_2() { habla_borracho(TEXTB7, "B7.als"); flags[41] = 1; } - conversa("op_2.cal"); + conversa("op_2.cal"); lee_dibujos("964.alg"); descomprime_dibujo(dir_hare_frente, 1); @@ -10816,7 +10816,7 @@ void DrasculaEngine::animacion_24_2() { if (flags[22] == 0) conversa("op_4.cal"); else - conversa("op_5.cal"); + conversa("op_5.cal"); sal_de_la_habitacion(0); flags[21] = 0; @@ -11276,7 +11276,7 @@ void DrasculaEngine::animacion_5_2() { x = x + 52; pausa(3); } - fin_sound_corte(); + fin_sound_corte(); x = 0; @@ -11324,9 +11324,9 @@ void DrasculaEngine::animacion_6_2() { pausa(1); if (flags[4] == 1) - habla_hacker(TEXTD66, "d66.als"); + habla_hacker(TEXTD66, "d66.als"); pausa(6); - habla_ciego(TEXTD78, "d78.als", + habla_ciego(TEXTD78, "d78.als", "004447222550002222755554444466222000220555002220550444446666662220000557550033344477222522665444466663337446055504446550550550222633003330000666622044422755722270255566667555655007222777"); pausa(4); habla_hacker(TEXTD67, "d67.als"); @@ -11359,7 +11359,7 @@ void DrasculaEngine::animacion_33_2() { flags[9] = 1; pausa(12); - hablar(TEXTD56, "d56.als" ); + hablar(TEXTD56, "d56.als" ); pausa(8); borra_pantalla(); @@ -11381,11 +11381,11 @@ void DrasculaEngine::animacion_33_2() { habla_ciego(TEXTD68, "d68.als", "44472225500022227555544444472225500022227555544444664466"); pausa(5); - habla_hacker(TEXTD57, "d57.als"); + habla_hacker(TEXTD57, "d57.als"); pausa(6); _system->delayMillis(1000); habla_ciego(TEXTD77, "d77.als", "56665004444447222550002222755554444466555033022755555000444444444444444444444444444444"); - habla_hacker(TEXTD65, "d65.als"); + habla_hacker(TEXTD65, "d65.als"); DIBUJA_FONDO(0, 0, 0, 0, 320, 200, dir_dibujo1, dir_zona_pantalla); VUELCA_PANTALLA(0, 0, 0, 0, 320, 200, dir_zona_pantalla); @@ -11413,9 +11413,9 @@ void DrasculaEngine::animacion_33_2() { bool DrasculaEngine::pantalla_21(int fl) { if (objeto_que_lleva == ABRIR && fl == 101 && flags[28] == 0) - hablar(TEXT419, "419.als"); + hablar(TEXT419, "419.als"); else if (objeto_que_lleva == ABRIR && fl == 101 && flags[28] == 1) - abre_puerta(0, 1); + abre_puerta(0, 1); else if (objeto_que_lleva == CERRAR && fl == 101) cierra_puerta(0, 1); else if(objeto_que_lleva == COGER && fl == 141) { @@ -11455,11 +11455,11 @@ void DrasculaEngine::pantalla_22(int fl) { hablar(TEXT499, "499.als"); hablar(TEXT500, "500.als"); } else if (objeto_que_lleva == MIRAR && fl == 52) - hablar(TEXT497, "497.als"); + hablar(TEXT497, "497.als"); else if (objeto_que_lleva == HABLAR && fl == 52) - hablar(TEXT498, "498.als"); + hablar(TEXT498, "498.als"); else if (objeto_que_lleva == COGER && fl == 180 && flags[26] == 0) - hablar(TEXT420, "420.als"); + hablar(TEXT420, "420.als"); else if (objeto_que_lleva == COGER && fl == 180 && flags[26] == 1) { agarra_objeto(7); visible[3] = 0; @@ -11476,7 +11476,7 @@ void DrasculaEngine::pantalla_23(int fl) { cierra_puerta(0, 0); actualiza_datos(); } else if(objeto_que_lleva == ABRIR && fl == 104) - abre_puerta(1, 1); + abre_puerta(1, 1); else if(objeto_que_lleva == CERRAR && fl == 104) cierra_puerta(1, 1); else if(objeto_que_lleva == COGER && fl == 142) { @@ -11493,11 +11493,11 @@ void DrasculaEngine::pantalla_23(int fl) { void DrasculaEngine::pantalla_24(int fl) { if (objeto_que_lleva == ABRIR && fl == 105) - abre_puerta(1, 0); + abre_puerta(1, 0); else if (objeto_que_lleva == CERRAR && fl == 105) cierra_puerta(1, 0); else if (objeto_que_lleva == ABRIR && fl == 106) - abre_puerta(2, 1); + abre_puerta(2, 1); else if (objeto_que_lleva == CERRAR && fl == 106) cierra_puerta(2, 1); else if (objeto_que_lleva == MIRAR && fl == 151) @@ -11508,9 +11508,9 @@ void DrasculaEngine::pantalla_24(int fl) { void DrasculaEngine::pantalla_26(int fl) { if (objeto_que_lleva == ABRIR && fl == 107 && flags[30] == 0) - abre_puerta(2, 0); + abre_puerta(2, 0); else if (objeto_que_lleva == ABRIR && fl == 107 && flags[30] == 1) - hablar(TEXT421, "421.als"); + hablar(TEXT421, "421.als"); else if (objeto_que_lleva == CERRAR && fl == 107) cierra_puerta(2, 0); else if (objeto_que_lleva == 10 && fl == 50 && flags[18] == 1 && flags[12] == 1) @@ -11525,7 +11525,7 @@ void DrasculaEngine::pantalla_26(int fl) { lleva_al_hare(260, 180); agarra_objeto(10); visible[1] = 0; - flags[12] = 1; + flags[12] = 1; cierra_puerta(2, 0); sentido_hare = 2; habla_igorpuerta(TEXTI27, "I27.als"); @@ -11542,70 +11542,70 @@ void DrasculaEngine::pantalla_26(int fl) { } else if (objeto_que_lleva == HABLAR && fl == 51) animacion_1_4(); else if (objeto_que_lleva == ABRIR && fl == 167) - hablar(TEXT467, "467.als"); + hablar(TEXT467, "467.als"); else if (objeto_que_lleva == MIRAR && fl == 164) - hablar(TEXT470, "470.als"); + hablar(TEXT470, "470.als"); else if (objeto_que_lleva == ABRIR && fl == 164) - hablar(TEXT471, "471.als"); + hablar(TEXT471, "471.als"); else if (objeto_que_lleva == MIRAR && fl == 163) - hablar(TEXT472, "472.als"); + hablar(TEXT472, "472.als"); else if (objeto_que_lleva == COGER && fl == 163) - hablar(TEXT473, "473.als"); + hablar(TEXT473, "473.als"); else if (objeto_que_lleva == MIRAR && fl == 165) - hablar(TEXT474, "474.als"); + hablar(TEXT474, "474.als"); else if (objeto_que_lleva == MIRAR && fl == 168) - hablar(TEXT476, "476.als"); + hablar(TEXT476, "476.als"); else if (objeto_que_lleva == COGER && fl == 168) - hablar(TEXT477, "477.als"); + hablar(TEXT477, "477.als"); else hay_respuesta = 0; } void DrasculaEngine::pantalla_27(int fl) { if (objeto_que_lleva == ABRIR && fl == 110) - abre_puerta(6, 1); + abre_puerta(6, 1); else if (objeto_que_lleva == CERRAR && fl == 110) cierra_puerta(6, 1); else if (objeto_que_lleva == ABRIR && fl == 116 && flags[23] == 0) hablar(TEXT419, "419.als"); else if (objeto_que_lleva == ABRIR && fl == 116 && flags[23] == 1) - abre_puerta(5, 3); + abre_puerta(5, 3); else if (objeto_que_lleva == 17 && fl == 116) { flags[23] = 1; abre_puerta(5,3); sin_verbo(); } else if (objeto_que_lleva == MIRAR && fl == 175) - hablar(TEXT429, "429.als"); + hablar(TEXT429, "429.als"); else if (fl == 150) - hablar(TEXT460, "460.als"); + hablar(TEXT460, "460.als"); else hay_respuesta = 0; } void DrasculaEngine::pantalla_29(int fl) { if (objeto_que_lleva == ABRIR && fl == 114) - abre_puerta(4, 1); + abre_puerta(4, 1); else if (objeto_que_lleva == CERRAR && fl == 114) - cierra_puerta(4, 1); + cierra_puerta(4, 1); else if (objeto_que_lleva == MIRAR && fl == 152) - hablar(TEXT463, "463.als"); + hablar(TEXT463, "463.als"); else if (objeto_que_lleva == ABRIR && fl == 152) - hablar(TEXT464, "464.als"); + hablar(TEXT464, "464.als"); else if (objeto_que_lleva == MIRAR && fl == 153) - hablar(TEXT465, "465.als"); + hablar(TEXT465, "465.als"); else if (objeto_que_lleva == COGER && fl == 154) - hablar(TEXT466, "466.als"); + hablar(TEXT466, "466.als"); else if (objeto_que_lleva == ABRIR && fl == 156) - hablar(TEXT467, "467.als"); + hablar(TEXT467, "467.als"); else hay_respuesta = 0; } void DrasculaEngine::pantalla_30(int fl) { if (objeto_que_lleva == ABRIR && fl == 115) - abre_puerta(4, 0); + abre_puerta(4, 0); else if (objeto_que_lleva == CERRAR && fl == 115) - cierra_puerta(4, 0); + cierra_puerta(4, 0); else if (objeto_que_lleva == ABRIR && fl == 144 && flags[19] == 0) hablar(TEXT422, "422.als"); else if (objeto_que_lleva == ABRIR && fl == 144 && flags[19] == 1 && flags[22] == 1) @@ -11620,14 +11620,14 @@ void DrasculaEngine::pantalla_30(int fl) { if (flags[18] == 1) animacion_6_2(); } else if (objeto_que_lleva == CERRAR && fl == 144) - cierra_puerta(16, 1); + cierra_puerta(16, 1); else if (objeto_que_lleva == 13 && fl == 144) { hablar(TEXT424, "424.als"); flags[19] = 1; } else if (objeto_que_lleva == ABRIR && fl == 157) - hablar(TEXT468, "468.als"); + hablar(TEXT468, "468.als"); else if (objeto_que_lleva == MIRAR && fl == 158) - hablar(TEXT469, "469.als"); + hablar(TEXT469, "469.als"); else hay_respuesta = 0; } @@ -11638,26 +11638,26 @@ void DrasculaEngine::pantalla_31(int fl) { visible[1] = 0; flags[13] = 1; } else if (objeto_que_lleva == ABRIR && fl == 117) - abre_puerta(5, 0); + abre_puerta(5, 0); else if (objeto_que_lleva == CERRAR && fl == 117) - cierra_puerta(5, 0); + cierra_puerta(5, 0); else if (objeto_que_lleva == MIRAR && fl == 161) - hablar(TEXT470, "470.als"); + hablar(TEXT470, "470.als"); else if (objeto_que_lleva == ABRIR && fl == 161) - hablar(TEXT471, "471.als"); + hablar(TEXT471, "471.als"); else hay_respuesta = 0; } void DrasculaEngine::pantalla_34(int fl) { if (objeto_que_lleva == MOVER && fl == 146) - animacion_8_4(); + animacion_8_4(); else if (objeto_que_lleva == MIRAR && fl == 146) hablar(TEXT458, "458.als"); else if (objeto_que_lleva == COGER && fl == 146) hablar(TEXT459, "459.als"); else if (objeto_que_lleva == ABRIR && fl == 120 && flags[25] == 1) - abre_puerta(8, 2); + abre_puerta(8, 2); else if (objeto_que_lleva == ABRIR && fl == 120 && flags[25] == 0) { abre_puerta(8, 2); sentido_hare = 3; @@ -11696,7 +11696,7 @@ void DrasculaEngine::pantalla_35(int fl) { void DrasculaEngine::pantalla_44(int fl) { if (objeto_que_lleva == MIRAR && fl == 172) - hablar(TEXT428, "428.als"); + hablar(TEXT428, "428.als"); else hay_respuesta = 0; } @@ -11716,7 +11716,7 @@ void DrasculaEngine::habla_igorpuerta(const char *dicho, const char *filename) { color_abc(BLANCO); - if (hay_sb == 1){ + if (hay_sb == 1){ sku = new Common::File; sku->open(filename); if (!sku->isOpen()) { @@ -11738,13 +11738,13 @@ bucless: if (key != 0) ctvd_stop(); buffer_teclado(); - if (hay_sb == 1) { + if (hay_sb == 1) { if (LookForFree() != 0) goto bucless; delete sku; ctvd_terminate(); } else { - longitud = longitud - 2; + longitud = longitud - 2; if (longitud > 0) goto bucless; } @@ -11771,7 +11771,7 @@ void DrasculaEngine::habla_igor_peluca(const char *dicho, const char *filename) color_abc(BLANCO); - if (hay_sb == 1){ + if (hay_sb == 1){ sku = new Common::File; sku->open(filename); if (!sku->isOpen()) { @@ -11805,16 +11805,16 @@ bucless: if (key != 0) ctvd_stop(); buffer_teclado(); - if (hay_sb == 1){ + if (hay_sb == 1){ if (LookForFree() != 0) goto bucless; delete sku; ctvd_terminate(); } else { - longitud = longitud - 2; + longitud = longitud - 2; if (longitud > 0) goto bucless; - } + } refresca_pantalla(); VUELCA_PANTALLA(0, 0, 0, 0, 320, 200, dir_zona_pantalla); diff --git a/engines/gob/coktelvideo.h b/engines/gob/coktelvideo.h index 936b92c8f1..2b67f649f6 100644 --- a/engines/gob/coktelvideo.h +++ b/engines/gob/coktelvideo.h @@ -74,7 +74,7 @@ public: struct State { /** Left-most value of the updated rectangle. */ int16 left; - /** Top-most value of the updated rectangle. */ + /** Top-most value of the updated rectangle. */ int16 top; /** Right-most value of the updated rectangle. */ int16 right; @@ -231,7 +231,7 @@ protected: Audio::AppendableAudioStream *_audioStream; Audio::SoundHandle _audioHandle; - + uint32 _frameLength; uint32 _lastFrameTime; diff --git a/engines/gob/game.h b/engines/gob/game.h index 89877668c9..5cf5e1bea6 100644 --- a/engines/gob/game.h +++ b/engines/gob/game.h @@ -215,7 +215,7 @@ protected: byte *_variablesSizesArray[5]; GobEngine *_vm; - + int16 adjustKey(int16 key); byte *loadLocTexts(int32 *dataSize = 0); diff --git a/engines/gob/goblin.cpp b/engines/gob/goblin.cpp index bf07551569..df5811150e 100644 --- a/engines/gob/goblin.cpp +++ b/engines/gob/goblin.cpp @@ -1757,7 +1757,7 @@ void Goblin::setState(int16 index, int16 state) { (_vm->_scenery->_animBottom - _vm->_scenery->_animTop) - (obj->goblinY + 1) / 2; } else { - *obj->pPosY = (obj->goblinY + 1) * _vm->_map->_tilesHeight - + *obj->pPosY = (obj->goblinY + 1) * _vm->_map->_tilesHeight - (_vm->_scenery->_animBottom - _vm->_scenery->_animTop); } *obj->pPosX = obj->goblinX * _vm->_map->_tilesWidth; @@ -1849,7 +1849,7 @@ void Goblin::move(int16 destX, int16 destY, int16 objIndex) { mouseY = _vm->_global->_inter_mouseY; if (_vm->_map->_bigTiles) mouseY += ((_vm->_global->_inter_mouseY / _vm->_map->_tilesHeight) + 1) / 2; - + gobDestX = mouseX / _vm->_map->_tilesWidth; gobDestY = mouseY / _vm->_map->_tilesHeight; diff --git a/engines/gob/map.h b/engines/gob/map.h index ac9f0d48a8..8a94de8da9 100644 --- a/engines/gob/map.h +++ b/engines/gob/map.h @@ -133,7 +133,7 @@ public: return _passMap[y * _mapWidth + x]; } - + virtual void setPass(int x, int y, int8 pass, int heightOff = -1) { if (!_passMap) return; @@ -167,7 +167,7 @@ public: heightOff = _passWidth; return _passMap[y * heightOff + x]; } - + virtual void setPass(int x, int y, int8 pass, int heightOff = -1) { if (!_passMap) return; diff --git a/engines/gob/module.mk b/engines/gob/module.mk index b51de90656..8a428b4d34 100644 --- a/engines/gob/module.mk +++ b/engines/gob/module.mk @@ -59,5 +59,5 @@ ifdef BUILD_PLUGINS PLUGIN := 1 endif -# Include common rules +# Include common rules include $(srcdir)/rules.mk diff --git a/engines/gob/mult.h b/engines/gob/mult.h index b3fa892f34..90f6e61f9a 100644 --- a/engines/gob/mult.h +++ b/engines/gob/mult.h @@ -197,7 +197,7 @@ public: int16 sndSlotsCount; int16 sndSlot[60]; - int16 frameRate; + int16 frameRate; Video::Color fadePal[5][16]; int16 animObjs[4][4]; diff --git a/engines/gob/music.h b/engines/gob/music.h index 80dbc49167..199ea515b0 100644 --- a/engines/gob/music.h +++ b/engines/gob/music.h @@ -63,7 +63,7 @@ public: bool endOfData() const { return !_playing; } bool endOfStream() const { return false; } int getRate() const { return _rate; } - + protected: static const char *_tracks[][2]; static const char *_trackFiles[]; diff --git a/engines/gob/parse.h b/engines/gob/parse.h index 61c3763ce4..7d451b5f79 100644 --- a/engines/gob/parse.h +++ b/engines/gob/parse.h @@ -36,7 +36,7 @@ public: virtual int16 parseVarIndex(void) = 0; virtual int16 parseValExpr(byte stopToken = 99) = 0; virtual int16 parseExpr(byte stopToken, byte *resultPtr) = 0; - + Parse(GobEngine *vm); virtual ~Parse() {} diff --git a/engines/gob/scenery.h b/engines/gob/scenery.h index 800d0dbd2b..290d67d2d5 100644 --- a/engines/gob/scenery.h +++ b/engines/gob/scenery.h @@ -120,13 +120,13 @@ public: void updateAnim(int16 layer, int16 frame, int16 animation, int16 flags, int16 drawDeltaX, int16 drawDeltaY, char doDraw); - void writeAnimLayerInfo(uint16 index, uint16 layer, + void writeAnimLayerInfo(uint16 index, uint16 layer, int16 varDX, int16 varDY, int16 varUnk0, int16 varFrames); int16 getStaticLayersCount(uint16 index); int16 getAnimLayersCount(uint16 index); StaticLayer *getStaticLayer(uint16 index, uint16 layer); AnimLayer *getAnimLayer(uint16 index, uint16 layer); - + virtual int16 loadAnim(char search); Scenery(GobEngine *vm); diff --git a/engines/gob/sound.h b/engines/gob/sound.h index b2691b2ce6..6780c201b5 100644 --- a/engines/gob/sound.h +++ b/engines/gob/sound.h @@ -71,7 +71,7 @@ public: uint32 fadeSize = fade ? _size / 2 : 0; return ((_size * repCount - fadeSize) * 1000) / frequency; } - + SoundDesc() : _data(0), _dataPtr(0), _size(0), _type(SOUND_SND), _source(SOUND_FILE), _repCount(0), _frequency(0), _flag(0), _id(0) {} @@ -129,7 +129,7 @@ protected: Audio::SoundHandle *_activeHandle; Audio::SoundHandle _compositionHandle; - + SoundDesc *_compositionSamples; int8 _compositionSampleCount; int16 _composition[50]; diff --git a/engines/igor/parts/part_05.cpp b/engines/igor/parts/part_05.cpp index 08ebf31481..a336468a11 100644 --- a/engines/igor/parts/part_05.cpp +++ b/engines/igor/parts/part_05.cpp @@ -125,7 +125,7 @@ void IgorEngine::PART_05_ACTION_103() { _objectsState[60] = 1; if (_game.version == kIdEngDemo110) { ++_demoActionsCounter; - } + } PART_05_HELPER_4(255); } diff --git a/engines/igor/parts/part_17.cpp b/engines/igor/parts/part_17.cpp index 3e60e2f144..e4b227307e 100644 --- a/engines/igor/parts/part_17.cpp +++ b/engines/igor/parts/part_17.cpp @@ -504,7 +504,7 @@ void IgorEngine::PART_17() { while (_currentPart >= 170 && _currentPart <= 171) { runPartLoop(); } - leavePartLoop(); + leavePartLoop(); if (_objectsState[55] == 1) { _objectsState[56] = 1; } diff --git a/engines/igor/parts/part_21.cpp b/engines/igor/parts/part_21.cpp index 8e5ffb795a..ef284208a8 100644 --- a/engines/igor/parts/part_21.cpp +++ b/engines/igor/parts/part_21.cpp @@ -205,7 +205,7 @@ void IgorEngine::PART_21_ACTION_111() { PART_21_HELPER_1(255); if (_game.version == kIdEngDemo110) { ++_demoActionsCounter; - } + } ADD_DIALOGUE_TEXT(210, 2); SET_DIALOGUE_TEXT(1, 1); startIgorDialogue(); @@ -468,7 +468,7 @@ void IgorEngine::PART_21() { PART_21_HELPER_3(); } else if (_currentPart == 212) { PART_21_HELPER_4(); - } + } enterPartLoop(); while (_currentPart >= 210 && _currentPart <= 212) { runPartLoop(); diff --git a/engines/kyra/animator_v1.h b/engines/kyra/animator_v1.h index 04965875c0..7bfb872651 100644 --- a/engines/kyra/animator_v1.h +++ b/engines/kyra/animator_v1.h @@ -84,7 +84,7 @@ public: void clearQueue() { _objectQueue = 0; } void addObjectToQueue(AnimObject *object); void refreshObject(AnimObject *object); - + void makeBrandonFaceMouse(); void setBrandonAnimSeqSize(int width, int height); void resetBrandonAnimSeqSize(); @@ -124,7 +124,7 @@ protected: int _brandonAnimSeqSizeWidth; int _brandonAnimSeqSizeHeight; - + }; } // end of namespace Kyra diff --git a/engines/kyra/animator_v2.cpp b/engines/kyra/animator_v2.cpp index 1662534ab9..0d4bdf3328 100644 --- a/engines/kyra/animator_v2.cpp +++ b/engines/kyra/animator_v2.cpp @@ -30,7 +30,7 @@ namespace Kyra { void KyraEngine_v2::clearAnimObjects() { memset(_animObjects, 0, sizeof(_animObjects)); - + _animObjects[0].index = 0; _animObjects[0].type = 0; _animObjects[0].enabled = 1; @@ -39,12 +39,12 @@ void KyraEngine_v2::clearAnimObjects() { _animObjects[0].height = 49; _animObjects[0].width2 = 4; _animObjects[0].height2 = 10; - + for (int i = 1; i < 11; ++i) { _animObjects[i].index = i; _animObjects[i].type = 2; } - + for (int i = 11; i <= 40; ++i) { _animObjects[i].index = i; _animObjects[i].type = 1; @@ -74,7 +74,7 @@ KyraEngine_v2::AnimObj *KyraEngine_v2::addToAnimListSorted(AnimObj *list, AnimOb prev = cur; cur = temp; } - + if (add->yPos1 <= cur->yPos1) { prev->nextObject = add; add->nextObject = cur; @@ -126,11 +126,11 @@ void KyraEngine_v2::drawAnimObjects() { for (AnimObj *curObject = _animList; curObject; curObject = curObject->nextObject) { if (!curObject->enabled) continue; - + int x = curObject->xPos2 - (_screen->getScreenDim(2)->sx << 3); int y = curObject->yPos2 - _screen->getScreenDim(2)->sy; int layer = 7; - + if (curObject->flags & 0x800) { if (curObject->animFlags) layer = 0; @@ -170,11 +170,11 @@ void KyraEngine_v2::refreshAnimObjects(int force) { width -= width + x - 322; if (height + y > 143) height -= height + y - 144; - + _screen->hideMouse(); _screen->copyRegion(x, y, x, y, width, height, 2, 0, Screen::CR_CLIPPED); _screen->showMouse(); - + curObject->needRefresh = false; } } @@ -247,37 +247,37 @@ void KyraEngine_v2::updateSceneAnim(int anim, int newFrame) { AnimObj *animObject = &_animObjects[1+anim]; if (!animObject->enabled) return; - + animObject->needRefresh = 1; animObject->unk8 = 1; animObject->flags = 0; - + if (_sceneAnims[anim].flags & 2) animObject->flags |= 0x800; else animObject->flags &= ~0x800; - + if (_sceneAnims[anim].flags & 4) animObject->flags |= 1; else animObject->flags &= ~1; - + if (_sceneAnims[anim].flags & 0x20) { animObject->shapePtr = _sceneShapeTable[newFrame]; animObject->shapeIndex2 = 0xFFFF; animObject->shapeIndex3 = 0xFFFF; - animObject->animNum = 0xFFFF; + animObject->animNum = 0xFFFF; } else { animObject->shapePtr = 0; animObject->shapeIndex3 = newFrame; animObject->animNum = anim; } - + animObject->xPos1 = _sceneAnims[anim].x; animObject->yPos1 = _sceneAnims[anim].y; animObject->xPos2 = _sceneAnims[anim].x2; animObject->yPos2 = _sceneAnims[anim].y2; - + if (_sceneAnims[anim].flags & 2) { _animList = deleteAnimListEntry(_animList, animObject); if (!_animList) diff --git a/engines/kyra/debugger.cpp b/engines/kyra/debugger.cpp index 463e66f253..d44fcb3b81 100644 --- a/engines/kyra/debugger.cpp +++ b/engines/kyra/debugger.cpp @@ -241,7 +241,7 @@ bool Debugger_v2::cmd_enterScene(int argc, const char **argv) { if (argc > 1) { int scene = atoi(argv[1]); - // game will crash if entering a non-existent scene + // game will crash if entering a non-existent scene if (scene >= _vm->_sceneListSize) { DebugPrintf("scene number must be any value between (including) 0 and %d\n", _vm->_sceneListSize-1); return true; diff --git a/engines/kyra/gui_v1.cpp b/engines/kyra/gui_v1.cpp index 6c9b822955..e7161e8fcd 100644 --- a/engines/kyra/gui_v1.cpp +++ b/engines/kyra/gui_v1.cpp @@ -122,7 +122,7 @@ int KyraEngine_v1::buttonAmuletCallback(Button *caller) { } if (queryGameFlag(0xF1)) { assert(_waitForAmulet); - characterSays(2001, _waitForAmulet[0], 0, -2); + characterSays(2001, _waitForAmulet[0], 0, -2); return 1; } if (!queryGameFlag(0x55+jewel)) { @@ -135,18 +135,18 @@ int KyraEngine_v1::buttonAmuletCallback(Button *caller) { drawJewelPress(jewel, 0); drawJewelsFadeOutStart(); drawJewelsFadeOutEnd(jewel); - + _scriptInterpreter->initScript(_scriptClick, _scriptClickData); _scriptClick->regs[3] = 0; _scriptClick->regs[6] = jewel; _scriptInterpreter->startScript(_scriptClick, 4); - + while (_scriptInterpreter->validScript(_scriptClick)) _scriptInterpreter->runScript(_scriptClick); - + if (_scriptClick->regs[3]) return 1; - + _unkAmuletVar = 1; switch (jewel-1) { case 0: @@ -158,7 +158,7 @@ int KyraEngine_v1::buttonAmuletCallback(Button *caller) { characterSays(2003, _healingTip[0], 0, -2); } break; - + case 1: seq_makeBrandonInv(); break; @@ -192,7 +192,7 @@ int KyraEngine_v1::buttonAmuletCallback(Button *caller) { assert(_magicJewelString); characterSays(2007, _magicJewelString[0], 0, -2); break; - + default: break; } @@ -213,7 +213,7 @@ void KyraEngine_v1::processButtonList(Button *list) { list = list->nextButton; continue; } - + int x = list->x; int y = list->y; assert(list->dimTableIndex < _screen->_screenDimTableCount); @@ -221,12 +221,12 @@ void KyraEngine_v1::processButtonList(Button *list) { x += _screen->_screenDimTable[list->dimTableIndex].w << 3; } x += _screen->_screenDimTable[list->dimTableIndex].sx << 3; - + if (y < 0) { y += _screen->_screenDimTable[list->dimTableIndex].h; } y += _screen->_screenDimTable[list->dimTableIndex].sy; - + Common::Point mouse = getMousePos(); if (mouse.x >= x && mouse.y >= y && x + list->width >= mouse.x && y + list->height >= mouse.y) { int processMouseClick = 0; @@ -248,7 +248,7 @@ void KyraEngine_v1::processButtonList(Button *list) { } else if (_mousePressFlag) { processMouseClick = 1; } - + if (processMouseClick) { if (list->buttonCallback) { if ((this->*(list->buttonCallback))(list)) { @@ -269,7 +269,7 @@ void KyraEngine_v1::processButtonList(Button *list) { list = list->nextButton; continue; } - + list = list->nextButton; } } @@ -277,11 +277,11 @@ void KyraEngine_v1::processButtonList(Button *list) { void KyraEngine_v1::processButton(Button *button) { if (!button) return; - + int processType = 0; uint8 *shape = 0; Button::ButtonCallback callback = 0; - + int flags = (button->flags2 & 5); if (flags == 1) { processType = button->process2; @@ -302,16 +302,16 @@ void KyraEngine_v1::processButton(Button *button) { else if (processType == 4) callback = button->process0PtrCallback; } - + int x = button->x; int y = button->y; assert(button->dimTableIndex < _screen->_screenDimTableCount); if (x < 0) x += _screen->_screenDimTable[button->dimTableIndex].w << 3; - + if (y < 0) y += _screen->_screenDimTable[button->dimTableIndex].h; - + if (processType == 1 && shape) _screen->drawShape(_screen->_curPage, shape, x, y, button->dimTableIndex, 0x10); else if (processType == 4 && callback) @@ -370,7 +370,7 @@ int KyraEngine_v1::drawBoxCallback(Button *button) { int KyraEngine_v1::drawShadedBoxCallback(Button *button) { if (!_displayMenu) return 0; - + _screen->hideMouse(); _screen->drawShadedBox(button->x, button->y, button->x + button->width, button->y + button->height, 0xf9, 0xfa); _screen->showMouse(); @@ -386,7 +386,7 @@ void KyraEngine_v1::setGUILabels() { int walkspeedGarbageOffset = 36; int menuLabelGarbageOffset = 0; - + if (_flags.isTalkie) { if (_flags.lang == Common::EN_ANY) offset = 52; @@ -409,7 +409,7 @@ void KyraEngine_v1::setGUILabels() { } assert(offset + 27 < _guiStringsSize); - + // The Legend of Kyrandia _menu[0].menuName = _guiStrings[0]; // Load a Game @@ -425,7 +425,7 @@ void KyraEngine_v1::setGUILabels() { // Cancel _menu[2].item[5].itemString = _guiStrings[10]; - + // Enter a description of your saved game: _menu[3].menuName = _guiStrings[11]; // Save @@ -439,14 +439,14 @@ void KyraEngine_v1::setGUILabels() { _menu[4].item[0].itemString = _guiStrings[1]; // Quit playing _menu[4].item[1].itemString = _guiStrings[4]; - + // Game Controls _menu[5].menuName = _guiStrings[6]; // Yes _menu[1].item[0].itemString = _guiStrings[22 + offset]; // No _menu[1].item[1].itemString = _guiStrings[23 + offset]; - + // Music is _menu[5].item[0].labelString = _guiStrings[26 + offsetOptions]; // Sounds are @@ -457,7 +457,7 @@ void KyraEngine_v1::setGUILabels() { _menu[5].item[4].labelString = _guiStrings[25 + offsetOptions]; // Main Menu _menu[5].item[5].itemString = &_guiStrings[19 + offsetMainMenu][menuLabelGarbageOffset]; - + if (_flags.isTalkie) // Text & Voice _voiceTextString = _guiStrings[28 + offset]; @@ -473,7 +473,7 @@ int KyraEngine_v1::buttonMenuCallback(Button *caller) { assert(_guiStrings); assert(_configStrings); - + /* for (int i = 0; i < _guiStringsSize; i++) debug("GUI string %i: %s", i, _guiStrings[i]); @@ -481,7 +481,7 @@ int KyraEngine_v1::buttonMenuCallback(Button *caller) { for (int i = 0; i < _configStringsSize; i++) debug("Config string %i: %s", i, _configStrings[i]); */ - + setGUILabels(); if (_currentCharacter->sceneId == 210 && _deathHandler == 0xFF) { snd_playSoundEffect(0x36); @@ -505,7 +505,7 @@ int KyraEngine_v1::buttonMenuCallback(Button *caller) { _menuRestoreScreen = true; _keyPressed.reset(); _mousePressFlag = false; - + _toplevelMenu = 0; if (_menuDirectlyToLoad) { gui_loadGameMenu(0); @@ -558,7 +558,7 @@ void KyraEngine_v1::initMenu(Menu &menu) { _text->printText(menu.menuName, textX - 1, textY + 1, 12, 248, 0); _text->printText(menu.menuName, textX, textY, menu.textColor, 0, 0); - int x1, y1, x2, y2; + int x1, y1, x2, y2; for (int i = 0; i < menu.nrOfItems; i++) { if (!menu.item[i].enabled) continue; @@ -618,7 +618,7 @@ void KyraEngine_v1::initMenu(Menu &menu) { _scrollUpButton.nextButton = 0; _menuButtonList = initButton(_menuButtonList, &_scrollUpButton); processMenuButton(&_scrollUpButton); - + _scrollDownButton.x = menu.scrollDownBtnX + menu.x; _scrollDownButton.y = menu.scrollDownBtnY + menu.y; _scrollDownButton.buttonCallback = &KyraEngine_v1::gui_scrollDown; @@ -638,12 +638,12 @@ void KyraEngine_v1::calcCoords(Menu &menu) { int widthBackup = _screen->_charWidth; _screen->_charWidth = -2; - + menu.x = (320 - menu.width)/2; - int menu_x2 = menu.width + menu.x - 1; + int menu_x2 = menu.width + menu.x - 1; int maxOffset = 0; - int x1, x2, y1, y2; + int x1, x2, y1, y2; for (int i = 0; i < menu.nrOfItems; i++) { if (menu.item[i].x == -1) @@ -665,18 +665,18 @@ void KyraEngine_v1::calcCoords(Menu &menu) { maxOffset = offset; } } - + if (menu.item[i].itemString) { int textWidth = _screen->getTextWidth(menu.item[i].itemString) + 15; if (menu.item[i].width < textWidth) { menu.item[i].width = textWidth; - + if ( menu.x + menu.item[i].x + menu.item[i].width > menu_x2) menu.item[i].x -= (menu.x + menu.item[i].x + menu.item[i].width) - menu_x2 + 10; } - } - + } + } if (maxOffset > 0) { @@ -687,7 +687,7 @@ void KyraEngine_v1::calcCoords(Menu &menu) { } menu.width += maxOffset; } - + if (menu.menuName != 0) { int menuNameLength = _screen->getTextWidth(menu.menuName); if (menuNameLength > menu.width) @@ -698,10 +698,10 @@ void KyraEngine_v1::calcCoords(Menu &menu) { menu.width = 310; menu.x = (320 - menu.width)/2; - + if (menu.y == -1) menu.y = (200 - menu.height)/2; - + _screen->_charWidth = widthBackup; } @@ -1030,7 +1030,7 @@ bool KyraEngine_v1::gui_quitConfirm(const char *str) { _menu[1].menuName = str; calcCoords(_menu[1]); initMenu(_menu[1]); - + _displaySubMenu = true; _cancelSubMenu = true; @@ -1162,7 +1162,7 @@ void KyraEngine_v1::gui_setupControls(Menu &menu) { if (_flags.isTalkie) { textControl = 4; clickableOffset = 11; - + if (_configVoice == 0) _menu[5].item[4].enabled = 1; else @@ -1297,7 +1297,7 @@ void KyraEngine_v1::gui_processHighlights(Menu &menu) { if (mouse.x > x1 && mouse.x < x2 && mouse.y > y1 && mouse.y < y2) { - + if (menu.highlightedItem != i) { if (menu.item[menu.highlightedItem].enabled ) gui_redrawText(menu); @@ -1410,4 +1410,4 @@ void KyraEngine_v1::drawAmulet() { } } // end of namespace Kyra - + diff --git a/engines/kyra/gui_v2.cpp b/engines/kyra/gui_v2.cpp index 2e795dfb08..4c5fb8d840 100644 --- a/engines/kyra/gui_v2.cpp +++ b/engines/kyra/gui_v2.cpp @@ -53,16 +53,16 @@ bool KyraEngine_v2::gui_mainMenuGetInput() { int KyraEngine_v2::gui_handleMainMenu() { debugC(9, kDebugLevelMain, "KyraEngine_v2::gui_handleMainMenu()"); int command = -1; - + uint8 colorMap[16]; memset(colorMap, 0, sizeof(colorMap)); _screen->setTextColorMap(colorMap); - + const char * const *strings; - + Screen::FontId oldFont = _screen->setFont(Screen::FID_8_FNT); int charWidthBackUp = _screen->_charWidth; - + _screen->_charWidth = -2; if (_flags.gameID == GI_KYRA2) { @@ -91,9 +91,9 @@ int KyraEngine_v2::gui_handleMainMenu() { gui_drawMainBox(x, y, width, height, 1); gui_drawMainBox(x + 1, y + 1, width - 2, height - 2, 0); - + int selected = 0; - + gui_drawMainMenu(strings, selected); _screen->showMouse(); @@ -102,7 +102,7 @@ int KyraEngine_v2::gui_handleMainMenu() { int textPos = ((_screen->_curDim->w >> 1) + _screen->_curDim->sx) << 3; Common::Rect menuRect(x + 16, y + 4, x + width - 16, y + 4 + fh * 4); - + while (!_quitFlag) { gui_updateMainMenuAnimation(); bool mousePressed = gui_mainMenuGetInput(); @@ -133,14 +133,14 @@ int KyraEngine_v2::gui_handleMainMenu() { } _system->delayMillis(10); } - + if (_quitFlag) command = -1; - + _screen->copyRegion(backUpX, backUpY, backUpX, backUpY, backUpWidth, backUpHeight, 3, 0); _screen->_charWidth = charWidthBackUp; _screen->setFont(oldFont); - + return command; } @@ -157,7 +157,7 @@ void KyraEngine_v2::gui_drawMainMenu(const char *const *strings, int select) { int top = _screen->_curDim->sy; top += menuTable[1]; - + for (int i = 0; i < menuTable[3]; ++i) { int curY = top + i * _screen->getFontHeight(); int color = (i == select) ? menuTable[6] : menuTable[5]; @@ -175,17 +175,17 @@ void KyraEngine_v2::gui_drawMainBox(int x, int y, int w, int h, int fill) { colorTable = kyra3ColorTable; else colorTable = kyra2ColorTable; - + --w; --h; if (fill) _screen->fillRect(x, y, x+w, y+h, colorTable[0]); - + _screen->drawClippedLine(x, y+h, x+w, y+h, colorTable[1]); _screen->drawClippedLine(x+w, y, x+w, y+h, colorTable[1]); _screen->drawClippedLine(x, y, x+w, y, colorTable[2]); _screen->drawClippedLine(x, y, x, y+h, colorTable[2]); - + _screen->setPagePixel(_screen->_curPage, x, y+h, colorTable[3]); _screen->setPagePixel(_screen->_curPage, x+w, y, colorTable[3]); } @@ -194,29 +194,29 @@ void KyraEngine_v2::gui_printString(const char *format, int x, int y, int col1, debugC(9, kDebugLevelMain, "KyraEngine_v2::gui_printString('%s', %d, %d, %d, %d, %d, ...)", format, x, y, col1, col2, flags); if (!format) return; - + char string[512]; va_list vaList; va_start(vaList, flags); vsprintf(string, format, vaList); va_end(vaList); - + if (flags & 1) x -= _screen->getTextWidth(string) >> 1; - + if (flags & 2) x -= _screen->getTextWidth(string); - + if (flags & 4) { _screen->printText(string, x - 1, y, 240, col2); _screen->printText(string, x, y + 1, 240, col2); } - + if (flags & 8) { _screen->printText(string, x - 1, y, 227, col2); _screen->printText(string, x, y + 1, 227, col2); } - + _screen->printText(string, x, y, col1, col2); } diff --git a/engines/kyra/items_v1.cpp b/engines/kyra/items_v1.cpp index 026736077b..ae3ba2821a 100644 --- a/engines/kyra/items_v1.cpp +++ b/engines/kyra/items_v1.cpp @@ -90,10 +90,10 @@ byte KyraEngine_v1::findItemAtPos(int x, int y) { const uint8 *itemsTable = _roomTable[_currentCharacter->sceneId].itemsTable; const uint16 *xposOffset = _roomTable[_currentCharacter->sceneId].itemsXPos; const uint8 *yposOffset = _roomTable[_currentCharacter->sceneId].itemsYPos; - + int highestYPos = -1; byte returnValue = 0xFF; - + for (int i = 0; i < 12; ++i) { if (*itemsTable != 0xFF) { int xpos = *xposOffset - 11; @@ -103,7 +103,7 @@ byte KyraEngine_v1::findItemAtPos(int x, int y) { int itemHeight = _itemTable[*itemsTable].height; int ypos = *yposOffset + 3; int ypos2 = ypos - itemHeight - 3; - + if (y > ypos2 && ypos > y) { if (highestYPos <= ypos) { returnValue = i; @@ -116,7 +116,7 @@ byte KyraEngine_v1::findItemAtPos(int x, int y) { ++yposOffset; ++itemsTable; } - + return returnValue; } @@ -128,16 +128,16 @@ void KyraEngine_v1::placeItemInGenericMapScene(int item, int index) { static const uint16 itemMapSceneMaxTable[] = { 0x0010, 0x0024, 0x00C6, 0x006C, 0x00F5, 0x0000 }; - + int minValue = itemMapSceneMinTable[index]; int maxValue = itemMapSceneMaxTable[index]; - + while (true) { int room = _rnd.getRandomNumberRng(minValue, maxValue); assert(room < _roomTableSize); int nameIndex = _roomTable[room].nameIndex; bool placeItem = false; - + switch (nameIndex) { case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 11: @@ -149,7 +149,7 @@ void KyraEngine_v1::placeItemInGenericMapScene(int item, int index) { case 85: case 104: case 105: case 106: placeItem = true; break; - + case 51: if (room != 46) placeItem = true; @@ -158,7 +158,7 @@ void KyraEngine_v1::placeItemInGenericMapScene(int item, int index) { default: break; } - + if (placeItem) { Room *roomPtr = &_roomTable[room]; if (roomPtr->northExit == 0xFFFF && roomPtr->eastExit == 0xFFFF && roomPtr->southExit == 0xFFFF && roomPtr->westExit == 0xFFFF) @@ -166,7 +166,7 @@ void KyraEngine_v1::placeItemInGenericMapScene(int item, int index) { else if (_currentCharacter->sceneId == room) placeItem = false; } - + if (placeItem) { if (!processItemDrop(room, item, -1, -1, 2, 0)) continue; @@ -209,7 +209,7 @@ void KyraEngine_v1::wipeDownMouseItem(int xpos, int ypos) { backUpItemRect1(xpos, ypos); int y = ypos; int height = 16; - + while (height >= 0) { restoreItemRect1(xpos, ypos); _screen->setNewShapeHeight(_shapes[216+_itemInHand], height); @@ -219,7 +219,7 @@ void KyraEngine_v1::wipeDownMouseItem(int xpos, int ypos) { y += 2; height -= 2; delayUntil(nextTime); - } + } restoreItemRect1(xpos, ypos); _screen->resetShapeHeight(_shapes[216+_itemInHand]); destroyMouseItem(); @@ -235,10 +235,10 @@ void KyraEngine_v1::setupSceneItems() { uint8 item = currentRoom->itemsTable[i]; if (item == 0xFF || !currentRoom->needInit[i]) continue; - + int xpos = 0; int ypos = 0; - + if (currentRoom->itemsXPos[i] == 0xFFFF) { xpos = currentRoom->itemsXPos[i] = _rnd.getRandomNumberRng(24, 296); ypos = currentRoom->itemsYPos[i] = _rnd.getRandomNumberRng(_northExitHeight & 0xFF, 130); @@ -246,9 +246,9 @@ void KyraEngine_v1::setupSceneItems() { xpos = currentRoom->itemsXPos[i]; ypos = currentRoom->itemsYPos[i]; } - + _lastProcessedItem = i; - + int stop = 0; while (!stop) { stop = processItemDrop(sceneId, item, xpos, ypos, 3, 0); @@ -268,14 +268,14 @@ int KyraEngine_v1::countItemsInScene(uint16 sceneId) { debugC(9, kDebugLevelMain, "KyraEngine_v1::countItemsInScene(%d)", sceneId); assert(sceneId < _roomTableSize); Room *currentRoom = &_roomTable[sceneId]; - + int items = 0; - + for (int i = 0; i < 12; ++i) { if (currentRoom->itemsTable[i] != 0xFF) ++items; } - + return items; } @@ -285,15 +285,15 @@ int KyraEngine_v1::processItemDrop(uint16 sceneId, uint8 item, int x, int y, int uint8 itemIndex = findItemAtPos(x, y); if (unk1) itemIndex = 0xFF; - + if (itemIndex != 0xFF) { exchangeItemWithMouseItem(sceneId, itemIndex); return 0; } - + assert(sceneId < _roomTableSize); Room *currentRoom = &_roomTable[sceneId]; - + if (unk1 != 3) { for (int i = 0; i < 12; ++i) { if (currentRoom->itemsTable[i] == 0xFF) { @@ -307,20 +307,20 @@ int KyraEngine_v1::processItemDrop(uint16 sceneId, uint8 item, int x, int y, int if (freeItem == -1) return 0; - + if (sceneId != _currentCharacter->sceneId) { addItemToRoom(sceneId, item, freeItem, x, y); return 1; } - + int itemHeight = _itemTable[item].height; _lastProcessedItemHeight = itemHeight; - + if (x == -1 && x == -1) { x = _rnd.getRandomNumberRng(16, 304); y = _rnd.getRandomNumberRng(_northExitHeight & 0xFF, 135); } - + int xpos = x; int ypos = y; int destY = -1; @@ -330,25 +330,25 @@ int KyraEngine_v1::processItemDrop(uint16 sceneId, uint8 item, int x, int y, int while (running) { if ((_northExitHeight & 0xFF) <= ypos) { bool running2 = true; - + if (_screen->getDrawLayer(xpos, ypos) > 1) { if (((_northExitHeight >> 8) & 0xFF) != ypos) running2 = false; } - + if (_screen->getDrawLayer2(xpos, ypos, itemHeight) > 1) { if (((_northExitHeight >> 8) & 0xFF) != ypos) running2 = false; } - + if (!isDropable(xpos, ypos)) { if (((_northExitHeight >> 8) & 0xFF) != ypos) running2 = false; } - + int xpos2 = xpos; int xpos3 = xpos; - + while (running2) { if (isDropable(xpos2, ypos)) { if (_screen->getDrawLayer2(xpos2, ypos, itemHeight) < 7) { @@ -360,7 +360,7 @@ int KyraEngine_v1::processItemDrop(uint16 sceneId, uint8 item, int x, int y, int } } } - + if (isDropable(xpos3, ypos)) { if (_screen->getDrawLayer2(xpos3, ypos, itemHeight) < 7) { if (findItemAtPos(xpos3, ypos) == 0xFF) { @@ -371,18 +371,18 @@ int KyraEngine_v1::processItemDrop(uint16 sceneId, uint8 item, int x, int y, int } } } - + if (!running2) continue; - + xpos2 -= 2; if (xpos2 < 16) xpos2 = 16; - + xpos3 += 2; if (xpos3 > 304) xpos3 = 304; - + if (xpos2 > 16) continue; if (xpos3 < 304) @@ -390,45 +390,45 @@ int KyraEngine_v1::processItemDrop(uint16 sceneId, uint8 item, int x, int y, int running2 = false; } } - + if (((_northExitHeight >> 8) & 0xFF) == ypos) { running = 0; destY -= _rnd.getRandomNumberRng(0, 3); - + if ((_northExitHeight & 0xFF) < destY) continue; - + destY = (_northExitHeight & 0xFF) + 1; continue; - } + } ypos += 2; if (((_northExitHeight >> 8) & 0xFF) >= ypos) continue; ypos = (_northExitHeight >> 8) & 0xFF; } - + if (destX == -1 || destY == -1) return 0; - + if (unk1 == 3) { currentRoom->itemsXPos[freeItem] = destX; currentRoom->itemsYPos[freeItem] = destY; return 1; } - + if (unk1 == 2) itemSpecialFX(x, y, item); - + if (unk1 == 0) destroyMouseItem(); - + itemDropDown(x, y, destX, destY, freeItem, item); - + if (unk1 == 0 && unk2 != 0) { assert(_itemList && _droppedList); updateSentenceCommand(_itemList[item], _droppedList[0], 179); } - + return 1; } @@ -438,13 +438,13 @@ void KyraEngine_v1::exchangeItemWithMouseItem(uint16 sceneId, int itemIndex) { _animator->animRemoveGameItem(itemIndex); assert(sceneId < _roomTableSize); Room *currentRoom = &_roomTable[sceneId]; - + int item = currentRoom->itemsTable[itemIndex]; currentRoom->itemsTable[itemIndex] = _itemInHand; _itemInHand = item; _animator->animAddGameItem(itemIndex, sceneId); snd_playSoundEffect(53); - + setMouseItem(_itemInHand); assert(_itemList && _takenList); updateSentenceCommand(_itemList[_itemInHand], _takenList[1], 179); @@ -468,16 +468,16 @@ int KyraEngine_v1::checkNoDropRects(int x, int y) { _lastProcessedItemHeight = 16; if (_noDropRects[0].x == -1) return 0; - + for (int i = 0; i < 11; ++i) { if (_noDropRects[i].x == -1) break; - + int xpos = _noDropRects[i].x; int ypos = _noDropRects[i].y; int xpos2 = _noDropRects[i].x2; int ypos2 = _noDropRects[i].y2; - + if (xpos > x + 16) continue; if (xpos2 < x) @@ -488,7 +488,7 @@ int KyraEngine_v1::checkNoDropRects(int x, int y) { continue; return 1; } - + return 0; } @@ -496,14 +496,14 @@ int KyraEngine_v1::isDropable(int x, int y) { debugC(9, kDebugLevelMain, "KyraEngine_v1::isDropable(%d, %d)", x, y); x -= 8; y -= 1; - + if (checkNoDropRects(x, y)) return 0; - + for (int xpos = x; xpos < x + 16; ++xpos) { if (_screen->getShapeFlag1(xpos, y) == 0) return 0; - } + } return 1; } @@ -525,9 +525,9 @@ void KyraEngine_v1::itemDropDown(int x, int y, int destX, int destY, byte freeIt int addY = 2; int drawX = x - 8; int drawY = 0; - + backUpItemRect0(drawX, y - 16); - + while (tempY < destY) { restoreItemRect0(drawX, tempY - 16); tempY += addY; @@ -541,18 +541,18 @@ void KyraEngine_v1::itemDropDown(int x, int y, int destX, int destY, byte freeIt _screen->updateScreen(); delayUntil(nextTime); } - + bool skip = false; if (x == destX) { if (destY - y <= 16) skip = true; } - + if (!skip) { snd_playSoundEffect(0x47); if (addY < 6) addY = 6; - + int xDiff = (destX - x) << 4; xDiff /= addY; int startAddY = addY; @@ -640,7 +640,7 @@ void KyraEngine_v1::itemSpecialFX2(int x, int y, int item) { backUpItemRect0(x, y); if (item >= 80 && item <= 89) snd_playSoundEffect(55); - + for (int i = 201; i <= 205; ++i) { restoreItemRect0(x, y); uint32 nextTime = _system->getMillis() + 3 * _tickLength; @@ -648,7 +648,7 @@ void KyraEngine_v1::itemSpecialFX2(int x, int y, int item) { _screen->updateScreen(); delayUntil(nextTime); } - + for (int i = 204; i >= 201; --i) { restoreItemRect0(x, y); uint32 nextTime = _system->getMillis() + 3 * _tickLength; @@ -673,10 +673,10 @@ void KyraEngine_v1::magicOutMouseItem(int animIndex, int itemPos) { x = _itemPosX[itemPos] - 4; y = _itemPosY[itemPos] - 3; } - + if (_itemInHand == -1 && itemPos == -1) return; - + int tableIndex = 0, loopStart = 0, maxLoops = 0; if (animIndex == 0) { tableIndex = _rnd.getRandomNumberRng(0, 5); @@ -693,7 +693,7 @@ void KyraEngine_v1::magicOutMouseItem(int animIndex, int itemPos) { } else { tableIndex = -1; } - + if (animIndex == 2) snd_playSoundEffect(0x5E); else @@ -712,13 +712,13 @@ void KyraEngine_v1::magicOutMouseItem(int animIndex, int itemPos) { _screen->updateScreen(); delayUntil(nextTime); } - + if (itemPos != -1) { restoreItemRect1(x, y); _screen->fillRect(_itemPosX[itemPos], _itemPosY[itemPos], _itemPosX[itemPos] + 15, _itemPosY[itemPos] + 15, 12, 0); backUpItemRect1(x, y); } - + for (int shape = _magicMouseItemStartFrame2[animIndex]; shape <= _magicMouseItemEndFrame2[animIndex]; ++shape) { restoreItemRect1(x, y); uint32 nextTime = _system->getMillis() + 4 * _tickLength; @@ -774,14 +774,14 @@ void KyraEngine_v1::magicInMouseItem(int animIndex, int item, int itemPos) { loopStart = 124; maxLoops = 4; } - + _screen->hideMouse(); backUpItemRect1(x, y); if (animIndex == 2) snd_playSoundEffect(0x5E); else snd_playSoundEffect(0x37); - + for (int shape = _magicMouseItemStartFrame[animIndex]; shape <= _magicMouseItemEndFrame[animIndex]; ++shape) { restoreItemRect1(x, y); uint32 nextTime = _system->getMillis() + 4 * _tickLength; @@ -792,7 +792,7 @@ void KyraEngine_v1::magicInMouseItem(int animIndex, int item, int itemPos) { _screen->updateScreen(); delayUntil(nextTime); } - + for (int shape = _magicMouseItemStartFrame2[animIndex]; shape <= _magicMouseItemEndFrame2[animIndex]; ++shape) { restoreItemRect1(x, y); uint32 nextTime = _system->getMillis() + 4 * _tickLength; @@ -869,7 +869,7 @@ void KyraEngine_v1::updatePlayerItemsForScene() { _screen->setMouseCursor(8, 15, _shapes[216+_itemInHand]); _screen->showMouse(); } - + bool redraw = false; for (int i = 0; i < 10; ++i) { uint8 item = _currentCharacter->inventoryItems[i]; @@ -881,16 +881,16 @@ void KyraEngine_v1::updatePlayerItemsForScene() { redraw = true; } } - + if (redraw) { _screen->hideMouse(); redrawInventory(0); _screen->showMouse(); } - + if (_itemInHand == 33) magicOutMouseItem(2, -1); - + _screen->hideMouse(); for (int i = 0; i < 10; ++i) { uint8 item = _currentCharacter->inventoryItems[i]; diff --git a/engines/kyra/items_v2.cpp b/engines/kyra/items_v2.cpp index bc90b32544..02aeb7912c 100644 --- a/engines/kyra/items_v2.cpp +++ b/engines/kyra/items_v2.cpp @@ -78,7 +78,7 @@ int KyraEngine_v2::checkItemCollision(int x, int y) { yPos = curItem.y; } } - + return itemPos; } @@ -139,7 +139,7 @@ bool KyraEngine_v2::processItemDrop(uint16 sceneId, uint16 item, int x, int y, i } int itemHeight = _itemHtDat[item]; - + // no idea why it's '&&' here and not single checks for x and y if (x == -1 && y == -1) { x = _rnd.getRandomNumberRng(0x10, 0x130); @@ -188,7 +188,7 @@ bool KyraEngine_v2::processItemDrop(uint16 sceneId, uint16 item, int x, int y, i if (itemX == -1 || itemY == -1) return false; - + if (unk1 == 3) { _itemList[freeItemSlot].x = itemX; _itemList[freeItemSlot].y = itemY; @@ -286,7 +286,7 @@ void KyraEngine_v2::itemDropDown(int startX, int startY, int dstX, int dstY, int uint16 endDelay = _system->getMillis() + _tickLength; _screen->drawShape(0, itemShape, x, y, 0, 0); _screen->updateScreen(); - + // XXX: original doesn't update game state while delaying // our implementation *could* do it, so maybe check this again delayUntil(endDelay); @@ -295,7 +295,7 @@ void KyraEngine_v2::itemDropDown(int startX, int startY, int dstX, int dstY, int restoreGfxRect24x24(x, y); } else { restoreGfxRect24x24(curX, curY-16); - } + } } if (_layerFlagTable[_screen->getLayer(dstX, dstY)] && item != 13) { @@ -329,10 +329,10 @@ void KyraEngine_v2::exchangeMouseItem(int itemPos) { snd_playSoundEffect(0x0b); setMouseCursor(_itemInHand); int str2 = 7; - + if (_lang == 1) str2 = getItemCommandStringPickUp(itemId); - + updateCommandLineEx(itemId + 54, str2, 0xD6); _screen->showMouse(); @@ -341,7 +341,7 @@ void KyraEngine_v2::exchangeMouseItem(int itemPos) { bool KyraEngine_v2::pickUpItem(int x, int y) { int itemPos = checkItemCollision(x, y); - + if (itemPos <= -1) return false; @@ -355,10 +355,10 @@ bool KyraEngine_v2::pickUpItem(int x, int y) { snd_playSoundEffect(0x0b); setMouseCursor(itemId); int str2 = 7; - + if (_lang == 1) str2 = getItemCommandStringPickUp(itemId); - + updateCommandLineEx(itemId + 54, str2, 0xD6); _itemInHand = itemId; _screen->showMouse(); @@ -375,7 +375,7 @@ bool KyraEngine_v2::isDropable(int x, int y) { x -= 8; y -= 1; - + for (int xpos = x; xpos < x + 16; ++xpos) { if (_screen->getShapeFlag1(xpos, y) == 0) return false; diff --git a/engines/kyra/kyra.cpp b/engines/kyra/kyra.cpp index b0bc58ef49..b71e696df1 100644 --- a/engines/kyra/kyra.cpp +++ b/engines/kyra/kyra.cpp @@ -241,7 +241,7 @@ void KyraEngine::registerDefaultSettings() { void KyraEngine::readSettings() { _configWalkspeed = ConfMan.getInt("walkspeed"); - _configMusic = ConfMan.getBool("music_mute") ? 0 : ((ConfMan.getBool("cdaudio") && (_flags.platform == Common::kPlatformFMTowns || _flags.platform == Common::kPlatformPC98)) ? 2 : 1); + _configMusic = ConfMan.getBool("music_mute") ? 0 : ((ConfMan.getBool("cdaudio") && (_flags.platform == Common::kPlatformFMTowns || _flags.platform == Common::kPlatformPC98)) ? 2 : 1); _configSounds = ConfMan.getBool("sfx_mute") ? 0 : 1; _sound->enableMusic(_configMusic); diff --git a/engines/kyra/kyra.h b/engines/kyra/kyra.h index ea322f4d77..4614b6537d 100644 --- a/engines/kyra/kyra.h +++ b/engines/kyra/kyra.h @@ -58,7 +58,7 @@ enum { struct AudioDataStruct { const char * const *_fileList; - const int _fileListLen; + const int _fileListLen; const void * const _cdaTracks; const int _cdaNumTracks; }; @@ -92,12 +92,12 @@ class KyraEngine : public Engine { public: KyraEngine(OSystem *system, const GameFlags &flags); virtual ~KyraEngine(); - + bool quit() const { return _quitFlag; } - + uint8 game() const { return _flags.gameID; } const GameFlags &gameFlags() const { return _flags; } - + // access to Kyra specific functionallity Resource *resource() { return _res; } virtual Screen *screen() = 0; @@ -105,17 +105,17 @@ public: Sound *sound() { return _sound; } StaticResource *staticres() { return _staticres; } TimerManager *timer() { return _timer; } - + uint32 tickLength() const { return _tickLength; } - + virtual Movie *createWSAMovie() = 0; - + Common::RandomSource _rnd; - + // quit handling virtual void quitGame(); - // game flag handling + // game flag handling int setGameFlag(int flag); int queryGameFlag(int flag) const; int resetGameFlag(int flag); @@ -127,7 +127,7 @@ public: virtual void snd_playVoiceFile(int id) = 0; virtual bool snd_voiceIsPlaying(); virtual void snd_stopVoice(); - + // delay functionallity virtual void delayUntil(uint32 timestamp, bool updateGameTimers = false, bool update = false, bool isMainLoop = false); virtual void delay(uint32 millis, bool update = false, bool isMainLoop = false); @@ -136,10 +136,10 @@ public: protected: virtual int go() = 0; virtual int init(); - + // quit Handling bool _quitFlag; - + // intern Resource *_res; Sound *_sound; @@ -161,7 +161,7 @@ protected: bool speechEnabled(); bool textEnabled(); - + // game speed bool _skipFlag; uint16 _tickLength; @@ -171,7 +171,7 @@ protected: virtual void setupTimers() = 0; virtual void setWalkspeed(uint8 speed) = 0; - + // detection GameFlags _flags; int _lang; @@ -179,7 +179,7 @@ protected: // opcode virtual void setupOpcodeTable() = 0; Common::Array _opcodes; - + // game flags uint8 _flagsTable[100]; // TODO: check this value @@ -190,10 +190,10 @@ protected: const int8 *_trackMap; int _trackMapSize; - - // input + + // input Common::Point getMousePos() const; - + // pathfinder virtual int findWay(int x, int y, int toX, int toY, int *moveTable, int moveTableSize); int findSubPath(int x, int y, int toX, int toY, int *moveTable, int start, int end); @@ -202,7 +202,7 @@ protected: void changePosTowardsFacing(int &x, int &y, int facing); int getMoveTableSize(int *moveTable); virtual bool lineIsPassable(int x, int y) = 0; - + static const int8 _addXPosTable[]; static const int8 _addYPosTable[]; }; diff --git a/engines/kyra/kyra_v1.cpp b/engines/kyra/kyra_v1.cpp index 8630fc9806..87c6d4f843 100644 --- a/engines/kyra/kyra_v1.cpp +++ b/engines/kyra/kyra_v1.cpp @@ -53,10 +53,10 @@ KyraEngine_v1::KyraEngine_v1(OSystem *system, const GameFlags &flags) _seq_Forest = _seq_KallakWriting = _seq_KyrandiaLogo = _seq_KallakMalcolm = _seq_MalcolmTree = _seq_WestwoodLogo = _seq_Demo1 = _seq_Demo2 = _seq_Demo3 = _seq_Demo4 = 0; - + _seq_WSATable = _seq_CPSTable = _seq_COLTable = _seq_textsTable = 0; _seq_WSATable_Size = _seq_CPSTable_Size = _seq_COLTable_Size = _seq_textsTable_Size = 0; - + _roomFilenameTable = _characterImageTable = 0; _roomFilenameTableSize = _characterImageTableSize = 0; _itemList = _takenList = _placedList = _droppedList = _noDropList = 0; @@ -66,7 +66,7 @@ KyraEngine_v1::KyraEngine_v1(OSystem *system, const GameFlags &flags) _thePoison = _fluteString = _wispJewelStrings = _magicJewelString = _flaskFull = _fullFlask = 0; _thePoison_Size = _fluteString_Size = _wispJewelStrings_Size = 0; _magicJewelString_Size = _flaskFull_Size = _fullFlask_Size = 0; - + _defaultShapeTable = 0; _healingShapeTable = _healingShape2Table = 0; _defaultShapeTableSize = _healingShapeTableSize = _healingShape2TableSize = 0; @@ -122,15 +122,15 @@ KyraEngine_v1::~KyraEngine_v1() { delete _sprites; delete _animator; delete _seq; - + delete _npcScriptData; delete _scriptMain; - + delete _scriptClickData; delete _scriptClick; - + delete [] _characterList; - + delete [] _movFacingTable; delete [] _scrollUpButton.process0PtrShape; @@ -141,7 +141,7 @@ KyraEngine_v1::~KyraEngine_v1() { delete [] _scrollDownButton.process2PtrShape; delete [] _itemBkgBackUp[0]; - delete [] _itemBkgBackUp[1]; + delete [] _itemBkgBackUp[1]; for (int i = 0; i < ARRAYSIZE(_shapes); ++i) { if (_shapes[i] != 0) { @@ -179,12 +179,12 @@ int KyraEngine_v1::init() { assert(_text); initStaticResource(); - + _sound->setSoundList(&_soundData[kMusicIntro]); _trackMap = _dosTrackMap; _trackMapSize = _dosTrackMapSize; - + if (!_sound->init()) error("Couldn't init sound"); @@ -207,27 +207,27 @@ int KyraEngine_v1::init() { _characterList[0].height = 48; _characterList[0].facing = 3; _characterList[0].currentAnimFrame = 7; - + _npcScriptData = new ScriptData; memset(_npcScriptData, 0, sizeof(ScriptData)); assert(_npcScriptData); _npcScript = new ScriptState; assert(_npcScript); memset(_npcScript, 0, sizeof(ScriptState)); - + _scriptMain = new ScriptState; assert(_scriptMain); memset(_scriptMain, 0, sizeof(ScriptState)); - + _scriptClickData = new ScriptData; assert(_scriptClickData); memset(_scriptClickData, 0, sizeof(ScriptData)); _scriptClick = new ScriptState; assert(_scriptClick); memset(_scriptClick, 0, sizeof(ScriptState)); - + _debugger = new Debugger_v1(this); - assert(_debugger); + assert(_debugger); memset(_shapes, 0, sizeof(_shapes)); for (int i = 0; i < ARRAYSIZE(_movieObjects); ++i) @@ -251,7 +251,7 @@ int KyraEngine_v1::init() { _brandonPosX = _brandonPosY = -1; _deathHandler = 0xFF; _poisonDeathCounter = 0; - + memset(_itemTable, 0, sizeof(_itemTable)); memset(_exitList, 0xFFFF, sizeof(_exitList)); _exitListPtr = 0; @@ -269,17 +269,17 @@ int KyraEngine_v1::init() { memset(_foyerItemTable, -1, sizeof(_foyerItemTable)); _mouseState = _itemInHand = -1; _handleInput = false; - + _currentRoom = 0xFFFF; _scenePhasingFlag = 0; _lastProcessedItem = 0; _lastProcessedItemHeight = 16; - + _unkScreenVar1 = 1; _unkScreenVar2 = 0; _unkScreenVar3 = 0; _unkAmuletVar = 0; - + _endSequenceNeedLoading = 1; _malcolmFlag = 0; _beadStateVar = 0; @@ -291,16 +291,16 @@ int KyraEngine_v1::init() { _lastDisplayedPanPage = 0; memset(_panPagesTable, 0, sizeof(_panPagesTable)); _finalA = _finalB = _finalC = 0; - memset(&_kyragemFadingState, 0, sizeof(_kyragemFadingState)); + memset(&_kyragemFadingState, 0, sizeof(_kyragemFadingState)); _kyragemFadingState.gOffset = 0x13; _kyragemFadingState.bOffset = 0x13; _mousePressFlag = false; - + _menuDirectlyToLoad = false; _lastMusicCommand = 0; - + return 0; } @@ -390,15 +390,15 @@ void KyraEngine_v1::startup() { while (_scriptInterpreter->validScript(_scriptMain)) _scriptInterpreter->runScript(_scriptMain); - + _scriptInterpreter->unloadScript(_npcScriptData); if (!_scriptInterpreter->loadScript("_NPC.EMC", _npcScriptData, &_opcodes)) error("Could not load \"_NPC.EMC\" script"); - + snd_playTheme(1); enterNewScene(_currentCharacter->sceneId, _currentCharacter->facing, 0, 0, 1); - + if (_abortIntroFlag && _skipIntroFlag) { _menuDirectlyToLoad = true; _screen->setMouseCursor(1, 1, _shapes[0]); @@ -421,7 +421,7 @@ void KyraEngine_v1::mainLoop() { if (seq_playEnd() && _deathHandler != 8) break; } - + if (_deathHandler != 0xFF) { snd_playWanderScoreViaMap(0, 1); snd_playSoundEffect(49); @@ -432,7 +432,7 @@ void KyraEngine_v1::mainLoop() { buttonMenuCallback(0); _deathHandler = 0xFF; } - + if ((_brandonStatusBit & 2) && _brandonStatusBit0x02Flag) _animator->animRefreshNPC(0); @@ -440,7 +440,7 @@ void KyraEngine_v1::mainLoop() { _animator->animRefreshNPC(0); _brandonStatusBit0x20Flag = 0; } - + _screen->showMouse(); processButtonList(_buttonList); @@ -474,7 +474,7 @@ void KyraEngine_v1::delay(uint32 amount, bool update, bool isMainLoop) { while (_eventMan->pollEvent(event)) { switch (event.type) { case Common::EVENT_KEYDOWN: - if (event.kbd.keycode >= '1' && event.kbd.keycode <= '9' && + if (event.kbd.keycode >= '1' && event.kbd.keycode <= '9' && (event.kbd.flags == Common::KBD_CTRL || event.kbd.flags == Common::KBD_ALT) && isMainLoop) { const char *saveLoadSlot = getSavegameFilename(event.kbd.keycode - '0'); @@ -510,7 +510,7 @@ void KyraEngine_v1::delay(uint32 amount, bool update, bool isMainLoop) { case Common::EVENT_LBUTTONUP: _mousePressFlag = false; - if (_abortWalkFlag2) + if (_abortWalkFlag2) _abortWalkFlag = true; if (_handleInput) { @@ -541,7 +541,7 @@ void KyraEngine_v1::delay(uint32 amount, bool update, bool isMainLoop) { if (_skipFlag && !_abortIntroFlag && !queryGameFlag(0xFE)) _skipFlag = false; - + if (amount > 0 && !_skipFlag && !_quitFlag) _system->delayMillis(10); @@ -698,8 +698,8 @@ void KyraEngine_v1::processInput() { int handled = clickEventHandler(xpos, ypos); if (_changedScene || handled) return; - } - + } + // XXX _deathHandler specific if (ypos <= 158) { uint16 exit = 0xFFFF; @@ -712,7 +712,7 @@ void KyraEngine_v1::processInput() { } else if (ypos < 12) { exit = _walkBlockNorth; } - + if (exit != 0xFFFF) { _abortWalkFlag2 = true; handleSceneChange(xpos, ypos, 1, 1); @@ -742,7 +742,7 @@ void KyraEngine_v1::processInput() { } } } - } + } } int KyraEngine_v1::processInputHelper(int xpos, int ypos) { @@ -789,7 +789,7 @@ int KyraEngine_v1::clickEventHandler(int xpos, int ypos) { void KyraEngine_v1::updateMousePointer(bool forceUpdate) { int shape = 0; - + int newMouseState = 0; int newX = 0; int newY = 0; @@ -834,7 +834,7 @@ void KyraEngine_v1::updateMousePointer(bool forceUpdate) { } } } - + if (mouse.x >= _entranceMouseCursorTracks[0] && mouse.y >= _entranceMouseCursorTracks[1] && mouse.x <= _entranceMouseCursorTracks[2] && mouse.y <= _entranceMouseCursorTracks[3]) { switch (_entranceMouseCursorTracks[4]) { @@ -870,20 +870,20 @@ void KyraEngine_v1::updateMousePointer(bool forceUpdate) { break; } } - + if (newMouseState == -2) { shape = 6; newX = 4; newY = 4; } - + if ((newMouseState && _mouseState != newMouseState) || (newMouseState && forceUpdate)) { _mouseState = newMouseState; _screen->hideMouse(); _screen->setMouseCursor(newX, newY, _shapes[shape]); _screen->showMouse(); } - + if (!newMouseState) { if (_mouseState != _itemInHand || forceUpdate) { if (mouse.y > 158 || (mouse.x >= 12 && mouse.x < 308 && mouse.y < 136 && mouse.y >= 12) || forceUpdate) { @@ -924,7 +924,7 @@ void KyraEngine_v1::clickEventHandler2() { _scriptClick->regs[2] = mouse.y; _scriptClick->regs[4] = _itemInHand; _scriptInterpreter->startScript(_scriptClick, 6); - + while (_scriptInterpreter->validScript(_scriptClick)) _scriptInterpreter->runScript(_scriptClick); } @@ -934,28 +934,28 @@ int KyraEngine_v1::checkForNPCScriptRun(int xpos, int ypos) { int returnValue = -1; const Character *currentChar = _currentCharacter; int charLeft = 0, charRight = 0, charTop = 0, charBottom = 0; - + int scaleFactor = _scaleTable[currentChar->y1]; int addX = (((scaleFactor*8)*3)>>8)>>1; int addY = ((scaleFactor*3)<<4)>>8; - + charLeft = currentChar->x1 - addX; charRight = currentChar->x1 + addX; charTop = currentChar->y1 - addY; charBottom = currentChar->y1; - + if (xpos >= charLeft && charRight >= xpos && charTop <= ypos && charBottom >= ypos) return 0; - + if (xpos > 304 || xpos < 16) return -1; - + for (int i = 1; i < 5; ++i) { currentChar = &_characterList[i]; - + if (currentChar->sceneId != _currentCharacter->sceneId) continue; - + charLeft = currentChar->x1 - 12; charRight = currentChar->x1 + 11; charTop = currentChar->y1 - 48; @@ -963,10 +963,10 @@ int KyraEngine_v1::checkForNPCScriptRun(int xpos, int ypos) { // charBottom = currentChar->y2 - 16; // else charBottom = currentChar->y1; - + if (xpos < charLeft || xpos > charRight || ypos < charTop || charBottom < ypos) continue; - + if (returnValue != -1) { if (currentChar->y1 >= _characterList[returnValue].y1) returnValue = i; @@ -974,7 +974,7 @@ int KyraEngine_v1::checkForNPCScriptRun(int xpos, int ypos) { returnValue = i; } } - + return returnValue; } @@ -985,7 +985,7 @@ void KyraEngine_v1::runNpcScript(int func) { _npcScript->regs[0] = _currentCharacter->sceneId; _npcScript->regs[4] = _itemInHand; _npcScript->regs[5] = func; - + while (_scriptInterpreter->validScript(_npcScript)) _scriptInterpreter->runScript(_npcScript); } @@ -1050,7 +1050,7 @@ void KyraEngine_v1::writeSettings() { } ConfMan.setInt("talkspeed", talkspeed); - + KyraEngine::writeSettings(); } @@ -1258,7 +1258,7 @@ void KyraEngine_v1::setupOpcodeTable() { // 0x9c Opcode(o1_dummy) }; - + for (int i = 0; i < ARRAYSIZE(opcodeTable); ++i) _opcodes.push_back(&opcodeTable[i]); } diff --git a/engines/kyra/kyra_v1.h b/engines/kyra/kyra_v1.h index e9bba94b96..ac3f9960fe 100644 --- a/engines/kyra/kyra_v1.h +++ b/engines/kyra/kyra_v1.h @@ -209,7 +209,7 @@ public: const char * const*seqCPSTable() { return _seq_CPSTable; } const char * const*seqCOLTable() { return _seq_COLTable; } const char * const*seqTextsTable() { return _seq_textsTable; } - + const uint8 * const*palTable1() { return &_specialPalettes[0]; } const uint8 * const*palTable2() { return &_specialPalettes[29]; } @@ -279,7 +279,7 @@ public: void snd_playWanderScoreViaMap(int command, int restart); virtual void snd_playVoiceFile(int id); void snd_voiceWaitForFinish(bool ingame = true); - + void saveGame(const char *fileName, const char *saveName); void loadGame(const char *fileName); @@ -316,7 +316,7 @@ protected: int findWay(int x, int y, int toX, int toY, int *moveTable, int moveTableSize); bool lineIsPassable(int x, int y); - // -> item handling + // -> item handling // --> misc void addItemToRoom(uint16 sceneId, uint8 item, int itemIndex, int x, int y); @@ -417,10 +417,10 @@ protected: // misc (TODO) void startup(); void mainLoop(); - + int checkForNPCScriptRun(int xpos, int ypos); void runNpcScript(int func); - + void loadMouseShapes(); void loadCharacterShapes(); void loadSpecialEffectShapes(); @@ -431,7 +431,7 @@ protected: void setupPanPages(); void freePanPages(); void closeFinalWsa(); - + //void setTimer19(); void setupTimers(); void timerUpdateHeadAnims(int timerNum); @@ -457,7 +457,7 @@ protected: void calcCoords(Menu &menu); void initMenu(Menu &menu); void setGUILabels(); - + Button *initButton(Button *list, Button *newButton); void processButtonList(Button *list); void processButton(Button *button); @@ -515,7 +515,7 @@ protected: int _unkScreenVar1, _unkScreenVar2, _unkScreenVar3; int _beadStateVar; int _unkAmuletVar; - + int _malcolmFlag; int _endSequenceSkipFlag; int _endSequenceNeedLoading; @@ -526,7 +526,7 @@ protected: int _lastDisplayedPanPage; uint8 *_panPagesTable[20]; Movie *_finalA, *_finalB, *_finalC; - + Movie *_movieObjects[10]; uint16 _entranceMouseCursorTracks[8]; @@ -534,18 +534,18 @@ protected: uint16 _walkBlockEast; uint16 _walkBlockSouth; uint16 _walkBlockWest; - + int32 _scaleMode; int16 _scaleTable[145]; - + Rect _noDropRects[11]; - + int8 _birthstoneGemTable[4]; int8 _idolGemsTable[3]; - + int8 _marbleVaseItem; int8 _foyerItemTable[3]; - + int8 _cauldronState; int8 _crystalState[2]; @@ -561,27 +561,27 @@ protected: uint16 _currentChatPartnerBackupFrame; uint16 _currentCharAnimFrame; - + int8 *_sceneAnimTable[50]; - + Item _itemTable[145]; int _lastProcessedItem; int _lastProcessedItemHeight; - + int16 *_exitListPtr; int16 _exitList[11]; SceneExits _sceneExits; uint16 _currentRoom; int _scenePhasingFlag; - + int _sceneChangeState; int _loopFlag2; - + int _pathfinderFlag; int _pathfinderFlag2; int _lastFindWayRet; int *_movFacingTable; - + int8 _talkingCharNum; int8 _charSayUnk2; int8 _charSayUnk3; @@ -599,16 +599,16 @@ protected: Debugger *_debugger; ScriptState *_scriptMain; - + ScriptState *_npcScript; ScriptData *_npcScriptData; - + ScriptState *_scriptClick; ScriptData *_scriptClickData; - + Character *_characterList; Character *_currentCharacter; - + Button *_buttonList; Button *_menuButtonList; bool _displayMenu; @@ -648,17 +648,17 @@ protected: const uint8 *_seq_Demo3; const uint8 *_seq_Demo4; const uint8 *_seq_Reunion; - + const char * const*_seq_WSATable; const char * const*_seq_CPSTable; const char * const*_seq_COLTable; const char * const*_seq_textsTable; - + int _seq_WSATable_Size; int _seq_CPSTable_Size; int _seq_COLTable_Size; int _seq_textsTable_Size; - + const char * const*_itemList; const char * const*_takenList; const char * const*_placedList; @@ -678,13 +678,13 @@ protected: const char * const*_veryClever; const char * const*_homeString; const char * const*_newGameString; - + const char *_voiceTextString; const char *_textSpeedString; const char *_onString; const char *_offString; const char *_onCDString; - + int _itemList_Size; int _takenList_Size; int _placedList_Size; @@ -704,7 +704,7 @@ protected: int _veryClever_Size; int _homeString_Size; int _newGameString_Size; - + const char * const*_characterImageTable; int _characterImageTableSize; @@ -713,47 +713,47 @@ protected: const char * const*_configStrings; int _configStringsSize; - + Shape *_defaultShapeTable; int _defaultShapeTableSize; - + const Shape *_healingShapeTable; int _healingShapeTableSize; const Shape *_healingShape2Table; int _healingShape2TableSize; - + const Shape *_posionDeathShapeTable; int _posionDeathShapeTableSize; - + const Shape *_fluteAnimShapeTable; int _fluteAnimShapeTableSize; - + const Shape *_winterScrollTable; int _winterScrollTableSize; const Shape *_winterScroll1Table; int _winterScroll1TableSize; const Shape *_winterScroll2Table; int _winterScroll2TableSize; - + const Shape *_drinkAnimationTable; int _drinkAnimationTableSize; - + const Shape *_brandonToWispTable; int _brandonToWispTableSize; - + const Shape *_magicAnimationTable; int _magicAnimationTableSize; - + const Shape *_brandonStoneTable; int _brandonStoneTableSize; - + Room *_roomTable; int _roomTableSize; const char * const*_roomFilenameTable; int _roomFilenameTableSize; - + const uint8 *_amuleteAnim; - + const uint8 * const*_specialPalettes; const char *const *_soundFiles; @@ -763,14 +763,14 @@ protected: const int32 *_cdaTrackTable; int _cdaTrackTableSize; const AudioDataStruct * _soundData; - + static const int8 _charXPosTable[]; static const int8 _charYPosTable[]; // positions of the inventory static const uint16 _itemPosX[]; static const uint8 _itemPosY[]; - + void setupButtonData(); Button *_buttonData; Button **_buttonDataListPtr; diff --git a/engines/kyra/kyra_v2.cpp b/engines/kyra/kyra_v2.cpp index 529b4ffbd5..5f0d1a1e50 100644 --- a/engines/kyra/kyra_v2.cpp +++ b/engines/kyra/kyra_v2.cpp @@ -173,7 +173,7 @@ int KyraEngine_v2::go() { // load just the pak files needed for ingame _res->loadPakFile(StaticResource::staticDataFilename()); if (_flags.platform == Common::kPlatformPC && _flags.isTalkie) - _res->loadFileList("FILEDATA.FDT"); + _res->loadFileList("FILEDATA.FDT"); else _res->loadFileList(_ingamePakList, _ingamePakListSize); } @@ -214,10 +214,10 @@ void KyraEngine_v2::startup() { _screenBuffer = new uint8[64000]; _unkBuf200kByte = new uint8[200000]; - loadChapterBuffer(_newChapterFile); + loadChapterBuffer(_newChapterFile); loadCCodeBuffer("C_CODE.XXX"); - + if (_flags.isTalkie) { loadOptionsBuffer("OPTIONS.XXX"); @@ -928,7 +928,7 @@ void KyraEngine_v2::updateCommandLineEx(int str1, int str2, int16 palIndex) { ++src; *src = toupper(*src); } - + strcpy((char*)_unkBuf500Bytes, src); if (str2 > 0) { @@ -1571,7 +1571,7 @@ void KyraEngine_v2::playVoice(int high, int low) { void KyraEngine_v2::snd_playSoundEffect(int track) { debugC(9, kDebugLevelMain | kDebugLevelSound, "KyraEngine_v2::snd_playSoundEffect(%d)", track); - + if (track == 10) track = _lastSfxTrack; @@ -1583,7 +1583,7 @@ void KyraEngine_v2::snd_playSoundEffect(int track) { int16 vocIndex = (int16) READ_LE_UINT16(&_ingameSoundIndex[track * 2]); if (vocIndex != -1) _sound->voicePlay(_ingameSoundList[vocIndex]); - else if (_flags.platform == Common::kPlatformPC) + else if (_flags.platform == Common::kPlatformPC) // TODO ?? Maybe there is a way to let users select whether they want // voc, midi or adl sfx (even though it makes no sense to choose anything but voc). // For now this is used as a fallback only (if no voc file exists). diff --git a/engines/kyra/kyra_v2.h b/engines/kyra/kyra_v2.h index 6436cec92f..97ebb263dd 100644 --- a/engines/kyra/kyra_v2.h +++ b/engines/kyra/kyra_v2.h @@ -859,7 +859,7 @@ protected: int _sequencePakListSize; const char *const *_ingamePakList; int _ingamePakListSize; - + const char *const *_musicFileListIntro; int _musicFileListIntroSize; const char *const *_musicFileListFinale; diff --git a/engines/kyra/kyra_v3.cpp b/engines/kyra/kyra_v3.cpp index 6ee5eff11c..ce0f1a8cd2 100644 --- a/engines/kyra/kyra_v3.cpp +++ b/engines/kyra/kyra_v3.cpp @@ -61,7 +61,7 @@ KyraEngine_v3::KyraEngine_v3(OSystem *system, const GameFlags &flags) : KyraEngi KyraEngine_v3::~KyraEngine_v3() { delete _soundDigital; - + delete [] _unkPage1; delete [] _unkPage2; delete [] _interfaceCPS1; @@ -96,12 +96,12 @@ int KyraEngine_v3::init() { KyraEngine::init(); gui_initMainMenu(); - + _soundDigital = new SoundDigital(this, _mixer); assert(_soundDigital); if (!_soundDigital->init()) error("_soundDigital->init() failed"); - + _screen->loadFont(Screen::FID_6_FNT, "6.FNT"); _screen->loadFont(Screen::FID_8_FNT, "8FAT.FNT"); _screen->loadFont(Screen::FID_BOOKFONT_FNT, "BOOKFONT.FNT"); @@ -134,24 +134,24 @@ int KyraEngine_v3::init() { int KyraEngine_v3::go() { uint8 *pal = _screen->getPalette(1); assert(pal); - + _mainMenuLogo = createWSAMovie(); assert(_mainMenuLogo); _mainMenuLogo->open("REVENGE.WSA", 1, pal); assert(_mainMenuLogo->opened()); - + bool running = true; while (running && !_quitFlag) { _screen->_curPage = 0; _screen->clearPage(0); pal[0] = pal[1] = pal[2] = 0; - + _screen->setScreenPalette(pal); - + // XXX playMenuAudioFile(); - + _mainMenuLogo->setX(0); _mainMenuLogo->setY(0); _mainMenuLogo->setDrawPage(0); @@ -178,18 +178,18 @@ int KyraEngine_v3::go() { // XXX running = false; break; - + case 1: playVQA("K3INTRO"); break; - + case 2: //delete _mainMenuLogo; //_mainMenuLogo = 0; //show load dialog //running = false; break; - + case 3: _soundDigital->beginFadeOut(_musicSoundChannel); _screen->fadeToBlack(); @@ -197,7 +197,7 @@ int KyraEngine_v3::go() { _musicSoundChannel = -1; running = false; break; - + default: break; } @@ -255,19 +255,19 @@ void KyraEngine_v3::playMenuAudioFile() { void KyraEngine_v3::playMusicTrack(int track, int force) { debugC(9, kDebugLevelMain, "KyraEngine::playMusicTrack(%d, %d)", track, force); - + // XXX byte_2C87C compare - + if (_musicSoundChannel != -1 && !_soundDigital->isPlaying(_musicSoundChannel)) force = 1; else if (_musicSoundChannel == -1) force = 1; - + if (track == _curMusicTrack && !force) return; - + stopMusicTrack(); - + if (_musicSoundChannel == -1) { assert(track < _soundListSize && track >= 0); @@ -279,7 +279,7 @@ void KyraEngine_v3::playMusicTrack(int track, int force) { else delete handle; } - + _musicSoundChannel = track; } @@ -287,21 +287,21 @@ void KyraEngine_v3::stopMusicTrack() { if (_musicSoundChannel != -1 && _soundDigital->isPlaying(_musicSoundChannel)) { _soundDigital->stopSound(_musicSoundChannel); } - + _curMusicTrack = -1; _musicSoundChannel = -1; } int KyraEngine_v3::musicUpdate(int forceRestart) { debugC(9, kDebugLevelMain, "KyraEngine::unkUpdate(%d)", forceRestart); - + static uint32 mTimer = 0; static uint16 lock = 0; if (ABS(_system->getMillis() - mTimer) > (int)(0x0F * _tickLength)) { mTimer = _system->getMillis(); } - + if (_system->getMillis() < mTimer && !forceRestart) { return 1; } @@ -318,7 +318,7 @@ int KyraEngine_v3::musicUpdate(int forceRestart) { lock = 0; mTimer = _system->getMillis() + 0x0F * _tickLength; } - + return 1; } @@ -332,17 +332,17 @@ void KyraEngine_v3::gui_initMainMenu() { void KyraEngine_v3::gui_updateMainMenuAnimation() { uint32 nextRun = 0; - + uint32 now = _system->getMillis(); if (now < nextRun) return; // yes 2 * _tickLength here not 3 * like in the first draw nextRun = now + 2 * _tickLength; - + _mainMenuLogo->displayFrame(_mainMenuFrame); _screen->updateScreen(); - + _mainMenuFrame += _mainMenuFrameAdd; if (_mainMenuFrame < 29) { _mainMenuFrame = 29; @@ -351,7 +351,7 @@ void KyraEngine_v3::gui_updateMainMenuAnimation() { _mainMenuFrame = 64; _mainMenuFrameAdd = -1; } - + // XXX } @@ -367,17 +367,17 @@ void KyraEngine_v3::preinit() { // XXX setGameFlag(0x216); - + _unkPage1 = new uint8[64000]; assert(_unkPage1); - + musicUpdate(0); musicUpdate(0); - + _interfaceCPS1 = new uint8[17920]; _interfaceCPS2 = new uint8[3840]; assert(_interfaceCPS1 && _interfaceCPS2); - + _screen->setFont(Screen::FID_6_FNT); } diff --git a/engines/kyra/kyra_v3.h b/engines/kyra/kyra_v3.h index f0c3f3b2dd..78ce6382a4 100644 --- a/engines/kyra/kyra_v3.h +++ b/engines/kyra/kyra_v3.h @@ -53,14 +53,14 @@ private: void setupOpcodeTable() {} SoundDigital *_soundDigital; - + // sound specific private: void playMenuAudioFile(); - + int _musicSoundChannel; const char *_menuAudioFile; - + static const char *_soundList[]; static const int _soundListSize; diff --git a/engines/kyra/module.mk b/engines/kyra/module.mk index b5bf5ab73b..e631ddf5dd 100644 --- a/engines/kyra/module.mk +++ b/engines/kyra/module.mk @@ -48,5 +48,5 @@ ifdef BUILD_PLUGINS PLUGIN := 1 endif -# Include common rules +# Include common rules include $(srcdir)/rules.mk diff --git a/engines/kyra/resource.cpp b/engines/kyra/resource.cpp index 57094d8e68..b6d3bfe57a 100644 --- a/engines/kyra/resource.cpp +++ b/engines/kyra/resource.cpp @@ -63,7 +63,7 @@ bool Resource::reset() { unloadAllPakFiles(); FilesystemNode dir(ConfMan.get("path")); - + if (!dir.exists() || !dir.isDirectory()) error("invalid game path '%s'", dir.getPath().c_str()); @@ -179,7 +179,7 @@ bool Resource::loadPakFile(const Common::String &filename) { bool Resource::loadFileList(const Common::String &filedata) { Common::File f; - + if (!f.open(filedata)) return false; @@ -200,7 +200,7 @@ bool Resource::loadFileList(const Common::String &filedata) { error("couldn't load file '%s'", filename.c_str()); return false; } - } + } } return true; diff --git a/engines/kyra/scene.cpp b/engines/kyra/scene.cpp index 22cf2e0f2b..f3e41b2d39 100644 --- a/engines/kyra/scene.cpp +++ b/engines/kyra/scene.cpp @@ -33,12 +33,12 @@ int KyraEngine::findWay(int x, int y, int toX, int toY, int *moveTable, int move x &= 0xFFFC; toX &= 0xFFFC; y &= 0xFFFE; toY &= 0xFFFE; x = (int16)x; y = (int16)y; toX = (int16)toX; toY = (int16)toY; - + if (x == toY && y == toY) { moveTable[0] = 8; return 0; } - + int curX = x; int curY = y; int tempValue = 0; @@ -46,7 +46,7 @@ int KyraEngine::findWay(int x, int y, int toX, int toY, int *moveTable, int move int *pathTable1 = new int[0x7D0]; int *pathTable2 = new int[0x7D0]; assert(pathTable1 && pathTable2); - + while (true) { int newFacing = getFacingFromPointToPoint(x, y, toX, toY); changePosTowardsFacing(curX, curY, newFacing); @@ -86,7 +86,7 @@ int KyraEngine::findWay(int x, int y, int toX, int toY, int *moveTable, int move screen()->updateScreen(); //waitTicks(5); }*/ - + if (!lineIsPassable(curX, curY)) { if (curX != toX || curY != toY) continue; @@ -99,7 +99,7 @@ int KyraEngine::findWay(int x, int y, int toX, int toY, int *moveTable, int move break; } } - + temp = findSubPath(x, y, curX, curY, pathTable1, 1, 0x7D0); tempValue = findSubPath(x, y, curX, curY, pathTable2, 0, 0x7D0); if (curX == toX && curY == toY) { @@ -109,11 +109,11 @@ int KyraEngine::findWay(int x, int y, int toX, int toY, int *moveTable, int move return 0x7D00; } } - + if (temp != 0x7D00 || tempValue != 0x7D00) break; } - + if (temp < tempValue) { if (lastUsedEntry + temp > moveTableSize) { delete [] pathTable1; @@ -152,18 +152,18 @@ int KyraEngine::findSubPath(int x, int y, int toX, int toY, int *moveTable, int static const int8 facingTable3[] = { 2, 4, 4, 6, 6, 0, 0, 2, 6, 6, 0, 0, 2, 2, 4, 4 }; static const int8 addPosTableX[] = { -1, 0, -1, 4, -1, 0, -1, -4, -1, -4, -1, 0, -1, 4, -1, 0 }; static const int8 addPosTableY[] = { -1, 2, -1, 0, -1, -2, -1, 0, -1, 0, -1, 2, -1, 0, -1, -2 }; - + // debug specific /*++unkTable[start]; while (screen()->getPalette(0)[unkTable[start]] != 0x0F) { ++unkTable[start]; }*/ - + int xpos1 = x, xpos2 = x; int ypos1 = y, ypos2 = y; int newFacing = getFacingFromPointToPoint(x, y, toX, toY); int position = 0; - + while (position != end) { int newFacing2 = newFacing; while (true) { @@ -202,7 +202,7 @@ int KyraEngine::findSubPath(int x, int y, int toX, int toY, int *moveTable, int if (x == toX && y == toY) return position; - + if (xpos1 == xpos2 && ypos1 == ypos2) break; @@ -217,21 +217,21 @@ int KyraEngine::getFacingFromPointToPoint(int x, int y, int toX, int toY) { static const int facingTable[] = { 1, 0, 1, 2, 3, 4, 3, 2, 7, 0, 7, 6, 5, 4, 5, 6 }; - + int facingEntry = 0; int ydiff = y - toY; if (ydiff < 0) { ++facingEntry; ydiff = -ydiff; - } + } facingEntry <<= 1; - + int xdiff = toX - x; if (xdiff < 0) { ++facingEntry; xdiff = -xdiff; } - + if (xdiff >= ydiff) { int temp = ydiff; ydiff = xdiff; @@ -243,7 +243,7 @@ int KyraEngine::getFacingFromPointToPoint(int x, int y, int toX, int toY) { facingEntry += 1; } int temp = (ydiff + 1) >> 1; - + if (xdiff < temp) { facingEntry <<= 1; facingEntry += 1; @@ -290,7 +290,7 @@ int KyraEngine::getMoveTableSize(int *moveTable) { int retValue = 0; if (moveTable[0] == 8) return 0; - + static const int facingTable[] = { 4, 5, 6, 7, 0, 1, 2, 3 }; @@ -304,7 +304,7 @@ int KyraEngine::getMoveTableSize(int *moveTable) { 7, 0, -1, 4, 5, -1, -1, -1, -1, -1, 0, -1, 6, -1, -1, -1 }; - + int *oldPosition = moveTable; int *tempPosition = moveTable; int *curPosition = moveTable + 1; @@ -315,13 +315,13 @@ int KyraEngine::getMoveTableSize(int *moveTable) { retValue -= 2; *oldPosition = 9; *curPosition = 9; - + while (tempPosition != moveTable) { --tempPosition; if (*tempPosition != 9) break; } - + if (tempPosition == moveTable && *tempPosition == 9) { while (*tempPosition != 8 && *tempPosition == 9) ++tempPosition; @@ -329,7 +329,7 @@ int KyraEngine::getMoveTableSize(int *moveTable) { if (*tempPosition == 8) return 0; } - + oldPosition = tempPosition; curPosition = oldPosition+1; @@ -338,12 +338,12 @@ int KyraEngine::getMoveTableSize(int *moveTable) { continue; } - + if (unkTable[*curPosition+((*oldPosition)*8)] != -1) { --retValue; *oldPosition = unkTable[*curPosition+((*oldPosition)*8)]; *curPosition = 9; - + if (tempPosition != oldPosition) { curPosition = oldPosition; oldPosition = tempPosition; @@ -365,7 +365,7 @@ int KyraEngine::getMoveTableSize(int *moveTable) { } continue; } - + tempPosition = oldPosition; oldPosition = curPosition; ++retValue; diff --git a/engines/kyra/scene_v1.cpp b/engines/kyra/scene_v1.cpp index d5726fa57b..ce64269ba1 100644 --- a/engines/kyra/scene_v1.cpp +++ b/engines/kyra/scene_v1.cpp @@ -64,13 +64,13 @@ void KyraEngine_v1::enterNewScene(int sceneId, int facing, int unk1, int unk2, i newSfxFile = 2; else if (_currentCharacter->sceneId == 24 && sceneId == 7) newSfxFile = 1; - + if (newSfxFile != -1) { _curSfxFile = newSfxFile; _sound->loadSoundFile(_curSfxFile); } } - + switch (_currentCharacter->sceneId) { case 1: if (sceneId == 0) { @@ -103,7 +103,7 @@ void KyraEngine_v1::enterNewScene(int sceneId, int facing, int unk1, int unk2, i default: break; } - + if (unkVar1 && unk1) { int xpos = _currentCharacter->x1; int ypos = _currentCharacter->y1; @@ -127,32 +127,32 @@ void KyraEngine_v1::enterNewScene(int sceneId, int facing, int unk1, int unk2, i default: break; } - + moveCharacterToPos(0, facing, xpos, ypos); } - + for (int i = 0; i < ARRAYSIZE(_movieObjects); ++i) _movieObjects[i]->close(); - + if (!brandonAlive) { _scriptInterpreter->initScript(_scriptClick, _scriptClickData); _scriptInterpreter->startScript(_scriptClick, 5); while (_scriptInterpreter->validScript(_scriptClick)) _scriptInterpreter->runScript(_scriptClick); } - + memset(_entranceMouseCursorTracks, 0xFFFF, sizeof(uint16)*4); _currentCharacter->sceneId = sceneId; - + assert(sceneId < _roomTableSize); assert(_roomTable[sceneId].nameIndex < _roomFilenameTableSize); Room *currentRoom = &_roomTable[sceneId]; - + setupSceneResource(sceneId); - + _currentRoom = sceneId; - + int tableId = _roomTable[sceneId].nameIndex; char fileNameBuffer[32]; strcpy(fileNameBuffer, _roomFilenameTable[tableId]); @@ -161,12 +161,12 @@ void KyraEngine_v1::enterNewScene(int sceneId, int facing, int unk1, int unk2, i _sprites->setupSceneAnims(); _scriptInterpreter->unloadScript(_scriptClickData); loadSceneMsc(); - + _walkBlockNorth = currentRoom->northExit; _walkBlockEast = currentRoom->eastExit; _walkBlockSouth = currentRoom->southExit; _walkBlockWest = currentRoom->westExit; - + if (_walkBlockNorth == 0xFFFF) _screen->blockOutRegion(0, 0, 320, (_northExitHeight & 0xFF)+3); if (_walkBlockEast == 0xFFFF) @@ -175,15 +175,15 @@ void KyraEngine_v1::enterNewScene(int sceneId, int facing, int unk1, int unk2, i _screen->blockOutRegion(0, 135, 320, 8); if (_walkBlockWest == 0xFFFF) _screen->blockOutRegion(0, 0, 8, 139); - + if (!brandonAlive) updatePlayerItemsForScene(); startSceneScript(brandonAlive); setupSceneItems(); - + initSceneData(facing, unk2, brandonAlive); - + _loopFlag2 = 0; _screen->showMouse(); if (!brandonAlive) @@ -244,15 +244,15 @@ void KyraEngine_v1::moveCharacterToPos(int character, int facing, int xpos, int delayUntil(nextFrame, true); } break; - - case 2: + + case 2: while (ch->x1 < xpos) { nextFrame = _timer->getDelay(5 + character) * _tickLength + _system->getMillis(); setCharacterPositionWithUpdate(character); delayUntil(nextFrame, true); } break; - + case 4: while (ypos > ch->y1) { nextFrame = _timer->getDelay(5 + character) * _tickLength + _system->getMillis(); @@ -260,7 +260,7 @@ void KyraEngine_v1::moveCharacterToPos(int character, int facing, int xpos, int delayUntil(nextFrame, true); } break; - + case 6: while (ch->x1 > xpos) { nextFrame = _timer->getDelay(5 + character) * _tickLength + _system->getMillis(); @@ -268,7 +268,7 @@ void KyraEngine_v1::moveCharacterToPos(int character, int facing, int xpos, int delayUntil(nextFrame, true); } break; - + default: break; } @@ -321,10 +321,10 @@ void KyraEngine_v1::setCharacterPositionHelper(int character, int *facingTable) } } } - + static uint8 facingIsZero[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; static uint8 facingIsFour[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; - + if (facing == 0) { ++facingIsZero[character]; } else { @@ -350,13 +350,13 @@ void KyraEngine_v1::setCharacterPositionHelper(int character, int *facingTable) facing = 0; resetTables = true; } - + if (resetTables) { facingIsZero[character] = 0; facingIsFour[character] = 0; } } - + static const uint16 maxAnimationFrame[] = { 0x000F, 0x0031, 0x0055, 0x0000, 0x0000, 0x0000, 0x0008, 0x002A, 0x004E, 0x0000, 0x0000, 0x0000, @@ -366,7 +366,7 @@ void KyraEngine_v1::setCharacterPositionHelper(int character, int *facingTable) 0x0028, 0x004C, 0x0070, 0x0000, 0x0000, 0x0000, 0x0023, 0x0047, 0x006B, 0x0000, 0x0000, 0x0000 }; - + if (facing == 0) { if (maxAnimationFrame[36+character] > ch->currentAnimFrame) ch->currentAnimFrame = maxAnimationFrame[36+character]; @@ -385,10 +385,10 @@ void KyraEngine_v1::setCharacterPositionHelper(int character, int *facingTable) if (maxAnimationFrame[character] < ch->currentAnimFrame) ch->currentAnimFrame = maxAnimationFrame[6+character]+2; } - + if (character == 0 && (_brandonStatusBit & 0x10)) ch->currentAnimFrame = 88; - + _animator->animRefreshNPC(character); } @@ -416,11 +416,11 @@ void KyraEngine_v1::startSceneScript(int brandonAlive) { _screen->loadBitmap(fileNameBuffer, 3, 3, (_flags.platform == Common::kPlatformAmiga ? _screen->getPalette(0) : 0)); _sprites->loadSceneShapes(); _exitListPtr = 0; - - _scaleMode = 1; + + _scaleMode = 1; for (int i = 0; i < 145; ++i) _scaleTable[i] = 256; - + clearNoDropRects(); _scriptInterpreter->initScript(_scriptClick, _scriptClickData); strcpy(fileNameBuffer, _roomFilenameTable[tableId]); @@ -430,19 +430,19 @@ void KyraEngine_v1::startSceneScript(int brandonAlive) { _scriptInterpreter->startScript(_scriptClick, 0); _scriptClick->regs[0] = _currentCharacter->sceneId; _scriptClick->regs[7] = brandonAlive; - + while (_scriptInterpreter->validScript(_scriptClick)) _scriptInterpreter->runScript(_scriptClick); } void KyraEngine_v1::initSceneData(int facing, int unk1, int brandonAlive) { debugC(9, kDebugLevelMain, "KyraEngine_v1::initSceneData(%d, %d, %d)", facing, unk1, brandonAlive); - + int16 xpos2 = 0; int setFacing = 1; - + int16 xpos = 0, ypos = 0; - + if (_brandonPosX == -1 && _brandonPosY == -1) { switch (facing + 1) { case 0: @@ -472,7 +472,7 @@ void KyraEngine_v1::initSceneData(int facing, int unk1, int brandonAlive) { default: break; } - + if ((uint8)(_northExitHeight & 0xFF) + 2 >= ypos) ypos = (_northExitHeight & 0xFF) + 4; if (xpos >= 308) @@ -482,12 +482,12 @@ void KyraEngine_v1::initSceneData(int facing, int unk1, int brandonAlive) { if (xpos <= 12) xpos = 16; } - + if (_brandonPosX > -1) xpos = _brandonPosX; if (_brandonPosY > -1) ypos = _brandonPosY; - + int16 ypos2 = 0; if (_brandonPosX > -1 && _brandonPosY > -1) { switch (_currentCharacter->sceneId) { @@ -555,9 +555,9 @@ void KyraEngine_v1::initSceneData(int facing, int unk1, int brandonAlive) { break; } } - + _brandonPosX = _brandonPosY = -1; - + if (unk1 && setFacing) { ypos2 = ypos; xpos2 = xpos; @@ -582,7 +582,7 @@ void KyraEngine_v1::initSceneData(int facing, int unk1, int brandonAlive) { break; } } - + xpos2 = (int16)(xpos2 & 0xFFFC); ypos2 = (int16)(ypos2 & 0xFFFE); xpos = (int16)(xpos & 0xFFFC); @@ -592,12 +592,12 @@ void KyraEngine_v1::initSceneData(int facing, int unk1, int brandonAlive) { _currentCharacter->x2 = xpos; _currentCharacter->y1 = ypos; _currentCharacter->y2 = ypos; - + initSceneObjectList(brandonAlive); - + if (unk1 && brandonAlive == 0) moveCharacterToPos(0, facing, xpos2, ypos2); - + _scriptClick->regs[4] = _itemInHand; _scriptClick->regs[7] = brandonAlive; _scriptInterpreter->startScript(_scriptClick, 3); @@ -609,9 +609,9 @@ void KyraEngine_v1::initSceneObjectList(int brandonAlive) { debugC(9, kDebugLevelMain, "KyraEngine_v1::initSceneObjectList(%d)", brandonAlive); for (int i = 0; i < 28; ++i) _animator->actors()[i].active = 0; - + int startAnimFrame = 0; - + AnimObject *curAnimState = _animator->actors(); curAnimState->active = 1; curAnimState->drawY = _currentCharacter->y1; @@ -624,10 +624,10 @@ void KyraEngine_v1::initSceneObjectList(int brandonAlive) { if (_scaleMode) { curAnimState->x1 = _currentCharacter->x1; curAnimState->y1 = _currentCharacter->y1; - + _animator->_brandonScaleX = _scaleTable[_currentCharacter->y1]; _animator->_brandonScaleY = _scaleTable[_currentCharacter->y1]; - + curAnimState->x1 += (_animator->_brandonScaleX * xOffset) >> 8; curAnimState->y1 += (_animator->_brandonScaleY * yOffset) >> 8; } else { @@ -641,10 +641,10 @@ void KyraEngine_v1::initSceneObjectList(int brandonAlive) { curAnimState->bkgdChangeFlag = 1; _animator->clearQueue(); _animator->addObjectToQueue(curAnimState); - + int listAdded = 0; int addedObjects = 1; - + for (int i = 1; i < 5; ++i) { Character *ch = &_characterList[i]; curAnimState = &_animator->actors()[addedObjects]; @@ -655,7 +655,7 @@ void KyraEngine_v1::initSceneObjectList(int brandonAlive) { ++addedObjects; continue; } - + curAnimState->drawY = ch->y1; curAnimState->sceneAnimPtr = _shapes[ch->currentAnimFrame]; curAnimState->animFrameNumber = ch->currentAnimFrame; @@ -665,10 +665,10 @@ void KyraEngine_v1::initSceneObjectList(int brandonAlive) { if (_scaleMode) { curAnimState->x1 = ch->x1; curAnimState->y1 = ch->y1; - + _animator->_brandonScaleX = _scaleTable[ch->y1]; _animator->_brandonScaleY = _scaleTable[ch->y1]; - + curAnimState->x1 += (_animator->_brandonScaleX * xOffset) >> 8; curAnimState->y1 += (_animator->_brandonScaleY * yOffset) >> 8; } else { @@ -680,20 +680,20 @@ void KyraEngine_v1::initSceneObjectList(int brandonAlive) { curAnimState->active = 1; curAnimState->refreshFlag = 1; curAnimState->bkgdChangeFlag = 1; - + if (ch->facing >= 1 && ch->facing <= 3) curAnimState->flags |= 1; else if (ch->facing >= 5 && ch->facing <= 7) curAnimState->flags &= 0xFFFFFFFE; - + _animator->addObjectToQueue(curAnimState); - + ++addedObjects; ++listAdded; if (listAdded < 2) i = 5; } - + for (int i = 0; i < 11; ++i) { curAnimState = &_animator->sprites()[i]; @@ -715,9 +715,9 @@ void KyraEngine_v1::initSceneObjectList(int brandonAlive) { curAnimState->y1 = curAnimState->y2 = _sprites->_anims[i].y; curAnimState->background = _sprites->_anims[i].background; curAnimState->sceneAnimPtr = _sprites->_sceneShapes[_sprites->_anims[i].sprite]; - + curAnimState->disable = _sprites->_anims[i].disable; - + if (_sprites->_anims[i].unk2) curAnimState->flags = 0x800; else @@ -725,10 +725,10 @@ void KyraEngine_v1::initSceneObjectList(int brandonAlive) { if (_sprites->_anims[i].flipX) curAnimState->flags |= 0x1; - + _animator->addObjectToQueue(curAnimState); } - + for (int i = 0; i < 12; ++i) { curAnimState = &_animator->items()[i]; Room *curRoom = &_roomTable[_currentCharacter->sceneId]; @@ -739,17 +739,17 @@ void KyraEngine_v1::initSceneObjectList(int brandonAlive) { curAnimState->animFrameNumber = (int16)0xFFFF; curAnimState->y1 = curRoom->itemsYPos[i]; curAnimState->x1 = curRoom->itemsXPos[i]; - + curAnimState->x1 -= (_animator->fetchAnimWidth(curAnimState->sceneAnimPtr, _scaleTable[curAnimState->drawY])) >> 1; curAnimState->y1 -= _animator->fetchAnimHeight(curAnimState->sceneAnimPtr, _scaleTable[curAnimState->drawY]); - + curAnimState->x2 = curAnimState->x1; curAnimState->y2 = curAnimState->y1; - + curAnimState->active = 1; curAnimState->refreshFlag = 1; curAnimState->bkgdChangeFlag = 1; - + _animator->addObjectToQueue(curAnimState); } else { curAnimState->active = 0; @@ -757,7 +757,7 @@ void KyraEngine_v1::initSceneObjectList(int brandonAlive) { curAnimState->bkgdChangeFlag = 0; } } - + _animator->preserveAnyChangedBackgrounds(); curAnimState = _animator->actors(); curAnimState->bkgdChangeFlag = 1; @@ -839,7 +839,7 @@ void KyraEngine_v1::initSceneScreen(int brandonAlive) { if (_currentCharacter->sceneId == 210) { if (_itemInHand != -1) magicOutMouseItem(2, -1); - + _screen->hideMouse(); for (int i = 0; i < 10; ++i) { if (_currentCharacter->inventoryItems[i] != 0xFF) @@ -870,7 +870,7 @@ int KyraEngine_v1::handleSceneChange(int xpos, int ypos, int unk1, int frameRese _pathfinderFlag = 13; } } - + if (ypos <= (_northExitHeight&0xFF)+2) { if (_roomTable[sceneId].northExit != 0xFFFF) { xpos = _sceneExits.northXPos; @@ -884,19 +884,19 @@ int KyraEngine_v1::handleSceneChange(int xpos, int ypos, int unk1, int frameRese _pathfinderFlag = 11; } } - + int temp = xpos - _currentCharacter->x1; if (ABS(temp) < 4) { temp = ypos - _currentCharacter->y1; if (ABS(temp) < 2) return 0; } - + int x = (int16)(_currentCharacter->x1 & 0xFFFC); int y = (int16)(_currentCharacter->y1 & 0xFFFE); xpos = (int16)(xpos & 0xFFFC); ypos = (int16)(ypos & 0xFFFE); - + int ret = findWay(x, y, xpos, ypos, _movFacingTable, 150); _pathfinderFlag = 0; @@ -950,23 +950,23 @@ int KyraEngine_v1::processSceneChange(int *table, int unk1, int frameReset) { forceContinue = true; break; } - + returnValue = changeScene(_currentCharacter->facing); if (returnValue) { running = false; _abortWalkFlag = false; } - + if (unk1) { if (_mousePressFlag) { running = false; _sceneChangeState = 1; } } - + if (forceContinue || !running) continue; - + int temp = 0; if (table == tableStart || table[1] == 8) temp = setCharacterPosition(0, 0); @@ -975,7 +975,7 @@ int KyraEngine_v1::processSceneChange(int *table, int unk1, int frameReset) { if (temp) ++table; - + nextFrame = _timer->getDelay(5) * _tickLength + _system->getMillis(); while (_system->getMillis() < nextFrame) { _timer->update(); @@ -993,7 +993,7 @@ int KyraEngine_v1::processSceneChange(int *table, int unk1, int frameReset) { delay(10, true); } } - + if (frameReset && !(_brandonStatusBit & 2)) _currentCharacter->currentAnimFrame = 7; @@ -1008,22 +1008,22 @@ int KyraEngine_v1::changeScene(int facing) { if (_currentCharacter->sceneId == 5) return 0; } - + int xpos = _charXPosTable[facing] + _currentCharacter->x1; int ypos = _charYPosTable[facing] + _currentCharacter->y1; - + if (xpos >= 12 && xpos <= 308) { if (!lineIsPassable(xpos, ypos)) return false; } - + if (_exitListPtr) { int16 *ptr = _exitListPtr; // this loop should be only entered one time, seems to be some hack in the original while (true) { if (*ptr == -1) break; - + if (*ptr > _currentCharacter->x1 || _currentCharacter->y1 < ptr[1] || _currentCharacter->x1 > ptr[2] || _currentCharacter->y1 > ptr[3]) { ptr += 10; break; @@ -1058,7 +1058,7 @@ int KyraEngine_v1::changeScene(int facing) { break; } } - + _currentCharacter->facing = facing; _animator->animRefreshNPC(0); _animator->updateAllObjectShapes(); @@ -1067,33 +1067,33 @@ int KyraEngine_v1::changeScene(int facing) { return 1; } } - + int returnValue = 0; facing = 0; - + if ((_northExitHeight & 0xFF) + 2 >= ypos || (_northExitHeight & 0xFF) + 2 >= _currentCharacter->y1) { facing = 0; returnValue = 1; } - + if (xpos >= 308 || (_currentCharacter->x1 + 4) >= 308) { facing = 2; returnValue = 1; } - + if (((_northExitHeight >> 8) & 0xFF) - 2 < ypos || ((_northExitHeight >> 8) & 0xFF) - 2 < _currentCharacter->y1) { facing = 4; returnValue = 1; } - + if (xpos <= 12 || _currentCharacter->y1 <= 12) { facing = 6; returnValue = 1; } - + if (!returnValue) return 0; - + uint16 sceneId = 0xFFFF; switch (facing) { case 0: @@ -1112,7 +1112,7 @@ int KyraEngine_v1::changeScene(int facing) { sceneId = _roomTable[_currentCharacter->sceneId].westExit; break; } - + if (sceneId == 0xFFFF) return 0; @@ -1127,7 +1127,7 @@ void KyraEngine_v1::setCharactersInDefaultScene() { { 0xFFFF, 0x001D, 0x0021, 0xFFFF }, { 0xFFFF, 0x0000, 0x0000, 0xFFFF } }; - + for (int i = 1; i < 5; ++i) { Character *cur = &_characterList[i]; //cur->field_20 = 0; @@ -1178,49 +1178,49 @@ bool KyraEngine_v1::lineIsPassable(int x, int y) { if (_currentCharacter->sceneId == 5) return true; } - + if (_pathfinderFlag & 2) { if (x >= 312) return false; } - + if (_pathfinderFlag & 4) { if (y >= 136) return false; } - + if (_pathfinderFlag & 8) { if (x < 8) return false; } - + if (_pathfinderFlag2) { if (x <= 8 || x >= 312) return true; if (y < (_northExitHeight & 0xFF) || y > 135) return true; } - + if (y > 137) return false; if (y < 0) y = 0; - + int ypos = 8; if (_scaleMode) { ypos = (_scaleTable[y] >> 5) + 1; if (8 < ypos) ypos = 8; } - + x -= (ypos >> 1); - + int xpos = x; int xtemp = xpos + ypos - 1; if (x < 0) xpos = 0; - + if (xtemp > 319) xtemp = 319; diff --git a/engines/kyra/scene_v2.cpp b/engines/kyra/scene_v2.cpp index b9ed041206..63664c91d8 100644 --- a/engines/kyra/scene_v2.cpp +++ b/engines/kyra/scene_v2.cpp @@ -22,7 +22,7 @@ * $Id$ * */ - + #include "kyra/kyra_v2.h" #include "kyra/screen_v2.h" #include "kyra/sound.h" @@ -45,12 +45,12 @@ void KyraEngine_v2::enterNewScene(uint16 newScene, int facing, int unk1, int unk } _screen->hideMouse(); - + if (!unk3) { //updateSpecialItems(); //displayInvWsaLastFrame(); } - + if (unk1) { int x = _mainCharacter.x1; int y = _mainCharacter.y1; @@ -71,60 +71,60 @@ void KyraEngine_v2::enterNewScene(uint16 newScene, int facing, int unk1, int unk case 6: x = -16; break; - + default: break; } - + moveCharacter(facing, x, y); } - + bool newSoundFile = false; if (_sceneList[newScene].sound != _lastMusicCommand) { newSoundFile = true; //XXX _sound->beginFadeOut(); } - + _unkFlag1 = false; - + if (!unk3) { _scriptInterpreter->initScript(&_sceneScriptState, &_sceneScriptData); _scriptInterpreter->startScript(&_sceneScriptState, 5); while (_scriptInterpreter->validScript(&_sceneScriptState)) _scriptInterpreter->runScript(&_sceneScriptState); } - + Common::for_each(_wsaSlots, _wsaSlots+ARRAYSIZE(_wsaSlots), Common::mem_fun(&WSAMovieV2::close)); _specialExitCount = 0; memset(_specialExitTable, -1, sizeof(_specialExitTable)); - + _mainCharacter.sceneId = newScene; _sceneList[newScene].flags &= ~1; loadScenePal(); unloadScene(); loadSceneMsc(); - + SceneDesc &scene = _sceneList[newScene]; _sceneExit1 = scene.exit1; _sceneExit2 = scene.exit2; _sceneExit3 = scene.exit3; _sceneExit4 = scene.exit4; - + if (newSoundFile) { //XXX while (snd_isPlaying()) ; snd_loadSoundFile(_sceneList[newScene].sound); } - + startSceneScript(unk3); - + if (_overwriteSceneFacing) { facing = _mainCharacter.facing; _overwriteSceneFacing = false; } - + enterNewSceneUnk1(facing, unk2, unk3); - + setTimer1DelaySecs(-1); _sceneScriptState.regs[3] = 1; enterNewSceneUnk2(unk3); @@ -139,34 +139,34 @@ void KyraEngine_v2::enterNewSceneUnk1(int facing, int unk1, int unk2) { int x = 0, y = 0; int x2 = 0, y2 = 0; bool needProc = true; - + if (_mainCharX == -1 && _mainCharY == -1) { switch (facing+1) { case 1: case 2: case 8: x2 = _sceneEnterX3; y2 = _sceneEnterY3; break; - + case 3: x2 = _sceneEnterX4; y2 = _sceneEnterY4; break; - + case 4: case 5: case 6: x2 = _sceneEnterX1; y2 = _sceneEnterY1; break; - + case 7: x2 = _sceneEnterX2; y2 = _sceneEnterY2; break; - + default: x2 = y2 = -1; break; } - + if (x2 >= 316) x2 = 312; if (y2 >= 141) @@ -174,45 +174,45 @@ void KyraEngine_v2::enterNewSceneUnk1(int facing, int unk1, int unk2) { if (x2 <= 4) x2 = 8; } - + if (_mainCharX >= 0) { x = x2 = _mainCharX; needProc = false; } - + if (_mainCharY >= 0) { y = y2 = _mainCharY; needProc = false; } - + _mainCharX = _mainCharY = -1; - + if (unk1 && needProc) { x = x2; y = y2; - + switch (facing) { case 0: y2 = 147; break; - + case 2: x2 = -16; break; - + case 4: y2 = y - 4; break; - + case 6: x2 = 335; break; - + default: break; } } - + x2 &= ~3; x &= ~3; y2 &= ~1; @@ -222,17 +222,17 @@ void KyraEngine_v2::enterNewSceneUnk1(int facing, int unk1, int unk2) { _mainCharacter.x1 = _mainCharacter.x2 = x2; _mainCharacter.y1 = _mainCharacter.y2 = y2; initSceneAnims(unk2); - + if (!unk2) snd_playWanderScoreViaMap(_sceneList[_mainCharacter.sceneId].sound, 0); - + if (unk1 && !unk2 && _mainCharacter.animFrame != 32) moveCharacter(facing, x, y); } void KyraEngine_v2::enterNewSceneUnk2(int unk1) { _unk3 = -1; - + if (_mainCharX == -1 && _mainCharY == -1 && _mainCharacter.sceneId != 61 && !queryGameFlag(0x1F1) && !queryGameFlag(0x192) && !queryGameFlag(0x193) && _mainCharacter.sceneId != 70 && !queryGameFlag(0x159) && _mainCharacter.sceneId != 37) { @@ -240,12 +240,12 @@ void KyraEngine_v2::enterNewSceneUnk2(int unk1) { updateCharacterAnim(0); refreshAnimObjectsIfNeed(); } - + if (!unk1) { runSceneScript4(0); //XXX sub_27158 } - + _unk4 = 0; _unk3 = -1; } @@ -269,12 +269,12 @@ int KyraEngine_v2::trySceneChange(int *moveTable, int unk1, int updateChar) { unkFlag = false; } } - + if (checkSceneChange()) { running = false; changedScene = 1; } - + if (unk1) { // TODO: check this again int inputFlag = checkInput(0/*dword_324C5*/); @@ -283,7 +283,7 @@ int KyraEngine_v2::trySceneChange(int *moveTable, int unk1, int updateChar) { _unk4 = 1; } } - + if (!unkFlag || !running) continue; @@ -304,13 +304,13 @@ int KyraEngine_v2::trySceneChange(int *moveTable, int unk1, int updateChar) { updateType = -1; } } - + if (updateChar) _mainCharacter.animFrame = _characterFrameTable[_mainCharacter.facing]; - + updateCharacterAnim(0); refreshAnimObjectsIfNeed(); - + if (!changedScene && !_unk4) { //XXX } @@ -322,7 +322,7 @@ int KyraEngine_v2::checkSceneChange() { int charX = _mainCharacter.x1, charY = _mainCharacter.y1; int facing = 0; int process = 0; - + if (_screen->getLayer(charX, charY) == 1 && _unk3 == -6) { facing = 0; process = 1; @@ -336,36 +336,36 @@ int KyraEngine_v2::checkSceneChange() { facing = 6; process = 1; } - + if (!process) return 0; - + uint16 newScene = 0xFFFF; switch (facing) { case 0: newScene = curScene.exit1; break; - + case 2: newScene = curScene.exit2; break; - + case 4: newScene = curScene.exit3; break; - + case 6: newScene = curScene.exit4; break; - + default: newScene = _mainCharacter.sceneId; break; } - + if (newScene == 0xFFFF) return 0; - + enterNewScene(newScene, facing, 1, 1, 0); return 1; } @@ -379,7 +379,7 @@ void KyraEngine_v2::unloadScene() { void KyraEngine_v2::loadScenePal() { uint16 sceneId = _mainCharacter.sceneId; memcpy(_screen->getPalette(1), _screen->getPalette(0), 768); - + char filename[14]; strcpy(filename, _sceneList[sceneId].filename); strcat(filename, ".COL"); @@ -400,10 +400,10 @@ void KyraEngine_v2::loadSceneMsc() { void KyraEngine_v2::startSceneScript(int unk1) { uint16 sceneId = _mainCharacter.sceneId; char filename[14]; - + strcpy(filename, _sceneList[sceneId].filename); if (sceneId == 68 && (queryGameFlag(0x1BC) || queryGameFlag(0x1DC))) - strcpy(filename, "DOORX"); + strcpy(filename, "DOORX"); strcat(filename, ".CPS"); _screen->loadBitmap(filename, 3, 3, 0); @@ -421,18 +421,18 @@ void KyraEngine_v2::startSceneScript(int unk1) { _sceneEnterY3 = 128; _sceneEnterX4 = 24; _sceneEnterY4 = 72; - + _sceneCommentString = "Undefined scene comment string!"; _scriptInterpreter->initScript(&_sceneScriptState, &_sceneScriptData); - + strcpy(filename, _sceneList[sceneId].filename); strcat(filename, "."); strcat(filename, _scriptLangExt[(_flags.platform == Common::kPlatformPC && !_flags.isTalkie) ? 0 : _lang]); - + assert(_res->getFileSize(filename)); _scriptInterpreter->loadScript(filename, &_sceneScriptData, &_opcodes); runSceneScript7(); - + _scriptInterpreter->startScript(&_sceneScriptState, 0); _sceneScriptState.regs[0] = sceneId; _sceneScriptState.regs[5] = unk1; @@ -440,13 +440,13 @@ void KyraEngine_v2::startSceneScript(int unk1) { _scriptInterpreter->runScript(&_sceneScriptState); memcpy(_gamePlayBuffer, _screen->getCPagePtr(3), 46080); - + for (int i = 0; i < 10; ++i) { _scriptInterpreter->initScript(&_sceneSpecialScripts[i], &_sceneScriptData); _scriptInterpreter->startScript(&_sceneSpecialScripts[i], i+8); _sceneSpecialScriptsTimer[i] = 0; } - + _sceneEnterX1 &= ~3; _sceneEnterX2 &= ~3; _sceneEnterX3 &= ~3; @@ -461,7 +461,7 @@ void KyraEngine_v2::runSceneScript2() { _scriptInterpreter->initScript(&_sceneScriptState, &_sceneScriptData); _sceneScriptState.regs[4] = _itemInHand; _scriptInterpreter->startScript(&_sceneScriptState, 2); - + while (_scriptInterpreter->validScript(&_sceneScriptState)) _scriptInterpreter->runScript(&_sceneScriptState); } @@ -491,7 +491,7 @@ void KyraEngine_v2::runSceneScript6() { void KyraEngine_v2::runSceneScript7() { int oldPage = _screen->_curPage; _screen->_curPage = 2; - + _scriptInterpreter->startScript(&_sceneScriptState, 7); while (_scriptInterpreter->validScript(&_sceneScriptState)) _scriptInterpreter->runScript(&_sceneScriptState); @@ -502,32 +502,32 @@ void KyraEngine_v2::runSceneScript7() { void KyraEngine_v2::initSceneAnims(int unk1) { for (int i = 0; i < ARRAYSIZE(_animObjects); ++i) _animObjects[i].enabled = 0; - + bool animInit = false; - + AnimObj *animState = &_animObjects[0]; - + if (_mainCharacter.animFrame != 32) _mainCharacter.animFrame = _characterFrameTable[_mainCharacter.facing]; - + animState->enabled = 1; animState->xPos1 = _mainCharacter.x1; animState->yPos1 = _mainCharacter.y1; animState->shapePtr = _defaultShapeTable[_mainCharacter.animFrame]; animState->shapeIndex1 = animState->shapeIndex2 = _mainCharacter.animFrame; - + int frame = _mainCharacter.animFrame - 9; int shapeX = _shapeDescTable[frame].xAdd; int shapeY = _shapeDescTable[frame].yAdd; - + animState->xPos2 = _mainCharacter.x1; animState->yPos2 = _mainCharacter.y1; - + _charScaleX = _charScaleY = getScale(_mainCharacter.x1, _mainCharacter.y1); - + int shapeXScaled = (shapeX * _charScaleX) >> 8; int shapeYScaled = (shapeY * _charScaleY) >> 8; - + animState->xPos2 += shapeXScaled; animState->yPos2 += shapeYScaled; animState->xPos3 = animState->xPos2; @@ -536,39 +536,39 @@ void KyraEngine_v2::initSceneAnims(int unk1) { animState->unk8 = 1; _animList = 0; - + AnimObj *charAnimState = animState; - + for (int i = 0; i < 10; ++i) { animState = &_animObjects[i+1]; animState->enabled = 0; animState->needRefresh = 0; animState->unk8 = 0; - + if (_sceneAnims[i].flags & 1) { animState->enabled = 1; animState->needRefresh = 1; animState->unk8 = 1; } - + animState->animFlags = _sceneAnims[i].flags & 8; - + if (_sceneAnims[i].flags & 2) animState->flags = 0x800; else animState->flags = 0; - + if (_sceneAnims[i].flags & 4) animState->flags |= 1; - + animState->xPos1 = _sceneAnims[i].x; animState->yPos1 = _sceneAnims[i].y; - + if (_sceneAnims[i].flags & 0x20) animState->shapePtr = _sceneShapeTable[_sceneAnims[i].shapeIndex]; else animState->shapePtr = 0; - + if (_sceneAnims[i].flags & 0x40) { animState->shapeIndex3 = _sceneAnims[i].shapeIndex; animState->animNum = i; @@ -576,15 +576,15 @@ void KyraEngine_v2::initSceneAnims(int unk1) { animState->shapeIndex3 = 0xFFFF; animState->animNum = 0xFFFF; } - + animState->shapeIndex2 = 0xFFFF; - + animState->xPos3 = animState->xPos2 = _sceneAnims[i].x2; animState->yPos3 = animState->yPos2 = _sceneAnims[i].y2; animState->width = _sceneAnims[i].width; animState->height = _sceneAnims[i].height; animState->width2 = animState->height2 = _sceneAnims[i].specialSize; - + if (_sceneAnims[i].flags & 1) { if (animInit) { _animList = addToAnimListSorted(_animList, animState); @@ -594,17 +594,17 @@ void KyraEngine_v2::initSceneAnims(int unk1) { } } } - + if (animInit) { _animList = addToAnimListSorted(_animList, charAnimState); } else { _animList = initAnimList(_animList, charAnimState); animInit = true; } - + for (int i = 0; i < 30; ++i) { animState = &_animObjects[i+11]; - + uint16 shapeIndex = _itemList[i].id; if (shapeIndex == 0xFFFF || _itemList[i].sceneId != _mainCharacter.sceneId) { animState->enabled = 0; @@ -615,21 +615,21 @@ void KyraEngine_v2::initSceneAnims(int unk1) { animState->yPos1 = _itemList[i].y; animState->shapePtr = _defaultShapeTable[64+shapeIndex]; animState->shapeIndex1 = animState->shapeIndex2 = shapeIndex+64; - + animState->xPos2 = _itemList[i].x; animState->yPos2 = _itemList[i].y; int objectScale = getScale(animState->xPos2, animState->yPos2); - + const uint8 *shape = getShapePtr(animState->shapeIndex1); animState->xPos2 -= (_screen->getShapeScaledWidth(shape, objectScale) >> 1); animState->yPos2 -= (_screen->getShapeScaledHeight(shape, objectScale) >> 1); animState->xPos3 = animState->xPos2; animState->yPos3 = animState->yPos2; - + animState->enabled = 1; animState->needRefresh = 1; animState->unk8 = 1; - + if (animInit) { _animList = addToAnimListSorted(_animList, animState); } else { @@ -638,17 +638,17 @@ void KyraEngine_v2::initSceneAnims(int unk1) { } } } - + _animObjects[0].unk8 = 1; _animObjects[0].needRefresh = 1; - + for (int i = 1; i < 41; ++i) { if (_animObjects[i].enabled) { _animObjects[i].needRefresh = 1; _animObjects[i].unk8 = 1; } } - + restorePage3(); drawAnimObjects(); _screen->hideMouse(); @@ -686,23 +686,23 @@ void KyraEngine_v2::updateSpecialSceneScripts() { const int startScript = _lastProcessedSceneScript; while (_system->getMillis() <= nextTime) { - if (_sceneSpecialScriptsTimer[_lastProcessedSceneScript] <= _system->getMillis() && + if (_sceneSpecialScriptsTimer[_lastProcessedSceneScript] <= _system->getMillis() && !_specialSceneScriptState[_lastProcessedSceneScript]) { _specialSceneScriptRunFlag = true; - + while (_specialSceneScriptRunFlag && _sceneSpecialScriptsTimer[_lastProcessedSceneScript] <= _system->getMillis()) _specialSceneScriptRunFlag = _scriptInterpreter->runScript(&_sceneSpecialScripts[_lastProcessedSceneScript]) != 0; } - + if (!_scriptInterpreter->validScript(&_sceneSpecialScripts[_lastProcessedSceneScript])) { _scriptInterpreter->startScript(&_sceneSpecialScripts[_lastProcessedSceneScript], 8+_lastProcessedSceneScript); _specialSceneScriptRunFlag = false; } - + ++_lastProcessedSceneScript; if (_lastProcessedSceneScript >= 10) _lastProcessedSceneScript = 0; - + if (_lastProcessedSceneScript == startScript) return; } @@ -743,22 +743,22 @@ bool KyraEngine_v2::lineIsPassable(int x, int y) { if (x >= 320) return false; } - + if (_pathfinderFlag & 4) { if (y >= 144) return false; } - + if (_pathfinderFlag & 8) { if (x < 0) return false; } - + if (y > 143) return false; int unk1 = unkTable[getScale(x, y) >> 5]; - + if (y < 0) y = 0; x -= unk1 >> 1; @@ -767,7 +767,7 @@ bool KyraEngine_v2::lineIsPassable(int x, int y) { int x2 = x + unk1; if (x2 > 320) x2 = 320; - + for (;x < x2; ++x) if (!_screen->getShapeFlag1(x, y)) return false; @@ -793,15 +793,15 @@ int KyraEngine_v2::pathfinderUnk1(int *moveTable) { int oldX = 0, newX = 0, oldY = 0, newY = 0; int lastEntry = 0; lastEntry = pathfinderUnk2(lastEntry, 0, 0); - + while (*moveTableCur != 8) { oldEntry = curEntry; - + while (true) { curEntry = *moveTableCur; if (curEntry >= 0 && curEntry <= 7) break; - + if (curEntry == 8) { breakLoop = true; break; @@ -809,27 +809,27 @@ int KyraEngine_v2::pathfinderUnk1(int *moveTable) { ++moveTableCur; } } - + if (breakLoop) break; - + oldX = newX; oldY = newY; - + newX += _addXPosTable[curEntry]; newY += _addYPosTable[curEntry]; - + int temp = ABS(curEntry - oldEntry); if (temp > 4) { temp = 8 - temp; } - + if (temp > 1 || oldEntry != curEntry) lastEntry = pathfinderUnk2(lastEntry, oldX, oldY); - + ++moveTableCur; } - + lastEntry = pathfinderUnk2(lastEntry, newX, newY); _pathfinderUnkTable1[lastEntry*2+0] = -1; _pathfinderUnkTable1[lastEntry*2+1] = -1; @@ -855,7 +855,7 @@ int KyraEngine_v2::pathfinderUnk3(int tableLen, int x, int y) { y1 = _pathfinderUnkTable1[index1*2+1] + y; x2 = _pathfinderUnkTable1[index2*2+0] + x; y2 = _pathfinderUnkTable1[index2*2+0] + x; - + if (directLinePassable(x1, y1, x2, y2)) { lastEntry = pathfinderUnk4(lastEntry, index2); if (tableLen-1 == index2) @@ -892,7 +892,7 @@ void KyraEngine_v2::pathfinderUnk5(int *moveTable, int tableLen, int x, int y, i y1 = _pathfinderUnkTable1[index1*2+1] + y; x2 = _pathfinderUnkTable1[index2*2+0] + x; y2 = _pathfinderUnkTable1[index2*2+0] + x; - + int wayLen = findWay(x1, y1, x2, y2, moveTable, sizeLeft); moveTable += wayLen; sizeLeft -= wayLen; // unlike the original we want to be sure that the size left is correct diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp index c5cd09756f..546ab6f6a5 100644 --- a/engines/kyra/screen.cpp +++ b/engines/kyra/screen.cpp @@ -589,7 +589,7 @@ void Screen::copyRegionToBuffer(int pageNum, int x, int y, int w, int h, uint8 * if (x < 0) { dest += -x; - w += x; + w += x; x = 0; } else if (x + w > SCREEN_W) { w = SCREEN_W - x; @@ -627,7 +627,7 @@ void Screen::copyBlockToPage(int pageNum, int x, int y, int w, int h, const uint if (x < 0) { src += -x; - w += x; + w += x; x = 0; } else if (x + w > SCREEN_W) { w = SCREEN_W - x; diff --git a/engines/kyra/screen.h b/engines/kyra/screen.h index 3808087a4b..0c9bc98b1c 100644 --- a/engines/kyra/screen.h +++ b/engines/kyra/screen.h @@ -85,7 +85,7 @@ public: DSF_WND_COORDS = 0x10, DSF_CENTER = 0x20 }; - + enum FontId { FID_6_FNT = 0, FID_8_FNT, @@ -95,7 +95,7 @@ public: FID_GOLDFONT_FNT, FID_NUM }; - + Screen(KyraEngine *vm, OSystem *system); virtual ~Screen(); @@ -181,7 +181,7 @@ public: // mouse handling void hideMouse(); void showMouse(); - void setMouseCursor(int x, int y, byte *shape); + void setMouseCursor(int x, int y, byte *shape); // rect handling virtual int getRectSize(int w, int h); @@ -191,7 +191,7 @@ public: void addBitBlitRect(int x, int y, int w, int h); void bitBlitRects(); - // misc + // misc void loadBitmap(const char *filename, int tempPage, int dstPage, uint8 *palData); void loadPalette(const char *filename, uint8 *palData); @@ -200,10 +200,10 @@ public: void setAnimBlockPtr(int size); void setShapePages(int page1, int page2); - + byte getShapeFlag1(int x, int y); byte getShapeFlag2(int x, int y); - + void savePageToDisk(const char *file, int page); void loadPageFromDisk(const char *file, int page); void deletePageFromDisk(int page); @@ -227,7 +227,7 @@ public: bool _disableScreen; const ScreenDim *_curDim; - + static const ScreenDim _screenDimTable[]; static const int _screenDimTableCount; @@ -298,19 +298,19 @@ protected: int _animBlockSize; int _mouseLockCount; - + Rect *_bitBlitRects; int _bitBlitNum; uint8 *_unkPtr1, *_unkPtr2; - + enum { kMaxDirtyRects = 50 }; - + bool _forceFullUpdate; int _numDirtyRects; Rect *_dirtyRects; - + void addDirtyRect(int x, int y, int w, int h); OSystem *_system; diff --git a/engines/kyra/screen_v1.h b/engines/kyra/screen_v1.h index f6133db49d..5354e870fa 100644 --- a/engines/kyra/screen_v1.h +++ b/engines/kyra/screen_v1.h @@ -22,10 +22,10 @@ * $Id$ * */ - + #ifndef KYRA_SCREEN_V1_H #define KYRA_SCREEN_V1_H - + #include "kyra/screen.h" namespace Kyra { @@ -36,9 +36,9 @@ class Screen_v1 : public Screen { public: Screen_v1(KyraEngine_v1 *vm, OSystem *system); virtual ~Screen_v1(); - + void fadeSpecialPalette(int palIndex, int startIndex, int size, int fadeTime); - + protected: KyraEngine_v1 *_vm; }; diff --git a/engines/kyra/screen_v2.cpp b/engines/kyra/screen_v2.cpp index 6060ac0498..a3a415c1d7 100644 --- a/engines/kyra/screen_v2.cpp +++ b/engines/kyra/screen_v2.cpp @@ -125,7 +125,7 @@ void Screen_v2::wsaFrameAnimationStep(int x1, int y1, int x2, int y2, cdm.w <<= 3; int na = 0, nb = 0, nc = w2; - + if (!calcBounds(cdm.w, cdm.h, x2, y2, w2, h2, na, nb, nc)) return; @@ -140,7 +140,7 @@ void Screen_v2::wsaFrameAnimationStep(int x1, int y1, int x2, int y2, u = t; uint8 * s = src + (x1 + t) * 320; uint8 * dt = (uint8*) _wsaFrameAnimBuffer; - + t = w2 - w1; if (!t) { memcpy(dt, s, w2); @@ -158,7 +158,7 @@ void Screen_v2::wsaFrameAnimationStep(int x1, int y1, int x2, int y2, cnt++; } memset(dt, *s++, cnt); - dt += cnt; + dt += cnt; } } } else { @@ -181,7 +181,7 @@ void Screen_v2::wsaFrameAnimationStep(int x1, int y1, int x2, int y2, } memcpy(dst + x2 + cdm.sx, _wsaFrameAnimBuffer + na, w2); dst += 320; - } while (++nb < h2); + } while (++nb < h2); } void Screen_v2::cmpFadeFrameStep(int srcPage, int srcW, int srcH, int srcX, int srcY, int dstPage, int dstW, @@ -212,7 +212,7 @@ void Screen_v2::cmpFadeFrameStep(int srcPage, int srcW, int srcH, int srcX, int uint8 * dst = getPagePtr(dstPage) + dstW * (Y2 + r2); uint8 * cmp = getPagePtr(cmpPage); - while (H2--) { + while (H2--) { uint8 * s = src + r4 + X1; uint8 * d = dst + r1 + X2; @@ -230,7 +230,7 @@ bool Screen_v2::calcBounds(int w0, int h0, int &x1, int &y1, int &w1, int &h1, i x2 = 0; y2 = 0; w2 = w1; - + int t = x1 + w1; if (t < 1) { w1 = h1 = -1; diff --git a/engines/kyra/screen_v2.h b/engines/kyra/screen_v2.h index 654ee6f99f..6931f5e4d4 100644 --- a/engines/kyra/screen_v2.h +++ b/engines/kyra/screen_v2.h @@ -22,7 +22,7 @@ * $Id$ * */ - + #ifndef KYRA_SCREEN_V2_H #define KYRA_SCREEN_V2_H @@ -37,10 +37,10 @@ friend class Debugger_v2; public: Screen_v2(KyraEngine_v2 *vm, OSystem *system); virtual ~Screen_v2(); - + virtual void setScreenDim(int dim); const ScreenDim *getScreenDim(int dim); - + // sequence player void generateGrayOverlay(const uint8 *srcPal, uint8 *grayOverlay, int factor, int addR, int addG, int addB, int lastColor, bool flag); void applyGrayOverlay(int x, int y, int w, int h, int pageNum, const uint8 *grayOverlay); @@ -50,30 +50,30 @@ public: int w1, int h1, int w2, int h2, int srcPage, int dstPage, int dim); void cmpFadeFrameStep(int srcPage, int srcW, int srcH, int srcX, int srcY, int dstPage, int dstW, int dstH, int dstX, int dstY, int cmpW, int cmpH, int cmpPage); - + // screen page handling void copyWsaRect(int x, int y, int w, int h, int dimState, int plotFunc, const uint8 *src, int unk1, const uint8 *unkPtr1, const uint8 *unkPtr2); - + // shape handling uint8 *getPtrToShape(uint8 *shpFile, int shape); const uint8 *getPtrToShape(const uint8 *shpFile, int shape); - + int getShapeScaledWidth(const uint8 *shpFile, int scale); int getShapeScaledHeight(const uint8 *shpFile, int scale); uint16 getShapeSize(const uint8 *shp); - + uint8 *makeShapeCopy(const uint8 *src, int index); - + void drawShape(uint8 pageNum, const uint8 *shapeData, int x, int y, int sd, int flags, ...); - + // rect handling virtual int getRectSize(int w, int h); - + // layer handling int getLayer(int x, int y); - + // mouse handling bool isMouseVisible() const; @@ -81,12 +81,12 @@ public: void setTextColorMap(const uint8 *cmap); private: KyraEngine_v2 *_vm; - + static const ScreenDim _screenDimTable[]; static const int _screenDimTableCount; uint8 *_wsaFrameAnimBuffer; - + // maybe subclass screen for kyra3 static const ScreenDim _screenDimTableK3[]; static const int _screenDimTableCountK3; diff --git a/engines/kyra/script.h b/engines/kyra/script.h index 244547b372..ce59d8ee29 100644 --- a/engines/kyra/script.h +++ b/engines/kyra/script.h @@ -64,12 +64,12 @@ struct ScriptState { class ScriptFileParser { public: ScriptFileParser() : _scriptFile(), _startOffset(0), _endOffset(0) {} - ScriptFileParser(const char *filename, Resource *res) : _scriptFile(), _startOffset(0), _endOffset(0) { setFile(filename, res); } + ScriptFileParser(const char *filename, Resource *res) : _scriptFile(), _startOffset(0), _endOffset(0) { setFile(filename, res); } ~ScriptFileParser() { destroy(); } - + // 'script' must be allocated with new! void setFile(const char *filename, Resource *res); - + operator bool() const { return (_startOffset != _endOffset) && _scriptFile.isOpen(); } uint32 getFORMBlockSize(); @@ -86,15 +86,15 @@ private: class ScriptHelper { public: ScriptHelper(KyraEngine *vm); - + bool loadScript(const char *filename, ScriptData *data, const Common::Array *opcodes); void unloadScript(ScriptData *data); - + void initScript(ScriptState *scriptState, const ScriptData *data); bool startScript(ScriptState *script, int function); - + bool validScript(ScriptState *script); - + bool runScript(ScriptState *script); protected: KyraEngine *_vm; @@ -106,7 +106,7 @@ protected: CommandProc proc; const char *desc; }; - + const CommandEntry *_commands; private: void cmd_jmpTo(ScriptState*); diff --git a/engines/kyra/script_v2.cpp b/engines/kyra/script_v2.cpp index 190177fcb1..9f3de9484a 100644 --- a/engines/kyra/script_v2.cpp +++ b/engines/kyra/script_v2.cpp @@ -110,7 +110,7 @@ int KyraEngine_v2::o2_setCharacterAnimFrame(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o2_setCharacterAnimFrame(%p) (-, %d, %d)", (const void *)script, stackPos(1), stackPos(2)); int animFrame = stackPos(1); int updateAnim = stackPos(2); - + _mainCharacter.animFrame = animFrame; if (updateAnim) updateCharacterAnim(0); @@ -162,7 +162,7 @@ int KyraEngine_v2::o2_displayWsaFrame(ScriptState *script) { int doUpdate = stackPos(6); int dstPage = stackPos(7); int backUp = stackPos(8); - + _screen->hideMouse(); uint32 endTime = _system->getMillis() + waitTime * _tickLength; _wsaSlots[slot]->setX(x); @@ -170,18 +170,18 @@ int KyraEngine_v2::o2_displayWsaFrame(ScriptState *script) { _wsaSlots[slot]->setDrawPage(dstPage); _wsaSlots[slot]->displayFrame(frame, copyParam | 0xC000); _screen->updateScreen(); - + if (backUp) memcpy(_gamePlayBuffer, _screen->getCPagePtr(3), 46080); while (_system->getMillis() < endTime) { if (doUpdate) update(); - + if (endTime - _system->getMillis() >= 10) delay(10); } - _screen->showMouse(); + _screen->showMouse(); return 0; } @@ -196,14 +196,14 @@ int KyraEngine_v2::o2_displayWsaSequentialFrames(ScriptState *script) { int slot = stackPos(5); int maxTimes = stackPos(6); int copyFlags = stackPos(7); - + if (maxTimes > 1) maxTimes = 1; - + _wsaSlots[slot]->setX(x); _wsaSlots[slot]->setY(y); _wsaSlots[slot]->setDrawPage(0); - + _screen->hideMouse(); int curTime = 0; while (curTime < maxTimes) { @@ -212,7 +212,7 @@ int KyraEngine_v2::o2_displayWsaSequentialFrames(ScriptState *script) { uint32 endTime = _system->getMillis() + waitTime * _tickLength; _wsaSlots[slot]->displayFrame(i, 0xC000 | copyFlags); _screen->updateScreen(); - + do { update(); @@ -257,7 +257,7 @@ int KyraEngine_v2::o2_defineItem(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o2_defineItem(%p) (%d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3)); int freeItem = findFreeItem(); - + if (freeItem >= 0) { _itemList[freeItem].id = stackPos(0); _itemList[freeItem].x = stackPos(1); @@ -280,7 +280,7 @@ int KyraEngine_v2::o2_countItemInInventory(ScriptState *script) { if (_itemInHand == int16(item)) ++count; - + return count; } @@ -386,9 +386,9 @@ int KyraEngine_v2::o2_drawSceneShape(ScriptState *script) { _screen->hideMouse(); restorePage3(); - + _screen->drawShape(2, _sceneShapeTable[shape], x, y, 2, flag); - + memcpy(_gamePlayBuffer, _screen->getCPagePtr(3), 46080); _screen->drawShape(0, _sceneShapeTable[shape], x, y, 2, flag); @@ -442,7 +442,7 @@ int KyraEngine_v2::o2_update(ScriptState *script) { update(); } - return 0; + return 0; } int KyraEngine_v2::o2_fadeScenePal(ScriptState *script) { @@ -461,7 +461,7 @@ int KyraEngine_v2::o2_enterNewSceneEx(ScriptState *script) { runSceneScript4(0); _unk5 = 1; - + if (_mainCharX == -1 || _mainCharY == -1) { _mainCharacter.animFrame = _characterFrameTable[_mainCharacter.facing]; updateCharacterAnim(0); @@ -545,22 +545,22 @@ int KyraEngine_v2::o2_defineRoomEntrance(ScriptState *script) { _sceneEnterX1 = stackPos(1); _sceneEnterY1 = stackPos(2); break; - + case 1: _sceneEnterX2 = stackPos(1); _sceneEnterY2 = stackPos(2); break; - + case 2: _sceneEnterX3 = stackPos(1); _sceneEnterY3 = stackPos(2); break; - + case 3: _sceneEnterX4 = stackPos(1); _sceneEnterY4 = stackPos(2); break; - + default: break; } @@ -601,17 +601,17 @@ int KyraEngine_v2::o2_defineSceneAnim(ScriptState *script) { anim.shapeIndex = stackPos(11); if (stackPosString(12) != 0) strcpy(anim.filename, stackPosString(12)); - + if (anim.flags & 0x40) { if (!_sceneAnimMovie[animId]->open(anim.filename, 1, 0)) error("couldn't load '%s'", anim.filename); - + if (_sceneAnimMovie[animId]->xAdd() || _sceneAnimMovie[animId]->yAdd()) anim.wsaFlag = 1; else anim.wsaFlag = 0; } - + return 0; } @@ -633,7 +633,7 @@ int KyraEngine_v2::o2_defineRoom(ScriptState *script) { scene->exit4 = stackPos(5); scene->flags = stackPos(6); scene->sound = stackPos(7); - + if (_mainCharacter.sceneId == stackPos(0)) { _sceneExit1 = scene->exit1; _sceneExit2 = scene->exit2; @@ -661,7 +661,7 @@ int KyraEngine_v2::o2_countItemInstances(ScriptState *script) { if (_itemList[i].id == item) ++count; } - + if (_hiddenItems[0] == item && _newChapterFile == 1) ++count; if (_hiddenItems[1] == item && _newChapterFile == 1) diff --git a/engines/kyra/seqplayer.h b/engines/kyra/seqplayer.h index 4636a956e9..ce7f4648df 100644 --- a/engines/kyra/seqplayer.h +++ b/engines/kyra/seqplayer.h @@ -43,7 +43,7 @@ public: void freeHandShapes(); bool playSequence(const uint8 *seqData, bool skipSeq); - + uint8 *setPanPages(int pageNum, int shape); protected: KyraEngine_v1 *_vm; diff --git a/engines/kyra/sequences_v1.cpp b/engines/kyra/sequences_v1.cpp index 6b4516bbd8..785b0b3aed 100644 --- a/engines/kyra/sequences_v1.cpp +++ b/engines/kyra/sequences_v1.cpp @@ -59,7 +59,7 @@ void KyraEngine_v1::seq_demo() { _screen->copyRegion(0, 0, 0, 111, 320, 64, 6, 0); _screen->updateScreen(); _screen->fadeFromBlack(); - + _seq->playSequence(_seq_WestwoodLogo, true); delay(60 * _tickLength); _seq->playSequence(_seq_KyrandiaLogo, true); @@ -95,7 +95,7 @@ void KyraEngine_v1::seq_intro() { if (_flags.isTalkie) _res->loadPakFile("INTRO.VRM"); - + static const IntroProc introProcTable[] = { &KyraEngine_v1::seq_introLogos, &KyraEngine_v1::seq_introStory, @@ -145,7 +145,7 @@ void KyraEngine_v1::seq_introLogos() { } _screen->clearPage(0); - + if (_flags.platform == Common::kPlatformAmiga) { _screen->loadPalette("INTRO.PAL", _screen->_currentPalette); _screen->loadBitmap("BOTTOM.CPS", 3, 5, 0); @@ -163,7 +163,7 @@ void KyraEngine_v1::seq_introLogos() { _screen->_curPage = 0; _screen->updateScreen(); _screen->fadeFromBlack(); - + if (_seq->playSequence(_seq_WestwoodLogo, _skipFlag) || _quitFlag) { _screen->fadeToBlack(); _screen->clearPage(0); @@ -266,7 +266,7 @@ void KyraEngine_v1::seq_introStory() { const int x2 = (Screen::SCREEN_W - _screen->getTextWidth(_seq_textsTable[19])) / 2; const int y1 = 175; const int y2 = 184; - + uint8 colorMap[] = { 0, 15, 12, 12 }; _screen->setTextColor(colorMap, 0, 3); @@ -327,26 +327,26 @@ void KyraEngine_v1::seq_createAmuletJewel(int jewel, int page, int noSound, int _screen->updateScreen(); delayWithTicks(3); } - + const uint16 *opcodes = 0; switch (jewel - 1) { case 0: opcodes = specialJewelTable1; break; - + case 1: opcodes = specialJewelTable2; break; - + case 2: opcodes = specialJewelTable3; break; - + case 3: opcodes = specialJewelTable4; break; } - + if (opcodes) { for (int i = 0; opcodes[i] != 0xFFFF; ++i) { _screen->drawShape(page, _shapes[opcodes[i]], _amuletX2[jewel], _amuletY2[jewel], 0, 0); @@ -444,31 +444,31 @@ void KyraEngine_v1::seq_poisonDeathNowAnim() { assert(_posionDeathShapeTable); setupShapes123(_posionDeathShapeTable, 20, 0); _animator->setBrandonAnimSeqSize(8, 48); - + _currentCharacter->currentAnimFrame = 124; _animator->animRefreshNPC(0); delayWithTicks(30); - + _currentCharacter->currentAnimFrame = 123; _animator->animRefreshNPC(0); delayWithTicks(30); - + for (int i = 125; i <= 139; ++i) { _currentCharacter->currentAnimFrame = i; _animator->animRefreshNPC(0); delayWithTicks(8); } - + delayWithTicks(60); - + for (int i = 140; i <= 142; ++i) { _currentCharacter->currentAnimFrame = i; _animator->animRefreshNPC(0); delayWithTicks(8); } - + delayWithTicks(60); - + _animator->resetBrandonAnimSeqSize(); freeShapes123(); _animator->restoreAllObjectBackgrounds(); @@ -489,7 +489,7 @@ void KyraEngine_v1::seq_playFluteAnimation() { _animator->animRefreshNPC(0); delayWithTicks(2); } - + int delayTime = 0, soundType = 0; if (queryGameFlag(0x85)) { snd_playSoundEffect(0x63); @@ -505,13 +505,13 @@ void KyraEngine_v1::seq_playFluteAnimation() { delayTime = 2; soundType = 2; } - + for (int i = 131; i <= 158; ++i) { _currentCharacter->currentAnimFrame = i; _animator->animRefreshNPC(0); delayWithTicks(delayTime); } - + for (int i = 126; i >= 123; --i) { _currentCharacter->currentAnimFrame = i; _animator->animRefreshNPC(0); @@ -522,7 +522,7 @@ void KyraEngine_v1::seq_playFluteAnimation() { _animator->animRefreshNPC(0); freeShapes123(); _screen->showMouse(); - + if (soundType == 1) { assert(_fluteString); characterSays(1000, _fluteString[0], 0, -2); @@ -541,13 +541,13 @@ void KyraEngine_v1::seq_winterScroll1() { assert(_winterScroll2Table); setupShapes123(_winterScrollTable, 7, 0); _animator->setBrandonAnimSeqSize(5, 66); - + for (int i = 123; i <= 129; ++i) { _currentCharacter->currentAnimFrame = i; _animator->animRefreshNPC(0); delayWithTicks(8); } - + freeShapes123(); snd_playSoundEffect(0x20); @@ -565,7 +565,7 @@ void KyraEngine_v1::seq_winterScroll1() { _animator->animRefreshNPC(0); delayWithTicks(8); } - + if (_currentCharacter->sceneId == 41 && !queryGameFlag(0xA2)) { snd_playSoundEffect(0x20); _sprites->_anims[0].play = false; @@ -574,13 +574,13 @@ void KyraEngine_v1::seq_winterScroll1() { _animator->sprites()[1].active = 1; setGameFlag(0xA2); } - + for (int i = midpoint; i < 123 + numFrames; ++i) { _currentCharacter->currentAnimFrame = i; _animator->animRefreshNPC(0); delayWithTicks(8); } - + if (_currentCharacter->sceneId == 117 && !queryGameFlag(0xB3)) { for (int i = 0; i <= 7; ++i) { _sprites->_anims[i].play = false; @@ -596,16 +596,16 @@ void KyraEngine_v1::seq_winterScroll1() { } else { delayWithTicks(120); } - + freeShapes123(); setupShapes123(_winterScroll2Table, 4, 0); - + for (int i = 123; i <= 126; ++i) { _currentCharacter->currentAnimFrame = i; _animator->animRefreshNPC(0); delayWithTicks(8); } - + _animator->resetBrandonAnimSeqSize(); _currentCharacter->currentAnimFrame = 7; _animator->animRefreshNPC(0); @@ -614,27 +614,27 @@ void KyraEngine_v1::seq_winterScroll1() { } void KyraEngine_v1::seq_winterScroll2() { - debugC(9, kDebugLevelMain, "seq_winterScroll2()"); + debugC(9, kDebugLevelMain, "seq_winterScroll2()"); _screen->hideMouse(); checkAmuletAnimFlags(); assert(_winterScrollTable); setupShapes123(_winterScrollTable, 7, 0); _animator->setBrandonAnimSeqSize(5, 66); - + for (int i = 123; i <= 128; ++i) { _currentCharacter->currentAnimFrame = i; _animator->animRefreshNPC(0); delayWithTicks(8); } - + delayWithTicks(120); - + for (int i = 127; i >= 123; --i) { _currentCharacter->currentAnimFrame = i; _animator->animRefreshNPC(0); delayWithTicks(8); } - + _animator->resetBrandonAnimSeqSize(); _currentCharacter->currentAnimFrame = 7; _animator->animRefreshNPC(0); @@ -651,7 +651,7 @@ void KyraEngine_v1::seq_makeBrandonInv() { if (_beadStateVar == 4 || _beadStateVar == 6) return; } - + _screen->hideMouse(); checkAmuletAnimFlags(); _brandonStatusBit |= 0x20; @@ -714,11 +714,11 @@ void KyraEngine_v1::seq_makeBrandonWisp() { debugC(9, kDebugLevelMain, "seq_makeBrandonWisp()"); if (_deathHandler == 8) return; - + if (_currentCharacter->sceneId == 210) { if (_beadStateVar == 4 || _beadStateVar == 6) return; - } + } _screen->hideMouse(); checkAmuletAnimFlags(); assert(_brandonToWispTable); @@ -779,9 +779,9 @@ void KyraEngine_v1::seq_dispelMagicAnimation() { _animator->animRefreshNPC(0); delayWithTicks(8); } - + delayWithTicks(120); - + for (int i = 127; i >= 123; --i) { _currentCharacter->currentAnimFrame = i; _animator->animRefreshNPC(0); @@ -799,7 +799,7 @@ void KyraEngine_v1::seq_fillFlaskWithWater(int item, int type) { int newItem = -1; static const uint8 flaskTable1[] = { 0x46, 0x48, 0x4A, 0x4C }; static const uint8 flaskTable2[] = { 0x47, 0x49, 0x4B, 0x4D }; - + if (item >= 60 && item <= 77) { assert(_flaskFull); characterSays(8006, _flaskFull[0], 0, -2); @@ -810,10 +810,10 @@ void KyraEngine_v1::seq_fillFlaskWithWater(int item, int type) { assert(type >= 0 && type < ARRAYSIZE(flaskTable2)); newItem = flaskTable2[type]; } - + if (newItem == -1) return; - + _screen->hideMouse(); setMouseItem(newItem); _screen->showMouse(); @@ -830,7 +830,7 @@ void KyraEngine_v1::seq_fillFlaskWithWater(int item, int type) { void KyraEngine_v1::seq_playDrinkPotionAnim(int item, int unk2, int flags) { debugC(9, kDebugLevelMain, "KyraEngine_v1::seq_playDrinkPotionAnim(%d, %d, %d)", item, unk2, flags); uint8 red, green, blue; - + switch (item) { case 60: case 61: @@ -875,9 +875,9 @@ void KyraEngine_v1::seq_playDrinkPotionAnim(int item, int unk2, int flags) { red = (uint8)((double)red * 0.63); green = (uint8)((double)green * 0.63); blue = (uint8)((double)blue * 0.63); - + _screen->setPaletteIndex(0xFE, red, green, blue); - + _screen->hideMouse(); checkAmuletAnimFlags(); _currentCharacter->facing = 5; @@ -885,12 +885,12 @@ void KyraEngine_v1::seq_playDrinkPotionAnim(int item, int unk2, int flags) { assert(_drinkAnimationTable); setupShapes123(_drinkAnimationTable, 9, flags); _animator->setBrandonAnimSeqSize(5, 54); - + for (int i = 123; i <= 131; ++i) { _currentCharacter->currentAnimFrame = i; _animator->animRefreshNPC(0); delayWithTicks(5); - } + } snd_playSoundEffect(0x34); for (int i = 0; i < 2; ++i) { _currentCharacter->currentAnimFrame = 130; @@ -900,18 +900,18 @@ void KyraEngine_v1::seq_playDrinkPotionAnim(int item, int unk2, int flags) { _animator->animRefreshNPC(0); delayWithTicks(7); } - + if (unk2) { // XXX } - + for (int i = 131; i >= 123; --i) { _currentCharacter->currentAnimFrame = i; _animator->animRefreshNPC(0); delayWithTicks(5); } - - _animator->resetBrandonAnimSeqSize(); + + _animator->resetBrandonAnimSeqSize(); _currentCharacter->currentAnimFrame = 7; _animator->animRefreshNPC(0); freeShapes123(); @@ -947,7 +947,7 @@ int KyraEngine_v1::seq_playEnd() { _unkEndSeqVar2 = _system->getMillis() + 600 * _tickLength; _screen->copyRegion(312, 0, 312, 0, 8, 136, 0, 2); } - + // TODO: better handling. This timer shouldn't count when the menu is open or something. if (_unkEndSeqVar2 != -1) { if (_system->getMillis() > (uint32)_unkEndSeqVar2) { @@ -956,7 +956,7 @@ int KyraEngine_v1::seq_playEnd() { _malcolmFlag = 1; } } - + if (handleMalcolmFlag()) { _beadStateVar = 0; _malcolmFlag = 12; @@ -1057,7 +1057,7 @@ void KyraEngine_v1::seq_playCredits() { static const uint8 colorMap[] = { 0, 0, 0xC, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; static const char stringTerms[] = { 0x5, 0xd, 0x0}; static const int numStrings = 250; - + struct { int16 x, y; uint8 code; @@ -1065,18 +1065,18 @@ void KyraEngine_v1::seq_playCredits() { Screen::FontId font; uint8 *str; } strings[numStrings]; - + memset(strings, 0, sizeof(strings)); - + _screen->hideMouse(); if (!_flags.isTalkie) { _screen->loadFont(Screen::FID_CRED6_FNT, "CREDIT6.FNT"); _screen->loadFont(Screen::FID_CRED8_FNT, "CREDIT8.FNT"); } else _screen->setFont(Screen::FID_8_FNT); - + _screen->loadBitmap("CHALET.CPS", 4, 4, _screen->_currentPalette); - + _screen->setCurPage(0); _screen->clearCurPage(); _screen->setTextColorMap(colorMap); @@ -1088,7 +1088,7 @@ void KyraEngine_v1::seq_playCredits() { uint8 *buffer = 0; uint32 size = 0; - + if (_flags.platform == Common::kPlatformFMTowns || _flags.platform == Common::kPlatformPC98) { int sizeTmp = 0; const uint8 *bufferTmp = _staticres->loadRawData(kCreditsStrings, sizeTmp); @@ -1105,26 +1105,26 @@ void KyraEngine_v1::seq_playCredits() { uint8 *nextString = buffer; uint8 *currentString = buffer; int currentY = 200; - + for (int i = 0; i < numStrings; i++) { if (*nextString == 0) break; - + currentString = nextString; nextString = (uint8 *)strpbrk((const char *)currentString, stringTerms); if (!nextString) nextString = (uint8 *)strchr((const char *)currentString, 0); - + strings[i].code = nextString[0]; *nextString = 0; if (strings[i].code != 0) nextString++; - + if (*currentString == 3 || *currentString == 4) { strings[i].unk1 = *currentString; currentString++; } - + if (*currentString == 1) { currentString++; if (!_flags.isTalkie) @@ -1137,28 +1137,28 @@ void KyraEngine_v1::seq_playCredits() { } strings[i].font = _screen->_currentFont; - if (strings[i].unk1 == 3) + if (strings[i].unk1 == 3) strings[i].x = 157 - _screen->getTextWidth((const char *)currentString); else if (strings[i].unk1 == 4) strings[i].x = 161; else strings[i].x = (320 - _screen->getTextWidth((const char *)currentString)) / 2 + 1; - + strings[i].y = currentY; if (strings[i].code != 5) currentY += 10; - + strings[i].str = currentString; } _screen->setCurPage(2); - + memset(_screen->getPalette(2), 0, sizeof(uint8)*768); _screen->setScreenPalette(_screen->getPalette(2)); _screen->copyRegion(8, 32, 8, 32, 312, 128, 4, 0, Screen::CR_NO_P_CHECK); _screen->fadePalette(_screen->_currentPalette, 0x5A); - Common::Event event; + Common::Event event; bool finished = false; int bottom = 201; while (!finished) { @@ -1166,7 +1166,7 @@ void KyraEngine_v1::seq_playCredits() { if (bottom > 175) { _screen->copyRegion(8, 32, 8, 32, 312, 128, 4, 2, Screen::CR_NO_P_CHECK); bottom = 0; - + for (int i = 0; i < numStrings; i++) { if (strings[i].y < 200 && strings[i].y > 0) { if (strings[i].font != _screen->_currentFont) @@ -1203,7 +1203,7 @@ void KyraEngine_v1::seq_playCredits() { } delete [] buffer; - + _screen->fadeToBlack(); _screen->clearCurPage(); _screen->showMouse(); @@ -1219,7 +1219,7 @@ int KyraEngine_v1::handleMalcolmFlag() { static uint16 frame = 0; static uint32 timer1 = 0; static uint32 timer2 = 0; - + switch (_malcolmFlag) { case 1: frame = 0; @@ -1243,7 +1243,7 @@ int KyraEngine_v1::handleMalcolmFlag() { } } break; - + case 3: if (_system->getMillis() < timer1) { if (_system->getMillis() >= timer2) { @@ -1260,7 +1260,7 @@ int KyraEngine_v1::handleMalcolmFlag() { frame = 18; } break; - + case 4: if (_system->getMillis() >= timer2) { _finalA->setX(8); @@ -1277,7 +1277,7 @@ int KyraEngine_v1::handleMalcolmFlag() { } } break; - + case 5: if (_system->getMillis() >= timer2) { _finalA->setX(8); @@ -1293,7 +1293,7 @@ int KyraEngine_v1::handleMalcolmFlag() { } } break; - + case 6: if (_unkEndSeqVar4) { if (frame <= 33 && _system->getMillis() >= timer2) { @@ -1312,7 +1312,7 @@ int KyraEngine_v1::handleMalcolmFlag() { } } break; - + case 7: if (_unkEndSeqVar5 == 1) { _malcolmFlag = 8; @@ -1339,7 +1339,7 @@ int KyraEngine_v1::handleMalcolmFlag() { } } break; - + case 9: snd_playSoundEffect(12); snd_playSoundEffect(12); @@ -1356,7 +1356,7 @@ int KyraEngine_v1::handleMalcolmFlag() { delay(60 * _tickLength); _malcolmFlag = 0; return 1; - + case 10: if (!_beadStateVar) { handleBeadState(); @@ -1367,7 +1367,7 @@ int KyraEngine_v1::handleMalcolmFlag() { _malcolmFlag = 11; } break; - + case 11: if (_system->getMillis() >= timer2) { _text->restoreTalkTextMessageBkgd(2, 0); @@ -1375,11 +1375,11 @@ int KyraEngine_v1::handleMalcolmFlag() { timer1 = _system->getMillis() + 180 * _tickLength; } break; - + default: break; } - + return 0; } @@ -1389,7 +1389,7 @@ int KyraEngine_v1::handleBeadState() { static uint32 timer2 = 0; static BeadState beadState1 = { -1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; static BeadState beadState2 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - + static const int table1[] = { -1, -2, -4, -5, -6, -7, -6, -5, -4, -2, -1, 0, 1, 2, 4, 5, @@ -1403,21 +1403,21 @@ int KyraEngine_v1::handleBeadState() { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - + switch (_beadStateVar) { case 0: if (beadState1.x != -1 && _endSequenceBackUpRect) { _screen->copyFromCurPageBlock(beadState1.x >> 3, beadState1.y, beadState1.width, beadState1.height, _endSequenceBackUpRect); _screen->addBitBlitRect(beadState1.x, beadState1.y, beadState1.width2, beadState1.height); } - + beadState1.x = -1; beadState1.tableIndex = 0; timer1 = 0; timer2 = 0; _lastDisplayedPanPage = 0; return 1; - + case 1: if (beadState1.x != -1) { if (_endSequenceBackUpRect) { @@ -1429,7 +1429,7 @@ int KyraEngine_v1::handleBeadState() { } _beadStateVar = 2; break; - + case 2: if (_system->getMillis() >= timer1) { int x = 0, y = 0; @@ -1472,7 +1472,7 @@ int KyraEngine_v1::handleBeadState() { _screen->addBitBlitRect(x, y, beadState1.width2, beadState1.height); } break; - + case 3: if (_system->getMillis() >= timer1) { timer1 = _system->getMillis() + 4 * _tickLength; @@ -1505,7 +1505,7 @@ int KyraEngine_v1::handleBeadState() { beadState1.unk8 = _currentCharacter->x1 - 4; beadState1.unk9 = _currentCharacter->y1 - 30; } - + if (_text->printed()) _text->restoreTalkTextMessageBkgd(2, 0); @@ -1514,7 +1514,7 @@ int KyraEngine_v1::handleBeadState() { } } break; - + case 4: if (_system->getMillis() >= timer1) { int x = 0, y = 0; @@ -1543,7 +1543,7 @@ int KyraEngine_v1::handleBeadState() { } } break; - + case 5: if (_system->getMillis() >= timer1) { timer1 = _system->getMillis() + _tickLength; @@ -1590,13 +1590,13 @@ int KyraEngine_v1::handleBeadState() { } } break; - + case 6: _screen->drawShape(2, _panPagesTable[19], beadState1.x, beadState1.y, 0, 0); _screen->addBitBlitRect(beadState1.x, beadState1.y, beadState1.width2, beadState1.height); _beadStateVar = 0; break; - + default: break; } @@ -1615,18 +1615,18 @@ void KyraEngine_v1::initBeadState(int x, int y, int x2, int y2, int unk, BeadSta unk1 = 0; else unk1 = -1; - - + + if (yDiff > 0) unk2 = 1; else if (yDiff == 0) unk2 = 0; else unk2 = -1; - + xDiff = ABS(xDiff); yDiff = ABS(yDiff); - + ptr->y = 0; ptr->x = 0; ptr->width = xDiff; @@ -1641,7 +1641,7 @@ int KyraEngine_v1::processBead(int x, int y, int &x2, int &y2, BeadState *ptr) { debugC(9, kDebugLevelMain, "KyraEngine_v1::processBead(%d, %d, %p, %p, %p)", x, y, (const void *)&x2, (const void *)&y2, (const void *)ptr); if (x == ptr->dstX && y == ptr->dstY) return 1; - + int xPos = x, yPos = y; if (ptr->width >= ptr->height) { for (int i = 0; i < ptr->unk9; ++i) { @@ -1662,7 +1662,7 @@ int KyraEngine_v1::processBead(int x, int y, int &x2, int &y2, BeadState *ptr) { yPos += ptr->unk8; } } - + int temp = ABS(x - ptr->dstX); if (ptr->unk9 > temp) xPos = ptr->dstX; @@ -1685,7 +1685,7 @@ void KyraEngine_v1::setupPanPages() { delete [] _panPagesTable[19]; _panPagesTable[19] = _screen->encodeShape(0, 0, 16, 9, 0); assert(_panPagesTable[19]); - + int curX = 16; for (int i = 0; i < 19; ++i) { delete [] _panPagesTable[i]; @@ -1734,10 +1734,10 @@ void KyraEngine_v1::updateKyragemFading() { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - + if (_system->getMillis() < _kyragemFadingState.timerCount) return; - + _kyragemFadingState.timerCount = _system->getMillis() + 4 * _tickLength; int palPos = 684; for (int i = 0; i < 20; ++i) { @@ -1768,32 +1768,32 @@ void KyraEngine_v1::updateKyragemFading() { return; _kyragemFadingState.nextOperation = 3; break; - + case 3: ++_kyragemFadingState.bOffset; if (_kyragemFadingState.bOffset < 19) return; _kyragemFadingState.nextOperation = 4; break; - + case 4: --_kyragemFadingState.rOffset; if (_kyragemFadingState.rOffset >= 1) return; _kyragemFadingState.nextOperation = 5; break; - + case 5: ++_kyragemFadingState.gOffset; if (_kyragemFadingState.gOffset < 19) return; _kyragemFadingState.nextOperation = 0; break; - + default: break; } - + _kyragemFadingState.timerCount = _system->getMillis() + 120 * _tickLength; } @@ -1854,7 +1854,7 @@ void KyraEngine_v1::drawJewelsFadeOutEnd(int jewel) { else newDelay = 8100; break; - + default: newDelay = 3600; break; diff --git a/engines/kyra/sequences_v2.cpp b/engines/kyra/sequences_v2.cpp index 5b4a7ababd..0de8522736 100644 --- a/engines/kyra/sequences_v2.cpp +++ b/engines/kyra/sequences_v2.cpp @@ -750,7 +750,7 @@ int KyraEngine_v2::seq_introForest(WSAMovieV2 *wsaObj, int x, int y, int frm) { seq_waitForTextsTimeout(); } else if (frm == 12) { //if (_flags.lang == Common::FR_FRA) - //XXX + //XXX seq_playTalkText(2); } return frm; @@ -874,7 +874,7 @@ int KyraEngine_v2::seq_finaleFunters(WSAMovieV2 *wsaObj, int x, int y, int frm) chatFirstFrame = 0; chatLastFrame = 8; voiceIndex = 35; - } else { + } else { chatFirstFrame = 9; chatLastFrame = 15; } @@ -963,7 +963,7 @@ int KyraEngine_v2::seq_finaleFerb(WSAMovieV2 *wsaObj, int x, int y, int frm) { chatX = 60; if (_flags.isTalkie) - voiceIndex = 36; + voiceIndex = 36; seq_playWsaSyncDialogue(25, voiceIndex, 143, chatX, chatY, chatW, wsaObj, 16, 25, x, y); _seqFrameDelay = 16; @@ -1186,7 +1186,7 @@ int KyraEngine_v2::seq_finaleFarmer(WSAMovieV2 *wsaObj, int x, int y, int frm) { chatX = 90; chatY = 30; chatW = 100; - + if (_flags.isTalkie) { if (_flags.lang == Common::FR_FRA || _flags.lang == Common::DE_DEU) { chatX = 75; @@ -1363,7 +1363,7 @@ int KyraEngine_v2::seq_finaleFirates(WSAMovieV2 *wsaObj, int x, int y, int frm) if (_flags.isTalkie) voiceIndex = 43; - + seq_playWsaSyncDialogue(32, voiceIndex, 137, chatX, chatY, chatW, wsaObj, 14, 16, x, y); break; @@ -1376,7 +1376,7 @@ int KyraEngine_v2::seq_finaleFirates(WSAMovieV2 *wsaObj, int x, int y, int frm) break; case 31: - if (_flags.isTalkie) + if (_flags.isTalkie) voiceIndex = 44; chatX = 90; diff --git a/engines/kyra/sound.cpp b/engines/kyra/sound.cpp index 4a62671df3..c2ec98c904 100644 --- a/engines/kyra/sound.cpp +++ b/engines/kyra/sound.cpp @@ -468,7 +468,7 @@ void KyraEngine::snd_playWanderScoreViaMap(int command, int restart) { //if (!_disableSound) { // XXX //} - + if (_flags.platform == Common::kPlatformPC) { assert(command*2+1 < _trackMapSize); if (_curMusicTheme != _trackMap[command*2]) { @@ -494,7 +494,7 @@ void KyraEngine::snd_playWanderScoreViaMap(int command, int restart) { _sound->playTrack(command); } } - } + } _lastMusicCommand = command; } diff --git a/engines/kyra/sound_digital.cpp b/engines/kyra/sound_digital.cpp index 8b31cf4684..89ebe50d02 100644 --- a/engines/kyra/sound_digital.cpp +++ b/engines/kyra/sound_digital.cpp @@ -38,12 +38,12 @@ class AUDStream : public Audio::AudioStream { public: AUDStream(Common::File *file, bool loop = false); ~AUDStream(); - + int readBuffer(int16 *buffer, const int numSamples); bool isStereo() const { return false; } bool endOfData() const { return _endOfData; } - + int getRate() const { return _rate; } void beginFadeIn(); @@ -56,22 +56,22 @@ private: int _rate; uint _processedSize; uint _totalSize; - + int _bytesLeft; - + byte *_outBuffer; int _outBufferOffset; uint _outBufferSize; - + byte *_inBuffer; uint _inBufferSize; int32 _fadeSamples; int32 _fadeCount; int _fading; - + int readChunk(int16 *buffer, const int maxSamples); - + static const int8 WSTable2Bit[]; static const int8 WSTable4Bit[]; }; @@ -85,7 +85,7 @@ const int8 AUDStream::WSTable4Bit[] = { AUDStream::AUDStream(Common::File *file, bool loop) : _file(file), _endOfData(true), _rate(0), _processedSize(0), _totalSize(0), _bytesLeft(0), _outBuffer(0), _outBufferOffset(0), _outBufferSize(0), _inBuffer(0), _inBufferSize(0) { - + _rate = _file->readUint16LE(); _totalSize = _file->readUint32LE(); _loop = loop; @@ -101,7 +101,7 @@ AUDStream::AUDStream(Common::File *file, bool loop) : _file(file), _endOfData(tr int type = _file->readByte(); // type _loopStart = file->pos(); - + if (type == 1 && !flags) { _endOfData = false; } else @@ -128,7 +128,7 @@ void AUDStream::beginFadeOut() { int AUDStream::readBuffer(int16 *buffer, const int numSamples) { int samplesRead = 0, samplesLeft = numSamples; - + while (samplesLeft > 0 && !_endOfData) { int samples = readChunk(buffer, samplesLeft); samplesRead += samples; @@ -165,11 +165,11 @@ int AUDStream::readChunk(int16 *buffer, const int maxSamples) { uint16 size = _file->readUint16LE(); uint16 outSize = _file->readUint16LE(); uint32 id = _file->readUint32LE(); - + assert(id == 0x0000DEAF); - + _processedSize += 8 + size; - + _outBufferOffset = 0; if (size == outSize) { if (outSize > _outBufferSize) { @@ -180,37 +180,37 @@ int AUDStream::readChunk(int16 *buffer, const int maxSamples) { } _bytesLeft = size; - + _file->read(_outBuffer, _bytesLeft); } else { _bytesLeft = outSize; - + if (outSize > _outBufferSize) { _outBufferSize = outSize; delete [] _outBuffer; _outBuffer = new uint8[_outBufferSize]; assert(_outBuffer); } - + if (size > _inBufferSize) { _inBufferSize = size; delete [] _inBuffer; _inBuffer = new uint8[_inBufferSize]; assert(_inBuffer); } - + if (_file->read(_inBuffer, size) != size) { _endOfData = true; return 0; } - + int16 curSample = 0x80; byte code = 0; int8 count = 0; uint16 input = 0; int j = 0; int i = 0; - + while (outSize > 0) { input = _inBuffer[i++] << 2; code = (input >> 8) & 0xff; @@ -279,7 +279,7 @@ int AUDStream::readChunk(int16 *buffer, const int maxSamples) { } } } - + // copies the chunk data to the output buffer if (_bytesLeft > 0) { int samples = MIN(_bytesLeft, maxSamples); @@ -340,14 +340,14 @@ int SoundDigital::playSound(Common::File *fileHandle, bool loop, bool fadeIn, in break; } } - + if (!use) { warning("no free sound channel"); delete fileHandle; return -1; } } - + use->stream = new AUDStream(fileHandle, loop); if (use->stream->endOfData()) { delete use->stream; @@ -358,10 +358,10 @@ int SoundDigital::playSound(Common::File *fileHandle, bool loop, bool fadeIn, in if (fadeIn) use->stream->beginFadeIn(); - + // TODO: set correct sound type from channel id _mixer->playInputStream(Audio::Mixer::kPlainSoundType, &use->handle, use->stream); - + return use - _sounds; } diff --git a/engines/kyra/sound_v1.cpp b/engines/kyra/sound_v1.cpp index ff345cf598..6c6d086882 100644 --- a/engines/kyra/sound_v1.cpp +++ b/engines/kyra/sound_v1.cpp @@ -22,7 +22,7 @@ * $Id$ * */ - + #include "kyra/sound.h" #include "kyra/kyra_v1.h" diff --git a/engines/kyra/sprites.h b/engines/kyra/sprites.h index 255d878635..3304458fda 100644 --- a/engines/kyra/sprites.h +++ b/engines/kyra/sprites.h @@ -74,12 +74,12 @@ public: void setupSceneAnims(); void loadDat(const char *filename, SceneExits &exits); void loadSceneShapes(); - + Anim _anims[MAX_NUM_ANIMS]; uint8 *_sceneShapes[50]; void refreshSceneAnimObject(uint8 animNum, uint8 shapeNum, uint16 x, uint16 y, bool flipX, bool unkFlag); - + int getDrawLayer(int y); int _sceneAnimatorBeaconFlag; diff --git a/engines/kyra/staticres.cpp b/engines/kyra/staticres.cpp index ea73882d43..df5af4ab3e 100644 --- a/engines/kyra/staticres.cpp +++ b/engines/kyra/staticres.cpp @@ -233,14 +233,14 @@ bool StaticResource::init() { { k2SeqplayTlkFiles, kLanguageList, "S_TLKFILES." }, { k2SeqplaySeqData, kRawData, "S_DATA.SEQ" }, { k2SeqplayIntroTracks, kStringList, "S_INTRO.TRA" }, - { k2SeqplayFinaleTracks, kStringList, "S_FINALE.TRA" }, + { k2SeqplayFinaleTracks, kStringList, "S_FINALE.TRA" }, { k2SeqplayIntroCDA, kRawData, "S_INTRO.CDA" }, { k2SeqplayFinaleCDA, kRawData, "S_FINALE.CDA" }, // Ingame { k2IngamePakFiles, kStringList, "I_PAKFILES.TXT" }, { k2IngameSfxFiles, kStringList, "I_SFXFILES.TXT" }, - { k2IngameSfxIndex, kRawData, "I_SFXINDEX.TRA" }, + { k2IngameSfxIndex, kRawData, "I_SFXINDEX.TRA" }, { k2IngameTracks, kStringList, "I_TRACKS.TRA" }, { k2IngameCDA, kRawData, "I_TRACKS.CDA" }, @@ -947,7 +947,7 @@ void KyraEngine_v2::initStaticResource() { } tlkfiles = 0; _staticres->unloadId(k2SeqplayTlkFiles); - + // assign music data static const char *fmtMusicFileListIntro[] = { "intro" }; static const char *fmtMusicFileListFinale[] = { "finale" }; @@ -968,7 +968,7 @@ void KyraEngine_v2::initStaticResource() { // setup sequence data const uint8 *seqData = _staticres->loadRawData(k2SeqplaySeqData, tmp); - + static const Seqproc hofSequenceCallbacks[] = { 0, &KyraEngine_v2::seq_introWestwood, &KyraEngine_v2::seq_introTitle, &KyraEngine_v2::seq_introOverview, diff --git a/engines/kyra/text.h b/engines/kyra/text.h index 594082187b..07bc0605dd 100644 --- a/engines/kyra/text.h +++ b/engines/kyra/text.h @@ -59,7 +59,7 @@ public: virtual void restoreTalkTextMessageBkgd(int srcPage, int dstPage); void printTalkTextMessage(const char *text, int x, int y, uint8 color, int srcPage, int dstPage); void printIntroTextMessage(const char *text, int x, int y, uint8 col1, uint8 col2, uint8 col3, - int dstPage, Screen::FontId font=Screen::FID_8_FNT); + int dstPage, Screen::FontId font=Screen::FID_8_FNT); void printText(const char *str, int x, int y, uint8 c0, uint8 c1, uint8 c2, Screen::FontId font=Screen::FID_8_FNT); void printCharacterText(const char *text, int8 charNum, int charX); diff --git a/engines/kyra/text_v1.cpp b/engines/kyra/text_v1.cpp index 4262ac5cb8..7f49c04766 100644 --- a/engines/kyra/text_v1.cpp +++ b/engines/kyra/text_v1.cpp @@ -22,7 +22,7 @@ * $Id$ * */ - + #include "kyra/kyra_v1.h" #include "kyra/screen_v1.h" #include "kyra/text.h" @@ -33,7 +33,7 @@ namespace Kyra { void KyraEngine_v1::waitForChatToFinish(int vocFile, int16 chatDuration, const char *chatStr, uint8 charNum) { - debugC(9, kDebugLevelMain, "KyraEngine_v1::waitForChatToFinish(%i, %s, %i)", chatDuration, chatStr, charNum); + debugC(9, kDebugLevelMain, "KyraEngine_v1::waitForChatToFinish(%i, %s, %i)", chatDuration, chatStr, charNum); bool hasUpdatedNPCs = false; bool runLoop = true; bool drawText = textEnabled(); @@ -113,8 +113,8 @@ void KyraEngine_v1::waitForChatToFinish(int vocFile, int16 chatDuration, const c if ((chatDuration < (int16)(_system->getMillis() - timeAtStart)) && chatDuration != -1 && (!drawText || !snd_voiceIsPlaying())) break; - uint32 nextTime = loopStart + _tickLength; - + uint32 nextTime = loopStart + _tickLength; + while (_system->getMillis() < nextTime) { while (_eventMan->pollEvent(event)) { switch (event.type) { @@ -133,7 +133,7 @@ void KyraEngine_v1::waitForChatToFinish(int vocFile, int16 chatDuration, const c break; } } - + if (nextTime - _system->getMillis() >= 10) { _system->delayMillis(10); _system->updateScreen(); @@ -189,7 +189,7 @@ void KyraEngine_v1::restoreChatPartnerAnimFrame(int8 charNum) { void KyraEngine_v1::backupChatPartnerAnimFrame(int8 charNum) { _talkingCharNum = 0; - if (charNum < 5 && charNum > 0) + if (charNum < 5 && charNum > 0) _currentChatPartnerBackupFrame = _characterList[charNum].currentAnimFrame; if (_currentCharacter->currentAnimFrame != 88) { @@ -230,7 +230,7 @@ int KyraEngine_v1::initCharacterChat(int8 charNum) { if (_talkingCharNum == -1) { returnValue = 1; _talkingCharNum = 0; - + if (_currentCharacter->currentAnimFrame != 88) { _currentCharacter->currentAnimFrame = 16; if (_scaleMode != 0) @@ -269,7 +269,7 @@ void KyraEngine_v1::characterSays(int vocFile, const char *chatStr, int8 charNum if (_currentCharacter->sceneId == 210) return; - convoInitialized = initCharacterChat(charNum); + convoInitialized = initCharacterChat(charNum); chatPartnerNum = getChatPartnerNum(); if (chatPartnerNum >= 0 && chatPartnerNum < 5) @@ -298,7 +298,7 @@ void KyraEngine_v1::characterSays(int vocFile, const char *chatStr, int8 charNum _text->_talkMessageY = yPos; _text->_talkMessageH = lineNum * 10; - + if (textEnabled()) { _animator->restoreAllObjectBackgrounds(); @@ -347,7 +347,7 @@ void KyraEngine_v1::drawSentenceCommand(const char *sentence, int color) { _currSentenceColor[0] = _screen->_currentPalette[765] = _screen->_currentPalette[color*3]; _currSentenceColor[1] = _screen->_currentPalette[766] = _screen->_currentPalette[color*3+1]; _currSentenceColor[2] = _screen->_currentPalette[767] = _screen->_currentPalette[color*3+2]; - + _screen->setScreenPalette(_screen->_currentPalette); _startSentencePalIndex = 0; } @@ -373,7 +373,7 @@ void KyraEngine_v1::updateTextFade() { debugC(9, kDebugLevelMain, "KyraEngine_v1::updateTextFade()"); if (!_fadeText) return; - + bool finished = false; for (int i = 0; i < 3; i++) { if (_currSentenceColor[i] > 4) @@ -384,7 +384,7 @@ void KyraEngine_v1::updateTextFade() { finished = true; } } - + _screen->_currentPalette[765] = _currSentenceColor[0]; _screen->_currentPalette[766] = _currSentenceColor[1]; _screen->_currentPalette[767] = _currSentenceColor[2]; diff --git a/engines/kyra/text_v2.cpp b/engines/kyra/text_v2.cpp index 24e146a990..345af34e71 100644 --- a/engines/kyra/text_v2.cpp +++ b/engines/kyra/text_v2.cpp @@ -95,7 +95,7 @@ void TextDisplayer_v2::calcWidestLineBounds(int &x1, int &x2, int w, int x) { x1 = x; x1 -= (w >> 1); x2 = x1 + w + 1; - + if (x1 + w >= 311) x1 = 311 - w - 1; @@ -113,13 +113,13 @@ int KyraEngine_v2::chatGetType(const char *str) { switch (*str) { case '!': return 2; - + case ')': return -1; - + case '?': return 1; - + default: return 0; } @@ -133,7 +133,7 @@ void KyraEngine_v2::objectChat(const char *str, int object, int vocHigh, int voc setNextIdleAnimTimer(); _chatVocHigh = _chatVocLow = -1; - + objectChatInit(str, object, vocHigh, vocLow); _chatText = str; _chatObject = object; @@ -175,7 +175,7 @@ void KyraEngine_v2::objectChat(const char *str, int object, int vocHigh, int voc _mainCharacter.animFrame = _characterFrameTable[_mainCharacter.facing]; updateCharacterAnim(0); - + _chatText = 0; _chatObject = -1; @@ -187,7 +187,7 @@ void KyraEngine_v2::objectChatInit(const char *str, int object, int vocHigh, int int lineNum = _text->buildMessageSubstrings(str); int yPos = 0, xPos = 0; - + if (!object) { int scale = getScale(_mainCharacter.x1, _mainCharacter.y1); yPos = _mainCharacter.y1 - ((_mainCharacter.height * scale) >> 8) - 8; @@ -225,7 +225,7 @@ void KyraEngine_v2::objectChatInit(const char *str, int object, int vocHigh, int } else { _chatVocHigh = _chatVocLow = -1; } - + _screen->showMouse(); } @@ -335,19 +335,19 @@ void KyraEngine_v2::objectChatWaitToFinish() { void KyraEngine_v2::initTalkObject(int initObject) { TalkObject &object = _talkObjectList[initObject]; - + char STAFilename[13]; char TLKFilename[13]; char ENDFilename[13]; - + strcpy(STAFilename, object.filename); strcpy(TLKFilename, object.filename); strcpy(ENDFilename, object.filename); - + strcpy(STAFilename + 4, "_STA.TIM"); strcpy(TLKFilename + 4, "_TLK.TIM"); strcpy(ENDFilename + 4, "_END.TIM"); - + _currentTalkSections.STATim = loadTIMFile(STAFilename, NULL, 0); _currentTalkSections.TLKTim = loadTIMFile(TLKFilename, NULL, 0); _currentTalkSections.ENDTim = loadTIMFile(ENDFilename, NULL, 0); @@ -356,7 +356,7 @@ void KyraEngine_v2::initTalkObject(int initObject) { _specialSceneScriptStateBackup[object.scriptId] = _specialSceneScriptState[object.scriptId]; _specialSceneScriptState[object.scriptId] = 1; } - + /*if (_currentTalkObject.STATim) { _objectChatFinished = false; while (!_objectChatFinished) { @@ -371,7 +371,7 @@ void KyraEngine_v2::initTalkObject(int initObject) { void KyraEngine_v2::deinitTalkObject(int initObject) { TalkObject &object = _talkObjectList[initObject]; - + /*if (_currentTalkObject.ENDTim) { _objectChatFinished = false; while (!_objectChatFinished) { @@ -382,25 +382,25 @@ void KyraEngine_v2::deinitTalkObject(int initObject) { update(); } }*/ - + if (object.scriptId != -1) { _specialSceneScriptState[object.scriptId] = _specialSceneScriptStateBackup[object.scriptId]; } - + if (_currentTalkSections.STATim != NULL) { freeTIM(_currentTalkSections.STATim); _currentTalkSections.STATim = NULL; } - + if (_currentTalkSections.TLKTim != NULL) { freeTIM(_currentTalkSections.TLKTim); _currentTalkSections.TLKTim = NULL; } - + if (_currentTalkSections.ENDTim != NULL) { freeTIM(_currentTalkSections.ENDTim); _currentTalkSections.ENDTim = NULL; - } + } } byte *KyraEngine_v2::loadTIMFile(const char *filename, byte *buffer, int32 bufferSize) { @@ -415,13 +415,13 @@ byte *KyraEngine_v2::loadTIMFile(const char *filename, byte *buffer, int32 buffe error("No FORM chunk found in file: '%s'", filename); return NULL; } - + if (formBlockSize < 20) { return NULL; } formBlockSize += sizeof(TIMHeader) + 120 + sizeof(TIMStructUnk1) * 10; - + TIMHeader *timHeader; if (buffer == NULL || bufferSize < formBlockSize) { buffer = new byte[formBlockSize]; @@ -429,9 +429,9 @@ byte *KyraEngine_v2::loadTIMFile(const char *filename, byte *buffer, int32 buffe timHeader->deleteBufferFlag = 0xBABE; } else { timHeader = (TIMHeader *)buffer; - timHeader->deleteBufferFlag = 0x0; + timHeader->deleteBufferFlag = 0x0; } - + int32 chunkSize = file.getIFFBlockSize(AVTL_CHUNK); timHeader->unkFlag = -1; timHeader->unkFlag2 = 0; @@ -439,17 +439,17 @@ byte *KyraEngine_v2::loadTIMFile(const char *filename, byte *buffer, int32 buffe timHeader->unkOffset2 = timHeader->unkOffset + sizeof(TIMStructUnk1) * 10; timHeader->AVTLOffset = timHeader->unkOffset2 + 120; timHeader->TEXTOffset = timHeader->AVTLOffset + chunkSize; - + _TIMBuffers.AVTLChunk = (uint16 *)(buffer + timHeader->AVTLOffset); _TIMBuffers.TEXTChunk = buffer + timHeader->TEXTOffset; - + if (!file.loadIFFBlock(AVTL_CHUNK, _TIMBuffers.AVTLChunk, chunkSize)) { error("Couldn't load AVTL chunk from file: '%s'", filename); return NULL; } - + _TIMBuffers.UnkChunk = (TIMStructUnk1 *)(buffer + timHeader->unkOffset); - + for (int i = 0; i < 10; i++) { _TIMBuffers.UnkChunk[i].unk_0 = 0; _TIMBuffers.UnkChunk[i].unk_2 = 0; @@ -463,15 +463,15 @@ byte *KyraEngine_v2::loadTIMFile(const char *filename, byte *buffer, int32 buffe if (!file.loadIFFBlock(TEXT_CHUNK, _TIMBuffers.TEXTChunk, chunkSize)) { error("Couldn't load TEXT chunk from file: '%s'", filename); return NULL; - } + } } - + return buffer; } void KyraEngine_v2::freeTIM(byte *buffer) { TIMHeader *timHeader = (TIMHeader *)buffer; - + if (timHeader->deleteBufferFlag == 0xBABE) { delete[] buffer; } diff --git a/engines/kyra/timer.cpp b/engines/kyra/timer.cpp index 7c16d27d22..c0f47111c6 100644 --- a/engines/kyra/timer.cpp +++ b/engines/kyra/timer.cpp @@ -53,7 +53,7 @@ struct TimerResync : public Common::UnaryFunction { struct TimerEqual : public Common::UnaryFunction { uint8 _id; - + TimerEqual(uint8 id) : _id(id) {} bool operator()(const TimerEntry &entry) const { @@ -80,13 +80,13 @@ void TimerManager::addTimer(uint8 id, TimerFunc *func, int countdown, bool enabl } TimerEntry newTimer; - + newTimer.id = id; newTimer.countdown = countdown; newTimer.enabled = enabled ? 1 : 0; newTimer.lastUpdate = newTimer.nextRun = 0; newTimer.func = func; - + _timers.push_back(newTimer); } @@ -95,7 +95,7 @@ void TimerManager::update() { if (_system->getMillis() < _nextRun) return; - + _nextRun += 99999; for (Iterator pos = _timers.begin(); pos != _timers.end(); ++pos) { @@ -106,7 +106,7 @@ void TimerManager::update() { uint32 curTime = _system->getMillis(); pos->lastUpdate = curTime; pos->nextRun = curTime + pos->countdown * _vm->tickLength(); - + _nextRun = MIN(_nextRun, pos->nextRun); } } @@ -116,7 +116,7 @@ void TimerManager::resync() { debugC(9, kDebugLevelTimer, "TimerManager::resync()"); _nextRun = 0; // force rerun - Common::for_each(_timers.begin(), _timers.end(), TimerResync(_vm, _system->getMillis())); + Common::for_each(_timers.begin(), _timers.end(), TimerResync(_vm, _system->getMillis())); } void TimerManager::resetNextRun() { @@ -135,7 +135,7 @@ void TimerManager::setCountdown(uint8 id, int32 countdown) { uint32 curTime = _system->getMillis(); timer->lastUpdate = curTime; timer->nextRun = curTime + countdown * _vm->tickLength(); - + _nextRun = MIN(_nextRun, timer->nextRun); } } else { @@ -197,14 +197,14 @@ void TimerManager::disable(uint8 id) { void TimerManager::loadDataFromFile(Common::InSaveFile *file, int version) { debugC(9, kDebugLevelTimer, "TimerManager::loadDataFromFile(%p, %d)", (const void*)file, version); - + if (version <= 7) { _nextRun = 0; for (int i = 0; i < 32; ++i) { uint8 enabled = file->readByte(); int32 countdown = file->readSint32BE(); uint32 nextRun = file->readUint32BE(); - + Iterator timer = Common::find_if(_timers.begin(), _timers.end(), TimerEqual(i)); if (timer != _timers.end()) { timer->enabled = enabled; @@ -220,7 +220,7 @@ void TimerManager::loadDataFromFile(Common::InSaveFile *file, int version) { } } else { warning("Loading timer data for non existing timer %d", i); - } + } } } else { int entries = file->readByte(); @@ -237,14 +237,14 @@ void TimerManager::loadDataFromFile(Common::InSaveFile *file, int version) { file->seek(7, SEEK_CUR); } } - + resync(); } } void TimerManager::saveDataToFile(Common::OutSaveFile *file) const { debugC(9, kDebugLevelTimer, "TimerManager::saveDataToFile(%p)", (const void*)file); - + file->writeByte(count()); for (CIterator pos = _timers.begin(); pos != _timers.end(); ++pos) { file->writeByte(pos->id); diff --git a/engines/kyra/timer.h b/engines/kyra/timer.h index 1edeb92a42..2c0251ffb7 100644 --- a/engines/kyra/timer.h +++ b/engines/kyra/timer.h @@ -43,11 +43,11 @@ typedef Functor1 TimerFunc; struct TimerEntry { uint8 id; int32 countdown; - int8 enabled; + int8 enabled; int32 lastUpdate; uint32 nextRun; - + TimerFunc *func; }; @@ -55,27 +55,27 @@ class TimerManager { public: TimerManager(KyraEngine *vm, OSystem *sys) : _vm(vm), _system(sys), _timers(), _nextRun(0) {} ~TimerManager() { reset(); } - + void reset(); - + void addTimer(uint8 id, TimerFunc *func, int countdown, bool enabled); int count() const { return _timers.size(); } - + void update(); - + void resetNextRun(); - + void setCountdown(uint8 id, int32 countdown); void setDelay(uint8 id, int32 countdown); int32 getDelay(uint8 id) const; - + bool isEnabled(uint8 id) const; void enable(uint8 id); void disable(uint8 id); void resync(); - + void loadDataFromFile(Common::InSaveFile *file, int version); void saveDataToFile(Common::OutSaveFile *file) const; private: @@ -83,7 +83,7 @@ private: OSystem *_system; Common::List _timers; uint32 _nextRun; - + typedef Common::List::iterator Iterator; typedef Common::List::const_iterator CIterator; }; diff --git a/engines/kyra/timer_v1.cpp b/engines/kyra/timer_v1.cpp index 55dab4413f..c02042f1cc 100644 --- a/engines/kyra/timer_v1.cpp +++ b/engines/kyra/timer_v1.cpp @@ -46,28 +46,28 @@ void KyraEngine_v1::setupTimers() { _timer->addTimer(7, 0, 8, 1); _timer->addTimer(8, 0, 9, 1); _timer->addTimer(9, 0, 7, 1); - + for (int i = 10; i <= 13; ++i) _timer->addTimer(i, 0, 420, 1); _timer->addTimer(14, TimerV1(timerCheckAnimFlag2), 600, 1); _timer->addTimer(15, TimerV1(timerUpdateHeadAnims), 11, 1); _timer->addTimer(16, TimerV1(timerSetFlags1), 7200, 1); - _timer->addTimer(17, 0 /*sub_15120*/, 7200, 1); + _timer->addTimer(17, 0 /*sub_15120*/, 7200, 1); _timer->addTimer(18, TimerV1(timerCheckAnimFlag1), 600, 1); _timer->addTimer(19, TimerV1(timerRedrawAmulet), 600, 1); - + _timer->addTimer(20, 0, 7200, 1); _timer->addTimer(21, 0/*sub_1517C*/, 18000, 1); _timer->addTimer(22, 0, 7200, 1); - + for (int i = 23; i <= 27; ++i) _timer->addTimer(i, 0, 10800, 1); _timer->addTimer(28, 0, 21600, 1); _timer->addTimer(29, 0, 7200, 1); _timer->addTimer(30, 0, 10800, 1); - + _timer->addTimer(31, TimerV1(timerFadeText), -1, 1); _timer->addTimer(32, TimerV1(updateAnimFlag1), 9, 1); _timer->addTimer(33, TimerV1(updateAnimFlag2), 3, 1); @@ -141,7 +141,7 @@ void KyraEngine_v1::setTextFadeTimerCountdown(int16 countdown) { void KyraEngine_v1::timerSetFlags2(int timerNum) { debugC(9, kDebugLevelMain | kDebugLevelTimer, "KyraEngine_v1::timerSetFlags2(%i)", timerNum); if (!((uint32*)(_flagsTable+0x2D))[timerNum]) - ((uint32*)(_flagsTable+0x2D))[timerNum] = 1; + ((uint32*)(_flagsTable+0x2D))[timerNum] = 1; } void KyraEngine_v1::timerCheckAnimFlag1(int timerNum) { diff --git a/engines/kyra/timer_v2.cpp b/engines/kyra/timer_v2.cpp index 1b12db4e9f..7a0fe5b03f 100644 --- a/engines/kyra/timer_v2.cpp +++ b/engines/kyra/timer_v2.cpp @@ -22,7 +22,7 @@ * $Id$ * */ - + #include "kyra/kyra_v2.h" #include "kyra/timer.h" @@ -32,7 +32,7 @@ namespace Kyra { void KyraEngine_v2::setupTimers() { debugC(9, kDebugLevelMain | kDebugLevelTimer, "KyraEngine_v2::setupTimers()"); - + _timer->addTimer(0, 0, 5, 1); _timer->addTimer(1, TimerV2(timerFunc2), -1, 1); _timer->addTimer(2, TimerV2(timerCauldronAnimation), 1, 1); @@ -96,7 +96,7 @@ void KyraEngine_v2::setTimer1DelaySecs(int secs) { if (secs == -1) secs = 32000; - + _timer->setCountdown(1, secs * 60); } diff --git a/engines/kyra/util.h b/engines/kyra/util.h index 072f4996f1..1c4b8462cc 100644 --- a/engines/kyra/util.h +++ b/engines/kyra/util.h @@ -42,9 +42,9 @@ template class Functor0Mem : public Functor0 { public: typedef Res (T::*FuncType)(); - + Functor0Mem(T *t, const FuncType &func) : _t(t), _func(func) {} - + bool isValid() const { return _func != 0; } Res operator()() const { return (_t->*_func)(); @@ -66,9 +66,9 @@ template class Functor1Mem : public Functor1 { public: typedef Res (T::*FuncType)(Arg); - + Functor1Mem(T *t, const FuncType &func) : _t(t), _func(func) {} - + bool isValid() const { return _func != 0; } Res operator()(Arg v1) const { return (_t->*_func)(v1); diff --git a/engines/kyra/wsamovie.h b/engines/kyra/wsamovie.h index 53f1819b30..5e97e1a5fb 100644 --- a/engines/kyra/wsamovie.h +++ b/engines/kyra/wsamovie.h @@ -57,7 +57,7 @@ public: protected: KyraEngine *_vm; bool _opened; - + int _x, _y; int _drawPage; }; @@ -103,7 +103,7 @@ public: void close(); void displayFrame(int frameNum, ...); -private: +private: void processFrame(int frameNum, uint8 *dst); uint8 *_buffer; @@ -112,23 +112,23 @@ private: class WSAMovieV2 : public WSAMovieV1 { public: WSAMovieV2(KyraEngine_v2 *vm); - + int open(const char *filename, int unk1, uint8 *palette); - + virtual void displayFrame(int frameNum, ...); void setX(int x) { _x = x + _xAdd; } void setY(int y) { _y = y + _yAdd; } - + int xAdd() const { return _xAdd; } int yAdd() const { return _yAdd; } - + int width() const { return _width; } int height() const { return _height; } void setWidth(int w) { _width = w; } void setHeight(int h) { _height = h; } - + // HACK for our intro code void flagOldOff(bool enabled) { _oldOff = enabled; } protected: 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::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(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 _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 { 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 { 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::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::iterator i = _playingSounds.begin(); + ManagedList::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::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(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); diff --git a/engines/module.mk b/engines/module.mk index 10a29e110a..6cfe9b36fa 100644 --- a/engines/module.mk +++ b/engines/module.mk @@ -3,5 +3,5 @@ MODULE := engines MODULE_OBJS := \ engine.o -# Include common rules +# Include common rules include $(srcdir)/rules.mk diff --git a/engines/queen/defs.h b/engines/queen/defs.h index 9e35ec2523..5b3475d400 100644 --- a/engines/queen/defs.h +++ b/engines/queen/defs.h @@ -65,7 +65,7 @@ enum InkColor { INK_TALK_NORMAL, INK_JOE, INK_OUTLINED_TEXT, - + INK_COUNT }; diff --git a/engines/queen/display.cpp b/engines/queen/display.cpp index bd4c461080..bac7c5f419 100644 --- a/engines/queen/display.cpp +++ b/engines/queen/display.cpp @@ -1455,7 +1455,7 @@ const uint8 Display::_fontGreek[] = { 0xBC, 0x98, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00, 0x00, 0xCC, 0x66, 0x33, 0x66, 0xCC, 0x00, 0x00, 0x9E, 0xB3, 0x33, 0x33, 0x33, 0x33, 0x1E, 0x00, 0x40, 0xC6, 0x4C, 0x58, 0x3E, 0x62, 0xC4, 0x0E, 0xB3, 0xB3, 0x33, 0x1E, 0x0C, 0x0C, 0x0C, 0x00, 0x9E, 0xB3, 0x33, 0x33, 0x1E, 0x00, 0x3F, 0x00, - 0xB4, 0x00, 0x30, 0x30, 0x30, 0x30, 0x18, 0x00, 0x38, 0x7C, 0xC6, 0xC6, 0xFE, 0xC6, 0xC6, 0x00, + 0xB4, 0x00, 0x30, 0x30, 0x30, 0x30, 0x18, 0x00, 0x38, 0x7C, 0xC6, 0xC6, 0xFE, 0xC6, 0xC6, 0x00, 0xF8, 0xCC, 0xCC, 0xF8, 0xCC, 0xCC, 0xF8, 0x00, 0xFC, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0x00, 0x38, 0x7C, 0xC6, 0xC6, 0xC6, 0xC6, 0xFE, 0x00, 0xFC, 0xC0, 0xC0, 0xF0, 0xC0, 0xC0, 0xFC, 0x00, 0xFC, 0x0C, 0x18, 0x30, 0x60, 0xC0, 0xFC, 0x00, 0xCC, 0xCC, 0xCC, 0xFC, 0xCC, 0xCC, 0xCC, 0x00, @@ -1466,7 +1466,7 @@ const uint8 Display::_fontGreek[] = { 0xFC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x00, 0xF8, 0xCC, 0xCC, 0xF8, 0xC0, 0xC0, 0xC0, 0x00, 0x00, 0x00, 0x18, 0x3C, 0x3C, 0x18, 0x00, 0x00, 0xFC, 0x60, 0x30, 0x18, 0x30, 0x60, 0xFC, 0x00, 0xFC, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x00, 0xCC, 0xCC, 0xCC, 0x78, 0x30, 0x30, 0x30, 0x00, - 0x10, 0x7C, 0xD6, 0xD6, 0xD6, 0x7C, 0x10, 0x00, 0xC6, 0x6C, 0x38, 0x10, 0x38, 0x6C, 0xC6, 0x00, + 0x10, 0x7C, 0xD6, 0xD6, 0xD6, 0x7C, 0x10, 0x00, 0xC6, 0x6C, 0x38, 0x10, 0x38, 0x6C, 0xC6, 0x00, 0xC6, 0xD6, 0xD6, 0xD6, 0x7C, 0x10, 0x10, 0x00, 0x78, 0xCC, 0xCC, 0xCC, 0x78, 0x00, 0xFC, 0x00, 0xBD, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00, 0xB4, 0xCC, 0xCC, 0x78, 0x30, 0x30, 0x30, 0x00, 0x30, 0x00, 0x7A, 0xCC, 0xCC, 0xCC, 0x7A, 0x00, 0x30, 0x00, 0x78, 0xCC, 0x60, 0xCC, 0x78, 0x00, diff --git a/engines/queen/xref.txt b/engines/queen/xref.txt index 55067aa922..9e562069e3 100644 --- a/engines/queen/xref.txt +++ b/engines/queen/xref.txt @@ -159,7 +159,7 @@ no_check_keys Input::_noCheckKeys INVENTORY ========= -DEL_ITEM_NUM() Logic::inventoryDeleteItem +DEL_ITEM_NUM() Logic::inventoryDeleteItem INS_ITEM_NUM() Logic::inventoryInsertItem INVDWN() Logic::inventoryScroll INVENTORY() Logic::inventoryRefresh @@ -427,7 +427,7 @@ in() Cutaway::inRange find_cd_cut() findCdCut find_cd_desc() *not needed* (included in Logic::joeSpeak) - -Kstr +Kstr bank9 NEWDEF, M,A, @@ -490,7 +490,7 @@ OUTLINE // not needed, textSet() Graphics::parameter FTOT // queen.c/SETUP_FURNITURE local var OBJMAXv // == Logic::_objMax[Logic::_currentRoom] TEMPstr -WORDstr +WORDstr JOE2str,PERSON2str // locals in Talk::initialTalk SUBJECT tmpbamflag diff --git a/engines/saga/actor.cpp b/engines/saga/actor.cpp index 81cc2bcf2c..8bc07c55ee 100644 --- a/engines/saga/actor.cpp +++ b/engines/saga/actor.cpp @@ -338,9 +338,9 @@ void Actor::loadActorList(int protagonistIdx, int actorCount, int actorsResource int stateResourceId; freeActorList(); - + _vm->_resource->loadResource(_actorContext, actorsResourceID, actorListData, actorListLength); - + _actorsCount = actorCount; if (actorListLength != (uint)_actorsCount * ACTOR_INHM_SIZE) { @@ -348,14 +348,14 @@ void Actor::loadActorList(int protagonistIdx, int actorCount, int actorsResource } MemoryReadStream actorS(actorListData, actorListLength); - + _actors = (ActorData **)malloc(_actorsCount * sizeof(*_actors)); for (i = 0; i < _actorsCount; i++) { actor = _actors[i] = new ActorData(); actor->_id = objectIndexToId(kGameObjectActor, i); //actorIndexToId(i); actor->_index = i; debug(4, "init actor id=0x%x index=%d", actor->_id, actor->_index); - actorS.readUint32LE(); //next displayed + actorS.readUint32LE(); //next displayed actorS.readByte(); //type actor->_flags = actorS.readByte(); actor->_nameIndex = actorS.readUint16LE(); @@ -450,10 +450,10 @@ void Actor::loadActorList(int protagonistIdx, int actorCount, int actorsResource } MemoryReadStream statesIds(idsResourcePointer, idsResourceLength); - + for (i = 0; i < protagStatesCount; i++) { stateResourceId = statesIds.readUint32LE(); - + loadFrameList(stateResourceId, _protagStates[i]._frames, _protagStates[i]._framesCount); } free(idsResourcePointer); @@ -485,20 +485,20 @@ void Actor::loadObjList(int objectCount, int objectsResourceID) { byte* objectListData; size_t objectListLength; freeObjList(); - + _vm->_resource->loadResource(_actorContext, objectsResourceID, objectListData, objectListLength); - + _objsCount = objectCount; MemoryReadStream objectS(objectListData, objectListLength); - + _objs = (ObjectData **)malloc(_objsCount * sizeof(*_objs)); for (i = 0; i < _objsCount; i++) { object = _objs[i] = new ObjectData(); object->_id = objectIndexToId(kGameObjectObject, i); object->_index = i; debug(9, "init object id=%d index=%d", object->_id, object->_index); - objectS.readUint32LE(); //next displayed + objectS.readUint32LE(); //next displayed objectS.readByte(); //type object->_flags = objectS.readByte(); object->_nameIndex = objectS.readUint16LE(); @@ -624,7 +624,7 @@ void Actor::setProtagState(int state) { } int Actor::getFrameType(ActorFrameTypes frameType) { - + if (_vm->getGameType() == GType_ITE) { switch (frameType) { case kFrameStand: @@ -915,10 +915,10 @@ uint16 Actor::hitTest(const Point &testPoint, bool skipProtagonist) { // id in this case, even though the chalk was drawn after the circle. // Therefore, for IHNM, we iterate through the whole draw list and // return the last match found, not the first one. - // Unfortunately, it is only possible to search items in the sorted draw + // Unfortunately, it is only possible to search items in the sorted draw // list from start to end, not reverse, so it's necessary to search // through the whole list to get the item drawn last - + uint16 result = ID_NOTHING; if (!_vm->_scene->getSceneClip().contains(testPoint)) @@ -1162,7 +1162,7 @@ void Actor::actorSpeech(uint16 actorId, const char **strings, int stringsCount, // HACK for the compact disk in Ellen's chapter // Once Ellen starts saying that "Something is different", bring the compact disk in the - // scene. After speaking with AM, the compact disk is visible. She always says this line + // scene. After speaking with AM, the compact disk is visible. She always says this line // when entering room 59, after speaking with AM, if the compact disk is not picked up yet // Check Script::sfDropObject for the other part of this hack if (_vm->getGameType() == GType_IHNM && _vm->_scene->currentChapterNumber() == 3 && diff --git a/engines/saga/actor.h b/engines/saga/actor.h index 4aa1f4508a..c31b78731f 100644 --- a/engines/saga/actor.h +++ b/engines/saga/actor.h @@ -298,7 +298,7 @@ public: Point _screenPosition; // screen coordinates int32 _screenDepth; // int32 _screenScale; // - + void saveState(Common::OutSaveFile *out) { out->writeUint16LE(_flags); out->writeSint32LE(_nameIndex); diff --git a/engines/saga/actor_path.cpp b/engines/saga/actor_path.cpp index 92d7310f16..1a6fff8395 100644 --- a/engines/saga/actor_path.cpp +++ b/engines/saga/actor_path.cpp @@ -184,8 +184,8 @@ bool Actor::scanPathLine(const Point &point1, const Point &point2) { point.x += s.x; errterm -= fDelta.y; } - - point.y += s.y; + + point.y += s.y; errterm += fDelta.x; if (!validPathCellPoint(point)) { @@ -205,7 +205,7 @@ bool Actor::scanPathLine(const Point &point1, const Point &point2) { point.y += s.y; errterm -= fDelta.x; } - + point.x += s.x; errterm += fDelta.y; @@ -381,7 +381,7 @@ int pathLine(Point *pointList, const Point &point1, const Point &point2) { tempPoint.y = delta.y * 2; if (delta.y > delta.x) { - + errterm = tempPoint.x - delta.y; res = delta.y; diff --git a/engines/saga/actor_walk.cpp b/engines/saga/actor_walk.cpp index 0a3cc9aa4f..7e66a67560 100644 --- a/engines/saga/actor_walk.cpp +++ b/engines/saga/actor_walk.cpp @@ -208,7 +208,7 @@ void Actor::updateActorsScene(int actorsEntrance) { if (actor->_flags & kProtagonist) { actor->_finalTarget = actor->_location; _centerActor = _protagonist = actor; - } else if (_vm->getGameType() == GType_ITE && + } else if (_vm->getGameType() == GType_ITE && _vm->_scene->currentSceneResourceId() == RID_ITE_OVERMAP_SCENE) { continue; } @@ -938,7 +938,7 @@ bool Actor::actorWalkTo(uint16 actorId, const Location &toLocation) { ((actor->_currentAction >= kActionWalkToPoint && actor->_currentAction <= kActionWalkDir) || (_vm->getGameType() == GType_ITE && actor == _protagonist)) && !_vm->_scene->canWalk(pointFrom)) { - + int max = _vm->getGameType() == GType_ITE ? 8 : 4; for (i = 1; i < max; i++) { @@ -1109,7 +1109,7 @@ bool Actor::actorEndWalk(uint16 actorId, bool recurse) { actor->_location.toScreenPointUV(testPoint); // it's wrong calculation, but it is used in ITE else actor->_location.toScreenPointXY(testPoint); - + hitZoneIndex = _vm->_scene->_actionMap->hitTest(testPoint); if (hitZoneIndex != -1) { hitZone = _vm->_scene->_actionMap->getHitZone(hitZoneIndex); diff --git a/engines/saga/animation.cpp b/engines/saga/animation.cpp index 4324496f7d..6690f07bbe 100644 --- a/engines/saga/animation.cpp +++ b/engines/saga/animation.cpp @@ -168,7 +168,7 @@ int Anim::playCutaway(int cut, bool fade) { warning("Could not allocate cutaway animation slot"); return 0; } - + // Some cutaways in IHNM have animResourceId equal to 0, which means that they only have // a background frame and no animation. Those animations are actually game scripts. // An example is the "nightfall" animation in Ben's chapter (fadein-fadeout), the animation @@ -461,7 +461,7 @@ void Anim::setCycles(uint16 animId, int cycles) { int Anim::getCycles(uint16 animId) { if (animId >= MAX_ANIMATIONS && _cutawayAnimations[animId - MAX_ANIMATIONS] == NULL) return 0; - + return getAnimation(animId)->cycles; } @@ -484,7 +484,7 @@ void Anim::play(uint16 animId, int vectorTime, bool playing) { return; if (animId >= MAX_ANIMATIONS && _cutawayAnimations[animId - MAX_ANIMATIONS] == NULL) { - // In IHNM, cutaways without an animation bit are not rendered, but the framecount + // In IHNM, cutaways without an animation bit are not rendered, but the framecount // needs to be updated _vm->_frameCount++; @@ -538,7 +538,7 @@ void Anim::play(uint16 animId, int vectorTime, bool playing) { // FIXME: if start > 0, then this works incorrectly decodeFrame(anim, anim->frameOffsets[frame], displayBuffer, _vm->getDisplayWidth() * _vm->getDisplayHeight()); - _vm->_frameCount++; + _vm->_frameCount++; anim->currentFrame++; if (anim->completed != 65535) { anim->completed++; @@ -547,7 +547,7 @@ void Anim::play(uint16 animId, int vectorTime, bool playing) { if (anim->currentFrame > anim->maxFrame) { anim->currentFrame = anim->loopFrame; - _vm->_frameCount++; + _vm->_frameCount++; if (anim->state == ANIM_STOPPING || anim->currentFrame == -1) { anim->state = ANIM_PAUSE; @@ -728,7 +728,7 @@ void Anim::decodeFrame(AnimationData *anim, size_t frameOffset, byte *buf, size_ // Begin RLE decompression to output buffer - do { + do { markByte = readS.readByte(); switch (markByte) { case SAGA_FRAME_START: diff --git a/engines/saga/console.cpp b/engines/saga/console.cpp index 87e825272d..47b2484547 100644 --- a/engines/saga/console.cpp +++ b/engines/saga/console.cpp @@ -117,7 +117,7 @@ bool Console::cmdPlayCutaway(int argc, const char **argv) { } bool Console::cmdCurrentScene(int argc, const char **argv) { - DebugPrintf("Current Scene is: %i, scene resource id: %i\n", + DebugPrintf("Current Scene is: %i, scene resource id: %i\n", _vm->_scene->currentSceneNumber(), _vm->_scene->currentSceneResourceId()); return true; } diff --git a/engines/saga/detection.cpp b/engines/saga/detection.cpp index f95730eeb7..aeac536af3 100644 --- a/engines/saga/detection.cpp +++ b/engines/saga/detection.cpp @@ -58,7 +58,7 @@ const bool SagaEngine::isMacResources() const { return (getPlatform() == Common: const GameResourceDescription *SagaEngine::getResourceDescription() { return _gameDescription->resourceDescription; } const GameSoundInfo *SagaEngine::getVoiceInfo() const { return _gameDescription->voiceInfo; } const GameSoundInfo *SagaEngine::getSfxInfo() const { return _gameDescription->sfxInfo; } -const GameSoundInfo *SagaEngine::getMusicInfo() const { +const GameSoundInfo *SagaEngine::getMusicInfo() const { static GameSoundInfo musicInfo; musicInfo.resourceType = kSoundPCM; musicInfo.frequency = 11025; @@ -68,7 +68,7 @@ const GameSoundInfo *SagaEngine::getMusicInfo() const { musicInfo.isBigEndian = false; musicInfo.isSigned = true; - return &musicInfo; + return &musicInfo; } const GameFontDescription *SagaEngine::getFontDescription(int index) { @@ -89,7 +89,7 @@ uint32 SagaEngine::getFeatures() const { if (_gf_compressed_sounds) result |= GF_COMPRESSED_SOUNDS; - return result; + return result; } Common::Language SagaEngine::getLanguage() const { return _gameDescription->desc.language; } diff --git a/engines/saga/detection_tables.h b/engines/saga/detection_tables.h index 0b84669b7f..7a987b6057 100644 --- a/engines/saga/detection_tables.h +++ b/engines/saga/detection_tables.h @@ -690,7 +690,7 @@ static const SAGAGameDescription gameDescriptions[] = { {"scripts.res", GAME_SCRIPTFILE, "be38bbc5a26be809dbf39f13befebd01", -1}, //{"sfx.res", GAME_SOUNDFILE, "1c610d543f32ec8b525e3f652536f269", -1}, // There are two English versions of the game, each one with a different sfx.res file - // Known MD5 checksums for sfx.res in the English version of the game are + // Known MD5 checksums for sfx.res in the English version of the game are // 1c610d543f32ec8b525e3f652536f269 and 45a9a9f5d37740be24fd2ae2edf36573 {"sfx.res", GAME_SOUNDFILE, NULL, -1}, { NULL, 0, NULL, 0} diff --git a/engines/saga/font.cpp b/engines/saga/font.cpp index 9a0892dbd0..157fed1216 100644 --- a/engines/saga/font.cpp +++ b/engines/saga/font.cpp @@ -249,7 +249,7 @@ int Font::getStringWidth(FontId fontId, const char *text, size_t count, FontEffe int ch; const byte *txt; - + font = getFont(fontId); txt = (const byte *) text; diff --git a/engines/saga/font.h b/engines/saga/font.h index 92ec5de312..6b930ddca0 100644 --- a/engines/saga/font.h +++ b/engines/saga/font.h @@ -141,7 +141,7 @@ class Font { } void textDrawRect(KnownFont font, Surface *ds, const char *text, const Common::Rect &rect, int color, int effectColor, FontEffectFlags flags) { textDrawRect(knownFont2FontIdx(font), ds, text, rect, color, effectColor, flags); - } + } void setFontMapping(int mapping) { _fontMapping = mapping; } @@ -168,7 +168,7 @@ class Font { void createOutline(FontData *font); void draw(FontId fontId, Surface *ds, const char *text, size_t count, const Common::Point &point, int color, int effectColor, FontEffectFlags flags); void outFont(const FontStyle &drawFont, Surface *ds, const char *text, size_t count, const Common::Point &point, int color, FontEffectFlags flags); - + FontData *getFont(FontId fontId) { validate(fontId); return _fonts[fontId]; diff --git a/engines/saga/ihnm_introproc.cpp b/engines/saga/ihnm_introproc.cpp index eaaff19c94..5f1d0157d5 100644 --- a/engines/saga/ihnm_introproc.cpp +++ b/engines/saga/ihnm_introproc.cpp @@ -228,7 +228,7 @@ bool Scene::playTitle(int title, int time, int mode) { break; } } - + if (checkKey()) { _vm->_scene->cutawaySkip(); interrupted = true; @@ -244,7 +244,7 @@ bool Scene::playTitle(int title, int time, int mode) { playParameter = false; frameTime = curTime; - + _vm->_system->copyRectToScreen((byte *)backBufferSurface->pixels, backBufferSurface->w, 0, 0, backBufferSurface->w, backBufferSurface->h); } diff --git a/engines/saga/interface.cpp b/engines/saga/interface.cpp index b13bf94650..ef31b85156 100644 --- a/engines/saga/interface.cpp +++ b/engines/saga/interface.cpp @@ -69,14 +69,14 @@ static int verbTypeToTextStringsIdLUT[2][kVerbTypeIdsMax] = { -1, -1, -1}, - {-1, + {-1, kVerbIHNMWalk, kVerbIHNMLookAt, - kVerbIHNMTake, - kVerbIHNMUse, + kVerbIHNMTake, + kVerbIHNMUse, kVerbIHNMTalkTo, kVerbIHNMSwallow, - kVerbIHNMGive, + kVerbIHNMGive, kVerbIHNMPush} }; @@ -95,7 +95,7 @@ static int IHNMTextStringIdsLUT[56] = { 8, // Give 10, // Options 11, // Test - 12, // + 12, // 13, // Help 14, // Quit Game 16, // Fast @@ -672,7 +672,7 @@ bool Interface::processAscii(Common::KeyState keystate) { if (keystate.keycode == Common::KEYCODE_ESCAPE || keystate.keycode == Common::KEYCODE_RETURN) { _vm->_script->wakeUpThreads(kWaitTypeRequest); _vm->_interface->setMode(kPanelMain); - + _protectHash = 0; for (char *p = _textInputString; *p; p++) @@ -772,7 +772,7 @@ void Interface::draw() { drawStatusBar(); - if (_panelMode == kPanelMain || _panelMode == kPanelMap || + if (_panelMode == kPanelMain || _panelMode == kPanelMap || (_panelMode == kPanelNull && _vm->getGameId() == GID_IHNM_DEMO)) { _mainPanel.getRect(rect); backBuffer->blit(rect, _mainPanel.image); @@ -2336,7 +2336,7 @@ void Interface::drawVerbPanelText(Surface *ds, PanelButton *panelButton, KnownCo if (_vm->getGameType() == GType_ITE) { textId = verbTypeToTextStringsIdLUT[0][panelButton->id]; text = _vm->getTextString(textId); - } else { + } else { textId = verbTypeToTextStringsIdLUT[1][panelButton->id]; text = _vm->_script->_mainStrings.getString(textId + 1); textShadowKnownColor = kKnownColorTransparent; @@ -2397,7 +2397,7 @@ bool Interface::converseAddText(const char *text, int strId, int replyId, byte r for (i = len; i >= 0; i--) { c = _converseWorkString[i]; - + if (_vm->getGameType() == GType_ITE) { if ((c == ' ' || c == '\0') && (_vm->_font->getStringWidth(kKnownFontSmall, _converseWorkString, i, kFontNormal) <= _vm->getDisplayInfo().converseMaxTextWidth)) break; @@ -2674,7 +2674,7 @@ void Interface::mapPanelShow() { rect.left = rect.top = 0; - _vm->_resource->loadResource(_interfaceContext, + _vm->_resource->loadResource(_interfaceContext, _vm->_resource->convertResourceId(RID_ITE_TYCHO_MAP), resource, resourceLength); if (resourceLength == 0) { error("Interface::mapPanelShow() unable to load Tycho map resource"); diff --git a/engines/saga/ite_introproc.cpp b/engines/saga/ite_introproc.cpp index 0def0f5b22..2aa263b097 100644 --- a/engines/saga/ite_introproc.cpp +++ b/engines/saga/ite_introproc.cpp @@ -372,7 +372,7 @@ int Scene::ITEIntroCave1Proc(int param) { Event event; Event *q_event; int lang = 0; - + if (_vm->getLanguage() == Common::DE_DEU) lang = 1; else if (_vm->getLanguage() == Common::IT_ITA) @@ -485,7 +485,7 @@ int Scene::ITEIntroCave2Proc(int param) { Event event; Event *q_event; int lang = 0; - + if (_vm->getLanguage() == Common::DE_DEU) lang = 1; else if (_vm->getLanguage() == Common::IT_ITA) diff --git a/engines/saga/module.mk b/engines/saga/module.mk index a3765ef01c..c1b1c364f6 100644 --- a/engines/saga/module.mk +++ b/engines/saga/module.mk @@ -39,5 +39,5 @@ ifdef BUILD_PLUGINS PLUGIN := 1 endif -# Include common rules +# Include common rules include $(srcdir)/rules.mk diff --git a/engines/saga/music.cpp b/engines/saga/music.cpp index 4158cd84c4..52a6734b8a 100644 --- a/engines/saga/music.cpp +++ b/engines/saga/music.cpp @@ -347,7 +347,7 @@ Music::Music(SagaEngine *vm, Audio::Mixer *mixer, MidiDriver *driver, int enable _currentVolume = 0; xmidiParser = MidiParser::createParser_XMIDI(); - smfParser = MidiParser::createParser_SMF(); + smfParser = MidiParser::createParser_SMF(); _digitalMusicContext = _vm->_resource->getContext(GAME_MUSICFILE); @@ -424,7 +424,7 @@ void Music::play(uint32 resourceId, MusicFlags flags) { MidiParser *parser; ResourceContext *context = NULL; byte *resourceData; - size_t resourceSize; + size_t resourceSize; uint32 loopStart; debug(2, "Music::play %d, %d", resourceId, flags); @@ -507,7 +507,7 @@ void Music::play(uint32 resourceId, MusicFlags flags) { context = _vm->_resource->getContext(GAME_MUSICFILE_GM); if (context == NULL) { context = _vm->_resource->getContext(GAME_RESOURCEFILE); - } + } } else { // I've listened to music from both the FM and the GM // file, and I've tentatively reached the conclusion diff --git a/engines/saga/objectmap.cpp b/engines/saga/objectmap.cpp index ef9bbc935c..c500ccf5ab 100644 --- a/engines/saga/objectmap.cpp +++ b/engines/saga/objectmap.cpp @@ -78,7 +78,7 @@ HitZone::HitZone(MemoryReadStreamEndian *readStream, int index, int sceneNumber) // WORKAROUND: bug #1259608: "ITE: Riff ignores command in Ferret merchant center" // Apparently ITE Mac version has bug in game data. Both ObjectMap and ActionMap - // for exit area are little taller (y = 123) and thus Riff goes to exit + // for exit area are little taller (y = 123) and thus Riff goes to exit // when clicked on barrel of nails. if (sceneNumber == 18 && index == 0 && i == 0 && j == 0 && point->y == 123) point->y = 129; diff --git a/engines/saga/puzzle.cpp b/engines/saga/puzzle.cpp index 71fe937987..23eaa42531 100644 --- a/engines/saga/puzzle.cpp +++ b/engines/saga/puzzle.cpp @@ -149,7 +149,7 @@ void Puzzle::initPieces(void) { int frameNumber; SpriteList *spriteList; _vm->_actor->getSpriteParams(puzzle, frameNumber, spriteList); - + for (int i = 0; i < PUZZLE_PIECES; i++) { spI = &(spriteList->infoList[i]); _pieceInfo[i].offX = (byte)(spI->width >> 1); diff --git a/engines/saga/rscfile.cpp b/engines/saga/rscfile.cpp index 00e9415379..7914b3ed3b 100644 --- a/engines/saga/rscfile.cpp +++ b/engines/saga/rscfile.cpp @@ -143,7 +143,7 @@ bool Resource::loadMacContext(ResourceContext *context) { uint32 macDataOffset; MacResMap macResMap; - MacResType *macResTypes; + MacResType *macResTypes; MacResType *macResType; MacResource *macResource; @@ -209,7 +209,7 @@ bool Resource::loadMacContext(ResourceContext *context) { for (i = macResMap.numTypes, macResType = macResTypes; i > 0; i--, macResType++) { context->file->seek(macResType->offset + macMapOffset + macResMap.typeOffset); - for (j = macResType->items, macResource = macResType->resources; j > 0; j--, macResource++) { + for (j = macResType->items, macResource = macResType->resources; j > 0; j--, macResource++) { macResource->id = context->file->readUint16BE(); macResource->nameOffset = context->file->readUint16BE(); macResource->dataOffset = context->file->readUint32BE(); @@ -222,7 +222,7 @@ bool Resource::loadMacContext(ResourceContext *context) { } } - for (j = macResType->items, macResource = macResType->resources; j > 0; j--, macResource++) { + for (j = macResType->items, macResource = macResType->resources; j > 0; j--, macResource++) { if (macResource->nameOffset != -1) { context->file->seek(macResource->nameOffset + macMapOffset + macResMap.nameOffset); macNameLen = context->file->readByte(); @@ -235,7 +235,7 @@ bool Resource::loadMacContext(ResourceContext *context) { for (i = macResMap.numTypes, macResType = macResTypes; i > 0; i--, macResType++) { //getting offsets & sizes of midi if (((context->fileType & GAME_MUSICFILE_GM) > 0) && (macResType->id == ID_MIDI)) { - + context->count = macResType->maxItemId + 1; context->table = (ResourceData *)calloc(context->count, sizeof(*context->table)); for (j = macResType->items, macResource = macResType->resources; j > 0; j--, macResource++) { @@ -283,10 +283,10 @@ bool Resource::loadContext(ResourceContext *context) { if (context->fileType & GAME_SWAPENDIAN) context->isBigEndian = !context->isBigEndian; - + isMacBinary = (context->fileType & GAME_MACBINARY) > 0; context->fileType &= ~GAME_MACBINARY; - + if (isMacBinary) { if (!loadMacContext(context)) { return false; @@ -447,7 +447,7 @@ bool Resource::createContexts() { sprintf(_voicesFileName[0], "voicesd.cmp"); _vm->_gf_compressed_sounds = true; } - } else if (Common::File::exists("inherit the earth voices") || + } else if (Common::File::exists("inherit the earth voices") || Common::File::exists("inherit the earth voices.cmp")) { _contextsCount++; voicesFileIndex = _contextsCount - 1; @@ -547,7 +547,7 @@ bool Resource::createContexts() { context->fileType = GAME_MUSICFILE; } else if (!soundFileInArray && i == soundFileIndex) { context->fileName = soundFileName; - context->fileType = GAME_SOUNDFILE; + context->fileType = GAME_SOUNDFILE; } else if (!voicesFileInArray && i == voicesFileIndex) { context->fileName = _voicesFileName[0]; // can be GAME_VOICEFILE or GAME_SOUNDFILE | GAME_VOICEFILE or GAME_VOICEFILE | GAME_SWAPENDIAN @@ -740,7 +740,7 @@ void Resource::loadGlobalResources(int chapter, int actorsEntrance) { } free(_vm->_sndRes->_fxTable); - + _vm->_sndRes->_fxTableLen = resourceLength / 4; _vm->_sndRes->_fxTable = (FxTable *)malloc(sizeof(FxTable) * _vm->_sndRes->_fxTableLen); @@ -791,7 +791,7 @@ void Resource::loadGlobalResources(int chapter, int actorsEntrance) { } free(_vm->_music->_songTable); - + _vm->_music->_songTableLen = resourceLength / 4; _vm->_music->_songTable = (int32 *)malloc(sizeof(int32) * _vm->_music->_songTableLen); diff --git a/engines/saga/rscfile.h b/engines/saga/rscfile.h index 765f362489..ee2181ae09 100644 --- a/engines/saga/rscfile.h +++ b/engines/saga/rscfile.h @@ -165,7 +165,7 @@ private: bool loadContext(ResourceContext *context); bool loadMacContext(ResourceContext *context); - bool loadSagaContext(ResourceContext *context, uint32 contextOffset, uint32 contextSize); + bool loadSagaContext(ResourceContext *context, uint32 contextOffset, uint32 contextSize); public: MetaResource _metaResource; diff --git a/engines/saga/saga.h b/engines/saga/saga.h index 9b6217ed19..85b1111503 100644 --- a/engines/saga/saga.h +++ b/engines/saga/saga.h @@ -445,8 +445,8 @@ enum ColorId { enum KnownColor { kKnownColorTransparent, - kKnownColorBrightWhite, - kKnownColorWhite, + kKnownColorBrightWhite, + kKnownColorWhite, kKnownColorBlack, kKnownColorSubtitleTextColor, @@ -655,8 +655,8 @@ private: public: ColorId KnownColor2ColorId(KnownColor knownColor); - void setTalkspeed(int talkspeed); - int getTalkspeed(); + void setTalkspeed(int talkspeed); + int getTalkspeed(); }; } // End of namespace Saga diff --git a/engines/saga/sagaresnames.h b/engines/saga/sagaresnames.h index 99d32a2d13..5bce483c3e 100644 --- a/engines/saga/sagaresnames.h +++ b/engines/saga/sagaresnames.h @@ -87,7 +87,7 @@ namespace Saga { #define RID_ITEDEMO_MAIN_PANEL 2 #define RID_ITEDEMO_CONVERSE_PANEL 3 -#define RID_ITEDEMO_OPTION_PANEL 3 // FIXME: should be 4 but it is an empty resource. +#define RID_ITEDEMO_OPTION_PANEL 3 // FIXME: should be 4 but it is an empty resource. #define RID_ITEDEMO_MAIN_SPRITES 5 // Proper fix would be not load options panel when demo is running #define RID_ITEDEMO_MAIN_PANEL_SPRITES 6 #define RID_ITEDEMO_MAIN_STRINGS 8 //main strings diff --git a/engines/saga/scene.cpp b/engines/saga/scene.cpp index 5390009616..4520c3f406 100644 --- a/engines/saga/scene.cpp +++ b/engines/saga/scene.cpp @@ -676,9 +676,9 @@ void Scene::loadScene(LoadSceneParams *loadSceneParams) { debug(3, "Loading scene number %d:", _sceneNumber); if (isNonInteractiveIHNMDemoPart()) { - // WORKAROUND for the non-interactive part of the IHNM demo: When restarting the + // WORKAROUND for the non-interactive part of the IHNM demo: When restarting the // non-interactive demo, opcode sfMainMode is incorrectly called. Therefore, if any - // of the scenes of the non-interactive demo are loaded (scenes 144-149), set panel + // of the scenes of the non-interactive demo are loaded (scenes 144-149), set panel // to null and lock the user interface _vm->_interface->deactivate(); _vm->_interface->setMode(kPanelNull); diff --git a/engines/saga/script.cpp b/engines/saga/script.cpp index cf61df8ea8..7664af314f 100644 --- a/engines/saga/script.cpp +++ b/engines/saga/script.cpp @@ -665,7 +665,7 @@ void Script::playfieldClick(const Point& mousePoint, bool leftButton) { doVerb(); return; } - } else { + } else { if (_vm->getGameType() == GType_IHNM) { if ((hitZone->getFlags() & kHitZoneNoWalk) && (_pendingVerb != getVerbType(kVerbWalkTo))) { doVerb(); @@ -738,8 +738,8 @@ void Script::playfieldClick(const Point& mousePoint, bool leftButton) { // (screens with Gorrister's heart) in IHNM. For some reason, this zone does // not have a corresponding action zone, so we auto-use it here, like the exits // in Benny's chapter - if (_vm->_scene->currentChapterNumber() == 1 && - _vm->_scene->currentSceneNumber() >= 16 && + if (_vm->_scene->currentChapterNumber() == 1 && + _vm->_scene->currentSceneNumber() >= 16 && _vm->_scene->currentSceneNumber() <= 19 && _pendingVerb == getVerbType(kVerbWalkTo) && hitZone != NULL && hitZone->getHitZoneId() == 24576) { @@ -813,7 +813,7 @@ void Script::whichObject(const Point& mousePoint) { // Note: for IHNM, the default right button action is "Look at" for actors, // but "Talk to" makes much more sense newRightButtonVerb = getVerbType(kVerbTalkTo); - // Slight hack because of the above change: the jukebox in Gorrister's chapter + // Slight hack because of the above change: the jukebox in Gorrister's chapter // is an actor, so change the right button action to "Look at" if (_vm->getGameType() == GType_IHNM && objectId == 8199) newRightButtonVerb = getVerbType(kVerbLookAt); diff --git a/engines/saga/sfuncs.cpp b/engines/saga/sfuncs.cpp index 39ca8ac112..4862ce3be0 100644 --- a/engines/saga/sfuncs.cpp +++ b/engines/saga/sfuncs.cpp @@ -840,7 +840,7 @@ void Script::sfDropObject(SCRIPTFUNC_PARAMS) { obj->_sceneNumber = _vm->_scene->currentSceneNumber(); // HACK for the compact disk in Ellen's chapter - // Change the scene number of the compact disk so that it's not shown. It will be shown + // Change the scene number of the compact disk so that it's not shown. It will be shown // once Ellen says that there's something different (i.e. after speaking with AM) // See Actor::actorSpeech for the other part of this hack if (_vm->getGameType() == GType_IHNM && _vm->_scene->currentChapterNumber() == 3 && @@ -982,7 +982,7 @@ void Script::sfCycleFrames(SCRIPTFUNC_PARAMS) { actor->_actorFlags |= kActorRandom; } if (flags & kCycleReverse) { - if (_vm->getGameType() == GType_IHNM && + if (_vm->getGameType() == GType_IHNM && _vm->_scene->currentChapterNumber() == 2 && _vm->_scene->currentSceneNumber() == 41) { // WORKAROUND: Prevent Benny from walking backwards after talking to the child via the monitor. This // occurs in the original as well, and is fixed by not setting the kActorBackwards flag at this point @@ -1728,7 +1728,7 @@ void Script::sfScriptStartCutAway(SCRIPTFUNC_PARAMS) { thread->pop(); // Not used int16 fade = thread->pop(); - _vm->_anim->setCutAwayMode(kPanelCutaway); + _vm->_anim->setCutAwayMode(kPanelCutaway); _vm->_anim->playCutaway(cut, fade != 0); } @@ -1804,7 +1804,7 @@ void Script::sfShowIHNMDemoHelpBg(SCRIPTFUNC_PARAMS) { } void Script::sfAddIHNMDemoHelpTextLine(SCRIPTFUNC_PARAMS) { - int stringId = thread->pop(); + int stringId = thread->pop(); TextListEntry textEntry; Event event; diff --git a/engines/saga/sndres.cpp b/engines/saga/sndres.cpp index 9f8a155e32..d6114b3fc4 100644 --- a/engines/saga/sndres.cpp +++ b/engines/saga/sndres.cpp @@ -172,7 +172,7 @@ bool SndRes::load(ResourceContext *context, uint32 resourceId, SoundBuffer &buff } else { soundInfo = _vm->getSfxInfo(); } - + context->table[resourceId].fillSoundPatch(soundInfo); MemoryReadStream readS(soundResource, soundResourceLength); @@ -184,8 +184,8 @@ bool SndRes::load(ResourceContext *context, uint32 resourceId, SoundBuffer &buff resourceType = kSoundVOC; } else if (!memcmp(soundResource, "RIFF", 4) != 0) { resourceType = kSoundWAV; - } - + } + bool uncompressedSound = false; // If patch data exists for sound resource 4 (used in ITE intro), don't treat this sound as compressed // Patch data for this resource is in file p2_a.iaf or p2_a.voc diff --git a/engines/saga/sprite.cpp b/engines/saga/sprite.cpp index 34b54e30f9..b5c675a403 100644 --- a/engines/saga/sprite.cpp +++ b/engines/saga/sprite.cpp @@ -120,7 +120,7 @@ void Sprite::loadList(int resourceId, SpriteList &spriteList) { if (offset >= spriteListLength) { // ITE Mac demos throw this warning warning("Sprite::loadList offset exceeded"); - return; + return; } spritePointer = spriteListData; diff --git a/engines/saga/xref.txt b/engines/saga/xref.txt index 1d3aff0824..ea775f5b2e 100644 --- a/engines/saga/xref.txt +++ b/engines/saga/xref.txt @@ -9,7 +9,7 @@ Watcom C++ arguments order: Sceneres.h ========== - LOADREQ_FIGURE + LOADREQ_FIGURE LOADREQ_OBJECT LOADREQ_BACKGROUND SAGA_BG_IMAGE LOADREQ_ZBUF SAGA_BG_MASK diff --git a/engines/scumm/cursor.cpp b/engines/scumm/cursor.cpp index 899f920247..0d0e7b054b 100644 --- a/engines/scumm/cursor.cpp +++ b/engines/scumm/cursor.cpp @@ -163,7 +163,7 @@ void ScummEngine_v70he::setCursorFromImg(uint img, uint room, uint imgindex) { void ScummEngine_v70he::setDefaultCursor() { const uint16 *src; int i, j; - static const byte palette[] = {0, 0, 0, 0, + static const byte palette[] = {0, 0, 0, 0, 0xff, 0xff, 0xff, 0, 0, 0, 0, 0}; diff --git a/engines/scumm/detection.h b/engines/scumm/detection.h index bc67aafb7e..26f6be8fec 100644 --- a/engines/scumm/detection.h +++ b/engines/scumm/detection.h @@ -39,7 +39,7 @@ struct GameSettings { * The gameid of this game. */ const char *gameid; - + /** * An identifier which can be used to distinguish game variants. * This string is also used to augment the description string @@ -51,13 +51,13 @@ struct GameSettings { * variant. Failing to obey this rule can lead to odd bugs. */ const char *variant; - + /** * An optional string that will be added to the 'preferredtarget' * computed by the detector. */ const char *preferredTag; - + /** * The numerical gameid of this game. * This is not in one-to-one correspondence with the gameid above. @@ -72,16 +72,16 @@ struct GameSettings { /** The HE subversion. */ byte heversion; - + /** MidiDriverFlags values */ int midi; - + /** * Bitmask obtained by ORing various GameFeatures enums, and used * to en-/disable certain features of this game variant. */ uint32 features; - + /** * Platform indicator, this is set to a value different from * kPlatformUnknown if this game variant only existed for this diff --git a/engines/scumm/dialogs.cpp b/engines/scumm/dialogs.cpp index 8977bc108f..e008ce2179 100644 --- a/engines/scumm/dialogs.cpp +++ b/engines/scumm/dialogs.cpp @@ -981,7 +981,7 @@ void DebugInputDialog::handleKeyDown(Common::KeyState state) { draw(); reflowLayout(); setInfoText(total); - } + } } } // End of namespace Scumm diff --git a/engines/scumm/dialogs.h b/engines/scumm/dialogs.h index b4cf8b1f85..7c99a0ebcc 100644 --- a/engines/scumm/dialogs.h +++ b/engines/scumm/dialogs.h @@ -124,7 +124,7 @@ protected: int _page; int _numPages; - + const GameSettings _game; void displayKeyBindings(); @@ -251,7 +251,7 @@ public: protected: int _value; uint32 _timer; - + void cycleValue(); }; diff --git a/engines/scumm/file_nes.cpp b/engines/scumm/file_nes.cpp index 88b4253a1d..95f5eec4ea 100644 --- a/engines/scumm/file_nes.cpp +++ b/engines/scumm/file_nes.cpp @@ -471,7 +471,7 @@ static const ScummNESFile::Resource res_scripts_esp[179] = { { 0x247C5, 0x0027, NES_SCRIPT }, { 0x1A08C, 0x004E, NES_SCRIPT }, { 0x00000, 0x0000, NES_SCRIPT }, { 0x2B21B, 0x00A5, NES_SCRIPT }, { 0x2A0D1, 0x00B1, NES_SCRIPT }, { 0x2A182, 0x0140, NES_SCRIPT }, { 0x197CF, 0x00BE, NES_SCRIPT }, { 0x1988D, 0x014D, NES_SCRIPT }, { 0x199DA, 0x0012, NES_SCRIPT }, { 0x2A2C2, 0x0005, NES_SCRIPT }, { 0x2A2C7, 0x0005, NES_SCRIPT }, { 0x2A2CC, 0x0005, NES_SCRIPT }, { 0x2A2D1, 0x0005, NES_SCRIPT }, { 0x2A2D6, 0x0005, NES_SCRIPT }, { 0x216E8, 0x0033, NES_SCRIPT }, - { 0x2A2DB, 0x0005, NES_SCRIPT }, { 0x00000, 0x0000, NES_SCRIPT }, { 0x2A2E0, 0x009C, NES_SCRIPT }, { 0x2A37C, 0x009C, NES_SCRIPT } + { 0x2A2DB, 0x0005, NES_SCRIPT }, { 0x00000, 0x0000, NES_SCRIPT }, { 0x2A2E0, 0x009C, NES_SCRIPT }, { 0x2A37C, 0x009C, NES_SCRIPT } }; static const ScummNESFile::Resource *res_scripts[ScummNESFile::kROMsetNum] = { diff --git a/engines/scumm/gfx.cpp b/engines/scumm/gfx.cpp index 27b24ac23c..f28cbb3548 100644 --- a/engines/scumm/gfx.cpp +++ b/engines/scumm/gfx.cpp @@ -263,7 +263,7 @@ void GdiV1::roomChanged(byte *roomptr) { decodeC64Gfx(roomptr + READ_LE_UINT16(roomptr + 12), _C64.picMap, roomptr[4] * roomptr[5]); decodeC64Gfx(roomptr + READ_LE_UINT16(roomptr + 14), _C64.colorMap, roomptr[4] * roomptr[5]); decodeC64Gfx(roomptr + READ_LE_UINT16(roomptr + 16), _C64.maskMap, roomptr[4] * roomptr[5]); - + // Read the mask data. The 16bit length value seems to always be 8 too big. // See bug #1837375 for details on this. const byte *maskPtr = roomptr + READ_LE_UINT16(roomptr + 18); diff --git a/engines/scumm/he/animation_he.h b/engines/scumm/he/animation_he.h index d93c1317d7..1d04c3e5df 100644 --- a/engines/scumm/he/animation_he.h +++ b/engines/scumm/he/animation_he.h @@ -47,7 +47,7 @@ class MoviePlayer : public Graphics::DXAPlayer { char baseName[40]; uint32 _flags; uint32 _wizResNum; - + public: MoviePlayer(ScummEngine_v90he *vm, Audio::Mixer *mixer); diff --git a/engines/scumm/he/resource_he.h b/engines/scumm/he/resource_he.h index 5e7a6bb96b..08f9a8108a 100644 --- a/engines/scumm/he/resource_he.h +++ b/engines/scumm/he/resource_he.h @@ -181,7 +181,7 @@ class Win32ResExtractor : public ResExtractor { int level; bool numeric_id; bool is_directory; - + char *get_resource_id_quoted(); } PACKED_STRUCT; diff --git a/engines/scumm/he/script_v72he.cpp b/engines/scumm/he/script_v72he.cpp index a3b1fd2c6b..c03be592d6 100644 --- a/engines/scumm/he/script_v72he.cpp +++ b/engines/scumm/he/script_v72he.cpp @@ -1709,7 +1709,7 @@ void ScummEngine_v72he::o72_openFile() { int ScummEngine_v72he::readFileToArray(int slot, int32 size) { writeVar(0, 0); byte *data = defineArray(0, kByteArray, 0, 0, 0, size); - + if (slot != -1) { _hInFileTable[slot]->read(data, size + 1); } diff --git a/engines/scumm/he/sound_he.h b/engines/scumm/he/sound_he.h index 5ee1f9e0b9..47ff145e6b 100644 --- a/engines/scumm/he/sound_he.h +++ b/engines/scumm/he/sound_he.h @@ -61,7 +61,7 @@ public: // Used by createSound() public: SoundHE(ScummEngine *parent, Audio::Mixer *mixer); ~SoundHE(); - + virtual void addSoundToQueue(int sound, int heOffset = 0, int heChannel = 0, int heFlags = 0); virtual void addSoundToQueue2(int sound, int heOffset = 0, int heChannel = 0, int heFlags = 0); diff --git a/engines/scumm/imuse_digi/dimuse_track.cpp b/engines/scumm/imuse_digi/dimuse_track.cpp index a1a41ef251..d3c61a6a80 100644 --- a/engines/scumm/imuse_digi/dimuse_track.cpp +++ b/engines/scumm/imuse_digi/dimuse_track.cpp @@ -93,7 +93,7 @@ void IMuseDigital::startSound(int soundId, const char *soundName, int soundType, debug(5, "IMuseDigital::startSound(%d, trackId:%d)", soundId, l); Track *track = _track[l]; - + // Reset the track memset(track, 0, sizeof(Track)); diff --git a/engines/scumm/imuse_digi/dimuse_track.h b/engines/scumm/imuse_digi/dimuse_track.h index e613798569..0c6445c43a 100644 --- a/engines/scumm/imuse_digi/dimuse_track.h +++ b/engines/scumm/imuse_digi/dimuse_track.h @@ -81,7 +81,7 @@ struct Track { Track() : soundId(-1), used(false), stream(NULL) { } - + int getPan() const { return (pan != 64) ? 2 * pan - 127 : 0; } int getVol() const { return vol / 1000; } Audio::Mixer::SoundType getType() const { diff --git a/engines/scumm/intern.h b/engines/scumm/intern.h index 3339780991..c693787e83 100644 --- a/engines/scumm/intern.h +++ b/engines/scumm/intern.h @@ -61,7 +61,7 @@ protected: uint16 xStrips, yStrips; bool isDrawn; } _flashlight; - + char _saveLoadVarsFilename[256]; public: @@ -283,7 +283,7 @@ protected: V2MouseoverBox _mouseOverBoxesV2[7]; int8 _mouseOverBoxV2; - + char _sentenceBuf[256]; int _activeInventory; @@ -568,7 +568,7 @@ protected: int16 xpos, ypos; byte color; byte charset; - byte text[256]; + byte text[256]; }; /** BlastObjects to draw */ @@ -879,7 +879,7 @@ public: char tag[12+1]; int32 offset; }; - + protected: int _verbLineSpacing; bool _existLanguageFile; @@ -893,7 +893,7 @@ protected: int16 xpos, ypos; byte color; byte charset; - byte text[256]; + byte text[256]; bool actorSpeechMsg; }; #else diff --git a/engines/scumm/module.mk b/engines/scumm/module.mk index 47c1a9e55c..3a50bcab8c 100644 --- a/engines/scumm/module.mk +++ b/engines/scumm/module.mk @@ -120,5 +120,5 @@ ifdef BUILD_PLUGINS PLUGIN := 1 endif -# Include common rules +# Include common rules include $(srcdir)/rules.mk diff --git a/engines/scumm/object.h b/engines/scumm/object.h index f27e6a501e..2a817b2b88 100644 --- a/engines/scumm/object.h +++ b/engines/scumm/object.h @@ -45,7 +45,7 @@ enum ObjectStateV2 { // FIXME: Not quite sure how to name state 8. It seems to mark some kind // of "activation state" for the given object. E.g. is a door open? // Is a drawer extended? In addition it is used to toggle the look - // of objects that the user can "pick up" (i.e. it is set in + // of objects that the user can "pick up" (i.e. it is set in // o2_pickupObject together with kObjectStateUntouchable). So in a sense, // it can also mean "invisible" in some situations. kObjectState_08 = 8 diff --git a/engines/scumm/saveload.cpp b/engines/scumm/saveload.cpp index 07b4141620..fac3ad9975 100644 --- a/engines/scumm/saveload.cpp +++ b/engines/scumm/saveload.cpp @@ -597,10 +597,10 @@ void ScummEngine::saveInfos(Common::OutSaveFile* file) { // still save old format for older versions section.timeTValue = time(0); section.playtime = _system->getMillis() / 1000 - _engineStartTime; - + tm curTime; _system->getTimeAndDate(curTime); - + section.date = (curTime.tm_mday & 0xFF) << 24 | ((curTime.tm_mon + 1) & 0xFF) << 16 | (curTime.tm_year + 1900) & 0xFFFF; section.time = (curTime.tm_hour & 0xFF) << 8 | (curTime.tm_min) & 0xFF; @@ -1257,7 +1257,7 @@ void ScummEngine_v7::saveOrLoad(Serializer *s) { s->saveLoadArrayOf(_subtitleQueue, ARRAYSIZE(_subtitleQueue), sizeof(_subtitleQueue[0]), subtitleQueueEntries); s->saveLoadEntries(this, V7Entries); - + if (s->getVersion() <= VER(68) && s->isLoading()) { // WORKAROUND bug #1846049: Reset the default charset color to a sane value. _string[0]._default.charset = 1; diff --git a/engines/scumm/script_v6.cpp b/engines/scumm/script_v6.cpp index 599d70f280..2d195026ef 100644 --- a/engines/scumm/script_v6.cpp +++ b/engines/scumm/script_v6.cpp @@ -2384,7 +2384,7 @@ void ScummEngine_v6::o6_talkActor() { _forcedWaitForMessage = false; _scriptPointer += resStrLen(_scriptPointer) + 1; - + return; } diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h index fa86dec650..41f7784d36 100644 --- a/engines/scumm/scumm.h +++ b/engines/scumm/scumm.h @@ -391,7 +391,7 @@ public: void increaseResourceCounter(); void resourceStats(); - + //protected: bool validateResource(const char *str, int type, int index) const; protected: @@ -434,7 +434,7 @@ public: protected: VirtualMachineState vm; - + bool _oldSoundsPaused; public: @@ -474,7 +474,7 @@ protected: virtual void scummLoop_handleActors() = 0; virtual void scummLoop_handleEffects(); virtual void scummLoop_handleSound(); - + virtual void runBootscript(); // Event handling diff --git a/engines/scumm/sound.cpp b/engines/scumm/sound.cpp index c27b34eb62..ae337030e1 100644 --- a/engines/scumm/sound.cpp +++ b/engines/scumm/sound.cpp @@ -394,7 +394,7 @@ void Sound::playSound(int soundID) { */ } else if ((_vm->_game.platform == Common::kPlatformMacintosh) && (_vm->_game.id == GID_INDY3) && (ptr[26] == 0)) { - // Sound fomat as used in Indy3 EGA Mac. + // Sound fomat as used in Indy3 EGA Mac. // It seems to be closely related to the Amiga format, see player_v3a.cpp // The following is known: // offset 0, 16 LE: total size @@ -424,7 +424,7 @@ void Sound::playSound(int soundID) { if (loopcount > 1) { // TODO: We can only loop once, or infinitely many times, but // have no support for a finite number of repetitions. - // This is + // This is loopStart = READ_BE_UINT16(ptr + 10) - READ_BE_UINT16(ptr + 8); loopEnd = READ_BE_UINT16(ptr + 14); flags |= Audio::Mixer::FLAG_LOOP; diff --git a/engines/scumm/verbs.cpp b/engines/scumm/verbs.cpp index cfc6afed7a..0648b7a641 100644 --- a/engines/scumm/verbs.cpp +++ b/engines/scumm/verbs.cpp @@ -635,7 +635,7 @@ void ScummEngine_v2::checkExecVerbs() { } } } - + // Generic keyboard input runInputScript(4, _mouseAndKeyboardStat, 1); } else if (_mouseAndKeyboardStat & MBS_MOUSE_MASK) { diff --git a/engines/sky/module.mk b/engines/sky/module.mk index 7d53615bd0..67b3b19e5d 100644 --- a/engines/sky/module.mk +++ b/engines/sky/module.mk @@ -28,5 +28,5 @@ ifdef BUILD_PLUGINS PLUGIN := 1 endif -# Include common rules +# Include common rules include $(srcdir)/rules.mk diff --git a/engines/sky/music/adlibchannel.h b/engines/sky/music/adlibchannel.h index d73de0b0de..67c0b5d176 100644 --- a/engines/sky/music/adlibchannel.h +++ b/engines/sky/music/adlibchannel.h @@ -78,7 +78,7 @@ private: uint8 *_instrumentMap; uint8 *_registerTable, *_opOutputTable; uint8 *_adlibRegMirror; - + // normal subs void setRegister(uint8 regNum, uint8 value); int32 getNextEventTime(void); @@ -87,7 +87,7 @@ private: void setupInstrument(uint8 opcode); void setupChannelVolume(uint8 volume); void stopNote(void); - + // Streamfunctions from Command90hTable void com90_caseNoteOff(void); // 0 void com90_stopChannel(void); // 1 diff --git a/engines/sky/music/gmchannel.cpp b/engines/sky/music/gmchannel.cpp index d7d2ba854b..fc35fed391 100644 --- a/engines/sky/music/gmchannel.cpp +++ b/engines/sky/music/gmchannel.cpp @@ -119,7 +119,7 @@ uint8 GmChannel::process(uint16 aktTime) { case 11: com90_getChannelPanValue(); break; case 12: com90_setLoopPoint(); break; case 13: com90_getChannelControl(); break; - + default: error("GmChannel: Unknown music opcode 0x%02X", opcode); break; diff --git a/engines/sky/music/mt32music.cpp b/engines/sky/music/mt32music.cpp index 2be19a0651..aa784e7437 100644 --- a/engines/sky/music/mt32music.cpp +++ b/engines/sky/music/mt32music.cpp @@ -102,10 +102,10 @@ bool MT32Music::processPatchSysEx(uint8 *sysExData) { return false; // decompress data from stream - sysExBuf[ 0] = 0x41; - sysExBuf[ 1] = 0x10; - sysExBuf[ 2] = 0x16; - sysExBuf[ 3] = 0x12; + sysExBuf[ 0] = 0x41; + sysExBuf[ 1] = 0x10; + sysExBuf[ 2] = 0x16; + sysExBuf[ 3] = 0x12; sysExBuf[ 4] = 0x5; sysExBuf[ 5] = sysExData[0] >> 4; // patch offset part 1 sysExBuf[ 6] = (sysExData[0] & 0xF) << 3; // patch offset part 2 diff --git a/engines/sky/music/musicbase.cpp b/engines/sky/music/musicbase.cpp index b6ea150d94..9bf7a62a21 100644 --- a/engines/sky/music/musicbase.cpp +++ b/engines/sky/music/musicbase.cpp @@ -146,10 +146,10 @@ void MusicBase::startMusic(uint16 param) { _onNextPoll.musicToProcess = param & 0xF; } -uint8 MusicBase::giveVolume(void) { - return (uint8)_musicVolume; +uint8 MusicBase::giveVolume(void) { + return (uint8)_musicVolume; } - + uint8 MusicBase::giveCurrentMusic(void) { return _currentMusic; } diff --git a/engines/sword1/animation.h b/engines/sword1/animation.h index db3ea75fd9..0837814c69 100644 --- a/engines/sword1/animation.h +++ b/engines/sword1/animation.h @@ -132,9 +132,9 @@ protected: void updateScreen(void); }; -#endif +#endif -#ifdef USE_MPEG2 +#ifdef USE_MPEG2 class AnimationState : public Graphics::BaseAnimationState { private: diff --git a/engines/sword1/module.mk b/engines/sword1/module.mk index 5db32e57c1..1ee62af853 100644 --- a/engines/sword1/module.mk +++ b/engines/sword1/module.mk @@ -25,5 +25,5 @@ ifdef BUILD_PLUGINS PLUGIN := 1 endif -# Include common rules +# Include common rules include $(srcdir)/rules.mk diff --git a/engines/sword1/resman.h b/engines/sword1/resman.h index 2bd3955db5..a0a8bb6c4c 100644 --- a/engines/sword1/resman.h +++ b/engines/sword1/resman.h @@ -78,7 +78,7 @@ public: Header *lockScript(uint32 scrID); void unlockScript(uint32 scrID); FrameHeader *fetchFrame(void *resourceData, uint32 frameNo); - + uint16 getUint16(uint16 value) { return (_isBigEndian) ? FROM_BE_16(value): FROM_LE_16(value); } diff --git a/engines/sword2/header.h b/engines/sword2/header.h index 3e4cc0a6ae..5100e43de1 100644 --- a/engines/sword2/header.h +++ b/engines/sword2/header.h @@ -183,7 +183,7 @@ struct AnimHeader { writeS.writeByte(feetEndDir); writeS.writeUint16LE(blend); } - + }; // runtimeComp - compression used on each frame of the anim diff --git a/engines/sword2/module.mk b/engines/sword2/module.mk index 25d73ab775..3b21023fa8 100644 --- a/engines/sword2/module.mk +++ b/engines/sword2/module.mk @@ -38,5 +38,5 @@ ifdef BUILD_PLUGINS PLUGIN := 1 endif -# Include common rules +# Include common rules include $(srcdir)/rules.mk diff --git a/engines/sword2/mouse.h b/engines/sword2/mouse.h index c7d90cc6fe..09ac9ced20 100644 --- a/engines/sword2/mouse.h +++ b/engines/sword2/mouse.h @@ -76,7 +76,7 @@ enum { #define RDMENU_MAXPOCKETS 15 #define MOUSE_ANIM_HEADER_SIZE 6 - + struct MouseAnim { uint8 runTimeComp; // type of runtime compression used for the // frame data diff --git a/engines/sword2/object.h b/engines/sword2/object.h index ce894e287b..7ee8766105 100644 --- a/engines/sword2/object.h +++ b/engines/sword2/object.h @@ -280,7 +280,7 @@ public: // walk-data structure - contains details of layout of frames in the // mega-set, and how they are to be used -struct ObjectWalkdata { +struct ObjectWalkdata { int32 nWalkFrames; // no. of frames per walk-cycle int32 usingStandingTurnFrames; // 0 = no 1 = yes int32 usingWalkingTurnFrames; // 0 = no 1 = yes -- cgit v1.2.3