From 696897b0583ad52ebc6f7666525277847619a8ce Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 1 Jan 2009 15:06:43 +0000 Subject: Whoa! Removing trailing spaces. svn-id: r35648 --- backends/events/default/default-events.cpp | 10 +- backends/fs/ds/ds-fs.cpp | 8 +- backends/fs/posix/posix-fs.cpp | 16 +- backends/fs/posix/posix-fs.h | 4 +- backends/fs/ps2/ps2-fs-factory.h | 8 +- backends/fs/ps2/ps2-fs.cpp | 24 +- backends/fs/symbian/symbian-fs.cpp | 6 +- backends/fs/symbian/symbianstream.cpp | 42 +- backends/fs/wii/wii-fs.cpp | 2 +- backends/midi/stmidi.cpp | 4 +- backends/platform/PalmOS/Src/init_mathlib.cpp | 2 +- backends/platform/PalmOS/Src/init_sony.h | 2 +- backends/platform/PalmOS/Src/rumble.cpp | 2 +- backends/platform/PalmOS/Src/rumble.h | 2 +- backends/platform/dc/dc-fs.cpp | 2 +- backends/platform/ds/arm9/source/blitters.cpp | 108 ++-- backends/platform/ds/arm9/source/cdaudio.cpp | 166 +++--- backends/platform/ds/arm9/source/cdaudio.h | 2 +- backends/platform/ds/arm9/source/console2.h | 4 +- backends/platform/ds/arm9/source/dsmain.cpp | 616 ++++++++++----------- backends/platform/ds/arm9/source/dsmain.h | 4 +- backends/platform/ds/arm9/source/dsoptions.cpp | 38 +- backends/platform/ds/arm9/source/fat/disc_io.h | 6 +- backends/platform/ds/arm9/source/fat/gba_nds_fat.h | 28 +- backends/platform/ds/arm9/source/fat/io_dldi.h | 4 +- backends/platform/ds/arm9/source/fat/io_fcsr.h | 4 +- .../platform/ds/arm9/source/fat/io_m3_common.h | 6 +- backends/platform/ds/arm9/source/fat/io_m3cf.h | 4 +- backends/platform/ds/arm9/source/fat/io_mmcf.h | 2 +- backends/platform/ds/arm9/source/fat/io_mpcf.h | 4 +- backends/platform/ds/arm9/source/fat/io_njsd.h | 4 +- backends/platform/ds/arm9/source/fat/io_nmmc.h | 4 +- backends/platform/ds/arm9/source/fat/io_sccf.h | 4 +- backends/platform/ds/arm9/source/fat/io_scsd.h | 8 +- .../platform/ds/arm9/source/fat/io_sd_common.h | 10 +- backends/platform/ds/arm9/source/gbampsave.cpp | 44 +- backends/platform/ds/arm9/source/gbampsave.h | 18 +- backends/platform/ds/arm9/source/keys.cpp | 16 +- backends/platform/ds/arm9/source/osystem_ds.cpp | 98 ++-- backends/platform/ds/arm9/source/osystem_ds.h | 30 +- backends/platform/ds/arm9/source/portdefs.h | 4 +- backends/platform/ds/arm9/source/ramsave.cpp | 82 +-- backends/platform/ds/arm9/source/ramsave.h | 44 +- backends/platform/ds/arm9/source/scummconsole.h | 2 +- backends/platform/ds/arm9/source/scummhelp.cpp | 2 +- backends/platform/ds/arm9/source/scummhelp.h | 4 +- backends/platform/ds/arm9/source/touchkeyboard.cpp | 104 ++-- backends/platform/ds/arm9/source/touchkeyboard.h | 2 +- .../platform/ds/arm9/source/wordcompletion.cpp | 16 +- backends/platform/ds/arm9/source/zipreader.cpp | 62 +-- backends/platform/ds/arm9/source/zipreader.h | 16 +- backends/platform/iphone/osys_iphone.cpp | 50 +- backends/platform/iphone/osys_iphone.h | 6 +- backends/platform/ps2/Gs2dScreen.cpp | 10 +- backends/platform/ps2/fileio.cpp | 2 +- backends/platform/ps2/iop/rpckbd/include/ps2kbd.h | 2 +- backends/platform/ps2/iop/rpckbd/src/irx_imports.h | 2 +- backends/platform/ps2/iop/rpckbd/src/us_keymap.h | 50 +- backends/platform/ps2/irxboot.cpp | 4 +- backends/platform/ps2/savefilemgr.cpp | 6 +- backends/platform/ps2/savefilemgr.h | 2 +- backends/platform/ps2/systemps2.cpp | 10 +- backends/platform/psp/osys_psp.cpp | 4 +- backends/platform/psp/osys_psp_gu.cpp | 2 +- backends/platform/sdl/graphics.cpp | 4 +- backends/platform/sdl/sdl.h | 2 +- backends/platform/symbian/src/SymbianActions.cpp | 2 +- backends/platform/symbian/src/SymbianOS.cpp | 10 +- backends/platform/symbian/src/vsnprintf.h | 38 +- backends/platform/wii/gx_supp.h | 2 +- backends/platform/wii/osystem.cpp | 2 +- backends/platform/wii/osystem_gfx.cpp | 2 +- backends/platform/wince/CEActionsPocket.cpp | 4 +- backends/platform/wince/wince-sdl.cpp | 8 +- backends/platform/wince/wince-sdl.h | 2 +- backends/saves/default/default-saves.cpp | 2 +- backends/saves/posix/posix-saves.cpp | 2 +- backends/saves/psp/psp-saves.cpp | 2 +- common/fs.h | 2 +- common/unzip.cpp | 2 +- engines/agi/detection.cpp | 14 +- engines/agi/loader_v3.cpp | 2 +- engines/agi/saveload.cpp | 2 +- engines/agos/agos.cpp | 6 +- engines/agos/detection.cpp | 4 +- engines/agos/sound.cpp | 4 +- engines/agos/subroutine.cpp | 2 +- engines/agos/vga_s1.cpp | 2 +- engines/cine/anim.cpp | 2 +- engines/cine/bg_list.cpp | 2 +- engines/cine/cine.cpp | 4 +- engines/cine/detection.cpp | 6 +- engines/cine/gfx.cpp | 4 +- engines/cine/main_loop.cpp | 4 +- engines/cine/msg.cpp | 2 +- engines/cine/pal.cpp | 2 +- engines/cine/part.cpp | 4 +- engines/cine/saveload.cpp | 28 +- engines/cine/script_os.cpp | 2 +- engines/cine/unpack.h | 2 +- engines/cine/various.cpp | 18 +- engines/cruise/ctp.cpp | 4 +- engines/cruise/overlay.cpp | 8 +- engines/dialogs.cpp | 12 +- engines/drascula/animation.cpp | 2 +- engines/drascula/converse.cpp | 6 +- engines/drascula/drascula.cpp | 10 +- engines/drascula/graphics.cpp | 6 +- engines/drascula/objects.cpp | 2 +- engines/drascula/rooms.cpp | 16 +- engines/drascula/talk.cpp | 8 +- engines/engine.cpp | 6 +- engines/engine.h | 14 +- engines/game.cpp | 4 +- engines/game.h | 4 +- engines/gob/coktelvideo.cpp | 6 +- engines/gob/driver_vga.cpp | 4 +- engines/gob/game_v6.cpp | 6 +- engines/gob/goblin_v4.cpp | 8 +- engines/gob/indeo3.h | 2 +- engines/gob/mult_v2.cpp | 4 +- engines/gob/saveload.cpp | 2 +- engines/gob/saveload.h | 2 +- engines/gob/saveload_v2.cpp | 2 +- engines/gob/saveload_v3.cpp | 4 +- engines/gob/saveload_v4.cpp | 2 +- engines/gob/saveload_v6.cpp | 2 +- engines/gob/sound/soundblaster.cpp | 2 +- engines/gob/util.cpp | 4 +- engines/gob/video_v6.cpp | 2 +- engines/gob/videoplayer.cpp | 2 +- engines/groovie/cell.cpp | 8 +- engines/groovie/detection.cpp | 18 +- engines/groovie/font.cpp | 4 +- engines/groovie/groovie.cpp | 8 +- engines/groovie/module.mk | 2 +- engines/groovie/roq.cpp | 2 +- engines/groovie/script.cpp | 68 +-- engines/groovie/vdx.cpp | 4 +- engines/kyra/animator_hof.cpp | 4 +- engines/kyra/animator_mr.cpp | 4 +- engines/kyra/debugger.cpp | 4 +- engines/kyra/detection.cpp | 30 +- engines/kyra/gui.cpp | 4 +- engines/kyra/gui_hof.cpp | 24 +- engines/kyra/gui_lok.cpp | 2 +- engines/kyra/gui_mr.cpp | 32 +- engines/kyra/gui_v2.cpp | 12 +- engines/kyra/gui_v2.h | 2 +- engines/kyra/items_mr.cpp | 12 +- engines/kyra/kyra_hof.cpp | 18 +- engines/kyra/kyra_hof.h | 4 +- engines/kyra/kyra_mr.cpp | 20 +- engines/kyra/kyra_mr.h | 8 +- engines/kyra/kyra_v1.cpp | 6 +- engines/kyra/kyra_v1.h | 2 +- engines/kyra/kyra_v2.cpp | 2 +- engines/kyra/kyra_v2.h | 2 +- engines/kyra/lol.cpp | 106 ++-- engines/kyra/lol.h | 24 +- engines/kyra/resource.cpp | 2 +- engines/kyra/resource_intern.cpp | 52 +- engines/kyra/saveload.cpp | 2 +- engines/kyra/saveload_hof.cpp | 6 +- engines/kyra/saveload_lok.cpp | 6 +- engines/kyra/saveload_mr.cpp | 4 +- engines/kyra/scene_hof.cpp | 4 +- engines/kyra/scene_mr.cpp | 2 +- engines/kyra/screen.cpp | 34 +- engines/kyra/screen.h | 4 +- engines/kyra/screen_lok.h | 2 +- engines/kyra/screen_lol.cpp | 4 +- engines/kyra/screen_lol.h | 2 +- engines/kyra/screen_v2.cpp | 8 +- engines/kyra/screen_v2.h | 4 +- engines/kyra/script_hof.cpp | 32 +- engines/kyra/script_lok.cpp | 2 +- engines/kyra/script_mr.cpp | 10 +- engines/kyra/script_tim.cpp | 38 +- engines/kyra/script_tim.h | 16 +- engines/kyra/sequences_hof.cpp | 28 +- engines/kyra/sequences_mr.cpp | 6 +- engines/kyra/sound.h | 6 +- engines/kyra/sound_adlib.cpp | 2 +- engines/kyra/sound_digital.cpp | 8 +- engines/kyra/sound_midi.cpp | 10 +- engines/kyra/sound_towns.cpp | 66 +-- engines/kyra/staticres.cpp | 22 +- engines/kyra/text_mr.cpp | 22 +- engines/kyra/timer.cpp | 2 +- engines/kyra/vqa.cpp | 2 +- engines/kyra/wsamovie.cpp | 2 +- engines/lure/detection.cpp | 2 +- engines/lure/game.cpp | 6 +- engines/lure/hotspots.cpp | 4 +- engines/lure/intro.cpp | 2 +- engines/lure/lure.cpp | 6 +- engines/lure/res_struct.cpp | 4 +- engines/lure/sound.cpp | 2 +- engines/m4/actor.cpp | 8 +- engines/m4/actor.h | 2 +- engines/m4/animation.cpp | 8 +- engines/m4/animation.h | 2 +- engines/m4/assets.cpp | 14 +- engines/m4/assets.h | 2 +- engines/m4/compression.cpp | 10 +- engines/m4/console.cpp | 6 +- engines/m4/converse.cpp | 50 +- engines/m4/events.cpp | 12 +- engines/m4/events.h | 6 +- engines/m4/font.cpp | 14 +- engines/m4/globals.cpp | 10 +- engines/m4/globals.h | 12 +- engines/m4/graphics.cpp | 58 +- engines/m4/graphics.h | 14 +- engines/m4/gui.cpp | 124 ++--- engines/m4/gui.h | 34 +- engines/m4/hotspot.cpp | 2 +- engines/m4/m4.cpp | 16 +- engines/m4/m4.h | 2 +- engines/m4/m4_menus.cpp | 54 +- engines/m4/m4_views.cpp | 28 +- engines/m4/m4_views.h | 6 +- engines/m4/mads_anim.cpp | 26 +- engines/m4/mads_anim.h | 2 +- engines/m4/mads_menus.cpp | 38 +- engines/m4/midi.h | 4 +- engines/m4/rails.cpp | 10 +- engines/m4/resource.cpp | 14 +- engines/m4/saveload.cpp | 6 +- engines/m4/scene.cpp | 6 +- engines/m4/scene.h | 2 +- engines/m4/script.cpp | 76 +-- engines/m4/script.h | 14 +- engines/m4/sound.cpp | 10 +- engines/m4/sprite.cpp | 2 +- engines/m4/viewmgr.cpp | 16 +- engines/m4/viewmgr.h | 4 +- engines/m4/woodscript.cpp | 20 +- engines/m4/woodscript.h | 16 +- engines/m4/ws_machine.cpp | 4 +- engines/m4/ws_sequence.cpp | 32 +- engines/made/database.cpp | 14 +- engines/made/database.h | 8 +- engines/made/detection.cpp | 2 +- engines/made/graphics.cpp | 2 +- engines/made/made.cpp | 4 +- engines/made/pmvplayer.cpp | 10 +- engines/made/redreader.cpp | 4 +- engines/made/resource.cpp | 14 +- engines/made/resource.h | 2 +- engines/made/screen.cpp | 68 +-- engines/made/screen.h | 34 +- engines/made/script.cpp | 16 +- engines/made/scriptfuncs.cpp | 16 +- engines/made/scriptfuncs.h | 2 +- engines/made/sound.cpp | 2 +- engines/metaengine.h | 12 +- engines/queen/queen.cpp | 6 +- engines/queen/queen.h | 2 +- engines/saga/detection.cpp | 12 +- engines/saga/interface.cpp | 8 +- engines/saga/introproc_fta2.cpp | 6 +- engines/saga/itedata.cpp | 2 +- engines/saga/music.cpp | 4 +- engines/saga/render.cpp | 2 +- engines/saga/resource_hrs.cpp | 2 +- engines/saga/saga.cpp | 2 +- engines/saga/script.cpp | 2 +- engines/saga/sfuncs.cpp | 2 +- engines/saga/sndres.cpp | 6 +- engines/saga/sound.cpp | 14 +- engines/saga/sound.h | 2 +- engines/saga/sprite.cpp | 2 +- engines/scumm/actor.cpp | 6 +- engines/scumm/detection.cpp | 10 +- engines/scumm/dialogs.cpp | 20 +- engines/scumm/gfx.cpp | 6 +- engines/scumm/he/resource_he.cpp | 2 +- engines/scumm/he/script_v80he.cpp | 4 +- engines/scumm/he/wiz_he.cpp | 2 +- engines/scumm/player_v2a.cpp | 4 +- engines/scumm/scumm.h | 2 +- engines/scumm/smush/codec47.cpp | 2 +- engines/scumm/smush/imuse_channel.cpp | 2 +- engines/sky/detection.cpp | 6 +- engines/sword1/control.cpp | 10 +- engines/sword1/detection.cpp | 10 +- engines/sword2/sword2.cpp | 2 +- engines/tinsel/actors.cpp | 10 +- engines/tinsel/anim.cpp | 6 +- engines/tinsel/bg.cpp | 2 +- engines/tinsel/bmv.cpp | 10 +- engines/tinsel/cliprect.cpp | 4 +- engines/tinsel/config.cpp | 4 +- engines/tinsel/coroutine.h | 4 +- engines/tinsel/cursor.cpp | 6 +- engines/tinsel/debugger.cpp | 2 +- engines/tinsel/detection.cpp | 10 +- engines/tinsel/dialogs.cpp | 56 +- engines/tinsel/dialogs.h | 2 +- engines/tinsel/events.cpp | 6 +- engines/tinsel/graphics.cpp | 20 +- engines/tinsel/handle.cpp | 2 +- engines/tinsel/heapmem.cpp | 2 +- engines/tinsel/move.cpp | 4 +- engines/tinsel/music.cpp | 6 +- engines/tinsel/object.cpp | 2 +- engines/tinsel/palette.cpp | 4 +- engines/tinsel/pcode.cpp | 10 +- engines/tinsel/pcode.h | 4 +- engines/tinsel/pdisplay.cpp | 8 +- engines/tinsel/play.cpp | 30 +- engines/tinsel/play.h | 2 +- engines/tinsel/polygons.cpp | 32 +- engines/tinsel/rince.cpp | 10 +- engines/tinsel/saveload.cpp | 12 +- engines/tinsel/savescn.cpp | 10 +- engines/tinsel/scene.cpp | 4 +- engines/tinsel/sched.cpp | 14 +- engines/tinsel/sched.h | 26 +- engines/tinsel/scn.cpp | 2 +- engines/tinsel/scroll.cpp | 8 +- engines/tinsel/serializer.h | 8 +- engines/tinsel/sound.cpp | 6 +- engines/tinsel/sound.h | 4 +- engines/tinsel/strres.cpp | 14 +- engines/tinsel/sysvar.h | 2 +- engines/tinsel/text.cpp | 6 +- engines/tinsel/text.h | 2 +- engines/tinsel/timers.cpp | 2 +- engines/tinsel/tinlib.cpp | 52 +- engines/tinsel/tinsel.cpp | 44 +- gui/ThemeEngine.cpp | 6 +- gui/ThemeEngine.h | 4 +- test/common/func.h | 2 +- test/common/hashmap.h | 2 +- test/common/ptr.h | 4 +- test/common/queue.h | 4 +- test/common/stream.h | 8 +- test/cxxtest/cxxtest/Descriptions.cpp | 2 +- test/cxxtest/cxxtest/Descriptions.h | 14 +- test/cxxtest/cxxtest/DummyDescriptions.cpp | 14 +- test/cxxtest/cxxtest/DummyDescriptions.h | 14 +- test/cxxtest/cxxtest/ErrorFormatter.h | 6 +- test/cxxtest/cxxtest/ErrorPrinter.h | 2 +- test/cxxtest/cxxtest/GlobalFixture.cpp | 6 +- test/cxxtest/cxxtest/GlobalFixture.h | 6 +- test/cxxtest/cxxtest/Gui.h | 36 +- test/cxxtest/cxxtest/LinkedList.cpp | 22 +- test/cxxtest/cxxtest/LinkedList.h | 6 +- test/cxxtest/cxxtest/ParenPrinter.h | 2 +- test/cxxtest/cxxtest/QtGui.h | 14 +- test/cxxtest/cxxtest/RealDescriptions.cpp | 32 +- test/cxxtest/cxxtest/RealDescriptions.h | 36 +- test/cxxtest/cxxtest/StdValueTraits.h | 6 +- test/cxxtest/cxxtest/StdioFilePrinter.h | 6 +- test/cxxtest/cxxtest/StdioPrinter.h | 2 +- test/cxxtest/cxxtest/TeeListener.h | 34 +- test/cxxtest/cxxtest/TestListener.h | 2 +- test/cxxtest/cxxtest/TestRunner.h | 24 +- test/cxxtest/cxxtest/TestSuite.cpp | 10 +- test/cxxtest/cxxtest/TestSuite.h | 28 +- test/cxxtest/cxxtest/TestTracker.cpp | 26 +- test/cxxtest/cxxtest/TestTracker.h | 14 +- test/cxxtest/cxxtest/ValueTraits.cpp | 12 +- test/cxxtest/cxxtest/ValueTraits.h | 32 +- test/cxxtest/cxxtest/Win32Gui.h | 18 +- test/cxxtest/cxxtest/X11Gui.h | 18 +- test/cxxtest/cxxtest/YesNoRunner.h | 4 +- test/cxxtest/sample/CreatedTest.h | 2 +- test/cxxtest/sample/DeltaTest.h | 2 +- test/cxxtest/sample/ExceptionTest.h | 2 +- test/cxxtest/sample/FixtureTest.h | 2 +- test/cxxtest/sample/TraitsTest.h | 6 +- test/cxxtest/sample/mock/Dice.h | 2 +- test/cxxtest/sample/mock/MockStdlib.h | 2 +- test/cxxtest/sample/mock/TestDice.h | 8 +- test/cxxtest/sample/mock/roll.cpp | 2 +- tools/create_drascula/create_drascula.cpp | 4 +- tools/create_drascula/create_drascula.h | 2 +- tools/create_kyradat/create_kyradat.cpp | 30 +- tools/create_kyradat/hof_cd.h | 2 +- tools/create_kyradat/hof_demo.h | 2 +- tools/create_kyradat/misc.h | 4 +- 385 files changed, 2638 insertions(+), 2638 deletions(-) diff --git a/backends/events/default/default-events.cpp b/backends/events/default/default-events.cpp index 80c1b872c7..7c8c19c84e 100644 --- a/backends/events/default/default-events.cpp +++ b/backends/events/default/default-events.cpp @@ -356,7 +356,7 @@ bool DefaultEventManager::pollEvent(Common::Event &event) { if (!artificialEventQueue.empty()) { event = artificialEventQueue.pop(); result = true; - } else + } else result = _boss->pollEvent(event); if (_recordMode != kPassthrough) { @@ -397,7 +397,7 @@ bool DefaultEventManager::pollEvent(Common::Event &event) { if (g_engine && !g_engine->isPaused()) { Common::Event menuEvent; menuEvent.type = Common::EVENT_MAINMENU; - + // FIXME: GSoC RTL branch passes the F6 key event to the // engine, and also enqueues a EVENT_MAINMENU. For now, // we just drop the key event and return an EVENT_MAINMENU @@ -406,7 +406,7 @@ bool DefaultEventManager::pollEvent(Common::Event &event) { // // However, this has other consequences, possibly negative ones. // Like, what happens with key repeat for the trigger key? - + //pushEvent(menuEvent); event = menuEvent; @@ -519,8 +519,8 @@ void DefaultEventManager::pushEvent(Common::Event event) { if (event.type == Common::EVENT_QUIT) { if (!_shouldQuit) artificialEventQueue.push(event); - } else - artificialEventQueue.push(event); + } else + artificialEventQueue.push(event); } #endif // !defined(DISABLE_DEFAULT_EVENTMANAGER) diff --git a/backends/fs/ds/ds-fs.cpp b/backends/fs/ds/ds-fs.cpp index c0692c0713..97a034a998 100644 --- a/backends/fs/ds/ds-fs.cpp +++ b/backends/fs/ds/ds-fs.cpp @@ -249,7 +249,7 @@ GBAMPFileSystemNode::GBAMPFileSystemNode(const Common::String& path) { _isValid = false; // Old code returned false here, but I'm not sure why } else if ((strlen(pathStr) > 4) && (!strncmp(pathStr, "mp:/", 4))) { // Files which start with mp:/ - + // Clear the filename to 128 bytes, because a libfat bug occationally tries to read in this area. memset(check, 0, 128); strcpy(check, pathStr + 3); @@ -279,7 +279,7 @@ GBAMPFileSystemNode::GBAMPFileSystemNode(const Common::String& path) { _isValid = fileOrDir == FT_FILE; } - + // consolePrintf("Path: %s \n", check); @@ -567,7 +567,7 @@ size_t std_fread(const void* ptr, size_t size, size_t numItems, FILE* handle) { return numItems; } else { // consolePrintf("Read past end of file: %d read out of %d\n", bytes / size, numItems); - if ((size_t)bytes != size * numItems) readPastEndOfFile = true; + if ((size_t)bytes != size * numItems) readPastEndOfFile = true; return bytes / size; } return numItems; @@ -694,7 +694,7 @@ int std_fseek(FILE* handle, long int offset, int whence) { int std_ferror(FILE* handle) { //FIXME: not implemented? // consolePrintf("ferror "); - + return readPastEndOfFile; } diff --git a/backends/fs/posix/posix-fs.cpp b/backends/fs/posix/posix-fs.cpp index 463d647042..446ded779d 100644 --- a/backends/fs/posix/posix-fs.cpp +++ b/backends/fs/posix/posix-fs.cpp @@ -61,7 +61,7 @@ POSIXFilesystemNode::POSIXFilesystemNode(const Common::String &p) { } else { _path = p; } - + #ifdef __OS2__ // On OS/2, 'X:/' is a root of drive X, so we should not remove that last // slash. @@ -95,7 +95,7 @@ POSIXFilesystemNode::POSIXFilesystemNode(const Common::String &p) { AbstractFSNode *POSIXFilesystemNode::getChild(const Common::String &n) const { assert(!_path.empty()); assert(_isDirectory); - + // Make sure the string contains no slashes assert(!n.contains('/')); @@ -117,14 +117,14 @@ bool POSIXFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, boo // Special case for the root dir: List all DOS drives ULONG ulDrvNum; ULONG ulDrvMap; - + DosQueryCurrentDisk(&ulDrvNum, &ulDrvMap); - + for (int i = 0; i < 26; i++) { if (ulDrvMap & 1) { char drive_root[] = "A:/"; drive_root[0] += i; - + POSIXFilesystemNode *entry = new POSIXFilesystemNode(); entry->_isDirectory = true; entry->_isValid = true; @@ -132,10 +132,10 @@ bool POSIXFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, boo entry->_displayName = "[" + Common::String(drive_root, 2) + "]"; myList.push_back(entry); } - + ulDrvMap >>= 1; } - + return true; } #endif @@ -220,7 +220,7 @@ AbstractFSNode *POSIXFilesystemNode::getParent() const { const char *start = _path.c_str(); const char *end = start + _path.size(); - + // Strip of the last component. We make use of the fact that at this // point, _path is guaranteed to be normalized while (end > start && *(end-1) != '/') diff --git a/backends/fs/posix/posix-fs.h b/backends/fs/posix/posix-fs.h index 7bd21c94b1..8050f52b41 100644 --- a/backends/fs/posix/posix-fs.h +++ b/backends/fs/posix/posix-fs.h @@ -43,11 +43,11 @@ protected: Common::String _path; bool _isDirectory; bool _isValid; - + virtual AbstractFSNode *makeNode(const Common::String &path) const { return new POSIXFilesystemNode(path); } - + /** * Plain constructor, for internal use only (hence protected). */ diff --git a/backends/fs/ps2/ps2-fs-factory.h b/backends/fs/ps2/ps2-fs-factory.h index dd6b5dc013..3a1dec252d 100644 --- a/backends/fs/ps2/ps2-fs-factory.h +++ b/backends/fs/ps2/ps2-fs-factory.h @@ -30,18 +30,18 @@ /** * Creates PS2FilesystemNode objects. - * + * * Parts of this class are documented in the base interface class, AbstractFilesystemFactory. */ -class Ps2FilesystemFactory : public FilesystemFactory, public Common::Singleton { +class Ps2FilesystemFactory : public FilesystemFactory, public Common::Singleton { public: virtual AbstractFSNode *makeRootFileNode() const; virtual AbstractFSNode *makeCurrentDirectoryFileNode() const; virtual AbstractFSNode *makeFileNodePath(const Common::String &path) const; - + protected: Ps2FilesystemFactory() {}; - + private: friend class Common::Singleton; }; diff --git a/backends/fs/ps2/ps2-fs.cpp b/backends/fs/ps2/ps2-fs.cpp index fd20562a24..5246a9bd38 100644 --- a/backends/fs/ps2/ps2-fs.cpp +++ b/backends/fs/ps2/ps2-fs.cpp @@ -40,7 +40,7 @@ extern OSystem_PS2 *g_systemPs2; /** * Implementation of the ScummVM file system API based on the Ps2SDK. - * + * * Parts of this class are documented in the base interface class, AbstractFSNode. */ class Ps2FilesystemNode : public AbstractFSNode { @@ -62,15 +62,15 @@ public: * Creates a PS2FilesystemNode with the root node as path. */ Ps2FilesystemNode(); - + /** * Creates a PS2FilesystemNode for a given path. - * + * * @param path Common::String with the path the new node should point to. */ Ps2FilesystemNode(const Common::String &path); Ps2FilesystemNode(const Common::String &path, bool verify); - + /** * Copy constructor. */ @@ -165,7 +165,7 @@ Ps2FilesystemNode::Ps2FilesystemNode(const Ps2FilesystemNode *node) { } bool Ps2FilesystemNode::exists(void) const { - + dbg_printf("Ps2FilesystemNode::exists: path \"%s\": ", _path.c_str()); if (_path[4] != ':') { // don't bother for relative path... they always fail on PS2! @@ -217,10 +217,10 @@ AbstractFSNode *Ps2FilesystemNode::getChild(const Common::String &n) const { char listDir[256]; sprintf(listDir, "%s/", _path.c_str()); int fd = fio.dopen(listDir); - + if (fd >= 0) { iox_dirent_t dirent; - + while (fio.dread(fd, &dirent) > 0) { if (strcmp(n.c_str(), dirent.name) == 0) { Ps2FilesystemNode *dirEntry = new Ps2FilesystemNode(); @@ -240,13 +240,13 @@ AbstractFSNode *Ps2FilesystemNode::getChild(const Common::String &n) const { } fio.dclose(fd); } - + return NULL; } bool Ps2FilesystemNode::getChildren(AbstractFSList &list, ListMode mode, bool hidden) const { //TODO: honor the hidden flag - + if (!_isDirectory) return false; @@ -273,14 +273,14 @@ bool Ps2FilesystemNode::getChildren(AbstractFSList &list, ListMode mode, bool hi } else { char listDir[256]; int fd; - + if (_path.lastChar() == '/' /* || _path.lastChar() == ':'*/) fd = fio.dopen(_path.c_str()); else { sprintf(listDir, "%s/", _path.c_str()); fd = fio.dopen(listDir); } - + if (fd >= 0) { iox_dirent_t dirent; Ps2FilesystemNode dirEntry; @@ -338,7 +338,7 @@ char *Ps2FilesystemNode::getDeviceDescription(const char *path) const { else if (strncmp(path, "mass", 4) == 0) return "USB Mass Storage"; else - return "Harddisk"; + return "Harddisk"; } Common::SeekableReadStream *Ps2FilesystemNode::openForReading() { diff --git a/backends/fs/symbian/symbian-fs.cpp b/backends/fs/symbian/symbian-fs.cpp index 74b7c28873..3b57ac0356 100644 --- a/backends/fs/symbian/symbian-fs.cpp +++ b/backends/fs/symbian/symbian-fs.cpp @@ -140,7 +140,7 @@ AbstractFSNode *SymbianFilesystemNode::getChild(const Common::String &n) const { if (_path.lastChar() != '\\') newPath += '\\'; - newPath += n; + newPath += n; return new SymbianFilesystemNode(newPath); } @@ -196,7 +196,7 @@ bool SymbianFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, b if (_path.lastChar() != '\\') fname.Append('\\'); - + if (static_cast(g_system)->FsSession().GetDir(fname, KEntryAttNormal|KEntryAttDir, 0, dirPtr) == KErrNone) { CleanupStack::PushL(dirPtr); TInt cnt=dirPtr->Count(); @@ -219,7 +219,7 @@ bool SymbianFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, b if ((mode == Common::FSNode::kListFilesOnly && entry._isDirectory) || (mode == Common::FSNode::kListDirectoriesOnly && !entry._isDirectory)) continue; - + myList.push_back(new SymbianFilesystemNode(entry)); } CleanupStack::PopAndDestroy(dirPtr); diff --git a/backends/fs/symbian/symbianstream.cpp b/backends/fs/symbian/symbianstream.cpp index 5944cab892..650bbd0dcd 100644 --- a/backends/fs/symbian/symbianstream.cpp +++ b/backends/fs/symbian/symbianstream.cpp @@ -13,7 +13,7 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -21,7 +21,7 @@ * $URL$ * $Id$ * - */ + */ #include "common/scummsys.h" #include "backends/fs/symbian/symbianstream.h" @@ -48,7 +48,7 @@ TSymbianFileEntry* CreateSymbianFileEntry(const char* name, const char* mode) { fileEntry->_inputPos = KErrNotFound; fileEntry->_lastError = 0; fileEntry->_eofReached = EFalse; - + if (fileEntry != NULL) { TInt modeLen = strlen(mode); @@ -102,9 +102,9 @@ size_t ReadData(const void* ptr, size_t size, size_t numItems, TSymbianFileEntry TSymbianFileEntry* entry = ((TSymbianFileEntry*)(handle)); TUint32 totsize = size*numItems; TPtr8 pointer ( (unsigned char*) ptr, totsize); - + // Nothing cached and we want to load at least KInputBufferLength bytes - if (totsize >= KInputBufferLength) { + if (totsize >= KInputBufferLength) { TUint32 totLength = 0; if (entry->_inputPos != KErrNotFound) { TPtr8 cacheBuffer( (unsigned char*) entry->_inputBuffer+entry->_inputPos, entry->_inputBufferLen - entry->_inputPos, KInputBufferLength); @@ -113,19 +113,19 @@ size_t ReadData(const void* ptr, size_t size, size_t numItems, TSymbianFileEntry totLength+=pointer.Length(); pointer.Set(totLength+(unsigned char*) ptr, 0, totsize-totLength); } - + entry->_lastError = entry->_fileHandle.Read(pointer); - + totLength+=pointer.Length(); - + pointer.Set((unsigned char*) ptr, totLength, totsize); - + } else { - // Nothing in buffer + // Nothing in buffer if (entry->_inputPos == KErrNotFound) { TPtr8 cacheBuffer( (unsigned char*) entry->_inputBuffer, KInputBufferLength); - entry->_lastError = entry->_fileHandle.Read(cacheBuffer); - + entry->_lastError = entry->_fileHandle.Read(cacheBuffer); + if (cacheBuffer.Length() >= totsize) { pointer.Copy(cacheBuffer.Left(totsize)); entry->_inputPos = totsize; @@ -134,19 +134,19 @@ size_t ReadData(const void* ptr, size_t size, size_t numItems, TSymbianFileEntry pointer.Copy(cacheBuffer); entry->_inputPos = KErrNotFound; } - + } else { TPtr8 cacheBuffer( (unsigned char*) entry->_inputBuffer, entry->_inputBufferLen, KInputBufferLength); - + if (entry->_inputPos+totsize < entry->_inputBufferLen) { pointer.Copy(cacheBuffer.Mid(entry->_inputPos, totsize)); entry->_inputPos+=totsize; } else { - + pointer.Copy(cacheBuffer.Mid(entry->_inputPos, entry->_inputBufferLen-entry->_inputPos)); cacheBuffer.SetLength(0); entry->_lastError = entry->_fileHandle.Read(cacheBuffer); - + if (cacheBuffer.Length() >= totsize-pointer.Length()) { TUint32 restSize = totsize-pointer.Length(); pointer.Append(cacheBuffer.Left(restSize)); @@ -158,8 +158,8 @@ size_t ReadData(const void* ptr, size_t size, size_t numItems, TSymbianFileEntry } } } - } - + } + if((numItems * size) != pointer.Length() && entry->_lastError == KErrNone) { entry->_eofReached = ETrue; } @@ -234,11 +234,11 @@ bool SymbianStdioStream::seek(int32 offs, int whence) { break; } - + entry->_inputPos = KErrNotFound; entry->_eofReached = EFalse; entry->_fileHandle.Seek(seekMode, pos); - + return true; // FIXME: Probably should return a value based on what _fileHandle.Seek returns } @@ -256,7 +256,7 @@ uint32 SymbianStdioStream::write(const void *ptr, uint32 len) { if (((TSymbianFileEntry*)(_handle))->_lastError == KErrNone) { return len; } - + return 0; } diff --git a/backends/fs/wii/wii-fs.cpp b/backends/fs/wii/wii-fs.cpp index f3c457af5e..cbecce2d05 100644 --- a/backends/fs/wii/wii-fs.cpp +++ b/backends/fs/wii/wii-fs.cpp @@ -91,7 +91,7 @@ bool WiiFilesystemNode::getDevopChildren(AbstractFSList &list, ListMode mode, bo if (!dt || !dt->name || !dt->open_r || !dt->diropen_r) continue; - + list.push_back(new WiiFilesystemNode(Common::String(dt->name) + ":/", true)); } diff --git a/backends/midi/stmidi.cpp b/backends/midi/stmidi.cpp index f07b5b56ca..154f4aacf6 100644 --- a/backends/midi/stmidi.cpp +++ b/backends/midi/stmidi.cpp @@ -17,9 +17,9 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -/* +/* * Raw MIDI output for the Atari ST line of computers. - * Based on the ScummVM SEQ & CoreMIDI drivers. + * Based on the ScummVM SEQ & CoreMIDI drivers. * Atari code by Keith Scroggins * We, unfortunately, could not use the SEQ driver because the /dev/midi under * FreeMiNT (and hence in libc) is considered to be a serial port for machine diff --git a/backends/platform/PalmOS/Src/init_mathlib.cpp b/backends/platform/PalmOS/Src/init_mathlib.cpp index 88cf8a21f2..1ea39c3e0a 100644 --- a/backends/platform/PalmOS/Src/init_mathlib.cpp +++ b/backends/platform/PalmOS/Src/init_mathlib.cpp @@ -26,4 +26,4 @@ void MathlibRelease() { if (!useCount) SysLibRemove(MathLibRef); } -} \ No newline at end of file +} diff --git a/backends/platform/PalmOS/Src/init_sony.h b/backends/platform/PalmOS/Src/init_sony.h index 0316a012d7..86224283f6 100644 --- a/backends/platform/PalmOS/Src/init_sony.h +++ b/backends/platform/PalmOS/Src/init_sony.h @@ -37,4 +37,4 @@ void SonyHRRelease(UInt16 HRrefNum); UInt8 SonyScreenSize(UInt16 HRrefNum, Coord *stdw, Coord *stdh, Coord *fullw, Coord *fullh); -#endif \ No newline at end of file +#endif diff --git a/backends/platform/PalmOS/Src/rumble.cpp b/backends/platform/PalmOS/Src/rumble.cpp index 6546aa9e90..513152f49c 100644 --- a/backends/platform/PalmOS/Src/rumble.cpp +++ b/backends/platform/PalmOS/Src/rumble.cpp @@ -137,4 +137,4 @@ void RumbleRelease() { HwrVibrateAttributes(1, kHwrVibrateActive, &active); #endif } -} \ No newline at end of file +} diff --git a/backends/platform/PalmOS/Src/rumble.h b/backends/platform/PalmOS/Src/rumble.h index b95fa5f666..680c0eb164 100644 --- a/backends/platform/PalmOS/Src/rumble.h +++ b/backends/platform/PalmOS/Src/rumble.h @@ -31,4 +31,4 @@ void RumbleRun (Boolean active); Boolean RumbleInit (); void RumbleRelease (); -#endif \ No newline at end of file +#endif diff --git a/backends/platform/dc/dc-fs.cpp b/backends/platform/dc/dc-fs.cpp index d77e1c86df..810eed836c 100644 --- a/backends/platform/dc/dc-fs.cpp +++ b/backends/platform/dc/dc-fs.cpp @@ -90,7 +90,7 @@ AbstractFSNode *RoninCDFileNode::makeFileNodePath(const Common::String &path) { return new RoninCDFileNode(path); } else if ((fd = open(path.c_str(), O_DIR|O_RDONLY)) >= 0) { close(fd); - return new RoninCDDirectoryNode(path); + return new RoninCDDirectoryNode(path); } else { return NULL; } diff --git a/backends/platform/ds/arm9/source/blitters.cpp b/backends/platform/ds/arm9/source/blitters.cpp index 582e15eb13..07c6b3fee1 100644 --- a/backends/platform/ds/arm9/source/blitters.cpp +++ b/backends/platform/ds/arm9/source/blitters.cpp @@ -27,25 +27,25 @@ namespace DS { -void asmDrawStripToScreen(int height, int width, byte const* text, byte const* src, byte* dst, +void asmDrawStripToScreen(int height, int width, byte const* text, byte const* src, byte* dst, int vsPitch, int vmScreenWidth, int textSurfacePitch) { if (height <= 0) height = 1; if (width < 4) return; - - + + width &= ~4; // src = (const byte *) (((int) (src)) & (~4)); // dst = (byte *) (((int) (dst)) & (~4)); // text = (const byte *) (((int) (text)) & (~4)); - + asm ( "mov r5, %0\n" // Height - "yLoop:\n" + "yLoop:\n" "mov r3, #0\n" // X pos - + "xLoop:\n" - + "ldr r4, [%2, r3]\n" // Load text layer word "cmp r4, %5\n" "bne singleByteCompare\n" @@ -54,7 +54,7 @@ void asmDrawStripToScreen(int height, int width, byte const* text, byte const* s "add r3, r3, #4\n" "cmp r3, %1\n" // x == width? "blt xLoop\n" - + "add %2, %2, %8\n" // src += vs->pitch "add %3, %3, %6\n" // dst += _vm->_screenWidth "add %4, %4, %7\n" // text += _textSurface.pitch @@ -62,8 +62,8 @@ void asmDrawStripToScreen(int height, int width, byte const* text, byte const* s "cmp r5, #0\n" // y == 0? "bne yLoop\n" "b end\n" - - + + "singleByteCompare:\n" "ldrb r4, [%2, r3]\n" // Load text byte "cmps r4, %5, lsr #24\n" // Compare with mask @@ -78,7 +78,7 @@ void asmDrawStripToScreen(int height, int width, byte const* text, byte const* s "ldreqb r4, [%3, r3]\n" // Otherwise Load src byte "streqb r4, [%4, r3]\n" // Store it "add r3, r3, #1\n" - + "ldrb r4, [%2, r3]\n" // Load text byte "cmps r4, %5, lsr #24\n" // Compare with mask "strneb r4, [%4, r3]\n" // Store if not equal @@ -91,7 +91,7 @@ void asmDrawStripToScreen(int height, int width, byte const* text, byte const* s "strneb r4, [%4, r3]\n" // Store if not equal "ldreqb r4, [%3, r3]\n" // Otherwise Load src byte "streqb r4, [%4, r3]\n" // Store it - "add r3, r3, #1\n" + "add r3, r3, #1\n" "cmps r3, %1\n" // x == width? "blt xLoop\n" // Repeat @@ -101,10 +101,10 @@ void asmDrawStripToScreen(int height, int width, byte const* text, byte const* s "sub r5, r5, #1\n" // y -= 1 "cmp r5, #0\n" // y == 0? "bne yLoop\n" - + "end:\n" : /* no output registers */ - : "r" (height), "r" (width), "r" (text), "r" (src), "r" (dst), "r" (CHARSET_MASK_TRANSPARENCY | (CHARSET_MASK_TRANSPARENCY << 8) | (CHARSET_MASK_TRANSPARENCY << 16) | (CHARSET_MASK_TRANSPARENCY << 24)), + : "r" (height), "r" (width), "r" (text), "r" (src), "r" (dst), "r" (CHARSET_MASK_TRANSPARENCY | (CHARSET_MASK_TRANSPARENCY << 8) | (CHARSET_MASK_TRANSPARENCY << 16) | (CHARSET_MASK_TRANSPARENCY << 24)), "r" (vsPitch), "r" (vmScreenWidth), "r" (textSurfacePitch) : "r5", "r3", "r4", "%2", "%3", "%4", "memory"); } @@ -115,7 +115,7 @@ void asmCopy8Col(byte* dst, int dstPitch, const byte* src, int height) { asm("ands r0, %3, #1\n" "addne %3, %3, #1\n" "bne roll2\n" - + "yLoop2:\n" "ldr r0, [%2, #0]\n" "str r0, [%0, #0]\n" @@ -131,7 +131,7 @@ void asmCopy8Col(byte* dst, int dstPitch, const byte* src, int height) { "add %0, %0, %1\n" "add %2, %2, %1\n" "subs %3, %3, #2\n" - "bne yLoop2\n" + "bne yLoop2\n" : /* no output registers */ : "r" (dst), "r" (dstPitch), "r" (src), "r" (height) @@ -150,7 +150,7 @@ void ComputeDivBy5TableIFN() for (int i=0; i<160; ++i) { DIV_BY_5[i] = (2*i+5)/10; - } + } } #ifdef PERFECT_5_TO_4_RESCALING @@ -163,13 +163,13 @@ static inline void RescaleBlock_5x1555_To_4x1555( u16 s0, u16 s1, u16 s2, u16 s3 u32 bs3 = s3 & 0x1F; u32 bs4 = s4 & 0x1F; -#if 0 +#if 0 u32 gs0 = (s0 >> 5) & 0x1F; u32 gs1 = (s1 >> 5) & 0x1F; u32 gs2 = (s2 >> 5) & 0x1F; u32 gs3 = (s3 >> 5) & 0x1F; u32 gs4 = (s4 >> 5) & 0x1F; - + u32 rs0 = (s0 >> 10) & 0x1F; u32 rs1 = (s1 >> 10) & 0x1F; u32 rs2 = (s2 >> 10) & 0x1F; @@ -191,22 +191,22 @@ static inline void RescaleBlock_5x1555_To_4x1555( u16 s0, u16 s1, u16 s2, u16 s3 asm("and %0, %2, %1, lsr #10" : "=r"(rs3) : "r"(s3), "r"(mask) : ); asm("and %0, %2, %1, lsr #10" : "=r"(rs4) : "r"(s4), "r"(mask) : ); #endif - + u32 rd0 = 4*rs0 + rs1; u32 rd1 = 2*rs1 + rs1 + 2*rs2; u32 rd2 = 2*rs2 + 2*rs3 + rs3; u32 rd3 = rs3 + 4*rs4; - + u32 gd0 = 4*gs0 + gs1; u32 gd1 = 2*gs1 + gs1 + 2*gs2; u32 gd2 = 2*gs2 + 2*gs3 + gs3; u32 gd3 = gs3 + 4*gs4; - + u32 bd0 = 4*bs0 + bs1; u32 bd1 = 2*bs1 + bs1 + 2*bs2; u32 bd2 = 2*bs2 + 2*bs3 + bs3; u32 bd3 = bs3 + 4*bs4; - + #if 0 // Offsetting for correct rounding rd0 = rd0*2+5; rd1 = rd1*2+5; rd2 = rd2*2+5; rd3 = rd3*2+5; @@ -217,14 +217,14 @@ static inline void RescaleBlock_5x1555_To_4x1555( u16 s0, u16 s1, u16 s2, u16 s3 gd0 = (gd0 * 51) >> 9; gd1 = (gd1 * 51) >> 9; gd2 = (gd2 * 51) >> 9; gd3 = (gd3 * 51) >> 9; bd0 = (bd0 * 51) >> 9; bd1 = (bd1 * 51) >> 9; bd2 = (bd2 * 51) >> 9; bd3 = (bd3 * 51) >> 9; #else - rd0 = DIV_BY_5[rd0]; rd1 = DIV_BY_5[rd1]; rd2 = DIV_BY_5[rd2]; rd3 = DIV_BY_5[rd3]; - gd0 = DIV_BY_5[gd0]; gd1 = DIV_BY_5[gd1]; gd2 = DIV_BY_5[gd2]; gd3 = DIV_BY_5[gd3]; - bd0 = DIV_BY_5[bd0]; bd1 = DIV_BY_5[bd1]; bd2 = DIV_BY_5[bd2]; bd3 = DIV_BY_5[bd3]; + rd0 = DIV_BY_5[rd0]; rd1 = DIV_BY_5[rd1]; rd2 = DIV_BY_5[rd2]; rd3 = DIV_BY_5[rd3]; + gd0 = DIV_BY_5[gd0]; gd1 = DIV_BY_5[gd1]; gd2 = DIV_BY_5[gd2]; gd3 = DIV_BY_5[gd3]; + bd0 = DIV_BY_5[bd0]; bd1 = DIV_BY_5[bd1]; bd2 = DIV_BY_5[bd2]; bd3 = DIV_BY_5[bd3]; #endif - + u32 d10 = 0x80008000 | (rd1 << 26) | (gd1 << 21) | (bd1 << 16) | (rd0 << 10) | (gd0 << 5) | bd0; u32 d32 = 0x80008000 | (rd3 << 26) | (gd3 << 21) | (bd3 << 16) | (rd2 << 10) | (gd2 << 5) | bd2; - + ((u32*)dest)[0] = d10; ((u32*)dest)[1] = d32; } @@ -233,7 +233,7 @@ static inline void RescaleBlock_5x1555_To_4x1555( u16 s0, u16 s1, u16 s2, u16 s3 u16* dest) { static const u32 MASK = 0x03E07C1F; - + u32 argbargbs0 = u32(s0) | (u32(s0) << 16); u32 argbargbs1 = u32(s1) | (u32(s1) << 16); u32 argbargbs2 = u32(s2) | (u32(s2) << 16); @@ -245,32 +245,32 @@ static inline void RescaleBlock_5x1555_To_4x1555( u16 s0, u16 s1, u16 s2, u16 s3 u32 grbs2 = argbargbs2 & MASK; u32 grbs3 = argbargbs3 & MASK; u32 grbs4 = argbargbs4 & MASK; - + u32 grbd0 = (3*grbs0 + grbs1) >> 2; u32 grbd1 = ( grbs1 + grbs2) >> 1; u32 grbd2 = ( grbs2 + grbs3) >> 1; u32 grbd3 = ( grbs3 + 3*grbs4) >> 2; - + grbd0 &= MASK; grbd1 &= MASK; grbd2 &= MASK; grbd3 &= MASK; - + u32 d0 = grbd0 | (grbd0 >> 16); u32 d1 = grbd1 | (grbd1 >> 16); u32 d2 = grbd2 | (grbd2 >> 16); u32 d3 = grbd3 | (grbd3 >> 16); - - d0 &= 0xFFFF; - d1 &= 0xFFFF; - d2 &= 0xFFFF; - d3 &= 0xFFFF; - - d0 |= 0x8000; - d1 |= 0x8000; - d2 |= 0x8000; - d3 |= 0x8000; - + + d0 &= 0xFFFF; + d1 &= 0xFFFF; + d2 &= 0xFFFF; + d3 &= 0xFFFF; + + d0 |= 0x8000; + d1 |= 0x8000; + d2 |= 0x8000; + d3 |= 0x8000; + dest[0] = d0; dest[1] = d1; dest[2] = d2; @@ -287,13 +287,13 @@ static inline void RescaleBlock_5x8888_To_4x1555( u32 s0, u32 s1, u32 s2, u32 s3 u32 bd0 = (d0 << 24) >> 24; u32 bd1 = (d1 << 24) >> 24; u32 gd0 = (d0 << 16) >> 24; - u32 gd1 = (d1 << 16) >> 24; + u32 gd1 = (d1 << 16) >> 24; u32 rd0 = (d0 >> 16); u32 rd1 = (d1 >> 16); - + rd0 = DIV_BY_5[rd0]; rd1 = DIV_BY_5[rd1]; gd0 = DIV_BY_5[gd0]; gd1 = DIV_BY_5[gd1]; - bd0 = DIV_BY_5[bd0]; bd1 = DIV_BY_5[bd1]; + bd0 = DIV_BY_5[bd0]; bd1 = DIV_BY_5[bd1]; u32 d10 = 0x80008000 | (rd1 << 26) | (gd1 << 21) | (bd1 << 16) | (rd0 << 10) | (gd0 << 5) | bd0; ((u32*)dest)[0] = d10; @@ -307,11 +307,11 @@ static inline void RescaleBlock_5x8888_To_4x1555( u32 s0, u32 s1, u32 s2, u32 s3 u32 rd2 = (d2 >> 16); u32 rd3 = (d3 >> 16); - rd2 = DIV_BY_5[rd2]; rd3 = DIV_BY_5[rd3]; - gd2 = DIV_BY_5[gd2]; gd3 = DIV_BY_5[gd3]; - bd2 = DIV_BY_5[bd2]; bd3 = DIV_BY_5[bd3]; + rd2 = DIV_BY_5[rd2]; rd3 = DIV_BY_5[rd3]; + gd2 = DIV_BY_5[gd2]; gd3 = DIV_BY_5[gd3]; + bd2 = DIV_BY_5[bd2]; bd3 = DIV_BY_5[bd3]; u32 d32 = 0x80008000 | (rd3 << 26) | (gd3 << 21) | (bd3 << 16) | (rd2 << 10) | (gd2 << 5) | bd2; - + ((u32*)dest)[1] = d32; } @@ -320,7 +320,7 @@ static inline void RescaleBlock_5x8888_To_4x1555( u32 s0, u32 s1, u32 s2, u32 s3 static inline void Rescale_320xPAL8Scanline_To_256x1555Scanline(u16* dest, const u8* src, const u32* palette) { ComputeDivBy5TableIFN(); - + for (size_t i=0; i<64; ++i) { u32 s0 = palette[src[5*i+0]]; @@ -353,7 +353,7 @@ static inline void Rescale_320xPAL8Scanline_To_256x1555Scanline(u16* dest, const static inline void Rescale_320x1555Scanline_To_256x1555Scanline(u16* dest, const u16* src) { ComputeDivBy5TableIFN(); - + for (size_t i=0; i<64; ++i) { u16 s0 = src[5*i+0]; @@ -384,7 +384,7 @@ void Rescale_320x256xPAL8_To_256x256x1555(u16* dest, const u8* src, int destStri for (size_t i=0; i<200; ++i) { - Rescale_320xPAL8Scanline_To_256x1555Scanline(dest + i*destStride, src + i *srcStride, fastRam); + Rescale_320xPAL8Scanline_To_256x1555Scanline(dest + i*destStride, src + i *srcStride, fastRam); } } #else @@ -396,7 +396,7 @@ void Rescale_320x256xPAL8_To_256x256x1555(u16* dest, const u8* src, int destStri for (size_t i=0; i<200; ++i) { - Rescale_320xPAL8Scanline_To_256x1555Scanline(dest + i*destStride, src + i *srcStride, fastRam); + Rescale_320xPAL8Scanline_To_256x1555Scanline(dest + i*destStride, src + i *srcStride, fastRam); } } #endif diff --git a/backends/platform/ds/arm9/source/cdaudio.cpp b/backends/platform/ds/arm9/source/cdaudio.cpp index 56ac4e8c09..4f66401b53 100644 --- a/backends/platform/ds/arm9/source/cdaudio.cpp +++ b/backends/platform/ds/arm9/source/cdaudio.cpp @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ - + #include "cdaudio.h" #include "backends/fs/ds/ds-fs.h" #include "common/config-manager.h" @@ -53,9 +53,9 @@ struct WaveHeader { u16 fmtExtraData; // Number of extra fmt bytes u16 fmtExtra; // Samples per block (only for IMA-ADPCM files) } __attribute__ ((packed)); - + struct chunkHeader { - char name[4]; + char name[4]; u32 size; } __attribute__ ((packed)); @@ -112,7 +112,7 @@ void decompressBlock(); void allocBuffers() { - + } void setActive(bool active) { @@ -125,17 +125,17 @@ bool getActive() { void playTrack(int track, int numLoops, int startFrame, int duration) { Common::String path = ConfMan.get("path"); - + if (isPlayingFlag) { stopTrack(); } - + if (trackStartsAt2) { track++; } - - - + + + char str[100]; if (path[strlen(path.c_str()) - 1] == '/') { @@ -145,50 +145,50 @@ void playTrack(int track, int numLoops, int startFrame, int duration) { sprintf(str, "/track%d.wav", track); path = path + str; } - - + + //1820160 - + file = DS::std_fopen(path.c_str(), "rb"); - + if (!file) { consolePrintf("Failed to open %s!\n", path.c_str()); return; } - - + + DS::std_fread((const void *) &waveHeader, sizeof(waveHeader), 1, file); - + consolePrintf("Playing track %d\n", track); consolePrintf("Format: %d\n", waveHeader.fmtFormatTag); consolePrintf("Rate : %d\n", waveHeader.fmtSamPerSec); consolePrintf("Bits : %d\n", waveHeader.fmtBitsPerSam); consolePrintf("BlkSz : %d\n", waveHeader.fmtExtra); - + if ((waveHeader.fmtFormatTag != 17) && (waveHeader.fmtFormatTag != 20)) { consolePrintf("Wave file is in the wrong format! You must use IMA-ADPCM 4-bit mono.\n"); DS::std_fclose(file); return; } - + for (int r = 0; r < 8; r++) { IPC->adpcm.buffer[r] = (u8 * volatile) (decoderFormat *) malloc(waveHeader.fmtBlockAlign); IPC->adpcm.filled[r] = false; IPC->adpcm.arm7Dirty[r] = false; } - + // Skip chunks until we reach the data chunk chunkHeader chunk; DS::std_fread((const void *) &chunk, sizeof(chunkHeader), 1, file); - + while (!((chunk.name[0] == 'd') && (chunk.name[1] == 'a') && (chunk.name[2] == 't') && (chunk.name[3] == 'a'))) { DS::std_fseek(file, chunk.size, SEEK_CUR); DS::std_fread((const void *) &chunk, sizeof(chunkHeader), 1, file); } - + dataChunkStart = DS::std_ftell(file); - - + + static bool started = false; sampleNum = 0; blockCount = 0; @@ -206,35 +206,35 @@ void playTrack(int track, int numLoops, int startFrame, int duration) { memset(audioBuffer, 0, BUFFER_SIZE * 2); memset(decompressionBuffer, 0, waveHeader.fmtExtra * 2); DS::playSound(audioBuffer, BUFFER_SIZE * 2, false, false, waveHeader.fmtSamPerSec); - - } + + } fillPos = (IPC->streamPlayingSection + 1) & 3; isPlayingFlag = true; - - + + // Startframe is a 75Hz timer. Dunno why, since nothing else // seems to run at that rate. int tenths = (startFrame * 10) / 75; - + // Seek to the nearest block start to the start time int samples = (tenths * waveHeader.fmtSamPerSec) / 10; int block = samples / waveHeader.fmtExtra; - - + + if (duration == 0) { blocksLeft = 0; } else { blocksLeft = ((((duration * 100) / 75) * (waveHeader.fmtSamPerSec)) / (waveHeader.fmtExtra) / 100) + 10; } // consolePrintf("Playing %d blocks (%d)\n\n", blocksLeft, duration); - + // No need to seek if we're starting from the beginning if (block != 0) { DS::std_fseek(file, dataChunkStart + block * waveHeader.fmtBlockAlign, SEEK_SET); // consolePrintf("Startframe: %d msec: %d (%d,%d)\n", startFrame, tenthssec, samples, block); } - - + + //decompressBlock(); playNextBlock(); DS::CD::numLoops = numLoops; @@ -252,21 +252,21 @@ extern "C" void ARM_adcpm(int *block, int len, int stepTableIndex, void decompressBlock() { int block[2048]; bool loop = false; - + blockCount++; - + if (blockCount < 10) return; - - + + do { DS::std_fread((const void *) &blockHeader, sizeof(blockHeader), 1, file); - + DS::std_fread(&block[0], waveHeader.fmtBlockAlign - sizeof(blockHeader), 1, file); if (DS::std_feof(file) ) { // Reached end of file, so loop - - + + if ((numLoops == -1) || (numLoops > 1)) { // Seek file to first packet if (numLoops != -1) { @@ -283,14 +283,14 @@ void decompressBlock() { stopTrack(); return; } - + } else { loop = false; } - + } while (loop); - - + + if (blocksLeft > 0) { blocksLeft--; // consolePrintf("%d ", blocksLeft); @@ -305,37 +305,37 @@ void decompressBlock() { blockHeader.stepTableIndex, blockHeader.firstSample, decompressionBuffer); -#else +#else // First sample is in header decompressionBuffer[0] = blockHeader.firstSample; - + // Set up initial table indeces int stepTableIndex = blockHeader.stepTableIndex; int prevSample = blockHeader.firstSample; - + // consolePrintf("Decompressing block step=%d fs=%d\n", stepTableIndex, prevSample); for (int r = 0; r < waveHeader.fmtExtra - 1; r++) { - + int word = block[r >> 3]; int offset = 0; - + switch (7 - (r & 0x0007)) { case 0: { offset = (word & 0xF0000000) >> 28; break; } - + case 1: { offset = (word & 0x0F000000) >> 24; break; } - + case 2: { offset = (word & 0x00F00000) >> 20; break; } - + case 3: { offset = (word & 0x000F0000) >> 16; break; @@ -361,41 +361,41 @@ void decompressBlock() { break; } } - + int diff = 0; - + if (offset & 4) { diff = diff + stepTab[stepTableIndex]; } - + if (offset & 2) { diff = diff + (stepTab[stepTableIndex] >> 1); } - + if (offset & 1) { diff = diff + (stepTab[stepTableIndex] >> 2); } - + diff = diff + (stepTab[stepTableIndex] >> 3); - + if (offset & 8) { - diff = -diff; + diff = -diff; } - + int newSample = prevSample + diff; - + if (newSample > 32767) newSample = 32767; if (newSample < -32768) newSample = -32768; - + decompressionBuffer[r + 1] = newSample; - + prevSample = newSample; - + stepTableIndex += indexTab[offset]; - + if (stepTableIndex > 88) stepTableIndex = 88; if (stepTableIndex < 0) stepTableIndex = 0; - + } #endif @@ -404,21 +404,21 @@ void decompressBlock() { void playNextBlock() { if (!isPlayingFlag) return; int lastBlockId = -1; - + while (IPC->adpcm.semaphore); // Wait for buffer to become free if needed IPC->adpcm.semaphore = true; // Lock the buffer structure to prevent clashing with the ARM7 // DC_FlushAll(); - + //-8644, 25088 for (int block = fillPos + 1; block < fillPos + 4; block++) { int blockId = block & 3; - + if (IPC->streamFillNeeded[blockId]) { - + IPC->streamFillNeeded[blockId] = false; // DC_FlushAll(); - + /* if (!(REG_KEYINPUT & KEY_R)) { //consolePrintf("Align: %d First: %d Step:%d Res:%d\n", waveHeader.fmtBlockAlign, blockHeader.firstSample, blockHeader.stepTableIndex, blockHeader.reserved); consolePrintf("Filling buffer %d\n", blockId); @@ -432,19 +432,19 @@ void playNextBlock() { } } } - + lastBlockId = blockId; IPC->streamFillNeeded[blockId] = false; // DC_FlushAll(); } - - - + + + } - - - + + + if (lastBlockId != -1) { fillPos = lastBlockId; /* if (!(REG_KEYINPUT & KEY_R)) { @@ -459,18 +459,18 @@ void stopTrack() { if (!isPlayingFlag) return; DS::std_fclose(file); - + isPlayingFlag = false; - + for (int r = 0; r < BUFFER_SIZE; r++) { audioBuffer[r] = 0; } - + for (int r= 0; r < waveHeader.fmtExtra; r++) { decompressionBuffer[r] = 0; } // DS::stopSound(1); - + // free(audioBuffer); // free(decompressionBuffer); @@ -507,7 +507,7 @@ bool trackExists(int num) { bool checkCD() { // Need to check whethe CD audio files are present - do this by trying to open Track1.wav. consolePrintf("Attempted to open cd drive\n"); - + if (trackExists(1)) { trackStartsAt2 = false; return true; diff --git a/backends/platform/ds/arm9/source/cdaudio.h b/backends/platform/ds/arm9/source/cdaudio.h index d1897d3e5d..aac303dd5e 100644 --- a/backends/platform/ds/arm9/source/cdaudio.h +++ b/backends/platform/ds/arm9/source/cdaudio.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ - + #ifndef _CDAUDIO_H_ #define _CDAUDIO_H_ diff --git a/backends/platform/ds/arm9/source/console2.h b/backends/platform/ds/arm9/source/console2.h index 6b9a677cc7..86434dcb93 100644 --- a/backends/platform/ds/arm9/source/console2.h +++ b/backends/platform/ds/arm9/source/console2.h @@ -25,7 +25,7 @@ // // Changelog: // 0.1: First version -// 0.2: Fixed sprite mapping bug. 1D mapping should work now. +// 0.2: Fixed sprite mapping bug. 1D mapping should work now. // Changed some register defines for consistency. // ////////////////////////////////////////////////////////////////////// @@ -87,7 +87,7 @@ void consoleClear(void); // // Changelog: // 0.1: First version -// 0.2: Fixed sprite mapping bug. 1D mapping should work now. +// 0.2: Fixed sprite mapping bug. 1D mapping should work now. // Changed some register defines for consistency. // ////////////////////////////////////////////////////////////////////// diff --git a/backends/platform/ds/arm9/source/dsmain.cpp b/backends/platform/ds/arm9/source/dsmain.cpp index 458cfe7923..492b7384ec 100644 --- a/backends/platform/ds/arm9/source/dsmain.cpp +++ b/backends/platform/ds/arm9/source/dsmain.cpp @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ - + // - Remove scummconsole.c // - Delete files @@ -244,8 +244,8 @@ bool cpuScalerEnable = false; // 150 192 // 200 128 - // (256 << 8) / scale - + // (256 << 8) / scale + #ifdef USE_PROFILER @@ -259,7 +259,7 @@ u8* scalerBackBuffer = NULL; gameListType gameList[NUM_SUPPORTED_GAMES] = { // Unknown game - use normal SCUMM controls {"unknown", CONT_SCUMM_ORIGINAL}, - + // SCUMM games {"maniac", CONT_SCUMM_ORIGINAL}, {"zak", CONT_SCUMM_ORIGINAL}, @@ -270,7 +270,7 @@ gameListType gameList[NUM_SUPPORTED_GAMES] = { {"monkey2", CONT_SCUMM_ORIGINAL}, {"tentacle", CONT_SCUMM_ORIGINAL}, {"samnmax", CONT_SCUMM_SAMNMAX}, - + // Non-SCUMM games {"sky", CONT_SKY}, {"simon1", CONT_SIMON}, @@ -356,8 +356,8 @@ void setTopScreenZoom(int percentage) { // 150 192 // 200 128 - // (256 << 8) / scale - + // (256 << 8) / scale + s32 scale = (percentage << 8) / 100; subScreenScale = (256 * 256) / scale; @@ -374,11 +374,11 @@ controlType getControlType() { //plays an 8 bit mono sample at 11025Hz void playSound(const void* data, u32 length, bool loop, bool adpcm, int rate) { - + if (!IPC->soundData) { soundControl.count = 0; } - + soundControl.data[soundControl.count].data = data; soundControl.data[soundControl.count].len = length | (loop? 0x80000000: 0x00000000); soundControl.data[soundControl.count].rate = rate; // 367 samples per frame @@ -428,14 +428,14 @@ void initSprites() { sprites[i].attribute[2] = 0; sprites[i].filler = 0; } - + for (int i = 0; i < 128; i++) { spritesMain[i].attribute[0] = ATTR0_DISABLED; spritesMain[i].attribute[1] = 0; spritesMain[i].attribute[2] = 0; spritesMain[i].filler = 0; } - + updateOAM(); } @@ -446,7 +446,7 @@ void saveGameBackBuffer() { // So, I lock the video memory here, as if I'm going to modify it. This // forces OSystem_DS to create a system memory copy if one doesn't exist. // This will be automatially resotred by OSystem_DS::updateScreen(). - + OSystem_DS::instance()->lockScreen(); OSystem_DS::instance()->unlockScreen(); } @@ -460,22 +460,22 @@ void startSound(int freq, int buffer) { bufferFirstHalf = false; bufferSecondHalf = true; - + int bytes = (2 * (bufferSamples)) + 100; - + soundBuffer = (s16 *) malloc(bytes * 2); if (!soundBuffer) consolePrintf("Sound buffer alloc failed\n"); soundHiPart = true; - + for (int r = 0; r < bytes; r++) { soundBuffer[r] = 0; } soundFrequency = freq; - + swiWaitForVBlank(); swiWaitForVBlank(); @@ -507,14 +507,14 @@ void initGame() { // consolePrintf("\n\n\n\nCurrent game: '%s' %d\n", gameName, gameName[0]); currentGame = &gameList[0]; // Default game - + for (int r = 0; r < NUM_SUPPORTED_GAMES; r++) { if (!stricmp(gameName, gameList[r].gameId)) { currentGame = &gameList[r]; // consolePrintf("Game list num: %d\n", currentGame); } } - + /* if (firstTime) { firstTime = false; @@ -557,7 +557,7 @@ void displayMode8Bit() { consolePrintf("displayMode8Bit..."); #endif u16 buffer[32 * 32]; - + setKeyboardEnable(false); if (!displayModeIs8Bit) { @@ -568,7 +568,7 @@ void displayMode8Bit() { consoleInitDefault((u16*)SCREEN_BASE_BLOCK(2), (u16*)CHAR_BASE_BLOCK(0), 16); consolePrintSet(0, 23); - + if (!displayModeIs8Bit) { for (int r = 0; r < 32 * 32; r++) { ((u16 *) SCREEN_BASE_BLOCK(2))[r] = buffer[r]; @@ -577,20 +577,20 @@ void displayMode8Bit() { } displayModeIs8Bit = true; - + if (isCpuScalerEnabled()) { - videoSetMode(MODE_5_2D | (consoleEnable? DISPLAY_BG0_ACTIVE: 0) | DISPLAY_BG3_ACTIVE | DISPLAY_SPR_ACTIVE | DISPLAY_SPR_1D | DISPLAY_SPR_1D_BMP); + videoSetMode(MODE_5_2D | (consoleEnable? DISPLAY_BG0_ACTIVE: 0) | DISPLAY_BG3_ACTIVE | DISPLAY_SPR_ACTIVE | DISPLAY_SPR_1D | DISPLAY_SPR_1D_BMP); videoSetModeSub(MODE_3_2D /*| DISPLAY_BG0_ACTIVE*/ | DISPLAY_BG3_ACTIVE | DISPLAY_SPR_ACTIVE | DISPLAY_SPR_1D | DISPLAY_SPR_1D_BMP); //sub bg 0 will be used to print text - + vramSetBankA(VRAM_A_MAIN_BG_0x06000000); vramSetBankB(VRAM_B_MAIN_BG_0x06020000); - + vramSetBankC(VRAM_C_SUB_BG_0x06200000); vramSetBankD(VRAM_D_SUB_SPRITE); - + vramSetBankH(VRAM_H_LCD); - + BG3_CR = BG_BMP16_256x256 | BG_BMP_BASE(8); BG3_XDX = 256; @@ -601,27 +601,27 @@ void displayMode8Bit() { } else { - videoSetMode(MODE_5_2D | (consoleEnable? DISPLAY_BG0_ACTIVE: 0) | DISPLAY_BG3_ACTIVE | DISPLAY_SPR_ACTIVE | DISPLAY_SPR_1D | DISPLAY_SPR_1D_BMP); + videoSetMode(MODE_5_2D | (consoleEnable? DISPLAY_BG0_ACTIVE: 0) | DISPLAY_BG3_ACTIVE | DISPLAY_SPR_ACTIVE | DISPLAY_SPR_1D | DISPLAY_SPR_1D_BMP); videoSetModeSub(MODE_3_2D /*| DISPLAY_BG0_ACTIVE*/ | DISPLAY_BG3_ACTIVE | DISPLAY_SPR_ACTIVE | DISPLAY_SPR_1D | DISPLAY_SPR_1D_BMP); //sub bg 0 will be used to print text - + vramSetBankA(VRAM_A_MAIN_BG_0x06000000); vramSetBankB(VRAM_B_MAIN_BG_0x06020000); - + vramSetBankC(VRAM_C_SUB_BG_0x06200000); vramSetBankD(VRAM_D_SUB_SPRITE); - + vramSetBankH(VRAM_H_LCD); - + BG3_CR = BG_BMP8_512x256 | BG_BMP_BASE(8); - + BG3_XDX = (int) (((float) (gameWidth) / 256.0f) * 256); BG3_XDY = 0; BG3_YDX = 0; BG3_YDY = (int) ((200.0f / 192.0f) * 256); - } - + } + SUB_BG3_CR = BG_BMP8_512x256; - + SUB_BG3_XDX = (int) (subScreenWidth / 256.0f * 256); SUB_BG3_XDY = 0; SUB_BG3_YDX = 0; @@ -633,15 +633,15 @@ void displayMode8Bit() { BG0_CR = BG_MAP_BASE(2) | BG_TILE_BASE(0); BG0_Y0 = 0; - - // Restore palette entry used by text in the front-end + + // Restore palette entry used by text in the front-end // PALETTE_SUB[255] = savedPalEntry255; - - + + initGame(); - + #ifdef HEAVY_LOGGING consolePrintf("done\n"); #endif @@ -653,9 +653,9 @@ void displayMode8Bit() { } uploadSpriteGfx(); - + keyboardEnable = false; - + } void setGameID(int id) { @@ -668,22 +668,22 @@ void dummyHandler() { void checkSleepMode() { if (IPC->performArm9SleepMode) { - + consolePrintf("ARM9 Entering sleep mode\n"); - + int intSave = REG_IE; irqSet(IRQ_VBLANK, dummyHandler); // int irqHandlerSave = (int) IRQ_HANDLER; REG_IE = IRQ_VBLANK; //IRQ_HANDLER = dummyHandler; - + int powerSave = POWER_CR; POWER_CR &= ~POWER_ALL; - + while (IPC->performArm9SleepMode) { swiWaitForVBlank(); } - + POWER_CR = powerSave; // IRQ_HANDLER = (void (*)()) irqHandlerSave; irqSet(IRQ_VBLANK, VBlankHandler); @@ -722,18 +722,18 @@ void setCursorIcon(const u8* icon, uint w, uint h, byte keycolor, int hotspotX, { int off = 128*64; - - + + memset(SPRITE_GFX + off, 0, 32 * 32 * 2); memset(SPRITE_GFX_SUB + off, 0, 32 * 32 * 2); - + for (uint y=0; ygetDSPaletteEntry(color)); - + if (color == keycolor) { SPRITE_GFX[off+(y)*32+x] = 0x0000; // black background SPRITE_GFX_SUB[off+(y)*32+x] = 0x0000; // black background @@ -743,23 +743,23 @@ void setCursorIcon(const u8* icon, uint w, uint h, byte keycolor, int hotspotX, } } } - + } if (currentGame->control != CONT_SCUMM_SAMNMAX) return; uint16 border = RGB15(24,24,24) | 0x8000; - - + + int off = 176*64; memset(SPRITE_GFX_SUB+off, 0, 64*64*2); memset(SPRITE_GFX+off, 0, 64*64*2); - + int pos = 190 - (w+2); - - + + // make border for (uint i=0; i> 1; for (uint y=0; ygetMixerImpl()) { lastCallbackFrame = frameCount; - + for (int r = IPC->playingSection; r < IPC->playingSection + 4; r++) { int chunk = r & 3; - + if (IPC->fillNeeded[chunk]) { IPC->fillNeeded[chunk] = false; DC_FlushAll(); @@ -993,9 +993,9 @@ void doSoundCallback() { IPC->fillNeeded[chunk] = false; DC_FlushAll(); } - + } - + } #ifdef HEAVY_LOGGING consolePrintf("done\n"); @@ -1007,7 +1007,7 @@ void doTimerCallback() { if (callbackTimer <= 0) { callbackTimer += callbackInterval; callback(callbackInterval); - } + } } } @@ -1016,15 +1016,15 @@ void soundUpdate() { // playSound(soundBuffer, (bufferSamples * 2), true); } // consolePrintf("%x\n", IPC->test); - - + + if (bufferFrame == 0) { // bufferFirstHalf = true; - } + } if (bufferFrame == bufferSize >> 1) { //bufferSecondHalf = true; - } - + } + bufferFrame++; if (bufferFrame == bufferSize) { bufferFrame = 0; @@ -1037,20 +1037,20 @@ void memoryReport() { do { p = (int *) malloc(r * 8192); free(p); - r++; + r++; } while ((p) && (r < 512)); - + int t = -1; void* block[1024]; do { t++; block[t] = (int *) malloc(4096); - } while ((t < 1024) && (block[t])); - + } while ((t < 1024) && (block[t])); + for (int q = 0; q < t; q++) { free(block[q]); } - + consolePrintf("Free: %dK, Largest: %dK\n", t * 4, r * 8); } @@ -1061,7 +1061,7 @@ void addIndyFightingKeys() { event.type = Common::EVENT_KEYDOWN; event.kbd.flags = 0; - + // consolePrintf("Fight keys\n"); if ((getKeysDown() & KEY_L)) { @@ -1091,16 +1091,16 @@ void addIndyFightingKeys() { event.kbd.keycode = Common::KEYCODE_6; event.kbd.ascii = '6'; system->addEvent(event); - } + } if ((getKeysChanged() & KEY_DOWN)) { event.type = getKeyEvent(KEY_DOWN); event.kbd.keycode = Common::KEYCODE_2; event.kbd.ascii = '2'; system->addEvent(event); } - + if (indyFightRight) { - + if ((getKeysChanged() & KEY_X)) { event.type = getKeyEvent(KEY_X); event.kbd.keycode = Common::KEYCODE_9; @@ -1118,7 +1118,7 @@ void addIndyFightingKeys() { event.kbd.keycode = Common::KEYCODE_3; event.kbd.ascii = '3'; system->addEvent(event); - } + } } else { @@ -1139,18 +1139,18 @@ void addIndyFightingKeys() { event.kbd.keycode = Common::KEYCODE_1; event.kbd.ascii = '1'; system->addEvent(event); - } - + } + } - - + + if ((getKeysChanged() & KEY_Y)) { event.type = getKeyEvent(KEY_Y); event.kbd.keycode = Common::KEYCODE_5; event.kbd.ascii = '5'; system->addEvent(event); } -} +} void setKeyboardEnable(bool en) { @@ -1162,8 +1162,8 @@ void setKeyboardEnable(bool en) { DS::drawKeyboard(1, 15, backupBank); - - + + SUB_BG1_CR = BG_TILE_BASE(1) | BG_MAP_BASE(15); if (displayModeIs8Bit) { @@ -1185,10 +1185,10 @@ void setKeyboardEnable(bool en) { for (int r = 0; r < 256; r++) { BG_PALETTE_SUB[r] = BG_PALETTE[r]; } - - + + //restoreVRAM(1, 12, backupBank); - + if (displayModeIs8Bit) { // Copy the sub screen VRAM from the top screen - they should always be // the same. @@ -1200,17 +1200,17 @@ void setKeyboardEnable(bool en) { BG_GFX_SUB[y * 256 + x] = buffer[(y * (stride / 2)) + x]; } } -/* +/* for (int r = 0; r < (512 * 256) >> 1; r++) BG_GFX_SUB[r] = buffer[r]; - */ + */ SUB_DISPLAY_CR &= ~DISPLAY_BG1_ACTIVE; // Turn off keyboard layer SUB_DISPLAY_CR |= DISPLAY_BG3_ACTIVE; // Turn on game layer } else { SUB_DISPLAY_CR &= ~DISPLAY_BG1_ACTIVE; // Turn off keyboard layer SUB_DISPLAY_CR |= DISPLAY_BG0_ACTIVE; // Turn on console layer } - + // Restore the screens so they're the right way round if (gameScreenSwap) { POWER_CR |= POWER_SWAP_LCDS; @@ -1321,7 +1321,7 @@ void doButtonSelectMode(OSystem_DS* system) if ((mouseMode != MOUSE_HOVER) || (!displayModeIs8Bit)) { - if (getPenDown() && (!(getKeysHeld() & KEY_L)) && (!(getKeysHeld() & KEY_R))) { + if (getPenDown() && (!(getKeysHeld() & KEY_L)) && (!(getKeysHeld() & KEY_R))) { if ((mouseMode == MOUSE_LEFT) || (!displayModeIs8Bit)) { event.type = Common::EVENT_LBUTTONDOWN; leftButtonDown = true; @@ -1333,7 +1333,7 @@ void doButtonSelectMode(OSystem_DS* system) event.mouse = Common::Point(getPenX(), getPenY()); system->addEvent(event); } - + } else { // In hover mode, D-pad left and right click the mouse when the pen is on the screen @@ -1369,7 +1369,7 @@ void doButtonSelectMode(OSystem_DS* system) if (getKeysDown() & KEY_LEFT) { mouseMode = MOUSE_LEFT; } - + if (rightButtonDown) { Common::Event event; @@ -1378,8 +1378,8 @@ void doButtonSelectMode(OSystem_DS* system) system->addEvent(event); rightButtonDown = false; } - - + + if (getKeysDown() & KEY_RIGHT) { if ((currentGame->control != CONT_SCUMM_SAMNMAX) && (currentGame->control != CONT_FUTURE_WARS) && (currentGame->control != CONT_GOBLINS)) { mouseMode = MOUSE_RIGHT; @@ -1387,7 +1387,7 @@ void doButtonSelectMode(OSystem_DS* system) // If we're playing sam and max, click and release the right mouse // button to change verb Common::Event event; - + if (currentGame->control == CONT_FUTURE_WARS) { event.mouse = Common::Point(320 - 128, 200 - 128); event.type = Common::EVENT_MOUSEMOVE; @@ -1395,20 +1395,20 @@ void doButtonSelectMode(OSystem_DS* system) } else { event.mouse = Common::Point(getPenX(), getPenY()); } - + rightButtonDown = true; - - + + event.type = Common::EVENT_RBUTTONDOWN; system->addEvent(event); - + //event.type = Common::EVENT_RBUTTONUP; //system->addEvent(event); } } - - - + + + if (getKeysDown() & KEY_UP) { mouseMode = MOUSE_HOVER; } @@ -1423,7 +1423,7 @@ void addEventsToQueue() { OSystem_DS* system = OSystem_DS::instance(); Common::Event event; - + #ifdef USE_PROFILER if (keysDown() & KEY_R) { cygprofile_begin(); @@ -1435,7 +1435,7 @@ void addEventsToQueue() { } #endif - + if (system->isEventQueueEmpty()) { /* @@ -1444,7 +1444,7 @@ void addEventsToQueue() { consolePrintf("Tweak: %d\n", tweak); IPC->tweakChanged = true; } - + if (getKeysDown() & KEY_R) { tweak++; @@ -1460,14 +1460,14 @@ void addEventsToQueue() { if (!indyFightState) { - if ((!(getKeysHeld() & KEY_L)) && (!(getKeysHeld() & KEY_R)) && (getKeysDown() & KEY_B)) { + if ((!(getKeysHeld() & KEY_L)) && (!(getKeysHeld() & KEY_R)) && (getKeysDown() & KEY_B)) { if (currentGame->control == CONT_AGI) { event.kbd.keycode = Common::KEYCODE_RETURN; event.kbd.ascii = 13; event.kbd.flags = 0; } else { - event.kbd.keycode = Common::KEYCODE_ESCAPE; - event.kbd.ascii = 27; + event.kbd.keycode = Common::KEYCODE_ESCAPE; + event.kbd.ascii = 27; event.kbd.flags = 0; } @@ -1477,11 +1477,11 @@ void addEventsToQueue() { event.type = Common::EVENT_KEYUP; system->addEvent(event); } - + } - - - + + + if ((!getIndyFightState()) && (getKeysDown() & KEY_Y)) { consoleEnable = !consoleEnable; if (displayModeIs8Bit) { @@ -1490,7 +1490,7 @@ void addEventsToQueue() { displayMode16Bit(); } } - + if ((getKeyboardEnable())) { event.kbd.flags = 0; @@ -1498,30 +1498,30 @@ void addEventsToQueue() { bool release = getKeysReleased() & (KEY_LEFT | KEY_RIGHT | KEY_UP | KEY_DOWN); bool shoulders = getKeysHeld() & (KEY_L | KEY_R); - if ( (down && (!shoulders)) || release) + if ( (down && (!shoulders)) || release) { - + if (getKeysChanged() & KEY_LEFT) { event.kbd.keycode = Common::KEYCODE_LEFT; event.kbd.ascii = 0; event.type = getKeyEvent(KEY_LEFT); system->addEvent(event); } - + if (getKeysChanged() & KEY_RIGHT) { event.kbd.keycode = Common::KEYCODE_RIGHT; event.kbd.ascii = 0; event.type = getKeyEvent(KEY_RIGHT); system->addEvent(event); } - + if (getKeysChanged() & KEY_UP) { event.kbd.keycode = Common::KEYCODE_UP; event.kbd.ascii = 0; event.type = getKeyEvent(KEY_UP); system->addEvent(event); } - + if (getKeysChanged() & KEY_DOWN) { event.kbd.keycode = Common::KEYCODE_DOWN; event.kbd.ascii = 0; @@ -1529,9 +1529,9 @@ void addEventsToQueue() { system->addEvent(event); } } - + } - + if (!((getKeysHeld() & KEY_L) || (getKeysHeld() & KEY_R)) && (!getIndyFightState()) && (!getKeyboardEnable())) { if ((getKeysDown() & KEY_A) && (!indyFightState)) { @@ -1544,10 +1544,10 @@ void addEventsToQueue() { } } - - - - + + + + } if ((getKeysDown() & KEY_SELECT)) { @@ -1556,18 +1556,18 @@ void addEventsToQueue() { showOptionsDialog(); } - + } - + if (!getIndyFightState() && !((getKeysHeld() & KEY_L) || (getKeysHeld() & KEY_R)) && (getKeysDown() & KEY_X)) { setKeyboardEnable(!keyboardEnable); } - - updateStatus(); - + + updateStatus(); + Common::Event event; - + if (!keyboardEnable) { if ((tapScreenClicks) && (getIsDisplayMode8Bit())) @@ -1578,11 +1578,11 @@ void addEventsToQueue() { { doButtonSelectMode(system); } - + if (((!(getKeysHeld() & KEY_L)) && (!(getKeysHeld() & KEY_R)) || (indyFightState)) && (displayModeIs8Bit)) { // Controls specific to the control method - - + + if (currentGame->control == CONT_SKY) { // Extra controls for Beneath a Steel Sky if ((getKeysDown() & KEY_DOWN)) { @@ -1595,7 +1595,7 @@ void addEventsToQueue() { // Extra controls for Simon the Sorcerer if ((getKeysDown() & KEY_DOWN)) { Common::Event event; - + event.type = Common::EVENT_KEYDOWN; event.kbd.keycode = Common::KEYCODE_F10; // F10 or # - show hotspots event.kbd.ascii = Common::ASCII_F10; @@ -1608,13 +1608,13 @@ void addEventsToQueue() { } } - - + + if (currentGame->control == CONT_SCUMM_ORIGINAL) { // Extra controls for Scumm v1-5 games if ((getKeysDown() & KEY_DOWN)) { Common::Event event; - + event.type = Common::EVENT_KEYDOWN; event.kbd.keycode = Common::KEYCODE_PERIOD; // Full stop - skips current dialogue line event.kbd.ascii = '.'; @@ -1624,19 +1624,19 @@ void addEventsToQueue() { event.type = Common::EVENT_KEYUP; system->addEvent(event); } - + if (indyFightState) { addIndyFightingKeys(); } - + } - + } } - + if (!displayModeIs8Bit) { // Front end controls - + if (leftHandedSwap(getKeysChanged()) & KEY_UP) { event.type = getKeyEvent(leftHandedSwap(KEY_UP)); event.kbd.keycode = Common::KEYCODE_UP; @@ -1663,10 +1663,10 @@ void addEventsToQueue() { event.type = Common::EVENT_KEYUP; system->addEvent(event); } - + } - + if ((getKeysChanged() & KEY_START)) { event.type = getKeyEvent(KEY_START); if (currentGame->control == CONT_FUTURE_WARS) { @@ -1688,34 +1688,34 @@ void addEventsToQueue() { system->addEvent(event); } - + if (keyboardEnable) { DS::addKeyboardEvents(); } - + consumeKeys(); - + consumePenEvents(); } } - + void triggerIcon(int imageNum) { triggeredIcon = imageNum; - triggeredIconTimeout = 120; + triggeredIconTimeout = 120; } - + void setIcon(int num, int x, int y, int imageNum, int flags, bool enable) { - sprites[num].attribute[0] = ATTR0_BMP | (enable? (y & 0xFF): 192) | (!enable? ATTR0_DISABLED: 0); + sprites[num].attribute[0] = ATTR0_BMP | (enable? (y & 0xFF): 192) | (!enable? ATTR0_DISABLED: 0); sprites[num].attribute[1] = ATTR1_SIZE_32 | (x & 0x1FF) | flags; sprites[num].attribute[2] = ATTR2_ALPHA(1)| (imageNum * 16); } void setIconMain(int num, int x, int y, int imageNum, int flags, bool enable) { - spritesMain[num].attribute[0] = ATTR0_BMP | (y & 0xFF) | (!enable? ATTR0_DISABLED: 0); + spritesMain[num].attribute[0] = ATTR0_BMP | (y & 0xFF) | (!enable? ATTR0_DISABLED: 0); spritesMain[num].attribute[1] = ATTR1_SIZE_32 | (x & 0x1FF) | flags; spritesMain[num].attribute[2] = ATTR2_ALPHA(1)| (imageNum * 16); } @@ -1744,17 +1744,17 @@ void updateStatus() { break; } } - + setIcon(0, 208, 150, offs, 0, true); } - + if (indyFightState) { setIcon(1, (190 - 32), 150, 3, (indyFightRight? 0: ATTR1_FLIP_X), true); // consolePrintf("%d\n", indyFightRight); } else { // setIcon(1, 0, 0, 0, 0, false); } - + if (triggeredIconTimeout > 0) { triggeredIconTimeout--; setIcon(4, 16, 150, triggeredIcon, 0, true); @@ -1793,7 +1793,7 @@ void soundBufferEmptyHandler() { } else { // bufferFirstHalf = true; } - + soundHiPart = !soundHiPart; } @@ -1804,7 +1804,7 @@ void setMainScreenScroll(int x, int y) { } else */{ BG3_CX = x + (((frameCount & 1) == 0)? 64: 0); BG3_CY = y; - + if ((!gameScreenSwap) || (touchPadStyle)) { touchX = x >> 8; touchY = y >> 8; @@ -1827,14 +1827,14 @@ void setMainScreenScale(int x, int y) { BG3_YDY = y; } else - { + { BG3_XDX = x; BG3_XDY = 0; BG3_YDX = 0; BG3_YDY = y; } - - if ((!gameScreenSwap) || (touchPadStyle)) { + + if ((!gameScreenSwap) || (touchPadStyle)) { touchScX = x; touchScY = y; } @@ -1845,7 +1845,7 @@ void setZoomedScreenScroll(int x, int y, bool shake) { /* if (gameScreenSwap) { BG3_CX = x + ((shake && ((frameCount & 1) == 0))? 64: 0); BG3_CY = y; - + touchX = x >> 8; touchY = y >> 8; } else */{ @@ -1908,7 +1908,7 @@ void VBlankHandler(void) { soundUpdate(); - + if ((!gameScreenSwap) && (!(getKeysHeld() & KEY_L) && !(getKeysHeld() & KEY_R))) { if (currentGame) { @@ -1923,14 +1923,14 @@ void VBlankHandler(void) { } } } - + penUpdate(); keysUpdate(); frameCount++; - + if ((cursorEnable) && (mouseCursorVisible)) { if (!keyboardEnable) { storedMouseX = penX; @@ -1953,31 +1953,31 @@ void VBlankHandler(void) { if (callback) { callbackTimer -= FRAME_TIME; } - + if ((getKeysHeld() & KEY_L) || (getKeysHeld() & KEY_R)) { - + if ((!dragging) && (getPenHeld()) && (penDownFrames > 5)) { dragging = true; dragStartX = penX; dragStartY = penY; - + if (gameScreenSwap) { dragScX = subScTargetX; dragScY = subScTargetY; } else { dragScX = scX; - dragScY = scY; - } - - + dragScY = scY; + } + + } - + if ((dragging) && (!getPenHeld())) { dragging = false; } - + if (dragging) { - + if (gameScreenSwap) { subScTargetX = dragScX + ((dragStartX - penX) << 8); subScTargetY = dragScY + ((dragStartY - penY) << 8); @@ -1985,18 +1985,18 @@ void VBlankHandler(void) { scX = dragScX + ((dragStartX - penX)); scY = dragScY + ((dragStartY - penY)); } - + // consolePrintf("X:%d Y:%d\n", dragStartX - penX, dragStartY - penY); } - } - - + } + + /* if ((frameCount & 1) == 0) { SUB_BG3_CX = subScX; } else { SUB_BG3_CX = subScX + 64; } - + SUB_BG3_CY = subScY + (shakePos << 8);*/ /*SUB_BG3_XDX = (int) (subScreenWidth / 256.0f * 256); @@ -2005,26 +2005,26 @@ void VBlankHandler(void) { SUB_BG3_YDY = (int) (subScreenHeight / 192.0f * 256);*/ static int ratio = (320 << 8) / SCUMM_GAME_WIDTH; - + bool zooming = false; - + if ((getKeysHeld() & KEY_L) || (getKeysHeld() & KEY_R)) { if ((getKeysHeld() & KEY_A) && (subScreenScale < ratio)) { subScreenScale += 1; zooming = true; } - + if ((getKeysHeld() & KEY_B) && (subScreenScale > 128)) { subScreenScale -=1; zooming = true; } } - + int xCenter = subScTargetX + ((subScreenWidth >> 1) << 8); int yCenter = subScTargetY + ((subScreenHeight >> 1) << 8); - + if (twoHundredPercentFixedScale) { subScreenWidth = 256 >> 1; subScreenHeight = 192 >> 1; @@ -2033,9 +2033,9 @@ void VBlankHandler(void) { // subScreenHeight = SCUMM_GAME_HEIGHT * subScreenScale >> 8; - subScreenWidth = (256 * subScreenScale) >> 8; + subScreenWidth = (256 * subScreenScale) >> 8; subScreenHeight = (192 * subScreenScale) >> 8; - + if ( ((subScreenWidth) > 256 - 8) && ((subScreenWidth) < 256 + 8) ) { subScreenWidth = 256; subScreenHeight = 192; @@ -2064,13 +2064,13 @@ void VBlankHandler(void) { //triggerIcon(-1); } } - + subScTargetX = xCenter - ((subScreenWidth >> 1) << 8); subScTargetY = yCenter - ((subScreenHeight >> 1) << 8); - - + + if (subScTargetX < 0) subScTargetX = 0; if (subScTargetX > (gameWidth - subScreenWidth) << 8) subScTargetX = (gameWidth - subScreenWidth) << 8; @@ -2082,30 +2082,30 @@ void VBlankHandler(void) { subScX += (subScTargetX - subScX) >> 2; subScY += (subScTargetY - subScY) >> 2; - + if (displayModeIs8Bit) { - + if ((getKeysHeld() & KEY_L) || (getKeysHeld() & KEY_R)) { - + int offsX = 0, offsY = 0; if (getKeysHeld() & KEY_LEFT) { offsX -= 1; } - + if (getKeysHeld() & KEY_RIGHT) { offsX += 1; } - + if (getKeysHeld() & KEY_UP) { offsY -= 1; } - + if (getKeysHeld() & KEY_DOWN) { offsY += 1; } - + if (((gameScreenSwap) && (getKeysHeld() & KEY_L)) || ((!gameScreenSwap) && (getKeysHeld() & KEY_R))) { subScTargetX += offsX << 8; subScTargetY += offsY << 8; @@ -2116,32 +2116,32 @@ void VBlankHandler(void) { } if (!scaledMode) { - + if (scX + 256 > gameWidth - 1) { scX = gameWidth - 1 - 256; } - + if (scX < 0) { scX = 0; } - + if (scY + 192 > gameHeight - 1) { scY = gameHeight - 1 - 192; } - + if (scY < 0) { scY = 0; } - + setZoomedScreenScroll(subScX, subScY, (subScreenWidth != 256) && (subScreenWidth != 128)); setZoomedScreenScale(subScreenWidth, ((subScreenHeight * (256 << 8)) / 192) >> 8); - - + + setMainScreenScroll(scX << 8, (scY << 8) + (shakePos << 8)); setMainScreenScale(256, 256); // 1:1 scale - + } else { - + if (scY > gameHeight - 192 - 1) { scY = gameHeight - 192 - 1; } @@ -2149,13 +2149,13 @@ void VBlankHandler(void) { if (scY < 0) { scY = 0; } - + setZoomedScreenScroll(subScX, subScY, (subScreenWidth != 256) && (subScreenWidth != 128)); setZoomedScreenScale(subScreenWidth, ((subScreenHeight * (256 << 8)) / 192) >> 8); - + setMainScreenScroll(64, (scY << 8) + (shakePos << 8)); setMainScreenScale(320, 256); // 1:1 scale - + } } else { setZoomedScreenScroll(0, 0, true); @@ -2164,12 +2164,12 @@ void VBlankHandler(void) { setMainScreenScroll(0, 0); setMainScreenScale(320, 256); // 1:1 scale } - + // Enable on screen keyboard when pen taps icon if ((keyboardIcon) && (penX < 32) && (penY > 160) && (penHeld)) { setKeyboardEnable(true); } - + if (keyboardEnable) { if (DS::getKeyboardClosed()) { setKeyboardEnable(false); @@ -2219,7 +2219,7 @@ void setTopScreenTarget(int x, int y) { if (subScTargetY < 0) subScTargetY = 0; if (subScTargetY > gameHeight - subScreenHeight) subScTargetY = gameHeight - subScreenHeight; - + subScTargetX <<=8; subScTargetY <<=8; } @@ -2233,8 +2233,8 @@ void hBlankHandler() { #endif void uploadSpriteGfx() { - vramSetBankD(VRAM_D_SUB_SPRITE); - vramSetBankE(VRAM_E_MAIN_SPRITE); + vramSetBankD(VRAM_D_SUB_SPRITE); + vramSetBankE(VRAM_E_MAIN_SPRITE); // Convert texture from 24bit 888 to 16bit 1555, remembering to set top bit! u8* srcTex = (u8 *) ::icons_raw; @@ -2242,7 +2242,7 @@ void uploadSpriteGfx() { SPRITE_GFX_SUB[r] = 0x8000 | (srcTex[r * 3] >> 3) | ((srcTex[r * 3 + 1] >> 3) << 5) | ((srcTex[r * 3 + 2] >> 3) << 10); SPRITE_GFX[r] = 0x8000 | (srcTex[r * 3] >> 3) | ((srcTex[r * 3 + 1] >> 3) << 5) | ((srcTex[r * 3 + 2] >> 3) << 10); } - + } void initHardware() { @@ -2253,12 +2253,12 @@ void initHardware() { penInit(); powerON(POWER_ALL); -/* vramSetBankA(VRAM_A_MAIN_BG); - vramSetBankB(VRAM_B_MAIN_BG); +/* vramSetBankA(VRAM_A_MAIN_BG); + vramSetBankB(VRAM_B_MAIN_BG); vramSetBankC(VRAM_C_SUB_BG); */ - vramSetBankD(VRAM_D_SUB_SPRITE); - vramSetBankE(VRAM_E_MAIN_SPRITE); - + vramSetBankD(VRAM_D_SUB_SPRITE); + vramSetBankE(VRAM_E_MAIN_SPRITE); + currentTimeMillis = 0; @@ -2286,8 +2286,8 @@ void initHardware() { // Allocate save buffer for game screen // savedBuffer = new u8[320 * 200]; displayMode16Bit(); - - memset(BG_GFX, 0, 512 * 256 * 2); + + memset(BG_GFX, 0, 512 * 256 * 2); scaledMode = true; scX = 0; scY = 0; @@ -2295,33 +2295,33 @@ void initHardware() { subScY = 0; subScTargetX = 0; subScTargetY = 0; - + //lcdSwap(); POWER_CR &= ~POWER_SWAP_LCDS; - + frameCount = 0; callback = NULL; - -// vramSetBankH(VRAM_H_SUB_BG); - + +// vramSetBankH(VRAM_H_SUB_BG); + // // Do text stuff //BG0_CR = BG_MAP_BASE(0) | BG_TILE_BASE(1); // BG0_Y0 = 48; - + PALETTE[255] = RGB15(31,31,31);//by default font will be rendered with color 255 - + //consoleInit() is a lot more flexible but this gets you up and running quick // consoleInitDefault((u16*)SCREEN_BASE_BLOCK(0), (u16*)CHAR_BASE_BLOCK(1), 16); //consolePrintSet(0, 6); - + //irqs are nice irqInit(); // irqInitHandler(); irqSet(IRQ_VBLANK, VBlankHandler); irqSet(IRQ_TIMER0, timerTickHandler); irqSet(IRQ_TIMER2, soundBufferEmptyHandler); - + irqEnable(IRQ_VBLANK); irqEnable(IRQ_TIMER0); irqEnable(IRQ_TIMER2); @@ -2330,15 +2330,15 @@ void initHardware() { irqSet(IRQ_HBLANK, hBlankHandler); irqEnable(IRQ_HBLANK); #endif - - + + // Set up a millisecond timer #ifdef HEAVY_LOGGING consolePrintf("Setting up timer..."); #endif TIMER0_CR = 0; TIMER0_DATA = (u32) TIMER_FREQ(1000); - TIMER0_CR = TIMER_ENABLE | TIMER_DIV_1 | TIMER_IRQ_REQ; + TIMER0_CR = TIMER_ENABLE | TIMER_DIV_1 | TIMER_IRQ_REQ; REG_IME = 1; #ifdef HEAVY_LOGGING consolePrintf("done\n"); @@ -2347,7 +2347,7 @@ void initHardware() { PALETTE[255] = RGB15(0,0,31); initSprites(); - + // videoSetModeSub(MODE_3_2D | DISPLAY_BG0_ACTIVE | DISPLAY_BG3_ACTIVE | DISPLAY_SPR_ACTIVE | DISPLAY_SPR_1D | DISPLAY_SPR_1D_BMP); //sub bg 0 will be used to print text // If the software scaler's back buffer has not been allocated, do it now @@ -2405,7 +2405,7 @@ void penUpdate() { if ((tapTimeout >= 0)) { tapTimeout++; - + if (((tapTimeout > 15) || (tapCount == 2)) && (tapCount > 0)) { tapComplete = tapCount; tapCount = 0; @@ -2413,7 +2413,7 @@ void penUpdate() { } } - + if ((penHeld) && (!penDownThisFrame)) { if ((touchPadStyle) || (moved) || (tapCount == 1)) { @@ -2427,15 +2427,15 @@ void penUpdate() { } } - + if ((touchPadStyle) && (getIsDisplayMode8Bit())) { - - if ((penDownFrames > 0)) { - - + + if ((penDownFrames > 0)) { + + if ((penHeld)) { - + if (penDownThisFrame) { if (penDownFrames >= 2) { @@ -2446,13 +2446,13 @@ void penUpdate() { if ((ABS(diffX) < 35) && (ABS(diffY) < 35)) { - + if (speed >= 8) { diffX *= ((speed >> 3) * touchPadSensitivity) >> 3; diffY *= ((speed >> 3) * touchPadSensitivity) >> 3; } - + penX += diffX; penY += diffY; if (penX > 255) penX = 255; @@ -2460,30 +2460,30 @@ void penUpdate() { if (penY > 191) penY = 191; if (penY < 0) penY = 0; } - + // consolePrintf("x: %d y: %d\n", IPC->touchYpx - penDownY, IPC->touchYpx - penDownY); penDownX = IPC->touchXpx; penDownY = IPC->touchYpx; - + } } else { } - - + + } else { penDown = true; penHeld = true; penDownSaved = true; - + // First frame, so save pen positions if (penDownThisFrame) { penDownX = IPC->touchXpx; penDownY = IPC->touchYpx; } } - + } else { if (penHeld) { penReleased = true; @@ -2491,13 +2491,13 @@ void penUpdate() { } else { penReleased = false; } - + penDown = false; penHeld = false; } } else { if ((penDownFrames > 1)) { // Is this right? Dunno, but it works for me. - + if ((penHeld)) { penHeld = true; penDown = false; @@ -2512,9 +2512,9 @@ void penUpdate() { penY = IPC->touchYpx + touchYOffset; moved = true; } - - + + } else { if (penHeld) { penReleased = true; @@ -2522,12 +2522,12 @@ void penUpdate() { } else { penReleased = false; } - + penDown = false; penHeld = false; } - - + + } @@ -2545,20 +2545,20 @@ int leftHandedSwap(int keys) { // Start and select are unchanged if (leftHandedMode) { int result = keys & (~(KEY_R | KEY_L | KEY_Y | KEY_A | KEY_B | KEY_X | KEY_LEFT | KEY_RIGHT | KEY_UP | KEY_DOWN)); - + if (keys & KEY_L) result |= KEY_R; if (keys & KEY_R) result |= KEY_L; - + if (keys & KEY_LEFT) result |= KEY_Y; if (keys & KEY_RIGHT) result |= KEY_A; if (keys & KEY_DOWN) result |= KEY_B; if (keys & KEY_UP) result |= KEY_X; - + if (keys & KEY_Y) result |= KEY_LEFT; if (keys & KEY_A) result |= KEY_RIGHT; if (keys & KEY_B) result |= KEY_DOWN; if (keys & KEY_X) result |= KEY_UP; - + return result; } else { return keys; @@ -2647,10 +2647,10 @@ int getPenY() { GLvector getPenPos() { GLvector v; - + v.x = (penX * inttof32(1)) / SCREEN_WIDTH; v.y = (penY * inttof32(1)) / SCREEN_HEIGHT; - + return v; } @@ -2659,18 +2659,18 @@ GLvector getPenPos() { void formatSramOption() { consolePrintf("The following files are present in save RAM:\n"); DSSaveFileManager::instance()->listFiles(); - + consolePrintf("\nAre you sure you want to\n"); consolePrintf("DELETE all files?\n"); consolePrintf("A = Yes, X = No\n"); - + while (true) { if (keysHeld() & KEY_A) { DSSaveFileManager::instance()->formatSram(); consolePrintf("SRAM cleared!\n"); return; } - + if (keysHeld() & KEY_X) { consolePrintf("Whew, that was close!\n"); return; @@ -2708,7 +2708,7 @@ void* fastRamAlloc(int size) { if(fastRamPointer > fastRamData + FAST_RAM_SIZE) { consolePrintf("FastRam (ITCM) allocation failed!\n"); return NULL; - } + } return result; } @@ -2723,7 +2723,7 @@ void fastRamReset() { bool GBAMPAvail = false; -bool initGBAMP(int mode) { +bool initGBAMP(int mode) { if (FAT_InitFiles()) { if (mode == 2) { disc_IsInserted(); @@ -2748,14 +2748,14 @@ void initDebugger() { set_verbosity(VERBOSE_INFO | VERBOSE_ERROR); wireless_init(0); wireless_connect(); - + // This is where the address of the computer running the Java // stub goes. debugger_connect_tcp(192, 168, 0, 1); - debugger_init(); - + debugger_init(); + // Update function - should really call every frame - user_debugger_update(); + user_debugger_update(); } @@ -2788,7 +2788,7 @@ cardTranslate cardReaderTable[] = { void reboot() { int deviceType = -1; - + if (disc_getDeviceId() == DEVICE_DLDI) { char id[6]; @@ -2855,7 +2855,7 @@ void dsExceptionHandler() { consolePrintf("Blue screen of death"); setExceptionHandler(NULL); - + u32 currentMode = getCPSR() & 0x1f; u32 thumbState = ((*(u32*)0x027FFD90) & 0x20); @@ -2871,7 +2871,7 @@ void dsExceptionHandler() { exceptionAddress = getExceptionAddress( codeAddress, thumbState); else exceptionAddress = codeAddress; - + } else { if (thumbState) offset = 2; @@ -2919,13 +2919,13 @@ int main(void) { initDebugger(); } #endif - + // Let arm9 read cartridge *((u16 *) (0x04000204)) &= ~0x0080; - + lastCallbackFrame = 0; tweak = 0; - + indyFightState = false; indyFightRight = true; @@ -2938,25 +2938,25 @@ int main(void) { // bufferSize = 10; - + /*bufferRate = 44100; bufferFrame = 0; bufferSamples = 8192; bufferFirstHalf = false; bufferSecondHalf = true; - + int bytes = (2 * (bufferSamples)) + 100; - + soundBuffer = (s16 *) malloc(bytes * 2); soundHiPart = true; - + for (int r = 0; r < bytes; r++) { soundBuffer[r] = 0; } - + swiWaitForVBlank(); swiWaitForVBlank(); @@ -2965,29 +2965,29 @@ int main(void) { swiWaitForVBlank(); swiWaitForVBlank(); */ - + lastEventFrame = 0; mouseMode = MOUSE_LEFT; - + /* TIMER1_CR = 0; TIMER1_DATA = TIMER_FREQ(bufferRate); TIMER1_CR = TIMER_ENABLE | TIMER_DIV_1; - + TIMER2_CR = 0; TIMER2_DATA = 0xFFFF - (bufferSamples / 2); TIMER2_CR = TIMER_ENABLE | TIMER_IRQ_REQ | TIMER_CASCADE; */ // 2945 - 2947 - - + + // for (int r = 2946; r < 3000; r++) { // soundBuffer[r] = 30000; // } - + //2372 consolePrintf("-------------------------------\n"); @@ -3040,7 +3040,7 @@ int main(void) { consolePrintf("\n"); #endif - + #ifdef USE_BUILT_IN_DRIVER_SELECTION // Do M3 detection selectioon int extraData = DSSaveFileManager::getExtraData(); @@ -3079,7 +3079,7 @@ int main(void) { disc_setEnable(mode); DSSaveFileManager::setExtraData(mode); #else - + int mode = 0; #endif @@ -3125,11 +3125,11 @@ int main(void) { } delete node; - + updateStatus(); - - + + // OSystem_DS::instance(); g_system = new OSystem_DS(); diff --git a/backends/platform/ds/arm9/source/dsmain.h b/backends/platform/ds/arm9/source/dsmain.h index ab74554917..7efd4a9365 100644 --- a/backends/platform/ds/arm9/source/dsmain.h +++ b/backends/platform/ds/arm9/source/dsmain.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ - + #ifndef _DSMAIN_H #define _DSMAIN_H @@ -93,7 +93,7 @@ int getMillis(); // Return the current runtime in milliseconds void doTimerCallback(); // Call callback function if required // Sound -void doSoundCallback(); +void doSoundCallback(); void startSound(int freq, int buffer); // Start sound hardware // Call function if sound buffers need more data void playSound(const void* data, u32 length, bool loop, bool adpcm = false, int rate = 22050); // Start a sound diff --git a/backends/platform/ds/arm9/source/dsoptions.cpp b/backends/platform/ds/arm9/source/dsoptions.cpp index 60f3c2225b..a6996c0fcb 100644 --- a/backends/platform/ds/arm9/source/dsoptions.cpp +++ b/backends/platform/ds/arm9/source/dsoptions.cpp @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ - + #include "dsoptions.h" #include "dsmain.h" #include "gui/dialog.h" @@ -98,7 +98,7 @@ DSOptionsDialog::DSOptionsDialog() : GUI::Dialog(0, 0, 320 - 10, 230 - 40) { _tab->setActiveTab(0); _radioButtonMode = false; - + #ifdef DS_SCUMM_BUILD if (!DS::isGBAMPAvailable()) { // addButton(this, 100, 140, "Delete Save", 'dels', 'D'); @@ -112,7 +112,7 @@ DSOptionsDialog::DSOptionsDialog() : GUI::Dialog(0, 0, 320 - 10, 230 - 40) { // _cpuScaler = new GUI::CheckboxWidget(this, 160, 115, 90, 20, "CPU scaler", 0, 'T'); //#endif - + @@ -145,13 +145,13 @@ DSOptionsDialog::DSOptionsDialog() : GUI::Dialog(0, 0, 320 - 10, 230 - 40) { _unscaledCheckbox->setState(false); } - + if (ConfMan.hasKey("topscreenzoom", "ds")) { - _100PercentCheckbox->setState(false); - _150PercentCheckbox->setState(false); - _200PercentCheckbox->setState(false); - + _100PercentCheckbox->setState(false); + _150PercentCheckbox->setState(false); + _200PercentCheckbox->setState(false); + switch (ConfMan.getInt("topscreenzoom", "ds")) { case 100: { @@ -237,7 +237,7 @@ DSOptionsDialog::DSOptionsDialog() : GUI::Dialog(0, 0, 320 - 10, 230 - 40) { if (!_cpuScaler->getState() && !_unscaledCheckbox->getState()) { _hardScaler->setState(true); } - + _radioButtonMode = true; } @@ -293,17 +293,17 @@ void DSOptionsDialog::handleCommand(GUI::CommandSender *sender, uint32 cmd, uint _cpuScaler->setState(false); _hardScaler->setState(false); _unscaledCheckbox->setState(false); - + if ((sender == _cpuScaler) && (cmd == 0x10000002)) { _cpuScaler->setState(true); } - + if ((sender == _hardScaler) && (cmd == 0x10000001)) { _hardScaler->setState(true); } - + if ((sender == _unscaledCheckbox) && (cmd == 0x10000003)) { _unscaledCheckbox->setState(true); @@ -392,11 +392,11 @@ void togglePause() { OSystem_DS* system = OSystem_DS::instance(); event.type = Common::EVENT_KEYDOWN; - event.kbd.keycode = Common::KEYCODE_p; + event.kbd.keycode = Common::KEYCODE_p; event.kbd.ascii = 'p'; event.kbd.flags = 0; system->addEvent(event); - + event.type = Common::EVENT_KEYUP; system->addEvent(event); } @@ -407,12 +407,12 @@ void showOptionsDialog() { togglePause(); DS::displayMode16Bit(); - + DSOptionsDialog* d = new DSOptionsDialog(); d->runModal(); delete d; - + DS::displayMode8Bit(); togglePause(); @@ -487,7 +487,7 @@ void setOptions() { } else { DS::setCpuScalerEnable(false); } -#endif +#endif if (ConfMan.hasKey("screentaps", "ds")) { DS::setTapScreenClicksEnable(ConfMan.getBool("screentaps", "ds")); @@ -497,7 +497,7 @@ void setOptions() { if (ConfMan.hasKey("touchpad", "ds")) { bool enable = ConfMan.getBool("touchpad", "ds"); - + DS::setTrackPadStyleEnable(enable); if ((enable) and (firstLoad)) { @@ -509,7 +509,7 @@ void setOptions() { if (enable) { DS::setTapScreenClicksEnable(true); } - + } else { DS::setTrackPadStyleEnable(false); } diff --git a/backends/platform/ds/arm9/source/fat/disc_io.h b/backends/platform/ds/arm9/source/fat/disc_io.h index 2d3da1fc6f..d9a3c67353 100644 --- a/backends/platform/ds/arm9/source/fat/disc_io.h +++ b/backends/platform/ds/arm9/source/fat/disc_io.h @@ -7,7 +7,7 @@ // Use DMA to read the card, remove this line to use normal reads/writes // #define _CF_USE_DMA -// Allow buffers not aligned to 16 bits when reading files. +// Allow buffers not aligned to 16 bits when reading files. // Note that this will slow down access speed, so only use if you have to. // It is also incompatible with DMA #define _CF_ALLOW_UNALIGNED @@ -43,7 +43,7 @@ // This allows the code to build on an earlier version of libnds, before the register was renamed #ifndef REG_EXMEMCNT -#define REG_EXMEMCNT REG_EXEMEMCNT +#define REG_EXMEMCNT REG_EXEMEMCNT #endif #ifndef REG_EXEMEMCNT @@ -70,7 +70,7 @@ #endif // Disable NDS specific hardware and features if running on a GBA -#ifndef NDS +#ifndef NDS #undef SUPPORT_NMMC #undef DISC_CACHE #endif diff --git a/backends/platform/ds/arm9/source/fat/gba_nds_fat.h b/backends/platform/ds/arm9/source/fat/gba_nds_fat.h index 539f94fef7..f9746560e0 100644 --- a/backends/platform/ds/arm9/source/fat/gba_nds_fat.h +++ b/backends/platform/ds/arm9/source/fat/gba_nds_fat.h @@ -147,7 +147,7 @@ bool FAT_GetAlias (char* alias); /*----------------------------------------------------------------- FAT_GetLongFilename -Get the long name of the last file or directory retrived with +Get the long name of the last file or directory retrived with GetDirEntry. Also works for FindFirstFile and FindNextFile char* filename: OUT will be filled with the filename, should be at least 256 bytes long @@ -210,7 +210,7 @@ FAT_FindNextFile Gets the name of the next directory entry (can be a file or subdirectory) char* filename: OUT filename, must be at least 13 chars long -FILE_TYPE return: OUT returns FT_NONE if failed, +FILE_TYPE return: OUT returns FT_NONE if failed, FT_FILE if it found a file and FT_DIR if it found a directory -----------------------------------------------------------------*/ FILE_TYPE FAT_FindNextFile (char* filename); @@ -220,7 +220,7 @@ FAT_FindFirstFile Gets the name of the first directory entry and resets the count (can be a file or subdirectory) char* filename: OUT filename, must be at least 13 chars long -FILE_TYPE return: OUT returns FT_NONE if failed, +FILE_TYPE return: OUT returns FT_NONE if failed, FT_FILE if it found a file and FT_DIR if it found a directory -----------------------------------------------------------------*/ FILE_TYPE FAT_FindFirstFile (char* filename); @@ -230,7 +230,7 @@ FAT_FindFirstFileLFN Gets the long file name of the first directory entry and resets the count (can be a file or subdirectory) char* lfn: OUT long file name, must be at least 256 chars long -FILE_TYPE return: OUT returns FT_NONE if failed, +FILE_TYPE return: OUT returns FT_NONE if failed, FT_FILE if it found a file and FT_DIR if it found a directory -----------------------------------------------------------------*/ FILE_TYPE FAT_FindFirstFileLFN(char* lfn); @@ -240,16 +240,16 @@ FAT_FindNextFileLFN Gets the long file name of the next directory entry (can be a file or subdirectory) char* lfn: OUT long file name, must be at least 256 chars long -FILE_TYPE return: OUT returns FT_NONE if failed, +FILE_TYPE return: OUT returns FT_NONE if failed, FT_FILE if it found a file and FT_DIR if it found a directory -----------------------------------------------------------------*/ FILE_TYPE FAT_FindNextFileLFN(char* lfn); /*----------------------------------------------------------------- FAT_FileExists -Returns the type of file +Returns the type of file char* filename: IN filename of the file to look for -FILE_TYPE return: OUT returns FT_NONE if there is now file with +FILE_TYPE return: OUT returns FT_NONE if there is now file with that name, FT_FILE if it is a file and FT_DIR if it is a directory -----------------------------------------------------------------*/ FILE_TYPE FAT_FileExists (const char* filename); @@ -269,7 +269,7 @@ u32 FAT_GetFileSystemTotalSize (void); /*----------------------------------------------------------------- FAT_chdir Changes the current working directory -const char* path: IN null terminated string of directory separated by +const char* path: IN null terminated string of directory separated by forward slashes, / is root bool return: OUT returns true if successful -----------------------------------------------------------------*/ @@ -282,12 +282,12 @@ bool FAT_chdir (const char* path); /*----------------------------------------------------------------- FAT_fopen(filename, mode) Opens a file -const char* path: IN null terminated string of filename and path +const char* path: IN null terminated string of filename and path separated by forward slashes, / is root const char* mode: IN mode to open file in Supported modes: "r", "r+", "w", "w+", "a", "a+", don't use "b" or "t" in any mode, as all files are openned in binary mode -FAT_FILE* return: OUT handle to open file, returns -1 if the file +FAT_FILE* return: OUT handle to open file, returns -1 if the file couldn't be openned -----------------------------------------------------------------*/ FAT_FILE* FAT_fopen(const char* path, const char* mode); @@ -338,7 +338,7 @@ u32 FAT_fread (void* buffer, u32 size, u32 count, FAT_FILE* file); FAT_fwrite(buffer, size, count, file) Writes size * count bytes into file from buffer, starting from current position. It then sets the current position to the - byte after the last byte written. If the file was openned in + byte after the last byte written. If the file was openned in append mode it always writes to the end of the file. const void* buffer IN: Pointer to buffer containing data. Should be at least as big as the number of bytes to be written. @@ -371,7 +371,7 @@ int FAT_remove (const char* path); #ifdef CAN_WRITE_TO_DISC /*----------------------------------------------------------------- FAT_mkdir (path) -Makes a new directory, so long as no other directory or file has +Makes a new directory, so long as no other directory or file has the same name. const char* path IN: Path and filename of directory to make int return OUT: zero if successful, non-zero if not @@ -403,9 +403,9 @@ FAT_fgets (char *tgtBuffer, int num, FAT_FILE* file) Gets a up to num bytes from file, stopping at the first newline. -CAUTION: does not do strictly streaming. I.e. it's +CAUTION: does not do strictly streaming. I.e. it's reading more then needed bytes and seeking back. - shouldn't matter for random access + shouldn't matter for random access char *tgtBuffer OUT: buffer to write to int num IN: size of target buffer diff --git a/backends/platform/ds/arm9/source/fat/io_dldi.h b/backends/platform/ds/arm9/source/fat/io_dldi.h index 053de3a94c..034c6aace3 100644 --- a/backends/platform/ds/arm9/source/fat/io_dldi.h +++ b/backends/platform/ds/arm9/source/fat/io_dldi.h @@ -1,8 +1,8 @@ /* - io_dldi.h + io_dldi.h Reserved space for new drivers - + This software is completely free. No warranty is provided. If you use it, please give me credit and email me about your project at chishm@hotmail.com diff --git a/backends/platform/ds/arm9/source/fat/io_fcsr.h b/backends/platform/ds/arm9/source/fat/io_fcsr.h index 2f87c1c8aa..ef390a8ad6 100644 --- a/backends/platform/ds/arm9/source/fat/io_fcsr.h +++ b/backends/platform/ds/arm9/source/fat/io_fcsr.h @@ -1,5 +1,5 @@ /* - io_fcsr.h + io_fcsr.h Hardware Routines for using a GBA Flash Cart with SRAM @@ -23,7 +23,7 @@ extern LPIO_INTERFACE FCSR_GetInterface(void) ; #endif // define IO_FCSR_H /* - io_fcsr.h + io_fcsr.h Hardware Routines for using a GBA Flash Cart with SRAM diff --git a/backends/platform/ds/arm9/source/fat/io_m3_common.h b/backends/platform/ds/arm9/source/fat/io_m3_common.h index 92e6bed980..6d0c669783 100644 --- a/backends/platform/ds/arm9/source/fat/io_m3_common.h +++ b/backends/platform/ds/arm9/source/fat/io_m3_common.h @@ -1,5 +1,5 @@ /* - io_m3_common.h + io_m3_common.h Routines common to all version of the M3 @@ -7,7 +7,7 @@ Some code written by SaTa may have been unknowingly used. Copyright (c) 2006 Michael "Chishm" Chisholm - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -40,7 +40,7 @@ // Values for changing mode #define M3_MODE_ROM 0x00400004 -#define M3_MODE_MEDIA 0x00400003 +#define M3_MODE_MEDIA 0x00400003 extern void _M3_changeMode (u32 mode); diff --git a/backends/platform/ds/arm9/source/fat/io_m3cf.h b/backends/platform/ds/arm9/source/fat/io_m3cf.h index bade53f511..006c283adc 100644 --- a/backends/platform/ds/arm9/source/fat/io_m3cf.h +++ b/backends/platform/ds/arm9/source/fat/io_m3cf.h @@ -1,5 +1,5 @@ /* - io_m3cf.h + io_m3cf.h Hardware Routines for reading a compact flash card using the M3 CF @@ -24,7 +24,7 @@ extern LPIO_INTERFACE M3CF_GetInterface(void) ; #endif // define IO_M3CF_H /* - io_m3cf.h + io_m3cf.h Hardware Routines for reading a compact flash card using the M3 CF diff --git a/backends/platform/ds/arm9/source/fat/io_mmcf.h b/backends/platform/ds/arm9/source/fat/io_mmcf.h index baa43ac59f..fa9e6536ee 100644 --- a/backends/platform/ds/arm9/source/fat/io_mmcf.h +++ b/backends/platform/ds/arm9/source/fat/io_mmcf.h @@ -1,5 +1,5 @@ /* - io_mmcf.h + io_mmcf.h Hardware Routines for reading a compact flash card using the GBA Movie Player diff --git a/backends/platform/ds/arm9/source/fat/io_mpcf.h b/backends/platform/ds/arm9/source/fat/io_mpcf.h index 58cab41b4c..8ec8859097 100644 --- a/backends/platform/ds/arm9/source/fat/io_mpcf.h +++ b/backends/platform/ds/arm9/source/fat/io_mpcf.h @@ -1,5 +1,5 @@ /* - io_mpcf.h + io_mpcf.h Hardware Routines for reading a compact flash card using the GBA Movie Player @@ -24,7 +24,7 @@ extern LPIO_INTERFACE MPCF_GetInterface(void) ; #endif // define IO_MPCF_H /* - io_mpcf.h + io_mpcf.h Hardware Routines for reading a compact flash card using the GBA Movie Player diff --git a/backends/platform/ds/arm9/source/fat/io_njsd.h b/backends/platform/ds/arm9/source/fat/io_njsd.h index a297cda112..dce469cad6 100644 --- a/backends/platform/ds/arm9/source/fat/io_njsd.h +++ b/backends/platform/ds/arm9/source/fat/io_njsd.h @@ -1,11 +1,11 @@ /* - io_njsd.h + io_njsd.h Hardware Routines for reading an SD card using a NinjaDS SD adapter. Copyright (c) 2006 Michael "Chishm" Chisholm - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: diff --git a/backends/platform/ds/arm9/source/fat/io_nmmc.h b/backends/platform/ds/arm9/source/fat/io_nmmc.h index 5244d21868..0249e3a864 100644 --- a/backends/platform/ds/arm9/source/fat/io_nmmc.h +++ b/backends/platform/ds/arm9/source/fat/io_nmmc.h @@ -1,5 +1,5 @@ /* - io_NMMC.h + io_NMMC.h Hardware Routines for reading an SD or MMC card using a Neoflash MK2 or MK3. @@ -26,7 +26,7 @@ extern LPIO_INTERFACE NMMC_GetInterface(void) ; #endif // define IO_NMMC_H /* - io_NMMC.h + io_NMMC.h Hardware Routines for reading an SD or MMC card using a Neoflash MK2 or MK3. diff --git a/backends/platform/ds/arm9/source/fat/io_sccf.h b/backends/platform/ds/arm9/source/fat/io_sccf.h index 961909fbce..2270c4eab1 100644 --- a/backends/platform/ds/arm9/source/fat/io_sccf.h +++ b/backends/platform/ds/arm9/source/fat/io_sccf.h @@ -1,5 +1,5 @@ /* - io_sccf.h + io_sccf.h Hardware Routines for reading a compact flash card using the Supercard CF @@ -24,7 +24,7 @@ extern LPIO_INTERFACE SCCF_GetInterface(void) ; #endif // define IO_SCCF_H /* - io_sccf.h + io_sccf.h Hardware Routines for reading a compact flash card using the Supercard CF diff --git a/backends/platform/ds/arm9/source/fat/io_scsd.h b/backends/platform/ds/arm9/source/fat/io_scsd.h index 75115b8d62..492492f619 100644 --- a/backends/platform/ds/arm9/source/fat/io_scsd.h +++ b/backends/platform/ds/arm9/source/fat/io_scsd.h @@ -1,12 +1,12 @@ /* io_scsd.h by SaTa. based on io_sccf.h - - + + */ /* - io_sccf.h + io_sccf.h Hardware Routines for reading a compact flash card using the GBA Movie Player @@ -26,4 +26,4 @@ // export interface extern LPIO_INTERFACE SCSD_GetInterface(void) ; -#endif // define IO_SCSD_H \ No newline at end of file +#endif // define IO_SCSD_H diff --git a/backends/platform/ds/arm9/source/fat/io_sd_common.h b/backends/platform/ds/arm9/source/fat/io_sd_common.h index 09abffab39..8962d88890 100644 --- a/backends/platform/ds/arm9/source/fat/io_sd_common.h +++ b/backends/platform/ds/arm9/source/fat/io_sd_common.h @@ -8,7 +8,7 @@ SD routines partially based on sd.s by Romman Copyright (c) 2006 Michael "Chishm" Chisholm - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -32,7 +32,7 @@ 2006-07-11 - Chishm * Original release - + 2006-07-28 - Chishm * Changed voltage range that the SD card can use */ @@ -76,7 +76,7 @@ #define SD_STATE_IDENT 2 // Identification state, after ALL_SEND_CID #define SD_STATE_STBY 3 // Standby state, when card is deselected #define SD_STATE_TRAN 4 // Transfer state, after card is selected and ready for data transfer -#define SD_STATE_DATA 5 // +#define SD_STATE_DATA 5 // #define SD_STATE_RCV 6 // Receive data state #define SD_STATE_PRG 7 // Programming state #define SD_STATE_DIS 8 // Disconnect state @@ -85,7 +85,7 @@ #define READY_FOR_DATA 1 // bit 8 in card status /* -Calculate the CRC7 of a command and return it preshifted with +Calculate the CRC7 of a command and return it preshifted with an end bit added */ extern u8 _SD_CRC7(u8* data, int size); @@ -106,7 +106,7 @@ cmd_17byte_response: a pointer to a function that sends the SD card a command an use4bitBus: initialise card to use a 4 bit data bus when communicating with the card RCA: a pointer to the location to store the card's Relative Card Address, preshifted up by 16 bits. */ -extern bool _SD_InitCard (_SD_FN_CMD_6BYTE_RESPONSE cmd_6byte_response, +extern bool _SD_InitCard (_SD_FN_CMD_6BYTE_RESPONSE cmd_6byte_response, _SD_FN_CMD_17BYTE_RESPONSE cmd_17byte_response, bool use4bitBus, u32 *RCA); diff --git a/backends/platform/ds/arm9/source/gbampsave.cpp b/backends/platform/ds/arm9/source/gbampsave.cpp index a53ab9739d..8814fc4957 100644 --- a/backends/platform/ds/arm9/source/gbampsave.cpp +++ b/backends/platform/ds/arm9/source/gbampsave.cpp @@ -93,40 +93,40 @@ uint32 GBAMPSaveFile::write(const void *buf, uint32 size) { memcpy(buffer + bufferPos, buf, size); bufferPos += size; - + saveSize += size; /* int pos = 0; - + int rest = SAVE_BUFFER_SIZE - bufferPos; memcpy(buffer + bufferPos, buf, rest); bufferPos = 512; pos += rest; - flushSaveBuffer(); + flushSaveBuffer(); size -= rest; // consolePrintf("First section: %d\n", rest); - + while (size >= 512) { DS::std_fwrite(((char *) (buf)) + pos, 1, 512, handle); size -= 512; pos += 512; // consolePrintf("Full chunk, %d left ", size); } - + bufferPos = 0; memcpy(buffer + bufferPos, ((char *) (buf)) + pos, size); bufferPos += size; // consolePrintf("%d left in buffer ", bufferPos);*/ - + } else { - + memcpy(buffer + bufferPos, buf, size); bufferPos += size; - + saveSize += size; } - + // if ((size > 100) || (size <= 0)) consolePrintf("Write %d bytes\n", size); return size; } @@ -146,24 +146,24 @@ GBAMPSaveFileManager::~GBAMPSaveFileManager() { GBAMPSaveFile* GBAMPSaveFileManager::openSavefile(char const* name, bool saveOrLoad) { char fileSpec[128]; - + strcpy(fileSpec, getSavePath()); - + if (fileSpec[strlen(fileSpec) - 1] == '/') { sprintf(fileSpec, "%s%s", getSavePath(), name); } else { sprintf(fileSpec, "%s/%s", getSavePath(), name); } - + // consolePrintf("Opening the file: %s\n", fileSpec); GBAMPSaveFile* sf = new GBAMPSaveFile(fileSpec, saveOrLoad); if (sf->isOpen()) { // consolePrintf("Ok"); - return sf; + return sf; } else { // consolePrintf("Fail"); delete sf; - return NULL; + return NULL; } } @@ -189,11 +189,11 @@ const char *GBAMPSaveFileManager::getSavePath() const { return dir; } -Common::StringList GBAMPSaveFileManager::listSavefiles(const char *pattern) { +Common::StringList GBAMPSaveFileManager::listSavefiles(const char *pattern) { enum { TYPE_NO_MORE = 0, TYPE_FILE = 1, TYPE_DIR = 2 }; char name[256]; - + { char dir[128]; strcpy(dir, getSavePath()); @@ -218,13 +218,13 @@ Common::StringList GBAMPSaveFileManager::listSavefiles(const char *pattern) { // consolePrintf("Save path: '%s', pattern: '%s'\n", getSavePath(), pattern); - + int fileType = FAT_FindFirstFileLFN(name); Common::StringList list; do { - + if (fileType == TYPE_FILE) { FAT_GetLongFilename(name); @@ -232,18 +232,18 @@ Common::StringList GBAMPSaveFileManager::listSavefiles(const char *pattern) { for (int r = 0; name[r] != 0; r++) { name[r] = tolower(name[r]); } - - + + if (Common::matchString(name, pattern)) { list.push_back(name); } } } while ((fileType = FAT_FindNextFileLFN(name))); - + FAT_chdir("/"); return list; -} +} diff --git a/backends/platform/ds/arm9/source/gbampsave.h b/backends/platform/ds/arm9/source/gbampsave.h index 6ddc4fd964..c92d5d6151 100644 --- a/backends/platform/ds/arm9/source/gbampsave.h +++ b/backends/platform/ds/arm9/source/gbampsave.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ - + #ifndef _GBAMPSAVE_H_ #define _GBAMPSAVE_H_ @@ -38,19 +38,19 @@ class GBAMPSaveFile : public Common::InSaveFile, public Common::OutSaveFile { public: GBAMPSaveFile(char* name, bool saveOrLoad); virtual ~GBAMPSaveFile(); - + virtual uint32 read(void *buf, uint32 size); virtual uint32 write(const void *buf, uint32 size); - + virtual bool eos() const; virtual bool skip(uint32 bytes); virtual int32 pos() const; virtual int32 size() const; virtual bool seek(int32 pos, int whence); - + void flushSaveBuffer(); - + virtual bool isOpen() const { return handle != 0; } @@ -61,17 +61,17 @@ class GBAMPSaveFileManager : public Common::SaveFileManager { public: GBAMPSaveFileManager(); ~GBAMPSaveFileManager(); - + // static GBAMPSaveFileManager* instance() { return instancePtr; } GBAMPSaveFile *openSavefile(const char *filename, bool saveOrLoad); - + virtual Common::OutSaveFile* openForSaving(const char* filename) { return openSavefile(filename, true); } virtual Common::InSaveFile* openForLoading(const char* filename) { return openSavefile(filename, false); } - + virtual bool removeSavefile(const char *filename) { return false; } // TODO: Implement this virtual Common::StringList listSavefiles(const char *pattern); - + void deleteFile(char* name); void listFiles(); diff --git a/backends/platform/ds/arm9/source/keys.cpp b/backends/platform/ds/arm9/source/keys.cpp index dcec2287b9..8bfc983565 100644 --- a/backends/platform/ds/arm9/source/keys.cpp +++ b/backends/platform/ds/arm9/source/keys.cpp @@ -27,26 +27,26 @@ $Log: keys.c,v $ Revision 1.13 2006/01/12 09:10:47 wntrmute Added key repeat as suggested by pepsiman - + Revision 1.12 2005/11/27 12:30:25 wntrmute reverted to correct hardware REGisters - + Revision 1.11 2005/11/27 07:48:45 joatski Renamed REG_KEYINPUT and REG_KEYCNT back to KEYS and KEYS_CR, as the alternatives are defined in registers_alt.h. Changed function returns to uint32 - + Revision 1.10 2005/11/03 23:38:49 wntrmute don't use enum for key function returns - + Revision 1.9 2005/10/13 16:30:11 dovoto Changed KEYPAD_BITS to a typedef enum, this resolved some issues with multiple redefinition of KEYPAD_BITS (although this error did not allways occur). - + Revision 1.8 2005/10/03 21:21:59 wntrmute use enum types - + Revision 1.7 2005/09/07 18:06:27 wntrmute use new register names - + Revision 1.6 2005/08/23 17:06:10 wntrmute converted all endings to unix @@ -148,4 +148,4 @@ uint32 keysUp(void) { } -} // namespace ds \ No newline at end of file +} // namespace ds diff --git a/backends/platform/ds/arm9/source/osystem_ds.cpp b/backends/platform/ds/arm9/source/osystem_ds.cpp index 5ddcb50b15..dac9e59588 100644 --- a/backends/platform/ds/arm9/source/osystem_ds.cpp +++ b/backends/platform/ds/arm9/source/osystem_ds.cpp @@ -63,7 +63,7 @@ int OSystem_DS::timerHandler(int t) { tm->handler(); return t; } - + void OSystem_DS::initBackend() { ConfMan.setInt("autosave_period", 0); ConfMan.setBool("FM_medium_quality", true); @@ -80,7 +80,7 @@ void OSystem_DS::initBackend() { _mixer->setOutputRate(DS::getSoundFrequency()); _mixer->setReady(true); - + OSystem::initBackend(); } @@ -149,13 +149,13 @@ void OSystem_DS::setPalette(const byte *colors, uint start, uint num) { int red = *colors; int green = *(colors + 1); int blue = *(colors + 2); - + red >>= 3; green >>= 3; blue >>= 3; - + // if (r != 255) - { + { u16 paletteValue = red | (green << 5) | (blue << 10); if (DS::getIsDisplayMode8Bit()) { @@ -168,7 +168,7 @@ void OSystem_DS::setPalette(const byte *colors, uint start, uint num) { _palette[r] = paletteValue; } // if (num == 255) consolePrintf("pal:%d r:%d g:%d b:%d\n", r, red, green, blue); - + colors += 4; } } @@ -180,14 +180,14 @@ void OSystem_DS::setCursorPalette(const byte *colors, uint start, uint num) { int red = *colors; int green = *(colors + 1); int blue = *(colors + 2); - + red >>= 3; green >>= 3; blue >>= 3; - + u16 paletteValue = red | (green << 5) | (blue << 10); _cursorPalette[r] = paletteValue; - + colors += 4; } @@ -198,7 +198,7 @@ bool OSystem_DS::grabRawScreen(Graphics::Surface* surf) { surf->create(DS::getGameWidth(), DS::getGameHeight(), 1); // Ensure we copy using 16 bit quantities due to limitation of VRAM addressing - + const u16* image = (const u16 *) DS::get8BitBackBuffer(); for (int y = 0; y < DS::getGameHeight(); y++) @@ -215,7 +215,7 @@ bool OSystem_DS::grabRawScreen(Graphics::Surface* surf) { void OSystem_DS::grabPalette(unsigned char *colors, uint start, uint num) { // consolePrintf("Grabpalette"); - + for (unsigned int r = start; r < start + num; r++) { *colors++ = (BG_PALETTE[r] & 0x001F) << 3; *colors++ = (BG_PALETTE[r] & 0x03E0) >> 5 << 3; @@ -228,11 +228,11 @@ void OSystem_DS::grabPalette(unsigned char *colors, uint start, uint num) { void OSystem_DS::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) { //consolePrintf("Copy rect %d, %d %d, %d ", x, y, w, h); - if (!_graphicsEnable) return; + if (!_graphicsEnable) return; if (w <= 1) return; if (h < 0) return; if (!DS::getIsDisplayMode8Bit()) return; - + u16* bg; s32 stride; u16* bgSub = (u16 *) BG_GFX_SUB; @@ -258,7 +258,7 @@ void OSystem_DS::copyRectToScreen(const byte *buf, int pitch, int x, int y, int u8* dest = ((u8 *) (bg)) + (dy * stride) + x; u8* destSub = ((u8 *) (bgSub)) + (dy * 512) + x; u8* src = (u8 *) buf + (pitch * by); - + u32 dx; u32 pixelsLeft = w; @@ -306,7 +306,7 @@ void OSystem_DS::copyRectToScreen(const byte *buf, int pitch, int x, int y, int } by++; - + } // consolePrintf("Slow method used!\n"); @@ -315,40 +315,40 @@ void OSystem_DS::copyRectToScreen(const byte *buf, int pitch, int x, int y, int } else { // Stuff is aligned to 16-bit boundaries, so it's safe to do DMA. - + u16* src = (u16 *) buf; - + if (DS::getKeyboardEnable()) { - + for (int dy = y; dy < y + h; dy++) { u16* dest = bg + (dy * (stride >> 1)) + (x >> 1); - + DC_FlushRange(src, w << 1); DC_FlushRange(dest, w << 1); dmaCopyHalfWords(3, src, dest, w); - + while (dmaBusy(3)); - + src += pitch >> 1; } - + } else { for (int dy = y; dy < y + h; dy++) { u16* dest1 = bg + (dy * (stride >> 1)) + (x >> 1); u16* dest2 = bgSub + (dy << 8) + (x >> 1); - + DC_FlushRange(src, w << 1); DC_FlushRange(dest1, w << 1); DC_FlushRange(dest2, w << 1); - + dmaCopyHalfWords(3, src, dest1, w); - + if ((!_frameBufferExists) || (buf == _framebuffer.pixels)) { dmaCopyHalfWords(2, src, dest2, w); } - + while (dmaBusy(2) || dmaBusy(3)); - + src += pitch >> 1; } } @@ -402,36 +402,36 @@ void OSystem_DS::grabOverlay (OverlayColor *buf, int pitch) { void OSystem_DS::copyRectToOverlay (const OverlayColor *buf, int pitch, int x, int y, int w, int h) { u16* bg = (u16 *) DS::get16BitBackBuffer(); const u16* src = (const u16 *) buf; - + // if (x + w > 256) w = 256 - x; //if (x + h > 256) h = 256 - y; // consolePrintf("Copy rect ovl %d, %d %d, %d %d\n", x, y, w, h, pitch); - - + + for (int dy = y; dy < y + h; dy++) { - - + + // Slow but save copy: for (int dx = x; dx < x + w; dx++) { - + *(bg + (dy * 512) + dx) = *src; //if ((*src) != 0) consolePrintf("%d,%d: %d ", dx, dy, *src); //consolePrintf("%d,", *src); src++; } src += (pitch - w); - + // Fast but broken copy: (why?) /* REG_IME = 0; dmaCopy(src, bg + (dy << 9) + x, w * 2); REG_IME = 1; - + src += pitch;*/ } - + // consolePrintf("Copy rect ovl done"); } @@ -446,7 +446,7 @@ int16 OSystem_DS::getOverlayWidth() { return getWidth(); } - + bool OSystem_DS::showMouse(bool visible) { DS::setShowCursor(visible); return true; @@ -498,7 +498,7 @@ bool OSystem_DS::pollEvent(Common::Event &event) { return true; } } - + return false; /* if (lastPenFrame != DS::getMillis()) { @@ -511,7 +511,7 @@ bool OSystem_DS::pollEvent(Common::Event &event) { if (eventNum == 1) { eventNum = 0; lastPenFrame = DS::getMillis(); - if (DS::getPenDown()) { + if (DS::getPenDown()) { event.type = Common::EVENT_LBUTTONDOWN; event.mouse = Common::Point(DS::getPenX(), DS::getPenY()); consolePrintf("Down %d, %d ", event.mouse.x, event.mouse.y); @@ -538,12 +538,12 @@ void OSystem_DS::delayMillis(uint msecs) { int st = getMillis(); DS::addEventsToQueue(); DS::CD::update(); - + DS::doSoundCallback(); while (st + msecs >= getMillis()) { DS::doSoundCallback(); } - + DS::doTimerCallback(); DS::checkSleepMode(); DS::addEventsToQueue(); @@ -599,7 +599,7 @@ void OSystem_DS::quit() { /* consolePrintf("Soft resetting..."); IPC->reset = 1; REG_IE = 0; - + asm("swi 0x26\n"); swiSoftReset();*/ } @@ -618,10 +618,10 @@ Common::SaveFileManager* OSystem_DS::getSavefileManager() { } else { forceSram = false; } - if (forceSram) { + if (forceSram) { consolePrintf("Using SRAM save method!\n"); } - + if (DS::isGBAMPAvailable() && (!forceSram)) { return &mpSaveManager; } else { @@ -653,21 +653,21 @@ Graphics::Surface* OSystem_DS::createTempFrameBuffer() { } else { - + s32 height = DS::getGameHeight(); s32 width = DS::getGameWidth(); s32 stride = DS::get8BitBackBufferStride(); - + u16* src = DS::get8BitBackBuffer(); u16* dest = DS::getScalerBuffer(); for (int y = 0; y < height; y++) { - + u16* destLine = dest + (y * (width / 2)); u16* srcLine = src + (y * (stride / 2)); DC_FlushRange(srcLine, width); - + dmaCopyHalfWords(3, srcLine, destLine, width); } @@ -681,7 +681,7 @@ Graphics::Surface* OSystem_DS::createTempFrameBuffer() { _frameBufferExists = true; -/* +/* size_t imageStrideInBytes = DS::get8BitBackBufferStride(); size_t imageStrideInWords = imageStrideInBytes / 2; diff --git a/backends/platform/ds/arm9/source/osystem_ds.h b/backends/platform/ds/arm9/source/osystem_ds.h index 27adf88198..ce494011d0 100644 --- a/backends/platform/ds/arm9/source/osystem_ds.h +++ b/backends/platform/ds/arm9/source/osystem_ds.h @@ -19,8 +19,8 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ - - + + #ifndef _OSYSTEM_DS_H_ #define _OSYSTEM_DS_H_ #include "common/system.h" @@ -33,13 +33,13 @@ #include "sound/mixer_intern.h" #include "graphics/surface.h" -class DSAudioMixer : public Audio::MixerImpl { +class DSAudioMixer : public Audio::MixerImpl { public: DSAudioMixer(OSystem* system) : Audio::MixerImpl(system) { } }; -class DSTimerManager : public DefaultTimerManager { +class DSTimerManager : public DefaultTimerManager { }; @@ -48,10 +48,10 @@ protected: int eventNum; int lastPenFrame; - + Common::Event eventQueue[96]; int queuePos; - + #ifdef GBA_SRAM_SAVE DSSaveFileManager saveManager; #endif @@ -75,7 +75,7 @@ protected: byte _cursorKey; int _cursorScale; - + Graphics::Surface* createTempFrameBuffer(); bool _disableCursorPalette; @@ -114,7 +114,7 @@ public: virtual int16 getOverlayHeight(); virtual int16 getOverlayWidth(); virtual Graphics::PixelFormat getOverlayFormat() const { return Graphics::createPixelFormat<1555>(); } - + virtual bool showMouse(bool visible); virtual void warpMouse(int x, int y); @@ -146,21 +146,21 @@ public: virtual void displayMessageOnOSD(const char *msg); virtual Common::SaveFileManager *getSavefileManager(); - + void addEvent(Common::Event& e); bool isEventQueueEmpty() { return queuePos == 0; } - + virtual bool grabRawScreen(Graphics::Surface* surf); - + virtual void setFocusRectangle(const Common::Rect& rect); - + virtual void clearFocusRectangle(); - + virtual void initBackend(); - + virtual Graphics::Surface *lockScreen(); virtual void unlockScreen(); - + virtual Audio::Mixer* getMixer() { return _mixer; } Audio::MixerImpl* getMixerImpl() { return _mixer; } diff --git a/backends/platform/ds/arm9/source/portdefs.h b/backends/platform/ds/arm9/source/portdefs.h index 2e5f2097d8..8a14420907 100644 --- a/backends/platform/ds/arm9/source/portdefs.h +++ b/backends/platform/ds/arm9/source/portdefs.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ - + #ifndef _PORTDEFS_H_ #define _PORTDEFS_H_ @@ -82,7 +82,7 @@ int consolePrintf(const char* s, ...); #define ITCM_DATA __attribute__((section(".itcm"))) // Since I can't change the engine at the moment (post lockdown) this define can go here. -// This define changes the mouse-relative motion which doesn't make sense on a touch screen to +// This define changes the mouse-relative motion which doesn't make sense on a touch screen to // a more conventional form of input where the menus can be clicked on. #define LURE_CLICKABLE_MENUS diff --git a/backends/platform/ds/arm9/source/ramsave.cpp b/backends/platform/ds/arm9/source/ramsave.cpp index a9f4e3d2fc..113dd5df72 100644 --- a/backends/platform/ds/arm9/source/ramsave.cpp +++ b/backends/platform/ds/arm9/source/ramsave.cpp @@ -17,7 +17,7 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * + * */ #ifdef GBA_SRAM_SAVE @@ -53,18 +53,18 @@ DSSaveFile::DSSaveFile(SCUMMSave* s, bool compressed, u8* data) { ownsData = true; saveCompressed = false; // consolePrintf("Decompressed. name=%s size=%d (%d)", save.name, save.size, save.compressedSize); - + } else { ownsData = false; origHeader = s; } - + if (save.magic == (int) 0xBEEFCAFE) { save.isValid = true; } else { save.isValid = false; } - + isTempFile = false; eosReached = false; } @@ -80,7 +80,7 @@ DSSaveFile::~DSSaveFile() { } bool DSSaveFile::loadFromSaveRAM(vu8* address) { - + SCUMMSave newSave; for (int t = 0; t < (int) sizeof(newSave); t++) { @@ -91,13 +91,13 @@ bool DSSaveFile::loadFromSaveRAM(vu8* address) { newSave.isValid = true; *((u16 *) (0x4000204)) |= 0x3; - + saveData = new unsigned char[newSave.compressedSize]; - + for (int t = 0; t < (int) newSave.compressedSize; t++) { ((char *) (saveData))[t] = *(address + t + sizeof(newSave)); } - + if (ownsData) delete this->saveData; save = newSave; saveCompressed = true; @@ -107,7 +107,7 @@ bool DSSaveFile::loadFromSaveRAM(vu8* address) { return true; } - + return false; } @@ -116,11 +116,11 @@ void DSSaveFile::compress() { unsigned char* compBuffer = new unsigned char[(save.size * 110) / 100]; int compSize = LZ_Compress((u8 *) saveData, compBuffer, save.size); save.compressedSize = compSize; - - - + + + delete saveData; - + // Make the save smaller saveData = (u8 *) realloc(compBuffer, save.compressedSize); saveCompressed = true; @@ -131,39 +131,39 @@ int DSSaveFile::saveToSaveRAM(vu8* address) { unsigned char* compBuffer; bool failed; - + int compSize; - + compress(); - + compSize = save.compressedSize; compBuffer = saveData; - + if (DSSaveFileManager::instance()->getBytesFree() >= getRamUsage()) { DSSaveFileManager::instance()->addBytesFree(-getRamUsage()); - + // Write header for (int t = 0; t < sizeof(save); t++) { while (*(address + t) != ((char *) (&save))[t]) { *(address + t) = ((char *) (&save))[t]; } } - + // Write compressed buffer for (int t = sizeof(save); t < (int) sizeof(save) + compSize; t++) { while (*(address + t) != compBuffer[t - sizeof(save)]) { *(address + t) = compBuffer[t - sizeof(save)]; } } - + failed = false; } else { failed = true; } - + return failed? 0: compSize + sizeof(save); } @@ -181,7 +181,7 @@ uint32 DSSaveFile::read(void *buf, uint32 size) { } memcpy(buf, saveData + ptr, size); // consolePrintf("byte: %d ", ((u8 *) (buf))[0]); - + ptr += size; return size; } @@ -260,7 +260,7 @@ bool DSSaveFile::matches(const char *filename) { return false; } } - + void DSSaveFile::setName(char *name) { save.isValid = true; save.magic = 0xBEEFCAFE; @@ -269,7 +269,7 @@ void DSSaveFile::setName(char *name) { save.compressedSize = 0; saveData = new unsigned char[DS_MAX_SAVE_SIZE]; strcpy(save.name, name); - + if ((strstr(name, ".s99")) || (strstr(name, ".c"))) { isTempFile = true; } else { @@ -309,10 +309,10 @@ void DSSaveFile::deleteFile() { DSSaveFileManager::DSSaveFileManager() { instancePtr = this; - + *((u16 *) (0x4000204)) |= 0x3; swiWaitForVBlank(); - + loadAllFromSRAM(); } @@ -322,7 +322,7 @@ DSSaveFileManager::~DSSaveFileManager() { void DSSaveFileManager::loadAllFromSRAM() { int addr = 1; - + for (int r = 0; r < 8; r++) { gbaSave[r].deleteFile(); } @@ -343,7 +343,7 @@ void DSSaveFileManager::formatSram() { for (int r = 0; r < SRAM_SAVE_MAX; r++) { *(CART_RAM + r) = 0; } - + loadAllFromSRAM(); } @@ -369,7 +369,7 @@ DSSaveFile *DSSaveFileManager::openSavefile(const char* filename, bool saveOrLoa return gbaSave[r].clone(); } } - + if (saveOrLoad) { return makeSaveFile(filename, saveOrLoad); } else { @@ -429,20 +429,20 @@ void DSSaveFileManager::listSavefiles(const char *prefix, bool *marks, int num) } } } - + } */ DSSaveFile *DSSaveFileManager::makeSaveFile(const char *filename, bool saveOrLoad) { - + // Find a free save slot int r = 0; - + while ((r < 8) && (gbaSave[r].isValid())) { r++; } - + if ((r == 8) && (gbaSave[r].isValid())) { // No more saves return NULL; @@ -459,9 +459,9 @@ void DSSaveFileManager::flushToSaveRAM() { int cartAddr = 1; int s; int extraData = DSSaveFileManager::getExtraData(); - + *((u16 *) (0x4000204)) |= 0x3; - + swiWaitForVBlank(); int size = 0; @@ -471,20 +471,20 @@ void DSSaveFileManager::flushToSaveRAM() { if (!gbaSave[r].isTemp()) size += gbaSave[r].getRamUsage(); } } - + if (size <= SRAM_SAVE_MAX) { for (int r = 0; r < SRAM_SAVE_MAX; r++) { *(CART_RAM + r) = 0; } - + sramBytesFree = SRAM_SAVE_MAX; - + for (int r = 0; (r < 8); r++) { if (gbaSave[r].isValid() && (!gbaSave[r].isTemp())) { - + cartAddr += s = gbaSave[r].saveToSaveRAM(CART_RAM + cartAddr); - + /* if (s == 0) { consolePrintf("WARNING: Save didn't fit in cart RAM and has been lost!! Delete files and save again.", gbaSave[r].getName()); failed = true; @@ -495,7 +495,7 @@ void DSSaveFileManager::flushToSaveRAM() { consolePrintf("WARNING: Save didn't fit in cart RAM and has been lost!! Delete files and save again."); loadAllFromSRAM(); - + } DSSaveFileManager::setExtraData(extraData); diff --git a/backends/platform/ds/arm9/source/ramsave.h b/backends/platform/ds/arm9/source/ramsave.h index 034e957b7f..709b6fc6c1 100644 --- a/backends/platform/ds/arm9/source/ramsave.h +++ b/backends/platform/ds/arm9/source/ramsave.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ - + #ifndef _RAMSAVE_H_ #define _RAMSAVE_H_ @@ -46,58 +46,58 @@ class DSSaveFile : public Common::InSaveFile, public Common::OutSaveFile { u16 extraMagic; // 32 u32 reserved; // 36 } __attribute__ ((packed)); - + SCUMMSave save; u8* saveData; SCUMMSave* origHeader; bool isOpenFlag; bool isTempFile; bool eosReached; - + public: DSSaveFile(); DSSaveFile(SCUMMSave* s, bool saveCompressed, u8* data); ~DSSaveFile(); - + void reset(); - + bool isOpen() const { return isOpenFlag; } virtual bool eos() const; virtual void clearErr(); virtual bool skip(uint32 size); - + virtual int32 pos() const; virtual int32 size() const; virtual bool seek(int32 pos, int whence); uint32 read(void *buf, uint32 size); uint32 write(const void *buf, uint32 size); - + void setName(char *name); char* getName() { return save.name; } - + bool isValid() { return save.isValid; } bool isTemp() { return isTempFile; } bool matches(const char *prefix, int num); bool matches(const char *filename); - + void clearData(); void compress(); - + int getRamUsage() { return sizeof(save) + save.compressedSize; } char* getRamImage() { return (char *) &save; } - + int getSize() { return save.size; } - + DSSaveFile* clone(); - + bool loadFromSaveRAM(vu8* address); int saveToSaveRAM(vu8* address); - - + + void deleteFile(); - + void operator delete(void *p) { // consolePrintf("Finished! size=%d\n", ((DSSaveFile *) (p))->save->size); } @@ -109,25 +109,25 @@ public: class DSSaveFileManager : public Common::SaveFileManager { - + DSSaveFile gbaSave[8]; static DSSaveFileManager* instancePtr; int sramBytesFree; - + public: DSSaveFileManager(); ~DSSaveFileManager(); - + static DSSaveFileManager* instance() { return instancePtr; } DSSaveFile *openSavefile(const char *filename, bool saveOrLoad); - + virtual Common::OutSaveFile* openForSaving(const char* filename) { return openSavefile(filename, true); } virtual Common::InSaveFile* openForLoading(const char* filename) { return openSavefile(filename, false); } virtual bool removeSavefile(const char *filename); virtual Common::StringList listSavefiles(const char *pattern); - + void flushToSaveRAM(); void addBytesFree(int size) { sramBytesFree += size; } @@ -136,7 +136,7 @@ public: void deleteFile(char* name); void listFiles(); void formatSram(); - + void loadAllFromSRAM(); static bool isExtraDataPresent(); diff --git a/backends/platform/ds/arm9/source/scummconsole.h b/backends/platform/ds/arm9/source/scummconsole.h index 543ffc9409..f7aa30f125 100644 --- a/backends/platform/ds/arm9/source/scummconsole.h +++ b/backends/platform/ds/arm9/source/scummconsole.h @@ -25,7 +25,7 @@ // // Changelog: // 0.1: First version -// 0.2: Fixed sprite mapping bug. 1D mapping should work now. +// 0.2: Fixed sprite mapping bug. 1D mapping should work now. // Changed some register defines for consistency. // ////////////////////////////////////////////////////////////////////// diff --git a/backends/platform/ds/arm9/source/scummhelp.cpp b/backends/platform/ds/arm9/source/scummhelp.cpp index 452f782dc5..f9efd58276 100644 --- a/backends/platform/ds/arm9/source/scummhelp.cpp +++ b/backends/platform/ds/arm9/source/scummhelp.cpp @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ - + #include "scummhelp.h" #define ADD_BIND(k,d) do { key[i] = k; dsc[i] = d; i++; } while (0) diff --git a/backends/platform/ds/arm9/source/scummhelp.h b/backends/platform/ds/arm9/source/scummhelp.h index e79c863cbd..602cb5f788 100644 --- a/backends/platform/ds/arm9/source/scummhelp.h +++ b/backends/platform/ds/arm9/source/scummhelp.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ - + #ifndef _SCUMMHELP_H_ #define _SCUMMHELP_H_ @@ -30,7 +30,7 @@ namespace DS { void updateStrings(byte gameId, byte version, Common::Platform platform, int page, Common::String &title, Common::String *&key, Common::String *&dsc); - + } #endif diff --git a/backends/platform/ds/arm9/source/touchkeyboard.cpp b/backends/platform/ds/arm9/source/touchkeyboard.cpp index ea09f174c2..6ff8a60392 100644 --- a/backends/platform/ds/arm9/source/touchkeyboard.cpp +++ b/backends/platform/ds/arm9/source/touchkeyboard.cpp @@ -45,7 +45,7 @@ struct key_data { key_data keys[DS_NUM_KEYS] = { // Key number x y character - + // Numbers {28, 3, 0, '1'}, {29, 5, 0, '2'}, @@ -116,7 +116,7 @@ key_data keys[DS_NUM_KEYS] = { {54, 29, 8, Common::KEYCODE_DOWN}, {53, 31, 8, Common::KEYCODE_RIGHT}, {51, 29, 6, Common::KEYCODE_UP}, - + // Close button {56, 30, 0, Common::KEYCODE_INVALID}, @@ -133,7 +133,7 @@ key_data keys[DS_NUM_KEYS] = { {66, 26, -2, Common::KEYCODE_F10}, {67, 28, -2, Common::KEYCODE_F11}, {68, 30, -2, Common::KEYCODE_F12}, - + }; int keyboardX; @@ -162,7 +162,7 @@ void restoreVRAM(int tileBase, int mapBase, u16* saveSpace) { /* for (int r = 0; r < 32 * 32; r++) { ((u16 *) SCREEN_BASE_BLOCK_SUB(mapBase))[r] = *saveSpace++; } - + for (int r = 0; r < 4096; r++) { ((u16 *) CHAR_BASE_BLOCK_SUB(tileBase))[r] = *saveSpace++; }*/ @@ -175,19 +175,19 @@ void drawKeyboard(int tileBase, int mapBase, u16* saveSpace) { // *saveSpace++ = ((u16 *) SCREEN_BASE_BLOCK_SUB(mapBase))[r]; ((u16 *) SCREEN_BASE_BLOCK_SUB(mapBase))[r] = 0; } - + for (int r = 0; r < KEYBOARD_DATA_SIZE / 2; r++) { // *saveSpace++ = ((u16 *) CHAR_BASE_BLOCK_SUB(tileBase))[r]; ((u16 *) CHAR_BASE_BLOCK_SUB(tileBase))[r] = ((u16 *) (::keyboard_raw))[r]; } - + for (int r = 0; r < 16; r++) { BG_PALETTE_SUB[r] = ((u16 *) (keyboard_pal_raw))[r]; } // this is the font for (int tile = 0; tile < 94; tile++) { - + u16* tileAddr = (u16 *) (CHAR_BASE_BLOCK_SUB(tileBase) + ((KEYBOARD_DATA_SIZE) + (tile * 32))); u8* src = ((u8 *) (::_8x8font_tga_raw)) + 18 + tile * 8; @@ -197,55 +197,55 @@ void drawKeyboard(int tileBase, int mapBase, u16* saveSpace) { | ((*(src + (y * 752) + (x * 4) + 1) & 0x0F) << 4) | ((*(src + (y * 752) + (x * 4) + 2) & 0x0F) << 8) | ((*(src + (y * 752) + (x * 4) + 3) & 0x0F) << 12); - + } } } - + for (int r = 0; r < 16; r++) { int col = ((u16 *) (keyboard_pal_raw))[r]; - + int red = col & 0x001F; int green = (col & 0x03E0) >> 5; int blue = (col & 0x7C00) >> 10; - + red = (red * 8) / 16; green = (green * 24) / 16; blue = (blue * 8) / 16; if (green > 31) green = 31; - + BG_PALETTE_SUB[16 + r] = red | (green << 5) | (blue << 10); } - + keyboardX = -2; keyboardY = 2; - + DS::mapBase = mapBase; DS::tileBase = tileBase; - + shiftState = false; capsLockState = false; - + int x = keyboardX; int y = keyboardY; - + u16* base = ((u16 *) SCREEN_BASE_BLOCK_SUB(mapBase)); baseAddress = base; - + for (int r = 0; r < DS_NUM_KEYS; r++) { base[(y + keys[r].y) * 32 + x + keys[r].x] = 10 + keys[r].keyNum * 2; base[(y + keys[r].y) * 32 + x + keys[r].x + 1] = 10 + keys[r].keyNum * 2 + 1; - + base[(y + keys[r].y + 1) * 32 + x + keys[r].x] = 10 + 148 + keys[r].keyNum * 2; base[(y + keys[r].y + 1) * 32 + x + keys[r].x + 1] = 10 + 148 + keys[r].keyNum * 2 + 1; - + keys[r].pressed = false; } - + closed = false; clearAutoComplete(); } @@ -257,7 +257,7 @@ void drawAutoComplete() { baseAddress[y * 32 + x] = 0; } } - + for (int r = 0; r < autoCompleteCount; r++) { int y = 12 + (r % 6) * 2; @@ -265,15 +265,15 @@ void drawAutoComplete() { for (int p = 0; autoCompleteWord[r][p] != 0; p++) { char c = autoCompleteWord[r][p]; - + int tile = c - 33 + (KEYBOARD_DATA_SIZE / 32); if (selectedCompletion == r) { tile |= 0x1000; } - baseAddress[y * 32 + x + p] = tile; - + baseAddress[y * 32 + x + p] = tile; + } } @@ -330,7 +330,7 @@ void typeCompletion(int current) { event.type = Common::EVENT_KEYDOWN; event.kbd.flags = 0; system->addEvent(event); - + event.type = Common::EVENT_KEYUP; system->addEvent(event); } @@ -351,13 +351,13 @@ void updateTypeEvents() { Common::Event event; OSystem_DS* system = OSystem_DS::instance(); - + event.kbd.keycode = (Common::KeyCode) autoCompleteBuffer[0]; event.kbd.ascii = autoCompleteBuffer[0]; event.type = Common::EVENT_KEYDOWN; event.kbd.flags = 0; system->addEvent(event); - + event.type = Common::EVENT_KEYUP; system->addEvent(event); @@ -380,16 +380,16 @@ void createKeyEvent(int keyNum, Common::Event& event) } else { event.kbd.keycode = (Common::KeyCode) (Common::KEYCODE_F1 - (keys[keyNum].character - '1')); event.kbd.ascii = 0; - } - + } + } else if ((keys[keyNum].character >= 'A') && (keys[keyNum].character <= 'Z')) { - + if ((!DS::shiftState) && (!DS::capsLockState)) { event.kbd.ascii = keys[keyNum].character + 32; // Make key lowercase. } else { event.kbd.ascii = keys[keyNum].character; } - + event.kbd.keycode = (Common::KeyCode) event.kbd.ascii; } else { if ((keys[keyNum].character >= Common::KEYCODE_F1) && (keys[keyNum].character >= Common::KEYCODE_F12)) { @@ -399,7 +399,7 @@ void createKeyEvent(int keyNum, Common::Event& event) event.kbd.ascii = keys[keyNum].character; event.kbd.keycode = (Common::KeyCode) keys[keyNum].character; } - } + } } void releaseAllKeys() { @@ -408,7 +408,7 @@ void releaseAllKeys() { DS::setKeyHighlight(r, false); OSystem_DS* system = OSystem_DS::instance(); - + Common::Event event; createKeyEvent(r, event); event.type = Common::EVENT_KEYUP; @@ -416,7 +416,7 @@ void releaseAllKeys() { keys[r].pressed = false; } - } + } } void addKeyboardEvents() { @@ -427,7 +427,7 @@ void addKeyboardEvents() { if (DS::getPenDown()) { int x = IPC->touchXpx; int y = IPC->touchYpx; - + int tx = (x >> 3); int ty = (y >> 3); @@ -451,63 +451,63 @@ void addKeyboardEvents() { tx -= keyboardX; ty -= keyboardY; - + // consolePrintf("x=%d y=%d\n", tx, ty); - + for (int r = 0; r < DS_NUM_KEYS; r++) { - if (( (tx >= keys[r].x) && (tx <= keys[r].x + 1)) && + if (( (tx >= keys[r].x) && (tx <= keys[r].x + 1)) && (ty >= keys[r].y) && (ty <= keys[r].y + 1)) { OSystem_DS* system = OSystem_DS::instance(); Common::Event event; - + // consolePrintf("Key: %d\n", r); if ((keys[r].character == Common::KEYCODE_INVALID)) { // Close button //DS::closed = true; } else { createKeyEvent(r, event); - } - - //event.kbd.keycode = keys[r].character; - //event.kbd.ascii = keys[r].character; + } + + //event.kbd.keycode = keys[r].character; + //event.kbd.ascii = keys[r].character; event.type = Common::EVENT_KEYDOWN; system->addEvent(event); // event.type = Common::EVENT_KEYUP; // system->addEvent(event); - + switch (keys[r].character) { case DS_SHIFT: { DS::shiftState = !DS::shiftState; DS::setKeyHighlight(r, DS::shiftState); break; } - + case DS_CAPSLOCK: { DS::capsLockState = !DS::capsLockState; DS::setKeyHighlight(r, DS::capsLockState); break; } - + default: { DS::setKeyHighlight(r, true); keys[r].pressed = true; break; } } - + } } } - + if (DS::getPenReleased()) { - + for (int r = 0; r < DS_NUM_KEYS; r++) { if (keys[r].pressed) { DS::setKeyHighlight(r, false); OSystem_DS* system = OSystem_DS::instance(); - + Common::Event event; if ((keys[r].character == Common::KEYCODE_INVALID)) { // Close button @@ -524,7 +524,7 @@ void addKeyboardEvents() { resetShift = true; } } - } + } } diff --git a/backends/platform/ds/arm9/source/touchkeyboard.h b/backends/platform/ds/arm9/source/touchkeyboard.h index 91efbc1e9a..2f9da16ace 100644 --- a/backends/platform/ds/arm9/source/touchkeyboard.h +++ b/backends/platform/ds/arm9/source/touchkeyboard.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ - + #ifndef _TOUCHKEYBOARD_H_ #define _TOUCHKEYBOARD_H_ diff --git a/backends/platform/ds/arm9/source/wordcompletion.cpp b/backends/platform/ds/arm9/source/wordcompletion.cpp index 60ac673b69..54d74c68d5 100644 --- a/backends/platform/ds/arm9/source/wordcompletion.cpp +++ b/backends/platform/ds/arm9/source/wordcompletion.cpp @@ -23,7 +23,7 @@ void addAutoCompleteLine(char* line) { { char word[32]; int length; - + // Skip the T9-style numbers while (*line != ' ') { @@ -37,7 +37,7 @@ void addAutoCompleteLine(char* line) { if (*line == ' ') line++; - // Copy the new word + // Copy the new word do { word[length++] = *line++; } while ((*line != '\0') && (*line != ' ') && (*line != '\n')); @@ -47,7 +47,7 @@ void addAutoCompleteLine(char* line) { // Store a pointer to the start of the word wordBufferPtr[wordBufferPtrPos++] = &wordBuffer[wordBufferPos]; - + // copy the new word into the buffer strcpy(&wordBuffer[wordBufferPos], word); wordBufferPos += strlen(word) + 1; @@ -103,11 +103,11 @@ bool findWordCompletions(char* input) // Get the word from the dictonary line word = wordBufferPtr[position]; - + // Now check to see if the word is before or after the stub we're after int result = scumm_stricmp((const char *) partialWord, (const char *) word); - + if (result == 0) { // We've found the whole word. Aren't we good. break; @@ -127,10 +127,10 @@ bool findWordCompletions(char* input) word = wordBufferPtr[position]; //consolePrintf("Final word: %s\n", word); - + system->setCharactersEntered(strlen(partialWord)); - + bool match = true; @@ -160,7 +160,7 @@ bool findWordCompletions(char* input) break; } } - + if (match) { system->addAutoComplete(word); } diff --git a/backends/platform/ds/arm9/source/zipreader.cpp b/backends/platform/ds/arm9/source/zipreader.cpp index 01321f44f5..7af0718a44 100644 --- a/backends/platform/ds/arm9/source/zipreader.cpp +++ b/backends/platform/ds/arm9/source/zipreader.cpp @@ -17,7 +17,7 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * + * */ @@ -29,25 +29,25 @@ ZipFile::ZipFile() { // Locate a zip file in cartridge memory space - + // consolePrintf("ZIP file check..."); - + char* p = (char *) ZF_SEARCH_START; bool found = false; - + _zipFile = NULL; - + while ((p != (char *) ZF_SEARCH_END) && (!found)) { // Zip file header is: 0x504B0304 - + if ( (*p == 0x50) && (*(p + 1) == 0x4B) && (*(p + 2) == 0x03) && (*(p + 3) == 0x04) ) { // Found header! found = true; _zipFile = p; } - + if (!found) p += ZF_SEARCH_STRIDE; - + } if (_zipFile) { @@ -56,14 +56,14 @@ ZipFile::ZipFile() { // consolePrintf("Not in use!\n"); return; } - + changeToRoot(); restartFile(); - + if (_currentFile->compSize != (u32) getFileSize()) { consolePrintf("Error: ZIP file contains compression!\n"); } - + _allFilesVisible = false; } @@ -83,19 +83,19 @@ bool ZipFile::restartFile() { getFileName(name); more = skipFile(); } - + return more; } bool ZipFile::currentFileInFolder() { char name[128]; - + if (_allFilesVisible) return true; - + getFileName(name); // consolePrintf("N:'%s'D:'%s'\n", name, _directory); - + if (_directory[0] == 0) { // Root directory name[strlen(name) - 1] = 0; return !strchr(name, '\\'); // Not in root if contains a / character before the last character @@ -104,52 +104,52 @@ bool ZipFile::currentFileInFolder() { && (no slashes after the directory || it's the last character) && (slash follows directory) */ - if ((strstr(name, _directory) == name) && (strlen(name) != strlen(_directory)) + if ((strstr(name, _directory) == name) && (strlen(name) != strlen(_directory)) && ((strchr(name + strlen(_directory) + 1, '\\') == NULL) || (strchr(name + strlen(_directory) + 1, '\\') == name + strlen(name) - 1)) && (*(name + strlen(_directory)) == '\\')) { return true; } } - + return false; } void ZipFile::getFileName(char* name) { strncpy(name, (char *) (_currentFile + 1), _currentFile->nameLength); - + for (int r = 0; r < (int) strlen(name); r++) { if (name[r] == '/') name[r] = '\\'; } name[_currentFile->nameLength] = 0; - + if (name[strlen(name) - 1] == '\\') { name[strlen(name) - 1] = 0; - } + } } bool ZipFile::skipFile() { bool valid; do { - + // Move on to the next file _currentFile = (FileHeader *) ( ((char *) (_currentFile)) + sizeof(*_currentFile) + _currentFile->nameLength + _currentFile->fileSize + _currentFile->extraLength ); - + // Return true if there are more files. Check this by looking for the magic number valid = (_currentFile->magic[0] == 0x50) && (_currentFile->magic[1] == 0x4B) && (_currentFile->magic[2] == 0x03) && (_currentFile->magic[3] == 0x04); - - + + } while (valid && !currentFileInFolder()); - + return valid; - + // Currently doesn't handle data descriptors! } @@ -180,7 +180,7 @@ char* ZipFile::getFile() { bool ZipFile::findFile(char* search) { changeToRoot(); restartFile(); - + char searchName[128]; strcpy(searchName, search); for (int r = 0; r < (int) strlen(searchName); r++) { @@ -191,15 +191,15 @@ bool ZipFile::findFile(char* search) { *(searchName + strlen(searchName) - 1) = '\0'; // which we need to dispose of. } - + do { char name[128]; getFileName(name); if (*(name + strlen(name) - 1) == '\\') { // Directories have a terminating slash *(name + strlen(name) - 1) = '\0'; // which we need to dispose of. } - - + + if (!stricmp(name, searchName)) { // consolePrintf("'%s'=='%s'\n", name, searchName); return true; // Got it! @@ -222,7 +222,7 @@ void ZipFile::changeDirectory(char* dir) { for (int r = 0; r < (int) strlen(_directory); r++) { if (_directory[r] == '/') _directory[r] = '\\'; } - + if (_directory[strlen(_directory) - 1] == '\\') { _directory[strlen(_directory) - 1] = '\0'; } diff --git a/backends/platform/ds/arm9/source/zipreader.h b/backends/platform/ds/arm9/source/zipreader.h index 19aa3d9f31..cd7244dba5 100644 --- a/backends/platform/ds/arm9/source/zipreader.h +++ b/backends/platform/ds/arm9/source/zipreader.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ - + #ifndef _ZIPREADER_H_ #define _ZIPREADER_H_ #include "portdefs.h" @@ -45,9 +45,9 @@ class ZipFile { char* _zipFile; char _directory[128]; - + bool _allFilesVisible; - + FileHeader* _currentFile; public: @@ -55,25 +55,25 @@ public: ~ZipFile(); bool isReady(); - + // These operations set the current file bool restartFile(); bool skipFile(); - bool findFile(char* search); + bool findFile(char* search); // These return the file's data and information char* getFile(); int getFileSize(); void getFileName(char* name); bool isDirectory(); - + // These set the current directory void changeDirectory(char* name); void changeToRoot(); void setAllFilesVisible(bool state) { _allFilesVisible = state; } - + bool currentFileInFolder(); - + u16 misaligned16(u16* v); u32 misaligned32(u32* v); diff --git a/backends/platform/iphone/osys_iphone.cpp b/backends/platform/iphone/osys_iphone.cpp index d5c126e73b..c9fd0e4dff 100644 --- a/backends/platform/iphone/osys_iphone.cpp +++ b/backends/platform/iphone/osys_iphone.cpp @@ -65,11 +65,11 @@ OSystem_IPHONE::OSystem_IPHONE() : _needEventRestPeriod(false), _mouseClickAndDragEnabled(false), _touchpadModeEnabled(false), _gestureStartX(-1), _gestureStartY(-1), _fullScreenIsDirty(false), _mouseDirty(false), _timeSuspended(0), _lastDragPosX(-1), _lastDragPosY(-1) - + { _queuedInputEvent.type = (Common::EventType)0; _lastDrawnMouseRect = Common::Rect(0, 0, 0, 0); - + _fsFactory = new POSIXFilesystemFactory(); } @@ -693,7 +693,7 @@ bool OSystem_IPHONE::pollEvent(Common::Event &event) { case kInputMouseUp: if (!handleEvent_mouseUp(event, x, y)) - return false; + return false; break; case kInputMouseDragged: @@ -714,7 +714,7 @@ bool OSystem_IPHONE::pollEvent(Common::Event &event) { break; case kInputOrientationChanged: - handleEvent_orientationChanged((int)xUnit); + handleEvent_orientationChanged((int)xUnit); return false; break; @@ -762,12 +762,12 @@ bool OSystem_IPHONE::handleEvent_mouseDown(Common::Event &event, int x, int y) { } else { _lastMouseDown = getMillis(); } - return false; + return false; } bool OSystem_IPHONE::handleEvent_mouseUp(Common::Event &event, int x, int y) { //printf("Mouse up at (%u, %u)\n", x, y); - + if (_secondaryTapped) { _secondaryTapped = false; if (!handleEvent_secondMouseUp(event, x, y)) @@ -791,7 +791,7 @@ bool OSystem_IPHONE::handleEvent_mouseUp(Common::Event &event, int x, int y) { } else return false; } - + return true; } @@ -850,14 +850,14 @@ bool OSystem_IPHONE::handleEvent_secondMouseUp(Common::Event &event, int x, int event.mouse.x = _mouseX; event.mouse.y = _mouseY; } - - return true; + + return true; } bool OSystem_IPHONE::handleEvent_mouseDragged(Common::Event &event, int x, int y) { if (_lastDragPosX == x && _lastDragPosY == y) return false; - + _lastDragPosX = x; _lastDragPosY = y; @@ -927,13 +927,13 @@ bool OSystem_IPHONE::handleEvent_mouseDragged(Common::Event &event, int x, int y int mouseNewPosY; if (_touchpadModeEnabled ) { int deltaX = _lastPadX - x; - int deltaY = _lastPadY - y; + int deltaY = _lastPadY - y; _lastPadX = x; _lastPadY = y; - + mouseNewPosX = (int)(_mouseX - deltaX / 0.5f); mouseNewPosY = (int)(_mouseY - deltaY / 0.5f); - + if (mouseNewPosX < 0) mouseNewPosX = 0; else if (mouseNewPosX > _screenWidth) @@ -943,18 +943,18 @@ bool OSystem_IPHONE::handleEvent_mouseDragged(Common::Event &event, int x, int y mouseNewPosY = 0; else if (mouseNewPosY > _screenHeight) mouseNewPosY = _screenHeight; - + } else { mouseNewPosX = x; mouseNewPosY = y; } - + event.type = Common::EVENT_MOUSEMOVE; event.mouse.x = mouseNewPosX; event.mouse.y = mouseNewPosY; warpMouse(mouseNewPosX, mouseNewPosY); } - + return true; } @@ -986,7 +986,7 @@ void OSystem_IPHONE::handleEvent_orientationChanged(int orientation) { dirtyFullScreen(); updateScreen(); - } + } } void OSystem_IPHONE::handleEvent_keyPressed(Common::Event &event, int keyPressed) { @@ -1047,9 +1047,9 @@ void OSystem_IPHONE::handleEvent_keyPressed(Common::Event &event, int keyPresse event.kbd.flags = _queuedInputEvent.kbd.flags = 0; event.kbd.keycode = _queuedInputEvent.kbd.keycode = (Common::KeyCode)keyPressed; event.kbd.ascii = _queuedInputEvent.kbd.ascii = ascii; - _needEventRestPeriod = true; + _needEventRestPeriod = true; } - + bool OSystem_IPHONE::handleEvent_swipe(Common::Event &event, int direction) { Common::KeyCode keycode = Common::KEYCODE_INVALID; switch (_screenOrientation) { @@ -1115,7 +1115,7 @@ bool OSystem_IPHONE::handleEvent_swipe(Common::Event &event, int direction) { _queuedInputEvent.type = Common::EVENT_KEYUP; event.kbd.flags = _queuedInputEvent.kbd.flags = 0; _needEventRestPeriod = true; - + return true; } @@ -1126,14 +1126,14 @@ void OSystem_IPHONE::suspendLoop() { uint32 startTime = getMillis(); stopSoundsystem(); - + while (!done) { if (iPhone_fetchEvent(&eventType, &xUnit, &yUnit)) if ((InputEvent)eventType == kInputApplicationResumed) done = true; usleep(100000); } - + startSoundsystem(); _timeSuspended += getMillis() - startTime; @@ -1238,7 +1238,7 @@ void OSystem_IPHONE::startSoundsystem() { for (int i = 0; i < AUDIO_BUFFERS; i++) { if (AudioQueueAllocateBuffer(s_AudioQueue.queue, bufferBytes, &s_AudioQueue.buffers[i])) { printf("Error allocating AudioQueue buffer!\n"); - _mixer->setReady(false); + _mixer->setReady(false); return; } @@ -1248,10 +1248,10 @@ void OSystem_IPHONE::startSoundsystem() { AudioQueueSetParameter(s_AudioQueue.queue, kAudioQueueParam_Volume, 1.0); if (AudioQueueStart(s_AudioQueue.queue, NULL)) { printf("Error starting the AudioQueue!\n"); - _mixer->setReady(false); + _mixer->setReady(false); return; } - + _mixer->setOutputRate(AUDIO_SAMPLE_RATE); _mixer->setReady(true); } diff --git a/backends/platform/iphone/osys_iphone.h b/backends/platform/iphone/osys_iphone.h index c3d62b7c9c..1f16a8d0c3 100644 --- a/backends/platform/iphone/osys_iphone.h +++ b/backends/platform/iphone/osys_iphone.h @@ -190,17 +190,17 @@ protected: void suspendLoop(); static void AQBufferCallback(void *in, AudioQueueRef inQ, AudioQueueBufferRef outQB); static int timerHandler(int t); - + bool handleEvent_swipe(Common::Event &event, int direction); void handleEvent_keyPressed(Common::Event &event, int keyPressed); void handleEvent_orientationChanged(int orientation); bool handleEvent_mouseDown(Common::Event &event, int x, int y); bool handleEvent_mouseUp(Common::Event &event, int x, int y); - + bool handleEvent_secondMouseDown(Common::Event &event, int x, int y); bool handleEvent_secondMouseUp(Common::Event &event, int x, int y); - + bool handleEvent_mouseDragged(Common::Event &event, int x, int y); }; diff --git a/backends/platform/ps2/Gs2dScreen.cpp b/backends/platform/ps2/Gs2dScreen.cpp index 92ba731433..51c10c10f2 100644 --- a/backends/platform/ps2/Gs2dScreen.cpp +++ b/backends/platform/ps2/Gs2dScreen.cpp @@ -149,7 +149,7 @@ Gs2dScreen::Gs2dScreen(uint16 width, uint16 height, TVMode tvMode) { _videoMode = tvMode; printf("Setting up %s mode\n", (_videoMode == TV_PAL) ? "PAL" : "NTSC"); - + // set screen size, 640x544 for pal, 640x448 for ntsc _tvWidth = 640; _tvHeight = ((_videoMode == TV_PAL) ? 544 : 448); @@ -175,7 +175,7 @@ Gs2dScreen::Gs2dScreen(uint16 width, uint16 height, TVMode tvMode) { _clutPtrs[TEXT] = _clutPtrs[SCREEN] + 0x2000; _texPtrs[SCREEN] = _clutPtrs[SCREEN] + 0x3000; _texPtrs[TEXT] = 0; // these buffers are stored in the alpha gaps of the frame buffers - _texPtrs[MOUSE] = 128 * 256 * 4; + _texPtrs[MOUSE] = 128 * 256 * 4; _texPtrs[PRINTF] = _texPtrs[MOUSE] + M_SIZE * M_SIZE * 4; _showOverlay = false; @@ -224,7 +224,7 @@ Gs2dScreen::Gs2dScreen(uint16 width, uint16 height, TVMode tvMode) { updateScreen(); createAnimTextures(); - + // create anim thread ee_thread_t animThread, thisThread; ReferThreadStatus(GetThreadId(), &thisThread); @@ -636,7 +636,7 @@ void Gs2dScreen::animThread(void) { do { WaitSema(g_AnimSema); } while ((!_systemQuit) && (!g_RunAnim)); - + if (_systemQuit) break; @@ -761,7 +761,7 @@ const uint32 Gs2dScreen::_binaryClut[16] __attribute__((aligned(64))) = { GS_RGBA( 0, 0, 0, 0x20), // scrPrintf: semitransparent GS_RGBA(0xC0, 0xC0, 0xC0, 0), // scrPrintf: red GS_RGBA(0x16, 0x16, 0xF0, 0), // scrPrintf: blue - + GS_RGBA(0xFF, 0xFF, 0xFF, 0x80), GS_RGBA(0xFF, 0xFF, 0xFF, 0x80), // unused GS_RGBA(0xFF, 0xFF, 0xFF, 0x80), GS_RGBA(0xFF, 0xFF, 0xFF, 0x80), GS_RGBA(0xFF, 0xFF, 0xFF, 0x80), GS_RGBA(0xFF, 0xFF, 0xFF, 0x80), diff --git a/backends/platform/ps2/fileio.cpp b/backends/platform/ps2/fileio.cpp index b7fa8d03f1..039e309eb9 100644 --- a/backends/platform/ps2/fileio.cpp +++ b/backends/platform/ps2/fileio.cpp @@ -355,7 +355,7 @@ FILE *ps2_fopen(const char *fname, const char *mode) { file = new Ps2McWriteFile((Ps2SaveFileManager *)g_systemPs2->getSavefileManager()); if (file->open(fname + 4)) // + 4 to skip "mc0:" return (FILE *)file; - + delete file; return NULL; } else { diff --git a/backends/platform/ps2/iop/rpckbd/include/ps2kbd.h b/backends/platform/ps2/iop/rpckbd/include/ps2kbd.h index f16c7ca12b..bebbe73d6a 100644 --- a/backends/platform/ps2/iop/rpckbd/include/ps2kbd.h +++ b/backends/platform/ps2/iop/rpckbd/include/ps2kbd.h @@ -52,7 +52,7 @@ typedef struct _kbd_rawkey { #define PS2KBD_READMODE_RAW 2 /* Notes on read mode */ -/* In normal readmode (default) read multiples of 1 character off the keyboard file. These are +/* In normal readmode (default) read multiples of 1 character off the keyboard file. These are processed by the keymaps so that you get back ASCII data */ /* In raw readmode must read multiples of 2. First byte indicates state (i.e. Up or Down) Second byte is the USB key code for that key. This table is presented in the USB HID Usage Tables manaual diff --git a/backends/platform/ps2/iop/rpckbd/src/irx_imports.h b/backends/platform/ps2/iop/rpckbd/src/irx_imports.h index 6ecc8e5864..41a90a45f0 100644 --- a/backends/platform/ps2/iop/rpckbd/src/irx_imports.h +++ b/backends/platform/ps2/iop/rpckbd/src/irx_imports.h @@ -3,7 +3,7 @@ # ____| | ____| | | |____| # | ___| |____ ___| ____| | \ PS2DEV Open Source Project. #----------------------------------------------------------------------- -# Copyright (c) 2003 Marcus R. Brown +# Copyright (c) 2003 Marcus R. Brown # Licenced under Academic Free License version 2.0 # Review ps2sdk README & LICENSE files for further details. # diff --git a/backends/platform/ps2/iop/rpckbd/src/us_keymap.h b/backends/platform/ps2/iop/rpckbd/src/us_keymap.h index 57f0686cd3..6c41e794cb 100644 --- a/backends/platform/ps2/iop/rpckbd/src/us_keymap.h +++ b/backends/platform/ps2/iop/rpckbd/src/us_keymap.h @@ -16,8 +16,8 @@ /* Default US keymap */ -u8 us_keymap[PS2KBD_KEYMAP_SIZE] = - { +u8 us_keymap[PS2KBD_KEYMAP_SIZE] = + { 0, 0, 0, @@ -83,7 +83,7 @@ u8 us_keymap[PS2KBD_KEYMAP_SIZE] = 0, // F5 0, // F6 0, // F7 - 0, // F8 + 0, // F8 0, // F9 0, // F10 0, // F11 @@ -92,7 +92,7 @@ u8 us_keymap[PS2KBD_KEYMAP_SIZE] = 0, // Scroll Lock 0, // Pause 0, // Insert - 0, // Home + 0, // Home 0, // Pg Up 0, // Delete 0, // End @@ -102,7 +102,7 @@ u8 us_keymap[PS2KBD_KEYMAP_SIZE] = 0, // Down 0, // Up 0, // Numlock - '/', // Keypad + '/', // Keypad '*', '-', '+', @@ -276,7 +276,7 @@ u8 us_keymap[PS2KBD_KEYMAP_SIZE] = 0 }; -u8 us_shiftkeymap[PS2KBD_KEYMAP_SIZE] = +u8 us_shiftkeymap[PS2KBD_KEYMAP_SIZE] = { 0, 0, @@ -343,7 +343,7 @@ u8 us_shiftkeymap[PS2KBD_KEYMAP_SIZE] = 0, // F5 0, // F6 0, // F7 - 0, // F8 + 0, // F8 0, // F9 0, // F10 0, // F11 @@ -352,7 +352,7 @@ u8 us_shiftkeymap[PS2KBD_KEYMAP_SIZE] = 0, // Scroll Lock 0, // Pause 0, // Insert - 0, // Home + 0, // Home 0, // Pg Up 0, // Delete 0, // End @@ -362,7 +362,7 @@ u8 us_shiftkeymap[PS2KBD_KEYMAP_SIZE] = 0, // Down 0, // Up 0, // Numlock - '/', // Keypad + '/', // Keypad '*', '-', '+', @@ -536,7 +536,7 @@ u8 us_shiftkeymap[PS2KBD_KEYMAP_SIZE] = 0 }; -u8 us_keycap[PS2KBD_KEYMAP_SIZE] = +u8 us_keycap[PS2KBD_KEYMAP_SIZE] = { 0, 0, @@ -603,7 +603,7 @@ u8 us_keycap[PS2KBD_KEYMAP_SIZE] = 0, // F5 0, // F6 0, // F7 - 0, // F8 + 0, // F8 0, // F9 0, // F10 0, // F11 @@ -612,7 +612,7 @@ u8 us_keycap[PS2KBD_KEYMAP_SIZE] = 0, // Scroll Lock 0, // Pause 0, // Insert - 0, // Home + 0, // Home 0, // Pg Up 0, // Delete 0, // End @@ -622,7 +622,7 @@ u8 us_keycap[PS2KBD_KEYMAP_SIZE] = 0, // Down 0, // Up 0, // Numlock - 0, // Keypad + 0, // Keypad 0, 0, 0, @@ -796,7 +796,7 @@ u8 us_keycap[PS2KBD_KEYMAP_SIZE] = 0 }; -u8 us_special_keys[PS2KBD_KEYMAP_SIZE] = { +u8 us_special_keys[PS2KBD_KEYMAP_SIZE] = { 0, 0, @@ -863,7 +863,7 @@ u8 us_special_keys[PS2KBD_KEYMAP_SIZE] = { 5, // F5 6, // F6 7, // F7 - 8, // F8 + 8, // F8 9, // F9 10, // F10 11, // F11 @@ -872,7 +872,7 @@ u8 us_special_keys[PS2KBD_KEYMAP_SIZE] = { 33, // Scroll Lock 34, // Pause 35, // Insert - 36, // Home + 36, // Home 37, // Pg Up 38, // Delete 39, // End @@ -882,7 +882,7 @@ u8 us_special_keys[PS2KBD_KEYMAP_SIZE] = { 43, // Down 44, // Up 0, // Numlock - 0, // Keypad / + 0, // Keypad / 0, // Keypad * 0, // Keypad - 0, // Keypad + @@ -1056,7 +1056,7 @@ u8 us_special_keys[PS2KBD_KEYMAP_SIZE] = { 0 }; -u8 us_control_map[PS2KBD_KEYMAP_SIZE] = { +u8 us_control_map[PS2KBD_KEYMAP_SIZE] = { 0, 0, @@ -1123,7 +1123,7 @@ u8 us_control_map[PS2KBD_KEYMAP_SIZE] = { 0, // F5 0, // F6 0, // F7 - 0, // F8 + 0, // F8 0, // F9 0, // F10 0, // F11 @@ -1132,7 +1132,7 @@ u8 us_control_map[PS2KBD_KEYMAP_SIZE] = { 0, // Scroll Lock 0, // Pause 0, // Insert - 0, // Home + 0, // Home 0, // Pg Up 0, // Delete 0, // End @@ -1142,7 +1142,7 @@ u8 us_control_map[PS2KBD_KEYMAP_SIZE] = { 0, // Down 0, // Up 0, // Numlock - 0, // Keypad + 0, // Keypad 0, 0, 0, @@ -1316,7 +1316,7 @@ u8 us_control_map[PS2KBD_KEYMAP_SIZE] = { 0 }; -u8 us_alt_map[PS2KBD_KEYMAP_SIZE] = { +u8 us_alt_map[PS2KBD_KEYMAP_SIZE] = { 0, 0, @@ -1383,7 +1383,7 @@ u8 us_alt_map[PS2KBD_KEYMAP_SIZE] = { 0, // F5 0, // F6 0, // F7 - 0, // F8 + 0, // F8 0, // F9 0, // F10 0, // F11 @@ -1392,7 +1392,7 @@ u8 us_alt_map[PS2KBD_KEYMAP_SIZE] = { 0, // Scroll Lock 0, // Pause 0, // Insert - 0, // Home + 0, // Home 0, // Pg Up 0, // Delete 0, // End @@ -1402,7 +1402,7 @@ u8 us_alt_map[PS2KBD_KEYMAP_SIZE] = { 0, // Down 0, // Up 0, // Numlock - 0, // Keypad + 0, // Keypad 0, 0, 0, diff --git a/backends/platform/ps2/irxboot.cpp b/backends/platform/ps2/irxboot.cpp index 65d1e243eb..91c45294c6 100644 --- a/backends/platform/ps2/irxboot.cpp +++ b/backends/platform/ps2/irxboot.cpp @@ -74,7 +74,7 @@ BootDevice detectBootPath(const char *elfPath, char *bootPath) { device = OTHER; sioprintf("elf path: %s, device %d\n", elfPath, device); - + strcpy(bootPath, elfPath); char *pathPos = bootPath; @@ -116,7 +116,7 @@ BootDevice detectBootPath(const char *elfPath, char *bootPath) { return device; } -int loadIrxModules(int device, const char *irxPath, IrxReference **modules) { +int loadIrxModules(int device, const char *irxPath, IrxReference **modules) { IrxReference *resModules = (IrxReference *)malloc(numIrxFiles * sizeof(IrxReference)); IrxReference *curModule = resModules; diff --git a/backends/platform/ps2/savefilemgr.cpp b/backends/platform/ps2/savefilemgr.cpp index 8fbd98e78a..3e93b954c7 100644 --- a/backends/platform/ps2/savefilemgr.cpp +++ b/backends/platform/ps2/savefilemgr.cpp @@ -193,7 +193,7 @@ Ps2SaveFileManager::Ps2SaveFileManager(OSystem_PS2 *system, Gs2dScreen *screen) saveThread.initial_priority = thisThread.current_priority + 1; saveThread.stack_size = 8 * 1024; - _autoSaveStack = malloc(saveThread.stack_size); + _autoSaveStack = malloc(saveThread.stack_size); saveThread.stack = _autoSaveStack; saveThread.func = (void *)runSaveThread; saveThread.gp_reg = &_gp; @@ -409,7 +409,7 @@ Common::StringList Ps2SaveFileManager::listSavefiles(const char *regex) { _mcNeedsUpdate = true; mcTable *mcEntries = (mcTable*)memalign(64, sizeof(mcTable) * MAX_MC_ENTRIES); - + char temp[256], mcSearchStr[256], *dir, *ext; strcpy(temp, regex); dir = strdup(strtok(temp, ".")); @@ -451,7 +451,7 @@ bool Ps2SaveFileManager::removeSavefile(const char *filename) { char dir[64], name[64], fullPath[128]; - splitPath(filename, dir, name); + splitPath(filename, dir, name); sprintf(fullPath, "/ScummVM-%s/%s", dir, name); int res = _mc->remove(fullPath); diff --git a/backends/platform/ps2/savefilemgr.h b/backends/platform/ps2/savefilemgr.h index 0164d4551b..794c2aeb9c 100644 --- a/backends/platform/ps2/savefilemgr.h +++ b/backends/platform/ps2/savefilemgr.h @@ -43,7 +43,7 @@ public: int read(int fd, void *buf, int size); int write(int fd, const void *buf, int size); int mkDir(const char *name); - int getDir(const char *name, unsigned int mode, int max, void *dest); + int getDir(const char *name, unsigned int mode, int max, void *dest); int getInfo(int *type, int *free, int *format); int remove(const char *name); diff --git a/backends/platform/ps2/systemps2.cpp b/backends/platform/ps2/systemps2.cpp index aac399ee23..adf519cee3 100644 --- a/backends/platform/ps2/systemps2.cpp +++ b/backends/platform/ps2/systemps2.cpp @@ -197,7 +197,7 @@ void OSystem_PS2::startIrxModules(int numModules, IrxReference *modules) { } } else sioprintf("Module \"%s\" wasn't found: %d\n", modules[i].path, modules[i].errorCode); - + if ((modules[i].errorCode < 0) || (res < 0) || (rv < 0)) { if (!(modules[i].fileRef->flags & OPTIONAL)) { if (modules[i].errorCode < 0) @@ -208,7 +208,7 @@ void OSystem_PS2::startIrxModules(int numModules, IrxReference *modules) { quit(); } } - + if (modules[i].buffer) free(modules[i].buffer); } else { @@ -283,7 +283,7 @@ OSystem_PS2::OSystem_PS2(const char *elfPath) { hddPreparePoweroff(); //poweroffInit(); - dbg_printf("romeo : hddPreparePoweroff done\n"); + dbg_printf("romeo : hddPreparePoweroff done\n"); hddSetUserPoweroffCallback(gluePowerOffCallback, this); //poweroffSetCallback(gluePowerOffCallback, this); @@ -464,7 +464,7 @@ bool OSystem_PS2::hddPresent(void) { } bool OSystem_PS2::usbMassPresent(void) { - + if (_usbMassLoaded) { int testFd = fio.dopen("mass:/"); if (testFd >= 0) @@ -670,7 +670,7 @@ void OSystem_PS2::msgPrintf(int millis, char *format, ...) { while ((*lnEnd) && (*lnEnd != '\n')) lnEnd++; *lnEnd = '\0'; - + Common::String str(lnSta); int width = Graphics::g_sysfont.getStringWidth(str); if (width > maxWidth) diff --git a/backends/platform/psp/osys_psp.cpp b/backends/platform/psp/osys_psp.cpp index 7f38e3c4bb..72dd05e664 100644 --- a/backends/platform/psp/osys_psp.cpp +++ b/backends/platform/psp/osys_psp.cpp @@ -99,7 +99,7 @@ OSystem_PSP::~OSystem_PSP() { void OSystem_PSP::initBackend() { _savefile = new PSPSaveFileManager; - + _timer = new DefaultTimerManager(); setTimerCallback(&timer_handler, 10); @@ -614,7 +614,7 @@ void OSystem_PSP::setupMixer(void) { // least on some platforms SDL will lie and claim it did get the rate // even if it didn't. Probably only happens for "weird" rates, though. _samplesPerSec = obtained.freq; - + // Tell the mixer that we are ready and start the sound processing _mixer->setOutputRate(_samplesPerSec); _mixer->setReady(true); diff --git a/backends/platform/psp/osys_psp_gu.cpp b/backends/platform/psp/osys_psp_gu.cpp index 19057d4c41..a388ef55fe 100644 --- a/backends/platform/psp/osys_psp_gu.cpp +++ b/backends/platform/psp/osys_psp_gu.cpp @@ -96,7 +96,7 @@ OSystem_PSP_GU::OSystem_PSP_GU() { keyboard_letters = (unsigned char *)memalign(16, KBD_DATA_SIZE); if (Z_OK != uncompress((Bytef *)keyboard_letters, &kbdSize, (const Bytef *)keyboard_letters_compressed, size_keyboard_letters_compressed)) error("OSystem_PSP_GU: uncompressing keyboard_letters failed"); - + kbdSize = KBD_DATA_SIZE; keyboard_letters_shift = (unsigned char *)memalign(16, KBD_DATA_SIZE); if (Z_OK != uncompress((Bytef *)keyboard_letters_shift, &kbdSize, (const Bytef *)keyboard_letters_shift_compressed, size_keyboard_letters_shift_compressed)) diff --git a/backends/platform/sdl/graphics.cpp b/backends/platform/sdl/graphics.cpp index 4a05a03973..40af643a1b 100644 --- a/backends/platform/sdl/graphics.cpp +++ b/backends/platform/sdl/graphics.cpp @@ -301,7 +301,7 @@ void OSystem_SDL::setGraphicsModeIntern() { } _scalerProc = newScalerProc; - + if (_videoMode.mode != GFX_NORMAL) { for (int i = 0; i < ARRAYSIZE(s_gfxModeSwitchTable); i++) { if (s_gfxModeSwitchTable[i][1] == _videoMode.mode || s_gfxModeSwitchTable[i][2] == _videoMode.mode) { @@ -742,7 +742,7 @@ bool OSystem_SDL::saveScreenshot(const char *filename) { void OSystem_SDL::setFullscreenMode(bool enable) { Common::StackLock lock(_graphicsMutex); - + if (_oldVideoMode.setup && _oldVideoMode.fullscreen == enable) return; diff --git a/backends/platform/sdl/sdl.h b/backends/platform/sdl/sdl.h index 207ed50d63..09c45d8408 100644 --- a/backends/platform/sdl/sdl.h +++ b/backends/platform/sdl/sdl.h @@ -378,7 +378,7 @@ protected: SDL_Thread *_soundThread; bool _soundThreadIsRunning; bool _soundThreadShouldQuit; - + byte _activeSoundBuf; uint _soundBufSize; byte *_soundBuffers[2]; diff --git a/backends/platform/symbian/src/SymbianActions.cpp b/backends/platform/symbian/src/SymbianActions.cpp index e71b242329..6ad6ff75ce 100644 --- a/backends/platform/symbian/src/SymbianActions.cpp +++ b/backends/platform/symbian/src/SymbianActions.cpp @@ -178,7 +178,7 @@ void SymbianActions::initInstanceGame() { // Skip text if (!is_cine && !is_parallaction) _action_enabled[ACTION_SKIP_TEXT] = true; - if (is_simon || is_sky || is_sword2 || is_queen || is_sword1 || is_gob || + if (is_simon || is_sky || is_sword2 || is_queen || is_sword1 || is_gob || is_saga || is_kyra || is_touche || is_lure || is_feeble || is_drascula) _key_action[ACTION_SKIP_TEXT].setKey(Common::KEYCODE_ESCAPE, Common::KEYCODE_ESCAPE); // Escape key else { diff --git a/backends/platform/symbian/src/SymbianOS.cpp b/backends/platform/symbian/src/SymbianOS.cpp index 254b716927..251ba2c48e 100644 --- a/backends/platform/symbian/src/SymbianOS.cpp +++ b/backends/platform/symbian/src/SymbianOS.cpp @@ -25,7 +25,7 @@ #include // for CEikonEnv::Static() @ Symbian::FatalError() #include // for CSDLApp::GetExecutablePathCStr() @ Symbian::GetExecutablePath() #include - + #include "backends/fs/symbian/symbian-fs-factory.h" #include "backends/platform/symbian/src/SymbianOS.h" #include "backends/platform/symbian/src/SymbianActions.h" @@ -156,7 +156,7 @@ void OSystem_SDL_Symbian::initBackend() { // If savepath has not already been set then set it if (!ConfMan.hasKey("savepath")) { ConfMan.set("savepath", savePath); - + } // Ensure that the current set path (might have been altered by the user) exists @@ -164,7 +164,7 @@ void OSystem_SDL_Symbian::initBackend() { TFileName fname; TPtrC8 ptr((const unsigned char*)currentPath.c_str(),currentPath.size()); fname.Copy(ptr); - BaflUtils::EnsurePathExistsL(static_cast(g_system)->FsSession(), fname); + BaflUtils::EnsurePathExistsL(static_cast(g_system)->FsSession(), fname); ConfMan.setBool("FM_high_quality", false); #if !defined(S60) || defined(S60V3) // S60 has low quality as default @@ -268,12 +268,12 @@ void OSystem_SDL_Symbian::setupMixer() { // even if it didn't. Probably only happens for "weird" rates, though. _samplesPerSec = obtained.freq; _channels = obtained.channels; - + // Need to create mixbuffer for stereo mix to downmix if (_channels != 2) { _stereo_mix_buffer = new byte [obtained.size*2];//*2 for stereo values } - + // Tell the mixer that we are ready and start the sound processing _mixer->setOutputRate(_samplesPerSec); _mixer->setReady(true); diff --git a/backends/platform/symbian/src/vsnprintf.h b/backends/platform/symbian/src/vsnprintf.h index 5ed04b1980..5a9c836ea3 100644 --- a/backends/platform/symbian/src/vsnprintf.h +++ b/backends/platform/symbian/src/vsnprintf.h @@ -1,9 +1,9 @@ /* - * This is the vsnprintf for scummvm/symbian implementation from the original snprintf.c, + * This is the vsnprintf for scummvm/symbian implementation from the original snprintf.c, * all support functions has been removed and vsnprintf renamed to symbian_vsnprintf * snprintf.c - a portable implementation of snprintf * According to the homepage this function could be licensed as either Frontier Aritistic or GPL. - * + * * AUTHOR * Mark Martinec , April 1999. * @@ -230,14 +230,14 @@ static char credits[] = "\n\ @(#)snprintf.c, v2.2: Copyright 1999, Mark Martinec. Frontier Artistic License applies.\n\ @(#)snprintf.c, v2.2: http://www.ijs.si/software/snprintf/\n"; int symbian_vsnprintf(char *str, size_t str_m, const char *fmt, va_list ap) { - + size_t str_l = 0; const char *p = fmt; - + /* In contrast with POSIX, the ISO C99 now says * that str can be NULL and str_m can be 0. * This is more useful than the old: if (str_m < 1) return -1; */ - + if (!p) p = ""; while (*p) { if (*p != '%') { @@ -260,7 +260,7 @@ int symbian_vsnprintf(char *str, size_t str_m, const char *fmt, va_list ap) { the ' ' flag should be ignored. */ char length_modifier = '\0'; /* allowed values: \0, h, l, L */ char tmp[32];/* temporary buffer for simple numeric->string conversion */ - + const char *str_arg; /* string address in case of string argument */ size_t str_arg_l; /* natural field width of arg without padding and sign */ @@ -268,17 +268,17 @@ int symbian_vsnprintf(char *str, size_t str_m, const char *fmt, va_list ap) { /* unsigned char argument value - only defined for c conversion. N.B. standard explicitly states the char argument for the c conversion is unsigned */ - + size_t number_of_zeros_to_pad = 0; /* number of zeros to be inserted for numeric conversions as required by the precision or minimal field width */ - + size_t zero_padding_insertion_ind = 0; /* index into tmp where zero padding is to be inserted */ - + char fmt_spec = '\0'; /* current conversion specifier character */ - + str_arg = credits;/* just to make compiler happy (defined but not used)*/ str_arg = NULL; starting_p = p; p++; /* skip '%' */ @@ -298,7 +298,7 @@ int symbian_vsnprintf(char *str, size_t str_m, const char *fmt, va_list ap) { p++; } /* If the '0' and '-' flags both appear, the '0' flag should be ignored. */ - + /* parse field width */ if (*p == '*') { int j; @@ -397,21 +397,21 @@ int symbian_vsnprintf(char *str, size_t str_m, const char *fmt, va_list ap) { case 'd': case 'u': case 'o': case 'x': case 'X': case 'p': { /* NOTE: the u, o, x, X and p conversion specifiers imply the value is unsigned; d implies a signed value */ - + int arg_sign = 0; /* 0 if numeric argument is zero (or if pointer is NULL for 'p'), +1 if greater than zero (or nonzero for unsigned arguments), -1 if negative (unsigned argument is never negative) */ - + int int_arg = 0; unsigned int uint_arg = 0; /* only defined for length modifier h, or for no length modifiers */ - + long int long_arg = 0; unsigned long int ulong_arg = 0; /* only defined for length modifier l */ - + void *ptr_arg = NULL; /* pointer argument value -only defined for p conversion */ - + #ifdef SNPRINTF_LONGLONG_SUPPORT long long int long_long_arg = 0; unsigned long long int ulong_long_arg = 0; @@ -554,7 +554,7 @@ int symbian_vsnprintf(char *str, size_t str_m, const char *fmt, va_list ap) { } } /* zero padding to specified precision? */ - if (num_of_digits < precision) + if (num_of_digits < precision) number_of_zeros_to_pad = precision - num_of_digits; } /* zero padding to specified minimal field width? */ @@ -659,10 +659,10 @@ int symbian_vsnprintf(char *str, size_t str_m, const char *fmt, va_list ap) { int symbian_snprintf(char *text, size_t maxlen, const char *fmt, ...) { va_list ap; int retval; - + va_start(ap, fmt); retval = symbian_vsnprintf(text, maxlen, fmt, ap); va_end(ap); - + return retval; } diff --git a/backends/platform/wii/gx_supp.h b/backends/platform/wii/gx_supp.h index 108a94f0e7..3433ef8df5 100644 --- a/backends/platform/wii/gx_supp.h +++ b/backends/platform/wii/gx_supp.h @@ -1,5 +1,5 @@ /**************************************************************************** -* Generic GX Scaler +* Generic GX Scaler * softdev 2007 * dhewg 2008 * diff --git a/backends/platform/wii/osystem.cpp b/backends/platform/wii/osystem.cpp index 505f93c820..777d82dce7 100644 --- a/backends/platform/wii/osystem.cpp +++ b/backends/platform/wii/osystem.cpp @@ -93,7 +93,7 @@ OSystem_Wii::~OSystem_Wii() { void OSystem_Wii::initBackend() { _startup_time = gettime(); - + char buf[MAXPATHLEN]; if (!getcwd(buf, MAXPATHLEN)) strcpy(buf, "/"); diff --git a/backends/platform/wii/osystem_gfx.cpp b/backends/platform/wii/osystem_gfx.cpp index 1f0023a8e8..6402ce9a35 100644 --- a/backends/platform/wii/osystem_gfx.cpp +++ b/backends/platform/wii/osystem_gfx.cpp @@ -291,7 +291,7 @@ void OSystem_Wii::updateScreen() { if (_mouseVisible) { msx = _mouseX - _mouseHotspotX; - msy = _mouseY - _mouseHotspotY; + msy = _mouseY - _mouseHotspotY; mox = 0; moy = 0; mpx = _mouseWidth; diff --git a/backends/platform/wince/CEActionsPocket.cpp b/backends/platform/wince/CEActionsPocket.cpp index 7f78517762..3a83d4dadf 100644 --- a/backends/platform/wince/CEActionsPocket.cpp +++ b/backends/platform/wince/CEActionsPocket.cpp @@ -134,7 +134,7 @@ void CEActionsPocket::initInstanceGame() { GUI_Actions::initInstanceGame(); // See if a right click mapping could be needed - if (is_sword1 || is_sword2 || is_sky || is_queen || is_comi || is_gob || + if (is_sword1 || is_sword2 || is_sky || is_queen || is_comi || is_gob || is_samnmax || is_cine || is_touche || is_parallaction || is_drascula) _right_click_needed = true; @@ -173,7 +173,7 @@ void CEActionsPocket::initInstanceGame() { // Skip if (!is_cine && !is_parallaction) _action_enabled[POCKET_ACTION_SKIP] = true; - if (is_simon || is_sky || is_sword2 || is_queen || is_sword1 || is_gob || + if (is_simon || is_sky || is_sword2 || is_queen || is_sword1 || is_gob || is_saga || is_kyra || is_touche || is_lure || is_feeble || is_drascula) _key_action[POCKET_ACTION_SKIP].setKey(VK_ESCAPE); else diff --git a/backends/platform/wince/wince-sdl.cpp b/backends/platform/wince/wince-sdl.cpp index b08cfbbead..3e034baef4 100644 --- a/backends/platform/wince/wince-sdl.cpp +++ b/backends/platform/wince/wince-sdl.cpp @@ -460,7 +460,7 @@ static Common::String getDefaultConfigFileName() { strcpy(configFile, getcwd(NULL, MAX_PATH)); strcat(configFile, "\\"); strcat(configFile, DEFAULT_CONFIG_FILE); - return configFile; + return configFile; } Common::SeekableReadStream *OSystem_WINCE3::openConfigFileForReading() { @@ -1377,7 +1377,7 @@ bool OSystem_WINCE3::loadGFXMode() { if (_hwscreen == NULL) { warning("SDL_SetVideoMode says we can't switch to that mode (%s)", SDL_GetError()); quit(); - } + } // see what orientation sdl finally accepted if (_hwscreen->flags & SDL_PORTRTVIDEO) @@ -1441,8 +1441,8 @@ bool OSystem_WINCE3::loadGFXMode() { _km.y_max = _videoMode.screenHeight * _scaleFactorXm / _scaleFactorXd - 1; _km.delay_time = 25; _km.last_time = 0; - - return true; + + return true; } void OSystem_WINCE3::unloadGFXMode() { diff --git a/backends/platform/wince/wince-sdl.h b/backends/platform/wince/wince-sdl.h index 2cca49052b..e4dfddfecd 100644 --- a/backends/platform/wince/wince-sdl.h +++ b/backends/platform/wince/wince-sdl.h @@ -203,7 +203,7 @@ private: bool _zoomUp; // zooming up mode bool _zoomDown; // zooming down mode - bool _noDoubleTapRMB; // disable double tap -> rmb click + bool _noDoubleTapRMB; // disable double tap -> rmb click bool _rbutton; // double tap -> right button simulation bool _closeClick; // flag when taps are spatially close together diff --git a/backends/saves/default/default-saves.cpp b/backends/saves/default/default-saves.cpp index 871032754a..f5f321111b 100644 --- a/backends/saves/default/default-saves.cpp +++ b/backends/saves/default/default-saves.cpp @@ -113,7 +113,7 @@ bool DefaultSaveFileManager::removeSavefile(const char *filename) { return false; Common::FSNode file = savePath.getChild(filename); - + // FIXME: remove does not exist on all systems. If your port fails to // compile because of this, please let us know (scummvm-devel or Fingolfin). // There is a nicely portable workaround, too: Make this method overloadable. diff --git a/backends/saves/posix/posix-saves.cpp b/backends/saves/posix/posix-saves.cpp index 2466f3d8d9..bcc1824200 100644 --- a/backends/saves/posix/posix-saves.cpp +++ b/backends/saves/posix/posix-saves.cpp @@ -53,7 +53,7 @@ POSIXSaveFileManager::POSIXSaveFileManager() { } } /* -POSIXSaveFileManager::POSIXSaveFileManager(const Common::String &defaultSavepath) +POSIXSaveFileManager::POSIXSaveFileManager(const Common::String &defaultSavepath) : DefaultSaveFileManager(defaultSavepath) { } */ diff --git a/backends/saves/psp/psp-saves.cpp b/backends/saves/psp/psp-saves.cpp index 98384a4ed3..4a584554d2 100644 --- a/backends/saves/psp/psp-saves.cpp +++ b/backends/saves/psp/psp-saves.cpp @@ -39,7 +39,7 @@ PSPSaveFileManager::PSPSaveFileManager() { ConfMan.registerDefault("savepath", PSP_DEFAULT_SAVE_PATH); } /* -PSPSaveFileManager::PSPSaveFileManager(const Common::String &defaultSavepath) +PSPSaveFileManager::PSPSaveFileManager(const Common::String &defaultSavepath) : DefaultSaveFileManager(defaultSavepath) { } */ diff --git a/common/fs.h b/common/fs.h index 29d6f667ca..4d3a417c8b 100644 --- a/common/fs.h +++ b/common/fs.h @@ -223,7 +223,7 @@ public: * @return pointer to the stream object, 0 in case of a failure */ virtual WriteStream *openForWriting() const; - + // Compatibility with ArchiveMember API. SeekableReadStream *open() { return openForReading(); diff --git a/common/unzip.cpp b/common/unzip.cpp index 1a65b2e9b4..abb2096f4a 100644 --- a/common/unzip.cpp +++ b/common/unzip.cpp @@ -1442,7 +1442,7 @@ Common::SeekableReadStream *ZipArchive::openFile(const Common::String &name) { unzReadCurrentFile(_zipFile, buffer, fileInfo.uncompressed_size); unzCloseCurrentFile(_zipFile); return new Common::MemoryReadStream(buffer, fileInfo.uncompressed_size+1, true); - + // FIXME: instead of reading all into a memory stream, we could // instead create a new ZipStream class. But then we have to be // careful to handle the case where the client code opens multiple diff --git a/engines/agi/detection.cpp b/engines/agi/detection.cpp index a9f49b64c6..5763f8e63b 100644 --- a/engines/agi/detection.cpp +++ b/engines/agi/detection.cpp @@ -2186,7 +2186,7 @@ SaveStateList AgiMetaEngine::listSaves(const char *target) const { for (Common::StringList::const_iterator file = filenames.begin(); file != filenames.end(); ++file) { // Obtain the last 3 digits of the filename, since they correspond to the save slot int slotNum = atoi(file->c_str() + file->size() - 3); - + if (slotNum >= 0 && slotNum <= 999) { Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str()); if (in) { @@ -2250,7 +2250,7 @@ SaveStateDescriptor AgiMetaEngine::querySaveMetaInfos(const char *target, int sl int year = saveDate & 0xFFFF; desc.setSaveDate(year, month, day); - + int hour = (saveTime >> 8) & 0xFF; int minutes = saveTime & 0xFF; @@ -2264,7 +2264,7 @@ SaveStateDescriptor AgiMetaEngine::querySaveMetaInfos(const char *target, int sl return desc; } - + return SaveStateDescriptor(); } @@ -2414,8 +2414,8 @@ const Common::ADGameDescription *AgiMetaEngine::fallbackDetect(const Common::FSL // Check if we found a match with any of the fallback methods if (matchedUsingWag || matchedUsingFilenames) { _extra = description + (!_extra.empty() ? " " : "") + _extra; // Let's combine the description and extra - - // Override the gameid & extra values in g_fallbackDesc.desc. This only works + + // Override the gameid & extra values in g_fallbackDesc.desc. This only works // until the fallback detector is called again, and while the MetaEngine instance // is alive (as else the string storage is modified/deleted). g_fallbackDesc.desc.gameid = _gameid.c_str(); @@ -2454,11 +2454,11 @@ Common::Error AgiBase::saveGameState(int slot, const char *desc) { return Common::kNoError; // TODO: return success/failure } -bool AgiBase::canLoadGameStateCurrently() { +bool AgiBase::canLoadGameStateCurrently() { return (!(getGameType() == GType_PreAGI) && getflag(fMenusWork)); } -bool AgiBase::canSaveGameStateCurrently() { +bool AgiBase::canSaveGameStateCurrently() { return (!(getGameType() == GType_PreAGI) && getflag(fMenusWork)); } diff --git a/engines/agi/loader_v3.cpp b/engines/agi/loader_v3.cpp index bea57069c0..e784dad323 100644 --- a/engines/agi/loader_v3.cpp +++ b/engines/agi/loader_v3.cpp @@ -230,7 +230,7 @@ uint8 *AgiLoader_v3::loadVolRes(AgiDir *agid) { debugC(3, kDebugLevelResources, "offset = %d", agid->offset); debugC(3, kDebugLevelResources, "x = %x %x", x[0], x[1]); error("ACK! BAD RESOURCE"); - + _vm->quitGame(); } diff --git a/engines/agi/saveload.cpp b/engines/agi/saveload.cpp index a551394697..a3c3f0a035 100644 --- a/engines/agi/saveload.cpp +++ b/engines/agi/saveload.cpp @@ -46,7 +46,7 @@ * Version 1 (Sarien): view table has 256 entries (needed in KQ3) * Version 2 (ScummVM): first ScummVM version * Version 3 (ScummVM): added AGIPAL save/load support - * Version 4 (ScummVM): added thumbnails and save creation date/time + * Version 4 (ScummVM): added thumbnails and save creation date/time */ namespace Agi { diff --git a/engines/agos/agos.cpp b/engines/agos/agos.cpp index 641c6e707e..a2c7467412 100644 --- a/engines/agos/agos.cpp +++ b/engines/agos/agos.cpp @@ -555,7 +555,7 @@ Common::Error AGOSEngine::init() { // Setup midi driver int midiDriver = MidiDriver::detectMusicDriver(MDT_ADLIB | MDT_MIDI); _nativeMT32 = ((midiDriver == MD_MT32) || ConfMan.getBool("native_mt32")); - + _driver = MidiDriver::createMidi(midiDriver); if (_nativeMT32) { @@ -890,7 +890,7 @@ AGOSEngine::~AGOSEngine() { free(_tablesHeapPtr - _tablesHeapCurPos); free(_mouseData); - + free(_gameOffsetsPtr); free(_iconFilePtr); free(_itemArrayPtr); @@ -1029,7 +1029,7 @@ Common::Error AGOSEngine::go() { /* I do not think that this will be used - * + * void AGOSEngine::shutdown() { // Sync with AGOSEngine::~AGOSEngine() // In Simon 2, this gets deleted along with _sound further down diff --git a/engines/agos/detection.cpp b/engines/agos/detection.cpp index 5ca640d96c..4c400859f6 100644 --- a/engines/agos/detection.cpp +++ b/engines/agos/detection.cpp @@ -102,7 +102,7 @@ static const Common::ADParams detectionParams = { class AgosMetaEngine : public Common::AdvancedMetaEngine { public: AgosMetaEngine() : Common::AdvancedMetaEngine(detectionParams) {} - + virtual const char *getName() const { return "AGOS"; } @@ -110,7 +110,7 @@ public: virtual const char *getCopyright() const { return "AGOS (C) Adventure Soft"; } - + virtual bool hasFeature(MetaEngineFeature f) const; virtual bool createInstance(OSystem *syst, Engine **engine, const Common::ADGameDescription *desc) const; virtual SaveStateList listSaves(const char *target) const; diff --git a/engines/agos/sound.cpp b/engines/agos/sound.cpp index 4d60bbdbed..5558e9025a 100644 --- a/engines/agos/sound.cpp +++ b/engines/agos/sound.cpp @@ -58,7 +58,7 @@ public: BaseSound(Audio::Mixer *mixer, File *file, uint32 *offsets, bool bigEndian = false); virtual ~BaseSound(); void close(); - + void playSound(uint sound, Audio::Mixer::SoundType type, Audio::SoundHandle *handle, byte flags, int vol = 0) { playSound(sound, sound, type, handle, flags, vol); } @@ -563,7 +563,7 @@ void Sound::readSfxFile(const char *filename) { void Sound::loadSfxTable(File *gameFile, uint32 base) { stopAll(); - + if (_effects) _effects->close(); diff --git a/engines/agos/subroutine.cpp b/engines/agos/subroutine.cpp index 1d4f2e8ba6..07eb7306d8 100644 --- a/engines/agos/subroutine.cpp +++ b/engines/agos/subroutine.cpp @@ -541,7 +541,7 @@ int AGOSEngine::startSubroutine(Subroutine *sub) { error("Recursion error"); // WORKAROUND: If the game is saved, right after Simon is thrown in the dungeon of Sordid's Fortress of Doom, - // the saved game fails to load correctly. When loading the saved game, the sequence of Simon waking is started, + // the saved game fails to load correctly. When loading the saved game, the sequence of Simon waking is started, // before the scene is actually reloaded, due to a script bug. We manually add the extra script code from DOS CD // release, which fixed this particular script bug. if (getGameType() == GType_SIMON2 && !(getFeatures() & GF_TALKIE) && sub->id == 12101) { diff --git a/engines/agos/vga_s1.cpp b/engines/agos/vga_s1.cpp index b3ee374595..b1ae26437e 100644 --- a/engines/agos/vga_s1.cpp +++ b/engines/agos/vga_s1.cpp @@ -138,7 +138,7 @@ void AGOSEngine::vc22_setPaletteNew() { palptr[3] = 0; palptr += 4; - }; + }; } _paletteFlag = 2; diff --git a/engines/cine/anim.cpp b/engines/cine/anim.cpp index a0f998e02f..11ea4ea25c 100644 --- a/engines/cine/anim.cpp +++ b/engines/cine/anim.cpp @@ -585,7 +585,7 @@ int loadAni(const char *resourceName, int16 idx) { transparentColor = getAnimTransparentColor(resourceName); - // TODO: Merge this special case hack into getAnimTransparentColor somehow. + // TODO: Merge this special case hack into getAnimTransparentColor somehow. // HACK: Versions of TITRE.ANI with height 37 use color 0xF for transparency. // Versions of TITRE.ANI with height 57 use color 0x0 for transparency. // Fixes bug #2057619: FW: Glitches in title display of demo (regression). diff --git a/engines/cine/bg_list.cpp b/engines/cine/bg_list.cpp index fddca078e5..8a79bfeea1 100644 --- a/engines/cine/bg_list.cpp +++ b/engines/cine/bg_list.cpp @@ -98,7 +98,7 @@ void loadBgIncrustFromSave(Common::SeekableReadStream &fHandle) { tmp.y = fHandle.readUint16BE(); tmp.frame = fHandle.readUint16BE(); tmp.part = fHandle.readUint16BE(); - + bgIncrustList.push_back(tmp); if (tmp.param == 0) { diff --git a/engines/cine/cine.cpp b/engines/cine/cine.cpp index 3a2954f7d6..13991f0dec 100644 --- a/engines/cine/cine.cpp +++ b/engines/cine/cine.cpp @@ -98,7 +98,7 @@ Common::Error CineEngine::go() { delete renderer; delete[] collisionPage; delete g_sound; - + return Common::kNoError; } @@ -130,7 +130,7 @@ void CineEngine::initialize() { Common::set_to(zoneData.begin(), zoneData.end(), 0); // Resize zone query table to its correct size and reset all its elements - zoneQuery.resize(NUM_MAX_ZONE); + zoneQuery.resize(NUM_MAX_ZONE); Common::set_to(zoneQuery.begin(), zoneQuery.end(), 0); _timerDelayMultiplier = 12; // Set default speed diff --git a/engines/cine/detection.cpp b/engines/cine/detection.cpp index 7b4e34c645..d7351879ba 100644 --- a/engines/cine/detection.cpp +++ b/engines/cine/detection.cpp @@ -589,7 +589,7 @@ SaveStateList CineMetaEngine::listSaves(const char *target) const { if (pos < (sizeof(saveDesc) - 1)) { if (ch < 32 || in->eos()) { saveDesc[pos++] = '\0'; - } + } else if (ch >= 32) { saveDesc[pos++] = ch; } @@ -697,11 +697,11 @@ Common::Error CineEngine::saveGameState(int slot, const char *desc) { return Common::kNoError; } -bool CineEngine::canLoadGameStateCurrently() { +bool CineEngine::canLoadGameStateCurrently() { return (!disableSystemMenu && !inMenu); } -bool CineEngine::canSaveGameStateCurrently() { +bool CineEngine::canSaveGameStateCurrently() { return (allowPlayerInput && !disableSystemMenu && !inMenu); } diff --git a/engines/cine/gfx.cpp b/engines/cine/gfx.cpp index e743d4227c..d388a9e206 100644 --- a/engines/cine/gfx.cpp +++ b/engines/cine/gfx.cpp @@ -329,7 +329,7 @@ void FWRenderer::drawPlainBox(int x, int y, int width, int height, byte color) { Common::Rect screenRect(320, 200); boxRect.clip(screenRect); - // Draw the filled rectangle + // Draw the filled rectangle byte *dest = _backBuffer + boxRect.top * 320 + boxRect.left; for (int i = 0; i < boxRect.height(); i++) { memset(dest + i * 320, color, boxRect.width()); @@ -1092,7 +1092,7 @@ void OSRenderer::renderOverlay(const Common::List::iterator &it) { } _messageLen += messageTable[it->objIdx].size(); - drawMessage(messageTable[it->objIdx].c_str(), it->x, it->y, it->width, it->color); + drawMessage(messageTable[it->objIdx].c_str(), it->x, it->y, it->width, it->color); if (it->color >= 0) { // This test isn't in Future Wars's implementation waitForPlayerClick = 1; } diff --git a/engines/cine/main_loop.cpp b/engines/cine/main_loop.cpp index e88340479f..c6bca84e46 100644 --- a/engines/cine/main_loop.cpp +++ b/engines/cine/main_loop.cpp @@ -265,7 +265,7 @@ void CineEngine::mainLoop(int bootScriptIdx) { errorVar = 0; - addScriptToGlobalScripts(bootScriptIdx); + addScriptToGlobalScripts(bootScriptIdx); menuVar = 0; @@ -337,7 +337,7 @@ void CineEngine::mainLoop(int bootScriptIdx) { stopMusicAfterFadeOut(); di = executePlayerInput(); - + // Clear the zoneQuery table (Operation Stealth specific) if (g_cine->getGameType() == Cine::GType_OS) { Common::set_to(zoneQuery.begin(), zoneQuery.end(), 0); diff --git a/engines/cine/msg.cpp b/engines/cine/msg.cpp index c826db3bf3..08b16524fd 100644 --- a/engines/cine/msg.cpp +++ b/engines/cine/msg.cpp @@ -57,7 +57,7 @@ void loadMsg(char *pMsgName) { // buffer (e.g. message indexes 58-254 in BATEAU.MSG in PROCS08 in Operation Stealth). if (messageDataPos < sourceSize) { messageTable.push_back((const char *)(dataPtr + messageDataPos)); - } else { + } else { if (messageLen > 0) { // Only warn about overflowing non-empty strings warning("loadMsg(%s): message (%d. / %d) is overflowing the input buffer. Replacing it with an empty string", pMsgName, i + 1, count); } else { diff --git a/engines/cine/pal.cpp b/engines/cine/pal.cpp index c06f39fe03..78fea6b861 100644 --- a/engines/cine/pal.cpp +++ b/engines/cine/pal.cpp @@ -44,7 +44,7 @@ void loadPal(const char *fileName) { if (!palFileHandle.open(buffer)) error("loadPal(): Cannot open file %s", fileName); - uint16 palEntriesCount = palFileHandle.readUint16LE(); + uint16 palEntriesCount = palFileHandle.readUint16LE(); palFileHandle.readUint16LE(); // entry size palArray.resize(palEntriesCount); diff --git a/engines/cine/part.cpp b/engines/cine/part.cpp index 7679d9d380..2cf9a52569 100644 --- a/engines/cine/part.cpp +++ b/engines/cine/part.cpp @@ -80,7 +80,7 @@ static Common::String fixVolCnfFileName(const uint8 *src, uint len) { // so that's why we have to convert them first. There's no trailing zero in them // either and they're always of the full length 11 with padding spaces. Extension // can be always found at offset 8 onwards. - // + // // Examples of filename mappings: // "AEROPORTMSG" -> "AEROPORT.MSG" // "MITRAILLHP " -> "MITRAILL.HP" (Notice the trailing space after the extension) @@ -160,7 +160,7 @@ void CineEngine::readVolCnf() { // US Amiga release. It uses a compressed 'vol.cnf' file but still uses // file names of length 13. So we try to deduce the file name length from // the data in the 'vol.cnf' file. - int fileNameLength; + int fileNameLength; if (fileNameLenMod11 != fileNameLenMod13) { // All file name blocks' sizes were divisible by either 11 or 13, but not with both. fileNameLength = (fileNameLenMod11 ? 11 : 13); diff --git a/engines/cine/saveload.cpp b/engines/cine/saveload.cpp index 75581565e2..2917ad6d1b 100644 --- a/engines/cine/saveload.cpp +++ b/engines/cine/saveload.cpp @@ -103,7 +103,7 @@ enum CineSaveGameFormat detectSaveGameFormat(Common::SeekableReadStream &fHandle overlayEntrySize, bgIncrustEntrySize }; - + uint animEntrySize = animEntrySizeChoices[i]; // Jump over the animDataTable entries and the screen parameters int32 newPos = animDataTableStart + animEntrySize * animEntriesCount + sizeofScreenParams; @@ -128,7 +128,7 @@ enum CineSaveGameFormat detectSaveGameFormat(Common::SeekableReadStream &fHandle } fHandle.seek(newPos); } - + // If we could walk the chain successfully and // got exactly to the end of file then we've got a match. if (chainWalkSuccess && fHandle.pos() == fHandle.size()) { @@ -145,7 +145,7 @@ enum CineSaveGameFormat detectSaveGameFormat(Common::SeekableReadStream &fHandle assert(animEntrySize == oldAnimEntrySize || animEntrySize == newAnimEntrySize); if (animEntrySize == oldAnimEntrySize) { result = ANIMSIZE_23; - } else { // animEntrySize == newAnimEntrySize + } else { // animEntrySize == newAnimEntrySize // Check data and mask pointers in all of the animDataTable entries // to see whether we've got the version with the broken data and mask pointers or not. // In the broken format all data and mask pointers were always zero. @@ -484,7 +484,7 @@ bool CineEngine::loadTempSaveOS(Common::SeekableReadStream &in) { return false; } else if (hdr.version > CURRENT_OS_SAVE_VER) { warning("loadTempSaveOS: Detected newer format version. Not loading savegame"); - return false; + return false; } else if ((int)hdr.version < (int)CURRENT_OS_SAVE_VER) { warning("loadTempSaveOS: Detected older format version. Trying to load nonetheless. Things may break"); } else { // hdr.id == TEMP_OS_FORMAT_ID && hdr.version == CURRENT_OS_SAVE_VER @@ -499,7 +499,7 @@ bool CineEngine::loadTempSaveOS(Common::SeekableReadStream &in) { // Ok, so we've got a correct header for a temporary Operation Stealth savegame. // Let's start loading the plain savegame data then. - currentDisk = in.readUint16BE(); + currentDisk = in.readUint16BE(); in.read(currentPartName, 13); in.read(currentPrcName, 13); in.read(currentRelName, 13); @@ -509,7 +509,7 @@ bool CineEngine::loadTempSaveOS(Common::SeekableReadStream &in) { for (uint i = 0; i < 8; i++) { in.read(bgNames[i], 13); } - + in.read(currentCtName, 13); // Moved the loading of current procedure, relation, @@ -571,7 +571,7 @@ bool CineEngine::loadTempSaveOS(Common::SeekableReadStream &in) { // TODO: Use the loaded value (Is music playing? (Uint16BE, Boolean)). in.readUint16BE(); - renderer->_cmdY = in.readUint16BE(); + renderer->_cmdY = in.readUint16BE(); in.readUint16BE(); // Some unknown variable that seems to always be zero allowPlayerInput = in.readUint16BE(); playerCommand = in.readUint16BE(); @@ -583,7 +583,7 @@ bool CineEngine::loadTempSaveOS(Common::SeekableReadStream &in) { var2 = in.readUint16BE(); commandVar2 = in.readUint16BE(); renderer->_messageBg = in.readUint16BE(); - + // TODO: Use the loaded value (adBgVar1 (Uint16BE)). in.readUint16BE(); @@ -625,7 +625,7 @@ bool CineEngine::loadTempSaveOS(Common::SeekableReadStream &in) { // TODO: Palette handling? if (in.pos() == in.size()) { - debug(3, "loadTempSaveOS: Loaded the whole savefile."); + debug(3, "loadTempSaveOS: Loaded the whole savefile."); } else { warning("loadTempSaveOS: Loaded the savefile but didn't exhaust it completely. Something was left over"); } @@ -784,7 +784,7 @@ bool CineEngine::makeLoad(char *saveName) { // 0x2315 + (255 * 30) + (2 * 6) + (206 + 206 + 20 + 20) * 512 = ~242kB // // I think it extremely unlikely that there would be over 512 global scripts, object scripts, - // overlays and background incrusts so 256kB seems like quite a safe upper limit. + // overlays and background incrusts so 256kB seems like quite a safe upper limit. // NOTE: If the savegame format is changed then this value might have to be re-evaluated! // Hopefully devices with more limited memory can also cope with this memory allocation. saveSize = 256 * 1024; @@ -815,7 +815,7 @@ bool CineEngine::makeLoad(char *saveName) { if (load) { // Reset the engine's state resetEngine(); - + if (saveGameFormat == TEMP_OS_FORMAT) { // Load the temporary Operation Stealth savegame format result = loadTempSaveOS(*in); @@ -882,7 +882,7 @@ void CineEngine::makeSaveFW(Common::OutSaveFile &out) { void CineEngine::makeSaveOS(Common::OutSaveFile &out) { int i; - // Make a temporary Operation Stealth savegame format chunk header and save it. + // Make a temporary Operation Stealth savegame format chunk header and save it. ChunkHeader header; header.id = TEMP_OS_FORMAT_ID; header.version = CURRENT_OS_SAVE_VER; @@ -918,7 +918,7 @@ void CineEngine::makeSaveOS(Common::OutSaveFile &out) { // 0x2934: Is music playing? (Uint16BE, Boolean). out.writeUint16BE(0); - out.writeUint16BE(renderer->_cmdY); + out.writeUint16BE(renderer->_cmdY); out.writeUint16BE(0); // Some unknown variable that seems to always be zero out.writeUint16BE(allowPlayerInput); out.writeUint16BE(playerCommand); @@ -930,7 +930,7 @@ void CineEngine::makeSaveOS(Common::OutSaveFile &out) { out.writeUint16BE(var2); out.writeUint16BE(commandVar2); out.writeUint16BE(renderer->_messageBg); - + // FIXME: Save proper value for this variable, currently writing zero. // An unknown variable at 0x295E: adBgVar1 (Uint16BE). out.writeUint16BE(0); diff --git a/engines/cine/script_os.cpp b/engines/cine/script_os.cpp index e8f16ebfcc..792e75b42f 100644 --- a/engines/cine/script_os.cpp +++ b/engines/cine/script_os.cpp @@ -459,7 +459,7 @@ int FWScript::o2_modifySeqListElement() { byte e = getNextByte(); debugC(5, kCineDebugScript, "Line: %d: o2_modifySeqListElement(%d,%d,%d,%d,%d)", _line, a, b, c, d, e); - modifySeqListElement(a, 0, b, c, d, e); + modifySeqListElement(a, 0, b, c, d, e); return 0; } diff --git a/engines/cine/unpack.h b/engines/cine/unpack.h index 2355df5ee1..96d6d20158 100644 --- a/engines/cine/unpack.h +++ b/engines/cine/unpack.h @@ -76,7 +76,7 @@ private: /** * Get bits from the source stream. * @note Changes the bit position in the source stream. - * @param numBits Number of bits to read from the source stream. + * @param numBits Number of bits to read from the source stream. * @return Integer value consisting of the bits read from the source stream (In range [0, (2 ** numBits) - 1]). * @return Later the bit was read from the source, the less significant it is in the return value. */ diff --git a/engines/cine/various.cpp b/engines/cine/various.cpp index 3a826fab97..5b54bccc25 100644 --- a/engines/cine/various.cpp +++ b/engines/cine/various.cpp @@ -318,7 +318,7 @@ void CineEngine::resetEngine() { currentAdditionalBgIdx2 = 0; // TODO: Add resetting of the following variables // adBgVar1 = 0; - // adBgVar0 = 0; + // adBgVar0 = 0; // gfxFadeOutCompleted = 0; } } @@ -602,7 +602,7 @@ void makeCommandLine(void) { } } } - + if (g_cine->getGameType() == Cine::GType_OS || !(playerCommand != -1 && choiceResultTable[playerCommand] == 2)) { if (playerCommand == 2) { getMouseData(mouseUpdateStatus, &dummyU16, &x, &y); @@ -829,7 +829,7 @@ uint16 executePlayerInput(void) { renderer->setCommand(commandBuffer); isDrawCommandEnabled = 0; } - + getMouseData(mouseUpdateStatus, &mouseButton, &mouseX, &mouseY); while (mouseButton && currentEntry < 200) { @@ -870,7 +870,7 @@ uint16 executePlayerInput(void) { commandBuffer += " "; commandBuffer += objectTable[si].name; - + isDrawCommandEnabled = 1; @@ -1408,14 +1408,14 @@ uint16 addAni(uint16 param1, uint16 objIdx, const int8 *ptr, SeqListElement &ele return 1; } -/*! +/*! * Permutates the overlay list into a different order according to some logic. * \todo Check this function for correctness (Wasn't very easy to reverse engineer so there may be errors) */ void resetGfxEntityEntry(uint16 objIdx) { Common::List::iterator it, bObjsCutPoint; Common::List aReverseObjs, bObjs; - bool foundCutPoint = false; + bool foundCutPoint = false; // Go through the overlay list and partition the whole list into two categories (Type A and type B objects) for (it = overlayList.begin(); it != overlayList.end(); ++it) { @@ -1429,14 +1429,14 @@ void resetGfxEntityEntry(uint16 objIdx) { } else { objectMask = objectTable[it->objIdx].mask; } - + if (objectTable[objIdx].mask > objectMask) { // Check for B objects' cut point bObjsCutPoint = bObjs.reverse_begin(); foundCutPoint = true; } } } - + // Recreate the overlay list in a different order. overlayList.clear(); if (foundCutPoint) { @@ -1461,7 +1461,7 @@ void processSeqListElement(SeqListElement &element) { int16 var_10; int16 var_4; int16 var_2; - + // Initial interpretations for variables addressed through ptr1 (8-bit addressing): // These may be inaccurate! // 0: ? diff --git a/engines/cruise/ctp.cpp b/engines/cruise/ctp.cpp index b45b6dc866..3c81c4d561 100644 --- a/engines/cruise/ctp.cpp +++ b/engines/cruise/ctp.cpp @@ -154,7 +154,7 @@ void makeCtStruct(uint8* str, int16 table[][40], int num, int z) { a1 = a2 = (int16*)str; a2 += sizeof(int16*) / sizeof(int16) + 6; // skip header - + int16* XArray = XMIN_XMAX; int minY = *XArray++; @@ -179,7 +179,7 @@ void makeCtStruct(uint8* str, int16 table[][40], int num, int z) { adrStructPoly = (uint8*)a2; *(uint16**)a2 = (uint16*)-1; //chained list terminator - + a1+=sizeof(int16*); *a1++=num; *a1++=walkboxColor[num]; diff --git a/engines/cruise/overlay.cpp b/engines/cruise/overlay.cpp index 4d476ceaf1..5538e4cd9f 100644 --- a/engines/cruise/overlay.cpp +++ b/engines/cruise/overlay.cpp @@ -134,7 +134,7 @@ int loadOverlay(const char *scriptName) { // Skip pointers s.skip(60); - + ovlData->arrayProc = NULL; ovlData->ptr1 = NULL; ovlData->arrayObject = NULL; @@ -221,7 +221,7 @@ int loadOverlay(const char *scriptName) { if (!ovlData->arrayNameRelocGlob) { return (-2); } - + s.read(ovlData->arrayNameRelocGlob, ovlData->nameExportSize); } @@ -341,7 +341,7 @@ int loadOverlay(const char *scriptName) { ovlData->ptr1[i].var18 = s.readUint16BE(); ovlData->ptr1[i].var1A = s.readUint16BE(); } - + tempPtr = (ovlData3Struct *) ovlData->ptr1; for (i = 0; i < ovlData->numRel; i++) { @@ -400,7 +400,7 @@ int loadOverlay(const char *scriptName) { ovlData->arrayObject[i]._numStates = s.readUint16BE(); ovlData->arrayObject[i]._varTableIdx = s.readUint16BE(); ovlData->arrayObject[i]._firstStateIdx = s.readUint16BE(); - ovlData->arrayObject[i]._stateTableIdx = s.readUint16BE(); + ovlData->arrayObject[i]._stateTableIdx = s.readUint16BE(); } // allocate states for object with multiple states diff --git a/engines/dialogs.cpp b/engines/dialogs.cpp index fb634bee97..26c3ca1217 100644 --- a/engines/dialogs.cpp +++ b/engines/dialogs.cpp @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * $URL$ - * $Id$ + * $Id$ */ #include "base/version.h" @@ -87,13 +87,13 @@ MainMenuDialog::MainMenuDialog(Engine *engine) StaticTextWidget *version = new StaticTextWidget(this, "GlobalMenu.Version", gScummVMVersionDate); version->setAlign(Graphics::kTextAlignCenter); - + new GUI::ButtonWidget(this, "GlobalMenu.Resume", "Resume", kPlayCmd, 'P'); _loadButton = new GUI::ButtonWidget(this, "GlobalMenu.Load", "Load", kLoadCmd, 'L'); // TODO: setEnabled -> setVisible _loadButton->setEnabled(_engine->hasFeature(Engine::kSupportsLoadingDuringRuntime)); - + _saveButton = new GUI::ButtonWidget(this, "GlobalMenu.Save", "Save", kSaveCmd, 'S'); // TODO: setEnabled -> setVisible _saveButton->setEnabled(_engine->hasFeature(Engine::kSupportsSavingDuringRuntime)); @@ -102,7 +102,7 @@ MainMenuDialog::MainMenuDialog(Engine *engine) new GUI::ButtonWidget(this, "GlobalMenu.About", "About", kAboutCmd, 'A'); - _rtlButton = new GUI::ButtonWidget(this, "GlobalMenu.RTL", "Return to Launcher", kRTLCmd, 'R'); + _rtlButton = new GUI::ButtonWidget(this, "GlobalMenu.RTL", "Return to Launcher", kRTLCmd, 'R'); _rtlButton->setEnabled(_engine->hasFeature(Engine::kSupportsRTL)); @@ -184,7 +184,7 @@ void MainMenuDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat eventRTL.type = Common::EVENT_RTL; g_system->getEventManager()->pushEvent(eventRTL); close(); - } + } break; case kQuitCmd: { Common::Event eventQ; @@ -199,7 +199,7 @@ void MainMenuDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat } void MainMenuDialog::reflowLayout() { - if (_engine->hasFeature(Engine::kSupportsLoadingDuringRuntime)) + if (_engine->hasFeature(Engine::kSupportsLoadingDuringRuntime)) _loadButton->setEnabled(_engine->canLoadGameStateCurrently()); if (_engine->hasFeature(Engine::kSupportsSavingDuringRuntime)) _saveButton->setEnabled(_engine->canSaveGameStateCurrently()); diff --git a/engines/drascula/animation.cpp b/engines/drascula/animation.cpp index ad7fe64d0e..d8177441e5 100644 --- a/engines/drascula/animation.cpp +++ b/engines/drascula/animation.cpp @@ -152,7 +152,7 @@ void DrasculaEngine::animation_1_1() { copyBackground(0, 0, 320 - l, 0, l, 200, drawSurface3, screenSurface); copyBackground(l, 0, 0, 0, 320 - l, 200, bgSurface, screenSurface); - copyRect(interf_x[l2], interf_y[l2], 156 - l, 45, 63, 31, + copyRect(interf_x[l2], interf_y[l2], 156 - l, 45, 63, 31, drawSurface2, screenSurface); updateScreen(); p++; diff --git a/engines/drascula/converse.cpp b/engines/drascula/converse.cpp index cef1a17486..81d9c9741a 100644 --- a/engines/drascula/converse.cpp +++ b/engines/drascula/converse.cpp @@ -34,11 +34,11 @@ void DrasculaEngine::playTalkSequence(int sequence) { if (_talkSequences[i].chapter == currentChapter && _talkSequences[i].sequence == sequence) { seen = true; - + doTalkSequenceCommand(_talkSequences[i]); } else if (seen) // Stop searching down the list break; - } + } } void DrasculaEngine::doTalkSequenceCommand(TalkSequenceCommand cmd) { @@ -138,7 +138,7 @@ void DrasculaEngine::converse(int index) { error("missing data file %s", fileName); int size = _arj.size(); - int game1 = kDialogOptionUnselected, + int game1 = kDialogOptionUnselected, game2 = kDialogOptionUnselected, game3 = kDialogOptionUnselected; char phrase1[78], phrase2[78], phrase3[78], phrase4[78]; diff --git a/engines/drascula/drascula.cpp b/engines/drascula/drascula.cpp index 62a758bf9f..2016860f87 100644 --- a/engines/drascula/drascula.cpp +++ b/engines/drascula/drascula.cpp @@ -473,7 +473,7 @@ bool DrasculaEngine::runCurrentChapter() { if (menuScreen == 0 && takeObject == 1) checkObjects(); - + #ifdef _WIN32_WCE if (rightMouseButton) if (menuScreen) { @@ -502,7 +502,7 @@ bool DrasculaEngine::runCurrentChapter() { // Do not show the inventory screen in chapter 5, if the right mouse button is clicked // while the plug (object 16) is held // Fixes bug #2059621 - "DRASCULA: Plug bug" - if (rightMouseButton == 1 && menuScreen == 0 && + if (rightMouseButton == 1 && menuScreen == 0 && !(currentChapter == 5 && pickedObject == 16)) { #endif delay(100); @@ -578,7 +578,7 @@ bool DrasculaEngine::runCurrentChapter() { } else if (currentChapter == 6 && key == Common::KEYCODE_0 && roomNumber == 61) { loadPic("alcbar.alg", bgSurface, 255); } - + if (leftMouseButton != 0 || rightMouseButton != 0 || key != 0) if (currentChapter != 3) framesWithoutAction = 0; @@ -799,7 +799,7 @@ void DrasculaEngine::reduce_hare_chico(int xx1, int yy1, int xx2, int yy2, int w for (n = 0; n < newHeight; n++) { for (m = 0; m < newWidth; m++) { - copyRect((int)pixelX, (int)pixelY, xx2 + m, yy2 + n, + copyRect((int)pixelX, (int)pixelY, xx2 + m, yy2 + n, 1, 1, dir_inicio, dir_fin); pixelX += totalX; @@ -874,7 +874,7 @@ bool DrasculaEngine::loadDrasculaDat() { } ver = in.readByte(); - + if (ver != DRASCULA_DAT_VER) { snprintf(buf, 256, "File 'drascula.dat' is wrong version. Expected %d but got %d. Get it from the ScummVM website", DRASCULA_DAT_VER, ver); GUIErrorMessage(buf); diff --git a/engines/drascula/graphics.cpp b/engines/drascula/graphics.cpp index de35de5ab2..d97f95c5ef 100644 --- a/engines/drascula/graphics.cpp +++ b/engines/drascula/graphics.cpp @@ -224,7 +224,7 @@ void DrasculaEngine::print_abc(const char *said, int screenX, int screenY) { } // if } // for - copyRect(letterX, letterY, screenX, screenY, + copyRect(letterX, letterY, screenX, screenY, CHAR_WIDTH, CHAR_HEIGHT, tableSurface, screenSurface); screenX = screenX + CHAR_WIDTH; @@ -276,7 +276,7 @@ void DrasculaEngine::print_abc_opc(const char *said, int screenY, int game) { } // if } // for - copyRect(letterX, letterY, screenX, screenY, + copyRect(letterX, letterY, screenX, screenY, CHAR_WIDTH_OPC, CHAR_HEIGHT_OPC, backSurface, screenSurface); screenX = screenX + CHAR_WIDTH_OPC; @@ -516,7 +516,7 @@ int DrasculaEngine::playFrameSSN() { free(BufferSSN); waitFrameSSN(); if (FrameSSN) - mixVideo(VGA, screenSurface); + mixVideo(VGA, screenSurface); else memcpy(VGA, screenSurface, 64000); _system->copyRectToScreen((const byte *)VGA, 320, 0, 0, 320, 200); diff --git a/engines/drascula/objects.cpp b/engines/drascula/objects.cpp index c9c99aafa8..a64ee7e0cc 100644 --- a/engines/drascula/objects.cpp +++ b/engines/drascula/objects.cpp @@ -207,7 +207,7 @@ int DrasculaEngine::whichObject() { for (n = 1; n < 43; n++) { if (mouseX > _itemLocations[n].x && mouseY > _itemLocations[n].y && - mouseX < _itemLocations[n].x + OBJWIDTH && + mouseX < _itemLocations[n].x + OBJWIDTH && mouseY < _itemLocations[n].y + OBJHEIGHT) break; } diff --git a/engines/drascula/rooms.cpp b/engines/drascula/rooms.cpp index 027685f56a..7aa4af059d 100644 --- a/engines/drascula/rooms.cpp +++ b/engines/drascula/rooms.cpp @@ -1060,7 +1060,7 @@ void DrasculaEngine::updateRefresh() { // Check generic updaters for (int i = 0; i < _roomUpdatesSize; i++) { if (_roomUpdates[i].roomNum == roomNumber) { - if (_roomUpdates[i].flag < 0 || + if (_roomUpdates[i].flag < 0 || flags[_roomUpdates[i].flag] == _roomUpdates[i].flagValue) { if (_roomUpdates[i].type == 0) { copyBackground(_roomUpdates[i].sourceX, _roomUpdates[i].sourceY, @@ -1174,7 +1174,7 @@ void DrasculaEngine::update_2() { h = 22; } - copyRect(batX[actorFrames[kFrameBat]], batY[actorFrames[kFrameBat]], + copyRect(batX[actorFrames[kFrameBat]], batY[actorFrames[kFrameBat]], 239, 19, w, h, drawSurface3, screenSurface); difference = getTime() - savedTime; if (difference >= 6) { @@ -1214,7 +1214,7 @@ void DrasculaEngine::update_9_pre() { int blindY[] = {51, 51, 51, 51, 51, 51, 51, 127, 127}; int difference; - copyRect(blindX[actorFrames[kFrameBlind]], blindY[actorFrames[kFrameBlind]], + copyRect(blindX[actorFrames[kFrameBlind]], blindY[actorFrames[kFrameBlind]], 122, 57, 41, 72, drawSurface3, screenSurface); if (flags[9] == 0) { difference = getTime() - savedTime; @@ -1299,7 +1299,7 @@ void DrasculaEngine::update_18_pre() { if (flags[21] == 0) { copyBackground(1, 69, 120, 58, 56, 61, drawSurface3, screenSurface); - copyBackground(snore_x[actorFrames[kFrameSnore]], + copyBackground(snore_x[actorFrames[kFrameSnore]], snore_y[actorFrames[kFrameSnore]], 124, 59, 40, 37, drawSurface3, screenSurface); } else @@ -1877,7 +1877,7 @@ bool DrasculaEngine::exitRoom(int l) { int roomNum = 0; // Player can't exit the inn in chapter 1 - if (currentChapter == 1 && objectNum[l] == 104) { + if (currentChapter == 1 && objectNum[l] == 104) { return false; } @@ -1887,7 +1887,7 @@ bool DrasculaEngine::exitRoom(int l) { } updateDoor(l); - if (isDoor[l] != 0 && + if (isDoor[l] != 0 && ((currentChapter != 3 && currentChapter != 5) || visible[l] == 1)) { hideCursor(); @@ -1918,7 +1918,7 @@ bool DrasculaEngine::exitRoom(int l) { if (objectNum[l] == 173) { animation_35_2(); return true; - } + } if (objectNum[l] == 146 && flags[39] == 1) { flags[5] = 1; flags[11] = 1; @@ -1966,7 +1966,7 @@ void DrasculaEngine::updateDoor(int doorNum) { return; for (int i = 0; i < ARRAYSIZE(doors); i++) { - if (doors[i].chapter == currentChapter && + if (doors[i].chapter == currentChapter && objectNum[doorNum] == doors[i].doorNum) { isDoor[doorNum] = flags[doors[i].flag]; return; diff --git a/engines/drascula/talk.cpp b/engines/drascula/talk.cpp index 4ecc3e20f2..8fc52a18b5 100644 --- a/engines/drascula/talk.cpp +++ b/engines/drascula/talk.cpp @@ -75,7 +75,7 @@ void DrasculaEngine::talk_igor(int index, int talkerType) { copyBackground(); updateRefresh_pre(); } - + if (talkerType == kIgorDch) { placeIgor(); placeDrascula(); @@ -119,7 +119,7 @@ void DrasculaEngine::talk_igor(int index, int talkerType) { } } while (!isTalkFinished()); - if ((talkerType == kIgorFront && currentChapter == 6) || + if ((talkerType == kIgorFront && currentChapter == 6) || talkerType == kIgorDoor || talkerType == kIgorSeated || talkerType == kIgorWig) { updateRoom(); } @@ -776,7 +776,7 @@ void DrasculaEngine::talk_htel(int index) { copyBackground(x_talk[face], 1, 45, 24, 92, 108, frontSurface, screenSurface); else copyBackground(x_talk[face], 1, 45, 24, 92, 108, backSurface, screenSurface); - + if (!_subtitlesDisabled) centerText(said, 90, 50); @@ -912,7 +912,7 @@ void DrasculaEngine::talk_generic(const char* said, const char* filename, int* f copyBackground(); updateRefresh_pre(); - copyBackground(faces[face], coords[0], coords[1], coords[2], + copyBackground(faces[face], coords[0], coords[1], coords[2], coords[3], coords[4], surface, screenSurface); moveCharacters(); updateRefresh(); diff --git a/engines/engine.cpp b/engines/engine.cpp index 7831651a02..c0de2df66e 100644 --- a/engines/engine.cpp +++ b/engines/engine.cpp @@ -76,7 +76,7 @@ Engine::Engine(OSystem *syst) Engine::~Engine() { _mixer->stopAll(); - + delete _mainMenuDialog; g_engine = NULL; } @@ -156,9 +156,9 @@ void initGraphics(int width, int height, bool defaultTo1xScaler) { message += "'."; GUI::MessageDialog dialog(message); - dialog.runModal(); + dialog.runModal(); } - + if (gfxError & OSystem::kTransactionAspectRatioFailed) { GUI::MessageDialog dialog("Could not apply aspect ratio setting."); dialog.runModal(); diff --git a/engines/engine.h b/engines/engine.h index 0a84a122da..ac001de756 100644 --- a/engines/engine.h +++ b/engines/engine.h @@ -76,12 +76,12 @@ protected: Common::TimerManager *_timer; Common::EventManager *_eventMan; Common::SaveFileManager *_saveFileMan; - + GUI::Dialog *_mainMenuDialog; virtual int runDialog(GUI::Dialog &dialog); const Common::String _targetName; // target name for saves - + const Common::FSNode _gameDataDir; // FIXME: Get rid of this private: @@ -108,8 +108,8 @@ public: * the result of the Engine::shouldQuit() method appropriately). */ kSupportsRTL, - - /** + + /** * Loading savestates during runtime is supported, that is, this engine * implements loadGameState() and canLoadGameStateCurrently(). * If this feature is supported, then the corresponding MetaEngine *must* @@ -117,7 +117,7 @@ public: */ kSupportsLoadingDuringRuntime, - /** + /** * Loading savestates during runtime is supported, that is, this engine * implements saveGameState() and canSaveGameStateCurrently(). * If this feature is supported, then the corresponding MetaEngine *must* @@ -166,7 +166,7 @@ public: * Determine whether the engine supports the specified feature. */ virtual bool hasFeature(EngineFeature f) const { return false; } - + // virtual EnginePlugin *getMetaEnginePlugin() const; /** @@ -177,7 +177,7 @@ public: */ virtual void syncSoundSettings(); - /** + /** * Load a game state. * @param slot the slot from which a savestate should be loaded * @return returns kNoError on success, else an error code. diff --git a/engines/game.cpp b/engines/game.cpp index 3e6cdc2e79..c8cfcc663b 100644 --- a/engines/game.cpp +++ b/engines/game.cpp @@ -98,11 +98,11 @@ bool SaveStateDescriptor::getBool(const Common::String &key) const { if (contains(key)) { Common::String value = getVal(key); if (value.equalsIgnoreCase("true") || - value.equalsIgnoreCase("yes") || + value.equalsIgnoreCase("yes") || value.equals("1")) return true; if (value.equalsIgnoreCase("false") || - value.equalsIgnoreCase("no") || + value.equalsIgnoreCase("no") || value.equals("0")) return false; error("SaveStateDescriptor: %s '%s' has unknown value '%s' for boolean '%s'", diff --git a/engines/game.h b/engines/game.h index 21bfbce0f5..6c73941577 100644 --- a/engines/game.h +++ b/engines/game.h @@ -80,7 +80,7 @@ public: const Common::String &description() const { return getVal("description"); } Common::Language language() const { return contains("language") ? Common::parseLanguage(getVal("language")) : Common::UNK_LANG; } Common::Platform platform() const { return contains("platform") ? Common::parsePlatform(getVal("platform")) : Common::kPlatformUnknown; } - + const Common::String &preferredtarget() const { return contains("preferredtarget") ? getVal("preferredtarget") : getVal("gameid"); } @@ -169,7 +169,7 @@ public: * ratio of the game. If another ratio is required, contact the core team. */ const Graphics::Surface *getThumbnail() const { return _thumbnail.get(); } - + /** * Set a thumbnail graphics surface representing the savestate visually. * Ownership of the surface is transferred to the SaveStateDescriptor. diff --git a/engines/gob/coktelvideo.cpp b/engines/gob/coktelvideo.cpp index 9803dba6eb..9d0ca76f87 100644 --- a/engines/gob/coktelvideo.cpp +++ b/engines/gob/coktelvideo.cpp @@ -127,7 +127,7 @@ bool Imd::load(Common::SeekableReadStream &stream) { return false; } - _soundSliceLength = (uint32) (((double) (1000 << 16)) / + _soundSliceLength = (uint32) (((double) (1000 << 16)) / ((double) _soundFreq / (double) _soundSliceSize)); _frameLength = _soundSliceLength >> 16; @@ -1027,7 +1027,7 @@ bool Vmd::load(Common::SeekableReadStream &stream) { _soundSliceSize = -_soundSliceSize; } - _soundSliceLength = (uint32) (((double) (1000 << 16)) / + _soundSliceLength = (uint32) (((double) (1000 << 16)) / ((double) _soundFreq / (double) _soundSliceSize)); _frameLength = _soundSliceLength >> 16; @@ -1116,7 +1116,7 @@ bool Vmd::load(Common::SeekableReadStream &stream) { if ((((uint32) data.realSize) >= ssize) || (data.name[0] == 0)) continue; - + _extraData.push_back(data); } else diff --git a/engines/gob/driver_vga.cpp b/engines/gob/driver_vga.cpp index e9830cf197..b182700dba 100644 --- a/engines/gob/driver_vga.cpp +++ b/engines/gob/driver_vga.cpp @@ -90,7 +90,7 @@ void VGAVideoDriver::drawLetter(unsigned char item, int16 x, int16 y, int width = fontDesc->itemWidth; for (int k = 0; k < nWidth; k++) { - + data = *src++; for (int j = 0; j < MIN(8, width); j++) { if (data & 0x80) @@ -128,7 +128,7 @@ void VGAVideoDriver::drawSprite(SurfaceDesc *source, SurfaceDesc *dest, byte *destPos = dest->getVidMem() + (y * dest->getWidth()) + x; uint32 size = width * height; - + if (transp) { while (height--) { diff --git a/engines/gob/game_v6.cpp b/engines/gob/game_v6.cpp index 2e2813d712..739531d899 100644 --- a/engines/gob/game_v6.cpp +++ b/engines/gob/game_v6.cpp @@ -161,7 +161,7 @@ void Game_v6::prepareStart(void) { if (Common::File::exists("cd1.itk") && Common::File::exists("cd2.itk") && Common::File::exists("cd3.itk") && Common::File::exists("cd4.itk")) { _noCd = true; - } + } Game_v2::prepareStart(); } @@ -344,7 +344,7 @@ int16 Game_v6::checkCollisions(byte handleMouse, int16 deltaTime, int16 *pResId, _lastCollKey = checkMousePoint(1, &_lastCollId, &_lastCollAreaIndex); if ((_lastCollKey != 0) && (_lastCollId & 0x8000)) collAreaSub(_lastCollAreaIndex, 1); - } else + } else sub_1BA78(); } @@ -356,7 +356,7 @@ int16 Game_v6::checkCollisions(byte handleMouse, int16 deltaTime, int16 *pResId, *pResIndex = 0; return 0; - + } else if (handleMouse != 0) _vm->_draw->animateCursor(-1); diff --git a/engines/gob/goblin_v4.cpp b/engines/gob/goblin_v4.cpp index 1df5aab606..057e598727 100644 --- a/engines/gob/goblin_v4.cpp +++ b/engines/gob/goblin_v4.cpp @@ -615,19 +615,19 @@ int16 Goblin_v4::sub_20430(int16 state, uint16 dir) { case Map::kDirN: cx = 2; break; - + case Map::kDirNE: cx = 3; break; - + case Map::kDirW: cx = 0; break; - + case Map::kDirE: cx = 4; break; - + case Map::kDirSW: cx = 7; break; diff --git a/engines/gob/indeo3.h b/engines/gob/indeo3.h index f30b47806a..339581e2ea 100644 --- a/engines/gob/indeo3.h +++ b/engines/gob/indeo3.h @@ -75,7 +75,7 @@ private: uint16 y_w, y_h; uint16 uv_w, uv_h; }; - + int16 _width; int16 _height; YUVBufs _iv_frame[2]; diff --git a/engines/gob/mult_v2.cpp b/engines/gob/mult_v2.cpp index 6bd4ddb625..ffdcb5b1c3 100644 --- a/engines/gob/mult_v2.cpp +++ b/engines/gob/mult_v2.cpp @@ -517,7 +517,7 @@ void Mult_v2::playMultInit() { } delete[] _objects; - + _vm->_util->setFrameRate(_multData->frameRate); _animTop = 0; _animLeft = 0; @@ -762,7 +762,7 @@ void Mult_v2::newCycleAnim(Mult_Object &animObj) { _vm->_vidPlayer->slotClose(animObj.videoSlot - 1); animObj.videoSlot = 0; } - + break; case 6: diff --git a/engines/gob/saveload.cpp b/engines/gob/saveload.cpp index 3d711ed0b5..e45ea661b7 100644 --- a/engines/gob/saveload.cpp +++ b/engines/gob/saveload.cpp @@ -313,7 +313,7 @@ uint32 StagedSave::getSize() const { else size += _stages[i].size; } - + return size; } diff --git a/engines/gob/saveload.h b/engines/gob/saveload.h index c00351e555..c14b4f2680 100644 --- a/engines/gob/saveload.h +++ b/engines/gob/saveload.h @@ -51,7 +51,7 @@ public: bool toBuffer(byte *buffer, int32 size, bool palette) const; bool fromBuffer(const byte *buffer, int32 size, bool palette); - + private: byte *_sprite; int16 _width; diff --git a/engines/gob/saveload_v2.cpp b/engines/gob/saveload_v2.cpp index fc11950368..69bda7de31 100644 --- a/engines/gob/saveload_v2.cpp +++ b/engines/gob/saveload_v2.cpp @@ -223,7 +223,7 @@ bool SaveLoad_v2::loadGame(SaveFile &saveFile, int slot = getSlot(offset); int slotRem = getSlotRemainder(offset); - debugC(2, kDebugSaveLoad, "Loading from slot %d", slot); + debugC(2, kDebugSaveLoad, "Loading from slot %d", slot); SaveLoad::setCurrentSlot(saveFile.destName, slot); diff --git a/engines/gob/saveload_v3.cpp b/engines/gob/saveload_v3.cpp index dab5fd9385..265f8a2c62 100644 --- a/engines/gob/saveload_v3.cpp +++ b/engines/gob/saveload_v3.cpp @@ -308,7 +308,7 @@ bool SaveLoad_v3::loadGame(SaveFile &saveFile, saveFile.slot = getSlot(offset); int slotRem = getSlotRemainder(offset); - debugC(2, kDebugSaveLoad, "Loading from slot %d", saveFile.slot); + debugC(2, kDebugSaveLoad, "Loading from slot %d", saveFile.slot); SaveLoad::setCurrentSlot(saveFile.destName, saveFile.slot); @@ -569,7 +569,7 @@ bool SaveLoad_v3::saveScreenshot(SaveFile &saveFile, if (!_screenshot.savePalette(_vm->_global->_pPaletteDesc->vgaPal)) return false; - + byte *buffer = new byte[_screenshotSize]; if (!_screenshot.toBuffer(buffer, _screenshotSize, palette)) { diff --git a/engines/gob/saveload_v4.cpp b/engines/gob/saveload_v4.cpp index 0bd3dc03e6..28a2a61604 100644 --- a/engines/gob/saveload_v4.cpp +++ b/engines/gob/saveload_v4.cpp @@ -291,7 +291,7 @@ bool SaveLoad_v4::loadGame(SaveFile &saveFile, int slot = getSlot(offset); int slotRem = getSlotRemainder(offset); - debugC(2, kDebugSaveLoad, "Loading from slot %d", slot); + debugC(2, kDebugSaveLoad, "Loading from slot %d", slot); SaveLoad::setCurrentSlot(saveFile.destName, slot); diff --git a/engines/gob/saveload_v6.cpp b/engines/gob/saveload_v6.cpp index 7396642e33..408b9fa6bd 100644 --- a/engines/gob/saveload_v6.cpp +++ b/engines/gob/saveload_v6.cpp @@ -190,7 +190,7 @@ bool SaveLoad_v6::loadGame(SaveFile &saveFile, int slot = getSlot(offset); int slotRem = getSlotRemainder(offset); - debugC(2, kDebugSaveLoad, "Loading from slot %d", slot); + debugC(2, kDebugSaveLoad, "Loading from slot %d", slot); if ((slot >= 60) || (slotRem != 0)) { warning("Invalid loading procedure (%d, %d, %d, %d, %d)", diff --git a/engines/gob/sound/soundblaster.cpp b/engines/gob/sound/soundblaster.cpp index eeedfaa3cb..23eea90688 100644 --- a/engines/gob/sound/soundblaster.cpp +++ b/engines/gob/sound/soundblaster.cpp @@ -88,7 +88,7 @@ void SoundBlaster::playComposition(int16 *composition, int16 freqVal, SoundDesc *sndDescs, int8 sndCount) { _compositionSamples = sndDescs; - _compositionSampleCount = sndCount; + _compositionSampleCount = sndCount; int i = -1; do { diff --git a/engines/gob/util.cpp b/engines/gob/util.cpp index e535505a87..58430f0d41 100644 --- a/engines/gob/util.cpp +++ b/engines/gob/util.cpp @@ -334,12 +334,12 @@ void Util::setScrollOffset(int16 x, int16 y) { processInput(); if (x >= 0) - _vm->_video->_scrollOffsetX = x; + _vm->_video->_scrollOffsetX = x; else _vm->_video->_scrollOffsetX = _vm->_draw->_scrollOffsetX; if (y >= 0) - _vm->_video->_scrollOffsetY = y; + _vm->_video->_scrollOffsetY = y; else _vm->_video->_scrollOffsetY = _vm->_draw->_scrollOffsetY; diff --git a/engines/gob/video_v6.cpp b/engines/gob/video_v6.cpp index b3db7702aa..6cfe7be819 100644 --- a/engines/gob/video_v6.cpp +++ b/engines/gob/video_v6.cpp @@ -284,7 +284,7 @@ void Video_v6::drawYUV(SurfaceDesc *destDesc, int16 x, int16 y, } delete dither; -} +} const byte Video_v6::_ditherPalette[768] = { 0x00,0x80,0x80,0x26,0x6B,0xC0,0x4B,0x56,0x4B,0x71,0x41,0x8B, diff --git a/engines/gob/videoplayer.cpp b/engines/gob/videoplayer.cpp index ef9d663b6f..9f07b550be 100644 --- a/engines/gob/videoplayer.cpp +++ b/engines/gob/videoplayer.cpp @@ -398,7 +398,7 @@ int VideoPlayer::getNextFreeSlot() { if (slot == _videoSlots.size()) _videoSlots.push_back(0); - + return slot; } diff --git a/engines/groovie/cell.cpp b/engines/groovie/cell.cpp index c1ddedff9d..a6954c3921 100644 --- a/engines/groovie/cell.cpp +++ b/engines/groovie/cell.cpp @@ -50,7 +50,7 @@ int8 CellGame::calcMove(byte *origboard, uint8 color, uint8 depth) { if (0 == depth) { return 0; } - + for (i = 0; BOARDSIZE > i; i++) { // For every square on the board for (j = 0; BOARDSIZE > j; j++) { // if (color == *(origboard + i + (BOARDSIZE * j))) { // If the square is the desired colour @@ -62,7 +62,7 @@ int8 CellGame::calcMove(byte *origboard, uint8 color, uint8 depth) { int8 nextlevel; debugC(5, kGroovieDebugCell | kGroovieDebugAll, "Depth: %d: Valid move %d, %d-> %d, %d", depth, i, j, i+di, j+dj); execMove (newboard, color, i, j, i+di, j+dj); - + nextlevel = calcMove (newboard, oppColor, depth - 1); debugC(5, kGroovieDebugCell | kGroovieDebugAll, "Depth: %d: Next level down returned %d", depth, nextlevel); currDiff = countBoard(newboard, color) - origBoardCount - nextlevel; @@ -84,7 +84,7 @@ int8 CellGame::calcMove(byte *origboard, uint8 color, uint8 depth) { } } } - + _startX = bestStartX; _startY = bestStartY; _endX = bestEndX; @@ -161,7 +161,7 @@ byte CellGame::getStartY() { byte CellGame::getEndX() { if (_endX > BOARDSIZE) { warning ("CellGame::getEndX: not calculated yet!"); - return 1; + return 1; } else { return _endX; } diff --git a/engines/groovie/detection.cpp b/engines/groovie/detection.cpp index 4052149ed2..fef63c3c74 100644 --- a/engines/groovie/detection.cpp +++ b/engines/groovie/detection.cpp @@ -54,7 +54,7 @@ static const PlainGameDescriptor groovieGames[] = { static const GroovieGameDescription gameDescriptions[] = { // The 7th Guest DOS English - { + { { "t7g", "", AD_ENTRY1s("script.grv", "d1b8033b40aa67c076039881eccce90d", 16659), @@ -74,7 +74,7 @@ static const GroovieGameDescription gameDescriptions[] = { }, // The 7th Guest DOS Russian (Akella) - { + { { "t7g", "", { @@ -89,7 +89,7 @@ static const GroovieGameDescription gameDescriptions[] = { #ifdef GROOVIE_EXPERIMENTAL // The 11th Hour DOS English - { + { { "11h", "", AD_ENTRY1s("disk.1", "5c0428cd3659fc7bbcd0aa16485ed5da", 227), @@ -97,7 +97,7 @@ static const GroovieGameDescription gameDescriptions[] = { }, kGroovieV2, 1 }, - + // The 11th Hour DOS Demo English { { @@ -109,7 +109,7 @@ static const GroovieGameDescription gameDescriptions[] = { }, // The Making of The 11th Hour DOS English - { + { { "making11h", "", AD_ENTRY1s("disk.1", "5c0428cd3659fc7bbcd0aa16485ed5da", 227), @@ -119,7 +119,7 @@ static const GroovieGameDescription gameDescriptions[] = { }, // Clandestiny Trailer DOS English - { + { { "clantrailer", "", AD_ENTRY1s("disk.1", "5c0428cd3659fc7bbcd0aa16485ed5da", 227), @@ -129,7 +129,7 @@ static const GroovieGameDescription gameDescriptions[] = { }, // Clandestiny DOS English - { + { { "clandestiny", "", AD_ENTRY1s("disk.1", "f79fc1515174540fef6a34132efc4c53", 76), @@ -139,7 +139,7 @@ static const GroovieGameDescription gameDescriptions[] = { }, // Uncle Henry's Playhouse PC English - { + { { "unclehenry", "", AD_ENTRY1s("disk.1", "0e1b1d3cecc4fc7efa62a968844d1f7a", 72), @@ -149,7 +149,7 @@ static const GroovieGameDescription gameDescriptions[] = { }, // Tender Loving Care PC English - { + { { "tlc", "", AD_ENTRY1s("disk.1", "32a1afa68478f1f9d2b25eeea427f2e3", 84), diff --git a/engines/groovie/font.cpp b/engines/groovie/font.cpp index 6b77984469..e7365fcfa5 100644 --- a/engines/groovie/font.cpp +++ b/engines/groovie/font.cpp @@ -56,7 +56,7 @@ void Font::printstring(char *messagein) { Common::Rect topbar(640, 80); Graphics::Surface *gamescreen; gamescreen = _syst->lockScreen(); - gamescreen->fillRect(topbar, 0); + gamescreen->fillRect(topbar, 0); _syst->unlockScreen(); for (i = 0; i < 14; i++) { @@ -121,7 +121,7 @@ uint8 Font::printletter(char letter, uint16 xoffset) { _sphinxfnt->read(data, width * height); _syst->copyRectToScreen(data, width, xoffset, 16, width, height); delete[] data; - + return width; } diff --git a/engines/groovie/groovie.cpp b/engines/groovie/groovie.cpp index bbae45da3a..554ae792de 100644 --- a/engines/groovie/groovie.cpp +++ b/engines/groovie/groovie.cpp @@ -136,7 +136,7 @@ Common::Error GroovieEngine::init() { return Common::kUnknownError; } } - + // Check the script file extension if (!filename.hasSuffix(".grv")) { error("%s isn't a valid script filename", filename.c_str()); @@ -162,7 +162,7 @@ Common::Error GroovieEngine::init() { Common::Error GroovieEngine::go() { // Check that the game files and the audio tracks aren't together run from // the same cd - + checkCD(); // Game timer counter @@ -224,7 +224,7 @@ Common::Error GroovieEngine::go() { _cursorMan->animate(); _system->updateScreen(); tmr++; - // Wait a little bit between increments. While mouse is moving, this triggers + // Wait a little bit between increments. While mouse is moving, this triggers // only negligably slower. if (tmr > 4) { _script.timerTick(); @@ -280,4 +280,4 @@ void GroovieEngine::waitForInput() { _waitingForInput = true; } -} // End of namespace Groovie +} // End of namespace Groovie diff --git a/engines/groovie/module.mk b/engines/groovie/module.mk index 4a5d79cfb8..d4216d3437 100644 --- a/engines/groovie/module.mk +++ b/engines/groovie/module.mk @@ -21,5 +21,5 @@ ifeq ($(ENABLE_GROOVIE), DYNAMIC_PLUGIN) PLUGIN := 1 endif -# Include common rules +# Include common rules include $(srcdir)/rules.mk diff --git a/engines/groovie/roq.cpp b/engines/groovie/roq.cpp index 589251da31..0acf035b14 100644 --- a/engines/groovie/roq.cpp +++ b/engines/groovie/roq.cpp @@ -225,7 +225,7 @@ bool ROQPlayer::processBlockQuadVector(ROQBlockHeader &blockHeader) { // Upsample the 4x4 pixel block break; } - case 3: // CCC: + case 3: // CCC: //printf("coding type 3:\n"); processBlockQuadVectorSub(blockHeader); break; diff --git a/engines/groovie/script.cpp b/engines/groovie/script.cpp index 0799ea913d..0f70bb36ca 100644 --- a/engines/groovie/script.cpp +++ b/engines/groovie/script.cpp @@ -139,7 +139,7 @@ bool Script::loadScript(Common::String filename) { _code[0x03C2] = 0x38; } else if (filename.equals("maze.grv")) { // GRAPHICS ENHANCEMENT - Leave a skeleton in the maze. - // Replaces one normal T intersection with the unused(?) + // Replaces one normal T intersection with the unused(?) // skeleton T intersection graphics. assert(_codeSize == 3652); @@ -147,7 +147,7 @@ bool Script::loadScript(Common::String filename) { _code[0x0769] = 0x46; _code[0x0774] = 0x3E; _code[0x077A] = 0x42; - + // T with branch on right _code[0x08E2] = 0x43; _code[0x08D7] = 0x44; @@ -380,7 +380,7 @@ void Script::savegame(uint slot) { for (int i = 0; i < 15; i++) { newchar = _variables[i] + 0x30; if ((newchar < 0x30 || newchar > 0x39) && (newchar < 0x41 || newchar > 0x7A)) { - save[i] = '\0'; + save[i] = '\0'; break; } else { save[i] = newchar; @@ -478,7 +478,7 @@ void Script::o_videofromref() { // 0x09 debugScript(1, true, "Use external file if available"); } break; - + case 0x400D: // floating objects in music room case 0x5060: // a sound from gamwav? case 0x5098: // a sound from gamwav? @@ -723,7 +723,7 @@ void Script::o_random() { void Script::o_jmp() { uint16 address = readScript16bits(); - + debugScript(1, true, "JMP @0x%04X", address); // Set the current address @@ -732,7 +732,7 @@ void Script::o_jmp() { void Script::o_loadstring() { uint16 varnum = readScript8or16bits(); - + debugScript(1, false, "LOADSTRING var[0x%04X..] =", varnum); do { setVariable(varnum++, readScriptChar(true, true, true)); @@ -743,7 +743,7 @@ void Script::o_loadstring() { void Script::o_ret() { uint8 val = readScript8bits(); - + debugScript(1, true, "RET %d", val); // Set the return value @@ -760,7 +760,7 @@ void Script::o_ret() { void Script::o_call() { uint16 address = readScript16bits(); - + debugScript(1, true, "CALL @0x%04X", address); // Save return address in the call stack @@ -773,7 +773,7 @@ void Script::o_call() { void Script::o_sleep() { uint16 time = readScript16bits(); - + debugScript(1, true, "SLEEP 0x%04X", time); _vm->_system->delayMillis(time * 3); @@ -852,7 +852,7 @@ void Script::o_vdxtransition() { // 0x1C void Script::o_swap() { uint16 varnum1 = readScript8or16bits(); uint16 varnum2 = readScript16bits(); - + debugScript(1, true, "SWAP var[0x%04X] <-> var[0x%04X]", varnum1, varnum2); uint8 tmp = _variables[varnum1]; @@ -862,7 +862,7 @@ void Script::o_swap() { void Script::o_inc() { uint16 varnum = readScript8or16bits(); - + debugScript(1, true, "INC var[0x%04X]", varnum); setVariable(varnum, _variables[varnum] + 1); @@ -870,7 +870,7 @@ void Script::o_inc() { void Script::o_dec() { uint16 varnum = readScript8or16bits(); - + debugScript(1, true, "DEC var[0x%04X]", varnum); setVariable(varnum, _variables[varnum] - 1); @@ -878,7 +878,7 @@ void Script::o_dec() { void Script::o_strcmpnejmp_var() { // 0x21 uint16 data = readScriptVar(); - + if (data > 9) { data -= 7; } @@ -887,7 +887,7 @@ void Script::o_strcmpnejmp_var() { // 0x21 do { if (_variables[data++] != readScriptChar(true, true, true)) { stringsmatch = 0; - } + } } while (!(getCodeByte(_currentInstruction - 1) & 0x80)); uint16 offset = readScript16bits(); @@ -905,7 +905,7 @@ void Script::o_strcmpeqjmp() { // 0x23 uint16 varnum = readScript8or16bits(); uint8 val; uint8 result = 1; - + debugScript(1, false, "STRCMP-EQJMP: var[0x%04X..],", varnum); do { val = readScriptChar(true, true, true); @@ -938,7 +938,7 @@ void Script::o_mov() { void Script::o_add() { uint16 varnum1 = readScript8or16bits(); uint16 varnum2 = readScript16bits(); - + debugScript(1, true, "ADD var[0x%04X] += var[0x%04X]", varnum1, varnum2); setVariable(varnum1, _variables[varnum1] + _variables[varnum2]); @@ -996,7 +996,7 @@ void Script::o_endscript() { void Script::o_sethotspottop() { uint16 address = readScript16bits(); uint8 cursor = readScript8bits(); - + debugScript(5, true, "SETHOTSPOTTOP @0x%04X cursor=%d", address, cursor); _hotspotTopAction = address; @@ -1006,7 +1006,7 @@ void Script::o_sethotspottop() { void Script::o_sethotspotbottom() { uint16 address = readScript16bits(); uint8 cursor = readScript8bits(); - + debugScript(5, true, "SETHOTSPOTBOTTOM @0x%04X cursor=%d", address, cursor); _hotspotBottomAction = address; @@ -1016,7 +1016,7 @@ void Script::o_sethotspotbottom() { void Script::o_loadgame() { uint16 varnum = readScript8or16bits(); uint8 slot = _variables[varnum]; - + debugScript(1, true, "LOADGAME var[0x%04X] -> slot=%d (TODO)", varnum, slot); loadgame(slot); @@ -1026,7 +1026,7 @@ void Script::o_loadgame() { void Script::o_savegame() { uint16 varnum = readScript8or16bits(); uint8 slot = _variables[varnum]; - + debugScript(1, true, "SAVEGAME var[0x%04X] -> slot=%d (TODO)", varnum, slot); savegame(slot); @@ -1034,7 +1034,7 @@ void Script::o_savegame() { void Script::o_hotspotbottom_4() { //0x30 uint16 address = readScript16bits(); - + debugScript(5, true, "HOTSPOT-BOTTOM @0x%04X", address); // Mark the 80 pixels under the game area @@ -1045,7 +1045,7 @@ void Script::o_hotspotbottom_4() { //0x30 void Script::o_midivolume() { uint16 arg1 = readScript16bits(); uint16 arg2 = readScript16bits(); - + debugScript(1, true, "MIDI volume: %d %d", arg1, arg2); _vm->_musicPlayer->setGameVolume(arg1, arg2); } @@ -1054,7 +1054,7 @@ void Script::o_jne() { int16 varnum1 = readScript8or16bits(); uint16 varnum2 = readScript16bits(); uint16 address = readScript16bits(); - + debugScript(1, false, "JNE: var[var[0x%04X] - 0x31] != var[0x%04X] @0x%04X", varnum1, varnum2, address); if (_variables[_variables[varnum1] - 0x31] != _variables[varnum2]) { @@ -1067,7 +1067,7 @@ void Script::o_jne() { void Script::o_loadstringvar() { uint16 varnum = readScript8or16bits(); - + varnum = _variables[varnum] - 0x31; debugScript(1, false, "LOADSTRINGVAR var[0x%04X..] =", varnum); do { @@ -1239,7 +1239,7 @@ void Script::o_hotspot_slot() { Graphics::Surface *gamescreen; gamescreen = _vm->_system->lockScreen(); - gamescreen->fillRect(topbar, 0); + gamescreen->fillRect(topbar, 0); _vm->_system->unlockScreen(); @@ -1288,7 +1288,7 @@ void Script::o_checkvalidsaves() { for (i = 0; i < 15; i++) { file->read(&temp, 1); savename[i] = temp + 0x30; - } + } delete file; } else { @@ -1359,7 +1359,7 @@ void Script::o_setvideoorigin() { // Read the two offset arguments int16 origX = readScript16bits(); int16 origY = readScript16bits(); - + // Set bitflag 7 _bitflags |= 1 << 7; @@ -1403,8 +1403,8 @@ void Script::o_cellmove() { startY = staufsMove.getStartY(); endX = staufsMove.getEndX(); endY = staufsMove.getEndY(); - - + + // Set the movement origin setVariable(0, startY); // y setVariable(1, startX); // x @@ -1491,7 +1491,7 @@ void Script::o_getcd() { void Script::o_playcd() { uint8 val = readScript8bits(); - + debugScript(1, true, "PLAYCD %d", val); if (val == 2) { @@ -1507,7 +1507,7 @@ void Script::o_hotspot_outrect() { uint16 right = readScript16bits(); uint16 bottom = readScript16bits(); uint16 address = readScript16bits(); - + debugScript(1, true, "HOTSPOT-OUTRECT(%d,%d,%d,%d) @0x%04X (TODO)", left, top, right, bottom, address); // Test if the current mouse position is outside the specified rectangle @@ -1525,20 +1525,20 @@ void Script::o_stub56() { uint32 val1 = readScript32bits(); uint8 val2 = readScript8bits(); uint8 val3 = readScript8bits(); - + debugScript(1, true, "STUB56: 0x%08X 0x%02X 0x%02X", val1, val2, val3); } void Script::o_stub59() { uint16 val1 = readScript8or16bits(); uint8 val2 = readScript8bits(); - + debugScript(1, true, "STUB59: 0x%04X 0x%02X", val1, val2); } Script::OpcodeFunc Script::_opcodes[NUM_OPCODES] = { &Script::o_nop, // 0x00 - &Script::o_nop, + &Script::o_nop, &Script::o_playsong, &Script::o_bf9on, &Script::o_palfadeout, // 0x04 diff --git a/engines/groovie/vdx.cpp b/engines/groovie/vdx.cpp index 137333c362..247d2c885e 100644 --- a/engines/groovie/vdx.cpp +++ b/engines/groovie/vdx.cpp @@ -65,7 +65,7 @@ uint16 VDXPlayer::loadInternal() { // - 1 Puzzle piece? Skip palette, don't redraw full screen, draw still to b/ack buffer // - 2 Transparent colour is 0xFF // - 5 Skip still chunks - // - 7 + // - 7 // - 8 Just show the first frame // - 9 Start a palette fade in _flagZero = ((_flags & (1 << 0)) != 0); @@ -161,7 +161,7 @@ bool VDXPlayer::playFrameInternal() { } // Wait until the current frame can be shown - + if (!(Common::getEnabledSpecialDebugLevels() & kGroovieDebugFast)) { waitFrame(); } diff --git a/engines/kyra/animator_hof.cpp b/engines/kyra/animator_hof.cpp index c5d44d10af..5cc44f1b38 100644 --- a/engines/kyra/animator_hof.cpp +++ b/engines/kyra/animator_hof.cpp @@ -124,10 +124,10 @@ void KyraEngine_HoF::updateItemAnimations() { bool nextFrame = false; if (_itemAnimData[0].itemIndex == -1 || _inventorySaved) - return; + return; const ItemAnimData_v2 *s = &_itemAnimData[_nextAnimItem]; - ActiveItemAnim *a = &_activeItemAnim[_nextAnimItem]; + ActiveItemAnim *a = &_activeItemAnim[_nextAnimItem]; _nextAnimItem = ++_nextAnimItem % _itemAnimDataSize; uint32 ctime = _system->getMillis(); diff --git a/engines/kyra/animator_mr.cpp b/engines/kyra/animator_mr.cpp index 9702499fe7..5a26f9bcfd 100644 --- a/engines/kyra/animator_mr.cpp +++ b/engines/kyra/animator_mr.cpp @@ -201,7 +201,7 @@ void KyraEngine_MR::updateItemAnimations() { bool nextFrame = false; if (_itemAnimData[0].itemIndex == -1) - return; + return; const ItemAnimData_v2 *s = &_itemAnimData[_nextAnimItem]; ActiveItemAnim *a = &_activeItemAnim[_nextAnimItem]; @@ -438,7 +438,7 @@ void KyraEngine_MR::setCharacterAnimDim(int w, int h) { _charBackUpWidth2 = _animObjects[0].width2; _charBackUpHeight = _animObjects[0].height; _charBackUpHeight2 = _animObjects[0].height2; - + _animObjects[0].width2 = (w - _charBackUpWidth) / 2; _animObjects[0].height2 = h - _charBackUpHeight; _animObjects[0].width = w; diff --git a/engines/kyra/debugger.cpp b/engines/kyra/debugger.cpp index 7ae5414d82..94238f31b8 100644 --- a/engines/kyra/debugger.cpp +++ b/engines/kyra/debugger.cpp @@ -449,8 +449,8 @@ bool Debugger_HoF::cmd_passcodes(int argc, const char **argv) { DebugPrintf("value must be either 1 (on) or 0 (off)\n"); return true; } - - _vm->_dbgPass = val; + + _vm->_dbgPass = val; } else { DebugPrintf("Syntax: pass_codes <0/1>\n"); } diff --git a/engines/kyra/detection.cpp b/engines/kyra/detection.cpp index 6902c03a81..d0a73800e6 100644 --- a/engines/kyra/detection.cpp +++ b/engines/kyra/detection.cpp @@ -478,7 +478,7 @@ const KYRAGameDescription adGameDescs[] = { KYRA2_CD_FAN_FLAGS(Common::IT_ITA, Common::EN_ANY) }, - { + { { "kyra2", "CD", @@ -490,7 +490,7 @@ const KYRAGameDescription adGameDescs[] = { KYRA2_CD_FAN_FLAGS(Common::IT_ITA, Common::EN_ANY) }, - { + { { "kyra2", "CD", @@ -502,7 +502,7 @@ const KYRAGameDescription adGameDescs[] = { KYRA2_CD_FAN_FLAGS(Common::IT_ITA, Common::EN_ANY) }, - { + { { "kyra2", "CD", @@ -608,9 +608,9 @@ const KYRAGameDescription adGameDescs[] = { }, // Kyra3 - + // non installed version - { + { { "kyra3", 0, @@ -657,7 +657,7 @@ const KYRAGameDescription adGameDescs[] = { }, // installed version - { + { { "kyra3", 0, @@ -704,7 +704,7 @@ const KYRAGameDescription adGameDescs[] = { }, // Mac version - { + { { "kyra3", 0, @@ -843,7 +843,7 @@ const KYRAGameDescription adGameDescs[] = { }, KYRA3_CD_FAN_FLAGS(Common::IT_ITA, Common::FR_FRA) }, - + // Lands of Lore CD { { @@ -860,7 +860,7 @@ const KYRAGameDescription adGameDescs[] = { }, LOL_CD_FLAGS }, - + { { "lol", @@ -876,7 +876,7 @@ const KYRAGameDescription adGameDescs[] = { }, LOL_CD_FLAGS }, - + { { "lol", @@ -908,7 +908,7 @@ const KYRAGameDescription adGameDescs[] = { }, LOL_CD_FLAGS }, - + { { "lol", @@ -924,7 +924,7 @@ const KYRAGameDescription adGameDescs[] = { }, LOL_CD_FLAGS }, - + { { "lol", @@ -1144,7 +1144,7 @@ SaveStateList KyraMetaEngine::listSaves(const char *target) const { for (Common::StringList::const_iterator file = filenames.begin(); file != filenames.end(); file++) { // Obtain the last 3 digits of the filename, since they correspond to the save slot int slotNum = atoi(file->c_str() + file->size() - 3); - + if (slotNum >= 0 && slotNum <= 999) { Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str()); if (in) { @@ -1184,7 +1184,7 @@ SaveStateDescriptor KyraMetaEngine::querySaveMetaInfos(const char *target, int s error = Kyra::KyraEngine_v1::readSaveHeader(in, true, header); delete in; - + if (error == Kyra::KyraEngine_v1::kRSHENoError) { SaveStateDescriptor desc(slot, header.description); @@ -1195,7 +1195,7 @@ SaveStateDescriptor KyraMetaEngine::querySaveMetaInfos(const char *target, int s return desc; } } - + return SaveStateDescriptor(); } diff --git a/engines/kyra/gui.cpp b/engines/kyra/gui.cpp index 7ec667dfe3..a0ce40f491 100644 --- a/engines/kyra/gui.cpp +++ b/engines/kyra/gui.cpp @@ -153,7 +153,7 @@ void GUI::initMenu(Menu &menu) { scrollUpButton->buttonCallback = getScrollUpButtonHandler(); scrollUpButton->nextButton = 0; scrollUpButton->mouseWheel = -1; - + _menuButtonList = addButtonToList(_menuButtonList, scrollUpButton); updateMenuButton(scrollUpButton); @@ -348,7 +348,7 @@ void GUI::checkTextfieldInput() { if (event.kbd.keycode == 'q' && event.kbd.flags == Common::KBD_CTRL) _vm->quitGame(); else - _keyPressed = event.kbd; + _keyPressed = event.kbd; running = false; break; diff --git a/engines/kyra/gui_hof.cpp b/engines/kyra/gui_hof.cpp index c134745956..7930dbf2a0 100644 --- a/engines/kyra/gui_hof.cpp +++ b/engines/kyra/gui_hof.cpp @@ -320,7 +320,7 @@ void KyraEngine_HoF::scrollInventoryWheel() { int KyraEngine_HoF::bookButton(Button *button) { if (!queryGameFlag(1)) { - objectChat(getTableString(0xEB, _cCodeBuffer, 1), 0, 0x83, 0xEB); + objectChat(getTableString(0xEB, _cCodeBuffer, 1), 0, 0x83, 0xEB); return 0; } @@ -418,7 +418,7 @@ void KyraEngine_HoF::loadBookBkgd() { strcpy(filename, (_bookBkgd == 0) ? "_BOOKD.CPS" : "_BOOKC.CPS"); _bookBkgd ^= 1; - + if (_flags.isTalkie) { if (!_bookCurPage) strcpy(filename, "_XBOOKB.CPS"); @@ -475,7 +475,7 @@ void KyraEngine_HoF::showBookPage() { rightPage = _res->fileData(filename, 0); } } - + int rightPageY = _bookPageYOffset[_bookCurPage+1]; _screen->hideMouse(); @@ -508,7 +508,7 @@ void KyraEngine_HoF::bookLoop() { bookButtons[4].buttonCallback = BUTTON_FUNCTOR(KyraEngine_HoF, this, &KyraEngine_HoF::bookNextPage); Button *buttonList = 0; - + for (uint i = 0; i < ARRAYSIZE(bookButtons); ++i) buttonList = _gui->addButtonToList(buttonList, &bookButtons[i]); @@ -539,7 +539,7 @@ void KyraEngine_HoF::bookDecodeText(uint8 *str) { while (*op != 0x1A) { while (*op != 0x1A && *op != 0x0D) *dst++ = *op++; - + if (*op == 0x1A) break; @@ -619,7 +619,7 @@ int KyraEngine_HoF::cauldronButton(Button *button) { return 0; if (queryGameFlag(0xE4)) { - snd_playSoundEffect(0x0D); + snd_playSoundEffect(0x0D); return 0; } @@ -724,7 +724,7 @@ int GUI_HoF::optionsButton(Button *button) { initMenuLayout(_saveMenu); initMenuLayout(_savenameMenu); initMenuLayout(_deathMenu); - + _currentMenu = &_mainMenu; if (_vm->_menuDirectlyToLoad) { @@ -732,7 +732,7 @@ int GUI_HoF::optionsButton(Button *button) { setupPalette(); _loadedSave = false; - + loadMenu(0); if (_loadedSave) { @@ -1004,7 +1004,7 @@ int GUI_HoF::gameOptionsTalkie(Button *caller) { if (_vm->_lang != lang) { _reloadTemporarySave = true; - + Graphics::Surface thumb; createScreenThumbnail(thumb); _vm->saveGameState(999, "Autosave", &thumb); @@ -1053,7 +1053,7 @@ void GUI_HoF::setupOptionsButtons() { case 0: _gameOptions.item[1].itemId = 31; break; - + case 1: _gameOptions.item[1].itemId = 32; break; @@ -1079,7 +1079,7 @@ int GUI_HoF::sliderHandler(Button *caller) { assert(button >= 0 && button <= 3); int oldVolume = 0; - + if (_vm->gameFlags().isTalkie) { oldVolume = _vm->getVolume(KyraEngine_v1::kVolumeEntry(button)); } else { @@ -1151,7 +1151,7 @@ int GUI_HoF::sliderHandler(Button *caller) { _vm->_configTextspeed = newVolume; } } - + drawSliderBar(button, _vm->_buttonShapes[17]); if (playSoundEffect) _vm->snd_playSoundEffect(0x18); diff --git a/engines/kyra/gui_lok.cpp b/engines/kyra/gui_lok.cpp index 6af4841084..665c38115b 100644 --- a/engines/kyra/gui_lok.cpp +++ b/engines/kyra/gui_lok.cpp @@ -275,7 +275,7 @@ int GUI_LoK::processButtonList(Button *list, uint16 inputFlag, int8 mouseWheel) list->flags2 &= 0xFFFE; processButton(list); } - + if (list->flags2 & 4) { list->flags2 &= 0xFFFB; processButton(list); diff --git a/engines/kyra/gui_mr.cpp b/engines/kyra/gui_mr.cpp index e3f250c20e..38b8c5a5a3 100644 --- a/engines/kyra/gui_mr.cpp +++ b/engines/kyra/gui_mr.cpp @@ -189,10 +189,10 @@ void KyraEngine_MR::showInventory() { redrawInventory(30); drawMalcolmsMoodPointer(-1, 30); drawScore(30, 215, 191); - + if (queryGameFlag(0x97)) drawJestersStaff(1, 30); - + _screen->hideMouse(); if (_itemInHand < 0) { @@ -238,7 +238,7 @@ void KyraEngine_MR::showInventory() { times = 0; waitTill = _system->getMillis() + _tickLength; } - + height += _inventoryScrollSpeed; y -= _inventoryScrollSpeed; } @@ -260,10 +260,10 @@ void KyraEngine_MR::hideInventory() { _inventoryState = false; updateCLState(); initMainButtonList(true); - + _screen->copyBlockToPage(3, 0, 0, 320, 56, _interface); _screen->hideMouse(); - + restorePage3(); flagAnimObjsForRefresh(); drawAnimObjects(); @@ -306,7 +306,7 @@ void KyraEngine_MR::hideInventory() { times = 0; waitTill = _system->getMillis() + _tickLength; } - + y += _inventoryScrollSpeed; y2 += _inventoryScrollSpeed; } @@ -479,9 +479,9 @@ void KyraEngine_MR::redrawInventory(int page) { _screen->showMouse(); _screen->_curPage = pageBackUp; - + if (page == 0 || page == 1) - _screen->updateScreen(); + _screen->updateScreen(); } void KyraEngine_MR::clearInventorySlot(int slot, int page) { @@ -602,7 +602,7 @@ int KyraEngine_MR::buttonMoodChange(Button *button) { drawMalcolmsMoodText(); updateDlgIndex(); - + EMCData data; EMCState state; memset(&data, 0, sizeof(data)); @@ -717,7 +717,7 @@ void KyraEngine_MR::showAlbum() { _album.leftPage.wsa->setX(_albumWSAX[_album.nextPage+0]); _album.leftPage.wsa->setY(_albumWSAY[_album.nextPage+0]); _album.leftPage.wsa->setDrawPage(2); - + _album.leftPage.wsa->displayFrame(_album.leftPage.curFrame, 0x4000); } if (_album.rightPage.wsa->opened()) { @@ -865,7 +865,7 @@ void KyraEngine_MR::processAlbum() { Button *buttonList = 0; for (int i = 0; i < 5; ++i) buttonList = _gui->addButtonToList(buttonList, &albumButtons[i]); - + _album.leftPage.timer = _album.rightPage.timer = _system->getMillis(); albumNewPage(); _album.running = true; @@ -876,7 +876,7 @@ void KyraEngine_MR::processAlbum() { removeInputTop(); musicUpdate(0); - + if (_album.curPage != _album.nextPage) { int oldPage = _album.curPage; _album.curPage = _album.nextPage; @@ -930,7 +930,7 @@ void KyraEngine_MR::albumNewPage() { int id = _album.curPage / 2 + 100; albumChat((const char *)getTableEntry(_album.file, id), 205, id); - + if (id == 107) { _screen->copyRegion(76, 100, 76, 100, 244, 100, 2, 0, Screen::CR_NO_P_CHECK); albumChat((const char *)getTableEntry(_album.file, 108), 205, 108); @@ -1303,7 +1303,7 @@ int GUI_MR::optionsButton(Button *button) { initMenuLayout(_saveMenu); initMenuLayout(_savenameMenu); initMenuLayout(_deathMenu); - + _currentMenu = &_mainMenu; _vm->musicUpdate(0); @@ -1312,7 +1312,7 @@ int GUI_MR::optionsButton(Button *button) { backUpPage1(_vm->_screenBuffer); _loadedSave = false; - + --_loadMenu.numberOfItems; loadMenu(0); ++_loadMenu.numberOfItems; @@ -1503,7 +1503,7 @@ void GUI_MR::setupOptionsButtons() { case 0: _gameOptions.item[1].itemId = 31; break; - + case 1: _gameOptions.item[1].itemId = 32; break; diff --git a/engines/kyra/gui_v2.cpp b/engines/kyra/gui_v2.cpp index 500d816cb9..012a5b901b 100644 --- a/engines/kyra/gui_v2.cpp +++ b/engines/kyra/gui_v2.cpp @@ -65,7 +65,7 @@ void GUI_v2::processButton(Button *button) { } return; } - + int entry = button->flags2 & 5; byte val1 = 0, val2 = 0, val3 = 0; @@ -365,7 +365,7 @@ int GUI_v2::processButtonList(Button *buttonList, uint16 inputFlag, int8 mouseWh if ((*buttonList->buttonCallback.get())(buttonList)) break; } - + if (buttonList->flags & 0x20) break; } @@ -544,7 +544,7 @@ int GUI_v2::toggleWalkspeed(Button *caller) { int GUI_v2::toggleText(Button *caller) { updateMenuButton(caller); - + if (_vm->textEnabled()) { if (_vm->speechEnabled()) _vm->_configVoice = 1; @@ -636,7 +636,7 @@ int GUI_v2::clickSaveSlot(Button *caller) { int index = caller->index - _menuButtons[0].index; assert(index >= 0 && index <= 6); MenuItem &item = _saveMenu.item[index]; - + if (item.saveSlot >= 0) { if (_isDeleteMenu) { _slotToDelete = item.saveSlot; @@ -701,7 +701,7 @@ int GUI_v2::deleteMenu(Button *caller) { processHighlights(_saveMenu, _vm->_mouseX, _vm->_mouseY); getInput(); } - + if (_slotToDelete < 1) { restorePage1(_vm->_screenBuffer); backUpPage1(_vm->_screenBuffer); @@ -729,7 +729,7 @@ int GUI_v2::deleteMenu(Button *caller) { Common::String oldName = _vm->getSavegameFilename(*i); Common::String newName = _vm->getSavegameFilename(*i-1); _vm->_saveFileMan->renameSavefile(oldName.c_str(), newName.c_str()); - } + } _saveMenu.menuNameId = _vm->gameFlags().isTalkie ? 9 : 17; return 0; } diff --git a/engines/kyra/gui_v2.h b/engines/kyra/gui_v2.h index a8e14d8831..3c162c8cc2 100644 --- a/engines/kyra/gui_v2.h +++ b/engines/kyra/gui_v2.h @@ -128,7 +128,7 @@ protected: virtual void restorePalette() {} virtual char *getTableString(int id) = 0; - + virtual uint8 textFieldColor1() const = 0; virtual uint8 textFieldColor2() const = 0; virtual uint8 textFieldColor3() const = 0; diff --git a/engines/kyra/items_mr.cpp b/engines/kyra/items_mr.cpp index 299c826e80..f93ecc8d0c 100644 --- a/engines/kyra/items_mr.cpp +++ b/engines/kyra/items_mr.cpp @@ -138,7 +138,7 @@ bool KyraEngine_MR::processItemDrop(uint16 sceneId, uint16 item, int x, int y, i itemPos = -1; if (itemPos >= 0) { - exchangeMouseItem(itemPos, 1); + exchangeMouseItem(itemPos, 1); return true; } @@ -304,7 +304,7 @@ void KyraEngine_MR::itemDropDown(int startX, int startY, int dstX, int dstY, int } restoreGfxRect32x32(x, y); - } + } } _itemList[itemSlot].x = dstX; @@ -439,7 +439,7 @@ bool KyraEngine_MR::itemListMagic(int handItem, int itemSlot) { } else { setGameFlag(0x1AE); } - + _timer->setCountdown(12, 1); _timer->enable(12); } @@ -458,7 +458,7 @@ bool KyraEngine_MR::itemListMagic(int handItem, int itemSlot) { _screen->hideMouse(); deleteItemAnimEntry(itemSlot); addItemToAnimList(itemSlot); - + if (newItem == 0xFE) removeHandItem(); else if (newItem != 0xFF) @@ -468,7 +468,7 @@ bool KyraEngine_MR::itemListMagic(int handItem, int itemSlot) { if (_lang != 1) updateItemCommand(resItem, 3, 0xFF); - // Unlike the original we give points for when combining with scene items + // Unlike the original we give points for when combining with scene items if (resItem == 7) { updateScore(35, 100); delay(60*_tickLength, true); @@ -519,7 +519,7 @@ bool KyraEngine_MR::itemInventoryMagic(int handItem, int invSlot) { _screen->hideMouse(); clearInventorySlot(invSlot, 0); drawInventorySlot(0, resItem, invSlot); - + if (newItem == 0xFE) removeHandItem(); else if (newItem != 0xFF) diff --git a/engines/kyra/kyra_hof.cpp b/engines/kyra/kyra_hof.cpp index 316e341a14..48986f1bda 100644 --- a/engines/kyra/kyra_hof.cpp +++ b/engines/kyra/kyra_hof.cpp @@ -97,7 +97,7 @@ KyraEngine_HoF::KyraEngine_HoF(OSystem *system, const GameFlags &flags) : KyraEn _itemAnimData = 0; _demoAnimData = 0; _nextAnimItem = 0; - + for (int i = 0; i < 15; i++) memset(&_activeItemAnim[i], 0, sizeof(ActiveItemAnim)); @@ -212,7 +212,7 @@ void KyraEngine_HoF::pauseEngineIntern(bool pause) { } _nextIdleAnim += pausedTime; - + for (int x = 0; x < _itemAnimDataSize; x++) _activeItemAnim[x].nextFrame += pausedTime; @@ -270,7 +270,7 @@ Common::Error KyraEngine_HoF::init() { for (int i = 0; i < 2; i++) addShapeToPool(shapes, i, i); - + delete[] shapes; _screen->setMouseCursor(0, 0, getShapePtr(0)); @@ -284,7 +284,7 @@ Common::Error KyraEngine_HoF::go() { if (_flags.isDemo && !_flags.isTalkie) { if (_flags.gameID == GI_LOL) - seq_playSequences(kSequenceLolDemoScene1, kSequenceLolDemoScene6); + seq_playSequences(kSequenceLolDemoScene1, kSequenceLolDemoScene6); else seq_playSequences(kSequenceDemoVirgin, kSequenceDemoFisher); _menuChoice = 4; @@ -322,7 +322,7 @@ Common::Error KyraEngine_HoF::go() { if (!shouldQuit()) runLoop(); cleanup(); - + if (_showOutro) seq_playSequences(kSequenceFunters, kSequenceFrash); } @@ -1202,7 +1202,7 @@ int KyraEngine_HoF::inputSceneChange(int x, int y, int unk1, int unk2) { int vocH = _flags.isTalkie ? 131 : -1; if (_pathfinderFlag) { - if (findItem(curScene, 13) >= 0 && _unk3 <= -3) { + if (findItem(curScene, 13) >= 0 && _unk3 <= -3) { strId = 252; } else if (_itemInHand == 72) { strId = 257; @@ -1539,7 +1539,7 @@ void KyraEngine_HoF::snd_playSoundEffect(int track, int volume) { // 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). - // The PC-98 version has support for non-pcm sound effects, but only for tracks + // The PC-98 version has support for non-pcm sound effects, but only for tracks // which also have voc files. The syntax would be: // KyraEngine_v1::snd_playSoundEffect(vocIndex); } @@ -1748,7 +1748,7 @@ void KyraEngine_HoF::cauldronItemAnim(int item) { } snd_playSoundEffect(0x17); - + for (int i = 16; i > 0; i -= 2, curY += 2) { _screen->setNewShapeHeight(shape, i); restoreGfxRect32x32(x, y); @@ -1992,7 +1992,7 @@ void KyraEngine_HoF::writeSettings() { case 3: _flags.lang = Common::JA_JPN; break; - + case 0: default: _flags.lang = Common::EN_ANY; diff --git a/engines/kyra/kyra_hof.h b/engines/kyra/kyra_hof.h index 31dc38b110..b1902103a6 100644 --- a/engines/kyra/kyra_hof.h +++ b/engines/kyra/kyra_hof.h @@ -724,7 +724,7 @@ protected: int o2_displayWsaSequentialFrames(EMCState *script); int o2_displayWsaSequence(EMCState *script); int o2_addItemToInventory(EMCState *script); - int o2_drawShape(EMCState *script); + int o2_drawShape(EMCState *script); int o2_addItemToCurScene(EMCState *script); int o2_loadSoundFile(EMCState *script); int o2_removeSlotFromInventory(EMCState *script); @@ -863,7 +863,7 @@ protected: const uint16 *_ingameTalkObjIndex; int _ingameTalkObjIndexSize; const char *const *_ingameTimJpStr; - int _ingameTimJpStrSize; + int _ingameTimJpStrSize; const HofSeqData *_sequences; const ItemAnimData_v2 *_itemAnimData; int _itemAnimDataSize; diff --git a/engines/kyra/kyra_mr.cpp b/engines/kyra/kyra_mr.cpp index 6e5bba3dc0..acc0421a59 100644 --- a/engines/kyra/kyra_mr.cpp +++ b/engines/kyra/kyra_mr.cpp @@ -209,7 +209,7 @@ Common::Error KyraEngine_MR::init() { KyraEngine_v1::init(); initStaticResource(); - + _debugger = new Debugger_v2(this); assert(_debugger); @@ -229,7 +229,7 @@ Common::Error KyraEngine_MR::init() { _screen->setFont(Screen::FID_6_FNT); _screen->setAnimBlockPtr(3500); _screen->setScreenDim(0); - + _res->loadFileToBuf("PALETTE.COL", _screen->getPalette(0), 768); _screen->setScreenPalette(_screen->getPalette(0)); @@ -545,7 +545,7 @@ void KyraEngine_MR::playStudioSFX(const char *str) { void KyraEngine_MR::preinit() { debugC(9, kDebugLevelMain, "KyraEngine_MR::preinit()"); - + _itemBuffer1 = new int8[72]; _itemBuffer2 = new int8[144]; initMouseShapes(); @@ -583,7 +583,7 @@ void KyraEngine_MR::startup() { _screen->setFont(Screen::FID_6_FNT); - _stringBuffer = new char[500]; + _stringBuffer = new char[500]; //XXX musicUpdate(0); //XXX @@ -676,7 +676,7 @@ void KyraEngine_MR::startup() { assert(_sceneList); memset(_sceneList, 0, sizeof(SceneDesc)*98); _sceneListSize = 98; - + musicUpdate(0); runStartupScript(1, 0); _res->exists("MOODOMTR.WSA", true); @@ -1014,7 +1014,7 @@ void KyraEngine_MR::runLoop() { } checkAutosave(); - + if (_system->getMillis() >= _nextIdleAnim) showIdleAnim(); @@ -1054,7 +1054,7 @@ void KyraEngine_MR::handleInput(int x, int y) { } setNextIdleAnimTimer(); - + int skip = 0; if (checkCharCollision(x, y) && _unk3 >= -1 && runSceneScript2()) { @@ -1381,7 +1381,7 @@ char *KyraEngine_MR::appendLanguage(char *buf, int lang, int bufSize) { int KyraEngine_MR::loadLanguageFile(const char *file, uint8 *&buffer) { debugC(9, kDebugLevelMain, "KyraEngine_MR::loadLanguageFile('%s', %p)", file, (const void*)buffer); - delete[] buffer; + delete[] buffer; buffer = 0; uint32 size = 0; @@ -1487,7 +1487,7 @@ void KyraEngine_MR::scoreIncrease(int count, const char *str) { drawScore(0, 215, 191); _screen->updateScreen(); delay(20, true); - + snd_playSoundEffect(0x0E, 0xC8); drawOld = 0; } @@ -1498,7 +1498,7 @@ void KyraEngine_MR::scoreIncrease(int count, const char *str) { #pragma mark - void KyraEngine_MR::changeChapter(int newChapter, int sceneId, int malcolmShapes, int facing) { - debugC(9, kDebugLevelMain, "KyraEngine_MR::changeChapter(%d, %d, %d, %d)", newChapter, sceneId, malcolmShapes, facing); + debugC(9, kDebugLevelMain, "KyraEngine_MR::changeChapter(%d, %d, %d, %d)", newChapter, sceneId, malcolmShapes, facing); resetItemList(); _currentChapter = newChapter; diff --git a/engines/kyra/kyra_mr.h b/engines/kyra/kyra_mr.h index a0e0af93b0..6c06a84433 100644 --- a/engines/kyra/kyra_mr.h +++ b/engines/kyra/kyra_mr.h @@ -252,7 +252,7 @@ private: void drawMalcolmsMoodText(); void drawMalcolmsMoodPointer(int frame, int page); void drawJestersStaff(int type, int page); - + void drawScore(int page, int x, int y); void drawScoreCounting(int oldScore, int newScore, int drawOld, const int x); int getScoreX(const char *str); @@ -494,7 +494,7 @@ private: // special script code bool _useFrameTable; - + int o3a_setCharacterFrame(EMCState *script); // special shape code @@ -523,7 +523,7 @@ private: int _score; int _scoreMax; - + const uint8 *_scoreTable; int _scoreTableSize; @@ -564,7 +564,7 @@ private: void printAlbumPageText(); void printAlbumText(int page, const char *str, int x, int y, uint8 c0); - + void processAlbum(); void albumNewPage(); diff --git a/engines/kyra/kyra_v1.cpp b/engines/kyra/kyra_v1.cpp index b7b3fc60b7..eb0f929096 100644 --- a/engines/kyra/kyra_v1.cpp +++ b/engines/kyra/kyra_v1.cpp @@ -411,7 +411,7 @@ void KyraEngine_v1::registerDefaultSettings() { void KyraEngine_v1::readSettings() { _configWalkspeed = ConfMan.getInt("walkspeed"); _configMusic = 0; - + if (!ConfMan.getBool("music_mute")) { if (_flags.platform == Common::kPlatformFMTowns || _flags.platform == Common::kPlatformPC98) _configMusic = ConfMan.getBool("cdaudio") ? 2 : 1; @@ -501,7 +501,7 @@ void KyraEngine_v1::setVolume(kVolumeEntry vol, uint8 value) { case kVolumeSfx: ConfMan.setInt("sfx_volume", convertValueToMixer(value)); break; - + case kVolumeSpeech: ConfMan.setInt("speech_volume", convertValueToMixer(value)); break; @@ -524,7 +524,7 @@ uint8 KyraEngine_v1::getVolume(kVolumeEntry vol) { case kVolumeSfx: return convertValueFromMixer(ConfMan.getInt("sfx_volume")); break; - + case kVolumeSpeech: if (speechEnabled()) return convertValueFromMixer(ConfMan.getInt("speech_volume")); diff --git a/engines/kyra/kyra_v1.h b/engines/kyra/kyra_v1.h index e38f0b0633..af7e0385cc 100644 --- a/engines/kyra/kyra_v1.h +++ b/engines/kyra/kyra_v1.h @@ -290,7 +290,7 @@ protected: static const int8 _addYPosTable[]; // Character - + static const int8 _charAddXPosTable[]; static const int8 _charAddYPosTable[]; diff --git a/engines/kyra/kyra_v2.cpp b/engines/kyra/kyra_v2.cpp index 158206f73f..57f5cc029f 100644 --- a/engines/kyra/kyra_v2.cpp +++ b/engines/kyra/kyra_v2.cpp @@ -40,7 +40,7 @@ KyraEngine_v2::KyraEngine_v2(OSystem *system, const GameFlags &flags, const Engi _itemList = 0; _itemListSize = 0; - + _characterShapeFile = -1; _updateCharPosNextUpdate = 0; diff --git a/engines/kyra/kyra_v2.h b/engines/kyra/kyra_v2.h index 2d261d8c7b..bb3afe1b22 100644 --- a/engines/kyra/kyra_v2.h +++ b/engines/kyra/kyra_v2.h @@ -267,7 +267,7 @@ protected: int _characterShapeFile; virtual void loadCharacterShapes(int shapes) = 0; - + // pathfinder int _movFacingTable[600]; int _pathfinderFlag; diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp index 19a0a851e7..8daf1d857f 100644 --- a/engines/kyra/lol.cpp +++ b/engines/kyra/lol.cpp @@ -36,7 +36,7 @@ namespace Kyra { LoLEngine::LoLEngine(OSystem *system, const GameFlags &flags) : KyraEngine_v1(system, flags) { _screen = 0; - + switch (_flags.lang) { case Common::EN_ANY: case Common::EN_USA: @@ -59,7 +59,7 @@ LoLEngine::LoLEngine(OSystem *system, const GameFlags &flags) : KyraEngine_v1(sy } memset(_shapes, 0, sizeof(_shapes)); - + _chargenWSA = 0; _lastUsedStringBuffer = 0; _landsFile = 0; @@ -74,7 +74,7 @@ LoLEngine::~LoLEngine() { delete _screen; delete _tim; - + for (Common::Array::iterator i = _timIntroOpcodes.begin(); i != _timIntroOpcodes.end(); ++i) delete *i; _timIntroOpcodes.clear(); @@ -90,10 +90,10 @@ Common::Error LoLEngine::init() { _screen->setResolution(); KyraEngine_v1::init(); - + _tim = new TIMInterpreter(this, _screen, _system); assert(_tim); - + _screen->setAnimBlockPtr(10000); _screen->setScreenDim(0); @@ -210,9 +210,9 @@ void LoLEngine::preInit() { _eventList.clear(); //loadTalkFile(0); - + char filename[32]; - snprintf(filename, sizeof(filename), "LANDS.%s", _languageExt[_lang]); + snprintf(filename, sizeof(filename), "LANDS.%s", _languageExt[_lang]); _res->exists(filename, true); _landsFile = _res->fileData(filename, 0); @@ -233,7 +233,7 @@ int LoLEngine::mainMenu() { bool hasSave = saveFileLoadable(0); MainMenu::StaticData data = { - { 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0 }, { 0x01, 0x04, 0x0C, 0x04, 0x00, 0x3D, 0x9F }, { 0x2C, 0x19, 0x48, 0x2C }, Screen::FID_9_FNT, 1 @@ -253,9 +253,9 @@ int LoLEngine::mainMenu() { for (int i = 0; i < 5; ++i) { if (hasSave) - data.strings[i] = getLangString(mainMenuStrings[1 + tableOffs][i]); + data.strings[i] = getLangString(mainMenuStrings[1 + tableOffs][i]); else - data.strings[i] = getLangString(mainMenuStrings[tableOffs][i]); + data.strings[i] = getLangString(mainMenuStrings[tableOffs][i]); } MainMenu *menu = new MainMenu(this); @@ -333,9 +333,9 @@ void LoLEngine::setupPrologueData(bool load) { "INTRO.PAK", "INTROVOC.CMP", 0 }; - const char * const *fileList = _flags.isTalkie ? fileListCD : + const char * const *fileList = _flags.isTalkie ? fileListCD : (_flags.useInstallerPackage ? fileListFloppy : fileListFloppyExtracted); - + char filename[32]; for (uint i = 0; fileList[i]; ++i) { @@ -347,7 +347,7 @@ void LoLEngine::setupPrologueData(bool load) { } strcat(filename, fileList[i]); - + if (load) { if (!_res->loadPakFile(filename)) error("Couldn't load file: '%s'", filename); @@ -358,7 +358,7 @@ void LoLEngine::setupPrologueData(bool load) { _screen->clearPage(0); _screen->clearPage(3); - + if (load) { _chargenWSA = new WSAMovie_v2(this, _screen); assert(_chargenWSA); @@ -414,12 +414,12 @@ void LoLEngine::showIntro() { } _screen->showMouse(); _sound->voiceStop(); - + _eventList.clear(); - + _tim->unload(intro); _tim->clearLangData(); - + _screen->fadePalette(_screen->getPalette(1), 30, 0); } @@ -427,7 +427,7 @@ int LoLEngine::chooseCharacter() { debugC(9, kDebugLevelMain, "LoLEngine::chooseCharacter()"); _tim->setLangData("LOLINTRO.DIP"); - + _screen->loadFont(Screen::FID_9_FNT, "FONT9P.FNT"); _screen->loadBitmap("ITEMICN.SHP", 3, 3, 0); @@ -438,7 +438,7 @@ int LoLEngine::chooseCharacter() { _screen->loadBitmap("CHAR.CPS", 2, 2, _screen->getPalette(0)); _screen->loadBitmap("BACKGRND.CPS", 4, 4, _screen->getPalette(0)); - + if (!_chargenWSA->open("CHARGEN.WSA", 1, 0)) error("Couldn't load CHARGEN.WSA"); _chargenWSA->setX(113); @@ -448,7 +448,7 @@ int LoLEngine::chooseCharacter() { _screen->setFont(Screen::FID_9_FNT); _screen->_curPage = 2; - + for (int i = 0; i < 4; ++i) _screen->fprintStringIntro(_charPreviews[i].name, _charPreviews[i].x + 16, _charPreviews[i].y + 36, 0xC0, 0x00, 0x9C, 0x120); @@ -457,16 +457,16 @@ int LoLEngine::chooseCharacter() { _screen->fprintStringIntro("%d", _charPreviews[i].x + 21, _charPreviews[i].y + 56, 0x98, 0x00, 0x9C, 0x220, _charPreviews[i].attrib[1]); _screen->fprintStringIntro("%d", _charPreviews[i].x + 21, _charPreviews[i].y + 64, 0x98, 0x00, 0x9C, 0x220, _charPreviews[i].attrib[2]); } - + _screen->fprintStringIntro(_tim->getCTableEntry(51), 36, 173, 0x98, 0x00, 0x9C, 0x20); _screen->fprintStringIntro(_tim->getCTableEntry(53), 36, 181, 0x98, 0x00, 0x9C, 0x20); _screen->fprintStringIntro(_tim->getCTableEntry(55), 36, 189, 0x98, 0x00, 0x9C, 0x20); - + _screen->copyRegion(0, 0, 0, 0, 320, 200, 2, 0, Screen::CR_NO_P_CHECK); _screen->_curPage = 0; - + _screen->fadePalette(_screen->getPalette(0), 30, 0); - + bool kingIntro = true; while (!shouldQuit()) { if (kingIntro) @@ -515,10 +515,10 @@ int LoLEngine::chooseCharacter() { void LoLEngine::kingSelectionIntro() { debugC(9, kDebugLevelMain, "LoLEngine::kingSelectionIntro()"); - + _screen->copyRegion(0, 0, 0, 0, 112, 120, 4, 0, Screen::CR_NO_P_CHECK); int y = 38; - + _screen->fprintStringIntro(_tim->getCTableEntry(57), 8, y, 0x32, 0x00, 0x9C, 0x20); _screen->fprintStringIntro(_tim->getCTableEntry(58), 8, y + 10, 0x32, 0x00, 0x9C, 0x20); _screen->fprintStringIntro(_tim->getCTableEntry(59), 8, y + 20, 0x32, 0x00, 0x9C, 0x20); @@ -526,11 +526,11 @@ void LoLEngine::kingSelectionIntro() { _screen->fprintStringIntro(_tim->getCTableEntry(61), 8, y + 40, 0x32, 0x00, 0x9C, 0x20); _sound->voicePlay("KING01"); - + _chargenWSA->setX(113); _chargenWSA->setY(0); _chargenWSA->setDrawPage(0); - + int index = 4; while (_sound->voiceIsPlaying("KING01") && _charSelection == -1 && !shouldQuit() && !skipFlag()) { index = MAX(index, 4); @@ -550,9 +550,9 @@ void LoLEngine::kingSelectionIntro() { index = (index + 1) % 22; } - + resetSkipFlag(); - + _chargenWSA->displayFrame(0x10, 0, 0, 0); _screen->updateScreen(); _sound->voiceStop("KING01"); @@ -560,19 +560,19 @@ void LoLEngine::kingSelectionIntro() { void LoLEngine::kingSelectionReminder() { debugC(9, kDebugLevelMain, "LoLEngine::kingSelectionReminder()"); - + _screen->copyRegion(0, 0, 0, 0, 112, 120, 4, 0, Screen::CR_NO_P_CHECK); int y = 48; - + _screen->fprintStringIntro(_tim->getCTableEntry(62), 8, y, 0x32, 0x00, 0x9C, 0x20); _screen->fprintStringIntro(_tim->getCTableEntry(63), 8, y + 10, 0x32, 0x00, 0x9C, 0x20); - + _sound->voicePlay("KING02"); - + _chargenWSA->setX(113); _chargenWSA->setY(0); _chargenWSA->setDrawPage(0); - + int index = 0; while (_sound->voiceIsPlaying("KING02") && _charSelection == -1 && !shouldQuit() && index < 15) { _chargenWSA->displayFrame(_chargenFrameTable[index+9], 0, 0, 0); @@ -628,7 +628,7 @@ void LoLEngine::kingSelectionOutro() { void LoLEngine::processCharacterSelection() { debugC(9, kDebugLevelMain, "LoLEngine::processCharacterSelection()"); - + _charSelection = -1; while (!shouldQuit() && _charSelection == -1) { uint32 nextKingMessage = _system->getMillis() + 900 * _tickLength; @@ -681,22 +681,22 @@ int LoLEngine::selectionCharInfo(int character) { strcpy(filename, "FACE09.SHP"); vocFilename[3] = 'A'; break; - + case 1: strcpy(filename, "FACE01.SHP"); vocFilename[3] = 'M'; break; - + case 2: strcpy(filename, "FACE08.SHP"); vocFilename[3] = 'K'; break; - + case 3: strcpy(filename, "FACE05.SHP"); vocFilename[3] = 'C'; break; - + default: break; }; @@ -713,9 +713,9 @@ int LoLEngine::selectionCharInfo(int character) { _screen->fprintStringIntro(_tim->getCTableEntry(idx+2), 50, 147, 0x53, 0x00, 0xCF, 0x20); _screen->fprintStringIntro(_tim->getCTableEntry(idx+3), 50, 157, 0x53, 0x00, 0xCF, 0x20); _screen->fprintStringIntro(_tim->getCTableEntry(idx+4), 50, 167, 0x53, 0x00, 0xCF, 0x20); - + _screen->fprintStringIntro(_tim->getCTableEntry(69), 100, 168, 0x32, 0x00, 0xCF, 0x20); - + selectionCharInfoIntro(vocFilename); if (_charSelectionInfoResult == -1) { while (_charSelectionInfoResult == -1) { @@ -723,7 +723,7 @@ int LoLEngine::selectionCharInfo(int character) { _system->delayMillis(10); } } - + if (_charSelectionInfoResult != 1) { _charSelectionInfoResult = -1; _screen->copyRegion(0, 122, 0, 122, 320, 78, 2, 0, Screen::CR_NO_P_CHECK); @@ -743,7 +743,7 @@ int LoLEngine::selectionCharInfo(int character) { _screen->fprintStringIntro(_tim->getCTableEntry(68), 3, 68, 0x32, 0x00, 0x9C, 0x20); resetSkipFlag(); - kingSelectionOutro(); + kingSelectionOutro(); return character; } @@ -751,7 +751,7 @@ void LoLEngine::selectionCharInfoIntro(char *file) { debugC(9, kDebugLevelMain, "LoLEngine::selectionCharInfoIntro(%p)", (const void *)file); int index = 0; file[4] = '0'; - + while (_charSelectionInfoResult == -1 && !shouldQuit()) { if (!_sound->voicePlay(file)) break; @@ -789,21 +789,21 @@ int LoLEngine::getCharSelection() { return i; } } - + return -1; } int LoLEngine::selectionCharAccept() { int inputFlag = checkInput(0, false) & 0xCF; removeInputTop(); - + if (inputFlag == 200) { if (88 <= _mouseX && _mouseX <= 128 && 180 <= _mouseY && _mouseY <= 194) return 1; if (196 <= _mouseX && _mouseX <= 236 && 180 <= _mouseY && _mouseY <= 194) return 0; } - + return -1; } @@ -818,13 +818,13 @@ void LoLEngine::setupOpcodeTable() { Common::Array *timTable = 0; SetTimOpcodeTable(_timIntroOpcodes); - + // 0x00 OpcodeTim(tlol_setupPaletteFade); OpcodeTimUnImpl(); OpcodeTim(tlol_loadPalette); OpcodeTim(tlol_setupPaletteFadeEx); - + // 0x04 OpcodeTim(tlol_processWsaFrame); OpcodeTim(tlol_displayText); @@ -865,15 +865,15 @@ int LoLEngine::tlol_processWsaFrame(const TIM *tim, const uint16 *param) { const int x2 = param[2]; const int y2 = param[3]; const int factor = MAX(0, (int16)param[4]); - + const int x1 = anim->x; const int y1 = anim->y; - + int w1 = anim->wsa->width(); int h1 = anim->wsa->height(); int w2 = (w1 * factor) / 100; int h2 = (h1 * factor) / 100; - + anim->wsa->setDrawPage(2); anim->wsa->setX(x1); anim->wsa->setY(y1); diff --git a/engines/kyra/lol.h b/engines/kyra/lol.h index a984fdc36f..a6b7378b0f 100644 --- a/engines/kyra/lol.h +++ b/engines/kyra/lol.h @@ -22,7 +22,7 @@ * $Id$ * */ - + #ifndef KYRA_LOL_H #define KYRA_LOL_H @@ -41,7 +41,7 @@ class LoLEngine : public KyraEngine_v1 { public: LoLEngine(OSystem *system, const GameFlags &flags); ~LoLEngine(); - + Screen *screen(); private: Screen_LoL *_screen; @@ -61,13 +61,13 @@ private: void setupPrologueData(bool load); void showIntro(); - + struct CharacterPrev { const char *name; int x, y; int attrib[3]; }; - + static const CharacterPrev _charPreviews[]; WSAMovie_v2 *_chargenWSA; @@ -81,29 +81,29 @@ private: void updateSelectionAnims(); int selectionCharInfo(int character); void selectionCharInfoIntro(char *file); - + int getCharSelection(); int selectionCharAccept(); - + int _charSelection; int _charSelectionInfoResult; - + uint32 _selectionAnimTimers[4]; uint8 _selectionAnimFrames[4]; static const uint8 _selectionAnimIndexTable[]; - + static const uint16 _selectionPosTable[]; static const uint8 _selectionChar1IdxTable[]; static const uint8 _selectionChar2IdxTable[]; static const uint8 _selectionChar3IdxTable[]; static const uint8 _selectionChar4IdxTable[]; - + static const uint8 _reminderChar1IdxTable[]; static const uint8 _reminderChar2IdxTable[]; static const uint8 _reminderChar3IdxTable[]; static const uint8 _reminderChar4IdxTable[]; - + static const uint8 _charInfoFrameTable[]; // timer @@ -121,7 +121,7 @@ private: int tlol_setupPaletteFadeEx(const TIM *tim, const uint16 *param); int tlol_processWsaFrame(const TIM *tim, const uint16 *param); int tlol_displayText(const TIM *tim, const uint16 *param); - + // translation int _lang; @@ -137,7 +137,7 @@ private: // graphics uint8 *_shapes[138]; - + // unneeded void setWalkspeed(uint8) {} void setHandItem(uint16) {} diff --git a/engines/kyra/resource.cpp b/engines/kyra/resource.cpp index 85378659da..061cb7e602 100644 --- a/engines/kyra/resource.cpp +++ b/engines/kyra/resource.cpp @@ -184,7 +184,7 @@ bool Resource::loadFileList(const Common::String &filedata) { if (filename.hasSuffix(".PAK")) { if (!exists(filename.c_str()) && _vm->gameFlags().isDemo) { - // the demo version supplied with Kyra3 does not + // the demo version supplied with Kyra3 does not // contain all pak files listed in filedata.fdt // so we don't do anything here if they are non // existant. diff --git a/engines/kyra/resource_intern.cpp b/engines/kyra/resource_intern.cpp index 827af4892f..ebe874ae2f 100644 --- a/engines/kyra/resource_intern.cpp +++ b/engines/kyra/resource_intern.cpp @@ -212,7 +212,7 @@ struct PlainArchiveListSearch { Common::Archive *ResLoaderPak::load(Common::SharedPtr memberFile, Common::SeekableReadStream &stream) const { int32 filesize = stream.size(); - + int32 startoffset = 0, endoffset = 0; bool switchEndian = false; bool firstFile = true; @@ -400,7 +400,7 @@ bool ResLoaderTlk::isLoadable(const Common::String &filename, Common::SeekableRe Common::Archive *ResLoaderTlk::load(Common::SharedPtr file, Common::SeekableReadStream &stream) const { uint16 entries = stream.readUint16LE(); PlainArchive::FileInputList files; - + for (uint i = 0; i < entries; ++i) { PlainArchive::InputEntry entry; @@ -451,7 +451,7 @@ private: }; void FileExpanderSource::advSrcBitsBy1() { - _key >>= 1; + _key >>= 1; if (!--_bitsLeft) { if (_dataPtr < _endofBuffer) _key = ((*_dataPtr++) << 8 ) | (_key & 0xff); @@ -479,7 +479,7 @@ uint16 FileExpanderSource::getKeyMasked(uint8 newIndex) { if (_index > 8) { newIndex = _index - 8; - res = (_key & 0xff) & mskTable[8]; + res = (_key & 0xff) & mskTable[8]; advSrcBitsByIndex(8); _index = newIndex; res |= (((_key & 0xff) & mskTable[_index]) << 8); @@ -518,7 +518,7 @@ uint16 FileExpanderSource::keyMaskedAlign(uint16 val) { void FileExpanderSource::advSrcRefresh() { _key = READ_LE_UINT16(_dataPtr); if (_dataPtr < _endofBuffer - 1) - _dataPtr += 2; + _dataPtr += 2; _bitsLeft = 8; } @@ -566,7 +566,7 @@ bool FileExpander::process(uint8 *dst, const uint8 *src, uint32 outsize, uint32 0x10, 0x11, 0x12, 0x00, 0x08, 0x07, 0x09, 0x06, 0x0A, 0x05, 0x0B, 0x04, 0x0C, 0x03, 0x0D, 0x02, 0x0E, 0x01, 0x0F }; - + memset(_tables[0], 0, 3914); uint8 *d = dst; @@ -591,10 +591,10 @@ bool FileExpander::process(uint8 *dst, const uint8 *src, uint32 outsize, uint32 tableSize0 = _src->getKeyMasked(5) + 257; tableSize1 = _src->getKeyMasked(5) + 1; memset(_tables[7], 0, 19); - + const uint8 *itbl = indexTable; int numbytes = _src->getKeyMasked(4) + 4; - + while (numbytes--) _tables[7][*itbl++] = _src->getKeyMasked(3); @@ -615,7 +615,7 @@ bool FileExpander::process(uint8 *dst, const uint8 *src, uint32 outsize, uint32 uint8 tmpI = 0; if (cmd == 16) { cmd = _src->getKeyMasked(2) + 3; - tmpI = *(tmp - 1); + tmpI = *(tmp - 1); } else if (cmd == 17) { cmd = _src->getKeyMasked(3) + 3; } else { @@ -630,7 +630,7 @@ bool FileExpander::process(uint8 *dst, const uint8 *src, uint32 outsize, uint32 error("decompression failure"); } } - + memcpy(_tables[1], _tables[0] + tableSize0, tableSize1); generateTables(0, 2, 3, tableSize0); generateTables(1, 4, 5, tableSize1); @@ -640,7 +640,7 @@ bool FileExpander::process(uint8 *dst, const uint8 *src, uint32 outsize, uint32 postprocess = false; needrefresh = true; } else if (mode == 0){ - uint8 *d2 = _tables[0]; + uint8 *d2 = _tables[0]; memset(d2, 8, 144); memset(d2 + 144, 9, 112); memset(d2 + 256, 7, 24); @@ -659,9 +659,9 @@ bool FileExpander::process(uint8 *dst, const uint8 *src, uint32 outsize, uint32 if (!postprocess) continue; - + int16 cmd = 0; - + do { cmd = ((int16*) _tables[2])[_src->getKeyLower()]; _src->advSrcBitsByIndex(cmd < 0 ? calcCmdAndIndex(_tables[3], cmd) : _tables[0][cmd]); @@ -721,8 +721,8 @@ void FileExpander::generateTables(uint8 srcIndex, uint8 dstIndex, uint8 dstIndex const uint8 *s = tbl1; memset(_tables16[0], 0, 32); - - for (int i = 0; i < cnt; i++) + + for (int i = 0; i < cnt; i++) _tables16[0][(*s++)]++; _tables16[1][1] = 0; @@ -758,12 +758,12 @@ void FileExpander::generateTables(uint8 srcIndex, uint8 dstIndex, uint8 dstIndex if (t > 0) { uint16 v1 = *d; uint16 v2 = 0; - + do { v2 = (v2 << 1) | (v1 & 1); v1 >>= 1; } while (--t && v1); - + t++; uint8 c1 = (v1 & 1); while (t--) { @@ -775,7 +775,7 @@ void FileExpander::generateTables(uint8 srcIndex, uint8 dstIndex, uint8 dstIndex *d++ = v2; } else { d++; - } + } } memset(tbl2, 0, 512); @@ -794,7 +794,7 @@ void FileExpander::generateTables(uint8 srcIndex, uint8 dstIndex, uint8 dstIndex if (t && t < 9) { inc = 1 << t; uint16 o = *d; - + do { s2[o] = cnt; o += inc; @@ -824,7 +824,7 @@ void FileExpander::generateTables(uint8 srcIndex, uint8 dstIndex, uint8 dstIndex } while (--t); *s2 = cnt; } - d--; + d--; } while (--cnt >= 0); } @@ -909,7 +909,7 @@ Common::Archive *InstallerLoader::load(Resource *owner, const Common::String &fi delete tmpFile; tmpFile = 0; - + pos += cs; if (cs == size) { if (!bytesleft) { @@ -960,7 +960,7 @@ Common::Archive *InstallerLoader::load(Resource *owner, const Common::String &fi } uint32 size = (i == a->lastFile) ? a->endOffset : tmpFile->size(); - + if (startFile) { startFile = false; pos = a->startOffset + kExecSize; @@ -1009,7 +1009,7 @@ Common::Archive *InstallerLoader::load(Resource *owner, const Common::String &fi tmpFile->seek(pos, SEEK_SET); } } - + sprintf(filenameExt, extension.c_str(), i + 1); filenameTemp = a->filename + Common::String(filenameExt); @@ -1022,12 +1022,12 @@ Common::Archive *InstallerLoader::load(Resource *owner, const Common::String &fi } uint32 id = READ_LE_UINT32(hdr); - + if (id == 0x04034B50) { compressionType = hdr[8]; insize = READ_LE_UINT32(hdr + 18); outsize = READ_LE_UINT32(hdr + 22); - + uint16 filestrlen = READ_LE_UINT16(hdr + 26); *(hdr + 30 + filestrlen) = 0; entryStr = Common::String((const char *)(hdr + 30)); @@ -1047,7 +1047,7 @@ Common::Archive *InstallerLoader::load(Resource *owner, const Common::String &fi if ((pos + insize) > size) { // this is for files that are split between two archive files inPart1 = size - pos; - inPart2 = insize - inPart1; + inPart2 = insize - inPart1; tmpFile->read(inbuffer, inPart1); } else { tmpFile->read(inbuffer, insize); diff --git a/engines/kyra/saveload.cpp b/engines/kyra/saveload.cpp index 2c410a6ff6..f9cbe09db7 100644 --- a/engines/kyra/saveload.cpp +++ b/engines/kyra/saveload.cpp @@ -64,7 +64,7 @@ KyraEngine_v1::kReadSaveHeaderError KyraEngine_v1::readSaveHeader(Common::Seekab in->seek(0, SEEK_SET); in->read(descriptionBuffer, descriptionSize[i]); descriptionBuffer[descriptionSize[i]] = 0; - + type = in->readUint32BE(); header.version = in->readUint16LE(); if (type == MKID_BE('MBL3') && header.version == 100) { diff --git a/engines/kyra/saveload_hof.cpp b/engines/kyra/saveload_hof.cpp index d1407c1d91..ba39ee28a3 100644 --- a/engines/kyra/saveload_hof.cpp +++ b/engines/kyra/saveload_hof.cpp @@ -146,7 +146,7 @@ Common::Error KyraEngine_HoF::loadGameState(int slot) { warning("Trying to load savegame from original interpreter, while this is possible, it is not officially supported"); bool setFlag1EE = (queryGameFlag(0x1EE) != 0); - + _deathHandler = -1; if (!_unkSceneScreenFlag1) { _sound->beginFadeOut(); @@ -203,7 +203,7 @@ Common::Error KyraEngine_HoF::loadGameState(int slot) { for (int i = 0; i < 31; ++i) _newSceneDlgState[i] = in.readUint16(); } - + _cauldronUseCount = in.readSint16(); if (header.originalSave) @@ -312,7 +312,7 @@ Common::Error KyraEngine_HoF::loadGameState(int slot) { _mainCharX = _mainCharacter.x2 = _mainCharacter.x1; _mainCharY = _mainCharacter.y2 = _mainCharacter.y1; _mainCharacter.facing = 4; - + enterNewScene(_mainCharacter.sceneId, _mainCharacter.facing, 0, 0, 1); setHandItem(_itemInHand); diff --git a/engines/kyra/saveload_lok.cpp b/engines/kyra/saveload_lok.cpp index c437960907..3548723610 100644 --- a/engines/kyra/saveload_lok.cpp +++ b/engines/kyra/saveload_lok.cpp @@ -203,7 +203,7 @@ Common::Error KyraEngine_LoK::loadGameState(int slot) { _screen->updateScreen(); setMousePos(brandonX, brandonY); - + if (in->err() || in->eos()) { warning("Load failed ('%s', '%s').", fileName, header.description.c_str()); return Common::kUnknownError; @@ -223,14 +223,14 @@ Common::Error KyraEngine_LoK::saveGameState(int slot, const char *saveName, cons debugC(9, kDebugLevelMain, "KyraEngine_LoK::saveGame(%d, '%s', %p)", slot, saveName, (const void *)thumb); const char *fileName = getSavegameFilename(slot); - + if (shouldQuit()) return Common::kNoError; Common::OutSaveFile *out = openSaveForWriting(fileName, saveName, thumb); if (!out) return _saveFileMan->getError(); - + for (int i = 0; i < 11; i++) { out->writeUint16BE(_characterList[i].sceneId); out->writeByte(_characterList[i].height); diff --git a/engines/kyra/saveload_mr.cpp b/engines/kyra/saveload_mr.cpp index f2f10d635a..5193800b1d 100644 --- a/engines/kyra/saveload_mr.cpp +++ b/engines/kyra/saveload_mr.cpp @@ -184,7 +184,7 @@ Common::Error KyraEngine_MR::loadGameState(int slot) { for (int i = 0; i < 30; ++i) in.read(_conversationState[i], 30); - + if (!header.originalSave) { in.read(_newSceneDlgState, 40); } else { @@ -309,7 +309,7 @@ Common::Error KyraEngine_MR::loadGameState(int slot) { _badConsciencePosition = false; _goodConscienceShown = false; _goodConsciencePosition = false; - + enterNewScene(_mainCharacter.sceneId, _mainCharacter.facing, 0, 0, 1); setHandItem(_itemInHand); diff --git a/engines/kyra/scene_hof.cpp b/engines/kyra/scene_hof.cpp index b6c25a46c7..ad1632a231 100644 --- a/engines/kyra/scene_hof.cpp +++ b/engines/kyra/scene_hof.cpp @@ -91,7 +91,7 @@ void KyraEngine_HoF::enterNewScene(uint16 newScene, int facing, int unk1, int un waitTime = _system->getMillis() + 1000; _sound->beginFadeOut(); } - + _chatAltFlag = false; if (!unk3) { @@ -255,7 +255,7 @@ void KyraEngine_HoF::enterNewSceneUnk2(int unk1) { updateCharacterAnim(0); refreshAnimObjectsIfNeed(); } - } else if (_mainCharX != -1 && _mainCharY != -1) { + } else if (_mainCharX != -1 && _mainCharY != -1) { if (_characterFrameTable[_mainCharacter.facing] == 25) _mainCharacter.facing = 5; _mainCharacter.animFrame = _characterFrameTable[_mainCharacter.facing]; diff --git a/engines/kyra/scene_mr.cpp b/engines/kyra/scene_mr.cpp index 1ceb47155d..238e5ee447 100644 --- a/engines/kyra/scene_mr.cpp +++ b/engines/kyra/scene_mr.cpp @@ -765,7 +765,7 @@ int KyraEngine_MR::runSceneScript1(int x, int y) { return 0; if (_deathHandler >= 0) return 0; - + _emc->init(&_sceneScriptState, &_sceneScriptData); _sceneScriptState.regs[1] = x; _sceneScriptState.regs[2] = y; diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp index 44e66691a2..cd2227f130 100644 --- a/engines/kyra/screen.cpp +++ b/engines/kyra/screen.cpp @@ -80,8 +80,8 @@ bool Screen::init() { if (_vm->gameFlags().useHiResOverlay) { _useOverlays = true; _useSJIS = (_vm->gameFlags().lang == Common::JA_JPN); - _sjisInvisibleColor = (_vm->gameFlags().gameID == GI_KYRA1) ? 0x80 : 0xF6; - + _sjisInvisibleColor = (_vm->gameFlags().gameID == GI_KYRA1) ? 0x80 : 0xF6; + for (int i = 0; i < SCREEN_OVLS_NUM; ++i) { if (!_sjisOverlayPtrs[i]) { _sjisOverlayPtrs[i] = new uint8[SCREEN_OVL_SJIS_SIZE]; @@ -440,7 +440,7 @@ int Screen::fadePalStep(const uint8 *palette, int diff) { uint8 fadePal[768]; memcpy(fadePal, _screenPalette, 768); - + bool needRefresh = false; const int colors = (_vm->gameFlags().platform == Common::kPlatformAmiga ? 32 : 256) * 3; for (int i = 0; i < colors; ++i) { @@ -463,7 +463,7 @@ int Screen::fadePalStep(const uint8 *palette, int diff) { fadePal[i] = (uint8)c2; } } - + if (needRefresh) setScreenPalette(fadePal); @@ -1153,7 +1153,7 @@ void Screen::drawShape(uint8 pageNum, const uint8 *shapeData, int x, int y, int _dsTableLoopCount = 0; _dsTable2 = 0; _dsDrawLayer = 0; - + uint8 *table3 = 0; uint8 *table4 = 0; @@ -1242,7 +1242,7 @@ void Screen::drawShape(uint8 pageNum, const uint8 *shapeData, int x, int y, int &Screen::drawShapePlotType3_7, // used by Kyra 1 (invisibility) &Screen::drawShapePlotType8, // used by Kyra 2 &Screen::drawShapePlotType9, // used by Kyra 1 + 3 - 0, + 0, &Screen::drawShapePlotType11_15, // used by Kyra 1 (invisibility) + Kyra 3 (shadow) &Screen::drawShapePlotType12, // used by Kyra 2 &Screen::drawShapePlotType13, // used by Kyra 1 @@ -1253,7 +1253,7 @@ void Screen::drawShape(uint8 pageNum, const uint8 *shapeData, int x, int y, int }; int scaleCounterV = 0; - + f = flags & 0x0f; _dsProcessMargin = dsMarginFunc[f]; _dsScaleSkip = dsSkipFunc[f]; @@ -1304,7 +1304,7 @@ void Screen::drawShape(uint8 pageNum, const uint8 *shapeData, int x, int y, int if (flags & DSF_SCALE) { shapeHeight = (shapeHeight * _dsScaleH) >> 8; shpWidthScaled1 = shpWidthScaled2 = (shapeWidth * _dsScaleW) >> 8; - + if (!shapeHeight || !shpWidthScaled1) { va_end(args); return; @@ -1321,10 +1321,10 @@ void Screen::drawShape(uint8 pageNum, const uint8 *shapeData, int x, int y, int uint16 frameSize = READ_LE_UINT16(src); src += 2; int colorTableColors = ((_vm->gameFlags().gameID != GI_KYRA1) && (shapeFlags & 4)) ? *src++ : 16; - + if (!(flags & 0x8000) && (shapeFlags & 1)) _dsTable2 = src; - + if (flags & 0x400) src += colorTableColors; @@ -1479,7 +1479,7 @@ int Screen::drawShapeMarginNoScaleUpwind(uint8 *&dst, const uint8 *&src, int &cn continue; cnt = cnt + 1 - (*src++); } - + cnt++; dst -= cnt; return 0; @@ -1491,7 +1491,7 @@ int Screen::drawShapeMarginNoScaleDownwind(uint8 *&dst, const uint8 *&src, int & continue; cnt = cnt + 1 - (*src++); } - + cnt++; dst += cnt; return 0; @@ -1598,7 +1598,7 @@ void Screen::drawShapeProcessLineNoScaleUpwind(uint8 *&dst, const uint8 *&src, i c = *src++; dst += c; cnt -= c; - } + } } while (cnt > 0); } @@ -1613,7 +1613,7 @@ void Screen::drawShapeProcessLineNoScaleDownwind(uint8 *&dst, const uint8 *&src, c = *src++; dst -= c; cnt -= c; - } + } } while (cnt > 0); } @@ -1715,7 +1715,7 @@ void Screen::drawShapePlotType6(uint8 *dst, uint8 cmd) { int t = _drawShapeVar4 + _drawShapeVar5; if (t & 0xff00) { cmd = dst[_drawShapeVar3]; - t &= 0xff; + t &= 0xff; } else { cmd = _dsTable2[cmd]; } @@ -1794,7 +1794,7 @@ void Screen::drawShapePlotType14(uint8 *dst, uint8 cmd) { uint32 relOffs = dst - _dsDstPage; int t = (_shapePages[0][relOffs] & 0x7f) & 0x87; if (_dsDrawLayer < t) { - cmd = _shapePages[1][relOffs]; + cmd = _shapePages[1][relOffs]; } else { t = _drawShapeVar4 + _drawShapeVar5; if (t & 0xff00) { @@ -2701,7 +2701,7 @@ void Screen::loadBitmap(const char *filename, int tempPage, int dstPage, uint8 * warning("couldn't load bitmap: '%s'", filename); return; } - + if (skip) srcData += 4; diff --git a/engines/kyra/screen.h b/engines/kyra/screen.h index 58744a9d2a..8299262d0e 100644 --- a/engines/kyra/screen.h +++ b/engines/kyra/screen.h @@ -322,7 +322,7 @@ protected: void drawShapePlotType0(uint8 *dst, uint8 cmd); void drawShapePlotType1(uint8 *dst, uint8 cmd); - void drawShapePlotType3_7(uint8 *dst, uint8 cmd); + void drawShapePlotType3_7(uint8 *dst, uint8 cmd); void drawShapePlotType4(uint8 *dst, uint8 cmd); void drawShapePlotType5(uint8 *dst, uint8 cmd); void drawShapePlotType6(uint8 *dst, uint8 cmd); @@ -331,7 +331,7 @@ protected: void drawShapePlotType11_15(uint8 *dst, uint8 cmd); void drawShapePlotType12(uint8 *dst, uint8 cmd); void drawShapePlotType13(uint8 *dst, uint8 cmd); - void drawShapePlotType14(uint8 *dst, uint8 cmd); + void drawShapePlotType14(uint8 *dst, uint8 cmd); typedef int (Screen::*DsMarginSkipFunc)(uint8 *&dst, const uint8 *&src, int &cnt); typedef void (Screen::*DsLineFunc)(uint8 *&dst, const uint8 *&src, int &cnt, int scaleState); diff --git a/engines/kyra/screen_lok.h b/engines/kyra/screen_lok.h index 5b4b8a9266..136c098160 100644 --- a/engines/kyra/screen_lok.h +++ b/engines/kyra/screen_lok.h @@ -40,7 +40,7 @@ public: bool init(); int getRectSize(int w, int h); - + void setScreenDim(int dim); const ScreenDim *getScreenDim(int dim); diff --git a/engines/kyra/screen_lol.cpp b/engines/kyra/screen_lol.cpp index 1698c54bbf..8e7abee545 100644 --- a/engines/kyra/screen_lol.cpp +++ b/engines/kyra/screen_lol.cpp @@ -79,9 +79,9 @@ void Screen_LoL::fprintStringIntro(const char *format, int x, int y, uint8 c1, u va_list args; va_start(args, flags); - vsnprintf(buffer, sizeof(buffer), format, args); + vsnprintf(buffer, sizeof(buffer), format, args); va_end(args); - + if ((flags & 0x0F00) == 0x100) x -= getTextWidth(buffer) >> 1; if ((flags & 0x0F00) == 0x200) diff --git a/engines/kyra/screen_lol.h b/engines/kyra/screen_lol.h index 07c5b89604..bba748813a 100644 --- a/engines/kyra/screen_lol.h +++ b/engines/kyra/screen_lol.h @@ -35,7 +35,7 @@ class LoLEngine; class Screen_LoL : public Screen_v2 { public: Screen_LoL(LoLEngine *vm, OSystem *system); - + void setScreenDim(int dim); const ScreenDim *getScreenDim(int dim); diff --git a/engines/kyra/screen_v2.cpp b/engines/kyra/screen_v2.cpp index c6ea6a93e8..b2952ee113 100644 --- a/engines/kyra/screen_v2.cpp +++ b/engines/kyra/screen_v2.cpp @@ -57,7 +57,7 @@ uint8 *Screen_v2::generateOverlay(const uint8 *palette, uint8 *buffer, int start uint8 processedPalette[3]; const uint8 *src = palette + i*3; byte col; - + col = *src++; col -= ((((col - col1) * factor) << 1) >> 8) & 0xFF; processedPalette[0] = col; @@ -487,13 +487,13 @@ bool Screen_v2::calcBounds(int w0, int h0, int &x1, int &y1, int &w1, int &h1, i void Screen_v2::checkedPageUpdate(int srcPage, int dstPage) { debugC(9, kDebugLevelScreen, "Screen_v2::checkedPageUpdate(%d, %d)", srcPage, dstPage); - + const uint32 *src = (const uint32 *)getPagePtr(srcPage); uint32 *dst = (uint32 *)getPagePtr(dstPage); uint32 *page0 = (uint32 *)getPagePtr(0); - + bool updated = false; - + for (int y = 0; y < 200; ++y) { for (int x = 0; x < 80; ++x, ++src, ++dst, ++page0) { if (*src != *dst) { diff --git a/engines/kyra/screen_v2.h b/engines/kyra/screen_v2.h index 7bbdc4b6c3..d95bff35d1 100644 --- a/engines/kyra/screen_v2.h +++ b/engines/kyra/screen_v2.h @@ -46,7 +46,7 @@ public: uint8 *generateOverlay(const uint8 *palette, uint8 *buffer, int color, uint16 factor); void applyOverlay(int x, int y, int w, int h, int pageNum, const uint8 *overlay); int findLeastDifferentColor(const uint8 *paletteEntry, const uint8 *palette, uint16 numColors); - + virtual void getFadeParams(const uint8 *palette, int delay, int &delayInc, int &diff); // shape handling @@ -78,5 +78,5 @@ protected: } // end of namespace Kyra -#endif +#endif diff --git a/engines/kyra/script_hof.cpp b/engines/kyra/script_hof.cpp index e3a8bf95bc..4eb727a617 100644 --- a/engines/kyra/script_hof.cpp +++ b/engines/kyra/script_hof.cpp @@ -279,7 +279,7 @@ int KyraEngine_HoF::o2_wsaOpen(EMCState *script) { int KyraEngine_HoF::o2_displayWsaSequentialFrames(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_HoF::o2_displayWsaSequentialFrames(%p) (%d, %d, %d, %d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5), stackPos(6)); - + uint16 frameDelay = stackPos(2) * _tickLength; uint16 currentFrame = stackPos(3); uint16 lastFrame = stackPos(4); @@ -289,10 +289,10 @@ int KyraEngine_HoF::o2_displayWsaSequentialFrames(EMCState *script) { _wsaSlots[index]->setX(stackPos(0)); _wsaSlots[index]->setY(stackPos(1)); _wsaSlots[index]->setDrawPage(0); - + _screen->hideMouse(); - while (currentFrame <= lastFrame) { + while (currentFrame <= lastFrame) { uint32 endTime = _system->getMillis() + frameDelay; _wsaSlots[index]->displayFrame(currentFrame++, copyParam, 0, 0); if (!skipFlag()) { @@ -309,7 +309,7 @@ int KyraEngine_HoF::o2_displayWsaSequentialFrames(EMCState *script) { int KyraEngine_HoF::o2_displayWsaSequence(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_HoF::o2_displayWsaSequence(%p) (%d, %d, %d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5)); - + const int frameDelay = stackPos(2) * _tickLength; const int index = stackPos(3); const bool doUpdate = (stackPos(4) != 0); @@ -318,13 +318,13 @@ int KyraEngine_HoF::o2_displayWsaSequence(EMCState *script) { _wsaSlots[index]->setX(stackPos(0)); _wsaSlots[index]->setY(stackPos(1)); _wsaSlots[index]->setDrawPage(0); - + _screen->hideMouse(); int currentFrame = 0; const int lastFrame = _wsaSlots[index]->frames(); - while (currentFrame <= lastFrame) { + while (currentFrame <= lastFrame) { uint32 endTime = _system->getMillis() + frameDelay; _wsaSlots[index]->displayFrame(currentFrame++, copyParam, 0, 0); if (!skipFlag()) { @@ -740,7 +740,7 @@ int KyraEngine_HoF::o2_setCauldronState(EMCState *script) { int KyraEngine_HoF::o2_showItemString(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_HoF::o2_showItemString(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); const int item = stackPos(0); - + int string = 0; if (stackPos(1) == 1) { if (_lang == 1) @@ -798,7 +798,7 @@ int KyraEngine_HoF::o2_showLetter(EMCState *script) { _res->loadFileToBuf(filename, _screen->getPalette(0), 768); _screen->fadeToBlack(0x14); - + sprintf(filename, "LETTER%.1d.%s", letter, _languageExtension[_lang]); uint8 *letterBuffer = _res->fileData(filename, 0); if (!letterBuffer) { @@ -1142,11 +1142,11 @@ int KyraEngine_HoF::o2_mushroomEffect(EMCState *script) { memcpy(_screen->getPalette(2), _screen->_currentPalette, 768); for (int i = 1; i < 768; i += 3) - _screen->_currentPalette[i] = 0; + _screen->_currentPalette[i] = 0; snd_playSoundEffect(106); _screen->fadePalette(_screen->_currentPalette, 90, &_updateFunctor); memcpy(_screen->_currentPalette, _screen->getPalette(2), 768); - + for (int i = 0; i < 768; i += 3) { _screen->_currentPalette[i] = _screen->_currentPalette[i + 1] = 0; _screen->_currentPalette[i + 2] += (((int8)_screen->_currentPalette[i + 2]) >> 1); @@ -1155,9 +1155,9 @@ int KyraEngine_HoF::o2_mushroomEffect(EMCState *script) { } snd_playSoundEffect(106); _screen->fadePalette(_screen->_currentPalette, 90, &_updateFunctor); - + memcpy(_screen->_currentPalette, _screen->getPalette(2), 768); - _screen->fadePalette(_screen->_currentPalette, 30, &_updateFunctor); + _screen->fadePalette(_screen->_currentPalette, 30, &_updateFunctor); return 0; } @@ -1232,7 +1232,7 @@ int KyraEngine_HoF::o2_setupSceneAnimation(EMCState *script) { obj->shapePtr = _sceneShapeTable[anim.shapeIndex]; else obj->shapePtr = 0; - + if (anim.flags & 0x40) { obj->shapeIndex3 = anim.shapeIndex; obj->animNum = index; @@ -1267,10 +1267,10 @@ int KyraEngine_HoF::o2_stopSceneAnimation(EMCState *script) { refreshAnimObjectsIfNeed(); obj.enabled = 0; _animList = deleteAnimListEntry(_animList, &_animObjects[1+index]); - + if (_sceneAnimMovie[index]->opened()) _sceneAnimMovie[index]->close(); - + return 0; } @@ -1425,7 +1425,7 @@ int KyraEngine_HoF::o2_demoFinale(EMCState *script) { _sound->beginFadeOut(); _screen->fadeToBlack(); - + _runFlag = 0; return 0; } diff --git a/engines/kyra/script_lok.cpp b/engines/kyra/script_lok.cpp index 5cd35a6063..4901b5e1c4 100644 --- a/engines/kyra/script_lok.cpp +++ b/engines/kyra/script_lok.cpp @@ -1356,7 +1356,7 @@ int KyraEngine_LoK::o1_waitForConfirmationMouseClick(EMCState *script) { _animator->updateAllObjectShapes(); updateInput(); - + int input = checkInput(_buttonList, false) & 0xFF; removeInputTop(); if (input == 200) diff --git a/engines/kyra/script_mr.cpp b/engines/kyra/script_mr.cpp index 3273d3b89f..ddad2d28c3 100644 --- a/engines/kyra/script_mr.cpp +++ b/engines/kyra/script_mr.cpp @@ -358,7 +358,7 @@ int KyraEngine_MR::o3_drawSceneShape(EMCState *script) { int KyraEngine_MR::o3_drawSceneShapeOnPage(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_drawSceneShapeOnPage(%p) (%d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2)); const int shape = stackPos(0); - + int x = _sceneShapeDescs[shape].drawX; int y = _sceneShapeDescs[shape].drawY; _screen->drawShape(stackPos(2), _sceneShapes[shape], x, y, 2, (stackPos(1) != 0) ? 1 : 0); @@ -397,7 +397,7 @@ int KyraEngine_MR::o3_updateConversations(EMCState *script) { case 0: dlgIndex -= 34; break; - + case 1: dlgIndex -= 54; break; @@ -616,7 +616,7 @@ int KyraEngine_MR::o3_setSceneAnimPosAndFrame(EMCState *script) { const int newY2 = stackPos(2); const int newX = stackPos(3); const int newY = stackPos(4); - + if (newX2 >= 0) anim.x2 = newX2; if (newY2 >= 0) @@ -767,7 +767,7 @@ int KyraEngine_MR::o3_daggerWarning(EMCState *script) { const char *str = 0; int x = 0; - + str = (const char *)getTableEntry(_cCodeFile, 120); x = _text->getCenterStringX(str, 0xF, 0x68); _text->printText(str, x, 174, 0xFF, 0xF0, 0x00); @@ -1370,7 +1370,7 @@ void KyraEngine_MR::setupOpcodeTable() { Opcode(o3_dummy); OpcodeUnImpl(); Opcode(o3_dummy); - + SetOpcodeTable(_opcodesAnimation); // 0x00 Opcode(o2a_setAnimationShapes); diff --git a/engines/kyra/script_tim.cpp b/engines/kyra/script_tim.cpp index b10a6adbba..24f7fce576 100644 --- a/engines/kyra/script_tim.cpp +++ b/engines/kyra/script_tim.cpp @@ -82,13 +82,13 @@ TIMInterpreter::TIMInterpreter(KyraEngine_v1 *vm, Screen_v2 *screen, OSystem *sy _commands = commandProcs; _commandsSize = ARRAYSIZE(commandProcs); - + memset(&_animations, 0, sizeof(_animations)); _langData = 0; _textDisplayed = false; _textAreaBuffer = new uint8[320*40]; assert(_textAreaBuffer); - + _palDelayInc = _palDiff = _palDelayAcc = 0; } @@ -134,10 +134,10 @@ TIM *TIMInterpreter::load(const char *filename, const Common::Array>= 1; for (uint i = 0; i < avtlChunkSize; ++i) tim->avtl[i] = READ_LE_UINT16(tim->avtl + i); - + int num = (avtlChunkSize < TIM::kCountFuncs) ? avtlChunkSize : (int)TIM::kCountFuncs; for (int i = 0; i < num; ++i) - tim->func[i].avtl = tim->avtl + tim->avtl[i]; + tim->func[i].avtl = tim->avtl + tim->avtl[i]; strncpy(tim->filename, filename, 13); @@ -328,7 +328,7 @@ void TIMInterpreter::setupTextPalette(uint index, int fadePalette) { palette[1] = c2; palette[2] = c3; } - + if (!fadePalette && !_palDiff) { _screen->setScreenPalette(_screen->getPalette(0)); } else { @@ -347,14 +347,14 @@ TIMInterpreter::Animation *TIMInterpreter::initAnimStruct(int index, const char char file[32]; snprintf(file, 32, "%s.WSA", filename); - + if (_vm->resource()->exists(file)) { anim->wsa = new WSAMovie_v2(_vm, _screen); assert(anim->wsa); anim->wsa->open(file, wsaOpenFlags, (index == 1) ? _screen->getPalette(0) : 0); } - + if (anim->wsa && anim->wsa->opened()) { if (x == -1) anim->x = x = 0; @@ -382,7 +382,7 @@ TIMInterpreter::Animation *TIMInterpreter::initAnimStruct(int index, const char anim->wsa->setY(y); anim->wsa->setDrawPage(0); anim->wsa->displayFrame(0, 0, 0, 0); - } + } if (wsaFlags & 2) _screen->fadePalette(_screen->getPalette(0), 30, 0); @@ -406,7 +406,7 @@ TIMInterpreter::Animation *TIMInterpreter::initAnimStruct(int index, const char if (wsaFlags & 2) _screen->fadePalette(_screen->getPalette(0), 30, 0); } - + return anim; } @@ -460,13 +460,13 @@ int TIMInterpreter::cmd_initWSA(const uint16 *param) { const int index = param[0]; TIM::WSASlot &slot = _currentTim->wsa[index]; - + slot.x = int16(param[2]); slot.y = int16(param[3]); slot.offscreen = param[4]; slot.wsaFlags = param[5]; const char *filename = (const char *)(_currentTim->text + READ_LE_UINT16(_currentTim->text + (param[1]<<1))); - + slot.anim = initAnimStruct(index, filename, slot.x, slot.y, 10, slot.offscreen, slot.wsaFlags); return 1; } @@ -475,12 +475,12 @@ int TIMInterpreter::cmd_uninitWSA(const uint16 *param) { const int index = param[0]; TIM::WSASlot &slot = _currentTim->wsa[index]; - + if (!slot.anim) return 0; - + Animation &anim = _animations[index]; - + if (slot.offscreen) { delete anim.wsa; anim.wsa = 0; @@ -492,7 +492,7 @@ int TIMInterpreter::cmd_uninitWSA(const uint16 *param) { memset(&anim, 0, sizeof(Animation)); memset(&slot, 0, sizeof(TIM::WSASlot)); } - + return 1; } @@ -516,7 +516,7 @@ int TIMInterpreter::cmd_stopFunc(const uint16 *param) { int TIMInterpreter::cmd_wsaDisplayFrame(const uint16 *param) { Animation &anim = _animations[param[0]]; const int frame = param[1]; - + anim.wsa->setX(anim.x); anim.wsa->setY(anim.y); anim.wsa->setDrawPage((anim.wsaCopyParams & 0x4000) != 0 ? 2 : 8); @@ -553,7 +553,7 @@ int TIMInterpreter::cmd_playVocFile(const uint16 *param) { _vm->sound()->voicePlay(_vocFiles[index].c_str()/*, volume*/, true); else _vm->snd_playSoundEffect(index, volume); - + return 1; } @@ -579,7 +579,7 @@ int TIMInterpreter::cmd_setLoopIp(const uint16 *param) { int TIMInterpreter::cmd_continueLoop(const uint16 *param) { TIM::Function &func = _currentTim->func[_currentFunc]; - + if (!func.loopIp) return -2; @@ -591,7 +591,7 @@ int TIMInterpreter::cmd_continueLoop(const uint16 *param) { uint32 waitTime = (random * factor) / 0x8000; func.nextTime += waitTime * _vm->tickLength(); } - + return 1; } diff --git a/engines/kyra/script_tim.h b/engines/kyra/script_tim.h index 68ef23fd6c..3299622a19 100644 --- a/engines/kyra/script_tim.h +++ b/engines/kyra/script_tim.h @@ -91,10 +91,10 @@ public: TIM *load(const char *filename, const Common::Array *opcodes); void unload(TIM *&tim) const; - + void setLangData(const char *filename); void clearLangData() { delete[] _langData; _langData = 0; } - + const char *getCTableEntry(uint idx) const; void resetFinishedFlag() { _finished = false; } @@ -104,7 +104,7 @@ public: void stopCurFunc() { if (_currentTim) cmd_stopCurFunc(0); } void refreshTimersAfterPause(uint32 elapsedTime); - + void displayText(uint16 textId, int16 flags); void setupTextPalette(uint index, int fadePalette); @@ -118,15 +118,15 @@ private: int _currentFunc; bool _finished; - + Common::String _vocFiles[120]; - + Animation _animations[TIM::kWSASlots]; - + Animation *initAnimStruct(int index, const char *filename, int x, int y, int, int offscreenBuffer, uint16 wsaFlags); - + char _audioFilename[32]; - + uint8 *_langData; char *getTableEntry(uint idx); bool _textDisplayed; diff --git a/engines/kyra/sequences_hof.cpp b/engines/kyra/sequences_hof.cpp index 7d0feaed16..7048225891 100644 --- a/engines/kyra/sequences_hof.cpp +++ b/engines/kyra/sequences_hof.cpp @@ -309,7 +309,7 @@ void KyraEngine_HoF::seq_playSequences(int startSeq, int endSeq) { _eventList.clear(); if (_menuChoice == 2) { - seqNum = kSequenceTitle; + seqNum = kSequenceTitle; _menuChoice = 0; } } @@ -319,7 +319,7 @@ void KyraEngine_HoF::seq_playSequences(int startSeq, int endSeq) { _eventList.clear(); _screen->fadeToBlack(); } - + if (!_menuChoice) delay(1200); @@ -1798,7 +1798,7 @@ int KyraEngine_HoF::seq_demoDig(WSAMovie_v2 *wsaObj, int x, int y, int frm) { int KyraEngine_HoF::seq_lolDemoScene1(WSAMovie_v2 *wsaObj, int x, int y, int frm) { uint8 *tmpPal = _screen->getPalette(2); - + if (!(_seqFrameCounter % 100)) { if (_seqFrameCounter == 0) { _sound->haltTrack(); @@ -1808,12 +1808,12 @@ int KyraEngine_HoF::seq_lolDemoScene1(WSAMovie_v2 *wsaObj, int x, int y, int frm for (int i = 3; i < 0x300; i++) { tmpPal[i] = ((int)tmpPal[i] * 120) / 64; if (tmpPal[i] > 0x3f) - tmpPal[i] = 0x3f; + tmpPal[i] = 0x3f; } seq_playTalkText(_rnd.getRandomBit()); _screen->setScreenPalette(tmpPal); _screen->updateScreen(); - delay(8); + delay(8); } else { _screen->setScreenPalette(_screen->getPalette(0)); _screen->updateScreen(); @@ -1853,7 +1853,7 @@ int KyraEngine_HoF::seq_lolDemoScene3(WSAMovie_v2 *wsaObj, int x, int y, int frm seq_playTalkText(6); else if (frm == 26) seq_playTalkText(7); - + _seqFrameCounter++; return frm; } @@ -1887,7 +1887,7 @@ int KyraEngine_HoF::seq_lolDemoScene4(WSAMovie_v2 *wsaObj, int x, int y, int frm default: break; } - + _seqFrameCounter++; return frm; } @@ -1929,7 +1929,7 @@ int KyraEngine_HoF::seq_lolDemoText5(WSAMovie_v2 *wsaObj, int x, int y, int frm) } int KyraEngine_HoF::seq_lolDemoScene6(WSAMovie_v2 *wsaObj, int x, int y, int frm) { - while (_seqScrollTextCounter < 0x122) { + while (_seqScrollTextCounter < 0x122) { _seqEndTime = _system->getMillis() + 6 * _tickLength; if (!_seqFrameCounter) { _screen->loadBitmap("adtext.cps", 4, 4, 0); @@ -1947,17 +1947,17 @@ int KyraEngine_HoF::seq_lolDemoScene6(WSAMovie_v2 *wsaObj, int x, int y, int frm for (int i = 3; i < 0x300; i++) { tmpPal[i] = ((int)tmpPal[i] * 120) / 64; if (tmpPal[i] > 0x3f) - tmpPal[i] = 0x3f; + tmpPal[i] = 0x3f; } seq_playTalkText(_rnd.getRandomBit()); _screen->setScreenPalette(tmpPal); _screen->updateScreen(); delay(8); } - + if (_seqFrameCounter == 40 || _seqFrameCounter == 80 || _seqFrameCounter == 150 || _seqFrameCounter == 300) seq_playTalkText(3); - + _screen->copyPage(12, 2); seq_scrollPage(70, 130); _screen->copyPage(2, 0); @@ -2767,7 +2767,7 @@ void KyraEngine_HoF::seq_scrollPage(int bottom, int top) { if (dstH > 0) { if (_demoAnimData) { for (int i = 0; i < 4; i++) { - const ItemAnimData_v1 *def = &_demoAnimData[i]; + const ItemAnimData_v1 *def = &_demoAnimData[i]; ActiveItemAnim *a = &_activeItemAnim[i]; _screen->fillRect(12, def->y - 8, 28, def->y + 8, 0, 4); @@ -2830,7 +2830,7 @@ void KyraEngine_HoF::seq_init() { _res->unloadAllPakFiles(); _res->loadPakFile(StaticResource::staticDataFilename()); _res->loadFileList(_sequencePakList, _sequencePakListSize); - + if (_flags.platform == Common::kPlatformPC98) _sound->loadSoundFile("sound.dat"); @@ -2851,7 +2851,7 @@ void KyraEngine_HoF::seq_init() { numShp++; addShapeToPool(_screen->getPtrToShape(_animShapeFiledata, numShp), numShp); } while (getShapePtr(numShp)); - } else { + } else { MainMenu::StaticData data = { { _sequenceStrings[97], _sequenceStrings[96], _sequenceStrings[95], _sequenceStrings[98], 0 }, { 0x01, 0x04, 0x0C, 0x04, 0x00, 0xd7, 0xd6 }, diff --git a/engines/kyra/sequences_mr.cpp b/engines/kyra/sequences_mr.cpp index f41ed9c2f3..eb4c881e55 100644 --- a/engines/kyra/sequences_mr.cpp +++ b/engines/kyra/sequences_mr.cpp @@ -50,7 +50,7 @@ void KyraEngine_MR::showBadConscience() { if (_goodConscienceShown) _badConsciencePosition = !_goodConsciencePosition; - + int anim = _badConscienceAnim + (_badConsciencePosition ? 0 : 8); TalkObject &talkObject = _talkObjectList[1]; @@ -118,7 +118,7 @@ void KyraEngine_MR::showGoodConscience() { _goodConscienceShown = true; ++_goodConscienceAnim; _goodConscienceAnim %= 5; - + setNextIdleAnimTimer(); _goodConsciencePosition = (_mainCharacter.x1 <= 160); @@ -214,7 +214,7 @@ void KyraEngine_MR::eelScript() { case 2: runAnimationScript("EELS03.EMC", 0, 0, 1, 1); break; - + case 3: runAnimationScript("EELS04.EMC", 0, 0, 1, 1); break; diff --git a/engines/kyra/sound.h b/engines/kyra/sound.h index b456e96185..fc2e38d114 100644 --- a/engines/kyra/sound.h +++ b/engines/kyra/sound.h @@ -222,7 +222,7 @@ protected: enum { kNumChannelHandles = 4 }; - + struct SoundChannel { Common::String file; Audio::SoundHandle channelHandle; @@ -438,7 +438,7 @@ public: virtual kType getMusicType() const { return kPC98; } bool init(); - + void process() {} void loadSoundFile(uint file) {} void loadSoundFile(Common::String) {} @@ -484,7 +484,7 @@ protected: uint8 *_musicTrackData; uint8 *_sfxTrackData; - TownsPC98_OpnDriver *_driver; + TownsPC98_OpnDriver *_driver; }; class MixedSoundDriver : public Sound { diff --git a/engines/kyra/sound_adlib.cpp b/engines/kyra/sound_adlib.cpp index 32b09ecd2d..1509f530a3 100644 --- a/engines/kyra/sound_adlib.cpp +++ b/engines/kyra/sound_adlib.cpp @@ -2311,7 +2311,7 @@ void SoundAdlibPC::play(uint8 track) { ++pauseCount; _vm->pauseEngine(false); } - + while ((_driver->callback(16, 0) & 8)) { // We call the system delay and not the game delay to avoid concurrency issues. _vm->_system->delayMillis(10); diff --git a/engines/kyra/sound_digital.cpp b/engines/kyra/sound_digital.cpp index 20f3a7f9f9..b21336e993 100644 --- a/engines/kyra/sound_digital.cpp +++ b/engines/kyra/sound_digital.cpp @@ -56,7 +56,7 @@ private: int32 _fadeSamples; int32 _fadeCount; int _fading; - + bool _endOfData; }; @@ -69,13 +69,13 @@ void KyraAudioStream::beginFadeOut(uint32 millis) { int KyraAudioStream::readBuffer(int16 *buffer, const int numSamples) { int samplesRead = _impl->readBuffer(buffer, numSamples); - + if (_fading) { int samplesProcessed = 0; for (; samplesProcessed < samplesRead; ++samplesProcessed) { // To help avoid overflows for long fade times, we divide both // _fadeSamples and _fadeCount when calculating the new sample. - + int32 div = _fadeSamples / 256; if (_fading) { *buffer = (*buffer * (_fadeCount / 256)) / div; @@ -429,7 +429,7 @@ int SoundDigital::playSound(const char *filename, uint8 priority, Audio::Mixer:: if (volume > 255) volume = 255; volume = (volume * Audio::Mixer::kMaxChannelVolume) / 255; - + if (type == Audio::Mixer::kSpeechSoundType && _vm->heliumMode()) use->stream->setRate(32765); diff --git a/engines/kyra/sound_midi.cpp b/engines/kyra/sound_midi.cpp index 357a1d1a0a..8870c2e516 100644 --- a/engines/kyra/sound_midi.cpp +++ b/engines/kyra/sound_midi.cpp @@ -176,7 +176,7 @@ void MidiOutput::send(uint32 b) { byte param2 = (b >> 16) & 0xFF; if (event == 0xE0) { // Pitch-Wheel - _channels[channel].pitchWheel = + _channels[channel].pitchWheel = _sources[_curSource].channelPW[channel] = (param2 << 8) | param1; } else if (event == 0xC0) { // Program change _channels[channel].program = @@ -382,7 +382,7 @@ int MidiOutput::lockChannel() { notes = _channels[i].noteCount; } } - + if (channel == -1) { if (flags & kChannelProtected) flags &= ~kChannelProtected; @@ -425,7 +425,7 @@ void MidiOutput::unlockChannel(int channel) { void MidiOutput::stopNotesOnChannel(int channel) { for (int i = 0; i < 4; ++i) { - SoundSource &sound = _sources[i]; + SoundSource &sound = _sources[i]; for (int j = 0; j < 32; ++j) { if (sound.notes[j].channel == channel) { sound.notes[j].channel = 0xFF; @@ -520,7 +520,7 @@ bool SoundMidiPC::init() { else pakFile = "INTROVOC.PAK"; } - + if (!midiFile) return true; @@ -701,7 +701,7 @@ void SoundMidiPC::onTimer(void *data) { for (int i = 0; i < 16; ++i) midi->_output->stopNotesOnChannel(i); for (int i = 0; i < 4; ++i) - midi->_output->deinitSource(i); + midi->_output->deinitSource(i); midi->_output->setSoundSource(0); midi->_music->stopPlaying(); diff --git a/engines/kyra/sound_towns.cpp b/engines/kyra/sound_towns.cpp index 34c2c9c490..5edf662bd4 100644 --- a/engines/kyra/sound_towns.cpp +++ b/engines/kyra/sound_towns.cpp @@ -1174,7 +1174,7 @@ void TownsPC98_OpnOperator::keyOn() { void TownsPC98_OpnOperator::keyOff() { if (!_playing) return; - + _playing = false; if (_state != s_ready) _state = s_releasing; @@ -1361,7 +1361,7 @@ public: virtual void fadeStep(); void reset(); - const uint8 _idFlag; + const uint8 _idFlag; protected: void setupVibrato(); @@ -1623,7 +1623,7 @@ protected: private: void nextTick(int32 *buffer, uint32 bufferSize); void generateOutput(int32 &leftSample, int32 &rightSample, int32 *del, int32 *feed); - + struct ChanInternal { uint16 frqTemp; bool enableLeft; @@ -1637,7 +1637,7 @@ private: TownsPC98_OpnSquareSineSource *_ssg; TownsPC98_OpnPercussionSource *_prc; ChanInternal *_chanInternal; - + uint8 *_oprRates; uint8 *_oprRateshift; uint8 *_oprAttackDecay; @@ -1653,7 +1653,7 @@ private: struct OpnTimer { bool enabled; uint16 value; - + int32 smpTillCb; uint32 smpTillCbRem; int32 smpPerCb; @@ -1699,7 +1699,7 @@ public: void timerCallbackB(); void timerCallbackA(); - + bool looping() { return _looping == _updateChannelsFlag ? true : false; } bool musicPlaying() { return _musicPlaying; } @@ -1751,7 +1751,7 @@ protected: uint16 _sfxOffsets[2]; static const uint8 _drvTables[]; - + bool _ready; }; @@ -1897,7 +1897,7 @@ void TownsPC98_OpnChannel::processEvents() { void TownsPC98_OpnChannel::processFrequency() { if (_flags & CHS_RECALCFREQ) { - + _frequency = (((const uint16*)_drv->_opnFreqTable)[_frqBlockMSB & 0x0f] + _frqLSB) | (((_frqBlockMSB & 0x70) >> 1) << 8); _drv->writeReg(_part, _regOffset + 0xa4, (_frequency >> 8)); @@ -1970,7 +1970,7 @@ void TownsPC98_OpnChannel::reset() { _ticksLeft = 1; _flags = (_flags & ~CHS_EOT) | CHS_ALLOFF; - + _totalLevel = 0; _algorithm = 0; _flags = CHS_EOT; @@ -1986,7 +1986,7 @@ void TownsPC98_OpnChannel::reset() { _ssgTargetLvl = 0; _ssgStep = 0; _ssgTicksLeft = 0; - + _vbrInitDelayHi = 0; _vbrInitDelayLo = 0; _vbrModInitVal = 0; @@ -2101,7 +2101,7 @@ bool TownsPC98_OpnChannel::control_f8_toggleVibrato(uint8 para) { uint8 skipChannels = para / 36; uint8 entry = para % 36; TownsPC98_OpnDriver::TownsPC98_OpnChannel *t = &chan[skipChannels]; - + t->unnamedEntries[entry] = *_dataPtr++;*/ } return true; @@ -2571,7 +2571,7 @@ TownsPC98_OpnSquareSineSource::TownsPC98_OpnSquareSineSource(const uint32 timerb _reg[7] = &_chanEnable; _reg[8] = &_channels[0].vol; _reg[9] = &_channels[1].vol; - _reg[10] = &_channels[2].vol; + _reg[10] = &_channels[2].vol; reset(); } @@ -2731,7 +2731,7 @@ void TownsPC98_OpnSquareSineSource::updatesRegs() { TownsPC98_OpnPercussionSource::TownsPC98_OpnPercussionSource(const uint32 timerbase) : _tickLength(timerbase * 2), _timer(0), _ready(false) { - + memset(_rhChan, 0, sizeof(RhtChannel) * 6); _reg = new uint8 *[40]; @@ -2908,7 +2908,7 @@ void TownsPC98_OpnPercussionSource::advanceInput(RhtChannel *ins) { 60, 66, 73, 80, 88, 97, 107, 118, 130, 143, 157, 173, 190, 209, 230, 253, 279, 307, 337, 371, 408, 449, 494, 544, 598, 658, 724, 796, 876, 963, 1060, 1166, 1282, 1411, 1552 }; - + uint8 cur = (int8) *ins->pos++; for (int i = 0; i < 2; i++) { @@ -2928,7 +2928,7 @@ TownsPC98_OpnCore::TownsPC98_OpnCore(Audio::Mixer *mixer, OpnType type) : _regProtectionFlag(false), _ready(false) { memset(&_timers[0], 0, sizeof(OpnTimer)); - memset(&_timers[1], 0, sizeof(OpnTimer)); + memset(&_timers[1], 0, sizeof(OpnTimer)); _timers[0].cb = &TownsPC98_OpnCore::timerCallbackA; _timers[1].cb = &TownsPC98_OpnCore::timerCallbackB; _timerbase = (uint32)(_baserate * 1000000.0f); @@ -2956,7 +2956,7 @@ bool TownsPC98_OpnCore::init() { } generateTables(); - + TownsPC98_OpnOperator **opr = new TownsPC98_OpnOperator*[_numChan << 2]; for (int i = 0; i < (_numChan << 2); i++) opr[i] = new TownsPC98_OpnOperator(_timerbase, _oprRates, _oprRateshift, _oprAttackDecay, _oprFrq, _oprSinTbl, _oprLevelOut, _oprDetune); @@ -2985,7 +2985,7 @@ bool TownsPC98_OpnCore::init() { return true; } -void TownsPC98_OpnCore::reset() { +void TownsPC98_OpnCore::reset() { for (int i = 0; i < _numChan; i++) { for (int ii = 0; ii < 4; ii++) _chanInternal[i].opr[ii]->reset(); @@ -3010,14 +3010,14 @@ void TownsPC98_OpnCore::writeReg(uint8 part, uint8 regAddress, uint8 value) { return; static const uint8 oprOrdr[] = { 0, 2, 1, 3 }; - + uint8 h = regAddress & 0xf0; uint8 l = (regAddress & 0x0f); ChanInternal *c = 0; TownsPC98_OpnOperator **co = 0; TownsPC98_OpnOperator *o = 0; - + if (regAddress > 0x2F) { c = &_chanInternal[(l & 3) + 3 * part]; co = c->opr; @@ -3052,7 +3052,7 @@ void TownsPC98_OpnCore::writeReg(uint8 part, uint8 regAddress, uint8 value) { _timers[0].value = (_timers[0].value & 0xff00) | value; } else if (l == 5) { // Timer A - _timers[0].value = (_timers[0].value & 0xff) | (value << 8); + _timers[0].value = (_timers[0].value & 0xff) | (value << 8); } else if (l == 6) { // Timer B _timers[1].value = value & 0xff; @@ -3071,12 +3071,12 @@ void TownsPC98_OpnCore::writeReg(uint8 part, uint8 regAddress, uint8 value) { if (value & 10) { _timers[0].smpTillCb = _timers[0].smpPerCb; _timers[0].smpTillCbRem = _timers[0].smpTillCbRem; - } + } if (value & 20) { _timers[1].smpTillCb = _timers[1].smpPerCb; _timers[1].smpTillCbRem = _timers[1].smpTillCbRem; - } + } } else if (l == 2) { // LFO warning("TownsPC98_OpnDriver: TRYING TO USE LFO (NOT SUPPORTED)"); @@ -3316,12 +3316,12 @@ void TownsPC98_OpnCore::nextTick(int32 *buffer, uint32 bufferSize) { for (uint32 ii = 0; ii < bufferSize ; ii++) { int32 phbuf1, phbuf2, output; phbuf1 = phbuf2 = output = 0; - + int32 *leftSample = &buffer[ii * 2]; int32 *rightSample = &buffer[ii * 2 + 1]; int32 *del = &_chanInternal[i].feedbuf[2]; int32 *feed = _chanInternal[i].feedbuf; - + switch (_chanInternal[i].algorithm) { case 0: o[0]->generateOutput(0, feed, phbuf1); @@ -3393,19 +3393,19 @@ void TownsPC98_OpnCore::nextTick(int32 *buffer, uint32 bufferSize) { } TownsPC98_OpnDriver::TownsPC98_OpnDriver(Audio::Mixer *mixer, OpnType type) : TownsPC98_OpnCore(mixer, type), - _channels(0), _ssgChannels(0), _sfxChannels(0), _rhythmChannel(0), - _trackPtr(0), _sfxData(0), _sfxOffs(0), _ssgPatches(0), + _channels(0), _ssgChannels(0), _sfxChannels(0), _rhythmChannel(0), + _trackPtr(0), _sfxData(0), _sfxOffs(0), _ssgPatches(0), _opnCarrier(_drvTables + 76), _opnFreqTable(_drvTables + 108), _opnFreqTableSSG(_drvTables + 132), _opnFxCmdLen(_drvTables + 36), _opnLvlPresets(_drvTables + (type == OD_TOWNS ? 52 : 84)), - + _updateChannelsFlag(type == OD_TYPE26 ? 0x07 : 0x3F), _finishedChannelsFlag(0), _updateSSGFlag(type == OD_TOWNS ? 0x00 : 0x07), _finishedSSGFlag(0), _updateRhythmFlag(type == OD_TYPE86 ? 0x01 : 0x00), _finishedRhythmFlag(0), _updateSfxFlag(type == OD_TOWNS ? 0x00 : 0x06), _finishedSfxFlag(0), - + _musicTickCounter(0), - + _musicPlaying(false), _sfxPlaying(false), _fading(false), _looping(0), _ready(false) { } @@ -3526,7 +3526,7 @@ void TownsPC98_OpnDriver::loadMusicData(uint8 *data, bool loadPaused) { _patches = src_a + 4; _finishedChannelsFlag = _finishedSSGFlag = _finishedRhythmFlag = 0; - _musicPlaying = (loadPaused ? false : true); + _musicPlaying = (loadPaused ? false : true); unlock(); } @@ -3596,7 +3596,7 @@ void TownsPC98_OpnDriver::fadeStep() { if (_updateChannelsFlag & _channels[j]->_idFlag) _channels[j]->fadeStep(); } - + for (int j = 0; j < _numSSG; j++) { if (_updateSSGFlag & _ssgChannels[j]->_idFlag) _ssgChannels[j]->fadeStep(); @@ -3637,7 +3637,7 @@ void TownsPC98_OpnDriver::timerCallbackB() { _ssgChannels[i]->processFrequency(); } } - + if (_hasPercussion) if (_updateRhythmFlag & _rhythmChannel->_idFlag) _rhythmChannel->processEvents(); @@ -4139,7 +4139,7 @@ bool SoundTownsPC98_v2::init() { if (_musicEnabled && (res->exists("track1.mp3") || res->exists("track1.ogg") || res->exists("track1.flac") || res->exists("track1.fla"))) _musicEnabled = 2; - + return _driver->init(); } diff --git a/engines/kyra/staticres.cpp b/engines/kyra/staticres.cpp index 6653a6b47e..f97f5c808a 100644 --- a/engines/kyra/staticres.cpp +++ b/engines/kyra/staticres.cpp @@ -777,7 +777,7 @@ bool StaticResource::loadHofSequenceData(const char *filename, void *&ptr, int & tmp_f[ii].index = file->readUint16BE(); tmp_f[ii].delay = file->readUint16BE(); } - + tmp_n[i].wsaControl = (const FrameControl*) tmp_f; size += (num_c * sizeof(FrameControl)); @@ -807,7 +807,7 @@ bool StaticResource::loadShapeAnimData_v1(const char *filename, void *&ptr, int if (!file) return false; - size = file->readByte(); + size = file->readByte(); ItemAnimData_v1 *loadTo = new ItemAnimData_v1[size]; assert(loadTo); @@ -1251,7 +1251,7 @@ void KyraEngine_HoF::initStaticResource() { _sequencePakList = _staticres->loadStrings(k2SeqplayPakFiles, _sequencePakListSize); _ingamePakList = _staticres->loadStrings(k2IngamePakFiles, _ingamePakListSize); - _sequenceStrings = _staticres->loadStrings(k2SeqplayStrings, _sequenceStringsSize); + _sequenceStrings = _staticres->loadStrings(k2SeqplayStrings, _sequenceStringsSize); _ingameSoundList = _staticres->loadStrings(k2IngameSfxFiles, _ingameSoundListSize); _ingameSoundIndex = (const uint16 *)_staticres->loadRawData(k2IngameSfxIndex, _ingameSoundIndexSize); _musicFileListIntro = _staticres->loadStrings(k2SeqplayIntroTracks, _musicFileListIntroSize); @@ -1395,9 +1395,9 @@ void KyraEngine_MR::initStaticResource() { int tmp = 0; _mainMenuStrings = _staticres->loadStrings(k3MainMenuStrings, _mainMenuStringsSize); _soundList = _staticres->loadStrings(k3MusicFiles, _soundListSize); - _scoreTable = _staticres->loadRawData(k3ScoreTable, _scoreTableSize); + _scoreTable = _staticres->loadRawData(k3ScoreTable, _scoreTableSize); _sfxFileList = _staticres->loadStrings(k3SfxFiles, _sfxFileListSize); - _sfxFileMap = _staticres->loadRawData(k3SfxMap, _sfxFileMapSize); + _sfxFileMap = _staticres->loadRawData(k3SfxMap, _sfxFileMapSize); _itemAnimData = _staticres->loadShapeAnimData_v2(k3ItemAnimData, tmp); _itemMagicTable = _staticres->loadRawData(k3ItemMagicTable, tmp); _itemStringMap = _staticres->loadRawData(k3ItemStringMap, _itemStringMapSize); @@ -1499,13 +1499,13 @@ void GUI_LoK::initStaticResource() { _menu[0].item[2].callback = BUTTON_FUNCTOR(GUI_LoK, this, &GUI_LoK::gameControlsMenu); _menu[0].item[3].callback = quitPlayingFunctor; _menu[0].item[4].callback = BUTTON_FUNCTOR(GUI_LoK, this, &GUI_LoK::resumeGame); - + GUI_V1_MENU(_menu[1], -1, -1, 0x140, 0x38, 248, 249, 250, 0, 254,-1, 8, 0, 2, -1, -1, -1, -1); GUI_V1_MENU_ITEM(_menu[1].item[0], 1, 0, 0, 0, 0x18, 0, 0x1E, 0x48, 0x0F, 252, 253, -1, 255, 248, 249, 250, -1, 0, 0, 0, 0, 0); GUI_V1_MENU_ITEM(_menu[1].item[1], 1, 0, 0, 0, 0xD8, 0, 0x1E, 0x48, 0x0F, 252, 253, -1, 255, 248, 249, 250, -1, 0, 0, 0, 0, 0); _menu[1].item[0].callback = BUTTON_FUNCTOR(GUI_LoK, this, &GUI_LoK::quitConfirmYes); _menu[1].item[1].callback = BUTTON_FUNCTOR(GUI_LoK, this, &GUI_LoK::quitConfirmNo); - + GUI_V1_MENU(_menu[2], -1, -1, 0x120, 0xA0, 248, 249, 250, 0, 251, -1, 8, 0, 6, 132, 22, 132, 124); GUI_V1_MENU_ITEM(_menu[2].item[0], 1, 0, 0, 0, -1, 255, 0x27, 0x100, 0x0F, 252, 253, 5, 0, 248, 249, 250, -1, 0, 0, 0, 0, 0); GUI_V1_MENU_ITEM(_menu[2].item[1], 1, 0, 0, 0, -1, 255, 0x38, 0x100, 0x0F, 252, 253, 5, 0, 248, 249, 250, -1, 0, 0, 0, 0, 0); @@ -1514,13 +1514,13 @@ void GUI_LoK::initStaticResource() { GUI_V1_MENU_ITEM(_menu[2].item[4], 1, 0, 0, 0, -1, 255, 0x6B, 0x100, 0x0F, 252, 253, 5, 0, 248, 249, 250, -1, 0, 0, 0, 0, 0); GUI_V1_MENU_ITEM(_menu[2].item[5], 1, 0, 0, 0, 0xB8, 0, 0x86, 0x58, 0x0F, 252, 253, -1, 255, 248, 249, 250, -1, 0, 0, 0, 0, 0); _menu[2].item[5].callback = cancelSubMenuFunctor; - + GUI_V1_MENU(_menu[3], -1, -1, 288, 67, 248, 249, 250, 0, 251, -1, 8, 0, 2, -1, -1, -1, -1); GUI_V1_MENU_ITEM(_menu[3].item[0], 1, 0, 0, 0, 24, 0, 44, 85, 15, 252, 253, -1, 255, 248, 249, 250, -1, 0, 0, 0, 0, 0); GUI_V1_MENU_ITEM(_menu[3].item[1], 1, 0, 0, 0, 179, 0, 44, 85, 15, 252, 253, -1, 255, 248, 249, 250, -1, 0, 0, 0, 0, 0); _menu[3].item[0].callback = BUTTON_FUNCTOR(GUI_LoK, this, &GUI_LoK::savegameConfirm); _menu[3].item[1].callback = cancelSubMenuFunctor; - + GUI_V1_MENU(_menu[4], -1, -1, 0xD0, 0x4C, 248, 249, 250, 0, 251, -1, 8, 0, 2, -1, -1, -1, -1); GUI_V1_MENU_ITEM(_menu[4].item[0], 1, 0, 0, 0, -1, -1, 0x1E, 0xB4, 0x0F, 252, 253, -1, 0, 248, 249, 250, -1, 0, 0, 0, 0, 0); GUI_V1_MENU_ITEM(_menu[4].item[1], 1, 0, 0, 0, -1, -1, 0x2F, 0xB4, 0x0F, 252, 253, -1, 0, 248, 249, 250, -1, 0, 0, 0, 0, 0); @@ -1917,7 +1917,7 @@ void GUI_HoF::initStaticData() { _choiceMenu.item[i].enabled = false; for (int i = 0; i < 7; ++i) _choiceMenu.item[i].itemId = menuStr[3 * 8 + i + 1]; - + GUI_V2_MENU(_loadMenu, -1, -1, 0x120, 0xA0, 0xF8, 0xF9, 0xFA, menuStr[4 * 8], 0xFB, -1, 8, 0, 6, 0x84, 0x16, 0x84, 0x7C); GUI_V2_MENU_ITEM(_loadMenu.item[0], 1, 0x29, -1, 0x27, 0x100, 0xF, 0xFC, 0xFD, 5, 0xF8, 0xF9, 0xFA, -1, 0, 0, 0, 0); GUI_V2_MENU_ITEM(_loadMenu.item[1], 1, 0x2A, -1, 0x38, 0x100, 0xF, 0xFC, 0xFD, 5, 0xF8, 0xF9, 0xFA, -1, 0, 0, 0, 0); @@ -2103,7 +2103,7 @@ const char *KyraEngine_MR::_languageExtension[] = { "TRF", "TRG"/*, "TRI", Italian and Spanish were never included, the supported fan translations are using - "TRS" English/French extensions thus overwriting these languages */ + "TRS" English/French extensions thus overwriting these languages */ }; const int KyraEngine_MR::_languageExtensionSize = ARRAYSIZE(KyraEngine_MR::_languageExtension); diff --git a/engines/kyra/text_mr.cpp b/engines/kyra/text_mr.cpp index 41b4c30245..dc3e1235c6 100644 --- a/engines/kyra/text_mr.cpp +++ b/engines/kyra/text_mr.cpp @@ -58,8 +58,8 @@ char *TextDisplayer_MR::preprocessString(const char *str) { offs = dropCRIntoString(p, count, getCharLength(p, maxTextWidth)); p += count + offs; // No update of textWidth here - } - + } + if (textWidth > (2*maxTextWidth)) { count = getCharLength(p, textWidth/3); offs = dropCRIntoString(p, count, getCharLength(p, maxTextWidth)); @@ -68,13 +68,13 @@ char *TextDisplayer_MR::preprocessString(const char *str) { } count = getCharLength(p, textWidth/2); - offs = dropCRIntoString(p, count, getCharLength(p, maxTextWidth)); + offs = dropCRIntoString(p, count, getCharLength(p, maxTextWidth)); p += count + offs; textWidth = _screen->getTextWidth(p); if (textWidth > maxTextWidth) { count = getCharLength(p, textWidth/2); - offs = dropCRIntoString(p, count, getCharLength(p, maxTextWidth)); + offs = dropCRIntoString(p, count, getCharLength(p, maxTextWidth)); } } @@ -250,7 +250,7 @@ void KyraEngine_MR::objectChatInit(const char *str, int object, int vocHigh, int debugC(9, kDebugLevelMain, "KyraEngine_MR::objectChatInit('%s', %d, %d, %d)", str, object, vocHigh, vocLow); str = _text->preprocessString(str); int lineNum = _text->buildMessageSubstrings(str); - + int xPos = 0, yPos = 0; if (!object) { @@ -508,7 +508,7 @@ void KyraEngine_MR::albumChat(const char *str, int vocHigh, int vocLow) { _talkObjectList[1].x = 190; _talkObjectList[1].y = 188; - + _chatVocHigh = _chatVocLow = -1; _albumChatActive = true; albumChatInit(str, 1, vocHigh, vocLow); @@ -543,7 +543,7 @@ void KyraEngine_MR::albumChatInit(const char *str, int object, int vocHigh, int str = _text->preprocessString(str); int lineNum = _text->buildMessageSubstrings(str); - + int xPos = 0, yPos = 0; if (!object) { @@ -670,7 +670,7 @@ void KyraEngine_MR::updateDlgBuffer() { snprintf(dlgFile, 16, "CH%.02d-S%.02d.", _currentChapter, _mainCharacter.dlgIndex); appendLanguage(dlgFile, _lang, 16); snprintf(cnvFile, 16, "CH%.02d-S%.02d.CNV", _currentChapter, _mainCharacter.dlgIndex); - + delete _cnvFile; delete _dlgBuffer; @@ -750,7 +750,7 @@ void KyraEngine_MR::processDialog(int vocHighIndex, int vocHighBase, int funcNum while (running) { uint16 cmd = _cnvFile->readUint16LE(); int object = cmd - 12; - + if (cmd == 10) { break; } else if (cmd == 4) { @@ -901,12 +901,12 @@ void KyraEngine_MR::randomSceneChat() { void KyraEngine_MR::runDialog(int dlgIndex, int funcNum) { debugC(9, kDebugLevelMain, "KyraEngine_MR::runDialog(%d, %d)", dlgIndex, funcNum); - + switch (_currentChapter-2) { case 0: dlgIndex -= 34; break; - + case 1: dlgIndex -= 54; break; diff --git a/engines/kyra/timer.cpp b/engines/kyra/timer.cpp index 777871d65a..da7e22f684 100644 --- a/engines/kyra/timer.cpp +++ b/engines/kyra/timer.cpp @@ -199,7 +199,7 @@ void TimerManager::setNextRun(uint8 id, uint32 nextRun) { Iterator timer = Common::find_if(_timers.begin(), _timers.end(), TimerEqual(id)); if (timer != _timers.end()) { - timer->nextRun = nextRun; + timer->nextRun = nextRun; return; } diff --git a/engines/kyra/vqa.cpp b/engines/kyra/vqa.cpp index 0f6440fd47..851f36f742 100644 --- a/engines/kyra/vqa.cpp +++ b/engines/kyra/vqa.cpp @@ -657,7 +657,7 @@ void VQAMovie::play() { if (_vm->_mixer->isSoundHandleActive(_sound)) elapsedTime = _vm->_mixer->getSoundElapsedTime(_sound); - else + else elapsedTime = _system->getMillis() - startTick; if (elapsedTime >= (i * 1000) / _header.frameRate) diff --git a/engines/kyra/wsamovie.cpp b/engines/kyra/wsamovie.cpp index 110755c3ba..818f3c691f 100644 --- a/engines/kyra/wsamovie.cpp +++ b/engines/kyra/wsamovie.cpp @@ -503,7 +503,7 @@ void WSAMovie_v2::displayFrame(int frameNum, ...) { const uint8 *unkPtr1 = va_arg(args, const uint8*); const uint8 *unkPtr2 = va_arg(args, const uint8*); va_end(args); - + _screen->copyWsaRect(_x, _y, _width, _height, 0, plotFunc, _offscreenBuffer, unk1, unkPtr1, unkPtr2); _screen->_curPage = pageBackUp; diff --git a/engines/lure/detection.cpp b/engines/lure/detection.cpp index 5749e96bde..cb1f21ba9c 100644 --- a/engines/lure/detection.cpp +++ b/engines/lure/detection.cpp @@ -226,7 +226,7 @@ SaveStateList LureMetaEngine::listSaves(const char *target) const { for (Common::StringList::const_iterator file = filenames.begin(); file != filenames.end(); ++file) { // Obtain the last 3 digits of the filename, since they correspond to the save slot int slotNum = atoi(file->c_str() + file->size() - 3); - + if (slotNum >= 0 && slotNum <= 999) { Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str()); if (in) { diff --git a/engines/lure/game.cpp b/engines/lure/game.cpp index cf3d4ac125..860c64be35 100644 --- a/engines/lure/game.cpp +++ b/engines/lure/game.cpp @@ -138,12 +138,12 @@ void Game::execute() { screen.empty(); screen.setPaletteEmpty(); - + bool _loadSavegame = false; - + if (engine.gameToLoad() != -1) _loadSavegame = engine.loadGame(engine.gameToLoad()); - + if (!_loadSavegame) { // Flag for starting game setState(GS_RESTART); diff --git a/engines/lure/hotspots.cpp b/engines/lure/hotspots.cpp index 8c9a20ba7e..772baea6fb 100644 --- a/engines/lure/hotspots.cpp +++ b/engines/lure/hotspots.cpp @@ -2277,7 +2277,7 @@ void Hotspot::startTalk(HotspotData *charHotspot, uint16 id) { void Hotspot::saveToStream(Common::WriteStream *stream) { if (_data) _data->npcSchedule.saveToStream(stream); - else + else // Hotspot doesn't have an underlying data object, so write out an empty actions list stream->writeByte(0xff); @@ -2322,7 +2322,7 @@ void Hotspot::saveToStream(Common::WriteStream *stream) { void Hotspot::loadFromStream(Common::ReadStream *stream) { if (_data) _data->npcSchedule.loadFromStream(stream); - else + else // Dummy read of terminator for empty actions list assert(stream->readByte() == 0xff); diff --git a/engines/lure/intro.cpp b/engines/lure/intro.cpp index a4676984c6..c2b84001fc 100644 --- a/engines/lure/intro.cpp +++ b/engines/lure/intro.cpp @@ -61,7 +61,7 @@ bool Introduction::showScreen(uint16 screenId, uint16 paletteId, uint16 delaySiz Palette p(paletteId); if (LureEngine::getReference().shouldQuit()) return true; - + if (isEGA) screen.setPalette(&p); else screen.paletteFadeIn(&p); diff --git a/engines/lure/lure.cpp b/engines/lure/lure.cpp index 13173c8a96..e90059fa9b 100644 --- a/engines/lure/lure.cpp +++ b/engines/lure/lure.cpp @@ -118,14 +118,14 @@ LureEngine &LureEngine::getReference() { Common::Error LureEngine::go() { Game *gameInstance = new Game(); - + // If requested, load a savegame instead of showing the intro if (ConfMan.hasKey("save_slot")) { _gameToLoad = ConfMan.getInt("save_slot"); if (_gameToLoad < 0 || _gameToLoad > 999) _gameToLoad = -1; } - + if (_gameToLoad == -1) { if (ConfMan.getBool("copy_protection")) { CopyProtectionDialog *dialog = new CopyProtectionDialog(); @@ -249,7 +249,7 @@ void LureEngine::GUIError(const char *msg, ...) { GUIErrorMessage(buffer); } -void LureEngine::syncSoundSettings() { +void LureEngine::syncSoundSettings() { Sound.syncSounds(); } diff --git a/engines/lure/res_struct.cpp b/engines/lure/res_struct.cpp index 1c4fe883d0..7f97e533c1 100644 --- a/engines/lure/res_struct.cpp +++ b/engines/lure/res_struct.cpp @@ -785,7 +785,7 @@ void SequenceDelayList::add(uint16 delay, uint16 seqOffset, bool canClear) { void SequenceDelayList::tick() { SequenceDelayList::iterator i; - debugC(ERROR_DETAILED, kLureDebugScripts, "Delay List check start at time %d", + debugC(ERROR_DETAILED, kLureDebugScripts, "Delay List check start at time %d", g_system->getMillis()); for (i = begin(); i != end(); i++) { @@ -1221,7 +1221,7 @@ void BarmanLists::loadFromStream(Common::ReadStream *stream) { reset(); for (int index = 0; index < numEntries; ++index) { int16 value = stream->readUint16LE(); - _barList[index].currentCustomer = ((value < 1) || (value > NUM_SERVE_CUSTOMERS)) ? NULL : + _barList[index].currentCustomer = ((value < 1) || (value > NUM_SERVE_CUSTOMERS)) ? NULL : &_barList[index].customers[value - 1]; for (int ctr = 0; ctr < NUM_SERVE_CUSTOMERS; ++ctr) { diff --git a/engines/lure/sound.cpp b/engines/lure/sound.cpp index 569058b282..ab43b3619a 100644 --- a/engines/lure/sound.cpp +++ b/engines/lure/sound.cpp @@ -598,7 +598,7 @@ MidiMusic::MidiMusic(MidiDriver *driver, ChannelEntry channels[NUM_CHANNELS], if (_isMusic) setVolume(ConfMan.getInt("music_volume")); else - setVolume(ConfMan.getInt("sfx_volume")); + setVolume(ConfMan.getInt("sfx_volume")); _passThrough = false; diff --git a/engines/m4/actor.cpp b/engines/m4/actor.cpp index c7c90ac3ae..ab670f5a55 100644 --- a/engines/m4/actor.cpp +++ b/engines/m4/actor.cpp @@ -101,7 +101,7 @@ void Actor::unloadWalkers() { } void Actor::setWalkerPalette() { - _vm->_palette->setPalette(_walkerSprites[kFacingSouthEast]->getPalette(), 0, + _vm->_palette->setPalette(_walkerSprites[kFacingSouthEast]->getPalette(), 0, _walkerSprites[kFacingSouthEast]->getColorCount()); } @@ -157,7 +157,7 @@ void Inventory::removeFromBackpack(uint32 objectIndex) { _vm->_interfaceView->inventoryRemove(_inventory[objectIndex]->name); } -bool Inventory::isInCurrentScene(char* name) { +bool Inventory::isInCurrentScene(char* name) { return (getScene(name) == _vm->_scene->getCurrentScene()); } @@ -195,8 +195,8 @@ void Inventory::clear() { for (uint i = 0; i < _inventory.size(); i++) { delete _inventory[i]->name; delete _inventory[i]; - _inventory.remove_at(i); + _inventory.remove_at(i); } } - + } // End of namespace M4 diff --git a/engines/m4/actor.h b/engines/m4/actor.h index a39398db55..4bf212b2cc 100644 --- a/engines/m4/actor.h +++ b/engines/m4/actor.h @@ -86,7 +86,7 @@ private: // TODO: the original game capitalizes all inventory object names // internally, which we do as well, but perhaps we could make sure // that all object names are parsed with the same case and avoid -// case-insensitive string comparing through scumm_stricmp, using +// case-insensitive string comparing through scumm_stricmp, using // the normal strcmp method instead class Inventory { public: diff --git a/engines/m4/animation.cpp b/engines/m4/animation.cpp index 6c9d90a3d2..4b063241fc 100644 --- a/engines/m4/animation.cpp +++ b/engines/m4/animation.cpp @@ -74,7 +74,7 @@ void Animation::load(const char *filename) { //printf("%03d: %s\n", i, _spriteSeriesNames[i].c_str()); spriteSeriesStream = _vm->res()->get(_spriteSeriesNames[i].c_str()); - _spriteSeries = new SpriteAsset(_vm, spriteSeriesStream, + _spriteSeries = new SpriteAsset(_vm, spriteSeriesStream, spriteSeriesStream->size(), _spriteSeriesNames[i].c_str()); _vm->res()->toss(_spriteSeriesNames[i].c_str()); @@ -101,7 +101,7 @@ void Animation::load(const char *filename) { //printf("Chunk 1, size %i\n", animStream->size()); _frameEntries = new AnimationFrame[_frameEntryCount]; - + for (int i = 0; i < _frameEntryCount; i++) { frame.animFrameIndex = animStream->readUint16LE(); @@ -112,7 +112,7 @@ void Animation::load(const char *filename) { frame.y = animStream->readUint16LE(); frame.v = animStream->readByte(); frame.w = animStream->readByte(); - + _frameEntries[i] = frame; /* @@ -187,7 +187,7 @@ bool Animation::updateAnim() { //printf("_curFrameEntry = %d\n", _curFrameEntry); _curFrameEntry++; } - + //printf("_curFrame = %d\n", _curFrame); _curFrame++; diff --git a/engines/m4/animation.h b/engines/m4/animation.h index 6aafc53310..d11765facf 100644 --- a/engines/m4/animation.h +++ b/engines/m4/animation.h @@ -51,7 +51,7 @@ class Animation { void start(); bool updateAnim(); void stop(); - + private: bool _playing; M4Engine *_vm; diff --git a/engines/m4/assets.cpp b/engines/m4/assets.cpp index 0488f17d8f..1dbf9e79c7 100644 --- a/engines/m4/assets.cpp +++ b/engines/m4/assets.cpp @@ -152,7 +152,7 @@ void SpriteAsset::loadM4SpriteAsset(M4Engine *vm, Common::SeekableReadStream* st // Load & unpack RLE data if it's not a streaming animation if (frame.stream != 1) { - + frame.frame = new M4Sprite(stream, frame.x, frame.y, frame.w, frame.h, true, frame.comp); #if 0 char fn[512]; @@ -191,7 +191,7 @@ void SpriteAsset::loadMadsSpriteAsset(M4Engine *vm, Common::SeekableReadStream* int numColors = 0; RGB8 *palData = Palette::decodeMadsPalette(spriteStream, &numColors); Common::copy(palData, &palData[numColors], &_palette[0]); - if (numColors < 256) + if (numColors < 256) Common::set_to((byte *)&_palette[numColors], (byte *)&_palette[256], 0); _colorCount = numColors; delete[] palData; @@ -241,7 +241,7 @@ int32 SpriteAsset::parseSprite(bool isBigEndian) { uint32 numColors = (!isBigEndian) ? _stream->readUint32LE() : _stream->readUint32BE(); // TODO //if (palette) { - // TODO: A sprite set palette specifies the indexes, which need not start at + // TODO: A sprite set palette specifies the indexes, which need not start at // index 0. For now, I'm simply preloading the currently active palette // before starting to replace existing entries @@ -321,7 +321,7 @@ RGBList *SpriteAsset::getRgbList() { } void SpriteAsset::translate(RGBList *list, bool isTransparent) { - for (int frameIndex = 0; frameIndex < _frameCount; ++frameIndex) + for (int frameIndex = 0; frameIndex < _frameCount; ++frameIndex) _frames[frameIndex].frame->translate(list, isTransparent); } @@ -329,7 +329,7 @@ int32 SpriteAsset::getFrameSize(int index) { /* if (index + 1 == _frameCount) { } else { - + } */ return _frameOffsets[index + 1] - _frameOffsets[index]; @@ -417,7 +417,7 @@ bool AssetManager::loadAsset(const char *assetName, RGB8 *palette) { // Until loading code is complete, so that chunks not fully read are skipped correctly uint32 nextOfs = assetS->pos() + chunkSize; - + switch (chunkType) { case CHUNK_MACH: printf("MACH\n"); @@ -484,7 +484,7 @@ int32 AssetManager::addSpriteAsset(const char *assetName, int32 hash, RGB8 *pale printf("AssetManager::addSpriteAsset() asset %s not loaded, loading into %d\n", assetName, hash); clearAssets(kAssetTypeCELS, hash, hash); - + Common::SeekableReadStream *assetS = _vm->res()->get(assetName); _CELS[hash] = new SpriteAsset(_vm, assetS, assetS->size(), assetName); _vm->res()->toss(assetName); diff --git a/engines/m4/assets.h b/engines/m4/assets.h index efc9afed83..a1d5d2b0c3 100644 --- a/engines/m4/assets.h +++ b/engines/m4/assets.h @@ -31,7 +31,7 @@ #include "m4/sprite.h" namespace M4 { - + // Sequence chunks #define CHUNK_SCEN MKID_BE('SCEN') #define CHUNK_MACH MKID_BE('MACH') diff --git a/engines/m4/compression.cpp b/engines/m4/compression.cpp index 7dbb11f685..543fbd1fef 100644 --- a/engines/m4/compression.cpp +++ b/engines/m4/compression.cpp @@ -36,7 +36,7 @@ bool MadsPack::isCompressed(Common::SeekableReadStream *stream) { char tempBuffer[8]; stream->seek(0); if (stream->read(tempBuffer, 8) == 8) { - if (!strncmp(tempBuffer, madsPackString, 8)) + if (!strncmp(tempBuffer, madsPackString, 8)) return true; } @@ -60,7 +60,7 @@ void MadsPack::initialise(Common::SeekableReadStream *stream) { stream->seek(14); _count = stream->readUint16LE(); _items = new MadsPackEntry[_count]; - + byte *headerData = new byte[0xA0]; byte *header = headerData; stream->read(headerData, 0xA0); @@ -79,7 +79,7 @@ void MadsPack::initialise(Common::SeekableReadStream *stream) { // Decompress the entry byte *compressedData = new byte[_items[i].compressedSize]; stream->read(compressedData, _items[i].compressedSize); - + FabDecompressor fab; fab.decompress(compressedData, _items[i].compressedSize, _items[i].data, _items[i].size); delete[] compressedData; @@ -102,7 +102,7 @@ void FabDecompressor::decompress(const byte *srcData, int srcSize, byte *destDat byte copyLen, copyOfsShift, copyOfsMask, copyLenMask; unsigned long copyOfs; byte *destP; - + // Validate that the data starts with the FAB header if (strncmp((const char *)srcData, "FAB", 3) != 0) error("FabDecompressor - Invalid compressed data"); @@ -121,7 +121,7 @@ void FabDecompressor::decompress(const byte *srcData, int srcSize, byte *destDat _srcData = srcData; _srcP = _srcData + 6; _srcSize = srcSize; - _bitsLeft = 16; + _bitsLeft = 16; _bitBuffer = READ_LE_UINT16(srcData + 4); for (;;) { diff --git a/engines/m4/console.cpp b/engines/m4/console.cpp index ccf6d98f33..1950371edd 100644 --- a/engines/m4/console.cpp +++ b/engines/m4/console.cpp @@ -170,9 +170,9 @@ bool Console::cmdDumpFile(int argc, const char **argv) { bool Console::cmdShowSprite(int argc, const char **argv) { View *view = _vm->_viewManager->getView(VIEWID_SCENE); - if (view == NULL) + if (view == NULL) DebugPrintf("The scene view isn't currently active\n"); - else if (argc < 2) + else if (argc < 2) DebugPrintf("Usage: %s resource_name\n", argv[0]); else { char resourceName[20]; @@ -188,7 +188,7 @@ bool Console::cmdShowSprite(int argc, const char **argv) { RGBList *palData = new RGBList(asset->getColorCount(), asset->getPalette(), true); _vm->_palette->addRange(palData); - + // Get the scene background surface M4Surface *bg = _vm->_scene->getBackgroundSurface(); diff --git a/engines/m4/converse.cpp b/engines/m4/converse.cpp index 11131783e2..5567c8888a 100644 --- a/engines/m4/converse.cpp +++ b/engines/m4/converse.cpp @@ -39,7 +39,7 @@ namespace M4 { #define CONV_ENTRIES_HEIGHT 20 #define CONV_MAX_SHOWN_ENTRIES 5 -#define CONVERSATION_ENTRY_HIGHLIGHTED 22 +#define CONVERSATION_ENTRY_HIGHLIGHTED 22 #define CONVERSATION_ENTRY_NORMAL 3 // Conversation chunks @@ -75,7 +75,7 @@ namespace M4 { #define CHUNK_WPRL MKID_BE('WPRL') // weighted preply chunk -ConversationView::ConversationView(M4Engine *vm): View(vm, Common::Rect(0, +ConversationView::ConversationView(M4Engine *vm): View(vm, Common::Rect(0, vm->_screen->height() - INTERFACE_HEIGHT, vm->_screen->width(), vm->_screen->height())) { _screenType = VIEWID_CONVERSATION; @@ -110,7 +110,7 @@ void ConversationView::setNode(int32 nodeIndex) { continue; if ((int)_activeItems.size() > CONV_MAX_SHOWN_ENTRIES) { - warning("TODO: scrolling. Max shown entries are %i, skipping entry %i", + warning("TODO: scrolling. Max shown entries are %i, skipping entry %i", CONV_MAX_SHOWN_ENTRIES, i); } @@ -124,7 +124,7 @@ void ConversationView::setNode(int32 nodeIndex) { } // Figure out the longest string to determine where option highlighting ends - int tempX = _vm->_font->getWidth(node->entries[i]->text, 0) + + int tempX = _vm->_font->getWidth(node->entries[i]->text, 0) + CONV_ENTRIES_X_OFFSET + 10; _xEnd = MAX(_xEnd, tempX); } @@ -134,7 +134,7 @@ void ConversationView::setNode(int32 nodeIndex) { // Fallthrough if (node->fallthroughMinEntries >= 0 && node->fallthroughOffset >= 0) { - //printf("Current node falls through node at offset %i when entries are less or equal than %i\n", + //printf("Current node falls through node at offset %i when entries are less or equal than %i\n", // node->fallthroughOffset, node->fallthroughMinEntries); if (_activeItems.size() <= (uint32)node->fallthroughMinEntries) { const EntryInfo *entryInfo = _vm->_converse->getEntryInfo(node->fallthroughOffset); @@ -166,7 +166,7 @@ void ConversationView::onRefresh(RectList *rects, M4Surface *destSurface) { _vm->_font->setColor((_highlightedIndex == i) ? CONVERSATION_ENTRY_HIGHLIGHTED : CONVERSATION_ENTRY_NORMAL); - _vm->_font->writeString(this, _activeItems[i]->text, CONV_ENTRIES_X_OFFSET, + _vm->_font->writeString(this, _activeItems[i]->text, CONV_ENTRIES_X_OFFSET, CONV_ENTRIES_Y_OFFSET + CONV_ENTRIES_HEIGHT * i, 0, 0); } } @@ -178,7 +178,7 @@ bool ConversationView::onEvent(M4EventType eventType, int param, int x, int y, b // return false; if (!_entriesShown) return false; - if (eventType == KEVENT_KEY) + if (eventType == KEVENT_KEY) return false; int localY = y - _coords.top; @@ -267,7 +267,7 @@ void ConversationView::playNextReply() { if (currentEntry->isConditional) { if (!_vm->_converse->evaluateCondition( - _vm->_converse->getValue(currentEntry->condition.offset), + _vm->_converse->getValue(currentEntry->condition.offset), currentEntry->condition.op, currentEntry->condition.val)) continue; // don't play this reply } @@ -313,7 +313,7 @@ void ConversationView::playNextReply() { // If we reached here, there are no more replies, so perform the active entry's actions - //printf("Current selection does %i actions\n", _activeItems[entryIndex]->actions.size()); + //printf("Current selection does %i actions\n", _activeItems[entryIndex]->actions.size()); for (uint32 i = 0; i < _activeItems[_highlightedIndex]->actions.size(); i++) { if (!_vm->_converse->performAction(_activeItems[_highlightedIndex]->actions[i])) break; @@ -327,7 +327,7 @@ void ConversationView::playNextReply() { // Check if the conversation has been ended if (_currentNodeIndex == -1) { - _conversationState = kNoConversation; + _conversationState = kNoConversation; } } @@ -350,7 +350,7 @@ void Converse::startConversation(const char *convName, bool showConverseBox, Con if (showConverseBox) { _vm->_conversationView->show(); _vm->_mouse->lockCursor(CURSOR_ARROW); - + if (_interfaceWasVisible) _vm->_interfaceView->hide(); @@ -397,7 +397,7 @@ void Converse::loadConversation(const char *convName) { if (header != HEAD_CONV) { warning("Unexpected conversation file external header"); return; - } + } size = convS->readUint32LE(); // is this used at all? if (debugFlag) printf("Conv chunk size (external header): %i\n", size); @@ -486,7 +486,7 @@ void Converse::loadConversation(const char *convName) { curEntry->autoSelect = false; } _convNodes[curNode]->entries.push_back(curEntry); - setEntryInfo(curEntry->offset, curEntry->entryType, + setEntryInfo(curEntry->offset, curEntry->entryType, curNode, _convNodes[curNode]->entries.size() - 1); replyEntry = NULL; break; @@ -542,7 +542,7 @@ void Converse::loadConversation(const char *convName) { } curEntry->entries.push_back(replyEntry); - setEntryInfo(replyEntry->offset, replyEntry->entryType, + setEntryInfo(replyEntry->offset, replyEntry->entryType, curNode, _convNodes[curNode]->entries.size() - 1); // Seek to chunk data (i.e. TEXT/MESG tag, which is usually right // after this chunk but it can be further on in conditional reply chunks @@ -566,9 +566,9 @@ void Converse::loadConversation(const char *convName) { } if (replyEntry == NULL) { - parentEntry = curEntry; + parentEntry = curEntry; } else if (replyEntry != NULL && replyEntry->entryType != kWeightedReply) { - parentEntry = replyEntry; + parentEntry = replyEntry; } else if (replyEntry != NULL && replyEntry->entryType == kWeightedReply) { parentEntry = replyEntry->entries[currentWeightedEntry]; currentWeightedEntry++; @@ -636,7 +636,7 @@ void Converse::loadConversation(const char *convName) { case CHUNK_DSTR: // Destroy entry case CHUNK_EXIT: // Exit conversation curAction = new EntryAction(); - + // Conditional part if (chunk == CHUNK_CCGO || chunk == CHUNK_CHDE || chunk == CHUNK_CUHD || chunk == CHUNK_CDST || chunk == CHUNK_CEGO) { @@ -885,9 +885,9 @@ void Converse::loadConversationMads(const char *convName) { curEntry->id = convS->readUint16LE(); curEntry->offset = convS->readUint16LE(); curEntry->size = convS->readUint16LE(); - + _convNodes[i]->entries.push_back(curEntry); - //printf("Node %i, entry %i, id %i, offset %i, size %i, text: %s\n", + //printf("Node %i, entry %i, id %i, offset %i, size %i, text: %s\n", // i, j, curEntry->id, curEntry->offset, curEntry->size, curEntry->text); } } @@ -1026,7 +1026,7 @@ void Converse::readConvEntryActions(Common::SubReadStream *convS, ConvEntry *cur if (hasText1 == 1) { messageIndex = convS->readUint16LE(); - printf("Message 1 index: %i, text:\n", messageIndex); + printf("Message 1 index: %i, text:\n", messageIndex); for (uint32 i = 0; i < _madsMessageList[messageIndex]->messageStrings.size(); i++) { printf("%s\n", _madsMessageList[messageIndex]->messageStrings[i]); } @@ -1035,7 +1035,7 @@ void Converse::readConvEntryActions(Common::SubReadStream *convS, ConvEntry *cur if (hasText2 == 1) { messageIndex = convS->readUint16LE(); if (hasText1 == 0) { - printf("Message 2 index: %i, text:\n", messageIndex); + printf("Message 2 index: %i, text:\n", messageIndex); for (uint32 i = 0; i < _madsMessageList[messageIndex]->messageStrings.size(); i++) { printf("%s\n", _madsMessageList[messageIndex]->messageStrings[i]); } @@ -1048,7 +1048,7 @@ void Converse::readConvEntryActions(Common::SubReadStream *convS, ConvEntry *cur for (int k = 0; k < 4; k++) convS->readByte(); messageIndex = convS->readUint16LE(); - printf("Message index: %i, text:\n", messageIndex); + printf("Message index: %i, text:\n", messageIndex); for (uint32 i = 0; i < _madsMessageList[messageIndex]->messageStrings.size(); i++) { printf("%s\n", _madsMessageList[messageIndex]->messageStrings[i]); } @@ -1107,7 +1107,7 @@ void Converse::setEntryInfo(int32 offset, EntryType type, int32 nodeIndex, int32 //printf("Set entry info: offset %i, type %i, node %i, entry %i\n", offset, type, nodeIndex, entryIndex); } -const EntryInfo* Converse::getEntryInfo(int32 offset) { +const EntryInfo* Converse::getEntryInfo(int32 offset) { char hashOffset[10]; sprintf(hashOffset, "%i", offset); OffsetHashMap::const_iterator entry = _offsetMap.find(hashOffset); @@ -1161,13 +1161,13 @@ bool Converse::evaluateCondition(int32 leftVal, int32 op, int32 rightVal) { bool Converse::performAction(EntryAction *action) { if (action->isConditional) { - if (!evaluateCondition(getValue(action->condition.offset), + if (!evaluateCondition(getValue(action->condition.offset), action->condition.op, action->condition.val)) return true; // don't perform this action } if (action->actionType == kAssignValue) { - //printf("Assigning variable at offset %i to value %i\n", + //printf("Assigning variable at offset %i to value %i\n", // action->targetOffset, action->value); setValue(action->targetOffset, action->value); return true; // nothing else to do in an assignment action diff --git a/engines/m4/events.cpp b/engines/m4/events.cpp index 101a41015f..5c9313cbfb 100644 --- a/engines/m4/events.cpp +++ b/engines/m4/events.cpp @@ -91,7 +91,7 @@ M4EventType Events::handleEvents() { // State machine for moving between states switch (_mouseState) { - case MSTATE_NO_EVENT: + case MSTATE_NO_EVENT: if (_mouseButtons & LEFT_BUTTON_DOWN) { if ((dclickTime != 0) && (g_system->getMillis() < dclickTime)) { _mouseState = MSTATE_DOUBLECLICK_DOWN; @@ -199,7 +199,7 @@ bool Mouse::init(const char *seriesName, RGB8 *palette) { data = _cursorSprites->getFrame(i)->getBasePtr(x, y); if (*data == 1) { // It seems that some cursors have more than one hotspot - // In such a case, the first hotspot seems to set the x and + // In such a case, the first hotspot seems to set the x and // the second one the y hotspot offset if (!hotSpotSet) { _cursorSprites->getFrame(i)->xOffset = x; @@ -232,7 +232,7 @@ bool Mouse::setCursorNum(int cursorIndex) { return false; _lockedCursor = cursorIndex; - if (_locked) + if (_locked) // Cursor is locked, so don't go ahead with changing cursor return true; @@ -241,7 +241,7 @@ bool Mouse::setCursorNum(int cursorIndex) { // Set the cursor to the sprite CursorMan.replaceCursor((const byte *)_cursor->getData(), _cursor->w, _cursor->h, _cursor->xOffset, _cursor->yOffset, 0); - + return true; } @@ -284,7 +284,7 @@ const char *Mouse::getVerb() { } void Mouse::resetMouse() { - _hideRect.left = -1; + _hideRect.left = -1; _hideRect.top = -1; _hideRect.right = -1; _hideRect.bottom = -1; @@ -342,7 +342,7 @@ bool Mouse::inHideArea() { if ((_showRect.top == -1) && (_showRect.left == -1)) // No show rect defined return false; - + // Return true if the mouse is outside the show area return (_currentPos.x < _showRect.left) || (_currentPos.x > _showRect.right) || (_currentPos.y < _showRect.top) || (_currentPos.y > _showRect.bottom); diff --git a/engines/m4/events.h b/engines/m4/events.h index d261f29013..5f309e0a03 100644 --- a/engines/m4/events.h +++ b/engines/m4/events.h @@ -41,7 +41,7 @@ namespace M4 { #define RIGHT_BUTTON_DOWN 1 << 1 enum M4EventType { - MEVENT_NO_EVENT, MEVENT_MOVE, + MEVENT_NO_EVENT, MEVENT_MOVE, MEVENT_LEFT_CLICK, MEVENT_LEFT_HOLD, MEVENT_LEFT_DRAG, MEVENT_LEFT_RELEASE, MEVENT_RIGHT_CLICK, MEVENT_RIGHT_HOLD, MEVENT_RIGHT_DRAG, MEVENT_RIGHT_RELEASE, MEVENT_BOTH_CLICK, MEVENT_BOTH_HOLD, MEVENT_BOTH_DRAG, MEVENT_BOTH_RELEASE, @@ -79,7 +79,7 @@ public: Common::Event &event() { return _event; } Common::EventType type() { return _event.type; } - + // M4-centric methods M4EventType handleEvents(); bool kbdCheck(uint32 &keyCode); @@ -117,7 +117,7 @@ public: bool getCursorOn() { return _cursorOn; } void lockCursor(int cursorIndex); void unlockCursor(); - + const char *getVerb(); void resetMouse(); diff --git a/engines/m4/font.cpp b/engines/m4/font.cpp index 119e7297cf..a0ca27f745 100644 --- a/engines/m4/font.cpp +++ b/engines/m4/font.cpp @@ -55,7 +55,7 @@ void Font::setFont(const char *filename) { void Font::setFontM4(const char *filename) { Common::SeekableReadStream *fontFile = _vm->res()->openFile(filename); - + if (fontFile->readUint32LE() != MKID_BE('FONT')) { printf("Font::Font: FONT tag expected\n"); return; @@ -64,7 +64,7 @@ void Font::setFontM4(const char *filename) { _maxHeight = fontFile->readByte(); _maxWidth = fontFile->readByte(); uint32 fontSize = fontFile->readUint32LE(); - + //printf("Font::Font: _maxWidth = %d, _maxHeight = %d, fontSize = %d\n", _maxWidth, _maxHeight, fontSize); if (fontFile->readUint32LE() != MKID_BE('WIDT')) { @@ -137,8 +137,8 @@ Font::~Font() { void Font::setColor(uint8 color) { if (_sysFont) _fontColors[1] = color; - else - _fontColors[3] = color; + else + _fontColors[3] = color; } void Font::setColors(uint8 alt1, uint8 alt2, uint8 foreground) { @@ -166,7 +166,7 @@ int32 Font::write(M4Surface *surface, const char *text, int x, int y, int width, x++; y++; - + int skipY = 0; if (y < 0) { skipY = -y; @@ -194,7 +194,7 @@ int32 Font::write(M4Surface *surface, const char *text, int x, int y, int width, unsigned char theChar = (*text++) & 0x7F; int charWidth = _charWidths[theChar]; - + if (charWidth > 0) { if (xPos + charWidth >= width) @@ -244,7 +244,7 @@ int32 Font::write(M4Surface *surface, const char *text, int x, int y, int width, } xPos += charWidth + spaceWidth; - + } surface->freeData(); diff --git a/engines/m4/globals.cpp b/engines/m4/globals.cpp index 98d007f67e..56f78ce835 100644 --- a/engines/m4/globals.cpp +++ b/engines/m4/globals.cpp @@ -47,7 +47,7 @@ Kernel::Kernel(M4Engine *vm) : _vm(vm) { previousRoom = 0; trigger = 0; triggerMode = KT_DAEMON; - + _globalDaemonFn = NULL; _globalParserFn = NULL; @@ -88,17 +88,17 @@ bool Kernel::handleTrigger(int32 triggerNum) { bool result = false; int room = (triggerNum >> 16) & 0xFFF; - + printf("room = %d; currentRoom = %d\n", room, currentRoom); fflush(stdout); - + if (room != currentRoom) { printf("Kernel::handleTrigger() Trigger from another room\n"); return false; } - + trigger = triggerNum & 0xFFFF; KernelTriggerType mode = (KernelTriggerType)(triggerNum >> 28); - + switch (mode) { case KT_PREPARSE: diff --git a/engines/m4/globals.h b/engines/m4/globals.h index a80e8bf710..ec32c29fda 100644 --- a/engines/m4/globals.h +++ b/engines/m4/globals.h @@ -109,7 +109,7 @@ public: // TODO: Move to some palette/fading class int fadeUpDuration, firstFadeColorIndex; int minPalEntry, maxPalEntry; - + bool paused; //machine* myWalker; bool repeatedlyCallDeamon; @@ -120,7 +120,7 @@ public: int32 trigger; KernelTriggerType triggerMode; - + int32 createTrigger(int32 triggerNum); bool sendTrigger(int32 triggerNum); bool handleTrigger(int32 triggerNum); @@ -128,7 +128,7 @@ public: void loadGlobalScriptFunctions(); void loadSectionScriptFunctions(); void loadRoomScriptFunctions(); - + void globalDaemon(); void globalParser(); @@ -190,10 +190,10 @@ public: // Variables Common::Point position; // Player's current position int facing; // Facing direction - + char verb[PLAYER_FIELD_LENGTH]; // Action strings - char noun[PLAYER_FIELD_LENGTH]; - char prep[PLAYER_FIELD_LENGTH]; + char noun[PLAYER_FIELD_LENGTH]; + char prep[PLAYER_FIELD_LENGTH]; char object[PLAYER_FIELD_LENGTH]; Common::String assetName, shadowName; int walkerType, shadowType; diff --git a/engines/m4/graphics.cpp b/engines/m4/graphics.cpp index 1846f1c1e7..6d933d476b 100644 --- a/engines/m4/graphics.cpp +++ b/engines/m4/graphics.cpp @@ -190,7 +190,7 @@ void M4Surface::drawSprite(int x, int y, SpriteInfo &info, const Common::Rect &c printf("M4Surface::drawSprite() info.width = %d; info.scaleX = %d; info.height = %d; info.scaleY = %d; scaledWidth = %d; scaledHeight = %d\n", info.width, info.scaleX, info.height, info.scaleY, scaledWidth, scaledHeight); fflush(stdout); */ - + int clipX = 0, clipY = 0; // Clip the sprite's width and height according to the clip rectangle's dimensions // This clips the sprite to the bottom and right @@ -302,7 +302,7 @@ void M4Surface::drawSprite(int x, int y, SpriteInfo &info, const Common::Rect &c } } - + delete[] scaledLineBuf; } @@ -383,7 +383,7 @@ void M4Surface::loadBackgroundRiddle(const char *sceneName) { Common::SeekableReadStream *stream; // Loads a Riddle scene sprintf(resourceName, "%s.tt", sceneName); - stream = _vm->_resourceManager->get(resourceName); + stream = _vm->_resourceManager->get(resourceName); m4LoadBackground(stream); _vm->_resourceManager->toss(resourceName); } @@ -398,17 +398,17 @@ void M4Surface::loadBackground(int sceneNumber, RGBList **palData) { if (_vm->getGameType() == GType_RexNebular) { // Load Rex Nebular screen sprintf(resourceName, "rm%d.art", sceneNumber); - stream = _vm->_resourceManager->get(resourceName); + stream = _vm->_resourceManager->get(resourceName); rexLoadBackground(stream, palData); } else { // Loads M4 game scene if (palData) *palData = NULL; sprintf(resourceName, "%i.tt", sceneNumber); - stream = _vm->_resourceManager->get(resourceName); + stream = _vm->_resourceManager->get(resourceName); m4LoadBackground(stream); } - + _vm->_resourceManager->toss(resourceName); } else { @@ -519,7 +519,7 @@ void M4Surface::madsLoadBackground(int roomNumber, RGBList **palData) { // -------------------------------------------------------------------------------- // Loop through the mapping data to place the tiles on the screen - + uint16 *tIndex = &tileMap[0]; for (int y = 0; y < tileCountY; y++) { for (int x = 0; x < tileCountX; x++) { @@ -569,7 +569,7 @@ void M4Surface::rexLoadBackground(Common::SeekableReadStream *source, RGBList ** byte *pData = (byte *)pixels; sourceUnc->read(pData, sceneSize); - + freeData(); delete sourceUnc; } @@ -593,9 +593,9 @@ void M4Surface::m4LoadBackground(Common::SeekableReadStream *source) { uint8 blackIndex = 0; // Debug - //printf("loadBackground(): %dx%d picture (%d bytes) - %dx%d tiles of size %dx%d\n", + //printf("loadBackground(): %dx%d picture (%d bytes) - %dx%d tiles of size %dx%d\n", // widthVal, heightVal, size, tilesX, tilesY, tileWidth, tileHeight); - + // BGR data, which is converted to RGB8 for (uint i = 0; i < 256; i++) { palette[i].b = source->readByte() << 2; @@ -606,7 +606,7 @@ void M4Surface::m4LoadBackground(Common::SeekableReadStream *source) { if ((blackIndex == 0) && !palette[i].r && !palette[i].g && !palette[i].b) blackIndex = i; } - + _vm->_palette->setPalette(palette, 0, 256); // resize or create the surface @@ -644,7 +644,7 @@ void M4Surface::madsloadInterface(int index, RGBList **palData) { // Chunk 0, palette Common::SeekableReadStream *intStream = intFile.getItemStream(0); - + for (int i = 0; i < 16; i++) { palette[i].r = intStream->readByte() << 2; palette[i].g = intStream->readByte() << 2; @@ -711,14 +711,14 @@ static void makeTranslationList(RGB8 *palData, byte transList[NUM_GREENS]) { if (minDistance == 0) break; } - + transList[i] = bestIndex; } } // Support function for fading in or out -static void fadeRange(M4Engine *vm, RGB8 *srcPal, RGB8 *destPal, int startIndex, int endIndex, +static void fadeRange(M4Engine *vm, RGB8 *srcPal, RGB8 *destPal, int startIndex, int endIndex, int numSteps, uint delayAmount) { RGB8 tempPal[256]; @@ -733,11 +733,11 @@ static void fadeRange(M4Engine *vm, RGB8 *srcPal, RGB8 *destPal, int startIndex for (int i = startIndex; i <= endIndex; ++i) { // Handle the intermediate rgb values for fading - tempPal[i].r = (byte) (srcPal[i].r + (destPal[i].r - srcPal[i].r) * stepCtr / numSteps); - tempPal[i].g = (byte) (srcPal[i].g + (destPal[i].g - srcPal[i].g) * stepCtr / numSteps); - tempPal[i].b = (byte) (srcPal[i].b + (destPal[i].b - srcPal[i].b) * stepCtr / numSteps); + tempPal[i].r = (byte) (srcPal[i].r + (destPal[i].r - srcPal[i].r) * stepCtr / numSteps); + tempPal[i].g = (byte) (srcPal[i].g + (destPal[i].g - srcPal[i].g) * stepCtr / numSteps); + tempPal[i].b = (byte) (srcPal[i].b + (destPal[i].b - srcPal[i].b) * stepCtr / numSteps); } - + vm->_palette->setPalette(&tempPal[startIndex], startIndex, endIndex - startIndex + 1); vm->_viewManager->refreshAll(); } @@ -845,7 +845,7 @@ void Palette::fadeToGreen(int numSteps, uint delayAmount) { // using palette indexes in the range the range #32-63 into values from #64-255 makeTranslationList(destPalette, translationList); - + // Use palette indexes from #32-63 for the range of possible shades for (i = GREEN_START; i <= GREEN_END; ++i, greenAmount += 8) { @@ -854,12 +854,12 @@ void Palette::fadeToGreen(int numSteps, uint delayAmount) { } // Remap all pixels into the #32-63 range - + tempP = _vm->_scene->getData(); - for (int pixelCtr = 0; pixelCtr < _vm->_scene->width() * _vm->_scene->height(); + for (int pixelCtr = 0; pixelCtr < _vm->_scene->width() * _vm->_scene->height(); ++pixelCtr, ++tempP) { // If pixel is in #32-63 range already, remap to higher palette entries - if ((*tempP >= GREEN_START) && (*tempP <= GREEN_END)) + if ((*tempP >= GREEN_START) && (*tempP <= GREEN_END)) *tempP = translationList[*tempP - GREEN_START]; *tempP = (uint8) (GREEN_START + (destPalette[*tempP].g >> 3)); @@ -883,7 +883,7 @@ void Palette::fadeFromGreen(int numSteps, uint delayAmount, bool fadeToBlack) { destPalette = &blackPalette[0]; } - // Initially restore the faded palette + // Initially restore the faded palette _vm->_palette->setPalette(fadedPalette, 0, 256); _vm->_viewManager->refreshAll(); @@ -956,7 +956,7 @@ void Palette::setMadsSystemPalette() { palData[1].r = palData[1].g = palData[1].b = 0x54; palData[2].r = palData[2].g = palData[2].b = 0xb4; palData[3].r = palData[3].g = palData[3].b = 0xff; - + setPalette(palData, 0, 4); blockRange(0, 4); } @@ -976,18 +976,18 @@ void Palette::addRange(RGBList *list) { RGB8 palData[256]; g_system->grabPalette((byte *)&palData[0], 0, 256); bool paletteChanged = false; - + for (int colIndex = 0; colIndex < list->size(); ++colIndex) { // Scan through for an existing copy of the RGB value - int palIndex = -1; + int palIndex = -1; while (++palIndex < 256) { if (_usageCount[palIndex] <= 0) // Palette index is to be skipped continue; - if ((palData[palIndex].r == data[colIndex].r) && + if ((palData[palIndex].r == data[colIndex].r) && (palData[palIndex].g == data[colIndex].g) && - (palData[palIndex].b == data[colIndex].b)) + (palData[palIndex].b == data[colIndex].b)) // Match found break; } @@ -1000,7 +1000,7 @@ void Palette::addRange(RGBList *list) { break; } - if (palIndex == 256) + if (palIndex == 256) error("addRange - Ran out of palette space to allocate"); palData[palIndex].r = data[colIndex].r; diff --git a/engines/m4/graphics.h b/engines/m4/graphics.h index 84fc77656f..c210caef1e 100644 --- a/engines/m4/graphics.h +++ b/engines/m4/graphics.h @@ -51,7 +51,7 @@ struct M4Rect { class M4Surface; // RGBList -// Implements a list of RGB entries +// Implements a list of RGB entries class RGBList { private: @@ -92,7 +92,7 @@ private: void madsLoadBackground(int roomNumber, RGBList **palData = NULL); void m4LoadBackground(Common::SeekableReadStream *source); public: - M4Surface(bool isScreen = false) { + M4Surface(bool isScreen = false) { create(g_system->getWidth(), g_system->getHeight(), 1); _isScreen = isScreen; } @@ -118,7 +118,7 @@ public: void line(int x1, int y1, int x2, int y2, byte color); void frameRect(int x1, int y1, int x2, int y2); void fillRect(int x1, int y1, int x2, int y2); - + void drawSprite(int x, int y, SpriteInfo &info, const Common::Rect &clipRect); // Surface methods @@ -134,16 +134,16 @@ public: void copyFrom(M4Surface *src, const Common::Rect &srcBounds, int destX, int destY, int transparentColor = -1); - void update() { + void update() { if (_isScreen) { g_system->copyRectToScreen((const byte *)pixels, pitch, 0, 0, w, h); - g_system->updateScreen(); + g_system->updateScreen(); } } // copyTo methods - void copyTo(M4Surface *dest, int transparentColor = -1) { - dest->copyFrom(this, Common::Rect(width(), height()), 0, 0, transparentColor); + void copyTo(M4Surface *dest, int transparentColor = -1) { + dest->copyFrom(this, Common::Rect(width(), height()), 0, 0, transparentColor); } void copyTo(M4Surface *dest, int x, int y, int transparentColor = -1) { dest->copyFrom(this, Common::Rect(width(), height()), x, y, transparentColor); diff --git a/engines/m4/gui.cpp b/engines/m4/gui.cpp index 67c1c7a1a7..42fc068909 100644 --- a/engines/m4/gui.cpp +++ b/engines/m4/gui.cpp @@ -103,7 +103,7 @@ void MenuObject::onExecute() { //-------------------------------------------------------------------------- // MenuButton class // -// Defines a button object +// Defines a button object //-------------------------------------------------------------------------- MenuButton::MenuButton(DialogView *owner, int buttonId, int xs, int ys, int width, int height, @@ -164,9 +164,9 @@ bool MenuButton::onEvent(M4EventType event, int param, int x, int y, MenuObject if (isInside(x, y)) { if (currentItem) { callbackFlag = true; - if (_objectType == OBJTYPE_OM_SWITCH_ON) + if (_objectType == OBJTYPE_OM_SWITCH_ON) _objectType = OBJTYPE_OM_SWITCH_OFF; - else if (_objectType == OBJTYPE_OM_SWITCH_OFF) + else if (_objectType == OBJTYPE_OM_SWITCH_OFF) _objectType = OBJTYPE_OM_SWITCH_ON; } else { @@ -183,7 +183,7 @@ bool MenuButton::onEvent(M4EventType event, int param, int x, int y, MenuObject handledFlag = false; } break; - + case MEVENT_MOVE: if (isInside(x, y)) { currentItem = this; @@ -222,7 +222,7 @@ bool MenuButton::onEvent(M4EventType event, int param, int x, int y, MenuObject // If a callback is flagged, then handle it - if (callbackFlag) + if (callbackFlag) onExecute(); return handledFlag; @@ -268,8 +268,8 @@ void MenuButton::onRefresh() { case OBJTYPE_OM_DONE: sprite = sprites[OM_DONE_BTN_GREYED + _objectState]; - break; - + break; + case OBJTYPE_OM_CANCEL: sprite = (_objectState == OS_GREYED) ? sprites[OM_CANCEL_BTN_NORMAL] : sprites[OM_CANCEL_BTN_NORMAL + _objectState - 1]; @@ -291,26 +291,26 @@ void MenuButton::onRefresh() { case OBJTYPE_SL_TEXT: switch (_objectState) { case OS_MOUSEOVER: - _vm->_font->setColors(TEXT_COLOR_MOUSEOVER_SHADOW, TEXT_COLOR_MOUSEOVER_FOREGROUND, + _vm->_font->setColors(TEXT_COLOR_MOUSEOVER_SHADOW, TEXT_COLOR_MOUSEOVER_FOREGROUND, TEXT_COLOR_MOUSEOVER_HILIGHT); sprite = sprites[SL_LINE_MOUSEOVER]; break; case OS_PRESSED: - _vm->_font->setColors(TEXT_COLOR_PRESSED_SHADOW, TEXT_COLOR_PRESSED_FOREGROUND, + _vm->_font->setColors(TEXT_COLOR_PRESSED_SHADOW, TEXT_COLOR_PRESSED_FOREGROUND, TEXT_COLOR_PRESSED_HILIGHT); sprite = sprites[SL_LINE_PRESSED]; break; case OS_GREYED: - _vm->_font->setColors(TEXT_COLOR_GREYED_SHADOW, TEXT_COLOR_GREYED_FOREGROUND, + _vm->_font->setColors(TEXT_COLOR_GREYED_SHADOW, TEXT_COLOR_GREYED_FOREGROUND, TEXT_COLOR_GREYED_HILIGHT); sprite = sprites[SL_LINE_NORMAL]; break; default: case OS_NORMAL: - _vm->_font->setColors(TEXT_COLOR_NORMAL_SHADOW, TEXT_COLOR_NORMAL_FOREGROUND, + _vm->_font->setColors(TEXT_COLOR_NORMAL_SHADOW, TEXT_COLOR_NORMAL_FOREGROUND, TEXT_COLOR_NORMAL_HILIGHT); sprite = sprites[SL_LINE_NORMAL]; break; @@ -344,10 +344,10 @@ void MenuButton::onRefresh() { // Defines a horizontal slider that allows selection of a percentage //-------------------------------------------------------------------------- -MenuHorizSlider::MenuHorizSlider(DialogView *owner, int objectId, int xs, int ys, +MenuHorizSlider::MenuHorizSlider(DialogView *owner, int objectId, int xs, int ys, int width, int height, int initialPercentage, Callback callbackFn, bool transparent): MenuObject(owner, objectId, xs, ys, width, height, false, transparent) { - + _objectType = OBJTYPE_SLIDER; _callback = callbackFn; @@ -366,7 +366,7 @@ void MenuHorizSlider::onRefresh() { // Transparent button if (!_background) return; - + _background->copyTo(parent(), _bounds.left, _bounds.top, 0); } @@ -377,7 +377,7 @@ void MenuHorizSlider::onRefresh() { // Fill in the area to the left of the thumbnail if (_thumbX > 2) { - Common::Rect leftBounds(_bounds.left + 3, _bounds.top + 9, _bounds.left + _thumbX, + Common::Rect leftBounds(_bounds.left + 3, _bounds.top + 9, _bounds.left + _thumbX, _bounds.top + _thumbSize.y - 9); parent()->fillRect(leftBounds, SLIDER_BAR_COLOR); } @@ -397,7 +397,7 @@ bool MenuHorizSlider::onEvent(M4EventType event, int param, int x, int y, MenuOb switch (event) { case MEVENT_LEFT_CLICK: case MEVENT_DOUBLECLICK: - if (isInside(x, y) && (x - _bounds.left >= _thumbX) && + if (isInside(x, y) && (x - _bounds.left >= _thumbX) && (x - _bounds.left <= _thumbX + _thumbSize.x - 1)) { // The thumbnail has been clicked _sliderState = HSLIDER_THUMB_PRESSED; @@ -427,7 +427,7 @@ bool MenuHorizSlider::onEvent(M4EventType event, int param, int x, int y, MenuOb _percent = _thumbX * 100 / _maxThumbX; redrawFlag = callbackFlag = true; } - movingX = CLIP(x, _bounds.left + _thumbX, + movingX = CLIP(x, _bounds.left + _thumbX, _bounds.left + _thumbX + _thumbSize.x - 1); } else { currentItem = NULL; @@ -452,7 +452,7 @@ bool MenuHorizSlider::onEvent(M4EventType event, int param, int x, int y, MenuOb redrawFlag = true; callbackFlag = true; break; - + case MEVENT_MOVE: if (isInside(x, y) && (x - _bounds.left >= _thumbX) && (x - _bounds.left <= _thumbX + _thumbSize.x - 1)) { @@ -469,7 +469,7 @@ bool MenuHorizSlider::onEvent(M4EventType event, int param, int x, int y, MenuOb } redrawFlag = true; break; - + default: break; } @@ -477,7 +477,7 @@ bool MenuHorizSlider::onEvent(M4EventType event, int param, int x, int y, MenuOb if (redrawFlag) onRefresh(); - if (callbackFlag) + if (callbackFlag) onExecute(); return handledFlag; @@ -489,10 +489,10 @@ bool MenuHorizSlider::onEvent(M4EventType event, int param, int x, int y, MenuOb // Defines a vertical slider that's used in the save/load dialog //-------------------------------------------------------------------------- -MenuVertSlider::MenuVertSlider(DialogView *owner, int objectId, int xs, int ys, +MenuVertSlider::MenuVertSlider(DialogView *owner, int objectId, int xs, int ys, int width, int height, int initialPercentage, Callback callbackFn, bool transparent): MenuObject(owner, objectId, xs, ys, width, height, false, transparent) { - + _objectType = OBJTYPE_SLIDER; _callback = callbackFn; @@ -527,7 +527,7 @@ void MenuVertSlider::onRefresh() { // Transparent button if (!_background) return; - + _background->copyTo(parent(), _bounds.left, _bounds.top, 0); } @@ -544,22 +544,22 @@ void MenuVertSlider::onRefresh() { thumbSprite = NULL; } else if (_objectState == OS_MOUSEOVER) { - if (_sliderState == VSLIDER_UP) + if (_sliderState == VSLIDER_UP) upSprite = sprites[SL_UP_BTN_MOUSEOVER]; - else if (_sliderState == VSLIDER_THUMBNAIL) + else if (_sliderState == VSLIDER_THUMBNAIL) thumbSprite = sprites[SL_SLIDER_BTN_MOUSEOVER]; else if (_sliderState == VSLIDER_DOWN) downSprite = sprites[SL_DOWN_BTN_MOUSEOVER]; } else if (_objectState == OS_PRESSED) { - if (_sliderState == VSLIDER_UP) + if (_sliderState == VSLIDER_UP) upSprite = sprites[SL_UP_BTN_PRESSED]; - else if (_sliderState == VSLIDER_THUMBNAIL) + else if (_sliderState == VSLIDER_THUMBNAIL) thumbSprite = sprites[SL_SLIDER_BTN_PRESSED]; - else if (_sliderState == VSLIDER_DOWN) + else if (_sliderState == VSLIDER_DOWN) downSprite = sprites[SL_DOWN_BTN_PRESSED]; } - + // Draw the sprites upSprite->copyTo(parent(), _bounds.left, _bounds.top, 0); barSprite->copyTo(parent(), _bounds.left, _bounds.top + upSprite->height(), 0); @@ -615,7 +615,7 @@ bool MenuVertSlider::onEvent(M4EventType event, int param, int x, int y, MenuObj case MEVENT_LEFT_DRAG: case MEVENT_DOUBLECLICK_DRAG: - if (!currentItem) + if (!currentItem) return true; if (movingFlag) { @@ -639,9 +639,9 @@ bool MenuVertSlider::onEvent(M4EventType event, int param, int x, int y, MenuObj } movingY = y; - if (movingY < (_thumbY + _bounds.top)) + if (movingY < (_thumbY + _bounds.top)) movingY = _thumbY + _bounds.top; - else if (movingY > (_bounds.top + _thumbY + _thumbSize.y - 1)) + else if (movingY > (_bounds.top + _thumbY + _thumbSize.y - 1)) movingY = _bounds.top + _thumbY + _thumbSize.y - 1; } else { @@ -654,7 +654,7 @@ bool MenuVertSlider::onEvent(M4EventType event, int param, int x, int y, MenuObj setState(OS_PRESSED); redrawFlag = true; } - if (currentTime - callbackTime > 100) + if (currentTime - callbackTime > 100) callbackFlag = true; } else { @@ -672,13 +672,13 @@ bool MenuVertSlider::onEvent(M4EventType event, int param, int x, int y, MenuObj } } break; - + case MEVENT_LEFT_RELEASE: case MEVENT_DOUBLECLICK_RELEASE: movingFlag = false; if (isInside(x, y)) { tempState = getSliderArea(y - _bounds.top); - if ((tempState == VSLIDER_PAGE_UP) || (tempState == VSLIDER_PAGE_DOWN)) + if ((tempState == VSLIDER_PAGE_UP) || (tempState == VSLIDER_PAGE_DOWN)) setState(OS_NORMAL); else { setState(OS_MOUSEOVER); @@ -693,13 +693,13 @@ bool MenuVertSlider::onEvent(M4EventType event, int param, int x, int y, MenuObj if (parent()->getMenuType() == LOAD_MENU) updateThumbnails(); break; - + case MEVENT_MOVE: if (isInside(x, y)) { currentItem = this; tempState = getSliderArea(y - _bounds.top); if (_sliderState != tempState) { - if ((tempState == VSLIDER_PAGE_UP) || (tempState == VSLIDER_PAGE_DOWN)) + if ((tempState == VSLIDER_PAGE_UP) || (tempState == VSLIDER_PAGE_DOWN)) _objectState = OS_NORMAL; else { _sliderState = tempState; @@ -725,9 +725,9 @@ bool MenuVertSlider::onEvent(M4EventType event, int param, int x, int y, MenuObj if (isInside(x, y)) { tempState = getSliderArea(y - _bounds.top); - + if (_sliderState == tempState) { - if (currentTime - callbackTime > 100) + if (currentTime - callbackTime > 100) callbackFlag = true; } } @@ -737,7 +737,7 @@ bool MenuVertSlider::onEvent(M4EventType event, int param, int x, int y, MenuObj break; } - if (redrawFlag) + if (redrawFlag) onRefresh(); if (callbackFlag) { @@ -748,7 +748,7 @@ bool MenuVertSlider::onEvent(M4EventType event, int param, int x, int y, MenuObj return handledFlag; } -void MenuVertSlider::setPercentage(int value) { +void MenuVertSlider::setPercentage(int value) { _percent = value; _thumbY = _minThumbY + ((_percent * (_maxThumbY - _minThumbY)) / 100); onRefresh(); @@ -760,7 +760,7 @@ void MenuVertSlider::setPercentage(int value) { // Defines a message menu object //-------------------------------------------------------------------------- -MenuMessage::MenuMessage(DialogView *owner, int objectId, int xs, int ys, int width, int height, +MenuMessage::MenuMessage(DialogView *owner, int objectId, int xs, int ys, int width, int height, bool transparent): MenuObject(owner, objectId, xs, ys, width, height, false, transparent) { } @@ -772,7 +772,7 @@ void MenuMessage::onRefresh() { // Get the correct sprite to use switch (_objectId) { case SLTAG_SAVELOAD_LABEL: - sprite = (parent()->getMenuType() == SAVE_MENU) ? sprites[SL_SAVE_LABEL] : + sprite = (parent()->getMenuType() == SAVE_MENU) ? sprites[SL_SAVE_LABEL] : sprites[SL_LOAD_LABEL]; break; } @@ -783,7 +783,7 @@ void MenuMessage::onRefresh() { // Transparent button if (!_background) return; - + // Restore original background and then do a transparent copy of the sprite _background->copyTo(parent(), _bounds.left, _bounds.top); } @@ -797,7 +797,7 @@ void MenuMessage::onRefresh() { // Defines a menu item that displays a given surface //-------------------------------------------------------------------------- -MenuImage::MenuImage(DialogView *owner, int objectId, int xs, int ys, int width, int height, +MenuImage::MenuImage(DialogView *owner, int objectId, int xs, int ys, int width, int height, M4Surface *image, bool transparent): MenuObject(owner, objectId, xs, ys, width, height, false, transparent) { @@ -813,7 +813,7 @@ void MenuImage::onRefresh() { // Transparent button if (!_background) return; - + // Restore original background and then do a transparent copy of the sprite _background->copyTo(parent(), _bounds.left, _bounds.top); } @@ -828,7 +828,7 @@ void MenuImage::onRefresh() { // Defines a save/load dialog text entry //-------------------------------------------------------------------------- -MenuSaveLoadText::MenuSaveLoadText(DialogView *owner, int textId, int xs, int ys, +MenuSaveLoadText::MenuSaveLoadText(DialogView *owner, int textId, int xs, int ys, int width, int height, Callback callbackFn, bool greyed, bool transparent, bool loadFlag, const char *displayText, int displayValue): MenuButton(owner, textId, xs, ys, width, height, callbackFn, greyed, transparent, OBJTYPE_SL_TEXT) { @@ -882,7 +882,7 @@ bool MenuSaveLoadText::onEvent(M4::M4EventType event, int param, int x, int y, M delete parent()->_savegameThumbnail; parent()->_highlightedSlot = _index; - parent()->_savegameThumbnail = _vm->_saveLoad->getThumbnail(_index + 1); + parent()->_savegameThumbnail = _vm->_saveLoad->getThumbnail(_index + 1); thumbnail->setSprite(parent()->_savegameThumbnail); } @@ -901,12 +901,12 @@ bool MenuSaveLoadText::onEvent(M4::M4EventType event, int param, int x, int y, M parent()->_highlightedSlot = -1; } } - + return handledFlag; } -void MenuSaveLoadText::setVisible(bool value) { - _visible = value; +void MenuSaveLoadText::setVisible(bool value) { + _visible = value; parent()->refresh(_bounds); } @@ -916,8 +916,8 @@ void MenuSaveLoadText::setVisible(bool value) { // Defines a text entry field //-------------------------------------------------------------------------- -MenuTextField::MenuTextField(DialogView *owner, int fieldId, int xs, int ys, int width, - int height, bool greyed, Callback callbackFn, +MenuTextField::MenuTextField(DialogView *owner, int fieldId, int xs, int ys, int width, + int height, bool greyed, Callback callbackFn, const char *displayText, int displayValue, bool transparent): MenuObject(owner, fieldId, xs, ys, width, height, greyed, transparent) { @@ -946,7 +946,7 @@ void MenuTextField::onRefresh() { // Transparent button if (!_background) return; - + _background->copyTo(parent(), _bounds.left, _bounds.top, 0); } @@ -956,7 +956,7 @@ void MenuTextField::onRefresh() { // Draw the text _vm->_font->setFont(FONT_MENU); - _vm->_font->setColors(TEXT_COLOR_NORMAL_SHADOW, TEXT_COLOR_NORMAL_FOREGROUND, + _vm->_font->setColors(TEXT_COLOR_NORMAL_SHADOW, TEXT_COLOR_NORMAL_FOREGROUND, TEXT_COLOR_NORMAL_HILIGHT); int xp = _bounds.left + 4; @@ -989,7 +989,7 @@ bool MenuTextField::onEvent(M4EventType event, int param, int x, int y, MenuObje char tempStr[MAX_SAVEGAME_NAME]; int tempLen; char *tempP; - bool handledFlag = false, redrawFlag = false, callbackFlag = false; + bool handledFlag = false, redrawFlag = false, callbackFlag = false; if (_objectState == OS_GREYED) return false; @@ -1102,7 +1102,7 @@ bool MenuTextField::onEvent(M4EventType event, int param, int x, int y, MenuObje tempLen = _vm->_font->getWidth(_displayText); if ((strlen(_displayText) < MAX_SAVEGAME_NAME - 1) && (tempLen < _pixelWidth - 12) && (param >= 32) && (param <= 127)) { - + // Valid displayable character if (_cursor < _promptEnd) { strcpy(tempStr, _cursor); @@ -1124,10 +1124,10 @@ bool MenuTextField::onEvent(M4EventType event, int param, int x, int y, MenuObje break; } - if (redrawFlag) + if (redrawFlag) onRefresh(); - if (callbackFlag) + if (callbackFlag) onExecute(); return handledFlag; @@ -1148,8 +1148,8 @@ void GUITextField::onRefresh() { //-------------------------------------------------------------------------- -GUIButton::GUIButton(View *owner, const Common::Rect &bounds, int tag, - M4Surface *normalSprite, M4Surface *mouseOverSprite, M4Surface *pressedSprite): +GUIButton::GUIButton(View *owner, const Common::Rect &bounds, int tag, + M4Surface *normalSprite, M4Surface *mouseOverSprite, M4Surface *pressedSprite): GUIRect(owner, bounds, tag) { _normalSprite = normalSprite; @@ -1161,7 +1161,7 @@ GUIButton::GUIButton(View *owner, const Common::Rect &bounds, int tag, void GUIButton::onRefresh() { _parent->fillRect(_bounds, _vm->_palette->BLACK); - + if (_visible) { switch (_buttonState) { case BUTTON_MOUSEOVER: diff --git a/engines/m4/gui.h b/engines/m4/gui.h index 3f7e6f20c3..9bef495f76 100644 --- a/engines/m4/gui.h +++ b/engines/m4/gui.h @@ -92,7 +92,7 @@ enum ObjectType { enum GameMenuSpriteType { GM_DIALOG_BOX, - + GM_BUTTON_GREYED, GM_BUTTON_NORMAL, GM_BUTTON_MOUSEOVER, @@ -178,7 +178,7 @@ enum TextColors { TEXT_COLOR_PRESSED_HILIGHT = 236, TEXT_COLOR_PRESSED_FOREGROUND = 130, - TEXT_COLOR_PRESSED_SHADOW = 129 + TEXT_COLOR_PRESSED_SHADOW = 129 }; #define MENU_SS_FIELD_NORMAL 5 @@ -261,8 +261,8 @@ public: DialogView *parent() { return (DialogView *)_parent; } MenuObjectState getState() { return _objectState; } - virtual void setState(MenuObjectState state) { - _objectState = state; + virtual void setState(MenuObjectState state) { + _objectState = state; onRefresh(); } int getObjectId() { return _objectId; } @@ -273,7 +273,7 @@ public: class MenuButton: public MenuObject { public: - MenuButton(DialogView *owner, int buttonId, int xs, int ys, int width, int height, + MenuButton(DialogView *owner, int buttonId, int xs, int ys, int width, int height, Callback callbackFn = NULL, bool greyed = false, bool transparent = false, ObjectType buttonType = OBJTYPE_BUTTON); @@ -293,7 +293,7 @@ protected: int _percent; int _thumbX; public: - MenuHorizSlider(DialogView *owner, int sliderId, int xs, int ys, int width, int height, + MenuHorizSlider(DialogView *owner, int sliderId, int xs, int ys, int width, int height, int initialPercentage, Callback callbackFn = NULL, bool transparent = false); void onRefresh(); @@ -322,7 +322,7 @@ protected: MenuVertSliderState getSliderArea(int y); void updateThumbnails() {} public: - MenuVertSlider(DialogView *owner, int sliderId, int xs, int ys, int width, int height, + MenuVertSlider(DialogView *owner, int sliderId, int xs, int ys, int width, int height, int initialPercentage, Callback callbackFn = NULL, bool transparent = false); void onRefresh(); @@ -343,13 +343,13 @@ class MenuImage: public MenuObject { private: M4Surface *_sprite; public: - MenuImage(DialogView *owner, int objectId, int xs, int ys, int width, int height, + MenuImage(DialogView *owner, int objectId, int xs, int ys, int width, int height, M4Surface *image, bool transparent = false); void onRefresh(); const M4Surface *sprite() { return _sprite; } - void setSprite(M4Surface *v) { - _sprite = v; + void setSprite(M4Surface *v) { + _sprite = v; onRefresh(); } }; @@ -362,7 +362,7 @@ private: int _index; bool _visible; public: - MenuSaveLoadText(DialogView *owner, int textId, int xs, int ys, int width, int height, + MenuSaveLoadText(DialogView *owner, int textId, int xs, int ys, int width, int height, Callback callbackFn = NULL, bool greyed = false, bool transparent = false, bool loadFlag = false, const char *displayText = NULL, int displayValue = 0); @@ -383,8 +383,8 @@ private: char *_promptEnd; char *_cursor; public: - MenuTextField(DialogView *owner, int fieldId, int xs, int ys, int width, int height, - bool greyed, Callback callbackFn = NULL, const char *displayText = NULL, + MenuTextField(DialogView *owner, int fieldId, int xs, int ys, int width, int height, + bool greyed, Callback callbackFn = NULL, const char *displayText = NULL, int displayValue = 0, bool transparent = true); void onRefresh(); @@ -414,7 +414,7 @@ protected: bool _visible; bool _tracking; public: - GUIButton(View *owner, const Common::Rect &bounds, int tag, + GUIButton(View *owner, const Common::Rect &bounds, int tag, M4Surface *normalSprite, M4Surface *mouseOverSprite, M4Surface *pressedSprite); void onRefresh(); @@ -427,11 +427,11 @@ private: Common::String _text; public: GUITextField(View *owner, const Common::Rect &bounds); - void setText(const char *value) { - _text = value; + void setText(const char *value) { + _text = value; onRefresh(); } - + void onRefresh(); }; diff --git a/engines/m4/hotspot.cpp b/engines/m4/hotspot.cpp index a8057cf21d..7de66b375b 100644 --- a/engines/m4/hotspot.cpp +++ b/engines/m4/hotspot.cpp @@ -258,7 +258,7 @@ void HotSpotList::loadHotSpots(Common::SeekableReadStream* hotspotStream, int ho strLength = hotspotStream->readUint32LE(); // prepLength hotspotStream->read(buffer, strLength); // prep str_upper(buffer); - + if (strlen(buffer) > 0 && strcmp(buffer, "--") != 0 && strcmp(buffer, "ON") != 0) currentHotSpot->setPrep(buffer); else diff --git a/engines/m4/m4.cpp b/engines/m4/m4.cpp index 6cc81bf274..60e74fd127 100644 --- a/engines/m4/m4.cpp +++ b/engines/m4/m4.cpp @@ -75,7 +75,7 @@ void escapeHotkeyHandler(M4Engine *vm, View *view, uint32 key) { void textviewHotkeyHandler(M4Engine *vm, View *view, uint32 key) { // Deactivate the scene if it's currently active View *sceneView = vm->_viewManager->getView(VIEWID_SCENE); - if (sceneView != NULL) + if (sceneView != NULL) vm->_viewManager->deleteView(sceneView); // Activate the textview view @@ -206,7 +206,7 @@ void M4Engine::eventHandler() { _viewManager->handleMouseEvents(event); } - if (_events->kbdCheck(keycode)) + if (_events->kbdCheck(keycode)) _viewManager->handleKeyboardEvents(keycode); } @@ -217,9 +217,9 @@ bool M4Engine::delay(int duration, bool keyAborts, bool clickAborts) { while (!_events->quitFlag && (g_system->getMillis() < endTime)) { event = _events->handleEvents(); - if (clickAborts && (event == MEVENT_LEFT_RELEASE) || (event == MEVENT_RIGHT_RELEASE)) + if (clickAborts && (event == MEVENT_LEFT_RELEASE) || (event == MEVENT_RIGHT_RELEASE)) return true; - + if (_events->kbdCheck(keycode)) { if (keyAborts) return true; @@ -403,7 +403,7 @@ Common::Error M4Engine::goM4() { _viewManager->addView(_scene); // Setup game wide hotkeys. Note that Orion Burger used F2/F3 for Save/Restore, - // but for standardisation with most other games, F5/F7 are also mapped + // but for standardisation with most other games, F5/F7 are also mapped _viewManager->systemHotkeys().add(Common::KEYCODE_ESCAPE, &escapeHotkeyHandler); _viewManager->systemHotkeys().add(Common::KEYCODE_F2, &saveGameHotkeyHandler); @@ -454,7 +454,7 @@ Common::Error M4Engine::goM4() { _kernel->loadRoomScriptFunctions(); _kernel->roomInit(); - + #ifdef INTRO_TEST if (_kernel->currentRoom == 951) { curPart = 0; @@ -505,13 +505,13 @@ Common::Error M4Engine::goM4() { _ws->update(); _viewManager->refreshAll(); nextFrame = g_system->getMillis();// + GAME_FRAME_DELAY; - + // TEST STUFF ONLY if (_player->commandReady) { _kernel->roomParser(); _player->commandReady = false; } - + } g_system->delayMillis(10); diff --git a/engines/m4/m4.h b/engines/m4/m4.h index ac3262e7b8..69887b0fa4 100644 --- a/engines/m4/m4.h +++ b/engines/m4/m4.h @@ -116,7 +116,7 @@ protected: virtual Common::Error go(); void shutdown(); - + MidiPlayer *_midi; public: diff --git a/engines/m4/m4_menus.cpp b/engines/m4/m4_menus.cpp index 09c0afe313..88bcf85d05 100644 --- a/engines/m4/m4_menus.cpp +++ b/engines/m4/m4_menus.cpp @@ -139,7 +139,7 @@ void OrionCallbacks::saveLoadSaveFn(DialogView *view, MenuObject *item) { GUI::MessageDialog dialog("Save game failed!"); dialog.runModal(); } - + // Close the menu closeMenuFn(view, item); } @@ -170,7 +170,7 @@ void OrionCallbacks::saveLoadSlotFn(DialogView *view, MenuObject *item) { if (view->getMenuType() == SAVE_MENU) { // Add in a text field for entry of the savegame name vw->items().push_back(new MenuTextField(view, SLTAG_TEXTFIELD, - slotBounds.left, slotBounds.top, slotBounds.width(), slotBounds.height(), false, + slotBounds.left, slotBounds.top, slotBounds.width(), slotBounds.height(), false, saveLoadSaveFn, (button->getText() == EmptySaveString) ? NULL : button->getText(), button->getIndex() + 1)); @@ -180,7 +180,7 @@ void OrionCallbacks::saveLoadSlotFn(DialogView *view, MenuObject *item) { saveLoadLoadFn, button->getText(), button->getIndex() + 1)); } - // Hide the existing slot + // Hide the existing slot button->setVisible(false); // Disable the slider @@ -207,7 +207,7 @@ void OrionCallbacks::saveLoadCancelFn(DialogView *view, MenuObject *item) { currentItem->setState(OS_NORMAL); } } - + // Show the previously hidden slot again MenuSaveLoadText *slot = (MenuSaveLoadText *) view->getItem(SLTAG_SLOTS_START + view->_selectedSlot); slot->setVisible(true); @@ -257,7 +257,7 @@ void OrionCallbacks::saveLoadSliderFn(DialogView *view, MenuObject *item) { switch (slider->sliderState()) { case VSLIDER_UP: - if (newIndex > 0) + if (newIndex > 0) --newIndex; break; @@ -344,9 +344,9 @@ OrionMenuView::OrionMenuView(M4Engine *Vm, int x, int y, MenuType menuType, bool _menuObjects.push_back(new MenuButton(this, BTNID_RESUME, 45, 135, 24, 24, &OrionCallbacks::closeMenuFn)); _menuObjects.push_back(new MenuButton(this, BTNID_QUIT, 141, 135, 24, 24, &OrionCallbacks::gameExitFn)); _menuObjects.push_back(new MenuButton(this, BTNID_SAVE, 141, 53, 24, 24, &OrionCallbacks::gameSaveGameFn, _calledFromMainMenu)); - _menuObjects.push_back(new MenuButton(this, BTNID_LOAD, 141, 94, 24, 24, &OrionCallbacks::gameLoadGameFn, + _menuObjects.push_back(new MenuButton(this, BTNID_LOAD, 141, 94, 24, 24, &OrionCallbacks::gameLoadGameFn, !_vm->_saveLoad->hasSaves())); - + _escapeHandler = &OrionCallbacks::closeMenuFn; _returnHandler = &OrionCallbacks::closeMenuFn; break; @@ -359,13 +359,13 @@ OrionMenuView::OrionMenuView(M4Engine *Vm, int x, int y, MenuType menuType, bool // Add menu contents // TODO: Currently the Digi slider isn't hooked up to anything - _menuObjects.push_back(new MenuButton(this, OPTIONID_CANCEL, 93, 141, 74, 43, + _menuObjects.push_back(new MenuButton(this, OPTIONID_CANCEL, 93, 141, 74, 43, &OrionCallbacks::optionsCancelFn, false, false, OBJTYPE_OM_CANCEL)); - _menuObjects.push_back(new MenuButton(this, OPTIONID_DONE, 168, 141, 74, 43, + _menuObjects.push_back(new MenuButton(this, OPTIONID_DONE, 168, 141, 74, 43, &OrionCallbacks::optionsDoneFn, false, false, OBJTYPE_OM_DONE)); - _menuObjects.push_back(new MenuHorizSlider(this, OPTIONID_HSLIDER_MIDI, 47, 64, 212, 24, + _menuObjects.push_back(new MenuHorizSlider(this, OPTIONID_HSLIDER_MIDI, 47, 64, 212, 24, _originalMidiVolume * 100 / 255, &OrionCallbacks::optionsMidiSliderFn, true)); - _menuObjects.push_back(new MenuHorizSlider(this, OPTIONID_HSLIDER_DIGI, 47, 104, 212, 24, + _menuObjects.push_back(new MenuHorizSlider(this, OPTIONID_HSLIDER_DIGI, 47, 104, 212, 24, 0, &OrionCallbacks::optionsDigiSliderFn, true)); _escapeHandler = &OrionCallbacks::optionsEscapeFn; @@ -381,21 +381,21 @@ OrionMenuView::OrionMenuView(M4Engine *Vm, int x, int y, MenuType menuType, bool _selectedSlot = -1; _highlightedSlot = -1; _saveNames = _vm->_saveLoad->getSaves(); - + // Set up menu elements _menuObjects.push_back(new MenuMessage(this, SLTAG_SAVELOAD_LABEL, 50, 241, 70, 16)); - _menuObjects.push_back(new MenuButton(this, SLTAG_SAVELOAD, 214, 384, 72, 41, - (menuType == SAVE_MENU) ? &OrionCallbacks::saveLoadSaveFn : &OrionCallbacks::saveLoadLoadFn, + _menuObjects.push_back(new MenuButton(this, SLTAG_SAVELOAD, 214, 384, 72, 41, + (menuType == SAVE_MENU) ? &OrionCallbacks::saveLoadSaveFn : &OrionCallbacks::saveLoadLoadFn, true, true, (menuType == SAVE_MENU) ? OBJTYPE_SL_SAVE : OBJTYPE_SL_LOAD)); - _menuObjects.push_back(new MenuButton(this, SLTAG_CANCEL, 139, 384, 74, 43, + _menuObjects.push_back(new MenuButton(this, SLTAG_CANCEL, 139, 384, 74, 43, &OrionCallbacks::saveLoadCancelFn, false, false, OBJTYPE_SL_CANCEL)); - _menuObjects.push_back(new MenuVertSlider(this, SLTAG_VSLIDER, 291, 255, 23, 127, 0, + _menuObjects.push_back(new MenuVertSlider(this, SLTAG_VSLIDER, 291, 255, 23, 127, 0, &OrionCallbacks::saveLoadSliderFn)); if (_menuType == SAVE_MENU) _savegameThumbnail = createThumbnail(); - _menuObjects.push_back(new MenuImage(this, SLTAG_THUMBNAIL, 66, 28, 215, 162, + _menuObjects.push_back(new MenuImage(this, SLTAG_THUMBNAIL, 66, 28, 215, 162, (_savegameThumbnail == NULL) ? _sprites->getFrame(SL_EMPTY_THUMBNAIL) : _savegameThumbnail)); @@ -405,9 +405,9 @@ OrionMenuView::OrionMenuView(M4Engine *Vm, int x, int y, MenuType menuType, bool // Get save slot bool isEmpty = (slotIndex >= _saveNames->size()) || (*slot).empty(); - _menuObjects.push_back(new MenuSaveLoadText(this, SLTAG_SLOTS_START + slotIndex, + _menuObjects.push_back(new MenuSaveLoadText(this, SLTAG_SLOTS_START + slotIndex, 50, 256 + slotIndex * 15, 238, 15, &OrionCallbacks::saveLoadSlotFn, - (menuType == LOAD_MENU) && isEmpty, true, (menuType == LOAD_MENU), + (menuType == LOAD_MENU) && isEmpty, true, (menuType == LOAD_MENU), isEmpty ? EmptySaveString : slot->c_str(), slotIndex + 1)); } } @@ -428,7 +428,7 @@ OrionMenuView::OrionMenuView(M4Engine *Vm, int x, int y, MenuType menuType, bool OrionMenuView::~OrionMenuView() { delete _sprites; - + for (MenuObjectList::iterator i = _menuObjects.begin(); i != _menuObjects.end(); ++i) delete *i; _menuObjects.clear(); @@ -506,7 +506,7 @@ M4Surface *OrionMenuView::createThumbnail() { for (int yCtr = yStart; yCtr <= yEnd; yCtr += 3) { srcP = (byte *)srcSurface.pixels + (yCtr * _vm->_screen->width()); - for (int xCtr = 0; xCtr < result->width(); ++xCtr, srcP += 3) + for (int xCtr = 0; xCtr < result->width(); ++xCtr, srcP += 3) *destP++ = *srcP; } @@ -518,7 +518,7 @@ void OrionMenuView::destroyView() { bool interfaceVisible = _interfaceWasVisible; engine->_viewManager->deleteView(this); - // Fade the game back in if no menu views are active (such as if a button was pressed in one menu + // Fade the game back in if no menu views are active (such as if a button was pressed in one menu // to activate another menu dialog) bool fadeIn = engine->_viewManager->getView(VIEWID_MENU) == NULL; @@ -589,7 +589,7 @@ bool OrionMenuView::onEvent(M4EventType eventType, int param, int x, int y, bool } if (_currentItem) { - captureEvents = + captureEvents = (Common::find(_menuObjects.begin(), _menuObjects.end(), _currentItem) != _menuObjects.end()); if (!captureEvents) // The menu object is no longer active, so reset current item @@ -614,11 +614,11 @@ bool OrionMenuView::onEvent(M4EventType eventType, int param, int x, int y, bool return handledFlag; } else { - // Handle mouse events by scanning the item list to see if the cursor is within any + // Handle mouse events by scanning the item list to see if the cursor is within any for (i = _menuObjects.begin(); (i != _menuObjects.end()) && !handledFlag; ++i) { MenuObject *menuObj = *i; - + if (menuObj->isInside(localX, localY)) { // Found an item, so pass it the event menuObj->onEvent(eventType, param, localX, localY, _currentItem); @@ -631,7 +631,7 @@ bool OrionMenuView::onEvent(M4EventType eventType, int param, int x, int y, bool } if (_currentItem) { - captureEvents = + captureEvents = (Common::find(_menuObjects.begin(), _menuObjects.end(), _currentItem) != _menuObjects.end()); if (!captureEvents) // The menu object is no longer active, so reset current item @@ -708,7 +708,7 @@ void OrionMenuView::setTopSaveSlot(int slotNumber) { bool isEmpty = (slotIndex >= _saveNames->size()) || slot->empty(); item->setDisplay(slotIndex + 1, isEmpty ? EmptySaveString : slot->c_str()); - + item->setState((_menuType == SAVE_MENU) || !isEmpty ? OS_NORMAL : OS_GREYED); } } diff --git a/engines/m4/m4_views.cpp b/engines/m4/m4_views.cpp index 777356467b..f9ad5a6fbd 100644 --- a/engines/m4/m4_views.cpp +++ b/engines/m4/m4_views.cpp @@ -31,7 +31,7 @@ namespace M4 { -GUIInventory::GUIInventory(View *owner, M4Engine *vm, const Common::Rect &bounds, int horizCells, +GUIInventory::GUIInventory(View *owner, M4Engine *vm, const Common::Rect &bounds, int horizCells, int vertCells, int cellWidth, int cellHeight, int tag): GUIRect(owner, bounds, tag) { _vm = vm; @@ -60,7 +60,7 @@ void GUIInventory::onRefresh() { //kernel_trigger_dispatch(kernel_trigger_create(TRIG_INV_CLICK)); _scrollable = false; - + // Get to the starting inventory position for display ItemsIterator i = _inventoryItems.begin(); int index = _scrollPosition; @@ -70,7 +70,7 @@ void GUIInventory::onRefresh() { for (index = 0; (i != _inventoryItems.end()) && (index < _cellCount.x * _cellCount.y); ++index, ++i) { GUIInventoryItem *item = (*i).get(); const Common::Point cellPos = getCellPosition(index); -/* Common::Rect cellBounds(_bounds.left + cellPos.x + xOffset, +/* Common::Rect cellBounds(_bounds.left + cellPos.x + xOffset, _bounds.top + cellPos.y + yOffset, _bounds.left + cellPos.x + xOffset + _cellSize.x, _bounds.top + cellPos.y + _cellSize.y);*/ @@ -83,9 +83,9 @@ void GUIInventory::onRefresh() { item->icon->copyTo(_parent, iconPt.x, iconPt.y, 0); - if (_highlightedIndex == index) + if (_highlightedIndex == index) _parent->frameRect(Common::Rect(iconPt.x - 2, iconPt.y - 2, - iconPt.x + item->icon->width() + 2, iconPt.y + item->icon->height() + 2), + iconPt.x + item->icon->width() + 2, iconPt.y + item->icon->height() + 2), _vm->_palette->LIGHT_GRAY); } } @@ -203,13 +203,13 @@ void GUIInventory::setHighlight(int index) { _highlightedIndex = index; } -void GUIInventory::setScrollPosition(int value) { +void GUIInventory::setScrollPosition(int value) { if (value < 0) return; else if (value >= (int)_inventoryItems.size() - (_cellCount.x * _cellCount.y)) return; - _scrollPosition = value; + _scrollPosition = value; } //-------------------------------------------------------------------------- @@ -218,8 +218,8 @@ const char *INTERFACE_SERIES = "999intr"; #define SPR(x) _sprites->getFrame(x) -GameInterfaceView::GameInterfaceView(M4Engine *vm): - View(vm, Common::Rect(0, vm->_screen->height() - INTERFACE_HEIGHT, +GameInterfaceView::GameInterfaceView(M4Engine *vm): + View(vm, Common::Rect(0, vm->_screen->height() - INTERFACE_HEIGHT, vm->_screen->width(), vm->_screen->height())), _statusText(GUITextField(this, Common::Rect(200, 1, 450, 21))), _inventory(GUIInventory(this, vm, Common::Rect(188, 22, 539, 97), 9, 1, 39, 75, 3)) { @@ -249,7 +249,7 @@ GameInterfaceView::GameInterfaceView(M4Engine *vm): _buttons.push_back(ButtonList::value_type(new GUIButton(this, Common::Rect(580, 10, 620, 69), 3, SPR(69), SPR(70), SPR(71)))); // abduction _buttons.push_back(ButtonList::value_type(new GUIButton(this, Common::Rect(582, 70, 619, 105), 4, SPR(76), SPR(77), SPR(78)))); // menu - + _buttons.push_back(ButtonList::value_type(new GUIButton(this, Common::Rect(168, 22, 188, 97), 5, SPR(60), SPR(61), SPR(62)))); // Scroll left _buttons.push_back(ButtonList::value_type(new GUIButton(this, Common::Rect(539, 22, 559, 97), 6, SPR(64), SPR(65), SPR(66)))); // Scroll right } @@ -272,7 +272,7 @@ bool GameInterfaceView::onEvent(M4EventType eventType, int param, int x, int y, static bool selectionFlag = false; if (eventType == MEVENT_LEFT_RELEASE) selectionFlag = false; - + captureEvents = isInside(x, y); if (!captureEvents) return false; @@ -284,7 +284,7 @@ bool GameInterfaceView::onEvent(M4EventType eventType, int param, int x, int y, _statusText.onEvent(eventType, param, localX, localY, currentItem); _inventory.onEvent(eventType, param, localX, localY, currentItem); - if (_vm->_mouse->getCursorNum() != CURSOR_LOOK && + if (_vm->_mouse->getCursorNum() != CURSOR_LOOK && _vm->_mouse->getCursorNum() != CURSOR_TAKE && _vm->_mouse->getCursorNum() != CURSOR_USE && _vm->_interfaceView->_inventory.getSelectedIndex() == -1) { @@ -329,13 +329,13 @@ bool GameInterfaceView::onEvent(M4EventType eventType, int param, int x, int y, return true; } - + void GameInterfaceView::onRefresh(RectList *rects, M4Surface *destSurface) { clear(); _statusText.onRefresh(); _inventory.onRefresh(); - for (ButtonsIterator i = _buttons.begin(); i != _buttons.end(); ++i) + for (ButtonsIterator i = _buttons.begin(); i != _buttons.end(); ++i) ((*i).get())->onRefresh(); View::onRefresh(rects, destSurface); diff --git a/engines/m4/m4_views.h b/engines/m4/m4_views.h index 2f2d450332..ac1a2537ca 100644 --- a/engines/m4/m4_views.h +++ b/engines/m4/m4_views.h @@ -60,7 +60,7 @@ private: int _selectedIndex; M4Engine *_vm; public: - GUIInventory(View *owner, M4Engine *vm, const Common::Rect &bounds, + GUIInventory(View *owner, M4Engine *vm, const Common::Rect &bounds, int horizCells, int vertCells, int cellWidth, int cellHeight, int tag); void onRefresh(); @@ -71,14 +71,14 @@ public: int getInsideIndex(int x, int y); int getSelectedIndex() { return _selectedIndex; } const char *getSelectedObjectName(); - void clearSelected() { + void clearSelected() { _selectedIndex = -1; setHighlight(-1); } const Common::Point &getCellPosition(int index); void setHighlight(int index); bool needLeftButton() { return _scrollPosition != 0; } - bool needRightButton() { + bool needRightButton() { return (uint)(_inventoryItems.size() - _scrollPosition) > (uint)(_cellCount.x * _cellCount.y); } void setScrollPosition(int value); diff --git a/engines/m4/mads_anim.cpp b/engines/m4/mads_anim.cpp index f9374f866a..39ff2b739f 100644 --- a/engines/m4/mads_anim.cpp +++ b/engines/m4/mads_anim.cpp @@ -116,10 +116,10 @@ void TextviewView::setScript(const char *resourceName, TextviewCallback callback _script = _vm->res()->get(_resourceName); - processLines(); + processLines(); } -bool TextviewView::onEvent(M4EventType eventType, int param, int x, int y, bool &captureEvents) { +bool TextviewView::onEvent(M4EventType eventType, int param, int x, int y, bool &captureEvents) { if (!_processEvents) return false; @@ -180,7 +180,7 @@ void TextviewView::updateState() { byte *lineTemp = new byte[_panX]; for (int y = 0; y < _bgSurface.height(); ++y) { byte *pixelsP = _bgSurface.getBasePtr(0, y); - + // Copy the first X pixels into temp buffer, move the rest of the line // to the start of the line, and then move temp buffer pixels to end of line Common::copy(pixelsP, pixelsP + _panX, lineTemp); @@ -231,10 +231,10 @@ void TextviewView::updateState() { // Refresh the view int yp = (height() - _bgSurface.height()) / 2; _bgSurface.copyTo(this, 0, yp); - _textSurface.copyTo(this, Common::Rect(0, 0, _textSurface.width(), _bgSurface.height()), + _textSurface.copyTo(this, Common::Rect(0, 0, _textSurface.width(), _bgSurface.height()), 0, yp, _vm->_palette->BLACK); } - + void TextviewView::scriptDone() { TextviewCallback fn = _callback; M4Engine *vm = _vm; @@ -242,7 +242,7 @@ void TextviewView::scriptDone() { // Remove this view from manager and destroy it _vm->_viewManager->deleteView(this); - if (fn) + if (fn) fn(vm); } @@ -341,7 +341,7 @@ void TextviewView::processCommand() { // Set sound number paramP = commandStr + 5; //int soundId = getParameter(¶mP); - + //TODO: Proper handling of the sound drivers/sounds //if (!_soundDriverLoaded) // error("Attempted to set sound without loading any driver\n"); @@ -433,7 +433,7 @@ void TextviewView::processText() { // Copy the text line onto the bottom of the textSurface surface, which will allow it // to gradually scroll onto the screen int yp = _textSurface.height() - _vm->_font->getHeight() - TEXTVIEW_LINE_SPACING; - _textSurface.fillRect(Common::Rect(0, yp, _textSurface.width(), _textSurface.height()), + _textSurface.fillRect(Common::Rect(0, yp, _textSurface.width(), _textSurface.height()), _vm->_palette->BLACK); _vm->_font->writeString(&_textSurface, _currentLine, xStart, yp); } @@ -492,10 +492,10 @@ void AnimviewView::setScript(const char *resourceName, AnimviewCallback callback _script = _vm->res()->get(_resourceName); - processLines(); + processLines(); } -bool AnimviewView::onEvent(M4EventType eventType, int param, int x, int y, bool &captureEvents) { +bool AnimviewView::onEvent(M4EventType eventType, int param, int x, int y, bool &captureEvents) { // Wait for the Escape key or a mouse press if (((eventType == KEVENT_KEY) && (param == Common::KEYCODE_ESCAPE)) || (eventType == MEVENT_LEFT_RELEASE) || (eventType == MEVENT_RIGHT_RELEASE)) { @@ -510,7 +510,7 @@ bool AnimviewView::onEvent(M4EventType eventType, int param, int x, int y, bool void AnimviewView::updateState() { char bgFile[10]; int bgNumber = 0; - + // Only update state if wait period has expired if (_previousUpdate > 0) { if (g_system->getMillis() - _previousUpdate < 3000) { @@ -584,7 +584,7 @@ void AnimviewView::updateState() { // Read next line processLines(); } - + void AnimviewView::scriptDone() { AnimviewCallback fn = _callback; M4Engine *vm = _vm; @@ -592,7 +592,7 @@ void AnimviewView::scriptDone() { // Remove this view from manager and destroy it _vm->_viewManager->deleteView(this); - if (fn) + if (fn) fn(vm); } diff --git a/engines/m4/mads_anim.h b/engines/m4/mads_anim.h index 713e3bbfd5..4d380bbda8 100644 --- a/engines/m4/mads_anim.h +++ b/engines/m4/mads_anim.h @@ -48,7 +48,7 @@ typedef void (*TextviewCallback)(M4Engine *vm); class TextviewView: public View { private: bool _animating; - + char _resourceName[80]; Common::SeekableReadStream *_script; uint16 _spareScreens[10]; diff --git a/engines/m4/mads_menus.cpp b/engines/m4/mads_menus.cpp index 2857fc8080..3782b58e01 100644 --- a/engines/m4/mads_menus.cpp +++ b/engines/m4/mads_menus.cpp @@ -33,12 +33,12 @@ namespace M4 { #define DRAGON_MENUSCREEN 922 static Common::Point rexMenuItemPosList[6] = { - Common::Point(12, 68), Common::Point(12, 87), Common::Point(12, 107), + Common::Point(12, 68), Common::Point(12, 87), Common::Point(12, 107), Common::Point(184, 75), Common::Point(245, 75), Common::Point(184, 99) }; static Common::Point dragonMenuItemPosList[6] = { - Common::Point(46, 187), Common::Point(92, 187), Common::Point(138, 187), + Common::Point(46, 187), Common::Point(92, 187), Common::Point(138, 187), Common::Point(184, 187), Common::Point(230, 187), Common::Point(276, 187) }; @@ -85,7 +85,7 @@ RexMainMenuView::~RexMainMenuView() { for (uint i = 0; i < _itemPalData.size(); ++i) { _vm->_palette->deleteRange(_itemPalData[i]); delete _itemPalData[i]; - } + } } bool RexMainMenuView::onEvent(M4EventType eventType, int param, int x, int y, bool &captureEvents) { @@ -100,7 +100,7 @@ bool RexMainMenuView::onEvent(M4EventType eventType, int param, int x, int y, bo case Common::KEYCODE_F1: handleAction(START_GAME); break; - + case Common::KEYCODE_F2: handleAction(RESUME_GAME); break; @@ -162,7 +162,7 @@ bool RexMainMenuView::onEvent(M4EventType eventType, int param, int x, int y, bo menuIndex = getHighlightedItem(x, y); if (menuIndex != _highlightedIndex) { _bgSurface->copyTo(this, 0, row); - + _highlightedIndex = menuIndex; if (_highlightedIndex != -1) { M4Sprite *spr = _menuItem->getFrame(_highlightedIndex); @@ -184,7 +184,7 @@ bool RexMainMenuView::onEvent(M4EventType eventType, int param, int x, int y, bo default: break; } - + return false; } @@ -195,7 +195,7 @@ void RexMainMenuView::updateState() { int itemSize; uint32 currTime = g_system->getMillis(); - if (currTime < _delayTimeout) + if (currTime < _delayTimeout) return; _delayTimeout = currTime + MADS_MENU_ANIM_DELAY; @@ -213,8 +213,8 @@ void RexMainMenuView::updateState() { if (_menuItem) { // Draw the final frame of the menuitem M4Sprite *spr = _menuItem->getFrame(0); - itemSize = _menuItem->getFrame(0)->height(); - spr->copyTo(this, rexMenuItemPosList[_menuItemIndex - 1].x, + itemSize = _menuItem->getFrame(0)->height(); + spr->copyTo(this, rexMenuItemPosList[_menuItemIndex - 1].x, rexMenuItemPosList[_menuItemIndex - 1].y + row + (itemSize / 2) - (spr->height() / 2), 0); delete _menuItem; @@ -243,7 +243,7 @@ void RexMainMenuView::updateState() { if (_menuItem) { delete _menuItem; - // Copy over the current display surface area to the background, so the final frame + // Copy over the current display surface area to the background, so the final frame // of the previous menuitem should be kept on the screen copyTo(_bgSurface, Common::Rect(0, row, width(), row + MADS_SURFACE_HEIGHT), 0, 0); } @@ -262,7 +262,7 @@ void RexMainMenuView::updateState() { _frameIndex = _menuItem->getCount() - 1; - // If the final resource is now loaded, which contains the highlighted versions of + // If the final resource is now loaded, which contains the highlighted versions of // each menuitem, then the startup animation is complete if (_menuItemIndex == 7) { _vm->_mouse->cursorOn(); @@ -274,7 +274,7 @@ void RexMainMenuView::updateState() { // Move to the next menuitem frame - itemSize = _menuItem->getFrame(0)->height(); + itemSize = _menuItem->getFrame(0)->height(); _bgSurface->copyTo(this, 0, row); M4Sprite *spr = _menuItem->getFrame(_frameIndex); @@ -289,7 +289,7 @@ int RexMainMenuView::getHighlightedItem(int x, int y) { const Common::Point &pt = rexMenuItemPosList[index]; M4Sprite *spr = _menuItem->getFrame(index); - if ((x >= pt.x) && (y >= pt.y) && (x < (pt.x + spr->width())) && (y < (pt.y + spr->height()))) + if ((x >= pt.x) && (y >= pt.y) && (x < (pt.x + spr->width())) && (y < (pt.y + spr->height()))) return index; } @@ -346,9 +346,9 @@ void RexMainMenuView::handleAction(MadsGameAction action) { //-------------------------------------------------------------------------- -MadsMainMenuView::MadsMainMenuView(M4Engine *vm): +MadsMainMenuView::MadsMainMenuView(M4Engine *vm): View(vm, Common::Rect(0, 0, vm->_screen->width(), vm->_screen->height())) { - + } bool MadsMainMenuView::onEvent(M4EventType eventType, int param, int x, int y, bool &captureEvents) { @@ -391,7 +391,7 @@ DragonMainMenuView::~DragonMainMenuView() { for (uint i = 0; i < _itemPalData.size(); ++i) { _vm->_palette->deleteRange(_itemPalData[i]); delete _itemPalData[i]; - } + } } bool DragonMainMenuView::onEvent(M4EventType eventType, int param, int x, int y, bool &captureEvents) { @@ -409,7 +409,7 @@ bool DragonMainMenuView::onEvent(M4EventType eventType, int param, int x, int y, case Common::KEYCODE_F1: handleAction(START_GAME); break; - + case Common::KEYCODE_F2: handleAction(RESUME_GAME); break; @@ -439,7 +439,7 @@ bool DragonMainMenuView::onEvent(M4EventType eventType, int param, int x, int y, if (_vm->_mouse->getCursorOn()) { menuIndex = getHighlightedItem(x, y); if (menuIndex != _highlightedIndex) { - + _highlightedIndex = menuIndex; if (_highlightedIndex != -1) { sprintf(resName, "MAIN%d.SS", menuIndex); @@ -465,7 +465,7 @@ bool DragonMainMenuView::onEvent(M4EventType eventType, int param, int x, int y, default: break; } - + return false; } diff --git a/engines/m4/midi.h b/engines/m4/midi.h index 78dacdf77e..8e157cfbd1 100644 --- a/engines/m4/midi.h +++ b/engines/m4/midi.h @@ -93,7 +93,7 @@ protected: byte *convertHMPtoSMF(byte *data, uint32 inSize, uint32 &outSize); }; -} // End of namespace M4 +} // End of namespace M4 #endif - + diff --git a/engines/m4/rails.cpp b/engines/m4/rails.cpp index 0153934a88..18b3bf7232 100644 --- a/engines/m4/rails.cpp +++ b/engines/m4/rails.cpp @@ -174,10 +174,10 @@ long SqrtF16(long n) { uint32 v = (uint32)n; for (int i = 15; i <= 0; i--) { - s = r + (1L << i * 2); + s = r + (1L << i * 2); r >>= 1; - if (s <= v) { - v -= s; + if (s <= v) { + v -= s; r |= (1L << i * 2); } } @@ -254,7 +254,7 @@ void Rails::createEdge(int32 node1, int32 node2) { } -void Rails::restoreNodeEdges(int32 nodeID) { +void Rails::restoreNodeEdges(int32 nodeID) { for (int32 i = 0; i < MAXRAILNODES; i++) { createEdge(i, nodeID); } @@ -305,7 +305,7 @@ bool Rails::removeRailNode(int32 nodeID, bool restoreEdges) { int16 Rails::getEdgeLength(int32 node1, int32 node2) { int32 index; - if (_edges.empty() || node1 == node2) + if (_edges.empty() || node1 == node2) return 0; if (node2 < node1) SWAP(node1, node2); diff --git a/engines/m4/resource.cpp b/engines/m4/resource.cpp index 265e4dae0b..eb9a69998c 100644 --- a/engines/m4/resource.cpp +++ b/engines/m4/resource.cpp @@ -124,7 +124,7 @@ Common::SeekableReadStream *FileSystem::loadFile(const char *resourceName, bool else // Creates a SeekableSubReadStream, which will read the data in from disk as the // caller reads in data - result = new Common::SeekableSubReadStream(hagEntry->hagFile, hfe->offset, + result = new Common::SeekableSubReadStream(hagEntry->hagFile, hfe->offset, hfe->offset + hfe->size); } else { @@ -193,7 +193,7 @@ Common::SeekableReadStream *ResourceManager::get(const char *resourceName, bool newRes->name[63] = '\0'; newRes->flags = 0; newRes->stream = loadResource(resourceName, preloadFlag); - + _resources.push_back(ResourceList::value_type(newRes)); return newRes->stream; } @@ -231,7 +231,7 @@ void ResourceManager::dump() { ResourceIterator i; for (i = _resources.begin(); i != _resources.end(); ++i) { Resource *r = (*i).get(); - + if (!(r->flags & kResourcePurge)) { _vm->_events->getConsole()->DebugPrintf( "Resource #%i, name: %s, handle pointer: %p, size: %d, flags: %02X\n", @@ -272,7 +272,7 @@ ResourceType MADSResourceManager::getResourceType(const char *resourceName) { } else if (!strncmp(resourceName, "SPCHC", 5)) { // SPEECH resource return RESTYPE_SPEECH; - } + } // Check for a known extension const char *extPos = strchr(resourceName, '.'); @@ -313,7 +313,7 @@ Common::SeekableReadStream *MADSResourceManager::loadResource(const char *resour uint32 offset = 0, size = 0; // If the first character is a '@' then look for an external file - + if (*resourceName == '@') { ++resourceName; @@ -354,7 +354,7 @@ Common::SeekableReadStream *MADSResourceManager::loadResource(const char *resour } if (resIndex == numEntries) - error("Invalid resource '%s' specified", resourceName); + error("Invalid resource '%s' specified", resourceName); // Get the resource, either loading it in it's entirely or getting a stream reference @@ -426,7 +426,7 @@ Common::SeekableReadStream *M4ResourceManager::loadResource(const char *resource } else { error("M4ResourceManager::loadResource() No FileSystem attached"); } - return result; + return result; } bool M4ResourceManager::resourceExists(const char *resourceName) { diff --git a/engines/m4/saveload.cpp b/engines/m4/saveload.cpp index b46783ef4d..9147cd0906 100644 --- a/engines/m4/saveload.cpp +++ b/engines/m4/saveload.cpp @@ -38,7 +38,7 @@ SaveLoad::SaveLoad(M4Engine *vm) : _vm(vm) { // For Orion Burger, check the existance of a 'saves.dir' file to determine whether to // act exactly like the original. Otherwise, we'll use the ScummVM standard, where we'll // keep all the data for a savegame in a single file - + Common::File file; _emulateOriginal = file.exists(orionSavesList); } @@ -100,7 +100,7 @@ SaveGameList *SaveLoad::getSaves() { } else { // Skip over byte offset assert(saveFile->readUint32LE() < 0x100); - + // Read in savegame name saveFile->read(&saveName[0], MAX_SAVEGAME_NAME); result->push_back(Common::String(saveName)); @@ -133,7 +133,7 @@ M4Surface *SaveLoad::getThumbnail(int slotNumber) { // Open up savegame for access via savefile manager saveFile = _vm->saveManager()->openForLoading(generateSaveName(slotNumber)); } - if (!saveFile) + if (!saveFile) return NULL; dataOffset = saveFile->readUint32LE(); diff --git a/engines/m4/scene.cpp b/engines/m4/scene.cpp index c2de811d38..45659b8696 100644 --- a/engines/m4/scene.cpp +++ b/engines/m4/scene.cpp @@ -127,7 +127,7 @@ void Scene::loadScene(int sceneNumber) { } } - if (_vm->getGameType() == GType_Burger && + if (_vm->getGameType() == GType_Burger && sceneNumber != TITLE_SCENE_BURGER && sceneNumber != MAINMENU_SCENE_BURGER) _vm->_interfaceView->setStatusText(""); @@ -148,7 +148,7 @@ void Scene::loadScene(int sceneNumber) { // Load scene walk path file (*.COD/*.WW?) loadSceneCodes(sceneNumber); - + // Load inverse color table file (*.IPL) loadSceneInverseColorTable(sceneNumber); @@ -277,7 +277,7 @@ void Scene::loadSceneInverseColorTable(int sceneNumber) { // TODO? return; } - + } diff --git a/engines/m4/scene.h b/engines/m4/scene.h index 77578f5a02..4cf05ddddd 100644 --- a/engines/m4/scene.h +++ b/engines/m4/scene.h @@ -91,7 +91,7 @@ public: void checkHotspotAtMousePosMads(int x, int y); void showHotSpots(); void showCodes(); - int getCurrentScene() { return _currentScene; } + int getCurrentScene() { return _currentScene; } SceneResources getSceneResources() { return _sceneResources; } M4Surface *getBackgroundSurface() const { return _backgroundSurface; } byte *getInverseColorTable() const { return _inverseColorTable; } diff --git a/engines/m4/script.cpp b/engines/m4/script.cpp index c1725cbfdd..439c111ce9 100644 --- a/engines/m4/script.cpp +++ b/engines/m4/script.cpp @@ -59,9 +59,9 @@ enum OpcodeType { opXor, opShl, opShr, - + opDebug, - + opInvalid }; @@ -262,7 +262,7 @@ void ScriptInterpreter::open(const char *filename) { } _functions.push_back(new ScriptFunctionEntry(offset)); } - + int dataCount = _scriptFile->readUint32LE(); printf("dataCount = %d\n", dataCount); for (int i = 0; i < dataCount; i++) { @@ -304,7 +304,7 @@ void ScriptInterpreter::initScriptKernel() { _kernelFunctions = kernelFunctions; _kernelFunctionsMax = ARRAYSIZE(kernelFunctions) + 1; - + _kernelVars = kernelVars; _kernelVarsMax = ARRAYSIZE(kernelVars) + 1; @@ -360,7 +360,7 @@ int ScriptInterpreter::runFunction(ScriptFunction *scriptFunction) { done = !execOpcode(opcode); fflush(stdout); } - + _localStackPtr = oldLocalStackPtr; _runningFunction = oldRunningFunction; @@ -425,11 +425,11 @@ const char *ScriptInterpreter::toString(const ScriptValue &value) { case kConstString: return _constStrings[value.value]; - + default: printf("ScriptInterpreter::toString() Invalid type %d!\n", value.type); return NULL; - + } } @@ -487,7 +487,7 @@ void ScriptInterpreter::copyValue(ScriptValue &destValue, ScriptValue &sourceVal case kRegister: _registers[destValue.value] = sourceValue; break; - + case kLogicVar: // TODO: Move to own method if (sourceValue.type == kInteger) { @@ -546,7 +546,7 @@ void ScriptInterpreter::derefValue(ScriptValue &value) { void ScriptInterpreter::callKernelFunction(uint32 index) { printf("ScriptInterpreter::callKernelFunction() index = %d\n", index); - + if (index > _kernelFunctionsMax) { printf("ScriptInterpreter::callKernelFunction() Invalid kernel functionindex (%d)\n", index); return; @@ -558,7 +558,7 @@ void ScriptInterpreter::callKernelFunction(uint32 index) { // Now remove values from the stack if the function used any if (args > 4) _stackPtr -= args - 4; - + printf("-------------\n"); } @@ -656,7 +656,7 @@ bool ScriptInterpreter::execOpcode(byte opcode) { printf("-> ofs = %08X\n", temp); _runningFunction->jumpAbsolute(temp); return true; - + case opJl: temp = _runningFunction->readUint32(); if (_cmpFlags < 0) { @@ -779,7 +779,7 @@ bool ScriptInterpreter::execOpcode(byte opcode) { default: printf("Invalid opcode %d!\n", opcode); return false; - + } return false; @@ -947,13 +947,13 @@ int ScriptInterpreter::o1_playSound() { int room = INTEGER(4); printf("name = %s; channel = %d; volume = %d; trigger = %d; room = %d\n", name, channel, volume, trigger, room); - + Common::String soundName = Common::String(name) + ".raw"; _vm->_sound->playVoice(soundName.c_str(), 100); - + // HACK until fixed _vm->_kernel->sendTrigger(trigger); - + return 5; } @@ -994,10 +994,10 @@ int ScriptInterpreter::o1_fadeInit() { int trigger = INTEGER(5); printf("first = %d; last = %d; percent = %d; ticks = %d; trigger = %d\n", first, last, percent, ticks, trigger); - + // HACK until palette fading is implemented _vm->_kernel->sendTrigger(trigger); - + return 6; } @@ -1029,12 +1029,12 @@ int ScriptInterpreter::o1_hasPlayerSaid() { for (int i = 0; i < 3; i++) words[i] = STRING(i); printf("'%s', '%s', '%s'\n", words[0], words[1], words[2]); - + int result = _vm->_player->said(words[0], words[1], words[2]); printf(" -> '%d'\n", result); fflush(stdout); - + RETURN(result); return 3; } @@ -1046,7 +1046,7 @@ int ScriptInterpreter::o1_hasPlayerSaidAny() { printf("'%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s'\n", words[0], words[1], words[2], words[3], words[4], words[5], words[6], words[7], words[8], words[9]); - + int result = _vm->_player->saidAny(words[0], words[1], words[2], words[3], words[4], words[5], words[6], words[7], words[8], words[9]); printf(" -> '%d'\n", result); fflush(stdout); @@ -1097,9 +1097,9 @@ int ScriptInterpreter::o1_setHotspot() { const char *name = STRING(1); int value = INTEGER(2); printf("name = '%s' -> %d\n", name, value); - + _vm->_scene->getSceneResources().hotspots->setActive(name, (value != 0)); - + return 2; } @@ -1110,7 +1110,7 @@ int ScriptInterpreter::o1_loadConversation() { // TODO; just to show something _vm->_converse->startConversation(name); - + return 3; } @@ -1126,7 +1126,7 @@ int ScriptInterpreter::o1_playSeries() { int y = INTEGER(8); int firstFrame = INTEGER(9); int lastFrame = INTEGER(10); - + printf("name = %s; layer = %04X; flags = %08X; trigger = %d; frameRate = %d; loopCount = %d; scale = %d; x = %d; y = %d: firstFrame = %d; lastFrame = %d\n", name, layer, flags, trigger, frameRate, loopCount, scale, x, y, firstFrame, lastFrame); fflush(stdout); @@ -1165,9 +1165,9 @@ int ScriptInterpreter::o1_loadSeries() { printf("name = %s; hash = %d\n", name, hash); fflush(stdout); - + int result = _vm->_ws->loadSeries(name, hash, NULL); - + RETURN(result); return 3; } @@ -1210,10 +1210,10 @@ int ScriptInterpreter::o1_triggerTimerProc() { int ScriptInterpreter::o1_dispatchTrigger() { int trigger = INTEGER(0); printf("trigger = %d\n", trigger); - + _vm->_kernel->sendTrigger(trigger); //g_system->delayMillis(5000); - + return 1; } @@ -1226,11 +1226,11 @@ int ScriptInterpreter::o1_getRangedRandomValue() { int ScriptInterpreter::o1_wilburSaid() { const SaidArray& saidArray = DATA(0, SaidArray); - + int result = 0; // NOTE: The "Common::String soundName" stuff is just temporary until playVoice is fixed. - + for (int i = 0; i < saidArray.size(); i++) { SaidArrayItem *item = saidArray[i]; @@ -1265,7 +1265,7 @@ int ScriptInterpreter::o1_wilburSaid() { } printf(" -> '%d'\n", result); fflush(stdout); - + RETURN(result); return 1; } @@ -1287,13 +1287,13 @@ int ScriptInterpreter::o1_wilburSpeech() { printf("%s; %d; %d; %d; %d; %d\n", name, trigger, room, flag, volume, slot); fflush(stdout); //g_system->delayMillis(5000); - + KernelTriggerType oldTriggerMode = _vm->_kernel->triggerMode; // TODO Common::String soundName = Common::String(name) + ".raw"; _vm->_sound->playVoice(soundName.c_str(), 100); - + _vm->_kernel->triggerMode = oldTriggerMode; return 6; @@ -1346,7 +1346,7 @@ void ScriptInterpreter::getKernelVar(int index, ScriptValue &value) { case kPlayerCommandReady: value = (int)_vm->_player->commandReady; break; - + default: printf("ScriptInterpreter::getKernelVar() Invalid kernel var %d!\n", var); //g_system->delayMillis(2000); @@ -1358,14 +1358,14 @@ void ScriptInterpreter::getKernelVar(int index, ScriptValue &value) { void ScriptInterpreter::setKernelVar(int index, const ScriptValue &value) { printf("ScriptInterpreter::setKernelVar() index = %d\n", index); - + if (index > _kernelVarsMax) { printf("ScriptInterpreter::setKernelVar() Invalid kernel var index %d!\n", index); return; } printf("ScriptInterpreter::setKernelVar() name = %s\n", _kernelVars[index].desc); - + ScriptKernelVariable var = _kernelVars[index].var; switch (var) { @@ -1374,7 +1374,7 @@ void ScriptInterpreter::setKernelVar(int index, const ScriptValue &value) { _vm->_kernel->trigger = toInteger(value); printf("kKernelTrigger -> %d\n", toInteger(value)); break; - + case kKernelTriggerMode: _vm->_kernel->triggerMode = (KernelTriggerType)toInteger(value); printf("kKernelTrigger -> %d\n", toInteger(value)); @@ -1389,7 +1389,7 @@ void ScriptInterpreter::setKernelVar(int index, const ScriptValue &value) { _vm->_kernel->newRoom = toInteger(value); printf("kGameNewRoom -> %d\n", toInteger(value)); break; - + case kPlayerCommandReady: // TODO printf("kPlayerCommandReady -> %d\n", toInteger(value)); diff --git a/engines/m4/script.h b/engines/m4/script.h index 2a937040e9..63dc32958b 100644 --- a/engines/m4/script.h +++ b/engines/m4/script.h @@ -98,7 +98,7 @@ struct ScriptValue { value = intValue; return *this; } - + }; class ScriptDataItem { @@ -284,13 +284,13 @@ public: //TODO void unloadData(); /* Executes a function. */ int runFunction(ScriptFunction *scriptFunction); - + void push(const ScriptValue &value); void pop(ScriptValue &value); void dumpStack(); void dumpRegisters(); void dumpGlobalVars(); - + int toInteger(const ScriptValue &value); const char *toString(const ScriptValue &value); @@ -320,10 +320,10 @@ protected: Common::File *_scriptFile; /* An array of offset/ScriptFunction* pairs for each script function */ Common::Array _functions; - + // DEBUG only Common::Array _scriptFunctionNames; - + Common::Array _data; /* Maps function name -> index of function in _functions array */ FunctionNameMap _functionNames; @@ -339,7 +339,7 @@ protected: int _globalVarCount; ScriptValue _globalVars[1024]; - + int _logicGlobals[512]; int _cmpFlags; @@ -369,7 +369,7 @@ protected: void writeValue(ScriptValue &value); void copyValue(ScriptValue &destValue, ScriptValue &sourceValue); void derefValue(ScriptValue &value); - + void callKernelFunction(uint32 index); ScriptValue getArg(uint32 index); void dumpArgs(uint32 count); diff --git a/engines/m4/sound.cpp b/engines/m4/sound.cpp index 3091592313..542e8ebdcd 100644 --- a/engines/m4/sound.cpp +++ b/engines/m4/sound.cpp @@ -80,7 +80,7 @@ void Sound::playSound(const char *soundName, int volume, bool loop, int channel) } else { warning("Attempted to play a sound on a channel that isn't free"); return; - } + } } int bufferSize = soundStream->size(); @@ -124,7 +124,7 @@ void Sound::stopSound(int channel) { } else { warning("Attempted to stop a sound on a channel that is already free"); return; - } + } } for (int i = 0; i < SOUND_HANDLES; i++) { @@ -215,7 +215,7 @@ void Sound::loadDSRFile(const char *fileName) { printf("\n"); */ } - + _vm->res()->toss(fileName); _dsrFileLoaded = true; @@ -264,11 +264,11 @@ void Sound::playDSRSound(int soundIndex, int volume, bool loop) { fileStream->read(compData, _dsrFile.dsrEntries[soundIndex]->compSize); _vm->res()->toss(_dsrFile.fileName); - fab.decompress(compData, _dsrFile.dsrEntries[soundIndex]->compSize, + fab.decompress(compData, _dsrFile.dsrEntries[soundIndex]->compSize, buffer, _dsrFile.dsrEntries[soundIndex]->uncompSize); // Play sound - _mixer->playRaw(Audio::Mixer::kSFXSoundType, &handle->handle, buffer, + _mixer->playRaw(Audio::Mixer::kSFXSoundType, &handle->handle, buffer, _dsrFile.dsrEntries[soundIndex]->uncompSize, _dsrFile.dsrEntries[soundIndex]->frequency, flags, -1, volume); diff --git a/engines/m4/sprite.cpp b/engines/m4/sprite.cpp index 3862435216..6c7911b2e9 100644 --- a/engines/m4/sprite.cpp +++ b/engines/m4/sprite.cpp @@ -53,7 +53,7 @@ M4Sprite::M4Sprite(Common::SeekableReadStream* source, int xOfs, int yOfs, int w } else { loadMadsSprite(source); } - + xOffset = xOfs; yOffset = yOfs; diff --git a/engines/m4/viewmgr.cpp b/engines/m4/viewmgr.cpp index b74e598c6c..8bd56fab61 100644 --- a/engines/m4/viewmgr.cpp +++ b/engines/m4/viewmgr.cpp @@ -169,7 +169,7 @@ void View::restore(int x1, int y1, int x2, int y2) { void View::onRefresh(RectList *rects, M4Surface *destSurface) { assert(destSurface); - if (rects == NULL) + if (rects == NULL) // No rect list specified, so copy entire surface copyTo(destSurface, _coords.left, _coords.top, _transparent ? 0 : -1); else { @@ -222,7 +222,7 @@ void ViewManager::handleKeyboardEvents(uint32 keycode) { // Scan view list for one which accepts or blocks keyboard events. If one is found, // then the event is passed to it - + view = NULL; handledFlag = false; foundFlag = false; @@ -241,7 +241,7 @@ void ViewManager::handleKeyboardEvents(uint32 keycode) { handledFlag = (view->onEvent)(KEVENT_KEY, keycode, mousePos.x, mousePos.y, _captureEvents); } } - + // Scan view list for one with a hotkey list, aborting if a view is found that either // blocks keyboard events, or has a hotkey list that includes the keycode @@ -303,9 +303,9 @@ void ViewManager::handleMouseEvents(M4EventType event) { if (foundFlag) view->onEvent(event, 0, mousePos.x, mousePos.y, _captureEvents); - else + else _captureEvents = false; - if (_captureEvents) + if (_captureEvents) _captureScreen = view; } } @@ -363,7 +363,7 @@ View *ViewManager::getView(int screenType) { return *i; ++i; } - + return NULL; } @@ -395,7 +395,7 @@ void ViewManager::refreshAll() { void ViewManager::showTextView(const char *textViewName, bool returnToMainMenu) { // Deactivate the scene if it's currently active View *view = _vm->_viewManager->getView(VIEWID_SCENE); - if (view != NULL) + if (view != NULL) _vm->_viewManager->deleteView(view); // Deactivate the main menu if it's currently active @@ -416,7 +416,7 @@ void ViewManager::showTextView(const char *textViewName, bool returnToMainMenu) void ViewManager::showAnimView(const char *animViewName, bool returnToMainMenu) { // Deactivate the scene if it's currently active View *view = _vm->_viewManager->getView(VIEWID_SCENE); - if (view != NULL) + if (view != NULL) _vm->_viewManager->deleteView(view); // Deactivate the main menu if it's currently active diff --git a/engines/m4/viewmgr.h b/engines/m4/viewmgr.h index d3e7b1622d..4c4f227c5c 100644 --- a/engines/m4/viewmgr.h +++ b/engines/m4/viewmgr.h @@ -43,7 +43,7 @@ class ViewManager; enum {SCREEN_DIALOG, SCREEN_BUFFER, SCREEN_TEXT, SCREEN_TRANSPARENT}; enum ScreenEventType {SCREVENT_NONE = 0, SCREVENT_KEY = 1, SCREVENT_MOUSE = 2, SCREVENT_ALL = 3}; enum ScreenLayers { - LAYER_BACKGROUND = 0, LAYER_DRIFTER = 1, LAYER_INTERFACE = 1, LAYER_FLOATER = 2, + LAYER_BACKGROUND = 0, LAYER_DRIFTER = 1, LAYER_INTERFACE = 1, LAYER_FLOATER = 2, LAYER_SURFACE = 3, LAYER_MENU = 9, LAYER_MOUSE = 15 }; @@ -121,7 +121,7 @@ public: void moveRelative(int x, int y); void resize(int newWidth, int newHeight); void restore(int x1, int y1, int x2, int y2); - + Common::Rect bounds() const { return _coords; } bool isInside(int x, int y) const { return _coords.contains(x, y); } ScreenFlags screenFlags() const { return _screenFlags; } diff --git a/engines/m4/woodscript.cpp b/engines/m4/woodscript.cpp index 15d86a407e..25cfaa7664 100644 --- a/engines/m4/woodscript.cpp +++ b/engines/m4/woodscript.cpp @@ -159,9 +159,9 @@ WoodScript::WoodScript(M4Engine *vm) { _assets = new AssetManager(vm); _globals = new long[256]; //FIXME Find out how many globals there should be memset(_globals, 0, sizeof(long)); - + _backgroundSurface = NULL; - + Common::Rect viewBounds = Common::Rect(0, 0, 640, 480); //_surfaceView = new View(viewBounds); } @@ -206,10 +206,10 @@ Machine *WoodScript::createMachine(int32 machineHash, Sequence *parentSeq, _machineId++; _machines.push_back(machine); - + // goto first state for initialization machine->enterState(); - + return machine; } @@ -278,7 +278,7 @@ Machine *WoodScript::showSeries(const char *seriesName, long layer, uint32 flags _globals[kGlobTemp16] = (flags & SERIES_HORZ_FLIP) ? 0x10000 : 0; return createMachine(1, NULL, -1, -1, kCallbackTriggerDispatch, seriesName); - + } Machine *WoodScript::streamSeries(const char *seriesName, int32 frameRate, long layer, int32 triggerNum) { @@ -297,7 +297,7 @@ Machine *WoodScript::streamSeries(const char *seriesName, int32 frameRate, long void WoodScript::update() { // TODO: Don't show hidden sequences etc. - // TODO: For now, prevent any engine action if a menu is being displayed - eventually this should be + // TODO: For now, prevent any engine action if a menu is being displayed - eventually this should be // changed to a proper check of the engine paused variable, which the menus should set while active if (_vm->_viewManager->getView(VIEWID_MENU) != NULL) return; @@ -334,11 +334,11 @@ void WoodScript::update() { // TODO: Use correct clipRect etc. Common::Rect clipRect = Common::Rect(0, 0, 640, 480); Common::Rect updateRect; - + sequence->draw(_surfaceView, clipRect, updateRect); } - + // Handle end-of-sequence requests if (_endOfSequenceRequestList.size() > 0) { for (Common::Array::iterator it = _endOfSequenceRequestList.begin(); it != _endOfSequenceRequestList.end(); it++) { @@ -357,11 +357,11 @@ void WoodScript::clear() { for (Common::Array::iterator it = _sequences.begin(); it != _sequences.end(); it++) delete *it; _sequences.clear(); - + for (Common::Array::iterator it = _machines.begin(); it != _machines.end(); it++) delete *it; _machines.clear(); - + _layers.clear(); _endOfSequenceRequestList.clear(); diff --git a/engines/m4/woodscript.h b/engines/m4/woodscript.h index 7e968742b8..4a135e29ad 100644 --- a/engines/m4/woodscript.h +++ b/engines/m4/woodscript.h @@ -110,14 +110,14 @@ public: long *getVarPtr(int index); long *getParentVarPtr(int index); long *getDataPtr(int index); - + void setActive(bool active) { _active = active; } bool isActive() const { return _active; } bool isTerminated() const { return _terminated; } void draw(M4Surface *surface, const Common::Rect &clipRect, Common::Rect &updateRect); - + bool s1_end(Instruction &instruction); bool s1_clearVars(Instruction &instruction); bool s1_set(Instruction &instruction); @@ -185,9 +185,9 @@ protected: EndOfSequenceRequestItem _endOfSequenceRequest; int32 _indexReg; - + M4Sprite *_curFrame; - + int32 _sequenceHash; int32 _returnHashes[8]; //FIXME: Use constant instead of 8 @@ -305,7 +305,7 @@ public: /* Misc */ void setDepthTable(int16 *depthTable); - + long *getGlobalPtr(int index); long getGlobal(int index); void setGlobal(int index, long value); @@ -316,9 +316,9 @@ public: void setBackgroundSurface(M4Surface *backgroundSurface); // Sets the view which is used for drawing void setSurfaceView(View *view); - + RGB8 *getMainPalette() const; - + void setInverseColorTable(byte *inverseColorTable) { _inverseColorTable = inverseColorTable; } byte *getInverseColorTable() const { return _inverseColorTable; } @@ -331,7 +331,7 @@ protected: int32 _machineId; long *_globals; - + Common::Array _endOfSequenceRequestList; int32 _indexReg; diff --git a/engines/m4/ws_machine.cpp b/engines/m4/ws_machine.cpp index ece76fe5ab..0410f29f5b 100644 --- a/engines/m4/ws_machine.cpp +++ b/engines/m4/ws_machine.cpp @@ -125,7 +125,7 @@ bool Machine::searchPersistentMessages(uint32 messageHash, uint32 messageValue, void Machine::enterState() { MachineAsset *machineAsset = _ws->assets()->getMachine(_machHash); - + _code->jumpAbsolute(machineAsset->getStateOffset(_currentState)); int32 instruction = -1; @@ -207,7 +207,7 @@ void Machine::execBlock(int32 offset, int32 count) { instruction = execInstruction(); //g_system->delayMillis(500); } - + //printf("---------------------------------------\n"); fflush(stdout); if (instruction == 3) { diff --git a/engines/m4/ws_sequence.cpp b/engines/m4/ws_sequence.cpp index 918979ad17..e980d91675 100644 --- a/engines/m4/ws_sequence.cpp +++ b/engines/m4/ws_sequence.cpp @@ -284,7 +284,7 @@ long *Sequence::getDataPtr(int index) { void Sequence::draw(M4Surface *surface, const Common::Rect &clipRect, Common::Rect &updateRect) { SpriteInfo info; - + info.sprite = _curFrame; info.hotX = _curFrame->xOffset; info.hotY = _curFrame->yOffset; @@ -297,19 +297,19 @@ void Sequence::draw(M4Surface *surface, const Common::Rect &clipRect, Common::Re info.scaleX = _vars[kSeqVarWidth] < 0 ? -scaler : scaler; info.scaleY = scaler; surface->drawSprite(_vars[kSeqVarX] >> 16, _vars[kSeqVarY] >> 16, info, clipRect); - + } bool Sequence::s1_end(Instruction &instruction) { //printf("Sequence::s1_end()\n"); - + _terminated = true; return false; } bool Sequence::s1_clearVars(Instruction &instruction) { //printf("Sequence::s1_clearVars()\n"); - + clearVars(); _vars[kSeqVarMachineID] = _machine->getId(); return true; @@ -317,7 +317,7 @@ bool Sequence::s1_clearVars(Instruction &instruction) { bool Sequence::s1_set(Instruction &instruction) { //printf("Sequence::s1_set()\n"); - + *instruction.argp[0] = instruction.getValue(); return true; } @@ -337,7 +337,7 @@ bool Sequence::s1_compare(Instruction &instruction) { bool Sequence::s1_add(Instruction &instruction) { //printf("Sequence::s1_add()\n"); - + *instruction.argp[0] += instruction.getValue(); return true; } @@ -429,28 +429,28 @@ bool Sequence::s1_cos(Instruction &instruction) { bool Sequence::s1_abs(Instruction &instruction) { //printf("Sequence::s1_abs()\n"); - + *instruction.argp[0] = ABS(instruction.argv[1]); return true; } bool Sequence::s1_min(Instruction &instruction) { //printf("Sequence::s1_min()\n"); - + *instruction.argp[0] = MIN(instruction.argv[1], instruction.argv[2]); return true; } bool Sequence::s1_max(Instruction &instruction) { //printf("Sequence::s1_max()\n"); - + *instruction.argp[0] = MAX(instruction.argv[1], instruction.argv[2]); return true; } bool Sequence::s1_mod(Instruction &instruction) { //printf("Sequence::s1_mod()\n"); - + *instruction.argp[0] = instruction.argv[0] % instruction.getValue(); return true; } @@ -521,7 +521,7 @@ bool Sequence::s1_crunch(Instruction &instruction) { } // TODO: Update if walking etc. - + return false; } @@ -564,7 +564,7 @@ bool Sequence::s1_branch(Instruction &instruction) { bool Sequence::s1_setFrame(Instruction &instruction) { //printf("Sequence::s1_setFrame()\n"); - + int32 frameIndex; if (instruction.argc == 3) { frameIndex = _vm->imath_ranged_rand(instruction.argv[1] >> 16, instruction.argv[2] >> 16); @@ -573,10 +573,10 @@ bool Sequence::s1_setFrame(Instruction &instruction) { } else { frameIndex = (instruction.argv[0] & 0xFF0000) >> 16; } - + //printf("Sequence::s1_setFrame() spriteHash = %d\n", (uint32)instruction.argv[0] >> 24); //printf("Sequence::s1_setFrame() frameIndex = %d\n", frameIndex); - + SpriteAsset *spriteAsset = _ws->assets()->getSprite((uint32)instruction.argv[0] >> 24); _curFrame = spriteAsset->getFrame(frameIndex); @@ -603,7 +603,7 @@ bool Sequence::s1_pop(Instruction &instruction) { bool Sequence::s1_jumpSub(Instruction &instruction) { //printf("Sequence::s1_jumpSub()\n"); - + _returnHashes[_returnStackIndex] = _sequenceHash; _returnOffsets[_returnStackIndex] = _code->pos(); _returnStackIndex++; @@ -715,7 +715,7 @@ bool Sequence::s1_closeStream(Instruction &instruction) { bool Sequence::streamOpen() { _streamSpriteAsset = new SpriteAsset(_vm, _stream, _stream->size(), "stream", true); - + _vars[kSeqVarSpriteFrameNumber] = -0x10000; _vars[kSeqVarSpriteFrameCount] = _streamSpriteAsset->getCount() << 16; _vars[kSeqVarSpriteFrameRate] = _streamSpriteAsset->getFrameRate() << 16; diff --git a/engines/made/database.cpp b/engines/made/database.cpp index 8de30e28e8..b317862951 100644 --- a/engines/made/database.cpp +++ b/engines/made/database.cpp @@ -122,10 +122,10 @@ int ObjectV2::load(Common::SeekableReadStream &source) { delete[] _objData; _freeData = true; - + byte header[4]; source.read(header, 4); - + uint16 type = READ_LE_UINT16(header); if (type == 0x7FFF) { _objSize = READ_LE_UINT16(header + 2); @@ -370,11 +370,11 @@ GameDatabaseV2::~GameDatabaseV2() { } void GameDatabaseV2::load(Common::SeekableReadStream &sourceS) { - + // TODO: Read/verifiy header - + sourceS.seek(0x1C); - + uint32 textOffs = sourceS.readUint16LE() * 512; uint16 objectCount = sourceS.readUint16LE(); uint16 varObjectCount = sourceS.readUint16LE(); @@ -409,7 +409,7 @@ void GameDatabaseV2::load(Common::SeekableReadStream &sourceS) { sourceS.skip(objSize % 2); _objects.push_back(obj); } - + } void GameDatabaseV2::reloadFromStream(Common::SeekableReadStream &sourceS) { @@ -700,7 +700,7 @@ int16 *GameDatabaseV3::findObjectProperty(int16 objectIndex, int16 propertyId, i } return NULL; - + } const char *GameDatabaseV3::getString(uint16 offset) { diff --git a/engines/made/database.h b/engines/made/database.h index 3a6a0d6268..6d12e20b2b 100644 --- a/engines/made/database.h +++ b/engines/made/database.h @@ -82,11 +82,11 @@ public: byte getCount1(); byte getCount2(); byte *getData(); - + bool isConstant() { return false; } - + }; class ObjectV3 : public Object { @@ -100,11 +100,11 @@ public: byte getCount1(); byte getCount2(); byte *getData(); - + bool isConstant() { return !(getFlags() & 1); } - + }; class GameDatabase { diff --git a/engines/made/detection.cpp b/engines/made/detection.cpp index 57597ced37..afc1fdd9a3 100644 --- a/engines/made/detection.cpp +++ b/engines/made/detection.cpp @@ -244,7 +244,7 @@ static const MadeGameDescription gameDescriptions[] = { GF_DEMO, 0, }, - + { // The Manhole: New and Enhanced { diff --git a/engines/made/graphics.cpp b/engines/made/graphics.cpp index ee702893a0..35b00b466c 100644 --- a/engines/made/graphics.cpp +++ b/engines/made/graphics.cpp @@ -183,7 +183,7 @@ void decompressMovieImage(byte *source, Graphics::Surface &surface, uint16 cmdOf int bitBufLastCount = ((width + 3) >> 2) & 7; if (bitBufLastCount == 0) bitBufLastCount = 8; - + debug(1, "width = %d; bw = %d", width, bw); while (height > 0) { diff --git a/engines/made/made.cpp b/engines/made/made.cpp index fe4fcee63d..4baed339d5 100644 --- a/engines/made/made.cpp +++ b/engines/made/made.cpp @@ -79,7 +79,7 @@ MadeEngine::MadeEngine(OSystem *syst, const MadeGameDescription *gameDesc) : Eng int cd_num = ConfMan.getInt("cdrom"); if (cd_num >= 0) _system->openCD(cd_num); - + _pmvPlayer = new PmvPlayer(this, _mixer); _res = new ProjectReader(); _screen = new Screen(this); @@ -279,7 +279,7 @@ Common::Error MadeEngine::go() { _autoStopSound = false; _eventNum = _eventKey = _eventMouseX = _eventMouseY = 0; - + #ifdef DUMP_SCRIPTS _script->dumpAllScripts(); #else diff --git a/engines/made/pmvplayer.cpp b/engines/made/pmvplayer.cpp index 92497b74de..3cf35baf9c 100644 --- a/engines/made/pmvplayer.cpp +++ b/engines/made/pmvplayer.cpp @@ -84,7 +84,7 @@ void PmvPlayer::play(const char *filename) { uint32 palSize = 0; byte *frameData, *audioData, *soundData, *palData, *imageData; bool firstTime = true; - + uint32 soundStartTime = 0, skipFrames = 0; uint32 frameNum; @@ -106,7 +106,7 @@ void PmvPlayer::play(const char *filename) { frameData = new byte[chunkSize]; _fd->read(frameData, chunkSize); - + soundChunkOfs = READ_LE_UINT32(frameData + 8); palChunkOfs = READ_LE_UINT32(frameData + 16); @@ -156,7 +156,7 @@ void PmvPlayer::play(const char *filename) { } decompressMovieImage(imageData, *_surface, cmdOffs, pixelOffs, maskOffs, lineSize); - + if (firstTime) { _mixer->playInputStream(Audio::Mixer::kPlainSoundType, &_audioStreamHandle, _audioStream); soundStartTime = g_system->getMillis(); @@ -188,7 +188,7 @@ void PmvPlayer::play(const char *filename) { _audioStream->finish(); _mixer->stopHandle(_audioStreamHandle); - + //delete _audioStream; delete _fd; delete _surface; @@ -221,7 +221,7 @@ void PmvPlayer::handleEvents() { } void PmvPlayer::updateScreen() { - _vm->_system->copyRectToScreen((const byte*)_surface->pixels, _surface->pitch, + _vm->_system->copyRectToScreen((const byte*)_surface->pixels, _surface->pitch, (320 - _surface->w) / 2, (200 - _surface->h) / 2, _surface->w, _surface->h); _vm->_system->updateScreen(); } diff --git a/engines/made/redreader.cpp b/engines/made/redreader.cpp index a61d122041..1ce416c9f1 100644 --- a/engines/made/redreader.cpp +++ b/engines/made/redreader.cpp @@ -40,10 +40,10 @@ Common::MemoryReadStream *RedReader::load(const char *redFilename, const char *f error("RedReader::RedReader() Could not find %s in archive %s", filename, redFilename); byte *fileBuf = (byte *)malloc(fileEntry.origSize); - + LzhDecompressor lzhDec; lzhDec.decompress(fd, fileBuf, fileEntry.compSize, fileEntry.origSize); - + return new Common::MemoryReadStream(fileBuf, fileEntry.origSize, true); } diff --git a/engines/made/resource.cpp b/engines/made/resource.cpp index 2cae8b276c..bfd94ea86f 100644 --- a/engines/made/resource.cpp +++ b/engines/made/resource.cpp @@ -57,7 +57,7 @@ PictureResource::~PictureResource() { void PictureResource::load(byte *source, int size) { Common::MemoryReadStream *sourceS = new Common::MemoryReadStream(source, size); - + _hasPalette = (sourceS->readByte() != 0); byte cmdFlags = sourceS->readByte(); byte pixelFlags = sourceS->readByte(); @@ -109,7 +109,7 @@ void AnimationResource::load(byte *source, int size) { sourceS->readUint32LE(); sourceS->readUint32LE(); sourceS->readUint16LE(); - + _flags = sourceS->readUint16LE(); _width = sourceS->readUint16LE(); _height = sourceS->readUint16LE(); @@ -137,7 +137,7 @@ void AnimationResource::load(byte *source, int size) { uint16 maskOffs = sourceS->readUint16LE(); sourceS->readUint16LE(); uint16 lineSize = sourceS->readUint16LE(); - + Graphics::Surface *frame = new Graphics::Surface(); frame->create(frameWidth, frameHeight, 1); @@ -148,7 +148,7 @@ void AnimationResource::load(byte *source, int size) { } delete sourceS; - + } /* SoundResource */ @@ -165,16 +165,16 @@ void SoundResource::load(byte *source, int size) { uint16 chunkCount = READ_LE_UINT16(source + 8); uint16 chunkSize = READ_LE_UINT16(source + 12); - + _soundSize = chunkCount * chunkSize; _soundData = new byte[_soundSize]; - decompressSound(source + 14, _soundData, chunkSize, chunkCount); + decompressSound(source + 14, _soundData, chunkSize, chunkCount); } Audio::AudioStream *SoundResource::getAudioStream(int soundRate, bool loop) { byte flags = Audio::Mixer::FLAG_UNSIGNED; - if (loop) + if (loop) flags |= Audio::Mixer::FLAG_LOOP; return Audio::makeLinearInputStream(_soundData, _soundSize, soundRate, flags, 0, 0); diff --git a/engines/made/resource.h b/engines/made/resource.h index cb6e0b65f4..db327d6a3c 100644 --- a/engines/made/resource.h +++ b/engines/made/resource.h @@ -81,7 +81,7 @@ public: ~AnimationResource(); void load(byte *source, int size); int getCount() const { return _frames.size(); } - Graphics::Surface *getFrame(int index) const { + Graphics::Surface *getFrame(int index) const { if ((uint)index < _frames.size()) { return _frames[index]; } else { diff --git a/engines/made/screen.cpp b/engines/made/screen.cpp index 38a4baffc5..e3e56381e6 100644 --- a/engines/made/screen.cpp +++ b/engines/made/screen.cpp @@ -70,10 +70,10 @@ Screen::Screen(MadeEngine *vm) : _vm(vm) { _clip = 0; _exclude = 0; _mask = 0; - + _visualEffectNum = 0; _fx = new ScreenEffects(this); - + _textX = 0; _textY = 0; _textColor = 0; @@ -138,7 +138,7 @@ void Screen::setExcludeArea(uint16 x1, uint16 y1, uint16 x2, uint16 y2) { _excludeClipArea[3].clipRect = Common::Rect(x2, y1, 320, y2); _excludeClipAreaEnabled[3] = true; } - + } void Screen::drawSurface(Graphics::Surface *sourceSurface, int x, int y, int16 flipX, int16 flipY, int16 mask, const ClipInfo &clipInfo) { @@ -148,7 +148,7 @@ void Screen::drawSurface(Graphics::Surface *sourceSurface, int x, int y, int16 f int startY = 0; int clipWidth = sourceSurface->w; int clipHeight = sourceSurface->h; - + if (x < clipInfo.clipRect.left) { startX = clipInfo.clipRect.left - x; clipWidth -= startX; @@ -280,17 +280,17 @@ void Screen::drawSpriteChannels(const ClipInfo &clipInfo, int16 includeStateMask _excludeClipArea[i].destSurface = clipInfo.destSurface; _clipArea.destSurface = clipInfo.destSurface; - + for (uint16 i = 0; i < _channelsUsedCount; i++) { - + debug(2, "drawSpriteChannels() i = %d\n", i); - + if (((_channels[i].state & includeStateMask) == includeStateMask) && (_channels[i].state & excludeStateMask) == 0) { int16 flipX = _channels[i].state & 0x10; int16 flipY = _channels[i].state & 0x20; - + debug(2, "drawSpriteChannels() type = %d; index = %04X\n", _channels[i].type, _channels[i].index); - + switch (_channels[i].type) { case 1: // drawFlex @@ -306,7 +306,7 @@ void Screen::drawSpriteChannels(const ClipInfo &clipInfo, int16 includeStateMask drawFlex(_channels[i].index, _channels[i].x, _channels[i].y, flipX, flipY, _channels[i].mask, clipInfo); } break; - + case 2: // drawObjectText printObjectText(_channels[i].index, _channels[i].x, _channels[i].y, _channels[i].fontNum, _channels[i].textColor, _channels[i].outlineColor, clipInfo); break; @@ -328,14 +328,14 @@ void Screen::drawSpriteChannels(const ClipInfo &clipInfo, int16 includeStateMask case 4: // drawMenuText // Never used in any game break; - + default: break; } } - + } } @@ -349,9 +349,9 @@ void Screen::updateSprites() { drawSpriteChannels(_workScreenDrawCtx, 1, 2); _vm->_system->copyRectToScreen((const byte*)_workScreen->pixels, _workScreen->pitch, 0, 0, _workScreen->w, _workScreen->h); - + _vm->_system->updateScreen(); - + } void Screen::clearChannels() { @@ -432,30 +432,30 @@ uint16 Screen::placeSprite(uint16 channelIndex, uint16 flexIndex, int16 x, int16 if (channelIndex < 1 || channelIndex >= 100) return 0; - + channelIndex--; - + PictureResource *flex = _vm->_res->getPicture(flexIndex); - + if (flex) { Graphics::Surface *surf = flex->getPicture(); - + int16 state = 1; int16 x1, y1, x2, y2; - + x1 = x; y1 = y; x2 = x + surf->w + 1; y2 = y + surf->h + 1; //TODO: clipRect(x1, y1, x2, y2); - + if (_ground == 0) state |= 2; if (_clip != 0) state |= 4; if (_exclude != 0) state |= 8; - + _channels[channelIndex].state = state; _channels[channelIndex].type = 1; _channels[channelIndex].index = flexIndex; @@ -564,7 +564,7 @@ uint16 Screen::placeText(uint16 channelIndex, uint16 textObjectIndex, int16 x, i int textWidth = _font->getTextWidth(text); int textHeight = _font->getHeight(); - + if (outlineColor != -1) { textWidth += 2; textHeight += 2; @@ -582,9 +582,9 @@ uint16 Screen::placeText(uint16 channelIndex, uint16 textObjectIndex, int16 x, i x++; y++; } - + int16 state = 1; - + if (_ground == 0) state |= 2; @@ -652,7 +652,7 @@ void Screen::printChar(uint c, int16 x, int16 y, byte color) { uint width = 8, height = _font->getHeight(); byte *charData = _font->getChar(c); - + if (!charData) return; @@ -683,9 +683,9 @@ void Screen::printText(const char *text) { int linePos = 1; int16 x = _textX; int16 y = _textY; - + for (int textPos = 0; textPos < textLen; textPos++) { - + uint c = ((const byte*)text)[textPos]; int charWidth = _font->getCharWidth(c); @@ -714,17 +714,17 @@ void Screen::printText(const char *text) { // TODO: text[textPos] = '\x01'; } } - + if (x + charWidth > _textRect.right) { linePos = 1; x = _textRect.left; y += textHeight; } - + if (y + textHeight > _textRect.bottom) { // TODO } - + if (c >= 28 && c <= 255) { if (_dropShadowColor != -1) { printChar(c, x + 1, y + 1, _dropShadowColor); @@ -743,7 +743,7 @@ void Screen::printText(const char *text) { x += charWidth; linePos++; } - + } _textX = x; @@ -760,7 +760,7 @@ void Screen::printTextEx(const char *text, int16 x, int16 y, int16 fontNum, int1 ClipInfo oldFontDrawCtx = _fontDrawCtx; _fontDrawCtx = clipInfo; - + getTextRect(oldTextRect); setFont(fontNum); setTextColor(textColor); @@ -770,7 +770,7 @@ void Screen::printTextEx(const char *text, int16 x, int16 y, int16 fontNum, int1 setTextRect(oldTextRect); setFont(oldFontNum); _fontDrawCtx = oldFontDrawCtx; - + } void Screen::printObjectText(int16 objectIndex, int16 x, int16 y, int16 fontNum, int16 textColor, int16 outlineColor, const ClipInfo &clipInfo) { @@ -780,7 +780,7 @@ void Screen::printObjectText(int16 objectIndex, int16 x, int16 y, int16 fontNum, Object *obj = _vm->_dat->getObject(objectIndex); const char *text = obj->getString(); - + printTextEx(text, x, y, fontNum, textColor, outlineColor, clipInfo); } diff --git a/engines/made/screen.h b/engines/made/screen.h index 5d55085e5c..0e3b8a44f2 100644 --- a/engines/made/screen.h +++ b/engines/made/screen.h @@ -88,9 +88,9 @@ public: ~Screen(); void clearScreen(); - + void drawSurface(Graphics::Surface *sourceSurface, int x, int y, int16 flipX, int16 flipY, int16 mask, const ClipInfo &clipInfo); - + void loadRGBPalette(byte *palRGB, int count = 256); void setRGBPalette(byte *palRGB, int start = 0, int count = 256); bool isPaletteLocked() { return _paletteLock; } @@ -127,16 +127,16 @@ public: _dropShadowColor = -1; } - void setDropShadowColor(int16 color) { + void setDropShadowColor(int16 color) { _outlineColor = -1; _dropShadowColor = color; } - + void setTextXY(int16 x, int16 y) { _textX = x; _textY = y; } - + void homeText() { _textX = _textRect.left; _textY = _textRect.top; @@ -153,18 +153,18 @@ public: void drawSpriteChannels(const ClipInfo &clipInfo, int16 includeStateMask, int16 excludeStateMask); void updateSprites(); void clearChannels(); - + uint16 drawFlex(uint16 flexIndex, int16 x, int16 y, int16 flipX, int16 flipY, int16 mask, const ClipInfo &clipInfo); void drawAnimFrame(uint16 animIndex, int16 x, int16 y, int16 frameNum, int16 flipX, int16 flipY, const ClipInfo &clipInfo); uint16 drawPic(uint16 index, int16 x, int16 y, int16 flipX, int16 flipY); uint16 drawMask(uint16 index, int16 x, int16 y); - + uint16 drawAnimPic(uint16 animIndex, int16 x, int16 y, int16 frameNum, int16 flipX, int16 flipY); - + void addSprite(uint16 spriteIndex); - + uint16 drawSprite(uint16 flexIndex, int16 x, int16 y); uint16 placeSprite(uint16 channelIndex, uint16 flexIndex, int16 x, int16 y); @@ -173,7 +173,7 @@ public: int16 getAnimFrame(uint16 channelIndex); uint16 placeText(uint16 channelIndex, uint16 textObjectIndex, int16 x, int16 y, uint16 fontNum, int16 textColor, int16 outlineColor); - + void show(); void flash(int count); @@ -193,13 +193,13 @@ public: int16 addToSpriteList(int16 index, int16 xofs, int16 yofs); SpriteListItem getFromSpriteList(int16 index); void clearSpriteList(); - + void setDefaultMouseCursor(); protected: MadeEngine *_vm; ScreenEffects *_fx; - + bool _screenLock; bool _paletteLock; @@ -219,18 +219,18 @@ protected: int16 _clip, _exclude, _ground, _mask; int _visualEffectNum; - + Graphics::Surface *_backgroundScreen, *_workScreen, *_screenMask; ClipInfo _clipArea, _backgroundScreenDrawCtx, _workScreenDrawCtx, _maskDrawCtx; - + ClipInfo _excludeClipArea[4]; bool _excludeClipAreaEnabled[4]; - + uint16 _channelsUsedCount; SpriteChannel _channels[100]; - + Common::Array _spriteList; - + }; } // End of namespace Made diff --git a/engines/made/script.cpp b/engines/made/script.cpp index e4fd82b90f..45497b81a7 100644 --- a/engines/made/script.cpp +++ b/engines/made/script.cpp @@ -179,7 +179,7 @@ ScriptInterpreter::ScriptInterpreter(MadeEngine *vm) : _vm(vm) { _functions = new ScriptFunctions(_vm); _functions->setupExternalsTable(); - + #undef COMMAND } @@ -574,20 +574,20 @@ void ScriptInterpreter::cmd_send() { debug(4, "\nENTER: stackPtr = %d; _localStackPos = %d", _stack.getStackPos(), _localStackPos); byte argc = readByte(); - + debug(4, "argc = %d", argc); - + _stack.push(argc); _stack.push(_codeIp - _codeBase); _stack.push(_runningScriptObjectIndex); _stack.push(kScriptStackLimit - _localStackPos); _localStackPos = _stack.getStackPos(); - + int16 propertyId = _stack.peek(_localStackPos + argc + 2); int16 objectIndex = _stack.peek(_localStackPos + argc + 4); debug(4, "objectIndex = %d (%04X); propertyId = %d(%04X)", objectIndex, objectIndex, propertyId, propertyId); - + if (objectIndex != 0) { objectIndex = _vm->_dat->getObject(objectIndex)->getClass(); } else { @@ -625,9 +625,9 @@ void ScriptInterpreter::cmd_extend() { int16 result = _functions->callFunction(func, argc, argv); debug(2, "result = %04X (%d)", result, result); - + _stack.free(argc); - + _stack.setTop(result); } @@ -685,7 +685,7 @@ void ScriptInterpreter::dumpScript(int16 objectIndex, int *opcodeStats, int *ext Object *obj = _vm->_dat->getObject(objectIndex); byte *code = obj->getData(), *codeStart = code, *codeEnd = code + obj->getSize(); - + while (code < codeEnd) { byte opcode = *code++; if (opcode >= 1 && opcode <= _commandsMax) { diff --git a/engines/made/scriptfuncs.cpp b/engines/made/scriptfuncs.cpp index 835d846108..72ce3e238c 100644 --- a/engines/made/scriptfuncs.cpp +++ b/engines/made/scriptfuncs.cpp @@ -93,7 +93,7 @@ void ScriptFunctions::setupExternalsTable() { External(sfLoadMouseCursor); External(sfSetSpriteGround); External(sfLoadResText); - + if (_vm->getGameID() == GID_MANHOLE || _vm->getGameID() == GID_LGOP2 || _vm->getGameID() == GID_RODNEY) { External(sfAddScreenMask); External(sfSetSpriteMask); @@ -113,7 +113,7 @@ void ScriptFunctions::setupExternalsTable() { External(sfGetCdTime); External(sfPlayCdSegment); } - + if (_vm->getGameID() == GID_RTZ) { External(sfPrintf); External(sfClearMono); @@ -236,7 +236,7 @@ int16 ScriptFunctions::sfPlaySound(int16 argc, int16 *argv) { _vm->_autoStopSound = (argv[0] == 1); } if (soundNum > 0) { - _vm->_mixer->playInputStream(Audio::Mixer::kPlainSoundType, &_audioStreamHandle, + _vm->_mixer->playInputStream(Audio::Mixer::kPlainSoundType, &_audioStreamHandle, _vm->_res->getSound(soundNum)->getAudioStream(_vm->_soundRate, false)); } return 0; @@ -833,18 +833,18 @@ int16 ScriptFunctions::sfGetMenuCount(int16 argc, int16 *argv) { } int16 ScriptFunctions::sfSaveGame(int16 argc, int16 *argv) { - + int16 saveNum = argv[2]; int16 descObjectIndex = argv[1]; int16 version = argv[0]; - + if (saveNum > 999) return 6; const char *description = _vm->_dat->getObjectString(descObjectIndex); Common::String filename = _vm->getSavegameFilename(saveNum); return _vm->_dat->savegame(filename.c_str(), description, version); - + } int16 ScriptFunctions::sfLoadGame(int16 argc, int16 *argv) { @@ -857,11 +857,11 @@ int16 ScriptFunctions::sfLoadGame(int16 argc, int16 *argv) { Common::String filename = _vm->getSavegameFilename(saveNum); return _vm->_dat->loadgame(filename.c_str(), version); - + } int16 ScriptFunctions::sfGetGameDescription(int16 argc, int16 *argv) { - + int16 descObjectIndex = argv[2]; int16 saveNum = argv[1]; /*int16 version = argv[0];*/ diff --git a/engines/made/scriptfuncs.h b/engines/made/scriptfuncs.h index 9879556c3f..39dd9ad77e 100644 --- a/engines/made/scriptfuncs.h +++ b/engines/made/scriptfuncs.h @@ -63,7 +63,7 @@ protected: Common::Array _externalFuncs; Common::Array _externalFuncNames; GenericResource *_musicRes; - + int16 sfSystemCall(int16 argc, int16 *argv); int16 sfInitGraf(int16 argc, int16 *argv); int16 sfRestoreGraf(int16 argc, int16 *argv); diff --git a/engines/made/sound.cpp b/engines/made/sound.cpp index 27cf516b11..98426ea20b 100644 --- a/engines/made/sound.cpp +++ b/engines/made/sound.cpp @@ -59,7 +59,7 @@ void decompressSound(byte *source, byte *dest, uint16 chunkSize, uint16 chunkCou workChunkSize /= 4; type = (*source++) & 0x0F; - + workSample = prevSample; switch (type) { diff --git a/engines/metaengine.h b/engines/metaengine.h index af01c2658f..0a4ac680b5 100644 --- a/engines/metaengine.h +++ b/engines/metaengine.h @@ -113,9 +113,9 @@ public: } /** - * Remove the specified save state. + * Remove the specified save state. * - * For most engines this just amounts to calling _saveFileMan->removeSaveFile(). + * For most engines this just amounts to calling _saveFileMan->removeSaveFile(). * Engines which keep an index file will also update it accordingly. * * @note MetaEngines must indicate that this function has been implemented @@ -141,7 +141,7 @@ public: /** @name MetaEngineFeature flags */ //@{ - + /** * A feature in this context means an ability of the engine which can be * either available or not. @@ -153,7 +153,7 @@ public: * Used for --list-saves support, as well as the GMM load dialog. */ kSupportsListSaves, - + /** * Loading from the Launcher / command line (-x) */ @@ -189,7 +189,7 @@ public: kSavesSupportThumbnail, /** - * Features 'save_date' and 'save_time' entries in the + * Features 'save_date' and 'save_time' entries in the * savestate returned by querySaveMetaInfo. Those values * indicate the date/time the savegame was created. * This flag may only be set when 'kSavesSupportMetaInfo' is set. @@ -208,7 +208,7 @@ public: /** * Determine whether the engine supports the specified MetaEngine feature. * Used by e.g. the launcher to determine whether to enable the "Load" button. - */ + */ virtual bool hasFeature(MetaEngineFeature f) const { return false; } diff --git a/engines/queen/queen.cpp b/engines/queen/queen.cpp index ce4144d39d..e0241fb014 100644 --- a/engines/queen/queen.cpp +++ b/engines/queen/queen.cpp @@ -147,13 +147,13 @@ SaveStateList QueenMetaEngine::listSaves(const char *target) const { for (Common::StringList::const_iterator file = filenames.begin(); file != filenames.end(); ++file) { // Obtain the last 2 digits of the filename, since they correspond to the save slot int slotNum = atoi(file->c_str() + file->size() - 2); - + if (slotNum >= 0 && slotNum <= 99) { Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str()); if (in) { for (int i = 0; i < 4; i++) in->readUint32BE(); - in->read(saveDesc, 32); + in->read(saveDesc, 32); saveList.push_back(SaveStateDescriptor(slotNum, saveDesc)); delete in; } @@ -353,7 +353,7 @@ Common::Error QueenEngine::saveGameState(int slot, const char *desc) { warning("Can't create file '%s', game not saved", name); err = Common::kCreatingFileFailed; } - + return err; } diff --git a/engines/queen/queen.h b/engines/queen/queen.h index 34ba0ab8e7..3f7e40fc0f 100644 --- a/engines/queen/queen.h +++ b/engines/queen/queen.h @@ -102,7 +102,7 @@ public: void talkSpeed(int speed) { _talkSpeed = speed; } bool subtitles() const { return _subtitles; } void subtitles(bool enable) { _subtitles = enable; } - + void update(bool checkPlayerInput = false); bool canLoadOrSave() const; diff --git a/engines/saga/detection.cpp b/engines/saga/detection.cpp index 2d42ba336f..53540186d6 100644 --- a/engines/saga/detection.cpp +++ b/engines/saga/detection.cpp @@ -198,7 +198,7 @@ SaveStateList SagaMetaEngine::listSaves(const char *target) const { for (Common::StringList::const_iterator file = filenames.begin(); file != filenames.end(); ++file) { // Obtain the last 2 digits of the filename, since they correspond to the save slot slotNum = atoi(file->c_str() + file->size() - 2); - + if (slotNum >= 0 && slotNum <= 99) { Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str()); if (in) { @@ -285,7 +285,7 @@ SaveStateDescriptor SagaMetaEngine::querySaveMetaInfos(const char *target, int s int year = saveDate & 0xFFFF; desc.setSaveDate(year, month, day); - + int hour = (saveTime >> 8) & 0xFF; int minutes = saveTime & 0xFF; @@ -298,7 +298,7 @@ SaveStateDescriptor SagaMetaEngine::querySaveMetaInfos(const char *target, int s return desc; } - + return SaveStateDescriptor(); } @@ -358,12 +358,12 @@ Common::Error SagaEngine::saveGameState(int slot, const char *desc) { return Common::kNoError; // TODO: return success/failure } -bool SagaEngine::canLoadGameStateCurrently() { +bool SagaEngine::canLoadGameStateCurrently() { return !_scene->isInIntro(); } -bool SagaEngine::canSaveGameStateCurrently() { - return !_scene->isInIntro() && +bool SagaEngine::canSaveGameStateCurrently() { + return !_scene->isInIntro() && (_interface->getMode() == kPanelMain || _interface->getMode() == kPanelChapterSelection); } diff --git a/engines/saga/interface.cpp b/engines/saga/interface.cpp index 072a755f5d..166eb97d55 100644 --- a/engines/saga/interface.cpp +++ b/engines/saga/interface.cpp @@ -912,7 +912,7 @@ void Interface::drawPanelText(InterfacePanel *panel, PanelButton *panelButton) { textPoint.x = rect.left; textPoint.y = rect.top + 1; - _vm->_font->textDraw(textFont, text, textPoint, + _vm->_font->textDraw(textFont, text, textPoint, _vm->KnownColor2ColorId(kKnownColorVerbText), _vm->KnownColor2ColorId(textShadowKnownColor), kFontShadow); } @@ -1642,7 +1642,7 @@ void Interface::setOption(PanelButton *panelButton) { _vm->_subtitlesEnabled = true; // Set it to "Text" _vm->_voicesEnabled = false; } - + _vm->_speechVolume = _vm->_speechVolume + 25; if (_vm->_speechVolume > 255) _vm->_speechVolume = 0; ConfMan.setInt("speech_volume", _vm->_speechVolume); @@ -2378,8 +2378,8 @@ void Interface::drawVerbPanelText(PanelButton *panelButton, KnownColor textKnown point.y = _mainPanel.y + panelButton->yOffset + 12; } - _vm->_font->textDraw(kKnownFontVerb, text, point, - _vm->KnownColor2ColorId(textKnownColor), _vm->KnownColor2ColorId(textShadowKnownColor), + _vm->_font->textDraw(kKnownFontVerb, text, point, + _vm->KnownColor2ColorId(textKnownColor), _vm->KnownColor2ColorId(textShadowKnownColor), (textShadowKnownColor != kKnownColorTransparent) ? kFontShadow : kFontNormal); } diff --git a/engines/saga/introproc_fta2.cpp b/engines/saga/introproc_fta2.cpp index 0629ebe8e2..4e9541d0b9 100644 --- a/engines/saga/introproc_fta2.cpp +++ b/engines/saga/introproc_fta2.cpp @@ -48,7 +48,7 @@ public: } ~MoviePlayerSMK(void) { closeFile(); } - bool load(const char *filename) { + bool load(const char *filename) { _skipVideo = false; return loadFile(filename); } @@ -100,8 +100,8 @@ void MoviePlayerSMK::playVideo() { bool MoviePlayerSMK::processFrame() { Graphics::Surface *screen = _vm->_system->lockScreen(); - copyFrameToBuffer((byte *)screen->pixels, - (_vm->getDisplayInfo().width - getWidth()) / 2, + copyFrameToBuffer((byte *)screen->pixels, + (_vm->getDisplayInfo().width - getWidth()) / 2, (_vm->getDisplayInfo().height - getHeight()) / 2, _vm->getDisplayInfo().width); _vm->_system->unlockScreen(); diff --git a/engines/saga/itedata.cpp b/engines/saga/itedata.cpp index b8b14427b1..7f323b5587 100644 --- a/engines/saga/itedata.cpp +++ b/engines/saga/itedata.cpp @@ -257,7 +257,7 @@ ObjectTableData ITE_ObjectTable[ITE_OBJECTCOUNT] = { { 40, 269, 644, 416, 0, 41, 39, kObjNotFlat }, // Electrical Cable { 41, 12, 280, 516, 0, 43, 17, kObjUseWith }, // Piece of flint { 42, 5, 876, 332, 32, 65, 18, 0 }, // Rat Cloak - { 43, 52, 556, 1612, 0, 49, 28, kObjUseWith | + { 43, 52, 556, 1612, 0, 49, 28, kObjUseWith | kObjNotFlat }, // Bucket { 48, 52, 732, 948, 0, 50, 27, kObjUseWith }, // Cup { 49, 52, 520, 1872, 0, 53, 29, 0 }, // Fertilizer diff --git a/engines/saga/music.cpp b/engines/saga/music.cpp index 167861e7f2..8ed978791f 100644 --- a/engines/saga/music.cpp +++ b/engines/saga/music.cpp @@ -442,7 +442,7 @@ void Music::play(uint32 resourceId, MusicFlags flags) { uint32 loopStart; debug(2, "Music::play %d, %d", resourceId, flags); - + if (isPlaying() && _trackNumber == resourceId) { return; } @@ -450,7 +450,7 @@ void Music::play(uint32 resourceId, MusicFlags flags) { _trackNumber = resourceId; _player->stopMusic(); _mixer->stopHandle(_musicHandle); - + int realTrackNumber; if (_vm->getGameId() == GID_ITE) { diff --git a/engines/saga/render.cpp b/engines/saga/render.cpp index 688eed226e..599fde20e5 100644 --- a/engines/saga/render.cpp +++ b/engines/saga/render.cpp @@ -180,7 +180,7 @@ void Render::drawScene() { textPoint.x = (_vm->_gfx->getBackBufferWidth() - _vm->_font->getStringWidth(kKnownFontPause, pauseString, 0, kFontOutline)) / 2; textPoint.y = 90; - _vm->_font->textDraw(kKnownFontPause, pauseString, textPoint, + _vm->_font->textDraw(kKnownFontPause, pauseString, textPoint, _vm->KnownColor2ColorId(kKnownColorBrightWhite), _vm->KnownColor2ColorId(kKnownColorBlack), kFontOutline); } diff --git a/engines/saga/resource_hrs.cpp b/engines/saga/resource_hrs.cpp index 72f83981a6..cc59f7ccc9 100644 --- a/engines/saga/resource_hrs.cpp +++ b/engines/saga/resource_hrs.cpp @@ -56,7 +56,7 @@ bool Resource_HRS::loadResContext_v2(ResourceContext *context, uint32 contextSiz debug(3, "Context %s =====", context->fileName); context->file->seek(0, SEEK_SET); - + readElement(context->file, origin); // Check if the file is valid diff --git a/engines/saga/saga.cpp b/engines/saga/saga.cpp index f6249a7d0f..7f9fd6870c 100644 --- a/engines/saga/saga.cpp +++ b/engines/saga/saga.cpp @@ -233,7 +233,7 @@ Common::Error SagaEngine::init() { // Initialize system specific sound _sound = new Sound(this, _mixer); - + if (!isSaga2()) { _interface->converseInit(); _script->setVerb(_script->getVerbType(kVerbWalkTo)); diff --git a/engines/saga/script.cpp b/engines/saga/script.cpp index a81635d587..1384f1bf47 100644 --- a/engines/saga/script.cpp +++ b/engines/saga/script.cpp @@ -86,7 +86,7 @@ Script::Script(SagaEngine *vm) : _vm(vm) { } uint32 scriptResourceId = 0; - + if (!_vm->isSaga2()) { scriptResourceId = _vm->getResourceDescription()->moduleLUTResourceId; debug(3, "Loading module LUT from resource %i", scriptResourceId); diff --git a/engines/saga/sfuncs.cpp b/engines/saga/sfuncs.cpp index 01fe8c6c69..26933a36ea 100644 --- a/engines/saga/sfuncs.cpp +++ b/engines/saga/sfuncs.cpp @@ -279,7 +279,7 @@ void Script::sfTakeObject(SCRIPTFUNC_PARAMS) { // Normally, when objects are picked up, they should always have the same // _spriteListResourceId as their _index value. Some don't in IHNM, so // we fix their sprite here - // Fixes bugs #2057200 - "IHNM: Invisible inventory objects", + // Fixes bugs #2057200 - "IHNM: Invisible inventory objects", // #1861126 - "IHNM: Crash when Gorrister cuts sheet in the mooring ring" // and some incorrect objects in the IHNM demo if (_vm->getGameId() == GID_IHNM) diff --git a/engines/saga/sndres.cpp b/engines/saga/sndres.cpp index 4a32e4f929..38dacf0667 100644 --- a/engines/saga/sndres.cpp +++ b/engines/saga/sndres.cpp @@ -193,7 +193,7 @@ bool SndRes::load(ResourceContext *context, uint32 resourceId, SoundBuffer &buff if (_vm->getGameId() == GID_IHNM && _vm->isMacResources()) { char soundFileName[40]; int dirIndex = resourceId / 64; - + if ((context->fileType & GAME_VOICEFILE) != 0) { if (_voiceSerial == 0) { sprintf(soundFileName, "Voices/VoicesS/Voices%d/VoicesS%03x", dirIndex, resourceId); @@ -203,7 +203,7 @@ bool SndRes::load(ResourceContext *context, uint32 resourceId, SoundBuffer &buff } else { sprintf(soundFileName, "SFX/SFX%d/SFX%03x", dirIndex, resourceId); } - + file = new Common::File(); file->open(soundFileName); @@ -212,7 +212,7 @@ bool SndRes::load(ResourceContext *context, uint32 resourceId, SoundBuffer &buff ResourceData* resourceData = context->getResourceData(resourceId); file = context->getFile(resourceData); - + file->seek(resourceData->offset); soundResourceLength = resourceData->size; diff --git a/engines/saga/sound.cpp b/engines/saga/sound.cpp index e693e16629..50d4a2a766 100644 --- a/engines/saga/sound.cpp +++ b/engines/saga/sound.cpp @@ -63,7 +63,7 @@ SndHandle *Sound::getHandle() { return NULL; } -void Sound::playSoundBuffer(Audio::SoundHandle *handle, SoundBuffer &buffer, int volume, +void Sound::playSoundBuffer(Audio::SoundHandle *handle, SoundBuffer &buffer, int volume, sndHandleType handleType, bool loop) { byte flags; @@ -85,10 +85,10 @@ void Sound::playSoundBuffer(Audio::SoundHandle *handle, SoundBuffer &buffer, int if (!(_vm->getFeatures() & GF_COMPRESSED_SOUNDS)) { if (handleType == kVoiceHandle) - _mixer->playRaw(Audio::Mixer::kSpeechSoundType, handle, buffer.buffer, + _mixer->playRaw(Audio::Mixer::kSpeechSoundType, handle, buffer.buffer, buffer.size, buffer.frequency, flags, -1, volume); else - _mixer->playRaw(Audio::Mixer::kSFXSoundType, handle, buffer.buffer, + _mixer->playRaw(Audio::Mixer::kSFXSoundType, handle, buffer.buffer, buffer.size, buffer.frequency, flags, -1, volume); } else { Audio::AudioStream *stream = NULL; @@ -127,20 +127,20 @@ void Sound::playSoundBuffer(Audio::SoundHandle *handle, SoundBuffer &buffer, int default: // No compression, play it as raw sound if (handleType == kVoiceHandle) - _mixer->playRaw(Audio::Mixer::kSpeechSoundType, handle, buffer.buffer, + _mixer->playRaw(Audio::Mixer::kSpeechSoundType, handle, buffer.buffer, buffer.size, buffer.frequency, flags, -1, volume); else - _mixer->playRaw(Audio::Mixer::kSFXSoundType, handle, buffer.buffer, + _mixer->playRaw(Audio::Mixer::kSFXSoundType, handle, buffer.buffer, buffer.size, buffer.frequency, flags, -1, volume); break; } if (stream != NULL) { if (handleType == kVoiceHandle) - _mixer->playInputStream(Audio::Mixer::kSpeechSoundType, handle, stream, -1, + _mixer->playInputStream(Audio::Mixer::kSpeechSoundType, handle, stream, -1, volume, 0, true, false); else - _mixer->playInputStream(Audio::Mixer::kSFXSoundType, handle, stream, -1, + _mixer->playInputStream(Audio::Mixer::kSFXSoundType, handle, stream, -1, volume, 0, true, false); } } diff --git a/engines/saga/sound.h b/engines/saga/sound.h index 6d9e42a49d..cf6ca4a1a0 100644 --- a/engines/saga/sound.h +++ b/engines/saga/sound.h @@ -90,7 +90,7 @@ public: private: - void playSoundBuffer(Audio::SoundHandle *handle, SoundBuffer &buffer, int volume, + void playSoundBuffer(Audio::SoundHandle *handle, SoundBuffer &buffer, int volume, sndHandleType handleType, bool loop); SndHandle *getHandle(); diff --git a/engines/saga/sprite.cpp b/engines/saga/sprite.cpp index fc82490223..c246a8fafb 100644 --- a/engines/saga/sprite.cpp +++ b/engines/saga/sprite.cpp @@ -404,7 +404,7 @@ void Sprite::drawOccluded(SpriteList &spriteList, int spriteNumber, const Point sourceRowPointer += width; } - _vm->_render->addDirtyRect(Common::Rect(clipData.drawSource.x, clipData.drawSource.y, + _vm->_render->addDirtyRect(Common::Rect(clipData.drawSource.x, clipData.drawSource.y, clipData.drawSource.x + width, clipData.drawSource.y + height)); } diff --git a/engines/scumm/actor.cpp b/engines/scumm/actor.cpp index 1ea0da86d8..fdb066a4a3 100644 --- a/engines/scumm/actor.cpp +++ b/engines/scumm/actor.cpp @@ -1440,7 +1440,7 @@ void Actor::drawActorCostume(bool hitTestMode) { } setupActorScale(); - + BaseCostumeRenderer *bcr = _vm->_costumeRenderer; prepareDrawActorCostume(bcr); @@ -1456,7 +1456,7 @@ void Actor::drawActorCostume(bool hitTestMode) { } } - + void Actor::prepareDrawActorCostume(BaseCostumeRenderer *bcr) { bcr->_actorID = _number; @@ -1507,7 +1507,7 @@ void Actor::prepareDrawActorCostume(BaseCostumeRenderer *bcr) { void ActorHE::prepareDrawActorCostume(BaseCostumeRenderer *bcr) { Actor::prepareDrawActorCostume(bcr); - + bcr->_actorX += _heOffsX; bcr->_actorY += _heOffsY; diff --git a/engines/scumm/detection.cpp b/engines/scumm/detection.cpp index 326ee6d4c2..d9db5fc574 100644 --- a/engines/scumm/detection.cpp +++ b/engines/scumm/detection.cpp @@ -683,11 +683,11 @@ public: virtual const char *getName() const; virtual const char *getCopyright() const; - virtual bool hasFeature(MetaEngineFeature f) const; + virtual bool hasFeature(MetaEngineFeature f) const; virtual GameList getSupportedGames() const; virtual GameDescriptor findGame(const char *gameid) const; virtual GameList detectGames(const Common::FSList &fslist) const; - + virtual Common::Error createInstance(OSystem *syst, Engine **engine) const; virtual SaveStateList listSaves(const char *target) const; @@ -984,7 +984,7 @@ SaveStateList ScummMetaEngine::listSaves(const char *target) const { for (Common::StringList::const_iterator file = filenames.begin(); file != filenames.end(); ++file) { // Obtain the last 2 digits of the filename, since they correspond to the save slot int slotNum = atoi(file->c_str() + file->size() - 2); - + if (slotNum >= 0 && slotNum <= 99) { Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str()); if (in) { @@ -1016,7 +1016,7 @@ SaveStateDescriptor ScummMetaEngine::querySaveMetaInfos(const char *target, int // TODO: Cleanup Graphics::Surface *thumbnail = ScummEngine::loadThumbnailFromSlot(target, slot); - + SaveStateDescriptor desc(slot, saveDesc); desc.setDeletableFlag(true); desc.setThumbnail(thumbnail); @@ -1029,7 +1029,7 @@ SaveStateDescriptor ScummMetaEngine::querySaveMetaInfos(const char *target, int int year = infos.date & 0xFFFF; desc.setSaveDate(year, month, day); - + int hour = (infos.time >> 8) & 0xFF; int minutes = infos.time & 0xFF; diff --git a/engines/scumm/dialogs.cpp b/engines/scumm/dialogs.cpp index 6738e8d71a..cdbc2e3661 100644 --- a/engines/scumm/dialogs.cpp +++ b/engines/scumm/dialogs.cpp @@ -228,7 +228,7 @@ enum { SaveLoadChooser::SaveLoadChooser(const String &title, const String &buttonLabel, bool saveMode, ScummEngine *engine) : Dialog("ScummSaveLoad"), _saveMode(saveMode), _list(0), _chooseButton(0), _gfxWidget(0), _vm(engine) { - + _backgroundType = GUI::ThemeEngine::kDialogBackgroundSpecial; new StaticTextWidget(this, "ScummSaveLoad.Title", title); @@ -318,17 +318,17 @@ void SaveLoadChooser::reflowLayout() { if (g_gui.xmlEval()->getVar("Globals.ScummSaveLoad.ExtInfo.Visible") == 1) { int16 x, y; uint16 w, h; - + if (!g_gui.xmlEval()->getWidgetData("ScummSaveLoad.Thumbnail", x, y, w, h)) error("Error when loading position data for Save/Load Thumbnails."); - - int thumbW = kThumbnailWidth; + + int thumbW = kThumbnailWidth; int thumbH = ((g_system->getHeight() % 200 && g_system->getHeight() != 350) ? kThumbnailHeight2 : kThumbnailHeight1); int thumbX = x + (w >> 1) - (thumbW >> 1); int thumbY = y + kLineHeight; - + _container->resize(x, y, w, h); - _gfxWidget->resize(thumbX, thumbY, thumbW, thumbH); + _gfxWidget->resize(thumbX, thumbY, thumbW, thumbH); int height = thumbY + thumbH + kLineHeight; @@ -380,7 +380,7 @@ void SaveLoadChooser::updateInfos(bool redraw) { InfoStuff infos; memset(&infos, 0, sizeof(InfoStuff)); - if (selItem >= 0 && !_list->getSelectedString().empty() + if (selItem >= 0 && !_list->getSelectedString().empty() && _vm->loadInfosFromSlot(_saveMode ? selItem + 1 : selItem, &infos)) { char buffer[32]; snprintf(buffer, 32, "Date: %.2d.%.2d.%.4d", @@ -654,13 +654,13 @@ void HelpDialog::reflowLayout() { int lineHeight = g_gui.getFontHeight(); int16 x, y; uint16 w, h; - + g_gui.xmlEval()->getWidgetData("ScummHelp.HelpText", x, y, w, h); - + int keyW = w * 20 / 100; int dscX = x + keyW + 32; int dscW = w * 80 / 100; - + int xoff = (_w >> 1) - (w >> 1); for (int i = 0; i < HELP_NUM_LINES; i++) { diff --git a/engines/scumm/gfx.cpp b/engines/scumm/gfx.cpp index 4e8c22479d..04cde129fa 100644 --- a/engines/scumm/gfx.cpp +++ b/engines/scumm/gfx.cpp @@ -614,13 +614,13 @@ void ScummEngine::drawStripToScreen(VirtScreen *vs, int x, int width, int top, i const uint32 *src32 = (const uint32 *)src; const uint32 *text32 = (const uint32 *)text; uint32 *dst32 = (uint32 *)_compositeBuf; - + vsPitch >>= 2; const int textPitch = (_textSurface.pitch - width * m) >> 2; for (int h = height * m; h > 0; --h) { for (int w = width*m; w > 0; w-=4) { uint32 temp = *text32++; - + // Generate a byte mask for those text pixels (bytes) with // value CHARSET_MASK_TRANSPARENCY. In the end, each byte // in mask will be either equal to 0x00 or 0xFF. @@ -629,7 +629,7 @@ void ScummEngine::drawStripToScreen(VirtScreen *vs, int x, int width, int top, i uint32 mask = temp ^ CHARSET_MASK_TRANSPARENCY_32; mask = (((mask & 0x7f7f7f7f) + 0x7f7f7f7f) | mask) & 0x80808080; mask = ((mask >> 7) + 0x7f7f7f7f) ^ 0x80808080; - + // The following line is equivalent to this code: // *dst32++ = (*src32++ & mask) | (temp & ~mask); // However, some compilers can generate somewhat better diff --git a/engines/scumm/he/resource_he.cpp b/engines/scumm/he/resource_he.cpp index 74789bcc1e..49d0e2f729 100644 --- a/engines/scumm/he/resource_he.cpp +++ b/engines/scumm/he/resource_he.cpp @@ -526,7 +526,7 @@ int Win32ResExtractor::do_resources_recurs(WinLibrary *fi, WinResource *base, else return 0; } - + /* process each resource listed */ for (c = 0 ; c < rescnt ; c++) { /* (over)write the corresponding WinResource holder with the current */ diff --git a/engines/scumm/he/script_v80he.cpp b/engines/scumm/he/script_v80he.cpp index aa78757c53..55dc62c38d 100644 --- a/engines/scumm/he/script_v80he.cpp +++ b/engines/scumm/he/script_v80he.cpp @@ -475,7 +475,7 @@ void ScummEngine_v80he::o80_readConfigFile() { memcpy(section, "BluesTreasureHunt-Disc1\0", 24); else if (!strcmp((char *)section, "Blue'sTreasureHunt-Disc2")) memcpy(section, "BluesTreasureHunt-Disc2\0", 24); - } + } Common::ConfigFile ConfFile; if (!strcmp((char *)filename + r, "map.ini")) @@ -543,7 +543,7 @@ void ScummEngine_v80he::o80_writeConfigFile() { memcpy(section, "BluesTreasureHunt-Disc1\0", 24); else if (!strcmp((char *)section, "Blue'sTreasureHunt-Disc2")) memcpy(section, "BluesTreasureHunt-Disc2\0", 24); - } + } Common::ConfigFile ConfFile; ConfFile.loadFromSaveFile((const char *)filename + r); diff --git a/engines/scumm/he/wiz_he.cpp b/engines/scumm/he/wiz_he.cpp index c661812d09..55fc6cc900 100644 --- a/engines/scumm/he/wiz_he.cpp +++ b/engines/scumm/he/wiz_he.cpp @@ -933,7 +933,7 @@ uint8 Wiz::getWizPixelColor(const uint8 *data, int x, int y, int w, int h, uint return (READ_LE_UINT16(data) & 1) ? color : READ_LE_UINT16(data + 1); else return (data[0] & 1) ? color : data[1]; - + } uint8 Wiz::getRawWizPixelColor(const uint8 *data, int x, int y, int w, int h, uint bitDepth, uint8 color) { diff --git a/engines/scumm/player_v2a.cpp b/engines/scumm/player_v2a.cpp index 757b4a453f..719328d23f 100644 --- a/engines/scumm/player_v2a.cpp +++ b/engines/scumm/player_v2a.cpp @@ -1474,7 +1474,7 @@ private: uint16 _curfreq; }; -// plays a series of double-looped sounds at varying frequencies and delays, very specialized +// plays a series of double-looped sounds at varying frequencies and delays, very specialized // Guardian of the Sphinx, perhaps? class V2A_Sound_Special_Zak82 : public V2A_Sound_Base<4> { public: @@ -1616,7 +1616,7 @@ public: } _mod->stopChannel(_id | 0x000); _mode = 1; - + size = 0x2B8E; offset = _offset; assert(offset + size <= _offset + _size); diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h index 76ebab0f7c..e040cb1593 100644 --- a/engines/scumm/scumm.h +++ b/engines/scumm/scumm.h @@ -626,7 +626,7 @@ protected: void loadResource(Serializer *ser, int type, int index); Common::String makeSavegameName(int slot, bool temporary) const { - return makeSavegameName(_targetName, slot, temporary); + return makeSavegameName(_targetName, slot, temporary); } int getKeyState(int key); diff --git a/engines/scumm/smush/codec47.cpp b/engines/scumm/smush/codec47.cpp index 4bf2581365..62bc0bb098 100644 --- a/engines/scumm/smush/codec47.cpp +++ b/engines/scumm/smush/codec47.cpp @@ -566,7 +566,7 @@ Codec47Decoder::~Codec47Decoder() { bool Codec47Decoder::decode(byte *dst, const byte *src) { if ((_tableBig == NULL) || (_tableSmall == NULL) || (_deltaBuf == NULL)) return false; - + _offset1 = _deltaBufs[1] - _curBuf; _offset2 = _deltaBufs[0] - _curBuf; diff --git a/engines/scumm/smush/imuse_channel.cpp b/engines/scumm/smush/imuse_channel.cpp index fd34a8f60d..cab836fcc8 100644 --- a/engines/scumm/smush/imuse_channel.cpp +++ b/engines/scumm/smush/imuse_channel.cpp @@ -139,7 +139,7 @@ bool ImuseChannel::handleMap(byte *data) { default: error("Unknown iMUS subChunk found : %s, %d", tag2str(subType), subSize); } - + data += subSize; size -= subSize; } diff --git a/engines/sky/detection.cpp b/engines/sky/detection.cpp index 69b17a8093..e6cc131f47 100644 --- a/engines/sky/detection.cpp +++ b/engines/sky/detection.cpp @@ -69,7 +69,7 @@ public: virtual bool hasFeature(MetaEngineFeature f) const; virtual GameList getSupportedGames() const; virtual GameDescriptor findGame(const char *gameid) const; - virtual GameList detectGames(const Common::FSList &fslist) const; + virtual GameList detectGames(const Common::FSList &fslist) const; virtual Common::Error createInstance(OSystem *syst, Engine **engine) const; @@ -303,11 +303,11 @@ Common::Error SkyEngine::saveGameState(int slot, const char *desc) { return Common::kNoError; } -bool SkyEngine::canLoadGameStateCurrently() { +bool SkyEngine::canLoadGameStateCurrently() { return _systemVars.pastIntro && _skyControl->loadSaveAllowed(); } -bool SkyEngine::canSaveGameStateCurrently() { +bool SkyEngine::canSaveGameStateCurrently() { return _systemVars.pastIntro && _skyControl->loadSaveAllowed(); } diff --git a/engines/sword1/control.cpp b/engines/sword1/control.cpp index f4a4307501..eb61ffe4b3 100644 --- a/engines/sword1/control.cpp +++ b/engines/sword1/control.cpp @@ -729,7 +729,7 @@ void Control::readSavegameDescriptions(void) { for (Common::StringList::const_iterator file = filenames.begin(); file != filenames.end(); ++file) { // Obtain the last 3 digits of the filename, since they correspond to the save slot slotNum = atoi(file->c_str() + file->size() - 3); - + while (num < slotNum) { _saveNames.push_back(""); num++; @@ -818,7 +818,7 @@ void Control::checkForOldSaveGames() { slot++; } while ((ch != 255) && (!inf->eos())); - delete inf; + delete inf; // Delete index file _saveFileMan->removeSavefile("SAVEGAME.INF"); @@ -1050,7 +1050,7 @@ bool Control::restoreGameFromFile(uint8 slot) { if (saveHeader != SAVEGAME_HEADER) { // Display an error message, and do nothing displayMessage(0, "Save game '%s' is corrupt", fName); - return false; + return false; } inf->skip(40); // skip description @@ -1060,7 +1060,7 @@ bool Control::restoreGameFromFile(uint8 slot) { warning("Different save game version"); return false; } - + bool hasThumbnail = inf->readByte(); if (hasThumbnail) { @@ -1156,7 +1156,7 @@ bool Control::convertSaveGame(uint8 slot, char* desc) { free(saveData); saveData = NULL; return false; - } + } newSave->writeUint32LE(SAVEGAME_HEADER); newSave->write(desc, 40); diff --git a/engines/sword1/detection.cpp b/engines/sword1/detection.cpp index 657364cc11..b478199f86 100644 --- a/engines/sword1/detection.cpp +++ b/engines/sword1/detection.cpp @@ -203,7 +203,7 @@ SaveStateList SwordMetaEngine::listSaves(const char *target) const { for (Common::StringList::const_iterator file = filenames.begin(); file != filenames.end(); ++file) { // Obtain the last 3 digits of the filename, since they correspond to the save slot slotNum = atoi(file->c_str() + file->size() - 3); - + if (slotNum >= 0 && slotNum <= 999) { Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str()); if (in) { @@ -264,7 +264,7 @@ SaveStateDescriptor SwordMetaEngine::querySaveMetaInfos(const char *target, int int year = saveDate & 0xFFFF; desc.setSaveDate(year, month, day); - + int hour = (saveTime >> 8) & 0xFF; int minutes = saveTime & 0xFF; @@ -276,7 +276,7 @@ SaveStateDescriptor SwordMetaEngine::querySaveMetaInfos(const char *target, int return desc; } - + return SaveStateDescriptor(); } @@ -305,11 +305,11 @@ Common::Error SwordEngine::saveGameState(int slot, const char *desc) { return Common::kNoError; // TODO: return success/failure } -bool SwordEngine::canLoadGameStateCurrently() { +bool SwordEngine::canLoadGameStateCurrently() { return mouseIsActive(); } -bool SwordEngine::canSaveGameStateCurrently() { +bool SwordEngine::canSaveGameStateCurrently() { return mouseIsActive(); } #endif diff --git a/engines/sword2/sword2.cpp b/engines/sword2/sword2.cpp index 39c04da592..398eaada3e 100644 --- a/engines/sword2/sword2.cpp +++ b/engines/sword2/sword2.cpp @@ -187,7 +187,7 @@ SaveStateList Sword2MetaEngine::listSaves(const char *target) const { for (Common::StringList::const_iterator file = filenames.begin(); file != filenames.end(); ++file) { // Obtain the last 3 digits of the filename, since they correspond to the save slot int slotNum = atoi(file->c_str() + file->size() - 3); - + if (slotNum >= 0 && slotNum <= 999) { Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str()); if (in) { diff --git a/engines/tinsel/actors.cpp b/engines/tinsel/actors.cpp index c2402285b8..6020fa7d24 100644 --- a/engines/tinsel/actors.cpp +++ b/engines/tinsel/actors.cpp @@ -285,7 +285,7 @@ static void ActorTinselProcess(CORO_PARAM, const void *param) { // Run the Glitter code assert(actorInfo[atp->id - 1].actorCode); // no code to run - _ctx->pic = InitInterpretContext(GS_ACTOR, actorInfo[atp->id - 1].actorCode, + _ctx->pic = InitInterpretContext(GS_ACTOR, actorInfo[atp->id - 1].actorCode, atp->event, NOPOLY, atp->id, NULL); CORO_INVOKE_1(Interpret, _ctx->pic); @@ -374,7 +374,7 @@ void ActorEvent(CORO_PARAM, int ano, TINSEL_EVENT tEvent, bool bWait, int myEsca ano, // Actor NULL, // No object myEscape); - + if (atp.pic != NULL) { _ctx->pProc = g_scheduler->createProcess(PID_TCODE, ActorTinselProcess, &atp, sizeof(atp)); AttachInterpret(atp.pic, _ctx->pProc); @@ -386,7 +386,7 @@ void ActorEvent(CORO_PARAM, int ano, TINSEL_EVENT tEvent, bool bWait, int myEsca CORO_END_CODE; } - + /** * Called at the start of each scene for each actor with a code block. * @param as Actor structure @@ -1525,7 +1525,7 @@ bool ActorTagIsWanted(int actor) { } /** - * Given cursor position and an actor number, ascertains + * Given cursor position and an actor number, ascertains * whether the cursor is within the actor's tag area. * Returns True for a positive result, False for negative. */ @@ -1664,7 +1664,7 @@ int GetActorFilmNumber(int ano) { void StoreActorReel(int actor, int column, OBJECT *pObj) { RANGE_CHECK(actor); int i; - + for (i = 0; i < MAX_REELS; i++) { if (actorInfo[actor-1].presColumns[i] == -1) { // Store reel and object diff --git a/engines/tinsel/anim.cpp b/engines/tinsel/anim.cpp index 055e0bba94..b52d01860b 100644 --- a/engines/tinsel/anim.cpp +++ b/engines/tinsel/anim.cpp @@ -44,8 +44,8 @@ SCRIPTSTATE DoNextFrame(ANIM *pAnim) { const ANI_SCRIPT *pAni = (const ANI_SCRIPT *)LockMem(pAnim->hScript); while (1) { // repeat until a real image - debugC(DEBUG_DETAILED, kTinselDebugAnimations, - "DoNextFrame %ph index=%d, op=%xh", (byte *)pAnim, pAnim->scriptIndex, + debugC(DEBUG_DETAILED, kTinselDebugAnimations, + "DoNextFrame %ph index=%d, op=%xh", (byte *)pAnim, pAnim->scriptIndex, FROM_LE_32(pAni[pAnim->scriptIndex].op)); switch ((int32)FROM_LE_32(pAni[pAnim->scriptIndex].op)) { @@ -212,7 +212,7 @@ SCRIPTSTATE DoNextFrame(ANIM *pAnim) { void InitStepAnimScript(ANIM *pAnim, OBJECT *pAniObj, SCNHANDLE hNewScript, int aniSpeed) { OBJECT *pObj; // multi-object list iterator - debugC(DEBUG_DETAILED, kTinselDebugAnimations, + debugC(DEBUG_DETAILED, kTinselDebugAnimations, "InitStepAnimScript Object=(%d,%d,%xh) script=%xh aniSpeed=%d rec=%ph", !pAniObj ? 0 : fracToInt(pAniObj->xPos), !pAniObj ? 0 : fracToInt(pAniObj->yPos), diff --git a/engines/tinsel/bg.cpp b/engines/tinsel/bg.cpp index a5b4170673..0f83760987 100644 --- a/engines/tinsel/bg.cpp +++ b/engines/tinsel/bg.cpp @@ -211,7 +211,7 @@ static void BGotherProcess(CORO_PARAM, const void *param) { while (StepAnimScript(&_ctx->anim) != ScriptFinished) CORO_SLEEP(1); - + CORO_END_CODE; } diff --git a/engines/tinsel/bmv.cpp b/engines/tinsel/bmv.cpp index feac5d2c76..ef23ce06be 100644 --- a/engines/tinsel/bmv.cpp +++ b/engines/tinsel/bmv.cpp @@ -285,7 +285,7 @@ static void PrepBMV(const byte *sourceData, int length, short deltaFetchDisp) { // Shift another 2 bits to get hi nibble eax = (eax & 0xffffff00) | ((eax & 0xff) >> 2); NEXT_BYTE(esi); - + if ((eax & 0xC) != 0) { flag = true; ROL(eax, ecx); @@ -679,10 +679,10 @@ static int FollowingPacket(int thisPacket, bool bReallyImportant) { // Following 3 bytes are the length if (bReallyImportant) { // wrapped round or at least 3 bytes - assert(((nextReadSlot * SLOT_SIZE) < thisPacket) || + assert(((nextReadSlot * SLOT_SIZE) < thisPacket) || ((thisPacket + 3) < (nextReadSlot * SLOT_SIZE))); - if ((nextReadSlot * SLOT_SIZE >= thisPacket) && + if ((nextReadSlot * SLOT_SIZE >= thisPacket) && ((thisPacket + 3) >= nextReadSlot*SLOT_SIZE)) { // MaintainBuffer calls this back, but with false MaintainBuffer(); @@ -1005,7 +1005,7 @@ static bool DoBMVFrame(void) { xscr = -640; else xscr = 0; - + PrepBMV(bigBuffer + graphOffset, length, xscr); currentFrame++; @@ -1112,7 +1112,7 @@ void CopyMovieToScreen(void) { int yStart = (SCREEN_HEIGHT - SCREEN_HIGH) / 2; memset(_vm->screen().getBasePtr(0, 0), 0, yStart * SCREEN_WIDTH); memcpy(_vm->screen().getBasePtr(0, yStart), ScreenBeg, SCREEN_WIDTH * SCREEN_HIGH); - memset(_vm->screen().getBasePtr(0, yStart + SCREEN_HIGH), 0, + memset(_vm->screen().getBasePtr(0, yStart + SCREEN_HIGH), 0, (SCREEN_HEIGHT - SCREEN_HIGH - yStart) * SCREEN_WIDTH); BmvDrawText(true); diff --git a/engines/tinsel/cliprect.cpp b/engines/tinsel/cliprect.cpp index b67ae7b17f..bd84cc0049 100644 --- a/engines/tinsel/cliprect.cpp +++ b/engines/tinsel/cliprect.cpp @@ -128,7 +128,7 @@ void FindMovingObjects(OBJECT *pObjList, Common::Point *pWin, Common::Rect *pCli if ((pObj->flags & DMA_CHANGED) || // object changed HasPalMoved(pObj->pPal)) { // or palette moved // object has changed in some way - + Common::Rect rcClip; // objects clipped bounding rectangle Common::Rect rcObj; // objects bounding rectangle @@ -152,7 +152,7 @@ void FindMovingObjects(OBJECT *pObjList, Common::Point *pWin, Common::Rect *pCli rcObj.right = rcObj.left + pObj->width; rcObj.bottom = rcObj.top + pObj->height; - // calc intersection of object with clipping rect + // calc intersection of object with clipping rect if (IntersectRectangle(rcClip, rcObj, *pClip)) { // current position is within clipping rect AddClipRect(rcClip); diff --git a/engines/tinsel/config.cpp b/engines/tinsel/config.cpp index bec286a96b..4695a2e435 100644 --- a/engines/tinsel/config.cpp +++ b/engines/tinsel/config.cpp @@ -83,10 +83,10 @@ void WriteConfig(void) { default: lang = Common::EN_ANY; } - + ConfMan.set("language", Common::getLanguageCode(lang)); } - + // Write to disk ConfMan.flushToDisk(); } diff --git a/engines/tinsel/coroutine.h b/engines/tinsel/coroutine.h index 8cdbd44b19..30d90970b6 100644 --- a/engines/tinsel/coroutine.h +++ b/engines/tinsel/coroutine.h @@ -35,7 +35,7 @@ namespace Tinsel { * . * However, many improvements and tweaks have been made, in particular * by taking advantage of C++ features not available in C. - * + * * Why is this code here? Well, the Tinsel engine apparently used * setjmp/longjmp based coroutines as a core tool from the start, and * so they are deeply ingrained into the whole code base. When we @@ -45,7 +45,7 @@ namespace Tinsel { * would have meant a major restructuring of the entire code base, a * rather daunting task. Also, it would have very likely introduced * tons of regressons. - * + * * So instead of getting rid of the coroutines, we chose to implement * them in an alternate way, using Simon Tatham's trick as described * above. While the trick is dirty, the result seems to be clear enough, diff --git a/engines/tinsel/cursor.cpp b/engines/tinsel/cursor.cpp index 3fc3b974e9..c58a15849d 100644 --- a/engines/tinsel/cursor.cpp +++ b/engines/tinsel/cursor.cpp @@ -172,7 +172,7 @@ void SetCursorXY(int newx, int newy) { int Loffset, Toffset; // Screen offset PlayfieldGetPos(FIELD_WORLD, &Loffset, &Toffset); - newx -= Loffset; + newx -= Loffset; newy -= Toffset; if (GetDriverPosition(&x, &y)) @@ -210,7 +210,7 @@ bool GetCursorXYNoWait(int *x, int *y, bool absolute) { *x += Loffset; *y += Toffset; } - + return true; } @@ -443,7 +443,7 @@ static void DoCursorMove(void) { // get new mouse driver position - could have been modified ptMouse = _vm->getMousePosition(); - + if (lastCursorX != ptMouse.x || lastCursorY != ptMouse.y) { resetUserEventTime(); diff --git a/engines/tinsel/debugger.cpp b/engines/tinsel/debugger.cpp index 904763e228..b3cb2d1b92 100644 --- a/engines/tinsel/debugger.cpp +++ b/engines/tinsel/debugger.cpp @@ -46,7 +46,7 @@ extern SCNHANDLE GetSceneHandle(void); //----------------- SUPPORT FUNCTIONS --------------------- -//static +//static int strToInt(const char *s) { if (!*s) // No string at all diff --git a/engines/tinsel/detection.cpp b/engines/tinsel/detection.cpp index 4cae5885b5..32d4562ad9 100644 --- a/engines/tinsel/detection.cpp +++ b/engines/tinsel/detection.cpp @@ -52,8 +52,8 @@ uint32 TinselEngine::getFeatures() const { return _gameDescription->features; } -Common::Language TinselEngine::getLanguage() const { - return _gameDescription->desc.language; +Common::Language TinselEngine::getLanguage() const { + return _gameDescription->desc.language; } Common::Platform TinselEngine::getPlatform() const { @@ -454,14 +454,14 @@ public: virtual bool createInstance(OSystem *syst, Engine **engine, const Common::ADGameDescription *desc) const; - virtual bool hasFeature(MetaEngineFeature f) const; + virtual bool hasFeature(MetaEngineFeature f) const; virtual SaveStateList listSaves(const char *target) const; virtual int getMaximumSaveSlot() const; virtual void removeSaveState(const char *target, int slot) const; }; bool TinselMetaEngine::hasFeature(MetaEngineFeature f) const { - return + return (f == kSupportsListSaves) || // TODO: See tinsel.cpp ll 994-1005 #if 0 @@ -561,7 +561,7 @@ Common::Error TinselEngine::loadGameState(int slot) { // slot numbers instead of savelist entry numbers for loading. // This would also allow '-2' as slot for CD changes without // any major hackery. - + int listSlot = -1; const int numStates = Tinsel::getList(); for (int i = 0; i < numStates; ++i) { diff --git a/engines/tinsel/dialogs.cpp b/engines/tinsel/dialogs.cpp index b807abce57..c5d7449d3b 100644 --- a/engines/tinsel/dialogs.cpp +++ b/engines/tinsel/dialogs.cpp @@ -351,9 +351,9 @@ struct INV_DEF { int FirstDisp; // Index to first item currently displayed int inventoryX; // } Display position - int inventoryY; // } + int inventoryY; // } int otherX; // } Display position - int otherY; // } + int otherY; // } int MaxInvObj; // Max. allowed contents @@ -417,7 +417,7 @@ static OBJECT *RectObject = 0, *SlideObject = 0; // Current display objects, for // objects are in objArray. static int sliderYpos = 0; // For positioning the slider -static int sliderYmax = 0, sliderYmin = 0; // +static int sliderYmax = 0, sliderYmin = 0; // #define sliderRange (sliderYmax - sliderYmin) @@ -541,14 +541,14 @@ enum BFUNC { OPENQUIT, INITGAME, MUSICVOL, - + HOPPER2, // Call up Scene Hopper 2 BF_CHANGESCENE, CLANG, RLANG #ifdef MAC_OPTIONS - , MASTERVOL, SAMPVOL + , MASTERVOL, SAMPVOL #endif }; @@ -1418,7 +1418,7 @@ static void ObjectProcess(CORO_PARAM, const void *param) { */ void InvTinselEvent(INV_OBJECT *pinvo, TINSEL_EVENT event, PLR_EVENT be, int index) { OP_INIT to = { pinvo, event, be, 0 }; - + if (InventoryHidden || (TinselV2 && !pinvo->hScript)) return; @@ -1523,7 +1523,7 @@ void InvLoadGame(void) { if (iconArray[HL1] != NULL) { MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), iconArray[HL1]); iconArray[HL1] = NULL; - } + } RestoreGame(rGame+cd.extraBase); } } @@ -1643,7 +1643,7 @@ void Select(int i, bool force) { // New highlight box switch (cd.box[i].boxType) { case RGROUP: - iconArray[HL2] = RectangleObject(BgPal(), + iconArray[HL2] = RectangleObject(BgPal(), (TinselV2 ? HighlightColour() : COL_HILIGHT), cd.box[i].w, cd.box[i].h); MultiInsertObject(GetPlayfieldList(FIELD_STATUS), iconArray[HL2]); MultiSetAniXY(iconArray[HL2], @@ -1745,8 +1745,8 @@ void AddToInventory(int invno, int icon, bool hold) { INV_OBJECT *invObj; // Validate trying to add to a legal inventory - assert(invno == INV_1 || invno == INV_2 || invno == INV_CONV - || invno == INV_OPEN || (invno == INV_DEFAULT && TinselV2)); + assert(invno == INV_1 || invno == INV_2 || invno == INV_CONV + || invno == INV_OPEN || (invno == INV_DEFAULT && TinselV2)); if (invno == INV_OPEN) { assert(InventoryState == ACTIVE_INV && (ino == INV_1 || ino == INV_2)); // addopeninv() with inventry not open @@ -2219,11 +2219,11 @@ static int WhichMenuBox(int curX, int curY, bool bSlides) { // Slider on extra window if (cd.bExtraWin) { const Common::Rect &r = TinselV2 ? - Common::Rect(411, 46, 425, 339) : + Common::Rect(411, 46, 425, 339) : Common::Rect(20 + 181, 24 + 2, 20 + 181 + 8, 24 + 139 + 5); if (r.contains(curX, curY)) { - + if (curY < (r.top + (TinselV2 ? 18 : 5))) return IB_UP; else if (curY > (r.bottom - (TinselV2 ? 18 : 5))) @@ -2269,7 +2269,7 @@ void InvBoxes(bool InBody, int curX, int curY) { if (iconArray[HL1] != NULL) { MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), iconArray[HL1]); iconArray[HL1] = NULL; - } + } } else if (index != cd.pointBox) { cd.pointBox = index; // A new box is pointed to - high-light it @@ -2281,7 +2281,7 @@ void InvBoxes(bool InBody, int curX, int curY) { ///* I don't agree */ cd.box[cd.pointBox].boxType == RGROUP || cd.box[cd.pointBox].boxType == AATBUT || cd.box[cd.pointBox].boxType == AABUT) { - iconArray[HL1] = RectangleObject(BgPal(), + iconArray[HL1] = RectangleObject(BgPal(), (TinselV2 ? HighlightColour() : COL_HILIGHT), cd.box[cd.pointBox].w, cd.box[cd.pointBox].h); MultiInsertObject(GetPlayfieldList(FIELD_STATUS), iconArray[HL1]); @@ -2633,7 +2633,7 @@ static void AddBackground(OBJECT **rect, OBJECT **title, int extraH, int extraV, // add it to display list and position it MultiInsertObject(GetPlayfieldList(FIELD_STATUS), *rect); - MultiSetAniXY(*rect, InvD[ino].inventoryX + NM_BG_POS_X, + MultiSetAniXY(*rect, InvD[ino].inventoryX + NM_BG_POS_X, InvD[ino].inventoryY + NM_BG_POS_Y); MultiSetZPosition(*rect, Z_INV_BRECT); @@ -2752,7 +2752,7 @@ void AddBox(int *pi, int i) { *pi += 1; // Stick in the text - if ((cd.box[i].textMethod == TM_POINTER) || + if ((cd.box[i].textMethod == TM_POINTER) || (!TinselV2 && (cd.box[i].ixText == USE_POINTER))) { if (cd.box[i].boxText != NULL) { if (cd.box[i].boxType == RGROUP) { @@ -2849,7 +2849,7 @@ void AddBox(int *pi, int i) { assert(cd.box[i].ixText != USE_POINTER); LoadStringRes(configStrings[cd.box[i].ixText], TextBufferAddr(), TBUFSZ); } - iconArray[*pi] = ObjectTextOut(nullContext, GetPlayfieldList(FIELD_STATUS), + iconArray[*pi] = ObjectTextOut(nullContext, GetPlayfieldList(FIELD_STATUS), TextBufferAddr(), 0, x + MDTEXT_XOFF, y + MDTEXT_YOFF, GetTagFontHandle(), TXT_RIGHT); MultiSetZPosition(iconArray[*pi], Z_INV_ITEXT); *pi += 1; @@ -2915,7 +2915,7 @@ void AddBox(int *pi, int i) { assert(cd.box[i].ixText != USE_POINTER); LoadStringRes(configStrings[cd.box[i].ixText], TextBufferAddr(), TBUFSZ); } - iconArray[*pi] = ObjectTextOut(nullContext, GetPlayfieldList(FIELD_STATUS), + iconArray[*pi] = ObjectTextOut(nullContext, GetPlayfieldList(FIELD_STATUS), TextBufferAddr(), 0, x+MDTEXT_XOFF, y+MDTEXT_YOFF, GetTagFontHandle(), TXT_RIGHT); MultiSetZPosition(iconArray[*pi], Z_INV_ITEXT); *pi += 1; @@ -3060,7 +3060,7 @@ int AddExtraWindow(int x, int y, OBJECT **retObj) { MultiSetZPosition(retObj[n], Z_INV_MFRAME); n++; retObj[n] = AddObject(&pfilm->reels[IX_H156], -1); // Bottom - MultiSetAniXY(retObj[n], x + (TinselV2 ? TLwidth : 6), y + + MultiSetAniXY(retObj[n], x + (TinselV2 ? TLwidth : 6), y + (TinselV2 ? TLheight + 208 + BLheight + NM_BSY : 143)); MultiSetZPosition(retObj[n], Z_INV_MFRAME); n++; @@ -3241,7 +3241,7 @@ void ConstructInventory(InventoryType filling) { // Bottom side extra retObj[n] = AddObject(&pfilm->reels[IX_H26], -1); MultiSetAniXY(retObj[n], invX + offx, invY + TLheight + eV + BLheight + NM_BSY); - + MultiSetZPosition(retObj[n], zpos); n++; } @@ -3387,7 +3387,7 @@ bool RePosition(void) { InvD[ino].inventoryY += MAXTOP - p; bMoveitMoveit = true; // I like to.... } - + return bMoveitMoveit; } @@ -3731,7 +3731,7 @@ void HideConversation(bool bHide) { case CONV_DEF: InvD[INV_CONV].inventoryY = y - SysVar(SV_CONV_ABOVE_Y); break; - + default: break; } @@ -3764,7 +3764,7 @@ void HideConversation(bool bHide) { int Loffset, Toffset; PlayfieldGetPos(FIELD_WORLD, &Loffset, &Toffset); - y = GetActorBottom(thisConvActor) - MultiHighest(RectObject) + + y = GetActorBottom(thisConvActor) - MultiHighest(RectObject) + SysVar(SV_CONV_BELOW_Y); y -= Toffset; } @@ -3816,7 +3816,7 @@ bool ConvIsHidden(void) { * Start up an inventory window. */ void PopUpInventory(int invno) { - assert(invno == INV_1 || invno == INV_2 || invno == INV_CONV + assert(invno == INV_1 || invno == INV_2 || invno == INV_CONV || invno == INV_CONF || invno == INV_MENU); // Trying to open illegal inventory if (InventoryState == IDLE_INV) { @@ -4220,7 +4220,7 @@ void InventoryProcess(CORO_PARAM, const void *) { } } else CORO_INVOKE_1(ButtonToggle, g_buttonEffect.box); - + g_buttonEffect.bButAnim = false; } @@ -5098,7 +5098,7 @@ void InvPickup(int index) { return; // If not holding anything - if (HeldItem == INV_NOICON && InvD[ino].contents[index] && + if (HeldItem == INV_NOICON && InvD[ino].contents[index] && (!TinselV2 || InvD[ino].contents[index] != HeldItem)) { // Pick-up invObj = GetInvObject(InvD[ino].contents[index]); @@ -5186,7 +5186,7 @@ static void InvWalkTo(const Common::Point &coOrds) { // To cater for drop in dead space between icons, // look 1 pixel right, then 1 down, then 1 right and down. - if (i == INV_NOICON && HeldItem != INV_NOICON && + if (i == INV_NOICON && HeldItem != INV_NOICON && (ino == INV_1 || ino == INV_2)) { pt.x += 1; // 1 to the right i = InvItem(pt, false); @@ -5203,7 +5203,7 @@ static void InvWalkTo(const Common::Point &coOrds) { if (ino == INV_CONV) { ConvAction(i); - } else + } else InvPickup(i); } break; diff --git a/engines/tinsel/dialogs.h b/engines/tinsel/dialogs.h index faf95c7d1c..670f695a06 100644 --- a/engines/tinsel/dialogs.h +++ b/engines/tinsel/dialogs.h @@ -69,7 +69,7 @@ struct INV_OBJECT { void PopUpInventory(int invno); enum CONFTYPE { - MAIN_MENU, SAVE_MENU, LOAD_MENU, QUIT_MENU, RESTART_MENU, SOUND_MENU, + MAIN_MENU, SAVE_MENU, LOAD_MENU, QUIT_MENU, RESTART_MENU, SOUND_MENU, CONTROLS_MENU, SUBTITLES_MENU, HOPPER_MENU1, HOPPER_MENU2, TOP_WINDOW }; diff --git a/engines/tinsel/events.cpp b/engines/tinsel/events.cpp index 91f75fe71e..ea5dbf0655 100644 --- a/engines/tinsel/events.cpp +++ b/engines/tinsel/events.cpp @@ -310,7 +310,7 @@ static void ProcessUserEvent(TINSEL_EVENT uEvent, const Common::Point &coOrds, P GetCursorXY(&aniX, &aniY, true); // There could be a poly involved which has no tag. - if ((hPoly = InPolygon(aniX, aniY, TAG)) != NOPOLY || + if ((hPoly = InPolygon(aniX, aniY, TAG)) != NOPOLY || (!TinselV2 && ((hPoly = InPolygon(aniX, aniY, EXIT)) != NOPOLY))) { if (TinselV2 && (uEvent != PROV_WALKTO)) PolygonEvent(nullContext, hPoly, uEvent, 0, false, 0); @@ -391,7 +391,7 @@ void PlayerEvent(PLR_EVENT pEvent, const Common::Point &coOrds) { "PLR_MENU", "PLR_QUIT", "PLR_PGUP", "PLR_PGDN", "PLR_HOME", "PLR_END", "PLR_DRAG1_START", "PLR_DRAG1_END", "PLR_DRAG2_START", "PLR_DRAG2_END", "PLR_JUMP", "PLR_NOEVENT"}; - debugC(DEBUG_BASIC, kTinselDebugActions, "%s - (%d,%d)", + debugC(DEBUG_BASIC, kTinselDebugActions, "%s - (%d,%d)", actionList[pEvent], coOrds.x, coOrds.y); static uint32 lastRealAction = 0; @@ -602,7 +602,7 @@ void PolyTinselProcess(CORO_PARAM, const void *param) { /** * Run the Polygon process with the given event */ -void PolygonEvent(CORO_PARAM, HPOLYGON hPoly, TINSEL_EVENT tEvent, int actor, bool bWait, +void PolygonEvent(CORO_PARAM, HPOLYGON hPoly, TINSEL_EVENT tEvent, int actor, bool bWait, int myEscape, bool *result) { CORO_BEGIN_CONTEXT; PTP_INIT to; diff --git a/engines/tinsel/graphics.cpp b/engines/tinsel/graphics.cpp index 210bff0d5f..4209d1fe33 100644 --- a/engines/tinsel/graphics.cpp +++ b/engines/tinsel/graphics.cpp @@ -63,7 +63,7 @@ static void t0WrtNonZero(DRAWOBJECT *pObj, uint8 *srcP, uint8 *destP, bool apply int leftClip = applyClipping ? pObj->leftClip : 0; int rightClip = applyClipping ? pObj->rightClip : 0; - + // Horizontal loop for (int x = 0; x < pObj->width; ) { uint32 numBytes = READ_UINT32(srcP); @@ -91,7 +91,7 @@ static void t0WrtNonZero(DRAWOBJECT *pObj, uint8 *srcP, uint8 *destP, bool apply } else { // Copy a specified sequence length of pixels srcP += clipAmount; - + int runLength = numBytes - clipAmount; int rptLength = MAX(MIN(runLength, pObj->width - rightClip - x), 0); if (yClip == 0) { @@ -209,7 +209,7 @@ static void WrtNonZero(DRAWOBJECT *pObj, uint8 *srcP, uint8 *destP, bool applyCl tempDest += boxBounds.right - boxBounds.left + 1; width -= 3 - boxBounds.left + 1; - + // None of the remaining horizontal blocks should be left clipped boxBounds.left = 0; } @@ -340,7 +340,7 @@ static void WrtTrans(DRAWOBJECT *pObj, uint8 *destP, bool applyClipping) { return; } - // Set up the offset between destination lines + // Set up the offset between destination lines int lineOffset = SCREEN_WIDTH - pObj->width; // Loop through any remaining lines @@ -350,7 +350,7 @@ static void WrtTrans(DRAWOBJECT *pObj, uint8 *destP, bool applyClipping) { --pObj->height; destP += lineOffset; - } + } } /** @@ -494,7 +494,7 @@ void ClearScreen() { void *pDest = _vm->screen().getBasePtr(0, 0); memset(pDest, 0, SCREEN_WIDTH * SCREEN_HEIGHT); g_system->clearScreen(); - g_system->updateScreen(); + g_system->updateScreen(); } /** @@ -505,7 +505,7 @@ void UpdateScreenRect(const Common::Rect &pClip) { byte *pSrc = (byte *)_vm->screen().getBasePtr(pClip.left, pClip.top); g_system->copyRectToScreen(pSrc, _vm->screen().pitch, pClip.left, pClip.top + yOffset, pClip.width(), pClip.height()); - g_system->updateScreen(); + g_system->updateScreen(); } /** @@ -515,7 +515,7 @@ void DrawObject(DRAWOBJECT *pObj) { uint8 *srcPtr = NULL; uint8 *destPtr; - if ((pObj->width <= 0) || (pObj->height <= 0)) + if ((pObj->width <= 0) || (pObj->height <= 0)) // Empty image, so return immediately return; @@ -527,7 +527,7 @@ void DrawObject(DRAWOBJECT *pObj) { pObj->transOffset = 0; } else { byte *p = (byte *)LockMem(pObj->hBits & HANDLEMASK); - + srcPtr = p + (pObj->hBits & OFFSETMASK); pObj->charBase = (char *)p + READ_LE_UINT32(p + 0x10); pObj->transOffset = READ_LE_UINT32(p + 0x14); @@ -536,7 +536,7 @@ void DrawObject(DRAWOBJECT *pObj) { // Get destination starting point destPtr = (byte *)_vm->screen().getBasePtr(pObj->xPos, pObj->yPos); - + // Handle various draw types uint8 typeId = pObj->flags & 0xff; diff --git a/engines/tinsel/handle.cpp b/engines/tinsel/handle.cpp index 41774a9c88..b463244123 100644 --- a/engines/tinsel/handle.cpp +++ b/engines/tinsel/handle.cpp @@ -411,7 +411,7 @@ uint8 *LockMem(SCNHANDLE offset) { if (pH->pNode->pBaseAddr && (pH->filesize & fLoaded)) // already allocated and loaded return pH->pNode->pBaseAddr + (offset & OFFSETMASK); - + if (pH->pNode->pBaseAddr == NULL) // must have been discarded - reallocate the memory MemoryReAlloc(pH->pNode, pH->filesize & FSIZE_MASK, diff --git a/engines/tinsel/heapmem.cpp b/engines/tinsel/heapmem.cpp index 704f3c8104..e77f505edb 100644 --- a/engines/tinsel/heapmem.cpp +++ b/engines/tinsel/heapmem.cpp @@ -259,7 +259,7 @@ bool HeapCompact(long size, bool bDiscard) { } } } - + if (pOldest) // discard the oldest block MemoryDiscard(pOldest); diff --git a/engines/tinsel/move.cpp b/engines/tinsel/move.cpp index 20e4175e01..4422a7cf4a 100644 --- a/engines/tinsel/move.cpp +++ b/engines/tinsel/move.cpp @@ -1195,7 +1195,7 @@ static void NewCoOrdinates(int fromx, int fromy, int *targetX, int *targetY, // Ignore if already in it (it may have just appeared) if (!InMoverBlock(pMover, pMover->objX, pMover->objY)) { *s2 = ENTERING_MBLOCK; // Trying to walk through an actor - + *hS2p = -1; if (collisionActor) *collisionActor = ma; @@ -1359,7 +1359,7 @@ int SetActorDest(PMOVER pMover, int clickX, int clickY, bool igPath, SCNHANDLE h } } else { int wodResult = WorkOutDestination(clickX, clickY, &targetX, &targetY); - + if (pMover->actorID == GetLeadId()) { lastLeadXdest = targetX; lastLeadYdest = targetY; diff --git a/engines/tinsel/music.cpp b/engines/tinsel/music.cpp index 979fc61270..4e5b890335 100644 --- a/engines/tinsel/music.cpp +++ b/engines/tinsel/music.cpp @@ -124,7 +124,7 @@ const int enhancedAudioSCNVersion[] = { 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 52, 4, - 0, 0, 0, 0 + 0, 0, 0, 0 }; int GetTrackNumber(SCNHANDLE hMidi) { @@ -918,8 +918,8 @@ void dumpMusic() { int outFileSize = 0; char buffer[20000]; - int total = (_vm->getFeatures() & GF_SCNFILES) ? - ARRAYSIZE(midiOffsetsSCNVersion) : + int total = (_vm->getFeatures() & GF_SCNFILES) ? + ARRAYSIZE(midiOffsetsSCNVersion) : ARRAYSIZE(midiOffsetsGRAVersion); for (int i = 0; i < total; i++) { diff --git a/engines/tinsel/object.cpp b/engines/tinsel/object.cpp index c9766631f9..6add275341 100644 --- a/engines/tinsel/object.cpp +++ b/engines/tinsel/object.cpp @@ -252,7 +252,7 @@ void SortObjectList(OBJECT *pObjList) { // set head of list dummy OBJ Z Y values to lowest possible head.yPos = intToFrac(MIN_INT16); head.zPos = MIN_INT; - + for (pPrev = &head, pObj = head.pNext; pObj != NULL; pPrev = pObj, pObj = pObj->pNext) { // check Z order if (pObj->zPos < pPrev->zPos) { diff --git a/engines/tinsel/palette.cpp b/engines/tinsel/palette.cpp index afbe6555fc..cd628439ad 100644 --- a/engines/tinsel/palette.cpp +++ b/engines/tinsel/palette.cpp @@ -376,7 +376,7 @@ void SwapPalette(PALQ *pPalQ, SCNHANDLE hNewPal) { // Copy all the colours memcpy(pPalQ->palRGB, pNewPal->palRGB, pNewPal->numColours * sizeof(COLORREF)); - + if (!pPalQ->bFading) // Q the change to the video DAC UpdateDACqueue(pPalQ->posInDAC, FROM_LE_32(pNewPal->numColours), pPalQ->palRGB); @@ -496,7 +496,7 @@ void CreateTranslucentPalette(SCNHANDLE hPalette) { // map the Value field to one of the 4 colours reserved for the translucent palette val /= 63; - transPalette[i + 1] = (uint8)((val == 0) ? 0 : val + + transPalette[i + 1] = (uint8)((val == 0) ? 0 : val + (TinselV2 ? TranslucentColour() : COL_HILIGHT) - 1); } } diff --git a/engines/tinsel/pcode.cpp b/engines/tinsel/pcode.cpp index 81e7459c71..b90a90bfc2 100644 --- a/engines/tinsel/pcode.cpp +++ b/engines/tinsel/pcode.cpp @@ -160,7 +160,7 @@ static void FreeWaitCheck(PINT_CONTEXT pic, bool bVoluntary) { (icList + i)->waitNumber2 = 0; break; } - } + } } // Is someone waiting for this? @@ -249,7 +249,7 @@ void FreeMasterInterpretContext(void) { * @param actorId Associated actor (if any) * @param pinvo Associated inventory object */ -INT_CONTEXT *InitInterpretContext(GSORT gsort, SCNHANDLE hCode, TINSEL_EVENT event, +INT_CONTEXT *InitInterpretContext(GSORT gsort, SCNHANDLE hCode, TINSEL_EVENT event, HPOLYGON hpoly, int actorid, INV_OBJECT *pinvo, int myEscape) { INT_CONTEXT *ic; @@ -326,7 +326,7 @@ void RegisterGlobals(int num) { if (TinselV2) { // read initial values CdCD(nullContext); - + Common::File f; if (!f.open(GLOBALS_FILENAME)) error(CANNOT_FIND_FILE, GLOBALS_FILENAME); @@ -340,7 +340,7 @@ void RegisterGlobals(int num) { if (f.ioFailed()) error(FILE_IS_CORRUPT, GLOBALS_FILENAME); - + f.close(); } } @@ -514,7 +514,7 @@ void Interpret(CORO_PARAM, INT_CONTEXT *ic) { // same spot (i.e. here). // // The reasons we do it this way, instead of turning Interpret into - // a 'proper' coroutine are (1) we avoid implementation problems + // a 'proper' coroutine are (1) we avoid implementation problems // (CORO_INVOKE involves adding 'case' statements, but Interpret // already has a huge switch/case, so that would not work out of the // box), (2) we incurr less overhead, (3) it's easier to debug, diff --git a/engines/tinsel/pcode.h b/engines/tinsel/pcode.h index fef45d5e03..ec8b9e4587 100644 --- a/engines/tinsel/pcode.h +++ b/engines/tinsel/pcode.h @@ -41,7 +41,7 @@ enum RESUME_STATE { }; enum { - PCODE_STACK_SIZE = 128 //!< interpeters stack size + PCODE_STACK_SIZE = 128 //!< interpeters stack size }; enum GSORT { @@ -128,7 +128,7 @@ void WaitInterpret(CORO_PARAM, PPROCESS pWaitProc, bool *result); #define CONV_BOTTOM 1 // conversation() parameter #define CONV_END 2 // -#define CONTROL_OFF 0 // control() +#define CONTROL_OFF 0 // control() #define CONTROL_ON 1 // parameter #define CONTROL_OFFV 2 // #define CONTROL_OFFV2 3 // diff --git a/engines/tinsel/pdisplay.cpp b/engines/tinsel/pdisplay.cpp index 8cb6fcde0e..0eecaf28ef 100644 --- a/engines/tinsel/pdisplay.cpp +++ b/engines/tinsel/pdisplay.cpp @@ -317,7 +317,7 @@ int GetTaggedActor(void) { } /** - * Tag process keeps us updated as to which polygon is currently tagged + * Tag process keeps us updated as to which polygon is currently tagged * (if one is). Tag process asks us for this information, as does ProcessUserEvent(). */ static void SaveTaggedPoly(HPOLYGON hp) { @@ -559,7 +559,7 @@ static bool PolyTag(HotSpotTag *pTag, OBJECT **ppText) { int strLen; if (GetPolyTagHandle(hp) != 0) strLen = LoadStringRes(GetPolyTagHandle(hp), TextBufferAddr(), TBUFSZ); - else + else strLen = LoadStringRes(hTagtext, TextBufferAddr(), TBUFSZ); if (strLen == 0) @@ -656,7 +656,7 @@ void TagProcess(CORO_PARAM, const void *) { CORO_END_CONTEXT(_ctx); CORO_BEGIN_CODE(_ctx); - + _ctx->pText = NULL; _ctx->Tag = NO_HOTSPOT_TAG; @@ -735,7 +735,7 @@ static void leavingpoly(CORO_PARAM, HPOLYGON hp) { SetPolyTagWanted(hp, false, false, 0); } else if (PolyTagState(hp) == TAG_ON) { - // Delete this tag entry + // Delete this tag entry SetPolyTagState(hp, TAG_OFF); } diff --git a/engines/tinsel/play.cpp b/engines/tinsel/play.cpp index e42a531939..55616863ee 100644 --- a/engines/tinsel/play.cpp +++ b/engines/tinsel/play.cpp @@ -277,7 +277,7 @@ static void SoundReel(CORO_PARAM, SCNHANDLE hFilm, int column, int speed, } else if (pAni[_ctx->frameNumber].op == ANI_ADJUSTXY) { _ctx->frameNumber += 3; } else { - // ANI_STOP, ANI_HIDE, ANI_HFLIP, + // ANI_STOP, ANI_HIDE, ANI_HFLIP, // ANI_VFLIP, ANI_HVFLIP, default _ctx->frameNumber++; } @@ -388,7 +388,7 @@ static void ResSoundReel(CORO_PARAM, const void *) { CORO_BEGIN_CODE(_ctx); - CORO_INVOKE_ARGS(SoundReel, (CORO_SUBCTX, soundReels[i].hFilm, soundReels[i].column, + CORO_INVOKE_ARGS(SoundReel, (CORO_SUBCTX, soundReels[i].hFilm, soundReels[i].column, -1, 0, soundReels[i].actorCol)); CORO_KILL_SELF(); @@ -422,11 +422,11 @@ static void t1PlayReel(CORO_PARAM, const PPINIT *ppi) { CORO_BEGIN_CONTEXT; OBJECT *pPlayObj; // Object ANIM thisAnim; // Animation structure - + bool mActor; // Gets set if this is a moving actor bool lifeNoMatter; bool replaced; - + const FREEL *pfreel; // The 'column' to play int stepCount; int frameCount; @@ -658,13 +658,13 @@ static void t1PlayReel(CORO_PARAM, const PPINIT *ppi) { /** * - Don't bother if this reel is already playing for this actor. * - If explicit co-ordinates, use these, If embedded co-ordinates, - * leave alone, otherwise use actor's current position. - * - Moving actors get hidden during this play, other actors get - * replaced by this play. + * leave alone, otherwise use actor's current position. + * - Moving actors get hidden during this play, other actors get + * replaced by this play. * - Column 0 of a film gets its appropriate Z-position, slave columns - * get slightly bigger Z-positions, in column order. + * get slightly bigger Z-positions, in column order. * - Play proceeds until the script finishes, another reel starts up for - * this actor, or the actor gets killed. + * this actor, or the actor gets killed. * - If called from an splay(), moving actor's co-ordinates are updated * after the play, any walk still in progress will go on from there. * @param x Co-ordinates from the play(), set to (-1, -1) if none @@ -854,7 +854,7 @@ static void t2PlayReel(CORO_PARAM, int x, int y, bool bRestore, int speed, SCNHA */ InitStepAnimScript(&_ctx->thisAnim, _ctx->pPlayObj, _ctx->pFreel->script, speed); - if (bRestore || (ActorEsc(_ctx->reelActor) == true && + if (bRestore || (ActorEsc(_ctx->reelActor) == true && ActorEev(_ctx->reelActor) != GetEscEvents())) { // From restore, step to jump or end SkipFrames(&_ctx->thisAnim, -1); @@ -938,7 +938,7 @@ static void PlayProcess(CORO_PARAM, const void *param) { CORO_BEGIN_CODE(_ctx); if (TinselV2) - CORO_INVOKE_ARGS(t2PlayReel, (CORO_SUBCTX, ppi->x, ppi->y, ppi->bRestore, ppi->speed, + CORO_INVOKE_ARGS(t2PlayReel, (CORO_SUBCTX, ppi->x, ppi->y, ppi->bRestore, ppi->speed, ppi->hFilm, ppi->column, ppi->myescEvent, ppi->bTop)); else CORO_INVOKE_1(t1PlayReel, ppi); @@ -968,7 +968,7 @@ void NewestFilm(SCNHANDLE film, const FREEL *reel) { * NOTE: The processes are started in reverse order so that the first * column's process kicks in first. */ -void PlayFilm(CORO_PARAM, SCNHANDLE hFilm, int x, int y, int actorid, bool splay, bool sfact, bool escOn, +void PlayFilm(CORO_PARAM, SCNHANDLE hFilm, int x, int y, int actorid, bool splay, bool sfact, bool escOn, int myescEvent, bool bTop) { assert(hFilm != 0); // Trying to play NULL film const FILM *pFilm; @@ -1027,7 +1027,7 @@ void PlayFilm(CORO_PARAM, SCNHANDLE hFilm, int x, int y, int myescEvent, bool bT * Start up a play process for each slave column in a film. * Play the first column directly from the parent process. */ -void PlayFilmc(CORO_PARAM, SCNHANDLE hFilm, int x, int y, int actorid, bool splay, bool sfact, +void PlayFilmc(CORO_PARAM, SCNHANDLE hFilm, int x, int y, int actorid, bool splay, bool sfact, bool escOn, int myescEvent, bool bTop) { CORO_BEGIN_CONTEXT; PPINIT ppi; @@ -1039,7 +1039,7 @@ void PlayFilmc(CORO_PARAM, SCNHANDLE hFilm, int x, int y, int actorid, bool spla assert(hFilm != 0); // Trying to play NULL film const FILM *pFilm; - + pFilm = (const FILM *)LockMem(hFilm); // Now allowed empty films! @@ -1059,7 +1059,7 @@ void PlayFilmc(CORO_PARAM, SCNHANDLE hFilm, int x, int y, int actorid, bool spla _ctx->ppi.escOn = escOn; _ctx->ppi.myescEvent = myescEvent; - // Start display process for each secondary reel in the film in Tinsel 1, + // Start display process for each secondary reel in the film in Tinsel 1, // or all of them in Tinsel 2 for (int i = FROM_LE_32(pFilm->numreels) - 1; i >= (TinselV2 ? 0 : 1); i--) { NewestFilm(hFilm, &pFilm->reels[i]); diff --git a/engines/tinsel/play.h b/engines/tinsel/play.h index 5cdca25faa..dd79b304f8 100644 --- a/engines/tinsel/play.h +++ b/engines/tinsel/play.h @@ -47,7 +47,7 @@ void PlayFilm(CORO_PARAM, SCNHANDLE film, int x, int y, int actorid, bool splay, void PlayFilm(CORO_PARAM, SCNHANDLE hFilm, int x, int y, int myescEvent, bool bTop); -void PlayFilmc(CORO_PARAM, SCNHANDLE hFilm, int x, int y, int actorid, bool splay, bool sfact, +void PlayFilmc(CORO_PARAM, SCNHANDLE hFilm, int x, int y, int actorid, bool splay, bool sfact, bool escOn, int myescEvent, bool bTop); void RestoreActorReels(SCNHANDLE hFilm, short reelnum, short z, int x, int y); diff --git a/engines/tinsel/polygons.cpp b/engines/tinsel/polygons.cpp index 7d00a8a37a..184bd24f6b 100644 --- a/engines/tinsel/polygons.cpp +++ b/engines/tinsel/polygons.cpp @@ -95,7 +95,7 @@ struct POLYGON { int a[4]; // y1-y2 } int b[4]; // x2-x1 } See IsInPolygon() long c[4]; // y1x2 - x1y2 } - + /* * Internal derived data for speed and conveniance * set up by PseudoCentre() @@ -173,7 +173,7 @@ public: int32 nodecount; //!b2); //!< b squared int32 a2pb2 = (int)FROM_LE_32(line->a2pb2); //!< a squared + b squared int32 ra2pb2 = (int)FROM_LE_32(line->ra2pb2); //!< root(a squared + b squared) - + int32 ab = (int)FROM_LE_32(line->ab); int32 ac = (int)FROM_LE_32(line->ac); int32 bc = (int)FROM_LE_32(line->bc); @@ -736,7 +736,7 @@ static const POLYGON *TryPath(POLYGON *last, POLYGON *whereto, POLYGON *current) */ static HPOLYGON PathOnTheWay(HPOLYGON from, HPOLYGON to) { // TODO: Fingolfin says: This code currently uses DFS (depth first search), - // in the TryPath function, to compute a path between 'from' and 'to'. + // in the TryPath function, to compute a path between 'from' and 'to'. // However, a BFS (breadth first search) might yield more natural results, // at least in cases where there are multiple possible paths. // There is a small risk of regressions caused by such a change, though. @@ -753,7 +753,7 @@ static HPOLYGON PathOnTheWay(HPOLYGON from, HPOLYGON to) { for (i = 0; i < MAX_POLY; i++) { // For each polygon.. POLYGON *p = Polys[i]; - if (p && p->polyType == PATH) //...if it's a path + if (p && p->polyType == PATH) //...if it's a path p->tried = false; } Polys[from]->tried = true; @@ -818,7 +818,7 @@ int NearestEndNode(HPOLYGON hPath, int x, int y) { nlistx = (int32 *)(pps + (int)FROM_LE_32(ptp.pnodelistx)); nlisty = (int32 *)(pps + (int)FROM_LE_32(ptp.pnodelisty)); - + const int nodecount = (int)FROM_LE_32(ptp.nodecount); d1 = ABS(x - (int)FROM_LE_32(nlistx[0])) + ABS(y - (int)FROM_LE_32(nlisty[0])); @@ -926,7 +926,7 @@ int NearestNodeWithin(HPOLYGON hNpath, int x, int y) { */ void NearestCorner(int *x, int *y, HPOLYGON hStartPoly, HPOLYGON hDestPoly) { const POLYGON *psp, *pdp; - int j; + int j; int ncorn = 0; // nearest corner HPOLYGON hNpath = NOPOLY; // path containing nearest corner int ThisD, SmallestD = 1000; @@ -942,7 +942,7 @@ void NearestCorner(int *x, int *y, HPOLYGON hStartPoly, HPOLYGON hDestPoly) { for (j = 0; j < 4; j++) { if (IsInPolygon(psp->cx[j], psp->cy[j], hDestPoly)) { ThisD = ABS(*x - psp->cx[j]) + ABS(*y - psp->cy[j]); - if (ThisD < SmallestD) { + if (ThisD < SmallestD) { hNpath = hStartPoly; ncorn = j; // Try to ignore it if virtually stood on it @@ -956,7 +956,7 @@ void NearestCorner(int *x, int *y, HPOLYGON hStartPoly, HPOLYGON hDestPoly) { for (j = 0; j < 4; j++) { if (IsInPolygon(pdp->cx[j], pdp->cy[j], hStartPoly)) { ThisD = ABS(*x - pdp->cx[j]) + ABS(*y - pdp->cy[j]); - if (ThisD < SmallestD) { + if (ThisD < SmallestD) { hNpath = hDestPoly; ncorn = j; // Try to ignore it if virtually stood on it @@ -1187,7 +1187,7 @@ bool deadPolys[MAX_POLY]; // Currently just for dead blocks void RebootDeadTags(void) { nextfreeT = numScenesT = 0; nextfreeE = numScenesE = 0; - + memset(SceneTags, 0, sizeof(SceneTags)); memset(SceneExits, 0, sizeof(SceneExits)); memset(TagStates, 0, sizeof(TagStates)); @@ -1357,14 +1357,14 @@ static void SetPathAdjacencies() { // For each polygon.. for (i1 = 0; i1 < MAX_POLY-1; i1++) { - // Get polygon, but only carry on if it's a path + // Get polygon, but only carry on if it's a path p1 = Polys[i1]; if (!p1 || p1->polyType != PATH) continue; // For each subsequent polygon.. for (i2 = i1 + 1; i2 < MAX_POLY; i2++) { - // Get polygon, but only carry on if it's a path + // Get polygon, but only carry on if it's a path p2 = Polys[i2]; if (!p2 || p2->polyType != PATH) continue; @@ -1421,7 +1421,7 @@ void CheckNPathIntegrity() { for (i = 0; i < MAX_POLY; i++) { // For each polygon.. rp = Polys[i]; - if (rp && rp->polyType == PATH && rp->subtype == NODE) { //...if it's a node path + if (rp && rp->polyType == PATH && rp->subtype == NODE) { //...if it's a node path // Get compiled polygon structure cp = (const POLY *)pps + rp->pIndex; // This polygon nlistx = (int32 *)(pps + (int)FROM_LE_32(cp.pnodelistx)); @@ -1495,7 +1495,7 @@ static void SetExTags(SCNHANDLE ph) { return; } } - + i = numScenesT++; currentTScene = i; assert(numScenesT < MAX_SCENES); // Dead tag remembering: scene limit @@ -1582,7 +1582,7 @@ static void FiddlyBit(POLYGON *p) { p->lright[t1] = MAX(p->cx[t1], p->cx[(t1+1)%4]); p->lleft[t1] = MIN(p->cx[t1], p->cx[(t1+1)%4]); - p->ltop[t1] = MIN(p->cy[t1], p->cy[(t1+1)%4]); + p->ltop[t1] = MIN(p->cy[t1], p->cy[(t1+1)%4]); p->lbottom[t1] = MAX(p->cy[t1], p->cy[(t1+1)%4]); p->a[t1] = p->cy[t1] - p->cy[(t1+1)%4]; diff --git a/engines/tinsel/rince.cpp b/engines/tinsel/rince.cpp index 6590aed749..f92b8800db 100644 --- a/engines/tinsel/rince.cpp +++ b/engines/tinsel/rince.cpp @@ -229,7 +229,7 @@ void HideMover(PMOVER pMover, int sf) { if (!TinselV2) { // sf is only passed in Tinsel v1 pMover->SlowFactor = sf; - } else { + } else { // Tinsel 2 specific code if (IsTaggedActor(pMover->actorID)) { // It may be pointed to @@ -575,7 +575,7 @@ void AlterMover(PMOVER pMover, SCNHANDLE film, AR_FUNCTION fn) { StepAnimScript(&pMover->actorAnim); // 04/01/95 #endif } - + // Hang on, we may not want him yet! 04/01/95 if (pMover->bHidden) MultiSetZPosition(pMover->actorObj, -1); @@ -689,7 +689,7 @@ static void InitialPathChecks(PMOVER pMover, int xpos, int ypos) { z = GetScale(FirstPathPoly(), pMover->objY); } - SetMoverWalkReel(pMover, FORWARD, z, false); + SetMoverWalkReel(pMover, FORWARD, z, false); } static void MoverProcessHelper(int X, int Y, int id, PMOVER pMover) { @@ -758,7 +758,7 @@ void T1MoverProcess(CORO_PARAM, const void *param) { const PMOVER pActor = *(const PMOVER *)param; CORO_BEGIN_CODE(_ctx); - + while (1) { if (pActor->bSpecReel) { if (!pActor->bHidden) @@ -882,7 +882,7 @@ PMOVER InMoverBlock(PMOVER pMover, int x, int y) { caR = GetMoverRight(pMover) + x - caX; for (int i = 0; i < MAX_MOVERS; i++) { - if (pMover == &Movers[i] || + if (pMover == &Movers[i] || (TinselV2 && (Movers[i].actorObj == NULL)) || (!TinselV2 && !Movers[i].bActive)) continue; diff --git a/engines/tinsel/saveload.cpp b/engines/tinsel/saveload.cpp index 02153aed59..05fad82a66 100644 --- a/engines/tinsel/saveload.cpp +++ b/engines/tinsel/saveload.cpp @@ -157,7 +157,7 @@ static bool syncSaveGameHeader(Serializer &s, SaveGameHeader &hdr) { } static void syncSavedMover(Serializer &s, SAVED_MOVER &sm) { - SCNHANDLE *pList[3] = { (SCNHANDLE *)&sm.walkReels, + SCNHANDLE *pList[3] = { (SCNHANDLE *)&sm.walkReels, (SCNHANDLE *)&sm.standReels, (SCNHANDLE *)&sm.talkReels }; s.syncAsUint32LE(sm.bActive); @@ -165,7 +165,7 @@ static void syncSavedMover(Serializer &s, SAVED_MOVER &sm) { s.syncAsSint32LE(sm.objX); s.syncAsSint32LE(sm.objY); s.syncAsUint32LE(sm.hLastfilm); - + for (int pIndex = 0; pIndex < 3; ++pIndex) { SCNHANDLE *p = pList[pIndex]; for (int i = 0; i < TOTAL_SCALES * 4; ++i) @@ -281,7 +281,7 @@ static char *NewName(void) { static char result[FNAMELEN]; int i; int ano = 1; // Allocated number - + while (1) { Common::String fname = _vm->getSavegameFilename(ano); strcpy(result, fname.c_str()); @@ -343,7 +343,7 @@ int getList(Common::SaveFileManager *saveFileMan, const Common::String &target) if (difftime(mktime(&hdr.dateTime), mktime(&savedFiles[i].dateTime)) > 0) { Common::copy_backward(&savedFiles[i], &savedFiles[numSfiles], &savedFiles[numSfiles + 1]); break; - } + } } #endif @@ -366,7 +366,7 @@ int getList(void) { // TODO/FIXME: Just always reload this data? Be careful about slow downs!!! if (!NeedLoad) return numSfiles; - + return getList(_vm->getSaveFileMan(), _vm->getTargetName()); } @@ -478,7 +478,7 @@ static void DoSave(void) { return; Serializer s(0, f); - + // Write out a savegame header SaveGameHeader hdr; hdr.id = SAVEGAME_ID; diff --git a/engines/tinsel/savescn.cpp b/engines/tinsel/savescn.cpp index 66564f1c81..32f375290f 100644 --- a/engines/tinsel/savescn.cpp +++ b/engines/tinsel/savescn.cpp @@ -226,7 +226,7 @@ static void SortMAProcess(CORO_PARAM, const void *) { HideMover(GetMover(rsd->SavedMoverInfo[_ctx->i].actorID)); } - ActorPalette(rsd->SavedMoverInfo[_ctx->i].actorID, + ActorPalette(rsd->SavedMoverInfo[_ctx->i].actorID, rsd->SavedMoverInfo[_ctx->i].startColour, rsd->SavedMoverInfo[_ctx->i].paletteLength); if (rsd->SavedMoverInfo[_ctx->i].brightness != BOGUS_BRIGHTNESS) @@ -237,7 +237,7 @@ static void SortMAProcess(CORO_PARAM, const void *) { SetSysVar(ISV_DIVERT_ACTOR, _ctx->viaActor); bNotDoneYet = false; - + CORO_END_CODE; } @@ -311,7 +311,7 @@ static int DoRestoreSceneFrame(SAVED_DATA *sd, int n) { case RS_COUNT: _vm->_sound->stopAllSamples(); ClearScreen(); - + // Master script only affected on restore game, not restore scene if (TinselV2 && (sd == &sgData)) { g_scheduler->killMatchingProcess(PID_MASTER_SCR); @@ -350,7 +350,7 @@ static int DoRestoreSceneFrame(SAVED_DATA *sd, int n) { PlayfieldSetPos(FIELD_WORLD, sd->SavedLoffset, sd->SavedToffset); SetNoBlocking(sd->SavedNoBlocking); } - + RestoreNoScrollData(&sd->SavedNoScrollData); if (TinselV2) { @@ -422,7 +422,7 @@ void SaveGame(char *name, char *desc) { DoSaveScene(&sgData); RequestSaveGame(name, desc, &sgData, &savedSceneCount, ssData); - + // Actual saving is performed by ProcessSRQueue } diff --git a/engines/tinsel/scene.cpp b/engines/tinsel/scene.cpp index 8826d97099..b0aac5b605 100644 --- a/engines/tinsel/scene.cpp +++ b/engines/tinsel/scene.cpp @@ -245,7 +245,7 @@ static void LoadScene(SCNHANDLE scene, int entry) { // Music stuff char *cptr = (char *)FindChunk(scene, CHUNK_MUSIC_FILENAME); assert(cptr); - _vm->_pcmMusic->setMusicSceneDetails(FROM_LE_32(ss->hMusicScript), + _vm->_pcmMusic->setMusicSceneDetails(FROM_LE_32(ss->hMusicScript), FROM_LE_32(ss->hMusicSegment), cptr); } @@ -289,7 +289,7 @@ static void LoadScene(SCNHANDLE scene, int entry) { ++es; else es = (const ENTRANCE_STRUC *)((const byte *)es + 8); - + } if (i == FROM_LE_32(ss->numEntrance)) diff --git a/engines/tinsel/sched.cpp b/engines/tinsel/sched.cpp index 526ad3fcf6..8ced3ba9c0 100644 --- a/engines/tinsel/sched.cpp +++ b/engines/tinsel/sched.cpp @@ -69,17 +69,17 @@ Scheduler::Scheduler() { #endif pRCfunction = 0; - + active = new PROCESS; active->pPrevious = NULL; - + g_scheduler = this; // FIXME HACK } Scheduler::~Scheduler() { free(processList); processList = NULL; - + delete active; active = 0; } @@ -342,7 +342,7 @@ PROCESS *Scheduler::createProcess(int pid, CORO_ADDR coroAddr, const void *pPara if (pProc->pNext) pProc->pNext->pPrevious = pProc; active->pNext = pProc; - + } // set coroutine entry point @@ -377,7 +377,7 @@ PROCESS *Scheduler::createProcess(int pid, CORO_ADDR coroAddr, const void *pPara void Scheduler::killProcess(PROCESS *pKillProc) { // make sure a valid process pointer assert(pKillProc >= processList && pKillProc <= processList + NUM_PROCESS - 1); - + // can not kill the current process using killProcess ! assert(pCurrent != pKillProc); @@ -490,7 +490,7 @@ int Scheduler::killMatchingProcess(int pidKill, int pidMask) { /** * Set pointer to a function to be called by killProcess(). - * + * * May be called by a resource allocator, the function supplied is * called by killProcess() to allow the resource allocator to free * resources allocated to the dying process. @@ -603,7 +603,7 @@ void SceneProcessEvent(CORO_PARAM, uint32 procID, TINSEL_EVENT event, bool bWait if (_ctx->pic == NULL) return; - _ctx->pProc = g_scheduler->createProcess(PID_PROCESS + i, ProcessTinselProcess, + _ctx->pProc = g_scheduler->createProcess(PID_PROCESS + i, ProcessTinselProcess, &_ctx->pic, sizeof(_ctx->pic)); AttachInterpret(_ctx->pic, _ctx->pProc); break; diff --git a/engines/tinsel/sched.h b/engines/tinsel/sched.h index 1e2d3f796e..67b11271cd 100644 --- a/engines/tinsel/sched.h +++ b/engines/tinsel/sched.h @@ -49,7 +49,7 @@ struct PROCESS { PROCESS *pPrevious; //!< pointer to previous process in active or free list CoroContext state; //!< the state of the coroutine - CORO_ADDR coroAddr; //!< the entry point of the coroutine + CORO_ADDR coroAddr; //!< the entry point of the coroutine int sleepTime; //!< number of scheduler cycles to sleep int pid; //!< process ID @@ -66,18 +66,18 @@ class Scheduler { public: /** Pointer to a function of the form "void function(PPROCESS)" */ typedef void (*VFPTRPP)(PROCESS *); - + private: - + /** list of all processes */ PROCESS *processList; - + /** active process list - also saves scheduler state */ PROCESS *active; - + /** pointer to free process list */ PROCESS *pFreeProcesses; - + /** the currently active process */ PROCESS *pCurrent; @@ -88,7 +88,7 @@ private: void CheckStack(); #endif - + /** * Called from killProcess() to enable other resources * a process may be allocated to be released. @@ -102,11 +102,11 @@ public: ~Scheduler(); void reset(); - + #ifdef DEBUG void printStats(); #endif - + void schedule(); void rescheduleAll(); void reschedule(PPROCESS pReSchedProc = NULL); @@ -114,12 +114,12 @@ public: PROCESS *createProcess(int pid, CORO_ADDR coroAddr, const void *pParam, int sizeParam); void killProcess(PROCESS *pKillProc); - + PROCESS *getCurrentProcess(); int getCurrentPID() const; int killMatchingProcess(int pidKill, int pidMask = -1); - - + + void setResourceCallback(VFPTRPP pFunc); }; @@ -131,7 +131,7 @@ extern Scheduler *g_scheduler; // FIXME: Temporary global var, to be used until void SceneProcesses(uint32 numProcess, SCNHANDLE hProcess); void CallSceneProcess(uint32 procID); void KillSceneProcess(uint32 procID); -void SceneProcessEvent(CORO_PARAM, uint32 procID, TINSEL_EVENT event, bool bWait, +void SceneProcessEvent(CORO_PARAM, uint32 procID, TINSEL_EVENT event, bool bWait, int myEscape, bool *result = NULL); void RestoreSceneProcess(INT_CONTEXT *pic); diff --git a/engines/tinsel/scn.cpp b/engines/tinsel/scn.cpp index 2825a90fe3..e0b4188b90 100644 --- a/engines/tinsel/scn.cpp +++ b/engines/tinsel/scn.cpp @@ -55,7 +55,7 @@ byte *FindChunk(SCNHANDLE handle, uint32 chunk) { // V0 chunk types can be found by substracting 2 from the // chunk type. Note that CHUNK_STRING and CHUNK_BITMAP are // the same in V0 and V1 - if (TinselVersion == TINSEL_V0 && + if (TinselVersion == TINSEL_V0 && chunk != CHUNK_STRING && chunk != CHUNK_BITMAP) chunk -= 0x2L; diff --git a/engines/tinsel/scroll.cpp b/engines/tinsel/scroll.cpp index 579775c91f..f31f596c43 100644 --- a/engines/tinsel/scroll.cpp +++ b/engines/tinsel/scroll.cpp @@ -58,11 +58,11 @@ static int oldx = 0, oldy = 0; /** Boundaries and numbers of boundaries */ static SCROLLDATA sd = { { - {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, + {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, { - {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, + {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, 0, @@ -415,9 +415,9 @@ void ScrollProcess(CORO_PARAM, const void *) { CORO_BEGIN_CODE(_ctx); - // In Tinsel v2, scenes may play movies, so the background may not always + // In Tinsel v2, scenes may play movies, so the background may not always // already be initialised like it is in v1 - while (!GetBgObject()) + while (!GetBgObject()) CORO_SLEEP(1); ImageH = BgHeight(); // Dimensions diff --git a/engines/tinsel/serializer.h b/engines/tinsel/serializer.h index 98ee398ef8..8984cb4757 100644 --- a/engines/tinsel/serializer.h +++ b/engines/tinsel/serializer.h @@ -45,7 +45,7 @@ namespace Tinsel { } \ _bytesSynced += SIZE; \ } - + // TODO: Write comment for this // TODO: Inspired by the SCUMM engine -- move to common/ code and use in more engines? @@ -58,9 +58,9 @@ public: bool isSaving() { return (_saveStream != 0); } bool isLoading() { return (_loadStream != 0); } - + uint bytesSynced() const { return _bytesSynced; } - + void syncBytes(byte *buf, uint16 size) { if (_loadStream) _loadStream->read(buf, size); @@ -90,7 +90,7 @@ protected: #undef SYNC_AS -// TODO: Make a subclass "VersionedSerializer", which makes it easy to support +// TODO: Make a subclass "VersionedSerializer", which makes it easy to support // multiple versions of a savegame format (again inspired by SCUMM). /* class VersionedSerializer : public Serializer { diff --git a/engines/tinsel/sound.cpp b/engines/tinsel/sound.cpp index 9d1996ca01..aec61b410e 100644 --- a/engines/tinsel/sound.cpp +++ b/engines/tinsel/sound.cpp @@ -88,7 +88,7 @@ bool SoundManager::playSample(int id, Audio::Mixer::SoundType type, Audio::Sound // get file offset for this sample uint32 dwSampleIndex = _sampleIndex[id]; - + // move to correct position in the sample file _sampleStream.seek(dwSampleIndex); if (_sampleStream.ioFailed() || (uint32)_sampleStream.pos() != dwSampleIndex) @@ -190,7 +190,7 @@ bool SoundManager::playSample(int id, int sub, bool bLooped, int x, int y, int p // get file offset for this sample uint32 dwSampleIndex = _sampleIndex[id]; - + if (dwSampleIndex == 0) { warning("Tinsel2 playSample, non-existant sample %d", id); return false; @@ -305,7 +305,7 @@ int8 SoundManager::getPan(int x) { if (x < 0) { if (x < (-SCREEN_WIDTH / 2)) return -127; - + x = (-x * 127) / (SCREEN_WIDTH / 2); return 0 - x; diff --git a/engines/tinsel/sound.h b/engines/tinsel/sound.h index 9b980822dc..8b969a5f48 100644 --- a/engines/tinsel/sound.h +++ b/engines/tinsel/sound.h @@ -103,12 +103,12 @@ public: void stopAllSamples(void); // Stops any currently playing sample void stopSpecSample(int id, int sub = 0); // Stops a specific sample - + void setSFXVolumes(uint8 volume); bool sampleExists(int id); bool sampleIsPlaying(int id = -1); - + // TODO: Internal method, make this protected? void openSampleFiles(void); void closeSampleStream(void); diff --git a/engines/tinsel/strres.cpp b/engines/tinsel/strres.cpp index ad28c48334..2d963ae8bb 100644 --- a/engines/tinsel/strres.cpp +++ b/engines/tinsel/strres.cpp @@ -80,7 +80,7 @@ LANGUAGE textLanguage, sampleLanguage = TXT_ENGLISH; void ChangeLanguage(LANGUAGE newLang) { Common::File f; uint32 textLen = 0; // length of buffer - + textLanguage = newLang; sampleLanguage = newLang; @@ -98,8 +98,8 @@ void ChangeLanguage(LANGUAGE newLang) { error(CANNOT_FIND_FILE, _vm->getTextFile(newLang)); } - // Check whether the file is compressed or not - for compressed files the - // first long is the filelength and for uncompressed files it is the chunk + // Check whether the file is compressed or not - for compressed files the + // first long is the filelength and for uncompressed files it is the chunk // identifier textLen = f.readUint32LE(); if (f.ioFailed()) @@ -392,12 +392,12 @@ LANGUAGE NextLanguage(LANGUAGE thisOne) { int i; for (i = thisOne+1; i < NUM_LANGUAGES; i++) { - if (languages[i].bPresent) + if (languages[i].bPresent) return (LANGUAGE)i; } for (i = 0; i < thisOne; i++) { - if (languages[i].bPresent) + if (languages[i].bPresent) return (LANGUAGE)i; } @@ -409,12 +409,12 @@ LANGUAGE PrevLanguage(LANGUAGE thisOne) { int i; for (i = thisOne-1; i >= 0; i--) { - if (languages[i].bPresent) + if (languages[i].bPresent) return (LANGUAGE)i; } for (i = NUM_LANGUAGES-1; i > thisOne; i--) { - if (languages[i].bPresent) + if (languages[i].bPresent) return (LANGUAGE)i; } diff --git a/engines/tinsel/sysvar.h b/engines/tinsel/sysvar.h index 869a99caa3..8866558e62 100644 --- a/engines/tinsel/sysvar.h +++ b/engines/tinsel/sysvar.h @@ -86,7 +86,7 @@ typedef enum { SV_DEFAULT_INV, ISV_GHOST_ACTOR, ISV_GHOST_BASE, ISV_GHOST_COLOUR, - + SV_TOPVALID } SYSVARS; diff --git a/engines/tinsel/text.cpp b/engines/tinsel/text.cpp index 7e36e5236f..fbeee9b8ed 100644 --- a/engines/tinsel/text.cpp +++ b/engines/tinsel/text.cpp @@ -107,7 +107,7 @@ int JustifyText(char *szStr, int xPos, const FONT *pFont, int mode) { * @param mode Mode flags for the string * @param sleepTime Sleep time between each character (if non-zero) */ -OBJECT *ObjectTextOut(CORO_PARAM, OBJECT *pList, char *szStr, int colour, +OBJECT *ObjectTextOut(CORO_PARAM, OBJECT *pList, char *szStr, int colour, int xPos, int yPos, SCNHANDLE hFont, int mode, int sleepTime) { int xJustify; // x position of text after justification int yOffset; // offset to next line of text @@ -153,7 +153,7 @@ OBJECT *ObjectTextOut(CORO_PARAM, OBJECT *pList, char *szStr, int colour, } else { // printable character int aniX, aniY; // char image animation offsets - + OBJ_INIT oi; oi.hObjImg = FROM_LE_32(pFont->fontInit.hObjImg); oi.objFlags = FROM_LE_32(pFont->fontInit.objFlags); @@ -265,7 +265,7 @@ OBJECT *ObjectTextOut(CORO_PARAM, OBJECT *pList, char *szStr, int colour, */ bool IsCharImage(SCNHANDLE hFont, char c) { byte c2 = (byte)c; - + // Inventory save game name editor needs to be more clever for // multi-byte characters. This bodge will stop it erring. if (bMultiByte && (c2 & 0x80)) diff --git a/engines/tinsel/text.h b/engines/tinsel/text.h index 0fcc965ff9..29e1a08bfe 100644 --- a/engines/tinsel/text.h +++ b/engines/tinsel/text.h @@ -98,7 +98,7 @@ struct TEXTOUT { * @param mode mode flags for the string * @param sleepTime Sleep time between each character (if non-zero) */ -OBJECT *ObjectTextOut(CORO_PARAM, OBJECT *pList, char *szStr, int colour, +OBJECT *ObjectTextOut(CORO_PARAM, OBJECT *pList, char *szStr, int colour, int xPos, int yPos, SCNHANDLE hFont, int mode, int sleepTime = 0); OBJECT *ObjectTextOutIndirect( // output a string of text diff --git a/engines/tinsel/timers.cpp b/engines/tinsel/timers.cpp index 92abf4c028..8446aad0fa 100644 --- a/engines/tinsel/timers.cpp +++ b/engines/tinsel/timers.cpp @@ -23,7 +23,7 @@ * * Handles timers. * - * Note: As part of the transition to ScummVM, the ticks field of a timer has been changed + * Note: As part of the transition to ScummVM, the ticks field of a timer has been changed * to a millisecond value, rather than ticks at 24Hz. Most places should be able to use * the timers without change, since the ONE_SECOND constant has been set to be in MILLISECONDS */ diff --git a/engines/tinsel/tinlib.cpp b/engines/tinsel/tinlib.cpp index 788b999142..0a29a9fe82 100644 --- a/engines/tinsel/tinlib.cpp +++ b/engines/tinsel/tinlib.cpp @@ -150,7 +150,7 @@ enum MASTER_LIB_CODES { CLOSEINVENTORY, CONTROL, CONVERSATION, CONVTOPIC, CURSOR, CURSORXPOS, CURSORYPOS, CUTSCENE, DECCONVW, DECCSTRINGS, DECCURSOR, DECFLAGS, DECINV1, DECINV2, DECINVW, DECLARELANGUAGE, DECLEAD, DECSCALE, DECTAGFONT, DECTALKFONT, DELICON, - DELINV, DELTOPIC, DIMMUSIC, DROP, DROPEVERYTHING, DROPOUT, EFFECTACTOR, ENABLEMENU, + DELINV, DELTOPIC, DIMMUSIC, DROP, DROPEVERYTHING, DROPOUT, EFFECTACTOR, ENABLEMENU, ENDACTOR, ESCAPE, ESCAPEOFF, ESCAPEON, EVENT, FACETAG, FADEIN, FADEMIDI, FADEOUT, FRAMEGRAB, FREEZECURSOR, GETINVLIMIT, GHOST, GLOBALVAR, GRABMOVIE, HAILSCENE, HASRESTARTED, HAVE, HELDOBJECT, HIDEACTOR, HIDEBLOCK, HIDEEFFECT, HIDEPATH, @@ -164,8 +164,8 @@ enum MASTER_LIB_CODES { RESUMELASTGAME, RUNMODE, SAMPLEPLAYING, SAVESCENE, SAY, SAYAT, SCALINGREELS, SCANICON, SCREENXPOS, SCREENYPOS, SCROLL, SCROLLPARAMETERS, SENDACTOR, SENDGLOBALPROCESS, SENDOBJECT, SENDPROCESS, SENDTAG, SETACTOR, SETBLOCK, SETBRIGHTNESS, SETEXIT, SETINVLIMIT, - SETINVSIZE, SETLANGUAGE, SETPALETTE, SETSYSTEMREEL, SETSYSTEMSTRING, SETSYSTEMVAR, - SETTAG, SETTIMER, SHELL, SHOWACTOR, SHOWBLOCK, SHOWEFFECT, SHOWMENU, SHOWPATH, + SETINVSIZE, SETLANGUAGE, SETPALETTE, SETSYSTEMREEL, SETSYSTEMSTRING, SETSYSTEMVAR, + SETTAG, SETTIMER, SHELL, SHOWACTOR, SHOWBLOCK, SHOWEFFECT, SHOWMENU, SHOWPATH, SHOWPOS, SHOWREFER, SHOWSTRING, SHOWTAG, SPLAY, STAND, STANDTAG, STARTGLOBALPROCESS, STARTPROCESS, STARTTIMER, STOPMIDI, STOPSAMPLE, STOPWALK, SUBTITLES, SWALK, SWALKZ, SYSTEMVAR, TAGACTOR, TAGTAGXPOS, TAGTAGYPOS, TAGWALKXPOS, TAGWALKYPOS, TALK, TALKAT, @@ -223,14 +223,14 @@ const MASTER_LIB_CODES DW2_CODES[] = { ACTORREF, ACTORRGB, ACTORSCALE, ACTORXPOS, ACTORYPOS, ADDHIGHLIGHT, ADDINV, ADDINV1, ADDINV2, ADDOPENINV, ADDTOPIC, BACKGROUND, CALLACTOR, CALLGLOBALPROCESS, CALLOBJECT, - CALLPROCESS, CALLSCENE, CALLTAG, CAMERA, CDCHANGESCENE, + CALLPROCESS, CALLSCENE, CALLTAG, CAMERA, CDCHANGESCENE, CDDOCHANGE, CDLOAD, CDPLAY, CLEARHOOKSCENE, CLOSEINVENTORY, CONTROL, CONVERSATION, CURSOR, CURSORXPOS, CURSORYPOS, DECCONVW, DECCURSOR, DECFLAGS, DECINV1, DECINV2, DECINVW, DECLEAD, DECSCALE, DECTAGFONT, DECTALKFONT, DELTOPIC, DIMMUSIC, DROP, DROPOUT, EFFECTACTOR, ENABLEMENU, ENDACTOR, ESCAPEOFF, ESCAPEON, EVENT, FACETAG, FADEIN, FADEOUT, FRAMEGRAB, - FREEZECURSOR, GETINVLIMIT, GHOST, GLOBALVAR, GRABMOVIE, + FREEZECURSOR, GETINVLIMIT, GHOST, GLOBALVAR, GRABMOVIE, HASRESTARTED, HAVE, HELDOBJECT, HIDEACTOR, HIDEBLOCK, HIDEEFFECT, HIDEPATH, HIDEREFER, HIDETAG, HOLD, HOOKSCENE, IDLETIME, INSTANTSCROLL, INVENTORY, INVPLAY, INWHICHINV, KILLACTOR, @@ -292,7 +292,7 @@ void Walk(CORO_PARAM, int actor, int x, int y, SCNHANDLE film, int hold, bool ig //----------------- SUPPORT FUNCTIONS -------------------- /** - * For Scroll() and Offset(), work out top left for a + * For Scroll() and Offset(), work out top left for a * given screen position. */ static void DecodeExtreme(EXTREME extreme, int *px, int *py) { @@ -582,7 +582,7 @@ static void AddTopic(int icon) { */ static void AddInv(int invno, int object) { // illegal inventory number - assert(invno == INV_1 || invno == INV_2 || invno == INV_OPEN || invno == INV_DEFAULT); + assert(invno == INV_1 || invno == INV_2 || invno == INV_OPEN || invno == INV_DEFAULT); AddToInventory(invno, object, false); } @@ -1160,13 +1160,13 @@ static int GetInvLimit(int invno) { */ static void Ghost(int actor, int tColour, int tPalOffset) { SetSysVar(ISV_GHOST_ACTOR, actor); - SetSysVar(ISV_GHOST_COLOUR, tColour); + SetSysVar(ISV_GHOST_COLOUR, tColour); SetSysVar(ISV_GHOST_BASE, tPalOffset); CreateGhostPalette(BgPal()); } /** - * + * */ static void HailScene(SCNHANDLE scene) { DoHailScene(scene); @@ -1463,7 +1463,7 @@ void Offset(EXTREME extreme, int x, int y) { if (TinselV2) DecodeExtreme(extreme, &x, &y); - + PlayfieldSetPos(FIELD_WORLD, x, y); } @@ -1798,7 +1798,7 @@ static void PostActor(CORO_PARAM, int actor, TINSEL_EVENT event, HPOLYGON hp, assert(hp == NOPOLY && taggedActor); assert(IsTaggedActor(actor)); } - + if (IsTaggedActor(actor)) { assert(actor); ActorEvent(coroParam, actor, event, false, myEscape); @@ -1895,7 +1895,7 @@ static void Print(CORO_PARAM, int x, int y, SCNHANDLE text, int time, bool bSust if (time == 0) { // This is a 'talky' print _ctx->time = TextTime(TextBufferAddr()); - + // Cut short-able if sustain was not set _ctx->myleftEvent = bSustain ? 0 : GetLeftEvents(); } else { @@ -1923,7 +1923,7 @@ static void Print(CORO_PARAM, int x, int y, SCNHANDLE text, int time, bool bSust int Loffset, Toffset; // Screen position PlayfieldGetPos(FIELD_WORLD, &Loffset, &Toffset); _ctx->pText = ObjectTextOut(coroParam, GetPlayfieldList(FIELD_STATUS), TextBufferAddr(), - 0, x - Loffset, y - Toffset, + 0, x - Loffset, y - Toffset, TinselV2 ? GetTagFontHandle() : GetTalkFontHandle(), TXT_CENTRE); assert(_ctx->pText); // string produced NULL text if (IsTopWindow()) @@ -2197,7 +2197,7 @@ static void PrintObj(CORO_PARAM, const SCNHANDLE hText, const INV_OBJECT *pinvo, if (_ctx->bTookControl) ControlOn(); // Free control if we took it } - + } else { if (event == POINTED) { // FIXME: Is there ever an associated sound if in POINTED mode??? @@ -2341,7 +2341,7 @@ static void PrintObjNonPointed(CORO_PARAM, const SCNHANDLE text, const OBJECT *p static void PrintTag(HPOLYGON hp, SCNHANDLE text, int actor = 0, bool bCursor = false) { // printtag() may only be called from a polygon code block in Tinsel 1, or // additionally from a moving actor code block in Tinsel 2 - assert((hp != NOPOLY) || (TinselV2 && (actor != 0))); + assert((hp != NOPOLY) || (TinselV2 && (actor != 0))); if (hp != NOPOLY) { // Poly handling @@ -3264,7 +3264,7 @@ static void TalkOrSay(CORO_PARAM, SPEECH_TYPE speechType, SCNHANDLE hText, int x } else if (_ctx->whatSort == IS_TALKAT) { _ctx->bTalkReel = false; - + } else if ((_ctx->whatSort == IS_SAY) || (_ctx->whatSort == IS_SAYAT)) { _ctx->bTalkReel = false; if (IsTaggedActor(_ctx->actor)) { @@ -3338,7 +3338,7 @@ static void TalkOrSay(CORO_PARAM, SPEECH_TYPE speechType, SCNHANDLE hText, int x yshift = MultiHighest(_ctx->pText); if (yshift < 4) MultiMoveRelXY(_ctx->pText, 0, 4 - yshift); // Not off top - + /* * Don't go off the side of the screen */ @@ -3392,7 +3392,7 @@ static void TalkOrSay(CORO_PARAM, SPEECH_TYPE speechType, SCNHANDLE hText, int x // Handle timeout decrementing and Escape presses if (TinselV2) { - if ((_ctx->escEvents && _ctx->escEvents != GetEscEvents()) || + if ((_ctx->escEvents && _ctx->escEvents != GetEscEvents()) || (!bSustain && LeftEventChange(_ctx->myLeftEvent)) || (--_ctx->timeout <= 0)) { // Left event only kills current sub-string @@ -3748,7 +3748,7 @@ static void WaitKey(CORO_PARAM, bool escOn, int myEscape) { if (!MenuActive()) return; - + do { CORO_SLEEP(1); } while (MenuActive()); @@ -3804,14 +3804,14 @@ static void WaitTime(CORO_PARAM, int time, bool frame, bool escOn, int myEscape) if (escOn && myEscape != GetEscEvents()) break; } while (_ctx->time--); - + CORO_END_CODE; } /** * Set a moving actor off on a walk. */ -void Walk(CORO_PARAM, int actor, int x, int y, SCNHANDLE hFilm, int hold, bool igPath, +void Walk(CORO_PARAM, int actor, int x, int y, SCNHANDLE hFilm, int hold, bool igPath, int zOverride, bool escOn, int myescEvent) { CORO_BEGIN_CONTEXT; int thisWalk; @@ -3933,7 +3933,7 @@ static void Walked(CORO_PARAM, int actor, int x, int y, SCNHANDLE film, bool esc } else { // Pause before starting the walk CORO_SLEEP(ONE_SECOND); - + assert(pMover->hCpath != NOPOLY); // moving actor not in path // Briefly aquire token to kill off any other normal walk @@ -4563,7 +4563,7 @@ int CallLibraryRoutine(CORO_PARAM, int operand, int32 *pp, const INT_CONTEXT *pi // DW2 only DimMusic(); return 0; - + case DROP: // DW2 only Drop(pp[0]); @@ -4603,7 +4603,7 @@ int CallLibraryRoutine(CORO_PARAM, int operand, int32 *pp, const INT_CONTEXT *pi case EVENT: // Common to both DW1 & DW2 - if (TinselVersion == TINSEL_V2) + if (TinselVersion == TINSEL_V2) pp[0] = pic->event; else pp[0] = TINSEL1_EVENT_MAP[pic->event]; @@ -4890,7 +4890,7 @@ int CallLibraryRoutine(CORO_PARAM, int operand, int32 *pp, const INT_CONTEXT *pi if (*pResumeState == RES_1 && IsCdPlayHandle(pp[0])) *pResumeState = RES_NOT; else { - Play(coroParam, pp[0], pp[1], pp[2], pp[3], pic->myEscape, false, + Play(coroParam, pp[0], pp[1], pp[2], pp[3], pic->myEscape, false, pic->event, pic->hPoly, pic->idActor); if (coroParam) @@ -5442,7 +5442,7 @@ int CallLibraryRoutine(CORO_PARAM, int operand, int32 *pp, const INT_CONTEXT *pi // DW2 only pp[0] = ThisObject(pic->pinvo); return 0; - + case THISTAG: // DW2 only pp[0] = ThisTag(pic->hPoly); diff --git a/engines/tinsel/tinsel.cpp b/engines/tinsel/tinsel.cpp index eab2844a4e..9341b0fe4e 100644 --- a/engines/tinsel/tinsel.cpp +++ b/engines/tinsel/tinsel.cpp @@ -161,7 +161,7 @@ void KeyboardProcess(CORO_PARAM, const void *) { keypresses.erase(keypresses.begin()); const Common::Point mousePos = _vm->getMousePosition(); - // Switch for special keys + // Switch for special keys switch (evt.kbd.keycode) { // Drag action case Common::KEYCODE_LALT: @@ -196,7 +196,7 @@ void KeyboardProcess(CORO_PARAM, const void *) { if (evt.type == Common::EVENT_KEYUP) continue; - if (_vm->_keyHandler != NULL) + if (_vm->_keyHandler != NULL) // Keyboard is hooked, so pass it on to that handler first if (!_vm->_keyHandler(evt.kbd)) continue; @@ -221,11 +221,11 @@ void KeyboardProcess(CORO_PARAM, const void *) { case Common::KEYCODE_ESCAPE: #if 0 if (!TinselV2) { - // WORKAROUND: For Discworld 1, check if any of the starting logo screens are + // WORKAROUND: For Discworld 1, check if any of the starting logo screens are // active, and if so manually skip to the title screen, allowing them to be bypassed int sceneOffset = (_vm->getFeatures() & GF_SCNFILES) ? 1 : 0; int sceneNumber = (GetSceneHandle() >> SCNHANDLE_SHIFT) - sceneOffset; - if ((g_language == TXT_GERMAN) && + if ((g_language == TXT_GERMAN) && ((sceneNumber >= 25 && sceneNumber <= 27) || (sceneNumber == 17))) { // Skip to title screen // It seems the German CD version uses scenes 25,26,27,17 for the intro, @@ -386,7 +386,7 @@ static void MouseProcess(CORO_PARAM, const void *) { } else { // Initial mouse down - either for a single click, or potentially // the start of a double-click action - + if (TinselV2) { PlayerEvent(PLR_DRAG1_START, mousePos); @@ -412,7 +412,7 @@ static void MouseProcess(CORO_PARAM, const void *) { if (_ctx->lastLWasDouble == false) { _ctx->lastLeftClick = DwGetCurrentTime(); - // If player control is enabled, start a process which, if it times out, + // If player control is enabled, start a process which, if it times out, // will activate a single button click if (TinselV2 && ControlIsOn()) { clickPos = mousePos; @@ -630,7 +630,7 @@ static void RestoredProcess(CORO_PARAM, const void *param) { _ctx->pic = RestoreInterpretContext(_ctx->pic); _ctx->bConverse = TinselV2 && (_ctx->pic->event == CONVERSE); - + CORO_INVOKE_1(Interpret, _ctx->pic); // Restore control after CallScene() from a conversation icon @@ -690,7 +690,7 @@ bool ChangeScene(bool bReset) { } else if (--CountOut == 0) { if (!TinselV2) ClearScreen(); - + StartNewScene(NextScene.scene, NextScene.entry); NextScene.scene = 0; @@ -745,7 +745,7 @@ void LoadBasicChunks(void) { numObjects = (cptr != NULL) ? READ_LE_UINT32(cptr) : 0; cptr = FindChunk(INV_OBJ_SCNHANDLE, CHUNK_OBJECTS); - + #ifdef SCUMM_BIG_ENDIAN //convert to native endianness INV_OBJECT *io = (INV_OBJECT *)cptr; @@ -756,7 +756,7 @@ void LoadBasicChunks(void) { io->attribute = FROM_LE_32(io->attribute); } #endif - + RegisterIcons(cptr, numObjects); cptr = FindChunk(MASTER_SCNHANDLE, CHUNK_TOTAL_POLY); @@ -837,7 +837,7 @@ const char *TinselEngine::_textFiles[][3] = { }; -TinselEngine::TinselEngine(OSystem *syst, const TinselGameDescription *gameDesc) : +TinselEngine::TinselEngine(OSystem *syst, const TinselGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc) { _vm = this; @@ -861,7 +861,7 @@ TinselEngine::TinselEngine(OSystem *syst, const TinselGameDescription *gameDesc) int cd_num = ConfMan.getInt("cdrom"); if (cd_num >= 0) _system->openCD(cd_num); - + int midiDriver = MidiDriver::detectMusicDriver(MDT_MIDI | MDT_ADLIB | MDT_PREFER_MIDI); bool native_mt32 = ((midiDriver == MD_MT32) || ConfMan.getBool("native_mt32")); //bool adlib = (midiDriver == MD_ADLIB); @@ -876,7 +876,7 @@ TinselEngine::TinselEngine(OSystem *syst, const TinselGameDescription *gameDesc) //_midiMusic->setAdlib(adlib); _musicVolume = ConfMan.getInt("music_volume"); - + _sound = new SoundManager(this); _mousePos.x = 0; @@ -922,7 +922,7 @@ Common::Error TinselEngine::init() { g_system->getEventManager()->registerRandomSource(_random, "tinsel"); _console = new Console(); - + _scheduler = new Scheduler(); InitSysVars(); @@ -1067,7 +1067,7 @@ void TinselEngine::NextGameCycle(void) { if (MoviePlaying()) CopyMovieToScreen(); - else + else // redraw background DrawBackgnd(); @@ -1078,8 +1078,8 @@ void TinselEngine::NextGameCycle(void) { bool TinselEngine::pollEvent() { Common::Event event; - - if (!g_system->getEventManager()->pollEvent(event)) + + if (!g_system->getEventManager()->pollEvent(event)) return false; // Handle the various kind of events @@ -1094,7 +1094,7 @@ bool TinselEngine::pollEvent() { case Common::EVENT_MOUSEMOVE: { - // This fragment takes care of Tinsel 2 when it's been compiled with + // This fragment takes care of Tinsel 2 when it's been compiled with // blank areas at the top and bottom of thes creen int ySize = (g_system->getHeight() - _vm->screen().h) / 2; if ((event.mouse.y >= ySize) && (event.mouse.y < (g_system->getHeight() - ySize))) @@ -1106,7 +1106,7 @@ bool TinselEngine::pollEvent() { case Common::EVENT_KEYUP: ProcessKeyEvent(event); break; - + default: break; } @@ -1176,8 +1176,8 @@ void TinselEngine::RestartDrivers(void) { _scheduler->reset(); // init the event handlers - pMouseProcess = _scheduler->createProcess(PID_MOUSE, MouseProcess, NULL, 0); - pKeyboardProcess = _scheduler->createProcess(PID_KEYBOARD, KeyboardProcess, NULL, 0); + pMouseProcess = _scheduler->createProcess(PID_MOUSE, MouseProcess, NULL, 0); + pKeyboardProcess = _scheduler->createProcess(PID_KEYBOARD, KeyboardProcess, NULL, 0); // open MIDI files OpenMidiFiles(); @@ -1254,7 +1254,7 @@ void TinselEngine::ProcessKeyEvent(const Common::Event &event) { return; } - // All other keypresses add to the queue for processing in KeyboardProcess + // All other keypresses add to the queue for processing in KeyboardProcess keypresses.push_back(event); } diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp index 9ddf23549d..3b6791d281 100644 --- a/gui/ThemeEngine.cpp +++ b/gui/ThemeEngine.cpp @@ -195,7 +195,7 @@ void ThemeEngine::unloadTheme() { } } _bitmaps.clear(); - + delete _themeArchive; _themeArchive = 0; @@ -395,7 +395,7 @@ bool ThemeEngine::addBitmap(const Common::String &filename) { surf->free(); delete surf; } - + // Now try to load the bitmap via the ImageDecoder class. surf = Graphics::ImageDecoder::loadFile(filename); if (!surf && _themeArchive) { @@ -408,7 +408,7 @@ bool ThemeEngine::addBitmap(const Common::String &filename) { // Store the surface into our hashmap (attention, may store NULL entries!) _bitmaps[filename] = surf; - + return surf != 0; } diff --git a/gui/ThemeEngine.h b/gui/ThemeEngine.h index 56a288f9d4..b96cc47d7e 100644 --- a/gui/ThemeEngine.h +++ b/gui/ThemeEngine.h @@ -119,7 +119,7 @@ protected: bool buffer; //!< Sets whether this item is buffered on the backbuffer or drawn directly to the screen. DrawData parent; //!< Parent DrawData item, for items that overlay. E.g. kButtonIdle -> kButtonHover }; - + static const DrawDataInfo kDrawDataDefaults[]; @@ -139,7 +139,7 @@ protected: TextData id; const char *name; }; - + static const TextDataInfo kTextDataDefaults[]; public: diff --git a/test/common/func.h b/test/common/func.h index bf9b2ddff9..607122505c 100644 --- a/test/common/func.h +++ b/test/common/func.h @@ -47,7 +47,7 @@ class FuncTestSuite : public CxxTest::TestSuite myFoos[i] = new Foo; int counter = 0; - + Common::for_each(myFoos, myFoos+4, Common::bind2nd(Common::mem_fun(&Foo::fooAdd), counter)); TS_ASSERT_EQUALS(counter, 4); diff --git a/test/common/hashmap.h b/test/common/hashmap.h index acde1da028..8e31f38676 100644 --- a/test/common/hashmap.h +++ b/test/common/hashmap.h @@ -95,7 +95,7 @@ class HashMapTestSuite : public CxxTest::TestSuite container.clear(); TS_ASSERT( container.begin() == container.end() ); } - + void test_hash_map_copy(void) { Common::HashMap map1, container2; map1[323] = 32; diff --git a/test/common/ptr.h b/test/common/ptr.h index 986330057c..3071c3c0ca 100644 --- a/test/common/ptr.h +++ b/test/common/ptr.h @@ -43,7 +43,7 @@ class PtrTestSuite : public CxxTest::TestSuite void test_deleter() { Deleter myDeleter; myDeleter.test = new bool(false); - + { Common::SharedPtr p(new int(1), myDeleter); } @@ -55,7 +55,7 @@ class PtrTestSuite : public CxxTest::TestSuite void test_compare() { Common::SharedPtr p1(new int(1)); Common::SharedPtr p2; - + TS_ASSERT(p1); TS_ASSERT(!p2); diff --git a/test/common/queue.h b/test/common/queue.h index 7eedec9a5d..e3c0cb0a19 100644 --- a/test/common/queue.h +++ b/test/common/queue.h @@ -34,7 +34,7 @@ public: void test_front_back_pop() { Common::Queue queue; - + queue.push( 42); queue.push(-23); @@ -49,7 +49,7 @@ public: queue.pop(); TS_ASSERT_EQUALS(queue.front(), 42); } - + void test_assign() { Common::Queue q1, q2; diff --git a/test/common/stream.h b/test/common/stream.h index a605d34a2c..4d332b8925 100644 --- a/test/common/stream.h +++ b/test/common/stream.h @@ -7,9 +7,9 @@ class ReadLineStreamTestSuite : public CxxTest::TestSuite { void test_readline(void) { byte contents[] = { 'a', 'b', '\n', '\n', 'c', '\n' }; Common::MemoryReadStream ms(contents, sizeof(contents)); - + char buffer[100]; - + TS_ASSERT(0 != ms.readLine_NEW(buffer, sizeof(buffer))); TS_ASSERT(0 == strcmp(buffer, "ab\n")); @@ -29,9 +29,9 @@ class ReadLineStreamTestSuite : public CxxTest::TestSuite { void test_readline2(void) { byte contents[] = { 'a', 'b', '\n', '\n', 'c' }; Common::MemoryReadStream ms(contents, sizeof(contents)); - + char buffer[100]; - + TS_ASSERT(0 != ms.readLine_NEW(buffer, sizeof(buffer))); TS_ASSERT(0 == strcmp(buffer, "ab\n")); diff --git a/test/cxxtest/cxxtest/Descriptions.cpp b/test/cxxtest/cxxtest/Descriptions.cpp index 17637ec1bf..4325b9e799 100644 --- a/test/cxxtest/cxxtest/Descriptions.cpp +++ b/test/cxxtest/cxxtest/Descriptions.cpp @@ -8,7 +8,7 @@ namespace CxxTest TestDescription::~TestDescription() {} SuiteDescription::~SuiteDescription() {} WorldDescription::~WorldDescription() {} - + // // Convert total tests to string // diff --git a/test/cxxtest/cxxtest/Descriptions.h b/test/cxxtest/cxxtest/Descriptions.h index bd373ec762..c25b88dd99 100644 --- a/test/cxxtest/cxxtest/Descriptions.h +++ b/test/cxxtest/cxxtest/Descriptions.h @@ -8,7 +8,7 @@ #include -namespace CxxTest +namespace CxxTest { class TestSuite; @@ -16,28 +16,28 @@ namespace CxxTest { public: virtual ~TestDescription(); - + virtual const char *file() const = 0; virtual unsigned line() const = 0; virtual const char *testName() const = 0; virtual const char *suiteName() const = 0; - + virtual void run() = 0; virtual const TestDescription *next() const = 0; - virtual TestDescription *next() = 0; + virtual TestDescription *next() = 0; }; class SuiteDescription : public Link { public: virtual ~SuiteDescription(); - + virtual const char *file() const = 0; virtual unsigned line() const = 0; virtual const char *suiteName() const = 0; virtual TestSuite *suite() const = 0; - + virtual unsigned numTests() const = 0; virtual const TestDescription &testDescription( unsigned /*i*/ ) const = 0; @@ -54,7 +54,7 @@ namespace CxxTest { public: virtual ~WorldDescription(); - + virtual unsigned numSuites( void ) const = 0; virtual unsigned numTotalTests( void ) const = 0; virtual const SuiteDescription &suiteDescription( unsigned /*i*/ ) const = 0; diff --git a/test/cxxtest/cxxtest/DummyDescriptions.cpp b/test/cxxtest/cxxtest/DummyDescriptions.cpp index c862e439d8..04869bfc06 100644 --- a/test/cxxtest/cxxtest/DummyDescriptions.cpp +++ b/test/cxxtest/cxxtest/DummyDescriptions.cpp @@ -1,9 +1,9 @@ #include -namespace CxxTest +namespace CxxTest { DummyTestDescription::DummyTestDescription() {} - + const char *DummyTestDescription::file() const { return ""; } unsigned DummyTestDescription::line() const { return 0; } const char *DummyTestDescription::testName() const { return ""; } @@ -14,9 +14,9 @@ namespace CxxTest TestDescription *DummyTestDescription::next() { return 0; } const TestDescription *DummyTestDescription::next() const { return 0; } - + DummySuiteDescription::DummySuiteDescription() : _test() {} - + const char *DummySuiteDescription::file() const { return ""; } unsigned DummySuiteDescription::line() const { return 0; } const char *DummySuiteDescription::suiteName() const { return ""; } @@ -29,12 +29,12 @@ namespace CxxTest const TestDescription *DummySuiteDescription::firstTest() const { return 0; } void DummySuiteDescription::activateAllTests() {} bool DummySuiteDescription::leaveOnly( const char * /*testName*/ ) { return false; } - + bool DummySuiteDescription::setUp() { return true;} bool DummySuiteDescription::tearDown() { return true;} DummyWorldDescription::DummyWorldDescription() : _suite() {} - + unsigned DummyWorldDescription::numSuites( void ) const { return 0; } unsigned DummyWorldDescription::numTotalTests( void ) const { return 0; } const SuiteDescription &DummyWorldDescription::suiteDescription( unsigned ) const { return _suite; } @@ -42,7 +42,7 @@ namespace CxxTest const SuiteDescription *DummyWorldDescription::firstSuite() const { return 0; } void DummyWorldDescription::activateAllTests() {} bool DummyWorldDescription::leaveOnly( const char * /*suiteName*/, const char * /*testName*/ ) { return false; } - + bool DummyWorldDescription::setUp() { return true;} bool DummyWorldDescription::tearDown() { return true;} } diff --git a/test/cxxtest/cxxtest/DummyDescriptions.h b/test/cxxtest/cxxtest/DummyDescriptions.h index c9215d125f..69d1116f84 100644 --- a/test/cxxtest/cxxtest/DummyDescriptions.h +++ b/test/cxxtest/cxxtest/DummyDescriptions.h @@ -7,13 +7,13 @@ #include -namespace CxxTest +namespace CxxTest { class DummyTestDescription : public TestDescription { public: DummyTestDescription(); - + const char *file() const; unsigned line() const; const char *testName() const; @@ -27,10 +27,10 @@ namespace CxxTest }; class DummySuiteDescription : public SuiteDescription - { + { public: DummySuiteDescription(); - + const char *file() const; unsigned line() const; const char *suiteName() const; @@ -43,7 +43,7 @@ namespace CxxTest const TestDescription *firstTest() const; void activateAllTests(); bool leaveOnly( const char * /*testName*/ ); - + bool setUp(); bool tearDown(); @@ -55,7 +55,7 @@ namespace CxxTest { public: DummyWorldDescription(); - + unsigned numSuites( void ) const; unsigned numTotalTests( void ) const; const SuiteDescription &suiteDescription( unsigned ) const; @@ -63,7 +63,7 @@ namespace CxxTest const SuiteDescription *firstSuite() const; void activateAllTests(); bool leaveOnly( const char * /*suiteName*/, const char * /*testName*/ = 0 ); - + bool setUp(); bool tearDown(); diff --git a/test/cxxtest/cxxtest/ErrorFormatter.h b/test/cxxtest/cxxtest/ErrorFormatter.h index dca09bc7be..3c5b2b5dbe 100644 --- a/test/cxxtest/cxxtest/ErrorFormatter.h +++ b/test/cxxtest/cxxtest/ErrorFormatter.h @@ -25,7 +25,7 @@ namespace CxxTest virtual OutputStream &operator<<( const char * /*string*/ ) { return *this; } typedef void (*Manipulator)( OutputStream & ); - + virtual OutputStream &operator<<( Manipulator m ) { m( *this ); return *this; } static void endl( OutputStream &o ) { (o << "\n").flush(); } }; @@ -213,7 +213,7 @@ namespace CxxTest private: ErrorFormatter( const ErrorFormatter & ); ErrorFormatter &operator=( const ErrorFormatter & ); - + OutputStream &stop( const char *file, unsigned line ) { newLine(); @@ -249,7 +249,7 @@ namespace CxxTest { (*_o) << " (null)" << endl; } - + void dumpBuffer( const void *buffer, unsigned size ) { unsigned dumpSize = size; diff --git a/test/cxxtest/cxxtest/ErrorPrinter.h b/test/cxxtest/cxxtest/ErrorPrinter.h index 53d942532b..8c95c2a1e0 100644 --- a/test/cxxtest/cxxtest/ErrorPrinter.h +++ b/test/cxxtest/cxxtest/ErrorPrinter.h @@ -23,7 +23,7 @@ # include #endif // _CXXTEST_OLD_STD -namespace CxxTest +namespace CxxTest { class ErrorPrinter : public ErrorFormatter { diff --git a/test/cxxtest/cxxtest/GlobalFixture.cpp b/test/cxxtest/cxxtest/GlobalFixture.cpp index 29c6ab83a6..edcaf1efe4 100644 --- a/test/cxxtest/cxxtest/GlobalFixture.cpp +++ b/test/cxxtest/cxxtest/GlobalFixture.cpp @@ -3,16 +3,16 @@ #include -namespace CxxTest +namespace CxxTest { bool GlobalFixture::setUpWorld() { return true; } bool GlobalFixture::tearDownWorld() { return true; } bool GlobalFixture::setUp() { return true; } bool GlobalFixture::tearDown() { return true; } - + GlobalFixture::GlobalFixture() { attach( _list ); } GlobalFixture::~GlobalFixture() { detach( _list ); } - + GlobalFixture *GlobalFixture::firstGlobalFixture() { return (GlobalFixture *)_list.head(); } GlobalFixture *GlobalFixture::lastGlobalFixture() { return (GlobalFixture *)_list.tail(); } GlobalFixture *GlobalFixture::nextGlobalFixture() { return (GlobalFixture *)next(); } diff --git a/test/cxxtest/cxxtest/GlobalFixture.h b/test/cxxtest/cxxtest/GlobalFixture.h index c8173633f6..cbecb0daf8 100644 --- a/test/cxxtest/cxxtest/GlobalFixture.h +++ b/test/cxxtest/cxxtest/GlobalFixture.h @@ -3,7 +3,7 @@ #include -namespace CxxTest +namespace CxxTest { class GlobalFixture : public Link { @@ -12,10 +12,10 @@ namespace CxxTest virtual bool tearDownWorld(); virtual bool setUp(); virtual bool tearDown(); - + GlobalFixture(); ~GlobalFixture(); - + static GlobalFixture *firstGlobalFixture(); static GlobalFixture *lastGlobalFixture(); GlobalFixture *nextGlobalFixture(); diff --git a/test/cxxtest/cxxtest/Gui.h b/test/cxxtest/cxxtest/Gui.h index f4560dedd1..2cc392a642 100644 --- a/test/cxxtest/cxxtest/Gui.h +++ b/test/cxxtest/cxxtest/Gui.h @@ -20,15 +20,15 @@ namespace CxxTest { enterGui( argc, argv ); TestRunner::runAllTests( listener ); - leaveGui(); + leaveGui(); } virtual void enterGui( int & /*argc*/, char ** /*argv*/ ) {} virtual void leaveGui() {} - + // // The easy way is to implement these functions: - // + // virtual void guiEnterWorld( unsigned /*numTotalTests*/ ) {} virtual void guiEnterSuite( const char * /*suiteName*/ ) {} virtual void guiEnterTest( const char * /*suiteName*/, const char * /*testName*/ ) {} @@ -44,22 +44,22 @@ namespace CxxTest void leaveTest( const TestDescription & ) {} void leaveSuite( const SuiteDescription & ) {} void leaveWorld( const WorldDescription & ) {} - + void warning( const char * /*file*/, unsigned /*line*/, const char * /*expression*/ ) { yellowBarSafe(); } - + void failedTest( const char * /*file*/, unsigned /*line*/, const char * /*expression*/ ) { redBarSafe(); } - + void failedAssert( const char * /*file*/, unsigned /*line*/, const char * /*expression*/ ) { redBarSafe(); } - + void failedAssertEquals( const char * /*file*/, unsigned /*line*/, const char * /*xStr*/, const char * /*yStr*/, const char * /*x*/, const char * /*y*/ ) @@ -74,55 +74,55 @@ namespace CxxTest { redBarSafe(); } - + void failedAssertDelta( const char * /*file*/, unsigned /*line*/, const char * /*xStr*/, const char * /*yStr*/, const char * /*dStr*/, const char * /*x*/, const char * /*y*/, const char * /*d*/ ) { redBarSafe(); } - + void failedAssertDiffers( const char * /*file*/, unsigned /*line*/, const char * /*xStr*/, const char * /*yStr*/, const char * /*value*/ ) { redBarSafe(); } - + void failedAssertLessThan( const char * /*file*/, unsigned /*line*/, const char * /*xStr*/, const char * /*yStr*/, const char * /*x*/, const char * /*y*/ ) { redBarSafe(); } - + void failedAssertLessThanEquals( const char * /*file*/, unsigned /*line*/, const char * /*xStr*/, const char * /*yStr*/, const char * /*x*/, const char * /*y*/ ) { redBarSafe(); } - + void failedAssertPredicate( const char * /*file*/, unsigned /*line*/, const char * /*predicate*/, const char * /*xStr*/, const char * /*x*/ ) { redBarSafe(); } - + void failedAssertRelation( const char * /*file*/, unsigned /*line*/, const char * /*relation*/, const char * /*xStr*/, const char * /*yStr*/, const char * /*x*/, const char * /*y*/ ) { redBarSafe(); } - + void failedAssertThrows( const char * /*file*/, unsigned /*line*/, const char * /*expression*/, const char * /*type*/, bool /*otherThrown*/ ) { redBarSafe(); } - + void failedAssertThrowsNot( const char * /*file*/, unsigned /*line*/, const char * /*expression*/ ) { @@ -145,7 +145,7 @@ namespace CxxTest _state = RED_BAR; } } - + private: enum { GREEN_BAR, YELLOW_BAR, RED_BAR } _state; }; @@ -157,12 +157,12 @@ namespace CxxTest char **_argv; GuiT _gui; TuiT _tui; - + public: GuiTuiRunner( int &argc, char **argv ) : _argc( argc ), _argv( argv ) - { + { setFirst( _gui ); setSecond( _tui ); } diff --git a/test/cxxtest/cxxtest/LinkedList.cpp b/test/cxxtest/cxxtest/LinkedList.cpp index c4623e91c6..1cea5028cc 100644 --- a/test/cxxtest/cxxtest/LinkedList.cpp +++ b/test/cxxtest/cxxtest/LinkedList.cpp @@ -12,7 +12,7 @@ namespace CxxTest { _head = _tail = 0; } - + Link *List::head() { Link *l = _head; @@ -89,12 +89,12 @@ namespace CxxTest Link::~Link() { } - + bool Link::active() const { return _active; } - + void Link::setActive( bool value ) { _active = value; @@ -104,12 +104,12 @@ namespace CxxTest { return _next; } - + Link * Link::justPrev() { return _prev; } - + Link * Link::next() { Link *l = _next; @@ -117,7 +117,7 @@ namespace CxxTest l = l->_next; return l; } - + Link * Link::prev() { Link *l = _prev; @@ -125,7 +125,7 @@ namespace CxxTest l = l->_prev; return l; } - + const Link * Link::next() const { Link *l = _next; @@ -133,7 +133,7 @@ namespace CxxTest l = l->_next; return l; } - + const Link * Link::prev() const { Link *l = _prev; @@ -141,7 +141,7 @@ namespace CxxTest l = l->_prev; return l; } - + void Link::attach( List &l ) { if ( l._tail ) @@ -149,7 +149,7 @@ namespace CxxTest _prev = l._tail; _next = 0; - + if ( l._head == 0 ) l._head = this; l._tail = this; @@ -161,7 +161,7 @@ namespace CxxTest _prev->_next = _next; else l._head = _next; - + if ( _next ) _next->_prev = _prev; else diff --git a/test/cxxtest/cxxtest/LinkedList.h b/test/cxxtest/cxxtest/LinkedList.h index 983a6e244c..bb5e842c97 100644 --- a/test/cxxtest/cxxtest/LinkedList.h +++ b/test/cxxtest/cxxtest/LinkedList.h @@ -3,7 +3,7 @@ #include -namespace CxxTest +namespace CxxTest { struct List; class Link; @@ -29,7 +29,7 @@ namespace CxxTest }; class Link - { + { public: Link(); virtual ~Link(); @@ -39,7 +39,7 @@ namespace CxxTest Link *justNext(); Link *justPrev(); - + Link *next(); Link *prev(); const Link *next() const; diff --git a/test/cxxtest/cxxtest/ParenPrinter.h b/test/cxxtest/cxxtest/ParenPrinter.h index 9ecf310532..1db54fc5a3 100644 --- a/test/cxxtest/cxxtest/ParenPrinter.h +++ b/test/cxxtest/cxxtest/ParenPrinter.h @@ -9,7 +9,7 @@ #include -namespace CxxTest +namespace CxxTest { class ParenPrinter : public ErrorPrinter { diff --git a/test/cxxtest/cxxtest/QtGui.h b/test/cxxtest/cxxtest/QtGui.h index 4a8f25b5bc..0fd7bcd08e 100644 --- a/test/cxxtest/cxxtest/QtGui.h +++ b/test/cxxtest/cxxtest/QtGui.h @@ -4,7 +4,7 @@ // // The QtGui displays a simple progress bar using the Qt Toolkit. It // has been tested with versions 2.x and 3.x. -// +// // Apart from normal Qt command-line arguments, it accepts the following options: // -minimized Start minimized, pop up on error // -keep Don't close the window at the end @@ -63,7 +63,7 @@ namespace CxxTest getTotalTests(); processEvents(); } - + void redBar() { if ( _startMinimized && _mainWindow->isMinimized() ) @@ -100,7 +100,7 @@ namespace CxxTest { _startMinimized = _keep = false; _title = argv[0]; - + for ( int i = 1; i < argc; ++ i ) { QString arg( argv[i] ); if ( arg == "-minimized" ) @@ -115,11 +115,11 @@ namespace CxxTest void createApplication( int &argc, char **argv ) { _application = new QApplication( argc, argv ); - } - + } + void createWindow( const WorldDescription &wd ) { - getTotalTests( wd ); + getTotalTests( wd ); createMainWindow(); createProgressBar(); createStatusBar(); @@ -236,7 +236,7 @@ namespace CxxTest QWidget *desktop = QApplication::desktop(); int xCenter = desktop->x() + (desktop->width() / 2); int yCenter = desktop->y() + (desktop->height() / 2); - + int windowWidth = (desktop->width() * 4) / 5; int windowHeight = _mainWindow->height(); _mainWindow->setGeometry( xCenter - (windowWidth / 2), yCenter - (windowHeight / 2), windowWidth, windowHeight ); diff --git a/test/cxxtest/cxxtest/RealDescriptions.cpp b/test/cxxtest/cxxtest/RealDescriptions.cpp index 1e21ca7625..234622cbbf 100644 --- a/test/cxxtest/cxxtest/RealDescriptions.cpp +++ b/test/cxxtest/cxxtest/RealDescriptions.cpp @@ -8,12 +8,12 @@ #include -namespace CxxTest +namespace CxxTest { RealTestDescription::RealTestDescription() { } - + RealTestDescription::RealTestDescription( List &argList, SuiteDescription &argSuite, unsigned argLine, @@ -32,7 +32,7 @@ namespace CxxTest _testName = argTestName; attach( argList ); } - + bool RealTestDescription::setUp() { if ( !suite() ) @@ -97,7 +97,7 @@ namespace CxxTest _TS_CATCH_ABORT( {} ) ___TSM_CATCH( file(), line(), "Exception thrown from test" ); } - + RealSuiteDescription::RealSuiteDescription() {} RealSuiteDescription::RealSuiteDescription( const char *argFile, unsigned argLine, @@ -116,7 +116,7 @@ namespace CxxTest _line = argLine; _suiteName = argSuiteName; _tests = &argTests; - + attach( _suites ); } @@ -128,9 +128,9 @@ namespace CxxTest const TestDescription *RealSuiteDescription::firstTest() const { return (const RealTestDescription *)_tests->head(); } SuiteDescription *RealSuiteDescription::next() { return (RealSuiteDescription *)Link::next(); } const SuiteDescription *RealSuiteDescription::next() const { return (const RealSuiteDescription *)Link::next(); } - + unsigned RealSuiteDescription::numTests() const { return _tests->size(); } - + const TestDescription &RealSuiteDescription::testDescription( unsigned i ) const { return *(RealTestDescription *)_tests->nth( i ); @@ -140,7 +140,7 @@ namespace CxxTest { _tests->activateAll(); } - + bool RealSuiteDescription::leaveOnly( const char *testName ) { for ( TestDescription *td = firstTest(); td != 0; td = td->next() ) { @@ -149,9 +149,9 @@ namespace CxxTest return true; } } - return false; + return false; } - + StaticSuiteDescription::StaticSuiteDescription() {} StaticSuiteDescription::StaticSuiteDescription( const char *argFile, unsigned argLine, const char *argSuiteName, TestSuite &argSuite, @@ -168,7 +168,7 @@ namespace CxxTest RealSuiteDescription::initialize( argFile, argLine, argSuiteName, argTests ); doInitialize( argSuite ); } - + void StaticSuiteDescription::doInitialize( TestSuite &argSuite ) { _suite = &argSuite; @@ -204,17 +204,17 @@ namespace CxxTest _createLine = argCreateLine; _destroyLine = argDestroyLine; } - + List &RealWorldDescription::suites() { return RealSuiteDescription::_suites; } - + unsigned RealWorldDescription::numSuites( void ) const { return suites().size(); } - + unsigned RealWorldDescription::numTotalTests( void ) const { unsigned count = 0; @@ -222,7 +222,7 @@ namespace CxxTest count += sd->numTests(); return count; } - + SuiteDescription *RealWorldDescription::firstSuite() { return (RealSuiteDescription *)suites().head(); @@ -258,7 +258,7 @@ namespace CxxTest } return false; } - + bool RealWorldDescription::setUp() { for ( GlobalFixture *gf = GlobalFixture::firstGlobalFixture(); gf != 0; gf = gf->nextGlobalFixture() ) { diff --git a/test/cxxtest/cxxtest/RealDescriptions.h b/test/cxxtest/cxxtest/RealDescriptions.h index 14c457de7e..ad455db0c2 100644 --- a/test/cxxtest/cxxtest/RealDescriptions.h +++ b/test/cxxtest/cxxtest/RealDescriptions.h @@ -9,7 +9,7 @@ #include #include -namespace CxxTest +namespace CxxTest { class RealTestDescription : public TestDescription { @@ -17,7 +17,7 @@ namespace CxxTest RealTestDescription(); RealTestDescription( List &argList, SuiteDescription &argSuite, unsigned argLine, const char *argTestName ); void initialize( List &argList, SuiteDescription &argSuite, unsigned argLine, const char *argTestName ); - + const char *file() const; unsigned line() const; const char *testName() const; @@ -29,15 +29,15 @@ namespace CxxTest TestSuite *suite() const; bool setUp(); - void run(); + void run(); bool tearDown(); - + private: RealTestDescription( const RealTestDescription & ); RealTestDescription &operator=( const RealTestDescription & ); virtual void runTest() = 0; - + SuiteDescription *_suite; unsigned _line; const char *_testName; @@ -48,7 +48,7 @@ namespace CxxTest public: RealSuiteDescription(); RealSuiteDescription( const char *argFile, unsigned argLine, const char *argSuiteName, List &argTests ); - + void initialize( const char *argFile, unsigned argLine, const char *argSuiteName, List &argTests ); const char *file() const; @@ -59,17 +59,17 @@ namespace CxxTest const TestDescription *firstTest() const; SuiteDescription *next(); const SuiteDescription *next() const; - + unsigned numTests() const; const TestDescription &testDescription( unsigned i ) const; void activateAllTests(); bool leaveOnly( const char *testName ); - + private: RealSuiteDescription( const RealSuiteDescription & ); RealSuiteDescription &operator=( const RealSuiteDescription & ); - + const char *_file; unsigned _line; const char *_suiteName; @@ -91,16 +91,16 @@ namespace CxxTest const char *argSuiteName, TestSuite &argSuite, List &argTests ); TestSuite *suite() const; - + bool setUp(); bool tearDown(); - + private: StaticSuiteDescription( const StaticSuiteDescription & ); StaticSuiteDescription &operator=( const StaticSuiteDescription & ); void doInitialize( TestSuite &argSuite ); - + TestSuite *_suite; }; @@ -122,7 +122,7 @@ namespace CxxTest private: void doInitialize( unsigned argCreateLine, unsigned argDestroyLine ); }; - + template class DynamicSuiteDescription : public CommonDynamicSuiteDescription { @@ -152,7 +152,7 @@ namespace CxxTest bool setUp(); bool tearDown(); - + private: S *realSuite() const { return *_suite; } void setSuite( S *s ) { *_suite = s; } @@ -161,7 +161,7 @@ namespace CxxTest { setSuite( S::createSuite() ); } - + void destroySuite() { S *s = realSuite(); @@ -189,7 +189,7 @@ namespace CxxTest { if ( !_suite ) return true; - + _TS_TRY { _TSM_ASSERT_THROWS_NOTHING( file(), _destroyLine, "destroySuite() failed", destroySuite() ); } @@ -197,7 +197,7 @@ namespace CxxTest return true; } - + class RealWorldDescription : public WorldDescription { public: @@ -209,7 +209,7 @@ namespace CxxTest const SuiteDescription &suiteDescription( unsigned i ) const; void activateAllTests(); bool leaveOnly( const char *suiteName, const char *testName = 0 ); - + bool setUp(); bool tearDown(); static void reportError( const char *message ); diff --git a/test/cxxtest/cxxtest/StdValueTraits.h b/test/cxxtest/cxxtest/StdValueTraits.h index ac1ee07e3e..70e36f504f 100644 --- a/test/cxxtest/cxxtest/StdValueTraits.h +++ b/test/cxxtest/cxxtest/StdValueTraits.h @@ -39,7 +39,7 @@ namespace CxxTest private: CXXTEST_STD(string) _s; }; - + // // std::string // @@ -107,7 +107,7 @@ namespace CxxTest class ValueTraits< CXXTEST_STD(pair) > : public StdTraitsBase { public: - ValueTraits( const CXXTEST_STD(pair) &p ) + ValueTraits( const CXXTEST_STD(pair) &p ) { *this << "<" << TS_AS_STRING( p.first ) << ", " << TS_AS_STRING( p.second ) << ">"; } @@ -163,7 +163,7 @@ namespace CxxTest { dumpRange( *this, m.begin(), m.end() ); } - }; + }; // // std::deque diff --git a/test/cxxtest/cxxtest/StdioFilePrinter.h b/test/cxxtest/cxxtest/StdioFilePrinter.h index 47984b69b9..33e0ca6c3a 100644 --- a/test/cxxtest/cxxtest/StdioFilePrinter.h +++ b/test/cxxtest/cxxtest/StdioFilePrinter.h @@ -11,7 +11,7 @@ #include #include -namespace CxxTest +namespace CxxTest { class StdioFilePrinter : public ErrorFormatter { @@ -25,9 +25,9 @@ namespace CxxTest { Adapter( const Adapter & ); Adapter &operator=( const Adapter & ); - + FILE *_o; - + public: Adapter( FILE *o ) : _o(o) {} void flush() { fflush( _o ); } diff --git a/test/cxxtest/cxxtest/StdioPrinter.h b/test/cxxtest/cxxtest/StdioPrinter.h index af5bc6b639..2b89f38e8a 100644 --- a/test/cxxtest/cxxtest/StdioPrinter.h +++ b/test/cxxtest/cxxtest/StdioPrinter.h @@ -9,7 +9,7 @@ #include -namespace CxxTest +namespace CxxTest { class StdioPrinter : public StdioFilePrinter { diff --git a/test/cxxtest/cxxtest/TeeListener.h b/test/cxxtest/cxxtest/TeeListener.h index b65501a4c7..26d9e4e855 100644 --- a/test/cxxtest/cxxtest/TeeListener.h +++ b/test/cxxtest/cxxtest/TeeListener.h @@ -44,37 +44,37 @@ namespace CxxTest _first->enterSuite( d ); _second->enterSuite( d ); } - + void enterTest( const TestDescription &d ) { _first->enterTest( d ); _second->enterTest( d ); } - + void trace( const char *file, unsigned line, const char *expression ) { _first->trace( file, line, expression ); _second->trace( file, line, expression ); } - + void warning( const char *file, unsigned line, const char *expression ) { _first->warning( file, line, expression ); _second->warning( file, line, expression ); } - + void failedTest( const char *file, unsigned line, const char *expression ) { _first->failedTest( file, line, expression ); _second->failedTest( file, line, expression ); } - + void failedAssert( const char *file, unsigned line, const char *expression ) { _first->failedAssert( file, line, expression ); _second->failedAssert( file, line, expression ); } - + void failedAssertEquals( const char *file, unsigned line, const char *xStr, const char *yStr, const char *x, const char *y ) @@ -91,7 +91,7 @@ namespace CxxTest _first->failedAssertSameData( file, line, xStr, yStr, sizeStr, x, y, size ); _second->failedAssertSameData( file, line, xStr, yStr, sizeStr, x, y, size ); } - + void failedAssertDelta( const char *file, unsigned line, const char *xStr, const char *yStr, const char *dStr, const char *x, const char *y, const char *d ) @@ -99,7 +99,7 @@ namespace CxxTest _first->failedAssertDelta( file, line, xStr, yStr, dStr, x, y, d ); _second->failedAssertDelta( file, line, xStr, yStr, dStr, x, y, d ); } - + void failedAssertDiffers( const char *file, unsigned line, const char *xStr, const char *yStr, const char *value ) @@ -107,7 +107,7 @@ namespace CxxTest _first->failedAssertDiffers( file, line, xStr, yStr, value ); _second->failedAssertDiffers( file, line, xStr, yStr, value ); } - + void failedAssertLessThan( const char *file, unsigned line, const char *xStr, const char *yStr, const char *x, const char *y ) @@ -115,7 +115,7 @@ namespace CxxTest _first->failedAssertLessThan( file, line, xStr, yStr, x, y ); _second->failedAssertLessThan( file, line, xStr, yStr, x, y ); } - + void failedAssertLessThanEquals( const char *file, unsigned line, const char *xStr, const char *yStr, const char *x, const char *y ) @@ -123,14 +123,14 @@ namespace CxxTest _first->failedAssertLessThanEquals( file, line, xStr, yStr, x, y ); _second->failedAssertLessThanEquals( file, line, xStr, yStr, x, y ); } - + void failedAssertPredicate( const char *file, unsigned line, const char *predicate, const char *xStr, const char *x ) { _first->failedAssertPredicate( file, line, predicate, xStr, x ); _second->failedAssertPredicate( file, line, predicate, xStr, x ); } - + void failedAssertRelation( const char *file, unsigned line, const char *relation, const char *xStr, const char *yStr, const char *x, const char *y ) @@ -138,7 +138,7 @@ namespace CxxTest _first->failedAssertRelation( file, line, relation, xStr, yStr, x, y ); _second->failedAssertRelation( file, line, relation, xStr, yStr, x, y ); } - + void failedAssertThrows( const char *file, unsigned line, const char *expression, const char *type, bool otherThrown ) @@ -146,26 +146,26 @@ namespace CxxTest _first->failedAssertThrows( file, line, expression, type, otherThrown ); _second->failedAssertThrows( file, line, expression, type, otherThrown ); } - + void failedAssertThrowsNot( const char *file, unsigned line, const char *expression ) { _first->failedAssertThrowsNot( file, line, expression ); _second->failedAssertThrowsNot( file, line, expression ); } - + void leaveTest( const TestDescription &d ) { _first->leaveTest(d); _second->leaveTest(d); } - + void leaveSuite( const SuiteDescription &d ) { _first->leaveSuite(d); _second->leaveSuite(d); } - + void leaveWorld( const WorldDescription &d ) { _first->leaveWorld(d); diff --git a/test/cxxtest/cxxtest/TestListener.h b/test/cxxtest/cxxtest/TestListener.h index 0eeb5234ea..982d66aa3d 100644 --- a/test/cxxtest/cxxtest/TestListener.h +++ b/test/cxxtest/cxxtest/TestListener.h @@ -19,7 +19,7 @@ namespace CxxTest public: TestListener() {} virtual ~TestListener() {} - + virtual void enterWorld( const WorldDescription & /*desc*/ ) {} virtual void enterSuite( const SuiteDescription & /*desc*/ ) {} virtual void enterTest( const TestDescription & /*desc*/ ) {} diff --git a/test/cxxtest/cxxtest/TestRunner.h b/test/cxxtest/cxxtest/TestRunner.h index cf0d856e83..b656188936 100644 --- a/test/cxxtest/cxxtest/TestRunner.h +++ b/test/cxxtest/cxxtest/TestRunner.h @@ -5,14 +5,14 @@ // TestRunner is the class that runs all the tests. // To use it, create an object that implements the TestListener // interface and call TestRunner::runAllTests( myListener ); -// +// #include #include #include #include -namespace CxxTest +namespace CxxTest { class TestRunner { @@ -31,29 +31,29 @@ namespace CxxTest listener->warning( __FILE__, __LINE__, "Deprecated; Use runAllTests( TestListener & )" ); runAllTests( *listener ); } - } - + } + private: void runWorld() { RealWorldDescription wd; WorldGuard sg; - + tracker().enterWorld( wd ); if ( wd.setUp() ) { for ( SuiteDescription *sd = wd.firstSuite(); sd; sd = sd->next() ) if ( sd->active() ) runSuite( *sd ); - + wd.tearDown(); } tracker().leaveWorld( wd ); } - + void runSuite( SuiteDescription &sd ) { StateGuard sg; - + tracker().enterSuite( sd ); if ( sd.setUp() ) { for ( TestDescription *td = sd.firstTest(); td; td = td->next() ) @@ -68,7 +68,7 @@ namespace CxxTest void runTest( TestDescription &td ) { StateGuard sg; - + tracker().enterTest( td ); if ( td.setUp() ) { td.run(); @@ -76,14 +76,14 @@ namespace CxxTest } tracker().leaveTest( td ); } - + class StateGuard { #ifdef _CXXTEST_HAVE_EH bool _abortTestOnFail; #endif // _CXXTEST_HAVE_EH unsigned _maxDumpSize; - + public: StateGuard() { @@ -92,7 +92,7 @@ namespace CxxTest #endif // _CXXTEST_HAVE_EH _maxDumpSize = maxDumpSize(); } - + ~StateGuard() { #ifdef _CXXTEST_HAVE_EH diff --git a/test/cxxtest/cxxtest/TestSuite.cpp b/test/cxxtest/cxxtest/TestSuite.cpp index 3a1c0d2c43..6810730b6d 100644 --- a/test/cxxtest/cxxtest/TestSuite.cpp +++ b/test/cxxtest/cxxtest/TestSuite.cpp @@ -26,7 +26,7 @@ namespace CxxTest { currentAbortTestOnFail = value; } - + void doAbortTest() { # if defined(_CXXTEST_HAVE_EH) @@ -44,7 +44,7 @@ namespace CxxTest { return currentMaxDumpSize; } - + void setMaxDumpSize( unsigned value ) { currentMaxDumpSize = value; @@ -82,7 +82,7 @@ namespace CxxTest { if ( size == 0 ) return true; - + if ( x == y ) return true; @@ -119,7 +119,7 @@ namespace CxxTest { if ( message ) tracker().failedTest( file, line, message ); - + tracker().failedAssertThrows( file, line, expr, type, otherThrown ); TS_ABORT(); } @@ -129,7 +129,7 @@ namespace CxxTest { if ( message ) tracker().failedTest( file, line, message ); - + tracker().failedAssertThrowsNot( file, line, expression ); TS_ABORT(); } diff --git a/test/cxxtest/cxxtest/TestSuite.h b/test/cxxtest/cxxtest/TestSuite.h index fc5a206a7d..79b7cda2e5 100644 --- a/test/cxxtest/cxxtest/TestSuite.h +++ b/test/cxxtest/cxxtest/TestSuite.h @@ -25,11 +25,11 @@ namespace CxxTest virtual void setUp(); virtual void tearDown(); }; - + class AbortTest {}; void doAbortTest(); # define TS_ABORT() CxxTest::doAbortTest() - + bool abortTestOnFail(); void setAbortTestOnFail( bool value = CXXTEST_DEFAULT_ABORT ); @@ -143,7 +143,7 @@ namespace CxxTest template void doAssertRelation( const char *file, unsigned line, - const char *rExpr, const R &r, + const char *rExpr, const R &r, const char *xExpr, X x, const char *yExpr, Y y, const char *message ) @@ -172,7 +172,7 @@ namespace CxxTest if ( !delta( x, y, d ) ) { if ( message ) tracker().failedTest( file, line, message ); - + tracker().failedAssertDelta( file, line, xExpr, yExpr, dExpr, TS_AS_STRING(x), TS_AS_STRING(y), TS_AS_STRING(d) ); TS_ABORT(); @@ -183,7 +183,7 @@ namespace CxxTest const char *expr, const char *type, bool otherThrown, const char *message ); - + void doFailAssertThrowsNot( const char *file, unsigned line, const char *expression, const char *message ); @@ -231,23 +231,23 @@ namespace CxxTest // TS_ASSERT # define ___ETS_ASSERT(f,l,e,m) { if ( !(e) ) CxxTest::doFailAssert( (f), (l), #e, (m) ); } # define ___TS_ASSERT(f,l,e,m) { _TS_TRY { ___ETS_ASSERT(f,l,e,m); } __TS_CATCH(f,l) } - + # define _ETS_ASSERT(f,l,e) ___ETS_ASSERT(f,l,e,0) # define _TS_ASSERT(f,l,e) ___TS_ASSERT(f,l,e,0) - + # define ETS_ASSERT(e) _ETS_ASSERT(__FILE__,__LINE__,e) # define TS_ASSERT(e) _TS_ASSERT(__FILE__,__LINE__,e) - + # define _ETSM_ASSERT(f,l,m,e) ___ETS_ASSERT(f,l,e,TS_AS_STRING(m) ) # define _TSM_ASSERT(f,l,m,e) ___TS_ASSERT(f,l,e,TS_AS_STRING(m) ) # define ETSM_ASSERT(m,e) _ETSM_ASSERT(__FILE__,__LINE__,m,e) # define TSM_ASSERT(m,e) _TSM_ASSERT(__FILE__,__LINE__,m,e) - + // TS_ASSERT_EQUALS # define ___ETS_ASSERT_EQUALS(f,l,x,y,m) CxxTest::doAssertEquals( (f), (l), #x, (x), #y, (y), (m) ) # define ___TS_ASSERT_EQUALS(f,l,x,y,m) { _TS_TRY { ___ETS_ASSERT_EQUALS(f,l,x,y,m); } __TS_CATCH(f,l) } - + # define _ETS_ASSERT_EQUALS(f,l,x,y) ___ETS_ASSERT_EQUALS(f,l,x,y,0) # define _TS_ASSERT_EQUALS(f,l,x,y) ___TS_ASSERT_EQUALS(f,l,x,y,0) @@ -263,7 +263,7 @@ namespace CxxTest // TS_ASSERT_SAME_DATA # define ___ETS_ASSERT_SAME_DATA(f,l,x,y,s,m) CxxTest::doAssertSameData( (f), (l), #x, (x), #y, (y), #s, (s), (m) ) # define ___TS_ASSERT_SAME_DATA(f,l,x,y,s,m) { _TS_TRY { ___ETS_ASSERT_SAME_DATA(f,l,x,y,s,m); } __TS_CATCH(f,l) } - + # define _ETS_ASSERT_SAME_DATA(f,l,x,y,s) ___ETS_ASSERT_SAME_DATA(f,l,x,y,s,0) # define _TS_ASSERT_SAME_DATA(f,l,x,y,s) ___TS_ASSERT_SAME_DATA(f,l,x,y,s,0) @@ -365,7 +365,7 @@ namespace CxxTest // TS_ASSERT_DELTA # define ___ETS_ASSERT_DELTA(f,l,x,y,d,m) CxxTest::doAssertDelta( (f), (l), #x, (x), #y, (y), #d, (d), (m) ) # define ___TS_ASSERT_DELTA(f,l,x,y,d,m) { _TS_TRY { ___ETS_ASSERT_DELTA(f,l,x,y,d,m); } __TS_CATCH(f,l) } - + # define _ETS_ASSERT_DELTA(f,l,x,y,d) ___ETS_ASSERT_DELTA(f,l,x,y,d,0) # define _TS_ASSERT_DELTA(f,l,x,y,d) ___TS_ASSERT_DELTA(f,l,x,y,d,0) @@ -494,13 +494,13 @@ namespace CxxTest CXXTEST_COMPARISONS( signed CXXTEST_SMALL, unsigned CXXTEST_BIG, unsigned CXXTEST_BIG ) \ CXXTEST_COMPARISONS( signed CXXTEST_BIG, unsigned CXXTEST_SMALL, unsigned CXXTEST_BIG ) - CXXTEST_SMALL_BIG( char, short ) + CXXTEST_SMALL_BIG( char, short ) CXXTEST_SMALL_BIG( char, int ) CXXTEST_SMALL_BIG( short, int ) CXXTEST_SMALL_BIG( char, long ) CXXTEST_SMALL_BIG( short, long ) CXXTEST_SMALL_BIG( int, long ) - + # ifdef _CXXTEST_LONGLONG CXXTEST_SMALL_BIG( char, _CXXTEST_LONGLONG ) CXXTEST_SMALL_BIG( short, _CXXTEST_LONGLONG ) diff --git a/test/cxxtest/cxxtest/TestTracker.cpp b/test/cxxtest/cxxtest/TestTracker.cpp index a029835e47..79fc1ced59 100644 --- a/test/cxxtest/cxxtest/TestTracker.cpp +++ b/test/cxxtest/cxxtest/TestTracker.cpp @@ -18,7 +18,7 @@ namespace CxxTest TestTracker::~TestTracker() { } - + TestTracker & TestTracker::tracker() { static TestTracker theTracker; @@ -42,27 +42,27 @@ namespace CxxTest { return d ? d : &dummyTest(); } - + const SuiteDescription *TestTracker::fixSuite( const SuiteDescription *d ) const { return d ? d : &dummySuite(); } - + const WorldDescription *TestTracker::fixWorld( const WorldDescription *d ) const { return d ? d : &dummyWorld(); } - + const TestDescription &TestTracker::dummyTest() const { return dummySuite().testDescription(0); } - + const SuiteDescription &TestTracker::dummySuite() const { return dummyWorld().suiteDescription(0); } - + const WorldDescription &TestTracker::dummyWorld() const { return _dummyWorld; @@ -86,7 +86,7 @@ namespace CxxTest _testFailedAsserts = _suiteFailedTests = 0; _l->enterSuite(sd); } - + void TestTracker::enterTest( const TestDescription &td ) { setTest( &td ); @@ -128,7 +128,7 @@ namespace CxxTest countFailure(); _l->failedTest( file, line, expression ); } - + void TestTracker::failedAssert( const char *file, unsigned line, const char *expression ) { countFailure(); @@ -159,7 +159,7 @@ namespace CxxTest countFailure(); _l->failedAssertDelta( file, line, xStr, yStr, dStr, x, y, d ); } - + void TestTracker::failedAssertDiffers( const char *file, unsigned line, const char *xStr, const char *yStr, const char *value ) @@ -167,7 +167,7 @@ namespace CxxTest countFailure(); _l->failedAssertDiffers( file, line, xStr, yStr, value ); } - + void TestTracker::failedAssertLessThan( const char *file, unsigned line, const char *xStr, const char *yStr, const char *x, const char *y ) @@ -190,7 +190,7 @@ namespace CxxTest countFailure(); _l->failedAssertPredicate( file, line, predicate, xStr, x ); } - + void TestTracker::failedAssertRelation( const char *file, unsigned line, const char *relation, const char *xStr, const char *yStr, const char *x, const char *y ) @@ -198,7 +198,7 @@ namespace CxxTest countFailure(); _l->failedAssertRelation( file, line, relation, xStr, yStr, x, y ); } - + void TestTracker::failedAssertThrows( const char *file, unsigned line, const char *expression, const char *type, bool otherThrown ) @@ -206,7 +206,7 @@ namespace CxxTest countFailure(); _l->failedAssertThrows( file, line, expression, type, otherThrown ); } - + void TestTracker::failedAssertThrowsNot( const char *file, unsigned line, const char *expression ) { countFailure(); diff --git a/test/cxxtest/cxxtest/TestTracker.h b/test/cxxtest/cxxtest/TestTracker.h index 3f77ae410a..c788206be4 100644 --- a/test/cxxtest/cxxtest/TestTracker.h +++ b/test/cxxtest/cxxtest/TestTracker.h @@ -13,12 +13,12 @@ namespace CxxTest { class TestListener; - + class TestTracker : public TestListener { public: virtual ~TestTracker(); - + static TestTracker &tracker(); const TestDescription *fixTest( const TestDescription *d ) const; @@ -28,11 +28,11 @@ namespace CxxTest const TestDescription &test() const { return *_test; } const SuiteDescription &suite() const { return *_suite; } const WorldDescription &world() const { return *_world; } - + bool testFailed() const { return (testFailedAsserts() > 0); } bool suiteFailed() const { return (suiteFailedTests() > 0); } bool worldFailed() const { return (failedSuites() > 0); } - + unsigned warnings() const { return _warnings; } unsigned failedTests() const { return _failedTests; } unsigned testFailedAsserts() const { return _testFailedAsserts; } @@ -77,7 +77,7 @@ namespace CxxTest const char *expression, const char *type, bool otherThrown ); void failedAssertThrowsNot( const char *file, unsigned line, const char *expression ); - + private: TestTracker( const TestTracker & ); TestTracker &operator=( const TestTracker & ); @@ -94,7 +94,7 @@ namespace CxxTest const TestDescription &dummyTest() const; const SuiteDescription &dummySuite() const; const WorldDescription &dummyWorld() const; - + void setWorld( const WorldDescription *w ); void setSuite( const SuiteDescription *s ); void setTest( const TestDescription *t ); @@ -102,7 +102,7 @@ namespace CxxTest void countFailure(); friend class TestRunner; - + TestTracker(); void initialize(); void setListener( TestListener *l ); diff --git a/test/cxxtest/cxxtest/ValueTraits.cpp b/test/cxxtest/cxxtest/ValueTraits.cpp index 5f81e386fa..fd669eecd9 100644 --- a/test/cxxtest/cxxtest/ValueTraits.cpp +++ b/test/cxxtest/cxxtest/ValueTraits.cpp @@ -3,12 +3,12 @@ #include -namespace CxxTest +namespace CxxTest { // // Non-inline functions from ValueTraits.h // - + char digitToChar( unsigned digit ) { if ( digit < 10 ) @@ -26,7 +26,7 @@ namespace CxxTest asHex[2] = '\0'; return asHex; } - + char *copyString( char *dst, const char *src ) { while ( (*dst = *src) != '\0' ) { @@ -78,13 +78,13 @@ namespace CxxTest { return charToString( (unsigned long)(unsigned char)c, s ); } - + char *bytesToString( const unsigned char *bytes, unsigned numBytes, unsigned maxBytes, char *s ) { bool truncate = (numBytes > maxBytes); if ( truncate ) numBytes = maxBytes; - + s = copyString( s, "{ " ); for ( unsigned i = 0; i < numBytes; ++ i, ++ bytes ) s = copyString( copyString( s, byteToHex( *bytes ) ), " " ); @@ -120,7 +120,7 @@ namespace CxxTest s = copyString( s, "E" ); s = numberToString( requiredDigitsOnLeft( t ) - 1, s ); } - + void ValueTraits::normalNumber( double t ) { char *s = doNegative( t ); diff --git a/test/cxxtest/cxxtest/ValueTraits.h b/test/cxxtest/cxxtest/ValueTraits.h index 31035e88cc..339a345029 100644 --- a/test/cxxtest/cxxtest/ValueTraits.h +++ b/test/cxxtest/cxxtest/ValueTraits.h @@ -4,7 +4,7 @@ // // ValueTraits are used by CxxTest to convert arbitrary // values used in TS_ASSERT_EQUALS() to a string representation. -// +// // This header file contains value traits for builtin integral types. // To declare value traits for new types you should instantiate the class // ValueTraits. @@ -18,7 +18,7 @@ # define CXXTEST_TEMPLATE_INSTANTIATION template<> #endif // _CXXTEST_OLD_TEMPLATE_SYNTAX -namespace CxxTest +namespace CxxTest { // // This is how we use the value traits @@ -75,11 +75,11 @@ namespace CxxTest { enum { MAX_BYTES = 8 }; char _asString[sizeof("{ ") + sizeof("XX ") * MAX_BYTES + sizeof("... }")]; - + public: ValueTraits( const T &t ) { bytesToString( (const unsigned char *)&t, sizeof(T), MAX_BYTES, _asString ); } const char *asString( void ) const { return _asString; } - }; + }; // // traits( T t ) @@ -112,7 +112,7 @@ namespace CxxTest # else // !_CXXTEST_NO_COPY_CONST # define CXXTEST_COPY_CONST_TRAITS(CXXTEST_CLASS) CXXTEST_COPY_TRAITS(CXXTEST_CLASS, const CXXTEST_CLASS) # endif // _CXXTEST_NO_COPY_CONST - + // // Avoid compiler warnings about unsigned types always >= 0 // @@ -149,7 +149,7 @@ namespace CxxTest *s++ = '-'; n = abs(n); } - + N digit = 1; while ( digit <= (n / base) ) digit *= base; @@ -167,7 +167,7 @@ namespace CxxTest // All the specific ValueTraits follow. // You can #define CXXTEST_USER_VALUE_TRAITS if you don't want them // - + #ifndef CXXTEST_USER_VALUE_TRAITS // // ValueTraits: const char * const & @@ -178,7 +178,7 @@ namespace CxxTest { ValueTraits &operator=( const ValueTraits & ); const char *_asString; - + public: ValueTraits( const char * const &value ) : _asString( value ) {} ValueTraits( const ValueTraits &other ) : _asString( other._asString ) {} @@ -190,12 +190,12 @@ namespace CxxTest // // ValueTraits: bool - // + // CXXTEST_TEMPLATE_INSTANTIATION class ValueTraits { bool _value; - + public: ValueTraits( const bool value ) : _value( value ) {} const char *asString( void ) const { return _value ? "true" : "false"; } @@ -249,7 +249,7 @@ namespace CxxTest }; CXXTEST_COPY_CONST_TRAITS( signed long int ); - + // // ValueTraits: unsigned long // @@ -264,17 +264,17 @@ namespace CxxTest }; CXXTEST_COPY_CONST_TRAITS( unsigned long int ); - + // // All decimals are the same as the long version // - + CXXTEST_COPY_TRAITS( const signed int, const signed long int ); CXXTEST_COPY_TRAITS( const unsigned int, const unsigned long int ); CXXTEST_COPY_TRAITS( const signed short int, const signed long int ); CXXTEST_COPY_TRAITS( const unsigned short int, const unsigned long int ); CXXTEST_COPY_TRAITS( const unsigned char, const unsigned long int ); - + CXXTEST_COPY_CONST_TRAITS( signed int ); CXXTEST_COPY_CONST_TRAITS( unsigned int ); CXXTEST_COPY_CONST_TRAITS( signed short int ); @@ -310,7 +310,7 @@ namespace CxxTest class ValueTraits { public: - ValueTraits( double t ) + ValueTraits( double t ) { ( requiredDigitsOnLeft( t ) > MAX_DIGITS_ON_LEFT ) ? hugeNumber( t ) : @@ -318,7 +318,7 @@ namespace CxxTest } const char *asString( void ) const { return _asString; } - + private: enum { MAX_DIGITS_ON_LEFT = 24, DIGITS_ON_RIGHT = 4, BASE = 10 }; char _asString[1 + MAX_DIGITS_ON_LEFT + 1 + DIGITS_ON_RIGHT + 1]; diff --git a/test/cxxtest/cxxtest/Win32Gui.h b/test/cxxtest/cxxtest/Win32Gui.h index 7b37ceccbc..5fe38d3202 100644 --- a/test/cxxtest/cxxtest/Win32Gui.h +++ b/test/cxxtest/cxxtest/Win32Gui.h @@ -31,7 +31,7 @@ namespace CxxTest { parseCommandLine( argc, argv ); } - + void enterWorld( const WorldDescription &wd ) { getTotalTests( wd ); @@ -61,7 +61,7 @@ namespace CxxTest setIcon( IDI_WARNING ); getTotalTests(); } - + void redBar() { if ( _startMinimized ) @@ -90,11 +90,11 @@ namespace CxxTest HANDLE _canStartTests; unsigned _numTotalTests, _testsDone; char _strTotalTests[WorldDescription::MAX_STRLEN_TOTAL_TESTS]; - enum { + enum { STATUS_SUITE_NAME, STATUS_SUITE_TIME, STATUS_TEST_NAME, STATUS_TEST_TIME, STATUS_TESTS_DONE, STATUS_WORLD_TIME, - STATUS_TOTAL_PARTS + STATUS_TOTAL_PARTS }; int _statusWidths[STATUS_TOTAL_PARTS]; unsigned _statusOffsets[STATUS_TOTAL_PARTS]; @@ -107,7 +107,7 @@ namespace CxxTest { _startMinimized = _keep = false; _title = argv[0]; - + for ( int i = 1; i < argc; ++ i ) { if ( !lstrcmpA( argv[i], "-minimized" ) ) @@ -118,7 +118,7 @@ namespace CxxTest _title = argv[++i]; } } - + void getTotalTests() { getTotalTests( tracker().world() ); @@ -187,7 +187,7 @@ namespace CxxTest HMODULE dll = LoadLibraryA( "comctl32.dll" ); if ( !dll ) return; - + typedef void (WINAPI *FUNC)( void ); FUNC func = (FUNC)GetProcAddress( dll, "InitCommonControls" ); if ( !func ) @@ -394,7 +394,7 @@ namespace CxxTest progressBarMessage( PBM_SETBARCOLOR, 0, RGB( red, green, blue ) ); } #else // !PBM_SETBARCOLOR - void setColor( BYTE, BYTE, BYTE ) + void setColor( BYTE, BYTE, BYTE ) { } #endif // PBM_SETBARCOLOR @@ -500,7 +500,7 @@ namespace CxxTest { setRatios( 0, 0, 0, 0, 1, 1 ); resizeControls(); - + const char *tests = (_numTotalTests == 1) ? "test" : "tests"; if ( tracker().failedTests() ) wsprintfA( _statusTestsDone, "Failed %u of %s %s", diff --git a/test/cxxtest/cxxtest/X11Gui.h b/test/cxxtest/cxxtest/X11Gui.h index ed76db4dab..40a9e075dc 100644 --- a/test/cxxtest/cxxtest/X11Gui.h +++ b/test/cxxtest/cxxtest/X11Gui.h @@ -3,7 +3,7 @@ // // X11Gui displays a simple progress bar using X11 -// +// // It accepts the following command-line arguments: // -title - Sets the application title // -fn or -font <font> - Sets the font @@ -29,7 +29,7 @@ namespace CxxTest { parseCommandLine( argc, argv ); } - + void enterWorld( const WorldDescription &wd ) { openDisplay(); @@ -44,7 +44,7 @@ namespace CxxTest processEvents(); } } - + void guiEnterTest( const char *suiteName, const char *testName ) { if ( _display ) { @@ -53,7 +53,7 @@ namespace CxxTest redraw(); } } - + void yellowBar() { if ( _display ) { @@ -148,7 +148,7 @@ namespace CxxTest XAllocColor( _display, _colormap, &color ); return color.pixel; } - + void createWindow() { _window = XCreateSimpleWindow( _display, RootWindow( _display, 0 ), 0, 0, 1, 1, 0, 0, _background ); @@ -218,7 +218,7 @@ namespace CxxTest void centerWindow() { XMapWindow( _display, _window ); - + Screen *screen = XDefaultScreenOfDisplay( _display ); int screenWidth = WidthOfScreen( screen ); int screenHeight = HeightOfScreen( screen ); @@ -227,14 +227,14 @@ namespace CxxTest _width = (screenWidth * 4) / 5; _height = screenHeight / 14; - + XMoveResizeWindow( _display, _window, xCenter - (_width / 2), yCenter - (_height / 2), _width, _height ); } void processEvents() { redraw(); - + XEvent event; while( XCheckMaskEvent( _display, _eventMask, &event ) ) redraw(); @@ -290,7 +290,7 @@ namespace CxxTest void drawPercentage() { XSetForeground( _display, _gc, _foreground ); - + char str[sizeof("1000000000 of ") + sizeof(_strTotalTests) + sizeof(" (100%)")]; sprintf( str, "%u of %s (%u%%)", _testsDone, _strTotalTests, (_testsDone * 100) / _numTotalTests ); unsigned len = strlen( str ); diff --git a/test/cxxtest/cxxtest/YesNoRunner.h b/test/cxxtest/cxxtest/YesNoRunner.h index e7b83b6bb8..c8e891da46 100644 --- a/test/cxxtest/cxxtest/YesNoRunner.h +++ b/test/cxxtest/cxxtest/YesNoRunner.h @@ -9,7 +9,7 @@ #include <cxxtest/TestRunner.h> #include <cxxtest/TestListener.h> -namespace CxxTest +namespace CxxTest { class YesNoRunner : public TestListener { @@ -17,7 +17,7 @@ namespace CxxTest YesNoRunner() { } - + int run() { TestRunner::runAllTests( *this ); diff --git a/test/cxxtest/sample/CreatedTest.h b/test/cxxtest/sample/CreatedTest.h index 53a6821a21..fe6cce4450 100644 --- a/test/cxxtest/sample/CreatedTest.h +++ b/test/cxxtest/sample/CreatedTest.h @@ -17,7 +17,7 @@ class CreatedTest : public CxxTest::TestSuite public: CreatedTest( unsigned size ) : _buffer( new char[size] ) {} virtual ~CreatedTest() { delete[] _buffer; } - + static CreatedTest *createSuite() { return new CreatedTest( 16 ); } static void destroySuite( CreatedTest *suite ) { delete suite; } diff --git a/test/cxxtest/sample/DeltaTest.h b/test/cxxtest/sample/DeltaTest.h index 7223c3af25..5b2dd7c155 100644 --- a/test/cxxtest/sample/DeltaTest.h +++ b/test/cxxtest/sample/DeltaTest.h @@ -7,7 +7,7 @@ class DeltaTest : public CxxTest::TestSuite { double _pi, _delta; - + public: void setUp() { diff --git a/test/cxxtest/sample/ExceptionTest.h b/test/cxxtest/sample/ExceptionTest.h index 68363c8740..47375480b1 100644 --- a/test/cxxtest/sample/ExceptionTest.h +++ b/test/cxxtest/sample/ExceptionTest.h @@ -42,7 +42,7 @@ private: public: Number( int ) {} }; - + int throwThis( int i ) { throw Number( i ); diff --git a/test/cxxtest/sample/FixtureTest.h b/test/cxxtest/sample/FixtureTest.h index 33a119f2bd..272a90c2d5 100644 --- a/test/cxxtest/sample/FixtureTest.h +++ b/test/cxxtest/sample/FixtureTest.h @@ -19,7 +19,7 @@ public: { _buffer = new char[1024]; } - + void tearDown() { delete[] _buffer; diff --git a/test/cxxtest/sample/TraitsTest.h b/test/cxxtest/sample/TraitsTest.h index 14659385d0..09957e591d 100644 --- a/test/cxxtest/sample/TraitsTest.h +++ b/test/cxxtest/sample/TraitsTest.h @@ -20,7 +20,7 @@ public: Pet( const char *petName ) { strcpy( _name, petName ); } const char *name() const { return _name; } - + bool operator== ( const Pet &other ) const { return !strcmp( name(), other.name() ); @@ -32,13 +32,13 @@ public: // Note: Most compilers do not require that you define both // ValueTraits<const T> and ValueTraits<T>, but some do. // -namespace CxxTest +namespace CxxTest { CXXTEST_TEMPLATE_INSTANTIATION class ValueTraits<const Pet> { char _asString[256]; - + public: ValueTraits( const Pet &pet ) { sprintf( _asString, "Pet(\"%s\")", pet.name() ); } const char *asString() const { return _asString; } diff --git a/test/cxxtest/sample/mock/Dice.h b/test/cxxtest/sample/mock/Dice.h index 94271417e1..3a393ef262 100644 --- a/test/cxxtest/sample/mock/Dice.h +++ b/test/cxxtest/sample/mock/Dice.h @@ -5,7 +5,7 @@ class Dice { public: Dice(); - + unsigned roll(); }; diff --git a/test/cxxtest/sample/mock/MockStdlib.h b/test/cxxtest/sample/mock/MockStdlib.h index aee62bafe7..2434cb82cc 100644 --- a/test/cxxtest/sample/mock/MockStdlib.h +++ b/test/cxxtest/sample/mock/MockStdlib.h @@ -7,7 +7,7 @@ class MockStdlib : { public: unsigned lastSeed; - + void srand( unsigned seed ) { lastSeed = seed; diff --git a/test/cxxtest/sample/mock/TestDice.h b/test/cxxtest/sample/mock/TestDice.h index 35b3b7eec9..7607ccd6f8 100644 --- a/test/cxxtest/sample/mock/TestDice.h +++ b/test/cxxtest/sample/mock/TestDice.h @@ -16,14 +16,14 @@ public: { delete stdlib; } - + void test_Randomize_uses_time() { stdlib->nextTime = 12345; Dice dice; TS_ASSERT_EQUALS( stdlib->lastSeed, 12345 ); } - + void test_Roll() { Dice dice; @@ -47,7 +47,7 @@ public: stdlib->nextRand = 2; TS_ASSERT_EQUALS( dice.roll(), 3 ); - + class Five : public T::Base_rand { int rand() { return 5; } }; Five *five = new Five; @@ -55,7 +55,7 @@ public: TS_ASSERT_EQUALS( dice.roll(), 6 ); TS_ASSERT_EQUALS( dice.roll(), 6 ); delete five; - + stdlib->nextRand = 1; TS_ASSERT_EQUALS( dice.roll(), 2 ); } diff --git a/test/cxxtest/sample/mock/roll.cpp b/test/cxxtest/sample/mock/roll.cpp index 20ea967af3..75ca31bedd 100644 --- a/test/cxxtest/sample/mock/roll.cpp +++ b/test/cxxtest/sample/mock/roll.cpp @@ -6,6 +6,6 @@ int main() Dice dice; printf( "First roll: %u\n", dice.roll() ); printf( "Second roll: %u\n", dice.roll() ); - + return 0; } diff --git a/tools/create_drascula/create_drascula.cpp b/tools/create_drascula/create_drascula.cpp index e150fa7518..9ea2da380a 100644 --- a/tools/create_drascula/create_drascula.cpp +++ b/tools/create_drascula/create_drascula.cpp @@ -24,7 +24,7 @@ * This is a utility for storing all the hardcoded data of Drascula in a separate * data file, used by the game engine */ - + // HACK to allow building with the SDL backend on MinGW // see bug #1800764 "TOOLS: MinGW tools building broken" #ifdef main @@ -369,7 +369,7 @@ int main(int argc, char *argv[]) { fwrite(padBuf, pad, 1, outFile); } } - + // Write _textt writeUint16BE(outFile, NUM_TEXTT); for (lang = 0; lang < NUM_LANGS; lang++) { diff --git a/tools/create_drascula/create_drascula.h b/tools/create_drascula/create_drascula.h index 51287c43d2..13903e9564 100644 --- a/tools/create_drascula/create_drascula.h +++ b/tools/create_drascula/create_drascula.h @@ -43,7 +43,7 @@ #define NUM_TEXTVB 63 #define NUM_TEXTSYS 4 #define NUM_TEXTHIS 5 -#define NUM_TEXTVERBS 6 +#define NUM_TEXTVERBS 6 #define NUM_TEXTMISC 3 #define NUM_TEXTD1 11 diff --git a/tools/create_kyradat/create_kyradat.cpp b/tools/create_kyradat/create_kyradat.cpp index c69c38199a..456da29fa0 100644 --- a/tools/create_kyradat/create_kyradat.cpp +++ b/tools/create_kyradat/create_kyradat.cpp @@ -91,7 +91,7 @@ const ExtractType extractTypeTable[] = { { k2TypeShpDataV1, extractHofShapeAnimDataV1, createFilename }, { k2TypeShpDataV2, extractHofShapeAnimDataV2, createFilename }, { k2TypeSoundList, extractStringsWoSuffix, createFilename }, - { k2TypeLangSoundList, extractStringsWoSuffix, createLangFilename }, + { k2TypeLangSoundList, extractStringsWoSuffix, createLangFilename }, { k2TypeSfxList, extractPaddedStrings, createFilename }, { k3TypeRaw16to8, extractRaw16to8, createFilename }, { k3TypeShpData, extractMrShapeAnimData, createFilename }, @@ -239,7 +239,7 @@ const ExtractFilename extractFilenames[] = { { k2IngameCDA, kTypeRawData, "I_TRACKS.CDA" }, { k2IngameTalkObjIndex, kTypeRawData, "I_TALKOBJECTS.MAP" }, { k2IngameTimJpStrings, kTypeStringList, "I_TIMJPSTR.TXT" }, - { k2IngameItemAnimData, k2TypeShpDataV2, "I_INVANIM.SHP" }, + { k2IngameItemAnimData, k2TypeShpDataV2, "I_INVANIM.SHP" }, { k2IngameTlkDemoStrings, kTypeLanguageList, "I_TLKDEMO.TXT" }, @@ -295,7 +295,7 @@ bool getFilename(char *dstFilename, const Game *g, const int id) { void createFilename(char *dstFilename, const int gid, const int lang, const int special, const char *filename) { strcpy(dstFilename, filename); - static const char *gidExtensions[] = { "", ".K2", ".K3", 0, ".LOL" }; + static const char *gidExtensions[] = { "", ".K2", ".K3", 0, ".LOL" }; strcat(dstFilename, gidExtensions[gid]); for (const SpecialExtension *specialE = specialTable; specialE->special != -1; ++specialE) { @@ -318,7 +318,7 @@ void createLangFilename(char *dstFilename, const int gid, const int lang, const } } - static const char *gidExtensions[] = { "", ".K2", ".K3", 0, ".LOL" }; + static const char *gidExtensions[] = { "", ".K2", ".K3", 0, ".LOL" }; strcat(dstFilename, gidExtensions[gid]); for (const SpecialExtension *specialE = specialTable; specialE->special != -1; ++specialE) { @@ -633,7 +633,7 @@ bool extractHofSeqData(PAKFile &out, const Game *g, const byte *data, const uint uint16 relOffs = (uint16) (output - buffer); WRITE_BE_UINT16(hdout, relOffs); hdout++; - + WRITE_BE_UINT16(output, READ_LE_UINT16(ptr)); // flags ptr += 2; output += 2; @@ -683,9 +683,9 @@ bool extractHofSeqData(PAKFile &out, const Game *g, const byte *data, const uint extractHofSeqData_isControl(ctrStart, ctrSize)) { controlOffs = (uint16) (output - buffer); *output++ = ctrSize >> 2; - + for (int cc = 0; cc < ctrSize; cc += 2) - WRITE_BE_UINT16(output + cc, READ_LE_UINT16(ctrStart + cc)); // frame control + WRITE_BE_UINT16(output + cc, READ_LE_UINT16(ctrStart + cc)); // frame control output += ctrSize; } } @@ -708,7 +708,7 @@ bool extractHofSeqData(PAKFile &out, const Game *g, const byte *data, const uint ptr += 2; output += 2; - // endFrame + // endFrame WRITE_BE_UINT16(output, (ctrSize && ((ctrSize >> 2) < READ_LE_UINT16(ptr))) ? (ctrSize >> 2) : READ_LE_UINT16(ptr)); ptr += 2; output += 2; @@ -717,7 +717,7 @@ bool extractHofSeqData(PAKFile &out, const Game *g, const byte *data, const uint WRITE_BE_UINT16(output, READ_LE_UINT16(ptr)); ptr += 2; output += 2; - + ptr += 4; for (int w = 0; w < 2; w++) { //x, y @@ -744,7 +744,7 @@ bool extractHofSeqData(PAKFile &out, const Game *g, const byte *data, const uint memset(output, 0, 4); output += 4; } - + if (g->special == k2TownsFile1E) ptr += 2; @@ -891,7 +891,7 @@ bool extractHofShapeAnimDataV1(PAKFile &out, const Game *g, const byte *data, co src += 4; dst += 2; outsize += 4; - + for (int j = 0; j < 20; j++) { WRITE_BE_UINT16(dst, READ_LE_UINT16(src)); src += 2; @@ -923,12 +923,12 @@ bool extractHofShapeAnimDataV2(PAKFile &out, const Game *g, const byte *data, co WRITE_BE_UINT16(dst, READ_LE_UINT16(src)); src += 2; dst += 2; - + uint8 numFrames = *src; *dst++ = numFrames; src += 6; outsize += 3; - + for (int i = 0; i < (numFrames << 1); i++) { WRITE_BE_UINT16(dst, READ_LE_UINT16(src)); src += 2; @@ -1030,12 +1030,12 @@ bool extractMrShapeAnimData(PAKFile &out, const Game *g, const byte *data, const WRITE_BE_UINT16(dst, READ_LE_UINT16(src1)); src1 += 2; dst += 2; - + uint8 numFrames = *src1; *dst++ = numFrames; src1 += 10; outsize += 3; - + for (int i = 0; i < (numFrames << 1); i++) { WRITE_BE_UINT16(dst, READ_LE_UINT16(src2)); src2 += 2; diff --git a/tools/create_kyradat/hof_cd.h b/tools/create_kyradat/hof_cd.h index 431adbb674..1530a04e9f 100644 --- a/tools/create_kyradat/hof_cd.h +++ b/tools/create_kyradat/hof_cd.h @@ -54,7 +54,7 @@ const Game kyra2TalkieGames[] = { { kKyra2, FR_FRA, k2CDFile2F, "e20d0d2e500f01e399ec588247a7e213", kyra2File2CDF}, { kKyra2, DE_DEU, k2CDFile2G, "e20d0d2e500f01e399ec588247a7e213", kyra2File2CDG}, - // Italian Fan Translation (using same offsets as English) + // Italian Fan Translation (using same offsets as English) { kKyra2, IT_ITA, k2CDFile1I, "130795aa8f2333250c895dae9028b9bb", kyra2File1CDI}, GAME_DUMMY_ENTRY diff --git a/tools/create_kyradat/hof_demo.h b/tools/create_kyradat/hof_demo.h index 2eaaa3c413..b239f63780 100644 --- a/tools/create_kyradat/hof_demo.h +++ b/tools/create_kyradat/hof_demo.h @@ -26,7 +26,7 @@ const Game kyra2Demos[] = { { kKyra2, EN_ANY, k2DemoVersion, "a620a37579dd44ab0403482285e3897f", kyra2Demo}, { kKyra2, EN_ANY, k2CDFile2E, "fa54d8abfe05f9186c05f7de7eaf1480", kyra2DemoCDE}, { kKyra2, FR_FRA, k2CDFile2F, "fa54d8abfe05f9186c05f7de7eaf1480", kyra2DemoCDF}, - { kKyra2, DE_DEU, k2CDFile2G, "fa54d8abfe05f9186c05f7de7eaf1480", kyra2DemoCDG}, + { kKyra2, DE_DEU, k2CDFile2G, "fa54d8abfe05f9186c05f7de7eaf1480", kyra2DemoCDG}, GAME_DUMMY_ENTRY }; diff --git a/tools/create_kyradat/misc.h b/tools/create_kyradat/misc.h index f0de5283ad..c519418d37 100644 --- a/tools/create_kyradat/misc.h +++ b/tools/create_kyradat/misc.h @@ -536,13 +536,13 @@ const SpecialExtension specialTable[] = { { k2CDFile2E, "CD" }, { k2CDFile2F, "CD" }, { k2CDFile2G, "CD" }, - + { k2TownsFile1E, "TNS" }, { k2TownsFile1J, "TNS" }, { k2TownsFile2E, "TNS" }, { k2TownsFile2J, "TNS" }, { k2DemoVersion, "DEM" }, - { k2DemoLol, "DEM" }, + { k2DemoLol, "DEM" }, { -1, 0 } }; -- cgit v1.2.3