aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--AUTHORS4
-rw-r--r--COPYING.FREEFONT690
-rw-r--r--COPYRIGHT1
-rw-r--r--Makefile.common4
-rw-r--r--NEWS31
-rw-r--r--README77
-rw-r--r--audio/decoders/flac.cpp4
-rw-r--r--audio/decoders/iff_sound.cpp2
-rw-r--r--audio/decoders/qdm2.cpp6
-rw-r--r--audio/decoders/voc.cpp51
-rw-r--r--audio/decoders/wave.cpp7
-rw-r--r--audio/mididrv.cpp22
-rw-r--r--audio/mods/tfmx.cpp2
-rw-r--r--audio/softsynth/cms.cpp2
-rw-r--r--audio/softsynth/mt32.cpp47
-rw-r--r--audio/softsynth/mt32/AReverbModel.cpp237
-rw-r--r--audio/softsynth/mt32/AReverbModel.h86
-rw-r--r--audio/softsynth/mt32/DelayReverb.cpp150
-rw-r--r--audio/softsynth/mt32/DelayReverb.h53
-rw-r--r--audio/softsynth/mt32/FreeverbModel.cpp78
-rw-r--r--audio/softsynth/mt32/FreeverbModel.h44
-rw-r--r--audio/softsynth/mt32/LA32Ramp.cpp150
-rw-r--r--audio/softsynth/mt32/LA32Ramp.h43
-rw-r--r--audio/softsynth/mt32/Part.cpp622
-rw-r--r--audio/softsynth/mt32/Part.h133
-rw-r--r--audio/softsynth/mt32/Partial.cpp557
-rw-r--r--audio/softsynth/mt32/Partial.h119
-rw-r--r--audio/softsynth/mt32/PartialManager.cpp250
-rw-r--r--audio/softsynth/mt32/PartialManager.h54
-rw-r--r--audio/softsynth/mt32/Poly.cpp174
-rw-r--r--audio/softsynth/mt32/Poly.h67
-rw-r--r--audio/softsynth/mt32/Structures.h217
-rw-r--r--audio/softsynth/mt32/Synth.cpp1620
-rw-r--r--audio/softsynth/mt32/Synth.h471
-rw-r--r--audio/softsynth/mt32/TVA.cpp365
-rw-r--r--audio/softsynth/mt32/TVA.h94
-rw-r--r--audio/softsynth/mt32/TVF.cpp230
-rw-r--r--audio/softsynth/mt32/TVF.h54
-rw-r--r--audio/softsynth/mt32/TVP.cpp321
-rw-r--r--audio/softsynth/mt32/TVP.h67
-rw-r--r--audio/softsynth/mt32/Tables.cpp119
-rw-r--r--audio/softsynth/mt32/Tables.h64
-rw-r--r--audio/softsynth/mt32/freeverb.cpp357
-rw-r--r--audio/softsynth/mt32/freeverb.h322
-rw-r--r--audio/softsynth/mt32/i386.cpp849
-rw-r--r--audio/softsynth/mt32/i386.h49
-rw-r--r--audio/softsynth/mt32/mmath.h73
-rw-r--r--audio/softsynth/mt32/module.mk20
-rw-r--r--audio/softsynth/mt32/mt32_file.cpp69
-rw-r--r--audio/softsynth/mt32/mt32_file.h52
-rw-r--r--audio/softsynth/mt32/mt32emu.h140
-rw-r--r--audio/softsynth/mt32/part.cpp633
-rw-r--r--audio/softsynth/mt32/part.h112
-rw-r--r--audio/softsynth/mt32/partial.cpp968
-rw-r--r--audio/softsynth/mt32/partial.h148
-rw-r--r--audio/softsynth/mt32/partialManager.cpp272
-rw-r--r--audio/softsynth/mt32/partialManager.h56
-rw-r--r--audio/softsynth/mt32/structures.h284
-rw-r--r--audio/softsynth/mt32/synth.cpp1202
-rw-r--r--audio/softsynth/mt32/synth.h299
-rw-r--r--audio/softsynth/mt32/tables.cpp761
-rw-r--r--audio/softsynth/mt32/tables.h116
-rw-r--r--audio/softsynth/opl/dbopl.cpp4
-rw-r--r--audio/softsynth/sid.h4
-rw-r--r--backends/events/default/default-events.cpp93
-rw-r--r--backends/events/default/default-events.h2
-rw-r--r--backends/events/maemosdl/maemosdl-events.cpp66
-rw-r--r--backends/events/maemosdl/maemosdl-events.h11
-rw-r--r--backends/events/webossdl/webossdl-events.cpp28
-rw-r--r--backends/events/webossdl/webossdl-events.h6
-rw-r--r--backends/fs/symbian/symbian-fs.cpp10
-rw-r--r--backends/fs/symbian/symbianstream.cpp38
-rw-r--r--backends/fs/windows/windows-fs.cpp2
-rw-r--r--backends/graphics/null/null-graphics.h3
-rw-r--r--backends/graphics/opengl/glerrorcheck.cpp10
-rw-r--r--backends/graphics/opengl/gltexture.cpp15
-rw-r--r--backends/graphics/opengl/gltexture.h12
-rw-r--r--backends/graphics/opengl/opengl-graphics.cpp92
-rw-r--r--backends/graphics/opengl/opengl-graphics.h23
-rw-r--r--backends/graphics/openglsdl/openglsdl-graphics.cpp11
-rw-r--r--backends/keymapper/action.cpp6
-rw-r--r--backends/keymapper/action.h42
-rw-r--r--backends/keymapper/hardware-key.h103
-rw-r--r--backends/keymapper/keymap.cpp219
-rw-r--r--backends/keymapper/keymap.h17
-rw-r--r--backends/keymapper/keymapper-defaults.h56
-rw-r--r--backends/keymapper/keymapper.cpp73
-rw-r--r--backends/keymapper/keymapper.h43
-rw-r--r--backends/keymapper/remap-dialog.cpp67
-rw-r--r--backends/keymapper/remap-dialog.h2
-rw-r--r--backends/keymapper/types.h74
-rw-r--r--backends/midi/coreaudio.cpp44
-rw-r--r--backends/modular-backend.h7
-rw-r--r--backends/module.mk1
-rw-r--r--backends/mutex/null/null-mutex.h2
-rw-r--r--backends/platform/android/android.cpp1
-rw-r--r--backends/platform/android/android.h2
-rw-r--r--backends/platform/android/events.cpp36
-rw-r--r--backends/platform/android/texture.cpp2
-rw-r--r--backends/platform/bada/application.cpp2
-rw-r--r--backends/platform/bada/audio.cpp2
-rw-r--r--backends/platform/bada/fs.cpp10
-rw-r--r--backends/platform/bada/missing.cpp2
-rw-r--r--backends/platform/bada/portdefs.h6
-rw-r--r--backends/platform/dc/audio.cpp2
-rw-r--r--backends/platform/dc/dcloader.cpp4
-rw-r--r--backends/platform/dc/display.cpp14
-rw-r--r--backends/platform/ds/arm7/source/main.cpp18
-rw-r--r--backends/platform/ds/arm9/source/blitters.cpp10
-rw-r--r--backends/platform/ds/arm9/source/dsmain.cpp6
-rwxr-xr-xbackends/platform/gph/caanoo-bundle.mk20
-rw-r--r--backends/platform/gph/gp2x-bundle.mk29
-rwxr-xr-xbackends/platform/gph/gp2xwiz-bundle.mk20
-rw-r--r--backends/platform/iphone/blit_arm.s137
-rw-r--r--backends/platform/iphone/iphone_common.h65
-rw-r--r--backends/platform/iphone/iphone_keyboard.h13
-rw-r--r--backends/platform/iphone/iphone_keyboard.mm (renamed from backends/platform/iphone/iphone_keyboard.m)10
-rw-r--r--backends/platform/iphone/iphone_main.mm (renamed from backends/platform/iphone/iphone_main.m)69
-rw-r--r--backends/platform/iphone/iphone_video.h60
-rw-r--r--backends/platform/iphone/iphone_video.m756
-rw-r--r--backends/platform/iphone/iphone_video.mm853
-rw-r--r--backends/platform/iphone/module.mk3
-rw-r--r--backends/platform/iphone/osys_events.cpp401
-rw-r--r--backends/platform/iphone/osys_main.cpp57
-rw-r--r--backends/platform/iphone/osys_main.h57
-rw-r--r--backends/platform/iphone/osys_video.cpp503
-rw-r--r--backends/platform/iphone/osys_video.mm418
-rw-r--r--backends/platform/linuxmoto/hardwarekeys.cpp78
-rw-r--r--backends/platform/linuxmoto/linuxmoto-sdl.h2
-rw-r--r--backends/platform/maemo/maemo-common.h26
-rw-r--r--backends/platform/maemo/maemo-keys.h139
-rw-r--r--backends/platform/maemo/maemo.cpp91
-rw-r--r--backends/platform/maemo/maemo.h13
-rw-r--r--backends/platform/n64/osys_n64_utilities.cpp4
-rwxr-xr-xbackends/platform/openpandora/op-bundle.mk29
-rw-r--r--backends/platform/ps2/DmaPipe.cpp6
-rw-r--r--backends/platform/ps2/Gs2dScreen.cpp18
-rw-r--r--backends/platform/ps2/fileio.cpp12
-rw-r--r--backends/platform/ps2/icon.cpp8
-rw-r--r--backends/platform/ps2/ps2mutex.cpp6
-rw-r--r--backends/platform/ps2/ps2pad.cpp2
-rw-r--r--backends/platform/ps2/systemps2.cpp18
-rw-r--r--backends/platform/psp/display_manager.cpp8
-rw-r--r--backends/platform/sdl/hardwarekeys.cpp301
-rwxr-xr-xbackends/platform/sdl/macosx/appmenu_osx.mm44
-rw-r--r--backends/platform/sdl/posix/posix.cpp4
-rw-r--r--backends/platform/sdl/sdl.h2
-rw-r--r--backends/platform/sdl/win32/win32.cpp5
-rw-r--r--backends/platform/webos/webos.cpp8
-rw-r--r--backends/platform/webos/webos.h2
-rw-r--r--backends/platform/wince/wince-sdl.cpp12
-rw-r--r--backends/plugins/elf/elf-loader.cpp2
-rw-r--r--backends/saves/windows/windows-saves.cpp78
-rw-r--r--backends/saves/windows/windows-saves.h (renamed from backends/platform/iphone/blit_arm.h)25
-rw-r--r--backends/taskbar/win32/win32-taskbar.cpp19
-rw-r--r--base/commandLine.cpp2
-rw-r--r--base/main.cpp42
-rw-r--r--base/plugins.cpp2
-rw-r--r--base/version.cpp4
-rw-r--r--common/EventDispatcher.cpp20
-rw-r--r--common/EventMapper.cpp54
-rw-r--r--common/array.h74
-rw-r--r--common/config-file.cpp6
-rw-r--r--common/config-manager.cpp6
-rw-r--r--common/events.h43
-rw-r--r--common/fft.cpp2
-rw-r--r--common/forbidden.h47
-rw-r--r--common/fs.cpp4
-rw-r--r--common/hash-str.h4
-rw-r--r--common/hashmap.h91
-rw-r--r--common/huffman.h2
-rw-r--r--common/list.h7
-rw-r--r--common/list_intern.h2
-rw-r--r--common/memorypool.cpp2
-rw-r--r--common/memorypool.h2
-rw-r--r--common/module.mk1
-rw-r--r--common/quicktime.h4
-rw-r--r--common/serializer.h2
-rw-r--r--common/singleton.h2
-rw-r--r--common/stack.h47
-rw-r--r--common/str.cpp12
-rw-r--r--common/system.h31
-rw-r--r--common/translation.cpp56
-rw-r--r--common/translation.h19
-rw-r--r--common/unzip.cpp8
-rw-r--r--common/util.cpp55
-rw-r--r--common/util.h87
-rw-r--r--common/xmlparser.cpp12
-rw-r--r--common/xmlparser.h10
-rw-r--r--common/zlib.cpp9
-rw-r--r--common/zlib.h33
-rwxr-xr-xconfigure156
-rw-r--r--devtools/create_kyradat/create_kyradat.cpp447
-rw-r--r--devtools/create_kyradat/create_kyradat.h151
-rw-r--r--devtools/create_kyradat/extract.cpp14
-rw-r--r--devtools/create_kyradat/games.cpp157
-rw-r--r--devtools/create_kyradat/module.mk3
-rw-r--r--devtools/create_kyradat/tables.cpp371
-rw-r--r--devtools/create_kyradat/util.cpp13
-rw-r--r--devtools/create_kyradat/util.h1
-rw-r--r--devtools/create_translations/cp_parser.cpp104
-rw-r--r--devtools/create_translations/cp_parser.h54
-rw-r--r--devtools/create_translations/create_translations.cpp105
-rw-r--r--devtools/create_translations/create_translations.h1
-rw-r--r--devtools/create_translations/module.mk1
-rwxr-xr-xdevtools/credits.pl3
-rw-r--r--devtools/scumm-md5.txt17
-rw-r--r--devtools/skycpt/AsciiCptCompile.cpp2
-rw-r--r--devtools/skycpt/TextFile.cpp4
-rw-r--r--devtools/skycpt/cptcompiler.cpp34
-rwxr-xr-xdevtools/update-version.pl6
-rw-r--r--dists/debian/copyright2
-rw-r--r--dists/engine-data/kyra.datbin468443 -> 469735 bytes
-rw-r--r--dists/gph/README-GPH (renamed from backends/platform/gph/devices/common/README-GPH)3
-rw-r--r--dists/gph/README-GPH.in61
-rw-r--r--dists/gph/caanoo/scummvm-gdb.gpe (renamed from backends/platform/gph/devices/caanoo/scummvm-gdb.gpe)0
-rw-r--r--dists/gph/caanoo/scummvm.gpe (renamed from backends/platform/gph/devices/caanoo/scummvm.gpe)0
-rw-r--r--dists/gph/gp2x/mmuhack/Makefile (renamed from backends/platform/gph/devices/gp2x/mmuhack/Makefile)0
-rw-r--r--dists/gph/gp2x/mmuhack/README (renamed from backends/platform/gph/devices/gp2x/mmuhack/README)0
-rw-r--r--dists/gph/gp2x/mmuhack/flush_uppermem_cache.h (renamed from backends/platform/gph/devices/gp2x/mmuhack/flush_uppermem_cache.h)0
-rw-r--r--dists/gph/gp2x/mmuhack/flush_uppermem_cache.s (renamed from backends/platform/gph/devices/gp2x/mmuhack/flush_uppermem_cache.s)0
-rw-r--r--dists/gph/gp2x/mmuhack/mmuhack.c (renamed from backends/platform/gph/devices/gp2x/mmuhack/mmuhack.c)0
-rw-r--r--dists/gph/gp2x/mmuhack/mmuhack.o (renamed from backends/platform/gph/devices/gp2x/mmuhack/mmuhack.o)bin1720 -> 1720 bytes
-rw-r--r--dists/gph/gp2x/scummvm.gpe (renamed from backends/platform/gph/devices/gp2x/scummvm.gpe)0
-rw-r--r--dists/gph/gp2xwiz/scummvm-gdb.gpe (renamed from backends/platform/gph/devices/gp2xwiz/scummvm-gdb.gpe)0
-rw-r--r--dists/gph/gp2xwiz/scummvm.gpe (renamed from backends/platform/gph/devices/gp2xwiz/scummvm.gpe)0
-rw-r--r--dists/gph/scummvm.ini (renamed from backends/platform/gph/devices/common/scummvm.ini)2
-rw-r--r--dists/gph/scummvm.ini.in5
-rw-r--r--dists/gph/scummvm.png (renamed from backends/platform/gph/devices/common/scummvm.png)bin2656 -> 2656 bytes
-rw-r--r--dists/gph/scummvmb.png (renamed from backends/platform/gph/devices/common/scummvmb.png)bin34274 -> 34274 bytes
-rw-r--r--dists/macosx/DS_Storebin12292 -> 12292 bytes
-rw-r--r--[-rwxr-xr-x]dists/openpandora/PXML.xml (renamed from backends/platform/openpandora/build/PXML.xml)8
-rw-r--r--dists/openpandora/PXML.xml.in55
-rw-r--r--dists/openpandora/PXML_schema.xsd (renamed from backends/platform/openpandora/build/PXML_schema.xsd)0
-rw-r--r--[-rwxr-xr-x]dists/openpandora/README-OPENPANDORA (renamed from backends/platform/openpandora/build/README-OPENPANDORA)2
-rw-r--r--dists/openpandora/README-OPENPANDORA.in19
-rw-r--r--[-rwxr-xr-x]dists/openpandora/README-PND.txt (renamed from backends/platform/openpandora/build/README-PND.txt)2
-rw-r--r--dists/openpandora/README-PND.txt.in38
-rw-r--r--[-rwxr-xr-x]dists/openpandora/icon/preview-pic.png (renamed from backends/platform/openpandora/build/icon/preview-pic.png)bin72496 -> 72496 bytes
-rw-r--r--[-rwxr-xr-x]dists/openpandora/icon/scummvm.png (renamed from backends/platform/openpandora/build/icon/scummvm.png)bin2656 -> 2656 bytes
-rw-r--r--[-rwxr-xr-x]dists/openpandora/index.html (renamed from backends/platform/openpandora/build/index.html)4
-rw-r--r--dists/openpandora/index.html.in26
-rwxr-xr-xdists/openpandora/pnd_make.sh (renamed from backends/platform/openpandora/build/pnd_make.sh)0
-rwxr-xr-xdists/openpandora/runscummvm.sh (renamed from backends/platform/openpandora/build/runscummvm.sh)0
-rw-r--r--dists/win32/ScummVM.iss17
-rw-r--r--dists/win32/migration.bat51
-rw-r--r--dists/win32/migration.txt27
-rw-r--r--doc/cz/PrectiMe87
-rw-r--r--doc/de/Liesmich86
-rw-r--r--doc/de/Neues75
-rw-r--r--engines/agi/agi.cpp14
-rw-r--r--engines/agi/agi.h2
-rw-r--r--engines/agi/checks.cpp16
-rw-r--r--engines/agi/menu.h4
-rw-r--r--engines/agi/picture.h2
-rw-r--r--engines/agi/preagi_mickey.h2
-rw-r--r--engines/agi/preagi_troll.cpp4
-rw-r--r--engines/agi/saveload.cpp4
-rw-r--r--engines/agi/sound_2gs.cpp6
-rw-r--r--engines/agi/sound_sarien.cpp4
-rw-r--r--engines/agi/sprite.cpp2
-rw-r--r--engines/agi/sprite.h2
-rw-r--r--engines/agi/wagparser.cpp4
-rw-r--r--engines/agi/words.cpp2
-rw-r--r--engines/agos/agos.h8
-rw-r--r--engines/agos/animation.cpp6
-rw-r--r--engines/agos/res.cpp44
-rw-r--r--engines/agos/res_snd.cpp4
-rw-r--r--engines/agos/saveload.cpp4
-rw-r--r--engines/agos/script_pn.cpp8
-rw-r--r--engines/agos/sound.cpp326
-rw-r--r--engines/agos/sound.h2
-rw-r--r--engines/agos/string.cpp2
-rw-r--r--engines/agos/string_pn.cpp2
-rw-r--r--engines/agos/subroutine.cpp4
-rw-r--r--engines/cge/detection.cpp2
-rw-r--r--engines/cge/text.cpp4
-rw-r--r--engines/cine/detection.cpp2
-rw-r--r--engines/cine/gfx.cpp2
-rw-r--r--engines/composer/detection.cpp142
-rw-r--r--engines/cruise/background.cpp2
-rw-r--r--engines/cruise/backgroundIncrust.cpp6
-rw-r--r--engines/cruise/cruise.h2
-rw-r--r--engines/cruise/cruise_main.cpp6
-rw-r--r--engines/cruise/dataLoader.cpp2
-rw-r--r--engines/cruise/font.cpp2
-rw-r--r--engines/cruise/function.cpp10
-rw-r--r--engines/cruise/mainDraw.cpp8
-rw-r--r--engines/cruise/saveload.cpp4
-rw-r--r--engines/cruise/script.cpp4
-rw-r--r--engines/dialogs.cpp19
-rw-r--r--engines/draci/barchive.cpp6
-rw-r--r--engines/draci/sprite.cpp2
-rw-r--r--engines/drascula/interface.cpp2
-rw-r--r--engines/dreamweb/dreamweb.cpp4
-rw-r--r--engines/dreamweb/dreamweb.h49
-rw-r--r--engines/dreamweb/keypad.cpp110
-rw-r--r--engines/dreamweb/monitor.cpp42
-rw-r--r--engines/dreamweb/newplace.cpp38
-rw-r--r--engines/dreamweb/people.cpp10
-rw-r--r--engines/dreamweb/print.cpp4
-rw-r--r--engines/dreamweb/saveload.cpp92
-rw-r--r--engines/dreamweb/structs.h18
-rw-r--r--engines/dreamweb/stubs.cpp222
-rw-r--r--engines/dreamweb/titles.cpp12
-rw-r--r--engines/dreamweb/use.cpp4
-rw-r--r--engines/dreamweb/vgagrafx.cpp4
-rw-r--r--engines/engine.cpp16
-rw-r--r--engines/gob/aniobject.cpp30
-rw-r--r--engines/gob/aniobject.h5
-rw-r--r--engines/gob/cheater.cpp34
-rw-r--r--engines/gob/cheater.h62
-rw-r--r--engines/gob/cheater_geisha.cpp66
-rw-r--r--engines/gob/console.cpp19
-rw-r--r--engines/gob/console.h8
-rw-r--r--engines/gob/gob.cpp4
-rw-r--r--engines/gob/gob.h3
-rw-r--r--engines/gob/hotspots.cpp2
-rw-r--r--engines/gob/inter.h4
-rw-r--r--engines/gob/inter_geisha.cpp11
-rw-r--r--engines/gob/inter_v1.cpp14
-rw-r--r--engines/gob/minigames/geisha/diving.cpp440
-rw-r--r--engines/gob/minigames/geisha/diving.h68
-rw-r--r--engines/gob/minigames/geisha/evilfish.cpp17
-rw-r--r--engines/gob/minigames/geisha/evilfish.h6
-rw-r--r--engines/gob/minigames/geisha/meter.cpp116
-rw-r--r--engines/gob/minigames/geisha/meter.h89
-rw-r--r--engines/gob/minigames/geisha/oko.cpp170
-rw-r--r--engines/gob/minigames/geisha/oko.h84
-rw-r--r--engines/gob/module.mk4
-rw-r--r--engines/gob/sound/bgatmosphere.h1
-rw-r--r--engines/groovie/script.cpp2
-rw-r--r--engines/hugo/object.h2
-rw-r--r--engines/hugo/parser.cpp2
-rw-r--r--engines/hugo/schedule.cpp2
-rw-r--r--engines/hugo/sound.cpp2
-rw-r--r--engines/hugo/util.cpp2
-rw-r--r--engines/kyra/animator_hof.cpp11
-rw-r--r--engines/kyra/animator_mr.cpp9
-rw-r--r--engines/kyra/chargen.cpp20
-rw-r--r--engines/kyra/darkmoon.cpp24
-rw-r--r--engines/kyra/darkmoon.h17
-rw-r--r--engines/kyra/debugger.cpp33
-rw-r--r--engines/kyra/debugger.h3
-rw-r--r--engines/kyra/detection_tables.h188
-rw-r--r--engines/kyra/eob.cpp38
-rw-r--r--engines/kyra/eob.h41
-rw-r--r--engines/kyra/eobcommon.cpp132
-rw-r--r--engines/kyra/eobcommon.h41
-rw-r--r--engines/kyra/gui.cpp2
-rw-r--r--engines/kyra/gui_eob.cpp143
-rw-r--r--engines/kyra/gui_eob.h5
-rw-r--r--engines/kyra/gui_lol.cpp12
-rw-r--r--engines/kyra/gui_rpg.cpp2
-rw-r--r--engines/kyra/items_eob.cpp16
-rw-r--r--engines/kyra/kyra_hof.cpp10
-rw-r--r--engines/kyra/kyra_hof.h6
-rw-r--r--engines/kyra/kyra_lok.cpp5
-rw-r--r--engines/kyra/kyra_mr.cpp4
-rw-r--r--engines/kyra/kyra_mr.h4
-rw-r--r--engines/kyra/kyra_rpg.cpp35
-rw-r--r--engines/kyra/kyra_rpg.h22
-rw-r--r--engines/kyra/kyra_v1.cpp14
-rw-r--r--engines/kyra/kyra_v1.h6
-rw-r--r--engines/kyra/kyra_v2.h8
-rw-r--r--engines/kyra/lol.cpp4
-rw-r--r--engines/kyra/lol.h10
-rw-r--r--engines/kyra/magic_eob.cpp2
-rw-r--r--engines/kyra/resource.h162
-rw-r--r--engines/kyra/saveload_eob.cpp358
-rw-r--r--engines/kyra/saveload_rpg.cpp2
-rw-r--r--engines/kyra/scene_eob.cpp233
-rw-r--r--engines/kyra/scene_lol.cpp6
-rw-r--r--engines/kyra/scene_rpg.cpp137
-rw-r--r--engines/kyra/screen.cpp262
-rw-r--r--engines/kyra/screen.h54
-rw-r--r--engines/kyra/screen_eob.cpp1084
-rw-r--r--engines/kyra/screen_eob.h43
-rw-r--r--engines/kyra/script.cpp2
-rw-r--r--engines/kyra/script.h4
-rw-r--r--engines/kyra/script_eob.cpp14
-rw-r--r--engines/kyra/script_eob.h5
-rw-r--r--engines/kyra/script_hof.cpp2
-rw-r--r--engines/kyra/script_lok.cpp19
-rw-r--r--engines/kyra/script_mr.cpp2
-rw-r--r--engines/kyra/script_tim.cpp2
-rw-r--r--engines/kyra/script_tim.h4
-rw-r--r--engines/kyra/sequences_darkmoon.cpp631
-rw-r--r--engines/kyra/sequences_eob.cpp908
-rw-r--r--engines/kyra/sequences_hof.cpp10
-rw-r--r--engines/kyra/sprites_eob.cpp12
-rw-r--r--engines/kyra/staticres.cpp20
-rw-r--r--engines/kyra/staticres_eob.cpp121
-rw-r--r--engines/kyra/staticres_rpg.cpp4
-rw-r--r--engines/kyra/text_rpg.cpp10
-rw-r--r--engines/kyra/timer_eob.cpp2
-rw-r--r--engines/lastexpress/entities/alexei.cpp2
-rw-r--r--engines/lastexpress/entities/entity_intern.h4
-rw-r--r--engines/lastexpress/game/entities.cpp6
-rw-r--r--engines/lure/hotspots.cpp6
-rw-r--r--engines/lure/sound.cpp2
-rw-r--r--engines/made/database.cpp24
-rw-r--r--engines/made/database.h4
-rw-r--r--engines/made/graphics.cpp4
-rw-r--r--engines/made/resource.h8
-rw-r--r--engines/made/screen.cpp8
-rw-r--r--engines/made/screenfx.cpp4
-rw-r--r--engines/made/scriptfuncs.h2
-rw-r--r--engines/metaengine.h3
-rw-r--r--engines/mohawk/detection_tables.h66
-rw-r--r--engines/mohawk/graphics.cpp4
-rw-r--r--engines/mohawk/graphics.h6
-rw-r--r--engines/mohawk/livingbooks.cpp3
-rw-r--r--engines/mohawk/livingbooks_code.cpp8
-rw-r--r--engines/mohawk/myst.h2
-rw-r--r--engines/mohawk/myst_areas.h2
-rw-r--r--engines/mohawk/myst_scripts.h2
-rw-r--r--engines/mohawk/riven_external.h2
-rw-r--r--engines/mohawk/riven_scripts.h2
-rw-r--r--engines/mohawk/video.cpp2
-rw-r--r--engines/parallaction/balloons.cpp4
-rw-r--r--engines/parallaction/callables_br.cpp14
-rw-r--r--engines/parallaction/callables_ns.cpp16
-rw-r--r--engines/parallaction/debug.cpp6
-rw-r--r--engines/parallaction/dialogue.cpp2
-rw-r--r--engines/parallaction/disk.cpp4
-rw-r--r--engines/parallaction/disk_br.cpp10
-rw-r--r--engines/parallaction/disk_ns.cpp16
-rw-r--r--engines/parallaction/exec.h6
-rw-r--r--engines/parallaction/font.cpp16
-rw-r--r--engines/parallaction/gfxbase.cpp8
-rw-r--r--engines/parallaction/graphics.cpp32
-rw-r--r--engines/parallaction/graphics.h8
-rw-r--r--engines/parallaction/gui.h2
-rw-r--r--engines/parallaction/gui_br.cpp4
-rw-r--r--engines/parallaction/inventory.cpp4
-rw-r--r--engines/parallaction/inventory.h2
-rw-r--r--engines/parallaction/objects.cpp4
-rw-r--r--engines/parallaction/parallaction.cpp2
-rw-r--r--engines/parallaction/parallaction.h74
-rw-r--r--engines/parallaction/parser.h10
-rw-r--r--engines/parallaction/parser_br.cpp16
-rw-r--r--engines/parallaction/parser_ns.cpp6
-rw-r--r--engines/parallaction/sound_br.cpp2
-rw-r--r--engines/parallaction/sound_ns.cpp2
-rw-r--r--engines/queen/logic.cpp8
-rw-r--r--engines/queen/music.cpp2
-rw-r--r--engines/queen/talk.cpp2
-rw-r--r--engines/saga/animation.cpp2
-rw-r--r--engines/saga/gfx.cpp2
-rw-r--r--engines/saga/interface.cpp4
-rw-r--r--engines/saga/isomap.cpp2
-rw-r--r--engines/saga/resource.h2
-rw-r--r--engines/saga/script.h4
-rw-r--r--engines/sci/console.cpp73
-rw-r--r--engines/sci/detection.cpp18
-rw-r--r--engines/sci/engine/features.cpp9
-rw-r--r--engines/sci/engine/kernel_tables.h6
-rw-r--r--engines/sci/engine/kfile.cpp2
-rw-r--r--engines/sci/engine/kgraphics.cpp112
-rw-r--r--engines/sci/engine/klists.cpp18
-rw-r--r--engines/sci/engine/kpathing.cpp1
-rw-r--r--engines/sci/engine/kscripts.cpp10
-rw-r--r--engines/sci/engine/kstring.cpp24
-rw-r--r--engines/sci/engine/message.cpp2
-rw-r--r--engines/sci/engine/savegame.cpp22
-rw-r--r--engines/sci/engine/script_patches.cpp62
-rw-r--r--engines/sci/engine/scriptdebug.cpp2
-rw-r--r--engines/sci/engine/seg_manager.cpp2
-rw-r--r--engines/sci/engine/segment.cpp7
-rw-r--r--engines/sci/engine/segment.h2
-rw-r--r--engines/sci/engine/vm.cpp3
-rw-r--r--engines/sci/engine/workarounds.cpp2
-rw-r--r--engines/sci/graphics/cursor.cpp27
-rw-r--r--engines/sci/graphics/frameout.cpp54
-rw-r--r--engines/sci/graphics/frameout.h1
-rw-r--r--engines/sci/graphics/screen.cpp8
-rw-r--r--engines/sci/graphics/text16.cpp2
-rw-r--r--engines/sci/graphics/text32.cpp9
-rw-r--r--engines/sci/graphics/text32.h2
-rw-r--r--engines/sci/graphics/transitions.cpp14
-rw-r--r--engines/sci/parser/said.cpp2
-rw-r--r--engines/sci/parser/vocabulary.cpp2
-rw-r--r--engines/sci/resource.cpp22
-rw-r--r--engines/sci/resource.h2
-rw-r--r--engines/sci/resource_audio.cpp27
-rw-r--r--engines/sci/sound/drivers/amigamac.cpp6
-rw-r--r--engines/scumm/actor.cpp431
-rw-r--r--engines/scumm/actor.h60
-rw-r--r--engines/scumm/boxes.cpp26
-rw-r--r--engines/scumm/boxes.h2
-rw-r--r--engines/scumm/charset-fontdata.cpp2
-rw-r--r--engines/scumm/costume.cpp243
-rw-r--r--engines/scumm/costume.h18
-rw-r--r--engines/scumm/cursor.cpp2
-rw-r--r--engines/scumm/debugger.cpp8
-rw-r--r--engines/scumm/detection.cpp25
-rw-r--r--engines/scumm/detection_tables.h23
-rw-r--r--engines/scumm/gfx.cpp99
-rw-r--r--engines/scumm/gfx.h12
-rw-r--r--engines/scumm/gfx_towns.cpp12
-rw-r--r--engines/scumm/he/sound_he.cpp2
-rw-r--r--engines/scumm/he/wiz_he.cpp10
-rw-r--r--engines/scumm/object.cpp177
-rw-r--r--engines/scumm/object.h20
-rw-r--r--engines/scumm/player_apple2.h3
-rw-r--r--engines/scumm/player_nes.cpp2
-rw-r--r--engines/scumm/player_pce.cpp22
-rw-r--r--engines/scumm/player_pce.h1
-rw-r--r--engines/scumm/player_sid.cpp6
-rw-r--r--engines/scumm/player_sid.h3
-rw-r--r--engines/scumm/player_v1.cpp4
-rw-r--r--engines/scumm/resource.cpp4
-rw-r--r--engines/scumm/room.cpp2
-rw-r--r--engines/scumm/saveload.cpp37
-rw-r--r--engines/scumm/saveload.h6
-rw-r--r--engines/scumm/script.cpp197
-rw-r--r--engines/scumm/script_v0.cpp540
-rw-r--r--engines/scumm/script_v2.cpp167
-rw-r--r--engines/scumm/script_v4.cpp4
-rw-r--r--engines/scumm/script_v5.cpp70
-rw-r--r--engines/scumm/script_v8.cpp2
-rw-r--r--engines/scumm/scumm-md5.h17
-rw-r--r--engines/scumm/scumm.cpp43
-rw-r--r--engines/scumm/scumm.h28
-rw-r--r--engines/scumm/scumm_v0.h93
-rw-r--r--engines/scumm/scumm_v2.h13
-rw-r--r--engines/scumm/scumm_v5.h2
-rw-r--r--engines/scumm/smush/smush_player.cpp4
-rw-r--r--engines/scumm/sound.cpp1
-rw-r--r--engines/scumm/string.cpp10
-rw-r--r--engines/scumm/vars.cpp4
-rw-r--r--engines/scumm/verbs.cpp806
-rw-r--r--engines/scumm/verbs.h28
-rw-r--r--engines/sky/autoroute.cpp2
-rw-r--r--engines/sky/compact.cpp34
-rw-r--r--engines/sky/control.cpp60
-rw-r--r--engines/sky/control.h4
-rw-r--r--engines/sky/detection.cpp4
-rw-r--r--engines/sky/disk.cpp4
-rw-r--r--engines/sky/intro.cpp26
-rw-r--r--engines/sky/logic.cpp22
-rw-r--r--engines/sky/mouse.cpp2
-rw-r--r--engines/sky/music/adlibchannel.cpp10
-rw-r--r--engines/sky/music/gmmusic.cpp2
-rw-r--r--engines/sky/music/mt32music.cpp2
-rw-r--r--engines/sky/music/musicbase.cpp4
-rw-r--r--engines/sky/text.cpp4
-rw-r--r--engines/sword1/animation.cpp178
-rw-r--r--engines/sword1/animation.h11
-rw-r--r--engines/sword2/music.cpp2
-rw-r--r--engines/sword2/sprite.cpp18
-rw-r--r--engines/sword25/gfx/screenshot.cpp2
-rw-r--r--engines/sword25/util/lua/lbaselib.cpp7
-rw-r--r--engines/sword25/util/lua/llex.cpp26
-rw-r--r--engines/sword25/util/lua/lobject.cpp8
-rw-r--r--engines/sword25/util/lua/lstrlib.cpp2
-rw-r--r--engines/sword25/util/lua/luaconf.h2
-rw-r--r--engines/sword25/util/pluto/pluto.cpp26
-rw-r--r--engines/tinsel/background.cpp38
-rw-r--r--engines/tinsel/bg.cpp98
-rw-r--r--engines/tinsel/cursor.cpp298
-rw-r--r--engines/tinsel/detection.cpp2
-rw-r--r--engines/tinsel/dialogs.cpp2249
-rw-r--r--engines/tinsel/drives.cpp38
-rw-r--r--engines/tinsel/events.cpp86
-rw-r--r--engines/tinsel/font.cpp32
-rw-r--r--engines/tinsel/graphics.cpp6
-rw-r--r--engines/tinsel/handle.cpp108
-rw-r--r--engines/tinsel/heapmem.cpp74
-rw-r--r--engines/tinsel/mareels.cpp34
-rw-r--r--engines/tinsel/move.cpp40
-rw-r--r--engines/tinsel/music.cpp72
-rw-r--r--engines/tinsel/palette.cpp132
-rw-r--r--engines/tinsel/pcode.cpp98
-rw-r--r--engines/tinsel/pdisplay.cpp54
-rw-r--r--engines/tinsel/play.cpp50
-rw-r--r--engines/tinsel/rince.cpp92
-rw-r--r--engines/tinsel/saveload.cpp178
-rw-r--r--engines/tinsel/savescn.cpp140
-rw-r--r--engines/tinsel/scene.cpp60
-rw-r--r--engines/tinsel/sched.cpp64
-rw-r--r--engines/tinsel/scroll.cpp292
-rw-r--r--engines/tinsel/scroll.h6
-rw-r--r--engines/tinsel/sound.cpp34
-rw-r--r--engines/tinsel/strres.cpp56
-rw-r--r--engines/tinsel/strres.h2
-rw-r--r--engines/tinsel/sysvar.cpp20
-rw-r--r--engines/tinsel/text.cpp8
-rw-r--r--engines/tinsel/timers.cpp50
-rw-r--r--engines/tinsel/tinlib.cpp108
-rw-r--r--engines/tinsel/tinsel.cpp172
-rw-r--r--engines/tinsel/token.cpp28
-rw-r--r--engines/toltecs/menu.cpp6
-rw-r--r--engines/toltecs/movie.cpp5
-rw-r--r--engines/toltecs/resource.h2
-rw-r--r--engines/toltecs/screen.cpp2
-rw-r--r--engines/toltecs/script.cpp284
-rw-r--r--engines/toltecs/script.h2
-rw-r--r--engines/toltecs/segmap.cpp4
-rw-r--r--engines/toon/audio.cpp2
-rw-r--r--engines/toon/character.cpp2
-rw-r--r--engines/toon/detection.cpp9
-rw-r--r--engines/toon/script_func.h2
-rw-r--r--engines/toon/toon.cpp4
-rw-r--r--engines/touche/saveload.cpp26
-rw-r--r--engines/touche/staticres.cpp5
-rw-r--r--engines/touche/touche.cpp8
-rw-r--r--engines/touche/touche.h3
-rw-r--r--engines/tsage/core.cpp24
-rw-r--r--engines/tsage/core.h6
-rw-r--r--engines/tsage/detection.cpp1
-rw-r--r--engines/tsage/detection_tables.h18
-rw-r--r--engines/tsage/events.h26
-rw-r--r--engines/tsage/globals.cpp113
-rw-r--r--engines/tsage/globals.h37
-rw-r--r--engines/tsage/graphics.cpp22
-rw-r--r--engines/tsage/resources.cpp62
-rw-r--r--engines/tsage/resources.h5
-rw-r--r--engines/tsage/ringworld2/ringworld2_logic.cpp744
-rw-r--r--engines/tsage/ringworld2/ringworld2_logic.h109
-rw-r--r--engines/tsage/ringworld2/ringworld2_scenes0.cpp2897
-rw-r--r--engines/tsage/ringworld2/ringworld2_scenes0.h353
-rw-r--r--engines/tsage/ringworld2/ringworld2_scenes1.cpp14410
-rw-r--r--engines/tsage/ringworld2/ringworld2_scenes1.h1180
-rw-r--r--engines/tsage/ringworld2/ringworld2_scenes2.cpp48
-rw-r--r--engines/tsage/ringworld2/ringworld2_scenes3.cpp1366
-rw-r--r--engines/tsage/ringworld2/ringworld2_scenes3.h121
-rw-r--r--engines/tsage/ringworld2/ringworld2_speakers.cpp303
-rw-r--r--engines/tsage/ringworld2/ringworld2_speakers.h70
-rw-r--r--engines/tsage/scenes.cpp2
-rw-r--r--engines/tsage/staticres.cpp211
-rw-r--r--engines/tsage/staticres.h19
-rw-r--r--engines/tsage/user_interface.cpp8
-rw-r--r--engines/tucker/saveload.cpp2
-rw-r--r--engines/tucker/tucker.h2
-rw-r--r--graphics/VectorRendererSpec.cpp658
-rw-r--r--graphics/VectorRendererSpec.h27
-rw-r--r--graphics/cursorman.cpp4
-rw-r--r--graphics/font.cpp44
-rw-r--r--graphics/font.h9
-rw-r--r--graphics/fonts/bdf.cpp2
-rw-r--r--graphics/fonts/ttf.cpp483
-rw-r--r--graphics/fonts/ttf.h (renamed from backends/platform/iphone/blit.cpp)48
-rw-r--r--graphics/iff.cpp4
-rw-r--r--graphics/imagedec.cpp2
-rw-r--r--graphics/jpeg.cpp176
-rw-r--r--graphics/jpeg.h5
-rw-r--r--graphics/module.mk1
-rw-r--r--graphics/pict.cpp4
-rw-r--r--graphics/scaler/thumbnail_intern.cpp10
-rw-r--r--gui/ThemeEngine.cpp88
-rw-r--r--gui/ThemeEngine.h16
-rw-r--r--gui/ThemeParser.cpp9
-rw-r--r--gui/ThemeParser.h2
-rw-r--r--gui/browser_osx.mm6
-rw-r--r--gui/credits.h6
-rw-r--r--gui/gui-manager.cpp65
-rw-r--r--gui/gui-manager.h1
-rw-r--r--gui/launcher.cpp6
-rw-r--r--gui/options.cpp35
-rw-r--r--gui/options.h2
-rw-r--r--gui/themes/default.inc1878
-rw-r--r--gui/themes/fonts/FreeMonoBold.ttfbin0 -> 173608 bytes
-rw-r--r--gui/themes/fonts/FreeSans.ttfbin0 -> 714456 bytes
-rw-r--r--gui/themes/fonts/FreeSansBold.ttfbin0 -> 359272 bytes
-rw-r--r--gui/themes/fonts/README2
-rw-r--r--gui/themes/scummclassic.zipbin86033 -> 86033 bytes
-rw-r--r--gui/themes/scummclassic/THEMERC2
-rw-r--r--gui/themes/scummmodern.zipbin193364 -> 1441316 bytes
-rw-r--r--gui/themes/scummmodern/FreeMonoBold.ttfbin0 -> 173608 bytes
-rw-r--r--gui/themes/scummmodern/FreeSans.ttfbin0 -> 714456 bytes
-rw-r--r--gui/themes/scummmodern/FreeSansBold.ttfbin0 -> 359272 bytes
-rw-r--r--gui/themes/scummmodern/THEMERC2
-rw-r--r--gui/themes/scummmodern/eraser.bmpbin890 -> 824 bytes
-rw-r--r--gui/themes/scummmodern/scummmodern_gfx.stx14
-rwxr-xr-xgui/themes/scummtheme.py2
-rw-r--r--gui/themes/translations.datbin285893 -> 289839 bytes
-rw-r--r--gui/widget.cpp20
-rw-r--r--gui/widgets/editable.cpp11
-rw-r--r--gui/widgets/edittext.cpp5
-rw-r--r--po/POTFILES1
-rw-r--r--po/ca_ES.po193
-rw-r--r--po/cs_CZ.po195
-rw-r--r--po/da_DA.po208
-rw-r--r--po/de_DE.po248
-rw-r--r--po/es_ES.po197
-rw-r--r--po/fr_FR.po234
-rw-r--r--po/hu_HU.po192
-rw-r--r--po/iso-8859-2.cp320
-rw-r--r--po/iso-8859-5.cp320
-rw-r--r--po/it_IT.po201
-rw-r--r--po/module.mk7
-rw-r--r--po/nb_NO.po206
-rw-r--r--po/nn_NO.po198
-rw-r--r--po/pl_PL.po201
-rw-r--r--po/pt_BR.po195
-rw-r--r--po/ru_RU.po245
-rw-r--r--po/scummvm.pot190
-rw-r--r--po/se_SE.po197
-rw-r--r--po/uk_UA.po235
-rw-r--r--ports.mk11
-rw-r--r--test/common/fixedstack.h14
-rw-r--r--test/common/pack.h2
-rw-r--r--test/common/stack.h12
-rw-r--r--test/cxxtest/cxxtest/ValueTraits.h4
-rw-r--r--video/bink_decoder.cpp64
-rw-r--r--video/bink_decoder.h15
-rw-r--r--video/dxa_decoder.cpp8
-rw-r--r--video/qt_decoder.cpp2
710 files changed, 50331 insertions, 20063 deletions
diff --git a/AUTHORS b/AUTHORS
index b28cd55fb4..86f5c3e023 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -144,6 +144,8 @@ ScummVM Team
SAGA:
Torbjorn Andersson
+ Daniel Balsom - Original engine reimplementation author
+ (retired)
Filippos Karapetis
Andrew Kurushin
Eugene Sandulenko
@@ -477,6 +479,7 @@ Other contributions
Daniel Schepler - Final MI1 CD music support, initial Ogg Vorbis
support
Andre Souza - SDL-based OpenGL renderer
+ Tom Frost - WebOS port contributions
FreeSCI Contributors
--------------------
@@ -535,6 +538,7 @@ Other contributions
Special thanks to
*****************
+ Daniel Balsom - For the original Reinherit (SAGA) code
Sander Buskens - For his work on the initial reversing of Monkey2
Canadacow - For the original MT-32 emulator
Kevin Carnes - For Scumm16, the basis of ScummVM's older gfx codecs
diff --git a/COPYING.FREEFONT b/COPYING.FREEFONT
new file mode 100644
index 0000000000..df44319b71
--- /dev/null
+++ b/COPYING.FREEFONT
@@ -0,0 +1,690 @@
+NOTE: This license file only applies to the GNU FreeFont files:
+"FreeSansBold.ttf", "FreeSans.ttf" and "FreeMonoBold.ttf" distributed along
+with our theme files.
+
+The following license applies with this exception:
+As a special exception, if you create a document which uses this font, and
+embed this font or unaltered portions of this font into the document, this
+font does not by itself cause the resulting document to be covered by the
+GNU General Public License. This exception does not however invalidate any
+other reasons why the document might be covered by the GNU General Public
+License. If you modify this font, you may extend this exception to your
+version of the font, but you are not obligated to do so. If you do not
+wish to do so, delete this exception statement from your version.
+
+
+
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ 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, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ <program> Copyright (C) <year> <name of author>
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
diff --git a/COPYRIGHT b/COPYRIGHT
index e0a7aa90fb..9de8ac6492 100644
--- a/COPYRIGHT
+++ b/COPYRIGHT
@@ -213,3 +213,4 @@ Xanathar "xanathar"
Grant Yeager "glo_kidd"
Benjamin W. Zale "junior_aepi"
Yotam Barnoy "bluddy"
+Tom Frost "TomFrost"
diff --git a/Makefile.common b/Makefile.common
index 1ec3f66246..744ac493e3 100644
--- a/Makefile.common
+++ b/Makefile.common
@@ -106,7 +106,7 @@ ifdef CXX_UPDATE_DEP_FLAG
%.o: %.m
$(QUIET)$(MKDIR) $(*D)/$(DEPDIR)
- $(QUIET_CXX)$(CXX) $(CXX_UPDATE_DEP_FLAG) $(OBJCFLAGS) -c $(<) -o $*.o
+ $(QUIET_CXX)$(CXX) $(CXX_UPDATE_DEP_FLAG) $(CPPFLAGS) $(OBJCFLAGS) -c $(<) -o $*.o
# Build rule for assembler files with preprocessing
%.o: %.S
@@ -229,7 +229,7 @@ dist-src: \
@#DEB-src?
# Common files
-DIST_FILES_DOCS:=$(addprefix $(srcdir)/,AUTHORS COPYING COPYING.BSD COPYING.LGPL COPYRIGHT NEWS README)
+DIST_FILES_DOCS:=$(addprefix $(srcdir)/,AUTHORS COPYING COPYING.BSD COPYING.LGPL COPYING.FREEFONT COPYRIGHT NEWS README)
# Themes files
DIST_FILES_THEMES=scummmodern.zip scummclassic.zip
diff --git a/NEWS b/NEWS
index 7c5504baca..8ce67091ad 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,13 @@ For a more comprehensive changelog of the latest experimental code, see:
New Games:
- Added support for Soltys.
+ General:
+ - Updated MT-32 emulation code to latest munt project snapshot. The emulation
+ improved dramatically.
+ - Implemented support for TrueType fonts via FreeType2 in our GUI. Along
+ with it GNU FreeFont was also added to our modern theme. Note that not all
+ ports take advantage of this.
+
SDL ports:
- Added support for OpenGL (GSoC Task).
@@ -16,12 +23,30 @@ For a more comprehensive changelog of the latest experimental code, see:
SCUMM:
- Added support for the Macintosh version of SPY Fox in Hold the Mustard.
+ - Added a difficulty selection dialog for Loom FM-TOWNS.
+
+ iPhone port:
+ - Changed "F5 (menu)" gesture to open up the global main menu instead.
+ - Added support for custom cursor palettes, this makes the moderm theme use
+ the red pointer cursor for example.
+
+ Windows port:
+ - Changed default savegames location for Windows NT4/2000/XP/Vista/7.
+ (The migration batch file can be used to copy savegames from the old
+ default location, to the new default location).
-1.4.1 (????-??-??)
+1.4.1 (2012-01-27)
AGOS:
- Fixed loading videos directly from InstallShield cabinets in the Windows
version of the The Feeble Files.
+ BASS:
+ - Added support for Enhanced Music by James Woodcock
+ (http://www.jameswoodcock.co.uk/?p=7695).
+
+ Broken Sword 2:
+ - Slight graphics improvement for PSX version.
+
KYRA:
- Fixed bug in the original Lands of Lore GUI which made ScummVM error out
in the case the user did not have a contiguous save slot usage.
@@ -34,6 +59,8 @@ For a more comprehensive changelog of the latest experimental code, see:
- The option to toggle sound effect types between digitized and synthesized
has been disabled until a more user-friendly GUI option is possible.
Digital sound effects are always preferred for now.
+ - Fixed a case where starting a new song didn't fully reset its channels,
+ thus some notes sounded wrong.
1.4.0 (2011-11-11)
New Games:
@@ -137,7 +164,7 @@ For a more comprehensive changelog of the latest experimental code, see:
New Ports:
- Added WebOS port.
- General
+ General:
- Added support for loadable modules on platforms without a dynamic
loader (GSoC Task).
- Added Danish translation.
diff --git a/README b/README
index cb9da386df..928864ebea 100644
--- a/README
+++ b/README
@@ -1,5 +1,4 @@
ScummVM README
-Last updated: $Date$
------------------------------------------------------------------------
For more information, compatibility lists, details on donating, the latest
@@ -674,7 +673,12 @@ Rename voices.wav on CD4 to voices4.wav
3.14) The Legend of Kyrandia notes:
----- -----------------------------
To run The Legend of Kyrandia under ScummVM you need the 'kyra.dat'
-file, which can be found on the 'Downloads' page of the ScummVM website.
+file. The file should always be included in official ScummVM packages.
+In case ScummVM complains that the file is missing you can find it on the
+'Downloads' page of the ScummVM website. Note that the current Windows
+release of ScummVM should contain the file embedded into the executable,
+thus you only need to grab it in case ScummVM complains about the file
+being missing.
3.15) Sierra AGI games Predictive Input Dialog notes:
@@ -802,10 +806,6 @@ site, please see the section on reporting bugs.
FM-TOWNS versions:
- The Kanji versions require the FM-TOWNS Font ROM
- - ScummVM will crash randomly when using the FM-TOWNS Font ROM for
- the Kanji versions of the following games:
- The Secret of Monkey Island, Monkey Island 2: LeChuck's Revenge
- and Indiana Jones and the Fate of Atlantis
Loom:
- Turning off the subtitles via the config file does not work reliably
@@ -857,7 +857,6 @@ site, please see the section on reporting bugs.
The Legend of Kyrandia:
- No music or sound effects in the Macintosh floppy versions.
- Macintosh CD is using included DOS music and sound effects.
- - PC-9821 version lacks support for sound effects.
Humongous Entertainment games:
- Only the original load and save interface can be used.
@@ -1148,19 +1147,28 @@ Engines which currently support returning to the Launcher are:
AGI
AGOS
CINE
+ COMPOSER
+ CRUISE
DRACI
+ DRASCULA
GOB
GROOVIE
+ HUGO
KYRA
LURE
+ MADE
+ MOHAWK
PARALLACTION
QUEEN
SAGA
+ SCI
SCUMM
SKY
SWORD1
SWORD2
+ TEENAGENT
TOUCHE
+ TSAGE
TUCKER
@@ -1340,9 +1348,28 @@ config file by setting the savepath parameter. See the example config
file later in this README.
The platforms that currently have a different default directory are:
- Mac OS X: $HOME/Documents/ScummVM Savegames/
- Other unices: $HOME/.scummvm/
+ Mac OS X:
+ $HOME/Documents/ScummVM Savegames/
+
+ Other unices:
+ $HOME/.scummvm/
+
+ Windows Vista/7:
+ \Users\username\AppData\Roaming\ScummVM\Saved games\
+
+ Windows 2000/XP:
+ \Documents and Settings\username\Application Data\ScummVM\Saved games\
+
+ Windows NT4:
+ <windir>\Profiles\username\Application Data\ScummVM\Saved games\
+
+Savegames are stored under a hidden area in Windows NT4/2000/XP/Vista/7,
+which can be accessed by running "%APPDATA%\ScummVM\Saved Games\" or by
+enabling hidden files in Windows Explorer.
+Note for Windows NT4/2000/XP/Vista/7 users: The default savegames location
+changed in ScummVM 1.5.0. The migration batch file can be used to copy
+savegames from the old default location, to the new default location.
6.1) Autosaves:
---- ----------
@@ -1400,20 +1427,28 @@ Where 'xxx' is exact the saved game slot (ie 001) under ScummVM
AGI
AGOS
+ CGE
CINE
+ CRUISE
DRACI
GROOVIE
+ HUGO
KYRA
LURE
+ MOHAWK
PARALLACTION
QUEEN
SAGA
+ SCI
SCUMM
SKY
SWORD1
SWORD2
+ TEENAGENT
TINSEL
+ TOON
TOUCHE
+ TSAGE
TUCKER
--save-slot/-x:
@@ -1425,20 +1460,28 @@ Where 'xxx' is exact the saved game slot (ie 001) under ScummVM
Engines which currently support --save-slot/-x are:
AGI
+ CGE
CINE
+ CRUISE
DRACI
GROOVIE
+ HUGO
KYRA
LURE
- PARALLACTION
+ MOHAWK
QUEEN
SAGA
+ SCI
SCUMM
SKY
SWORD1
SWORD2
+ TEENAGENT
TINSEL
+ TOON
TOUCHE
+ TSAGE
+ TUCKER
7.0) Music and Sound:
@@ -2039,6 +2082,10 @@ The Legend of Kyrandia adds the following non-standard keyword:
walkspeed int The walk speed (0-4)
+The 7th Guest adds the following non-standard keyword:
+
+ t7g_speed string Video playback speed (normal, tweaked, im_an_ios)
+
9.0) Compiling:
---- ----------
@@ -2087,16 +2134,6 @@ debug messages (see http://www.sysinternals.com/ntw2k/freeware/debugview.shtml).
* Please refer to:
http://wiki.scummvm.org/index.php/Compiling_ScummVM/Windows_CE
- Debian GNU/Linux:
- * Install the packages 'build-essential', 'fakeroot', 'debhelper',
- and 'libsdl1.2-dev' on your system.
- * Install any of these packages (optional): 'libvorbis-dev' (for Ogg
- Vorbis support), 'libasound2-dev' (for ALSA sequencer support),
- 'libmad0-dev' (for MAD MP3 support), 'zlib1g-dev' (for compressed
- saves support).
- * Run 'make deb'.
- * Finally run 'dpkg -i ../scummvm-cvs*deb', and you're done.
-
Mac OS X:
* Make sure you have the developer tools installed.
* The SDL developer package for OS X available on the SDL web site is
diff --git a/audio/decoders/flac.cpp b/audio/decoders/flac.cpp
index d06a7b9c0e..bbaf5fd5ae 100644
--- a/audio/decoders/flac.cpp
+++ b/audio/decoders/flac.cpp
@@ -209,7 +209,7 @@ FLACStream::FLACStream(Common::SeekableReadStream *inStream, bool dispose)
::FLAC__seekable_stream_decoder_set_write_callback(_decoder, &FLACStream::callWrapWrite);
::FLAC__seekable_stream_decoder_set_metadata_callback(_decoder, &FLACStream::callWrapMetadata);
::FLAC__seekable_stream_decoder_set_error_callback(_decoder, &FLACStream::callWrapError);
- ::FLAC__seekable_stream_decoder_set_client_data(_decoder, (void*)this);
+ ::FLAC__seekable_stream_decoder_set_client_data(_decoder, (void *)this);
success = (::FLAC__seekable_stream_decoder_init(_decoder) == FLAC__SEEKABLE_STREAM_DECODER_OK);
#else
@@ -223,7 +223,7 @@ FLACStream::FLACStream(Common::SeekableReadStream *inStream, bool dispose)
&FLACStream::callWrapWrite,
&FLACStream::callWrapMetadata,
&FLACStream::callWrapError,
- (void*)this
+ (void *)this
) == FLAC__STREAM_DECODER_INIT_STATUS_OK);
#endif
if (success) {
diff --git a/audio/decoders/iff_sound.cpp b/audio/decoders/iff_sound.cpp
index 4efdce0338..b0c41f0180 100644
--- a/audio/decoders/iff_sound.cpp
+++ b/audio/decoders/iff_sound.cpp
@@ -75,7 +75,7 @@ struct A8SVXLoader {
case ID_BODY:
_dataSize = chunk._size;
- _data = (int8*)malloc(_dataSize);
+ _data = (int8 *)malloc(_dataSize);
assert(_data);
loadData(chunk._stream);
return true;
diff --git a/audio/decoders/qdm2.cpp b/audio/decoders/qdm2.cpp
index 113b88fbf6..735fb2b6a0 100644
--- a/audio/decoders/qdm2.cpp
+++ b/audio/decoders/qdm2.cpp
@@ -589,7 +589,7 @@ DECL_FFT(32768,16384,8192)
DECL_FFT(65536,32768,16384)
void fftCalc(FFTContext *s, FFTComplex *z) {
- static void (* const fftDispatch[])(FFTComplex*) = {
+ static void (* const fftDispatch[])(FFTComplex *) = {
fft4, fft8, fft16, fft32, fft64, fft128, fft256, fft512, fft1024,
fft2048, fft4096, fft8192, fft16384, fft32768, fft65536,
};
@@ -857,8 +857,8 @@ void rdftCalc(RDFTContext *s, float *data) {
if (s->inverse) {
data[0] *= k1;
data[1] *= k1;
- fftPermute(&s->fft, (FFTComplex*)data);
- fftCalc(&s->fft, (FFTComplex*)data);
+ fftPermute(&s->fft, (FFTComplex *)data);
+ fftCalc(&s->fft, (FFTComplex *)data);
}
}
diff --git a/audio/decoders/voc.cpp b/audio/decoders/voc.cpp
index 2cd5b23d09..f0b5b2777d 100644
--- a/audio/decoders/voc.cpp
+++ b/audio/decoders/voc.cpp
@@ -321,14 +321,21 @@ void VocStream::preProcess() {
// In case we hit a "Terminator" block we also break here.
if (_stream->eos() || block.code == 0)
break;
+ // We also allow 128 as terminator, since Simon 1 Amiga CD32 uses it.
+ if (block.code == 128) {
+ debug(3, "VocStream::preProcess: Caught 128 as terminator");
+ break;
+ }
block.length = _stream->readByte();
block.length |= _stream->readByte() << 8;
block.length |= _stream->readByte() << 16;
// Premature end of stream => error!
- if (_stream->eos() || _stream->err())
+ if (_stream->eos() || _stream->err()) {
+ warning("VocStream::preProcess: Reading failed");
return;
+ }
uint32 skip = 0;
@@ -338,17 +345,26 @@ void VocStream::preProcess() {
// Sound data (New format)
case 9:
if (block.code == 1) {
+ if (block.length < 2) {
+ warning("Invalid sound data block length %d in VOC file", block.length);
+ return;
+ }
+
// Read header data
int freqDiv = _stream->readByte();
// Prevent division through 0
- if (freqDiv == 256)
+ if (freqDiv == 256) {
+ warning("Invalid frequency divisor 256 in VOC file");
return;
+ }
block.sampleBlock.rate = getSampleRateFromVOCRate(freqDiv);
int codec = _stream->readByte();
// We only support 8bit PCM
- if (codec != 0)
+ if (codec != 0) {
+ warning("Unhandled codec %d in VOC file", codec);
return;
+ }
block.sampleBlock.samples = skip = block.length - 2;
block.sampleBlock.offset = _stream->pos();
@@ -366,11 +382,18 @@ void VocStream::preProcess() {
}
}
} else {
+ if (block.length < 12) {
+ warning("Invalid sound data (wew format) block length %d in VOC file", block.length);
+ return;
+ }
+
block.sampleBlock.rate = _stream->readUint32LE();
int bitsPerSample = _stream->readByte();
// We only support 8bit PCM
- if (bitsPerSample != 8)
+ if (bitsPerSample != 8) {
+ warning("Unhandled bits per sample %d in VOC file", bitsPerSample);
return;
+ }
int channels = _stream->readByte();
// We only support mono
if (channels != 1) {
@@ -395,23 +418,29 @@ void VocStream::preProcess() {
// Silence
case 3: {
- if (block.length != 3)
+ if (block.length != 3) {
+ warning("Invalid silence block length %d in VOC file", block.length);
return;
+ }
block.sampleBlock.offset = 0;
block.sampleBlock.samples = _stream->readUint16LE() + 1;
int freqDiv = _stream->readByte();
// Prevent division through 0
- if (freqDiv == 256)
+ if (freqDiv == 256) {
+ warning("Invalid frequency divisor 256 in VOC file");
return;
+ }
block.sampleBlock.rate = getSampleRateFromVOCRate(freqDiv);
} break;
// Repeat start
case 6:
- if (block.length != 2)
+ if (block.length != 2) {
+ warning("Invalid repeat start block length %d in VOC file", block.length);
return;
+ }
block.loopBlock.count = _stream->readUint16LE() + 1;
break;
@@ -427,8 +456,10 @@ void VocStream::preProcess() {
int freqDiv = _stream->readUint16LE();
// Prevent division through 0
- if (freqDiv == 65536)
+ if (freqDiv == 65536) {
+ warning("Invalid frequency divisor 65536 in VOC file");
return;
+ }
int codec = _stream->readByte();
// We only support RAW 8bit PCM.
@@ -455,8 +486,10 @@ void VocStream::preProcess() {
}
// Premature end of stream => error!
- if (_stream->eos() || _stream->err())
+ if (_stream->eos() || _stream->err()) {
+ warning("VocStream::preProcess: Reading failed");
return;
+ }
// Skip the rest of the block
if (skip)
diff --git a/audio/decoders/wave.cpp b/audio/decoders/wave.cpp
index 3cf4566d0c..44188f84ca 100644
--- a/audio/decoders/wave.cpp
+++ b/audio/decoders/wave.cpp
@@ -175,6 +175,13 @@ RewindableAudioStream *makeWAVStream(Common::SeekableReadStream *stream, Dispose
else if (type == 2) // MS ADPCM
return makeADPCMStream(stream, disposeAfterUse, size, Audio::kADPCMMS, rate, (flags & Audio::FLAG_STEREO) ? 2 : 1, blockAlign);
+ // Raw PCM, make sure the last packet is complete
+ uint sampleSize = (flags & Audio::FLAG_16BITS ? 2 : 1) * (flags & Audio::FLAG_STEREO ? 2 : 1);
+ if (size % sampleSize != 0) {
+ warning("makeWAVStream: Trying to play a WAVE file with an incomplete PCM packet");
+ size &= ~(sampleSize - 1);
+ }
+
// Raw PCM. Just read everything at once.
// TODO: More elegant would be to wrap the stream.
byte *data = (byte *)malloc(size);
diff --git a/audio/mididrv.cpp b/audio/mididrv.cpp
index 829bc3cd55..6817791c6b 100644
--- a/audio/mididrv.cpp
+++ b/audio/mididrv.cpp
@@ -59,17 +59,17 @@ static const struct {
uint32 type;
const char *guio;
} GUIOMapping[] = {
- { MT_PCSPK, GUIO_MIDIPCSPK, },
- { MT_CMS, GUIO_MIDICMS, },
- { MT_PCJR, GUIO_MIDIPCJR, },
- { MT_ADLIB, GUIO_MIDIADLIB, },
- { MT_C64, GUIO_MIDIC64, },
- { MT_AMIGA, GUIO_MIDIAMIGA, },
- { MT_APPLEIIGS, GUIO_MIDIAPPLEIIGS, },
- { MT_TOWNS, GUIO_MIDITOWNS, },
- { MT_PC98, GUIO_MIDIPC98, },
- { MT_GM, GUIO_MIDIGM, },
- { MT_MT32, GUIO_MIDIMT32, },
+ { MT_PCSPK, GUIO_MIDIPCSPK },
+ { MT_CMS, GUIO_MIDICMS },
+ { MT_PCJR, GUIO_MIDIPCJR },
+ { MT_ADLIB, GUIO_MIDIADLIB },
+ { MT_C64, GUIO_MIDIC64 },
+ { MT_AMIGA, GUIO_MIDIAMIGA },
+ { MT_APPLEIIGS, GUIO_MIDIAPPLEIIGS },
+ { MT_TOWNS, GUIO_MIDITOWNS },
+ { MT_PC98, GUIO_MIDIPC98 },
+ { MT_GM, GUIO_MIDIGM },
+ { MT_MT32, GUIO_MIDIMT32 },
{ 0, 0 },
};
diff --git a/audio/mods/tfmx.cpp b/audio/mods/tfmx.cpp
index 8d584809c8..2957529afc 100644
--- a/audio/mods/tfmx.cpp
+++ b/audio/mods/tfmx.cpp
@@ -876,7 +876,7 @@ const int8 *Tfmx::loadSampleFile(uint32 &sampleLen, Common::SeekableReadStream &
const int32 sampleSize = sampleStream.size();
if (sampleSize < 4) {
warning("Tfmx: Cant load Samplefile");
- return false;
+ return 0;
}
int8 *sampleAlloc = new int8[sampleSize];
diff --git a/audio/softsynth/cms.cpp b/audio/softsynth/cms.cpp
index a675da3f03..681f08dfa3 100644
--- a/audio/softsynth/cms.cpp
+++ b/audio/softsynth/cms.cpp
@@ -41,7 +41,7 @@ static const byte envelope[8][64] = {
{15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,
15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,
15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,
- 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, },
+ 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15 },
/* single decay */
{15,14,13,12,11,10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
diff --git a/audio/softsynth/mt32.cpp b/audio/softsynth/mt32.cpp
index eabde21296..186118262f 100644
--- a/audio/softsynth/mt32.cpp
+++ b/audio/softsynth/mt32.cpp
@@ -84,42 +84,6 @@ public:
int getRate() const { return _outputRate; }
};
-class MT32File : public MT32Emu::File {
- Common::File _in;
- Common::DumpFile _out;
-public:
- bool open(const char *filename, OpenMode mode) {
- if (mode == OpenMode_read)
- return _in.open(filename);
- else
- return _out.open(filename);
- }
- void close() {
- _in.close();
- _out.close();
- }
- size_t read(void *in, size_t size) {
- return _in.read(in, size);
- }
- bool readBit8u(MT32Emu::Bit8u *in) {
- byte b = _in.readByte();
- if (_in.eos())
- return false;
- *in = b;
- return true;
- }
- size_t write(const void *in, size_t size) {
- return _out.write(in, size);
- }
- bool writeBit8u(MT32Emu::Bit8u out) {
- _out.writeByte(out);
- return !_out.err();
- }
- bool isEOF() {
- return _in.isOpen() && _in.eos();
- }
-};
-
static int eatSystemEvents() {
Common::Event event;
Common::EventManager *eventMan = g_system->getEventManager();
@@ -206,9 +170,9 @@ static void drawMessage(int offset, const Common::String &text) {
g_system->updateScreen();
}
-static MT32Emu::File *MT32_OpenFile(void *userData, const char *filename, MT32Emu::File::OpenMode mode) {
- MT32File *file = new MT32File();
- if (!file->open(filename, mode)) {
+static Common::File *MT32_OpenFile(void *userData, const char *filename) {
+ Common::File *file = new Common::File();
+ if (!file->open(filename)) {
delete file;
return NULL;
}
@@ -329,6 +293,11 @@ int MidiDriver_MT32::open() {
drawMessage(-1, _s("Initializing MT-32 Emulator"));
if (!_synth->open(prop))
return MERR_DEVICE_NOT_AVAILABLE;
+
+ double gain = (double)ConfMan.getInt("midi_gain") / 100.0;
+ _synth->setOutputGain(1.0f * gain);
+ _synth->setReverbOutputGain(0.68f * gain);
+
_initializing = false;
if (screenFormat.bytesPerPixel > 1)
diff --git a/audio/softsynth/mt32/AReverbModel.cpp b/audio/softsynth/mt32/AReverbModel.cpp
new file mode 100644
index 0000000000..4ee6c87943
--- /dev/null
+++ b/audio/softsynth/mt32/AReverbModel.cpp
@@ -0,0 +1,237 @@
+/* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher
+ * Copyright (C) 2011 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "mt32emu.h"
+#include "AReverbModel.h"
+
+using namespace MT32Emu;
+
+// Default reverb settings for modes 0-2
+
+static const unsigned int NUM_ALLPASSES = 6;
+static const unsigned int NUM_DELAYS = 5;
+
+static const Bit32u MODE_0_ALLPASSES[] = {729, 78, 394, 994, 1250, 1889};
+static const Bit32u MODE_0_DELAYS[] = {846, 4, 1819, 778, 346};
+static const float MODE_0_TIMES[] = {0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.9f};
+static const float MODE_0_LEVELS[] = {0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 1.01575f};
+
+static const Bit32u MODE_1_ALLPASSES[] = {176, 809, 1324, 1258};
+static const Bit32u MODE_1_DELAYS[] = {2262, 124, 974, 2516, 356};
+static const float MODE_1_TIMES[] = {0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.95f};
+static const float MODE_1_LEVELS[] = {0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 1.01575f};
+
+static const Bit32u MODE_2_ALLPASSES[] = {78, 729, 994, 389};
+static const Bit32u MODE_2_DELAYS[] = {846, 4, 1819, 778, 346};
+static const float MODE_2_TIMES[] = {0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f};
+static const float MODE_2_LEVELS[] = {0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f};
+
+const AReverbSettings AReverbModel::REVERB_MODE_0_SETTINGS = {MODE_0_ALLPASSES, MODE_0_DELAYS, MODE_0_TIMES, MODE_0_LEVELS, 0.687770909f, 0.5f, 0.5f};
+const AReverbSettings AReverbModel::REVERB_MODE_1_SETTINGS = {MODE_1_ALLPASSES, MODE_1_DELAYS, MODE_1_TIMES, MODE_1_LEVELS, 0.712025098f, 0.375f, 0.625f};
+const AReverbSettings AReverbModel::REVERB_MODE_2_SETTINGS = {MODE_2_ALLPASSES, MODE_2_DELAYS, MODE_2_TIMES, MODE_2_LEVELS, 0.939522749f, 0.0f, 0.0f};
+
+RingBuffer::RingBuffer(Bit32u newsize) {
+ index = 0;
+ size = newsize;
+ buffer = new float[size];
+}
+
+RingBuffer::~RingBuffer() {
+ delete[] buffer;
+ buffer = NULL;
+ size = 0;
+}
+
+float RingBuffer::next() {
+ index++;
+ if (index >= size) {
+ index = 0;
+ }
+ return buffer[index];
+}
+
+bool RingBuffer::isEmpty() {
+ if (buffer == NULL) return true;
+
+ float *buf = buffer;
+ float total = 0;
+ for (Bit32u i = 0; i < size; i++) {
+ total += (*buf < 0 ? -*buf : *buf);
+ buf++;
+ }
+ return ((total / size) < .0002 ? true : false);
+}
+
+void RingBuffer::mute() {
+ float *buf = buffer;
+ for (Bit32u i = 0; i < size; i++) {
+ *buf++ = 0;
+ }
+}
+
+AllpassFilter::AllpassFilter(Bit32u useSize) : RingBuffer(useSize) {
+}
+
+Delay::Delay(Bit32u useSize) : RingBuffer(useSize) {
+}
+
+float AllpassFilter::process(float in) {
+ // This model corresponds to the allpass filter implementation in the real CM-32L device
+ // found from sample analysis
+
+ float out;
+
+ out = next();
+
+ // store input - feedback / 2
+ buffer[index] = in - 0.5f * out;
+
+ // return buffer output + feedforward / 2
+ return out + 0.5f * buffer[index];
+}
+
+float Delay::process(float in) {
+ // Implements a very simple delay
+
+ float out;
+
+ out = next();
+
+ // store input
+ buffer[index] = in;
+
+ // return buffer output
+ return out;
+}
+
+AReverbModel::AReverbModel(const AReverbSettings *useSettings) : allpasses(NULL), delays(NULL), currentSettings(useSettings) {
+}
+
+AReverbModel::~AReverbModel() {
+ close();
+}
+
+void AReverbModel::open(unsigned int /*sampleRate*/) {
+ // FIXME: filter sizes must be multiplied by sample rate to 32000Hz ratio
+ // IIR filter values depend on sample rate as well
+ allpasses = new AllpassFilter*[NUM_ALLPASSES];
+ for (Bit32u i = 0; i < NUM_ALLPASSES; i++) {
+ allpasses[i] = new AllpassFilter(currentSettings->allpassSizes[i]);
+ }
+ delays = new Delay*[NUM_DELAYS];
+ for (Bit32u i = 0; i < NUM_DELAYS; i++) {
+ delays[i] = new Delay(currentSettings->delaySizes[i]);
+ }
+ mute();
+}
+
+void AReverbModel::close() {
+ if (allpasses != NULL) {
+ for (Bit32u i = 0; i < NUM_ALLPASSES; i++) {
+ if (allpasses[i] != NULL) {
+ delete allpasses[i];
+ allpasses[i] = NULL;
+ }
+ }
+ delete[] allpasses;
+ allpasses = NULL;
+ }
+ if (delays != NULL) {
+ for (Bit32u i = 0; i < NUM_DELAYS; i++) {
+ if (delays[i] != NULL) {
+ delete delays[i];
+ delays[i] = NULL;
+ }
+ }
+ delete[] delays;
+ delays = NULL;
+ }
+}
+
+void AReverbModel::mute() {
+ for (Bit32u i = 0; i < NUM_ALLPASSES; i++) {
+ allpasses[i]->mute();
+ }
+ for (Bit32u i = 0; i < NUM_DELAYS; i++) {
+ delays[i]->mute();
+ }
+ filterhist1 = 0;
+ filterhist2 = 0;
+ combhist = 0;
+}
+
+void AReverbModel::setParameters(Bit8u time, Bit8u level) {
+// FIXME: wetLevel definitely needs ramping when changed
+// Although, most games don't set reverb level during MIDI playback
+ decayTime = currentSettings->decayTimes[time];
+ wetLevel = currentSettings->wetLevels[level];
+}
+
+bool AReverbModel::isActive() const {
+ bool bActive = false;
+ for (Bit32u i = 0; i < NUM_ALLPASSES; i++) {
+ bActive |= !allpasses[i]->isEmpty();
+ }
+ for (Bit32u i = 0; i < NUM_DELAYS; i++) {
+ bActive |= !delays[i]->isEmpty();
+ }
+ return bActive;
+}
+
+void AReverbModel::process(const float *inLeft, const float *inRight, float *outLeft, float *outRight, unsigned long numSamples) {
+// Three series allpass filters followed by a delay, fourth allpass filter and another delay
+ float dry, link, outL1, outL2, outR1, outR2;
+
+ for (unsigned long i = 0; i < numSamples; i++) {
+ dry = *inLeft + *inRight;
+
+ // Implementation of 2-stage IIR single-pole low-pass filter
+ // found at the entrance of reverb processing on real devices
+ filterhist1 += (dry - filterhist1) * currentSettings->filtVal;
+ filterhist2 += (filterhist1 - filterhist2) * currentSettings->filtVal;
+
+ link = allpasses[0]->process(-filterhist2);
+ link = allpasses[1]->process(link);
+
+ // this implements a comb filter cross-linked with the fourth allpass filter
+ link += combhist * decayTime;
+ link = allpasses[2]->process(link);
+ link = delays[0]->process(link);
+ outL1 = link;
+ link = allpasses[3]->process(link);
+ link = delays[1]->process(link);
+ outR1 = link;
+ link = allpasses[4]->process(link);
+ link = delays[2]->process(link);
+ outL2 = link;
+ link = allpasses[5]->process(link);
+ link = delays[3]->process(link);
+ outR2 = link;
+ link = delays[4]->process(link);
+
+ // comb filter end point
+ combhist = combhist * currentSettings->damp1 + link * currentSettings->damp2;
+
+ *outLeft = (outL1 + outL2) * wetLevel;
+ *outRight = (outR1 + outR2) * wetLevel;
+
+ inLeft++;
+ inRight++;
+ outLeft++;
+ outRight++;
+ }
+}
diff --git a/audio/softsynth/mt32/AReverbModel.h b/audio/softsynth/mt32/AReverbModel.h
new file mode 100644
index 0000000000..3fae08c34c
--- /dev/null
+++ b/audio/softsynth/mt32/AReverbModel.h
@@ -0,0 +1,86 @@
+/* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher
+ * Copyright (C) 2011 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef MT32EMU_A_REVERB_MODEL_H
+#define MT32EMU_A_REVERB_MODEL_H
+
+namespace MT32Emu {
+
+struct AReverbSettings {
+ const Bit32u *allpassSizes;
+ const Bit32u *delaySizes;
+ const float *decayTimes;
+ const float *wetLevels;
+ float filtVal;
+ float damp1;
+ float damp2;
+};
+
+class RingBuffer {
+protected:
+ float *buffer;
+ Bit32u size;
+ Bit32u index;
+public:
+ RingBuffer(Bit32u size);
+ virtual ~RingBuffer();
+ float next();
+ bool isEmpty();
+ void mute();
+};
+
+class AllpassFilter : public RingBuffer {
+public:
+ AllpassFilter(Bit32u size);
+ float process(float in);
+};
+
+class Delay : public RingBuffer {
+public:
+ Delay(Bit32u size);
+ float process(float in);
+};
+
+class AReverbModel : public ReverbModel {
+ AllpassFilter **allpasses;
+ Delay **delays;
+
+ const AReverbSettings *currentSettings;
+ float decayTime;
+ float wetLevel;
+ float filterhist1, filterhist2;
+ float combhist;
+ void mute();
+public:
+ AReverbModel(const AReverbSettings *newSettings);
+ ~AReverbModel();
+ void open(unsigned int sampleRate);
+ void close();
+ void setParameters(Bit8u time, Bit8u level);
+ void process(const float *inLeft, const float *inRight, float *outLeft, float *outRight, unsigned long numSamples);
+ bool isActive() const;
+
+ static const AReverbSettings REVERB_MODE_0_SETTINGS;
+ static const AReverbSettings REVERB_MODE_1_SETTINGS;
+ static const AReverbSettings REVERB_MODE_2_SETTINGS;
+};
+
+// Default reverb settings for modes 0-2
+
+}
+
+#endif
diff --git a/audio/softsynth/mt32/DelayReverb.cpp b/audio/softsynth/mt32/DelayReverb.cpp
new file mode 100644
index 0000000000..89eebf0d79
--- /dev/null
+++ b/audio/softsynth/mt32/DelayReverb.cpp
@@ -0,0 +1,150 @@
+/* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher
+ * Copyright (C) 2011 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+//#include <cmath>
+//#include <cstring>
+#include "mt32emu.h"
+#include "DelayReverb.h"
+
+using namespace MT32Emu;
+
+
+// CONFIRMED: The values below are found via analysis of digital samples. Checked with all time and level combinations.
+// Obviously:
+// rightDelay = (leftDelay - 2) * 2 + 2
+// echoDelay = rightDelay - 1
+// Leaving these separate in case it's useful for work on other reverb modes...
+const Bit32u REVERB_TIMINGS[8][3]= {
+ // {leftDelay, rightDelay, feedbackDelay}
+ {402, 802, 801},
+ {626, 1250, 1249},
+ {962, 1922, 1921},
+ {1490, 2978, 2977},
+ {2258, 4514, 4513},
+ {3474, 6946, 6945},
+ {5282, 10562, 10561},
+ {8002, 16002, 16001}
+};
+
+const float REVERB_FADE[8] = {0.0f, -0.049400051f, -0.08220577f, -0.131861118f, -0.197344907f, -0.262956344f, -0.345162114f, -0.509508615f};
+const float REVERB_FEEDBACK67 = -0.629960524947437f; // = -EXP2F(-2 / 3)
+const float REVERB_FEEDBACK = -0.682034520443118f; // = -EXP2F(-53 / 96)
+const float LPF_VALUE = 0.594603558f; // = EXP2F(-0.75f)
+
+DelayReverb::DelayReverb() {
+ buf = NULL;
+ sampleRate = 0;
+ setParameters(0, 0);
+}
+
+DelayReverb::~DelayReverb() {
+ delete[] buf;
+}
+
+void DelayReverb::open(unsigned int newSampleRate) {
+ if (newSampleRate != sampleRate || buf == NULL) {
+ sampleRate = newSampleRate;
+
+ delete[] buf;
+
+ // If we ever need a speedup, set bufSize to EXP2F(ceil(log2(bufSize))) and use & instead of % to find buf indexes
+ bufSize = 16384 * sampleRate / 32000;
+ buf = new float[bufSize];
+
+ recalcParameters();
+
+ // mute buffer
+ bufIx = 0;
+ if (buf != NULL) {
+ for (unsigned int i = 0; i < bufSize; i++) {
+ buf[i] = 0.0f;
+ }
+ }
+ }
+ // FIXME: IIR filter value depends on sample rate as well
+}
+
+void DelayReverb::close() {
+ delete[] buf;
+ buf = NULL;
+}
+
+// This method will always trigger a flush of the buffer
+void DelayReverb::setParameters(Bit8u newTime, Bit8u newLevel) {
+ time = newTime;
+ level = newLevel;
+ recalcParameters();
+}
+
+void DelayReverb::recalcParameters() {
+ // Number of samples between impulse and eventual appearance on the left channel
+ delayLeft = REVERB_TIMINGS[time][0] * sampleRate / 32000;
+ // Number of samples between impulse and eventual appearance on the right channel
+ delayRight = REVERB_TIMINGS[time][1] * sampleRate / 32000;
+ // Number of samples between a response and that response feeding back/echoing
+ delayFeedback = REVERB_TIMINGS[time][2] * sampleRate / 32000;
+
+ if (time < 6) {
+ feedback = REVERB_FEEDBACK;
+ } else {
+ feedback = REVERB_FEEDBACK67;
+ }
+
+ // Fading speed, i.e. amplitude ratio of neighbor responses
+ fade = REVERB_FADE[level];
+}
+
+void DelayReverb::process(const float *inLeft, const float *inRight, float *outLeft, float *outRight, unsigned long numSamples) {
+ if (buf == NULL) {
+ return;
+ }
+
+ for (unsigned int sampleIx = 0; sampleIx < numSamples; sampleIx++) {
+ // The ring buffer write index moves backwards; reads are all done with positive offsets.
+ Bit32u bufIxPrev = (bufIx + 1) % bufSize;
+ Bit32u bufIxLeft = (bufIx + delayLeft) % bufSize;
+ Bit32u bufIxRight = (bufIx + delayRight) % bufSize;
+ Bit32u bufIxFeedback = (bufIx + delayFeedback) % bufSize;
+
+ // Attenuated input samples and feedback response are directly added to the current ring buffer location
+ float sample = fade * (inLeft[sampleIx] + inRight[sampleIx]) + feedback * buf[bufIxFeedback];
+
+ // Single-pole IIR filter found on real devices
+ buf[bufIx] = buf[bufIxPrev] + (sample - buf[bufIxPrev]) * LPF_VALUE;
+
+ outLeft[sampleIx] = buf[bufIxLeft];
+ outRight[sampleIx] = buf[bufIxRight];
+
+ bufIx = (bufSize + bufIx - 1) % bufSize;
+ }
+}
+
+bool DelayReverb::isActive() const {
+ // Quick hack: Return true iff all samples in the left buffer are the same and
+ // all samples in the right buffers are the same (within the sample output threshold).
+ if (buf == NULL) {
+ return false;
+ }
+ float last = buf[0] * 8192.0f;
+ for (unsigned int i = 1; i < bufSize; i++) {
+ float s = (buf[i] * 8192.0f);
+ if (fabs(s - last) > 1.0f) {
+ return true;
+ }
+ }
+ return false;
+}
diff --git a/audio/softsynth/mt32/DelayReverb.h b/audio/softsynth/mt32/DelayReverb.h
new file mode 100644
index 0000000000..7c030fb839
--- /dev/null
+++ b/audio/softsynth/mt32/DelayReverb.h
@@ -0,0 +1,53 @@
+/* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher
+ * Copyright (C) 2011 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef MT32EMU_DELAYREVERB_H
+#define MT32EMU_DELAYREVERB_H
+
+namespace MT32Emu {
+
+class DelayReverb : public ReverbModel {
+private:
+ Bit8u time;
+ Bit8u level;
+
+ unsigned int sampleRate;
+ Bit32u bufSize;
+ Bit32u bufIx;
+
+ float *buf;
+
+ Bit32u delayLeft;
+ Bit32u delayRight;
+ Bit32u delayFeedback;
+
+ float fade;
+ float feedback;
+
+ void recalcParameters();
+
+public:
+ DelayReverb();
+ ~DelayReverb();
+ void open(unsigned int sampleRate);
+ void close();
+ void setParameters(Bit8u time, Bit8u level);
+ void process(const float *inLeft, const float *inRight, float *outLeft, float *outRight, unsigned long numSamples);
+ bool isActive() const;
+};
+}
+#endif
diff --git a/audio/softsynth/mt32/FreeverbModel.cpp b/audio/softsynth/mt32/FreeverbModel.cpp
new file mode 100644
index 0000000000..c11fa859d8
--- /dev/null
+++ b/audio/softsynth/mt32/FreeverbModel.cpp
@@ -0,0 +1,78 @@
+/* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher
+ * Copyright (C) 2011 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "mt32emu.h"
+#include "FreeverbModel.h"
+
+#include "freeverb.h"
+
+using namespace MT32Emu;
+
+FreeverbModel::FreeverbModel(float useScaleTuning, float useFiltVal, float useWet, Bit8u useRoom, float useDamp) {
+ freeverb = NULL;
+ scaleTuning = useScaleTuning;
+ filtVal = useFiltVal;
+ wet = useWet;
+ room = useRoom;
+ damp = useDamp;
+}
+
+FreeverbModel::~FreeverbModel() {
+ delete freeverb;
+}
+
+void FreeverbModel::open(unsigned int /*sampleRate*/) {
+ // FIXME: scaleTuning must be multiplied by sample rate to 32000Hz ratio
+ // IIR filter values depend on sample rate as well
+ if (freeverb == NULL) {
+ freeverb = new revmodel(scaleTuning);
+ }
+ freeverb->mute();
+
+ // entrance Lowpass filter factor
+ freeverb->setfiltval(filtVal);
+
+ // decay speed of high frequencies in the wet signal
+ freeverb->setdamp(damp);
+}
+
+void FreeverbModel::close() {
+ delete freeverb;
+ freeverb = NULL;
+}
+
+void FreeverbModel::process(const float *inLeft, const float *inRight, float *outLeft, float *outRight, unsigned long numSamples) {
+ freeverb->process(inLeft, inRight, outLeft, outRight, numSamples);
+}
+
+void FreeverbModel::setParameters(Bit8u time, Bit8u level) {
+ // wet signal level
+ // FIXME: need to implement some sort of reverb level ramping
+ freeverb->setwet((float)level / 7.0f * wet);
+
+ // wet signal decay speed
+ static float roomTable[] = {
+ 0.25f, 0.37f, 0.54f, 0.71f, 0.78f, 0.86f, 0.93f, 1.00f,
+ -1.00f, -0.50f, 0.00f, 0.30f, 0.51f, 0.64f, 0.77f, 0.90f,
+ 0.50f, 0.57f, 0.70f, 0.77f, 0.85f, 0.93f, 0.96f, 1.01f};
+ freeverb->setroomsize(roomTable[8 * room + time]);
+}
+
+bool FreeverbModel::isActive() const {
+ // FIXME: Not bothering to do this properly since we'll be replacing Freeverb soon...
+ return false;
+}
diff --git a/audio/softsynth/mt32/FreeverbModel.h b/audio/softsynth/mt32/FreeverbModel.h
new file mode 100644
index 0000000000..925b2dbf96
--- /dev/null
+++ b/audio/softsynth/mt32/FreeverbModel.h
@@ -0,0 +1,44 @@
+/* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher
+ * Copyright (C) 2011 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef MT32EMU_FREEVERB_MODEL_H
+#define MT32EMU_FREEVERB_MODEL_H
+
+class revmodel;
+
+namespace MT32Emu {
+
+class FreeverbModel : public ReverbModel {
+ revmodel *freeverb;
+ float scaleTuning;
+ float filtVal;
+ float wet;
+ Bit8u room;
+ float damp;
+public:
+ FreeverbModel(float useScaleTuning, float useFiltVal, float useWet, Bit8u useRoom, float useDamp);
+ ~FreeverbModel();
+ void open(unsigned int sampleRate);
+ void close();
+ void setParameters(Bit8u time, Bit8u level);
+ void process(const float *inLeft, const float *inRight, float *outLeft, float *outRight, unsigned long numSamples);
+ bool isActive() const;
+};
+
+}
+
+#endif
diff --git a/audio/softsynth/mt32/LA32Ramp.cpp b/audio/softsynth/mt32/LA32Ramp.cpp
new file mode 100644
index 0000000000..9f1f01c3c2
--- /dev/null
+++ b/audio/softsynth/mt32/LA32Ramp.cpp
@@ -0,0 +1,150 @@
+/* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher
+ * Copyright (C) 2011 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+Some notes on this class:
+
+This emulates the LA-32's implementation of "ramps". A ramp in this context is a smooth transition from one value to another, handled entirely within the LA-32.
+The LA-32 provides this feature for amplitude and filter cutoff values.
+
+The 8095 starts ramps on the LA-32 by setting two values in memory-mapped registers:
+
+(1) The target value (between 0 and 255) for the ramp to end on. This is represented by the "target" argument to startRamp().
+(2) The speed at which that value should be approached. This is represented by the "increment" argument to startRamp().
+
+Once the ramp target value has been hit, the LA-32 raises an interrupt.
+
+Note that the starting point of the ramp is whatever internal value the LA-32 had when the registers were set. This is usually the end point of a previously completed ramp.
+
+Our handling of the "target" and "increment" values is based on sample analysis and a little guesswork.
+Here's what we're pretty confident about:
+ - The most significant bit of "increment" indicates the direction that the LA32's current internal value ("current" in our emulation) should change in.
+ Set means downward, clear means upward.
+ - The lower 7 bits of "increment" indicate how quickly "current" should be changed.
+ - If "increment" is 0, no change to "current" is made and no interrupt is raised. [SEMI-CONFIRMED by sample analysis]
+ - Otherwise, if the MSb is set:
+ - If "current" already corresponds to a value <= "target", "current" is set immediately to the equivalent of "target" and an interrupt is raised.
+ - Otherwise, "current" is gradually reduced (at a rate determined by the lower 7 bits of "increment"), and once it reaches the equivalent of "target" an interrupt is raised.
+ - Otherwise (the MSb is unset):
+ - If "current" already corresponds to a value >= "target", "current" is set immediately to the equivalent of "target" and an interrupt is raised.
+ - Otherwise, "current" is gradually increased (at a rate determined by the lower 7 bits of "increment"), and once it reaches the equivalent of "target" an interrupt is raised.
+
+We haven't fully explored:
+ - Values when ramping between levels (though this is probably correct).
+ - Transition timing (may not be 100% accurate, especially for very fast ramps).
+*/
+//#include <cmath>
+
+#include "mt32emu.h"
+#include "LA32Ramp.h"
+#include "mmath.h"
+
+namespace MT32Emu {
+
+// SEMI-CONFIRMED from sample analysis.
+const int TARGET_MULT = 0x40000;
+const unsigned int MAX_CURRENT = 0xFF * TARGET_MULT;
+
+// We simulate the delay in handling "target was reached" interrupts by waiting
+// this many samples before setting interruptRaised.
+// FIXME: This should vary with the sample rate, but doesn't.
+// SEMI-CONFIRMED: Since this involves asynchronous activity between the LA32
+// and the 8095, a good value is hard to pin down.
+// This one matches observed behaviour on a few digital captures I had handy,
+// and should be double-checked. We may also need a more sophisticated delay
+// scheme eventually.
+const int INTERRUPT_TIME = 7;
+
+LA32Ramp::LA32Ramp() :
+ current(0),
+ largeTarget(0),
+ largeIncrement(0),
+ interruptCountdown(0),
+ interruptRaised(false) {
+}
+
+void LA32Ramp::startRamp(Bit8u target, Bit8u increment) {
+ // CONFIRMED: From sample analysis, this appears to be very accurate.
+ // FIXME: We could use a table for this in future
+ if (increment == 0) {
+ largeIncrement = 0;
+ } else {
+ largeIncrement = (unsigned int)(EXP2F(((increment & 0x7F) + 24) / 8.0f) + 0.125f);
+ }
+ descending = (increment & 0x80) != 0;
+ if (descending) {
+ // CONFIRMED: From sample analysis, descending increments are slightly faster
+ largeIncrement++;
+ }
+
+ largeTarget = target * TARGET_MULT;
+ interruptCountdown = 0;
+ interruptRaised = false;
+}
+
+Bit32u LA32Ramp::nextValue() {
+ if (interruptCountdown > 0) {
+ if (--interruptCountdown == 0) {
+ interruptRaised = true;
+ }
+ } else if (largeIncrement != 0) {
+ // CONFIRMED from sample analysis: When increment is 0, the LA32 does *not* change the current value at all (and of course doesn't fire an interrupt).
+ if (descending) {
+ // Lowering current value
+ if (largeIncrement > current) {
+ current = largeTarget;
+ interruptCountdown = INTERRUPT_TIME;
+ } else {
+ current -= largeIncrement;
+ if (current <= largeTarget) {
+ current = largeTarget;
+ interruptCountdown = INTERRUPT_TIME;
+ }
+ }
+ } else {
+ // Raising current value
+ if (MAX_CURRENT - current < largeIncrement) {
+ current = largeTarget;
+ interruptCountdown = INTERRUPT_TIME;
+ } else {
+ current += largeIncrement;
+ if (current >= largeTarget) {
+ current = largeTarget;
+ interruptCountdown = INTERRUPT_TIME;
+ }
+ }
+ }
+ }
+ return current;
+}
+
+bool LA32Ramp::checkInterrupt() {
+ bool wasRaised = interruptRaised;
+ interruptRaised = false;
+ return wasRaised;
+}
+
+void LA32Ramp::reset() {
+ current = 0;
+ largeTarget = 0;
+ largeIncrement = 0;
+ descending = false;
+ interruptCountdown = 0;
+ interruptRaised = false;
+}
+
+}
diff --git a/audio/softsynth/mt32/LA32Ramp.h b/audio/softsynth/mt32/LA32Ramp.h
new file mode 100644
index 0000000000..ae937eb7e1
--- /dev/null
+++ b/audio/softsynth/mt32/LA32Ramp.h
@@ -0,0 +1,43 @@
+/* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher
+ * Copyright (C) 2011 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef MT32EMU_LA32RAMP_H
+#define MT32EMU_LA32RAMP_H
+
+namespace MT32Emu {
+
+class LA32Ramp {
+private:
+ Bit32u current;
+ unsigned int largeTarget;
+ unsigned int largeIncrement;
+ bool descending;
+
+ int interruptCountdown;
+ bool interruptRaised;
+
+public:
+ LA32Ramp();
+ void startRamp(Bit8u target, Bit8u increment);
+ Bit32u nextValue();
+ bool checkInterrupt();
+ void reset();
+};
+
+}
+
+#endif /* TVA_H_ */
diff --git a/audio/softsynth/mt32/Part.cpp b/audio/softsynth/mt32/Part.cpp
new file mode 100644
index 0000000000..c9bd86b54a
--- /dev/null
+++ b/audio/softsynth/mt32/Part.cpp
@@ -0,0 +1,622 @@
+/* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher
+ * Copyright (C) 2011 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+//#include <cstdio>
+//#include <cstring>
+
+#include "mt32emu.h"
+#include "PartialManager.h"
+
+namespace MT32Emu {
+
+static const Bit8u PartialStruct[13] = {
+ 0, 0, 2, 2, 1, 3,
+ 3, 0, 3, 0, 2, 1, 3
+};
+
+static const Bit8u PartialMixStruct[13] = {
+ 0, 1, 0, 1, 1, 0,
+ 1, 3, 3, 2, 2, 2, 2
+};
+
+static const float floatKeyfollow[17] = {
+ -1.0f, -1.0f / 2.0f, -1.0f / 4.0f, 0.0f,
+ 1.0f / 8.0f, 1.0f / 4.0f, 3.0f / 8.0f, 1.0f / 2.0f, 5.0f / 8.0f, 3.0f / 4.0f, 7.0f / 8.0f, 1.0f,
+ 5.0f / 4.0f, 3.0f / 2.0f, 2.0f,
+ 1.0009765625f, 1.0048828125f
+};
+
+
+RhythmPart::RhythmPart(Synth *useSynth, unsigned int usePartNum): Part(useSynth, usePartNum) {
+ strcpy(name, "Rhythm");
+ rhythmTemp = &synth->mt32ram.rhythmTemp[0];
+ refresh();
+}
+
+Part::Part(Synth *useSynth, unsigned int usePartNum) {
+ synth = useSynth;
+ partNum = usePartNum;
+ patchCache[0].dirty = true;
+ holdpedal = false;
+ patchTemp = &synth->mt32ram.patchTemp[partNum];
+ if (usePartNum == 8) {
+ // Nasty hack for rhythm
+ timbreTemp = NULL;
+ } else {
+ sprintf(name, "Part %d", partNum + 1);
+ timbreTemp = &synth->mt32ram.timbreTemp[partNum];
+ }
+ currentInstr[0] = 0;
+ currentInstr[10] = 0;
+ modulation = 0;
+ expression = 100;
+ pitchBend = 0;
+ activePartialCount = 0;
+ memset(patchCache, 0, sizeof(patchCache));
+ for (int i = 0; i < MT32EMU_MAX_POLY; i++) {
+ freePolys.push_front(new Poly(this));
+ }
+}
+
+Part::~Part() {
+ while (!activePolys.empty()) {
+ delete activePolys.front();
+ activePolys.pop_front();
+ }
+ while (!freePolys.empty()) {
+ delete freePolys.front();
+ freePolys.pop_front();
+ }
+}
+
+void Part::setDataEntryMSB(unsigned char midiDataEntryMSB) {
+ if (nrpn) {
+ // The last RPN-related control change was for an NRPN,
+ // which the real synths don't support.
+ return;
+ }
+ if (rpn != 0) {
+ // The RPN has been set to something other than 0,
+ // which is the only RPN that these synths support
+ return;
+ }
+ patchTemp->patch.benderRange = midiDataEntryMSB > 24 ? 24 : midiDataEntryMSB;
+ updatePitchBenderRange();
+}
+
+void Part::setNRPN() {
+ nrpn = true;
+}
+
+void Part::setRPNLSB(unsigned char midiRPNLSB) {
+ nrpn = false;
+ rpn = (rpn & 0xFF00) | midiRPNLSB;
+}
+
+void Part::setRPNMSB(unsigned char midiRPNMSB) {
+ nrpn = false;
+ rpn = (rpn & 0x00FF) | (midiRPNMSB << 8);
+}
+
+void Part::setHoldPedal(bool pressed) {
+ if (holdpedal && !pressed) {
+ holdpedal = false;
+ stopPedalHold();
+ } else {
+ holdpedal = pressed;
+ }
+}
+
+Bit32s Part::getPitchBend() const {
+ return pitchBend;
+}
+
+void Part::setBend(unsigned int midiBend) {
+ // CONFIRMED:
+ pitchBend = (((signed)midiBend - 8192) * pitchBenderRange) >> 14; // PORTABILITY NOTE: Assumes arithmetic shift
+}
+
+Bit8u Part::getModulation() const {
+ return modulation;
+}
+
+void Part::setModulation(unsigned int midiModulation) {
+ modulation = (Bit8u)midiModulation;
+}
+
+void Part::resetAllControllers() {
+ modulation = 0;
+ expression = 100;
+ pitchBend = 0;
+ setHoldPedal(false);
+}
+
+void Part::reset() {
+ resetAllControllers();
+ allSoundOff();
+ rpn = 0xFFFF;
+}
+
+void RhythmPart::refresh() {
+ // (Re-)cache all the mapped timbres ahead of time
+ for (unsigned int drumNum = 0; drumNum < synth->controlROMMap->rhythmSettingsCount; drumNum++) {
+ int drumTimbreNum = rhythmTemp[drumNum].timbre;
+ if (drumTimbreNum >= 127) { // 94 on MT-32
+ continue;
+ }
+ PatchCache *cache = drumCache[drumNum];
+ backupCacheToPartials(cache);
+ for (int t = 0; t < 4; t++) {
+ // Common parameters, stored redundantly
+ cache[t].dirty = true;
+ cache[t].reverb = rhythmTemp[drumNum].reverbSwitch > 0;
+ }
+ }
+ updatePitchBenderRange();
+}
+
+void Part::refresh() {
+ backupCacheToPartials(patchCache);
+ for (int t = 0; t < 4; t++) {
+ // Common parameters, stored redundantly
+ patchCache[t].dirty = true;
+ patchCache[t].reverb = patchTemp->patch.reverbSwitch > 0;
+ }
+ memcpy(currentInstr, timbreTemp->common.name, 10);
+ updatePitchBenderRange();
+}
+
+const char *Part::getCurrentInstr() const {
+ return &currentInstr[0];
+}
+
+void RhythmPart::refreshTimbre(unsigned int absTimbreNum) {
+ for (int m = 0; m < 85; m++) {
+ if (rhythmTemp[m].timbre == absTimbreNum - 128) {
+ drumCache[m][0].dirty = true;
+ }
+ }
+}
+
+void Part::refreshTimbre(unsigned int absTimbreNum) {
+ if (getAbsTimbreNum() == absTimbreNum) {
+ memcpy(currentInstr, timbreTemp->common.name, 10);
+ patchCache[0].dirty = true;
+ }
+}
+
+void Part::setPatch(const PatchParam *patch) {
+ patchTemp->patch = *patch;
+}
+
+void RhythmPart::setTimbre(TimbreParam * /*timbre*/) {
+ synth->printDebug("%s: Attempted to call setTimbre() - doesn't make sense for rhythm", name);
+}
+
+void Part::setTimbre(TimbreParam *timbre) {
+ *timbreTemp = *timbre;
+}
+
+unsigned int RhythmPart::getAbsTimbreNum() const {
+ synth->printDebug("%s: Attempted to call getAbsTimbreNum() - doesn't make sense for rhythm", name);
+ return 0;
+}
+
+unsigned int Part::getAbsTimbreNum() const {
+ return (patchTemp->patch.timbreGroup * 64) + patchTemp->patch.timbreNum;
+}
+
+#if MT32EMU_MONITOR_MIDI > 0
+void RhythmPart::setProgram(unsigned int patchNum) {
+ synth->printDebug("%s: Attempt to set program (%d) on rhythm is invalid", name, patchNum);
+}
+#else
+void RhythmPart::setProgram(unsigned int) { }
+#endif
+
+void Part::setProgram(unsigned int patchNum) {
+ setPatch(&synth->mt32ram.patches[patchNum]);
+ holdpedal = false;
+ allSoundOff();
+ setTimbre(&synth->mt32ram.timbres[getAbsTimbreNum()].timbre);
+ refresh();
+}
+
+void Part::updatePitchBenderRange() {
+ pitchBenderRange = patchTemp->patch.benderRange * 683;
+}
+
+void Part::backupCacheToPartials(PatchCache cache[4]) {
+ // check if any partials are still playing with the old patch cache
+ // if so then duplicate the cached data from the part to the partial so that
+ // we can change the part's cache without affecting the partial.
+ // We delay this until now to avoid a copy operation with every note played
+ for (Common::List<Poly *>::iterator polyIt = activePolys.begin(); polyIt != activePolys.end(); polyIt++) {
+ (*polyIt)->backupCacheToPartials(cache);
+ }
+}
+
+void Part::cacheTimbre(PatchCache cache[4], const TimbreParam *timbre) {
+ backupCacheToPartials(cache);
+ int partialCount = 0;
+ for (int t = 0; t < 4; t++) {
+ if (((timbre->common.partialMute >> t) & 0x1) == 1) {
+ cache[t].playPartial = true;
+ partialCount++;
+ } else {
+ cache[t].playPartial = false;
+ continue;
+ }
+
+ // Calculate and cache common parameters
+ cache[t].srcPartial = timbre->partial[t];
+
+ cache[t].pcm = timbre->partial[t].wg.pcmWave;
+
+ switch (t) {
+ case 0:
+ cache[t].PCMPartial = (PartialStruct[(int)timbre->common.partialStructure12] & 0x2) ? true : false;
+ cache[t].structureMix = PartialMixStruct[(int)timbre->common.partialStructure12];
+ cache[t].structurePosition = 0;
+ cache[t].structurePair = 1;
+ break;
+ case 1:
+ cache[t].PCMPartial = (PartialStruct[(int)timbre->common.partialStructure12] & 0x1) ? true : false;
+ cache[t].structureMix = PartialMixStruct[(int)timbre->common.partialStructure12];
+ cache[t].structurePosition = 1;
+ cache[t].structurePair = 0;
+ break;
+ case 2:
+ cache[t].PCMPartial = (PartialStruct[(int)timbre->common.partialStructure34] & 0x2) ? true : false;
+ cache[t].structureMix = PartialMixStruct[(int)timbre->common.partialStructure34];
+ cache[t].structurePosition = 0;
+ cache[t].structurePair = 3;
+ break;
+ case 3:
+ cache[t].PCMPartial = (PartialStruct[(int)timbre->common.partialStructure34] & 0x1) ? true : false;
+ cache[t].structureMix = PartialMixStruct[(int)timbre->common.partialStructure34];
+ cache[t].structurePosition = 1;
+ cache[t].structurePair = 2;
+ break;
+ default:
+ break;
+ }
+
+ cache[t].partialParam = &timbre->partial[t];
+
+ cache[t].waveform = timbre->partial[t].wg.waveform;
+ }
+ for (int t = 0; t < 4; t++) {
+ // Common parameters, stored redundantly
+ cache[t].dirty = false;
+ cache[t].partialCount = partialCount;
+ cache[t].sustain = (timbre->common.noSustain == 0);
+ }
+ //synth->printDebug("Res 1: %d 2: %d 3: %d 4: %d", cache[0].waveform, cache[1].waveform, cache[2].waveform, cache[3].waveform);
+
+#if MT32EMU_MONITOR_INSTRUMENTS > 0
+ synth->printDebug("%s (%s): Recached timbre", name, currentInstr);
+ for (int i = 0; i < 4; i++) {
+ synth->printDebug(" %d: play=%s, pcm=%s (%d), wave=%d", i, cache[i].playPartial ? "YES" : "NO", cache[i].PCMPartial ? "YES" : "NO", timbre->partial[i].wg.pcmWave, timbre->partial[i].wg.waveform);
+ }
+#endif
+}
+
+const char *Part::getName() const {
+ return name;
+}
+
+void Part::setVolume(unsigned int midiVolume) {
+ // CONFIRMED: This calculation matches the table used in the control ROM
+ patchTemp->outputLevel = (Bit8u)(midiVolume * 100 / 127);
+ //synth->printDebug("%s (%s): Set volume to %d", name, currentInstr, midiVolume);
+}
+
+Bit8u Part::getVolume() const {
+ return patchTemp->outputLevel;
+}
+
+Bit8u Part::getExpression() const {
+ return expression;
+}
+
+void Part::setExpression(unsigned int midiExpression) {
+ // CONFIRMED: This calculation matches the table used in the control ROM
+ expression = (Bit8u)(midiExpression * 100 / 127);
+}
+
+void RhythmPart::setPan(unsigned int midiPan) {
+ // CONFIRMED: This does change patchTemp, but has no actual effect on playback.
+#if MT32EMU_MONITOR_MIDI > 0
+ synth->printDebug("%s: Pointlessly setting pan (%d) on rhythm part", name, midiPan);
+#endif
+ Part::setPan(midiPan);
+}
+
+void Part::setPan(unsigned int midiPan) {
+ // NOTE: Panning is inverted compared to GM.
+
+ // CM-32L: Divide by 8.5
+ patchTemp->panpot = (Bit8u)((midiPan << 3) / 68);
+ // FIXME: MT-32: Divide by 9
+ //patchTemp->panpot = (Bit8u)(midiPan / 9);
+
+ //synth->printDebug("%s (%s): Set pan to %d", name, currentInstr, panpot);
+}
+
+/**
+ * Applies key shift to a MIDI key and converts it into an internal key value in the range 12-108.
+ */
+unsigned int Part::midiKeyToKey(unsigned int midiKey) {
+ int key = midiKey + patchTemp->patch.keyShift;
+ if (key < 36) {
+ // After keyShift is applied, key < 36, so move up by octaves
+ while (key < 36) {
+ key += 12;
+ }
+ } else if (key > 132) {
+ // After keyShift is applied, key > 132, so move down by octaves
+ while (key > 132) {
+ key -= 12;
+ }
+ }
+ key -= 24;
+ return key;
+}
+
+void RhythmPart::noteOn(unsigned int midiKey, unsigned int velocity) {
+ if (midiKey < 24 || midiKey > 108) { /*> 87 on MT-32)*/
+ synth->printDebug("%s: Attempted to play invalid key %d (velocity %d)", name, midiKey, velocity);
+ return;
+ }
+ unsigned int key = midiKey;
+ unsigned int drumNum = key - 24;
+ int drumTimbreNum = rhythmTemp[drumNum].timbre;
+ if (drumTimbreNum >= 127) { // 94 on MT-32
+ synth->printDebug("%s: Attempted to play unmapped key %d (velocity %d)", name, midiKey, velocity);
+ return;
+ }
+ // CONFIRMED: Two special cases described by Mok
+ if (drumTimbreNum == 64 + 6) {
+ noteOff(0);
+ key = 1;
+ } else if (drumTimbreNum == 64 + 7) {
+ // This noteOff(0) is not performed on MT-32, only LAPC-I
+ noteOff(0);
+ key = 0;
+ }
+ int absTimbreNum = drumTimbreNum + 128;
+ TimbreParam *timbre = &synth->mt32ram.timbres[absTimbreNum].timbre;
+ memcpy(currentInstr, timbre->common.name, 10);
+ if (drumCache[drumNum][0].dirty) {
+ cacheTimbre(drumCache[drumNum], timbre);
+ }
+#if MT32EMU_MONITOR_INSTRUMENTS > 0
+ synth->printDebug("%s (%s): Start poly (drum %d, timbre %d): midiKey %u, key %u, velo %u, mod %u, exp %u, bend %u", name, currentInstr, drumNum, absTimbreNum, midiKey, key, velocity, modulation, expression, pitchBend);
+#if MT32EMU_MONITOR_INSTRUMENTS > 1
+ // According to info from Mok, keyShift does not appear to affect anything on rhythm part on LAPC-I, but may do on MT-32 - needs investigation
+ synth->printDebug(" Patch: (timbreGroup %u), (timbreNum %u), (keyShift %u), fineTune %u, benderRange %u, assignMode %u, (reverbSwitch %u)", patchTemp->patch.timbreGroup, patchTemp->patch.timbreNum, patchTemp->patch.keyShift, patchTemp->patch.fineTune, patchTemp->patch.benderRange, patchTemp->patch.assignMode, patchTemp->patch.reverbSwitch);
+ synth->printDebug(" PatchTemp: outputLevel %u, (panpot %u)", patchTemp->outputLevel, patchTemp->panpot);
+ synth->printDebug(" RhythmTemp: timbre %u, outputLevel %u, panpot %u, reverbSwitch %u", rhythmTemp[drumNum].timbre, rhythmTemp[drumNum].outputLevel, rhythmTemp[drumNum].panpot, rhythmTemp[drumNum].reverbSwitch);
+#endif
+#endif
+ playPoly(drumCache[drumNum], &rhythmTemp[drumNum], midiKey, key, velocity);
+}
+
+void Part::noteOn(unsigned int midiKey, unsigned int velocity) {
+ unsigned int key = midiKeyToKey(midiKey);
+ if (patchCache[0].dirty) {
+ cacheTimbre(patchCache, timbreTemp);
+ }
+#if MT32EMU_MONITOR_INSTRUMENTS > 0
+ synth->printDebug("%s (%s): Start poly: midiKey %u, key %u, velo %u, mod %u, exp %u, bend %u", name, currentInstr, midiKey, key, velocity, modulation, expression, pitchBend);
+#if MT32EMU_MONITOR_INSTRUMENTS > 1
+ synth->printDebug(" Patch: timbreGroup %u, timbreNum %u, keyShift %u, fineTune %u, benderRange %u, assignMode %u, reverbSwitch %u", patchTemp->patch.timbreGroup, patchTemp->patch.timbreNum, patchTemp->patch.keyShift, patchTemp->patch.fineTune, patchTemp->patch.benderRange, patchTemp->patch.assignMode, patchTemp->patch.reverbSwitch);
+ synth->printDebug(" PatchTemp: outputLevel %u, panpot %u", patchTemp->outputLevel, patchTemp->panpot);
+#endif
+#endif
+ playPoly(patchCache, NULL, midiKey, key, velocity);
+}
+
+void Part::abortPoly(Poly *poly) {
+ if (poly->startAbort()) {
+ while (poly->isActive()) {
+ if (!synth->prerender()) {
+ synth->printDebug("%s (%s): Ran out of prerender space to abort poly gracefully", name, currentInstr);
+ poly->terminate();
+ break;
+ }
+ }
+ }
+}
+
+bool Part::abortFirstPoly(unsigned int key) {
+ for (Common::List<Poly *>::iterator polyIt = activePolys.begin(); polyIt != activePolys.end(); polyIt++) {
+ Poly *poly = *polyIt;
+ if (poly->getKey() == key) {
+ abortPoly(poly);
+ return true;
+ }
+ }
+ return false;
+}
+
+bool Part::abortFirstPoly(PolyState polyState) {
+ for (Common::List<Poly *>::iterator polyIt = activePolys.begin(); polyIt != activePolys.end(); polyIt++) {
+ Poly *poly = *polyIt;
+ if (poly->getState() == polyState) {
+ abortPoly(poly);
+ return true;
+ }
+ }
+ return false;
+}
+
+bool Part::abortFirstPolyPreferHeld() {
+ if (abortFirstPoly(POLY_Held)) {
+ return true;
+ }
+ return abortFirstPoly();
+}
+
+bool Part::abortFirstPoly() {
+ if (activePolys.empty()) {
+ return false;
+ }
+ abortPoly(activePolys.front());
+ return true;
+}
+
+void Part::playPoly(const PatchCache cache[4], const MemParams::RhythmTemp *rhythmTemp, unsigned int midiKey, unsigned int key, unsigned int velocity) {
+ // CONFIRMED: Even in single-assign mode, we don't abort playing polys if the timbre to play is completely muted.
+ unsigned int needPartials = cache[0].partialCount;
+ if (needPartials == 0) {
+ synth->printDebug("%s (%s): Completely muted instrument", name, currentInstr);
+ return;
+ }
+
+ if ((patchTemp->patch.assignMode & 2) == 0) {
+ // Single-assign mode
+ abortFirstPoly(key);
+ }
+
+ if (!synth->partialManager->freePartials(needPartials, partNum)) {
+#if MT32EMU_MONITOR_PARTIALS > 0
+ synth->printDebug("%s (%s): Insufficient free partials to play key %d (velocity %d); needed=%d, free=%d, assignMode=%d", name, currentInstr, midiKey, velocity, needPartials, synth->partialManager->getFreePartialCount(), patchTemp->patch.assignMode);
+ synth->printPartialUsage();
+#endif
+ return;
+ }
+
+ if (freePolys.empty()) {
+ synth->printDebug("%s (%s): No free poly to play key %d (velocity %d)", name, currentInstr, midiKey, velocity);
+ return;
+ }
+ Poly *poly = freePolys.front();
+ freePolys.pop_front();
+ if (patchTemp->patch.assignMode & 1) {
+ // Priority to data first received
+ activePolys.push_front(poly);
+ } else {
+ activePolys.push_back(poly);
+ }
+
+ Partial *partials[4];
+ for (int x = 0; x < 4; x++) {
+ if (cache[x].playPartial) {
+ partials[x] = synth->partialManager->allocPartial(partNum);
+ activePartialCount++;
+ } else {
+ partials[x] = NULL;
+ }
+ }
+ poly->reset(key, velocity, cache[0].sustain, partials);
+
+ for (int x = 0; x < 4; x++) {
+ if (partials[x] != NULL) {
+#if MT32EMU_MONITOR_PARTIALS > 2
+ synth->printDebug("%s (%s): Allocated partial %d", name, currentInstr, partials[x]->debugGetPartialNum());
+#endif
+ partials[x]->startPartial(this, poly, &cache[x], rhythmTemp, partials[cache[x].structurePair]);
+ }
+ }
+#if MT32EMU_MONITOR_PARTIALS > 1
+ synth->printPartialUsage();
+#endif
+}
+
+void Part::allNotesOff() {
+ // The MIDI specification states - and Mok confirms - that all notes off (0x7B)
+ // should treat the hold pedal as usual.
+ for (Common::List<Poly *>::iterator polyIt = activePolys.begin(); polyIt != activePolys.end(); polyIt++) {
+ Poly *poly = *polyIt;
+ // FIXME: This has special handling of key 0 in NoteOff that Mok has not yet confirmed
+ // applies to AllNotesOff.
+ poly->noteOff(holdpedal);
+ }
+}
+
+void Part::allSoundOff() {
+ // MIDI "All sound off" (0x78) should release notes immediately regardless of the hold pedal.
+ // This controller is not actually implemented by the synths, though (according to the docs and Mok) -
+ // we're only using this method internally.
+ for (Common::List<Poly *>::iterator polyIt = activePolys.begin(); polyIt != activePolys.end(); polyIt++) {
+ Poly *poly = *polyIt;
+ poly->startDecay();
+ }
+}
+
+void Part::stopPedalHold() {
+ for (Common::List<Poly *>::iterator polyIt = activePolys.begin(); polyIt != activePolys.end(); polyIt++) {
+ Poly *poly = *polyIt;
+ poly->stopPedalHold();
+ }
+}
+
+void RhythmPart::noteOff(unsigned int midiKey) {
+ stopNote(midiKey);
+}
+
+void Part::noteOff(unsigned int midiKey) {
+ stopNote(midiKeyToKey(midiKey));
+}
+
+void Part::stopNote(unsigned int key) {
+#if MT32EMU_MONITOR_INSTRUMENTS > 0
+ synth->printDebug("%s (%s): stopping key %d", name, currentInstr, key);
+#endif
+
+ for (Common::List<Poly *>::iterator polyIt = activePolys.begin(); polyIt != activePolys.end(); polyIt++) {
+ Poly *poly = *polyIt;
+ // Generally, non-sustaining instruments ignore note off. They die away eventually anyway.
+ // Key 0 (only used by special cases on rhythm part) reacts to note off even if non-sustaining or pedal held.
+ if (poly->getKey() == key && (poly->canSustain() || key == 0)) {
+ if (poly->noteOff(holdpedal && key != 0)) {
+ break;
+ }
+ }
+ }
+}
+
+const MemParams::PatchTemp *Part::getPatchTemp() const {
+ return patchTemp;
+}
+
+unsigned int Part::getActivePartialCount() const {
+ return activePartialCount;
+}
+
+unsigned int Part::getActiveNonReleasingPartialCount() const {
+ unsigned int activeNonReleasingPartialCount = 0;
+ for (Common::List<Poly *>::const_iterator polyIt = activePolys.begin(); polyIt != activePolys.end(); polyIt++) {
+ Poly *poly = *polyIt;
+ if (poly->getState() != POLY_Releasing) {
+ activeNonReleasingPartialCount += poly->getActivePartialCount();
+ }
+ }
+ return activeNonReleasingPartialCount;
+}
+
+void Part::partialDeactivated(Poly *poly) {
+ activePartialCount--;
+ if (!poly->isActive()) {
+ activePolys.remove(poly);
+ freePolys.push_front(poly);
+ }
+}
+
+}
diff --git a/audio/softsynth/mt32/Part.h b/audio/softsynth/mt32/Part.h
new file mode 100644
index 0000000000..5c59c6d61f
--- /dev/null
+++ b/audio/softsynth/mt32/Part.h
@@ -0,0 +1,133 @@
+/* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher
+ * Copyright (C) 2011 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef MT32EMU_PART_H
+#define MT32EMU_PART_H
+
+#include <common/list.h>
+
+namespace MT32Emu {
+
+class PartialManager;
+class Synth;
+
+class Part {
+private:
+ // Direct pointer to sysex-addressable memory dedicated to this part (valid for parts 1-8, NULL for rhythm)
+ TimbreParam *timbreTemp;
+
+ // 0=Part 1, .. 7=Part 8, 8=Rhythm
+ unsigned int partNum;
+
+ bool holdpedal;
+
+ unsigned int activePartialCount;
+ PatchCache patchCache[4];
+ Common::List<Poly *> freePolys;
+ Common::List<Poly *> activePolys;
+
+ void setPatch(const PatchParam *patch);
+ unsigned int midiKeyToKey(unsigned int midiKey);
+
+ void abortPoly(Poly *poly);
+ bool abortFirstPoly(unsigned int key);
+
+protected:
+ Synth *synth;
+ // Direct pointer into sysex-addressable memory
+ MemParams::PatchTemp *patchTemp;
+ char name[8]; // "Part 1".."Part 8", "Rhythm"
+ char currentInstr[11];
+ Bit8u modulation;
+ Bit8u expression;
+ Bit32s pitchBend;
+ bool nrpn;
+ Bit16u rpn;
+ Bit16u pitchBenderRange; // (patchTemp->patch.benderRange * 683) at the time of the last MIDI program change or MIDI data entry.
+
+ void backupCacheToPartials(PatchCache cache[4]);
+ void cacheTimbre(PatchCache cache[4], const TimbreParam *timbre);
+ void playPoly(const PatchCache cache[4], const MemParams::RhythmTemp *rhythmTemp, unsigned int midiKey, unsigned int key, unsigned int velocity);
+ void stopNote(unsigned int key);
+ const char *getName() const;
+
+public:
+ Part(Synth *synth, unsigned int usePartNum);
+ virtual ~Part();
+ void reset();
+ void setDataEntryMSB(unsigned char midiDataEntryMSB);
+ void setNRPN();
+ void setRPNLSB(unsigned char midiRPNLSB);
+ void setRPNMSB(unsigned char midiRPNMSB);
+ void resetAllControllers();
+ virtual void noteOn(unsigned int midiKey, unsigned int velocity);
+ virtual void noteOff(unsigned int midiKey);
+ void allNotesOff();
+ void allSoundOff();
+ Bit8u getVolume() const; // Internal volume, 0-100, exposed for use by ExternalInterface
+ void setVolume(unsigned int midiVolume);
+ Bit8u getModulation() const;
+ void setModulation(unsigned int midiModulation);
+ Bit8u getExpression() const;
+ void setExpression(unsigned int midiExpression);
+ virtual void setPan(unsigned int midiPan);
+ Bit32s getPitchBend() const;
+ void setBend(unsigned int midiBend);
+ virtual void setProgram(unsigned int midiProgram);
+ void setHoldPedal(bool pedalval);
+ void stopPedalHold();
+ void updatePitchBenderRange();
+ virtual void refresh();
+ virtual void refreshTimbre(unsigned int absTimbreNum);
+ virtual void setTimbre(TimbreParam *timbre);
+ virtual unsigned int getAbsTimbreNum() const;
+ const char *getCurrentInstr() const;
+ unsigned int getActivePartialCount() const;
+ unsigned int getActiveNonReleasingPartialCount() const;
+
+ const MemParams::PatchTemp *getPatchTemp() const;
+
+ // This should only be called by Poly
+ void partialDeactivated(Poly *poly);
+
+ // These are rather specialised, and should probably only be used by PartialManager
+ bool abortFirstPoly(PolyState polyState);
+ // Abort the first poly in PolyState_HELD, or if none exists, the first active poly in any state.
+ bool abortFirstPolyPreferHeld();
+ bool abortFirstPoly();
+};
+
+class RhythmPart: public Part {
+ // Pointer to the area of the MT-32's memory dedicated to rhythm
+ const MemParams::RhythmTemp *rhythmTemp;
+
+ // This caches the timbres/settings in use by the rhythm part
+ PatchCache drumCache[85][4];
+public:
+ RhythmPart(Synth *synth, unsigned int usePartNum);
+ void refresh();
+ void refreshTimbre(unsigned int timbreNum);
+ void setTimbre(TimbreParam *timbre);
+ void noteOn(unsigned int key, unsigned int velocity);
+ void noteOff(unsigned int midiKey);
+ unsigned int getAbsTimbreNum() const;
+ void setPan(unsigned int midiPan);
+ void setProgram(unsigned int patchNum);
+};
+
+}
+#endif
diff --git a/audio/softsynth/mt32/Partial.cpp b/audio/softsynth/mt32/Partial.cpp
new file mode 100644
index 0000000000..03bec560b8
--- /dev/null
+++ b/audio/softsynth/mt32/Partial.cpp
@@ -0,0 +1,557 @@
+/* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher
+ * Copyright (C) 2011 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+//#include <cmath>
+//#include <cstdlib>
+//#include <cstring>
+
+#include "mt32emu.h"
+#include "mmath.h"
+
+using namespace MT32Emu;
+
+#ifdef INACCURATE_SMOOTH_PAN
+// Mok wanted an option for smoother panning, and we love Mok.
+static const float PAN_NUMERATOR_NORMAL[] = {0.0f, 0.5f, 1.0f, 1.5f, 2.0f, 2.5f, 3.0f, 3.5f, 4.0f, 4.5f, 5.0f, 5.5f, 6.0f, 6.5f, 7.0f};
+#else
+// CONFIRMED by Mok: These NUMERATOR values (as bytes, not floats, obviously) are sent exactly like this to the LA32.
+static const float PAN_NUMERATOR_NORMAL[] = {0.0f, 0.0f, 1.0f, 1.0f, 2.0f, 2.0f, 3.0f, 3.0f, 4.0f, 4.0f, 5.0f, 5.0f, 6.0f, 6.0f, 7.0f};
+#endif
+static const float PAN_NUMERATOR_MASTER[] = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f};
+static const float PAN_NUMERATOR_SLAVE[] = {0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 7.0f, 7.0f, 7.0f, 7.0f, 7.0f, 7.0f, 7.0f};
+
+Partial::Partial(Synth *useSynth, int useDebugPartialNum) :
+ synth(useSynth), debugPartialNum(useDebugPartialNum), sampleNum(0), tva(new TVA(this, &ampRamp)), tvp(new TVP(this)), tvf(new TVF(this, &cutoffModifierRamp)) {
+ ownerPart = -1;
+ poly = NULL;
+ pair = NULL;
+}
+
+Partial::~Partial() {
+ delete tva;
+ delete tvp;
+ delete tvf;
+}
+
+// Only used for debugging purposes
+int Partial::debugGetPartialNum() const {
+ return debugPartialNum;
+}
+
+// Only used for debugging purposes
+unsigned long Partial::debugGetSampleNum() const {
+ return sampleNum;
+}
+
+int Partial::getOwnerPart() const {
+ return ownerPart;
+}
+
+bool Partial::isActive() const {
+ return ownerPart > -1;
+}
+
+const Poly *Partial::getPoly() const {
+ return poly;
+}
+
+void Partial::activate(int part) {
+ // This just marks the partial as being assigned to a part
+ ownerPart = part;
+}
+
+void Partial::deactivate() {
+ if (!isActive()) {
+ return;
+ }
+ ownerPart = -1;
+ if (poly != NULL) {
+ poly->partialDeactivated(this);
+ if (pair != NULL) {
+ pair->pair = NULL;
+ }
+ }
+#if MT32EMU_MONITOR_PARTIALS > 2
+ synth->printDebug("[+%lu] [Partial %d] Deactivated", sampleNum, debugPartialNum);
+ synth->printPartialUsage(sampleNum);
+#endif
+}
+
+// DEPRECATED: This should probably go away eventually, it's currently only used as a kludge to protect our old assumptions that
+// rhythm part notes were always played as key MIDDLEC.
+int Partial::getKey() const {
+ if (poly == NULL) {
+ return -1;
+ } else if (ownerPart == 8) {
+ // FIXME: Hack, should go away after new pitch stuff is committed (and possibly some TVF changes)
+ return MIDDLEC;
+ } else {
+ return poly->getKey();
+ }
+}
+
+void Partial::startPartial(const Part *part, Poly *usePoly, const PatchCache *usePatchCache, const MemParams::RhythmTemp *rhythmTemp, Partial *pairPartial) {
+ if (usePoly == NULL || usePatchCache == NULL) {
+ synth->printDebug("[Partial %d] *** Error: Starting partial for owner %d, usePoly=%s, usePatchCache=%s", debugPartialNum, ownerPart, usePoly == NULL ? "*** NULL ***" : "OK", usePatchCache == NULL ? "*** NULL ***" : "OK");
+ return;
+ }
+ patchCache = usePatchCache;
+ poly = usePoly;
+ mixType = patchCache->structureMix;
+ structurePosition = patchCache->structurePosition;
+
+ Bit8u panSetting = rhythmTemp != NULL ? rhythmTemp->panpot : part->getPatchTemp()->panpot;
+ float panVal;
+ if (mixType == 3) {
+ if (structurePosition == 0) {
+ panVal = PAN_NUMERATOR_MASTER[panSetting];
+ } else {
+ panVal = PAN_NUMERATOR_SLAVE[panSetting];
+ }
+ // Do a normal mix independent of any pair partial.
+ mixType = 0;
+ pairPartial = NULL;
+ } else {
+ panVal = PAN_NUMERATOR_NORMAL[panSetting];
+ }
+
+ // FIXME: Sample analysis suggests that the use of panVal is linear, but there are some some quirks that still need to be resolved.
+ stereoVolume.leftVol = panVal / 7.0f;
+ stereoVolume.rightVol = 1.0f - stereoVolume.leftVol;
+
+ if (patchCache->PCMPartial) {
+ pcmNum = patchCache->pcm;
+ if (synth->controlROMMap->pcmCount > 128) {
+ // CM-32L, etc. support two "banks" of PCMs, selectable by waveform type parameter.
+ if (patchCache->waveform > 1) {
+ pcmNum += 128;
+ }
+ }
+ pcmWave = &synth->pcmWaves[pcmNum];
+ } else {
+ pcmWave = NULL;
+ wavePos = 0.0f;
+ lastFreq = 0.0;
+ }
+
+ // CONFIRMED: pulseWidthVal calculation is based on information from Mok
+ pulseWidthVal = (poly->getVelocity() - 64) * (patchCache->srcPartial.wg.pulseWidthVeloSensitivity - 7) + synth->tables.pulseWidth100To255[patchCache->srcPartial.wg.pulseWidth];
+ if (pulseWidthVal < 0) {
+ pulseWidthVal = 0;
+ } else if (pulseWidthVal > 255) {
+ pulseWidthVal = 255;
+ }
+
+ pcmPosition = 0.0f;
+ pair = pairPartial;
+ alreadyOutputed = false;
+ tva->reset(part, patchCache->partialParam, rhythmTemp);
+ tvp->reset(part, patchCache->partialParam);
+ tvf->reset(patchCache->partialParam, tvp->getBasePitch());
+}
+
+float Partial::getPCMSample(unsigned int position) {
+ if (position >= pcmWave->len) {
+ if (!pcmWave->loop) {
+ return 0;
+ }
+ position = position % pcmWave->len;
+ }
+ return synth->pcmROMData[pcmWave->addr + position];
+}
+
+unsigned long Partial::generateSamples(float *partialBuf, unsigned long length) {
+ if (!isActive() || alreadyOutputed) {
+ return 0;
+ }
+ if (poly == NULL) {
+ synth->printDebug("[Partial %d] *** ERROR: poly is NULL at Partial::generateSamples()!", debugPartialNum);
+ return 0;
+ }
+
+ alreadyOutputed = true;
+
+ // Generate samples
+
+ for (sampleNum = 0; sampleNum < length; sampleNum++) {
+ float sample = 0;
+ Bit32u ampRampVal = ampRamp.nextValue();
+ if (ampRamp.checkInterrupt()) {
+ tva->handleInterrupt();
+ }
+ if (!tva->isPlaying()) {
+ deactivate();
+ break;
+ }
+ // SEMI-CONFIRMED: From sample analysis:
+ // (1) Tested with a single partial playing PCM wave 77 with pitchCoarse 36 and no keyfollow, velocity follow, etc.
+ // This gives results within +/- 2 at the output (before any DAC bitshifting)
+ // when sustaining at levels 156 - 255 with no modifiers.
+ // (2) Tested with a special square wave partial (internal capture ID tva5) at TVA envelope levels 155-255.
+ // This gives deltas between -1 and 0 compared to the real output. Note that this special partial only produces
+ // positive amps, so negative still needs to be explored, as well as lower levels.
+ //
+ // Also still partially unconfirmed is the behaviour when ramping between levels, as well as the timing.
+ float amp = EXP2F((32772 - ampRampVal / 2048) / -2048.0f);
+
+ Bit16u pitch = tvp->nextPitch();
+ float freq = synth->tables.pitchToFreq[pitch];
+
+ if (patchCache->PCMPartial) {
+ // Render PCM waveform
+ int len = pcmWave->len;
+ int intPCMPosition = (int)pcmPosition;
+ if (intPCMPosition >= len && !pcmWave->loop) {
+ // We're now past the end of a non-looping PCM waveform so it's time to die.
+ deactivate();
+ break;
+ }
+ Bit32u pcmAddr = pcmWave->addr;
+ float positionDelta = freq * 2048.0f / synth->myProp.sampleRate;
+
+ // Linear interpolation
+ float firstSample = synth->pcmROMData[pcmAddr + intPCMPosition];
+ float nextSample = getPCMSample(intPCMPosition + 1);
+ sample = firstSample + (nextSample - firstSample) * (pcmPosition - intPCMPosition);
+
+ float newPCMPosition = pcmPosition + positionDelta;
+ if (pcmWave->loop) {
+ newPCMPosition = fmod(newPCMPosition, (float)pcmWave->len);
+ }
+ pcmPosition = newPCMPosition;
+ } else {
+ // Render synthesised waveform
+ wavePos *= lastFreq / freq;
+ lastFreq = freq;
+
+ Bit32u cutoffModifierRampVal = cutoffModifierRamp.nextValue();
+ if (cutoffModifierRamp.checkInterrupt()) {
+ tvf->handleInterrupt();
+ }
+ float cutoffModifier = cutoffModifierRampVal / 262144.0f;
+
+ // res corresponds to a value set in an LA32 register
+ Bit8u res = patchCache->srcPartial.tvf.resonance + 1;
+
+ // EXP2F(1.0f - (32 - res) / 4.0f);
+ float resAmp = synth->tables.resAmpMax[res];
+
+ // The cutoffModifier may not be supposed to be directly added to the cutoff -
+ // it may for example need to be multiplied in some way.
+ // The 240 cutoffVal limit was determined via sample analysis (internal Munt capture IDs: glop3, glop4).
+ // More research is needed to be sure that this is correct, however.
+ float cutoffVal = tvf->getBaseCutoff() + cutoffModifier;
+ if (cutoffVal > 240.0f) {
+ cutoffVal = 240.0f;
+ }
+
+ // Wave length in samples
+ float waveLen = synth->myProp.sampleRate / freq;
+
+ // Init cosineLen
+ float cosineLen = 0.5f * waveLen;
+ if (cutoffVal > 128.0f) {
+#if MT32EMU_ACCURATE_WG == 1
+ cosineLen *= EXP2F((cutoffVal - 128.0f) / -16.0f); // found from sample analysis
+#else
+ cosineLen *= synth->tables.cutoffToCosineLen[Bit32u((cutoffVal - 128.0f) * 8.0f)];
+#endif
+ }
+
+ // Start playing in center of first cosine segment
+ // relWavePos is shifted by a half of cosineLen
+ float relWavePos = wavePos + 0.5f * cosineLen;
+ if (relWavePos > waveLen) {
+ relWavePos -= waveLen;
+ }
+
+ float pulseLen = 0.5f;
+ if (pulseWidthVal > 128) {
+ pulseLen += synth->tables.pulseLenFactor[pulseWidthVal - 128];
+ }
+ pulseLen *= waveLen;
+
+ float lLen = pulseLen - cosineLen;
+
+ // Ignore pulsewidths too high for given freq
+ if (lLen < 0.0f) {
+ lLen = 0.0f;
+ }
+
+ // Ignore pulsewidths too high for given freq and cutoff
+ float hLen = waveLen - lLen - 2 * cosineLen;
+ if (hLen < 0.0f) {
+ hLen = 0.0f;
+ }
+
+ // Correct resAmp for cutoff in range 50..66
+ if ((cutoffVal >= 128.0f) && (cutoffVal < 144.0f)) {
+#if MT32EMU_ACCURATE_WG == 1
+ resAmp *= sinf(FLOAT_PI * (cutoffVal - 128.0f) / 32.0f);
+#else
+ resAmp *= synth->tables.sinf10[Bit32u(64 * (cutoffVal - 128.0f))];
+#endif
+ }
+
+ // Produce filtered square wave with 2 cosine waves on slopes
+
+ // 1st cosine segment
+ if (relWavePos < cosineLen) {
+#if MT32EMU_ACCURATE_WG == 1
+ sample = -cosf(FLOAT_PI * relWavePos / cosineLen);
+#else
+ sample = -synth->tables.sinf10[Bit32u(2048.0f * relWavePos / cosineLen) + 1024];
+#endif
+ } else
+
+ // high linear segment
+ if (relWavePos < (cosineLen + hLen)) {
+ sample = 1.f;
+ } else
+
+ // 2nd cosine segment
+ if (relWavePos < (2 * cosineLen + hLen)) {
+#if MT32EMU_ACCURATE_WG == 1
+ sample = cosf(FLOAT_PI * (relWavePos - (cosineLen + hLen)) / cosineLen);
+#else
+ sample = synth->tables.sinf10[Bit32u(2048.0f * (relWavePos - (cosineLen + hLen)) / cosineLen) + 1024];
+#endif
+ } else {
+
+ // low linear segment
+ sample = -1.f;
+ }
+
+ if (cutoffVal < 128.0f) {
+
+ // Attenuate samples below cutoff 50
+ // Found by sample analysis
+#if MT32EMU_ACCURATE_WG == 1
+ sample *= EXP2F(-0.125f * (128.0f - cutoffVal));
+#else
+ sample *= synth->tables.cutoffToFilterAmp[Bit32u(cutoffVal * 8.0f)];
+#endif
+ } else {
+
+ // Add resonance sine. Effective for cutoff > 50 only
+ float resSample = 1.0f;
+
+ // Now relWavePos counts from the middle of first cosine
+ relWavePos = wavePos;
+
+ // negative segments
+ if (!(relWavePos < (cosineLen + hLen))) {
+ resSample = -resSample;
+ relWavePos -= cosineLen + hLen;
+ }
+
+ // Resonance sine WG
+#if MT32EMU_ACCURATE_WG == 1
+ resSample *= sinf(FLOAT_PI * relWavePos / cosineLen);
+#else
+ resSample *= synth->tables.sinf10[Bit32u(2048.0f * relWavePos / cosineLen) & 4095];
+#endif
+
+ // Resonance sine amp
+ float resAmpFade = EXP2F(-synth->tables.resAmpFadeFactor[res >> 2] * (relWavePos / cosineLen)); // seems to be exact
+
+ // Now relWavePos set negative to the left from center of any cosine
+ relWavePos = wavePos;
+
+ // negative segment
+ if (!(wavePos < (waveLen - 0.5f * cosineLen))) {
+ relWavePos -= waveLen;
+ } else
+
+ // positive segment
+ if (!(wavePos < (hLen + 0.5f * cosineLen))) {
+ relWavePos -= cosineLen + hLen;
+ }
+
+ // Fading to zero while within cosine segments to avoid jumps in the wave
+ // Sample analysis suggests that this window is very close to cosine
+ if (relWavePos < 0.5f * cosineLen) {
+#if MT32EMU_ACCURATE_WG == 1
+ resAmpFade *= 0.5f * (1.0f - cosf(FLOAT_PI * relWavePos / (0.5f * cosineLen)));
+#else
+ resAmpFade *= 0.5f * (1.0f + synth->tables.sinf10[Bit32s(2048.0f * relWavePos / (0.5f * cosineLen)) + 3072]);
+#endif
+ }
+
+ sample += resSample * resAmp * resAmpFade;
+ }
+
+ // sawtooth waves
+ if ((patchCache->waveform & 1) != 0) {
+#if MT32EMU_ACCURATE_WG == 1
+ sample *= cosf(FLOAT_2PI * wavePos / waveLen);
+#else
+ sample *= synth->tables.sinf10[(Bit32u(4096.0f * wavePos / waveLen) & 4095) + 1024];
+#endif
+ }
+
+ wavePos++;
+
+ // wavePos isn't supposed to be > waveLen
+ if (wavePos > waveLen) {
+ wavePos -= waveLen;
+ }
+ }
+
+ // Multiply sample with current TVA value
+ sample *= amp;
+ *partialBuf++ = sample;
+ }
+ unsigned long renderedSamples = sampleNum;
+ sampleNum = 0;
+ return renderedSamples;
+}
+
+float *Partial::mixBuffersRingMix(float *buf1, float *buf2, unsigned long len) {
+ if (buf1 == NULL) {
+ return NULL;
+ }
+ if (buf2 == NULL) {
+ return buf1;
+ }
+
+ while (len--) {
+ // FIXME: At this point we have no idea whether this is remotely correct...
+ *buf1 = *buf1 * *buf2 + *buf1;
+ buf1++;
+ buf2++;
+ }
+ return buf1;
+}
+
+float *Partial::mixBuffersRing(float *buf1, float *buf2, unsigned long len) {
+ if (buf1 == NULL) {
+ return NULL;
+ }
+ if (buf2 == NULL) {
+ return NULL;
+ }
+
+ while (len--) {
+ // FIXME: At this point we have no idea whether this is remotely correct...
+ *buf1 = *buf1 * *buf2;
+ buf1++;
+ buf2++;
+ }
+ return buf1;
+}
+
+bool Partial::hasRingModulatingSlave() const {
+ return pair != NULL && structurePosition == 0 && (mixType == 1 || mixType == 2);
+}
+
+bool Partial::isRingModulatingSlave() const {
+ return pair != NULL && structurePosition == 1 && (mixType == 1 || mixType == 2);
+}
+
+bool Partial::isPCM() const {
+ return pcmWave != NULL;
+}
+
+const ControlROMPCMStruct *Partial::getControlROMPCMStruct() const {
+ if (pcmWave != NULL) {
+ return pcmWave->controlROMPCMStruct;
+ }
+ return NULL;
+}
+
+Synth *Partial::getSynth() const {
+ return synth;
+}
+
+bool Partial::produceOutput(float *leftBuf, float *rightBuf, unsigned long length) {
+ if (!isActive() || alreadyOutputed || isRingModulatingSlave()) {
+ return false;
+ }
+ if (poly == NULL) {
+ synth->printDebug("[Partial %d] *** ERROR: poly is NULL at Partial::produceOutput()!", debugPartialNum);
+ return false;
+ }
+
+ float *partialBuf = &myBuffer[0];
+ unsigned long numGenerated = generateSamples(partialBuf, length);
+ if (mixType == 1 || mixType == 2) {
+ float *pairBuf;
+ unsigned long pairNumGenerated;
+ if (pair == NULL) {
+ pairBuf = NULL;
+ pairNumGenerated = 0;
+ } else {
+ pairBuf = &pair->myBuffer[0];
+ pairNumGenerated = pair->generateSamples(pairBuf, numGenerated);
+ // pair will have been set to NULL if it deactivated within generateSamples()
+ if (pair != NULL) {
+ if (!isActive()) {
+ pair->deactivate();
+ pair = NULL;
+ } else if (!pair->isActive()) {
+ pair = NULL;
+ }
+ }
+ }
+ if (pairNumGenerated > 0) {
+ if (mixType == 1) {
+ mixBuffersRingMix(partialBuf, pairBuf, pairNumGenerated);
+ } else {
+ mixBuffersRing(partialBuf, pairBuf, pairNumGenerated);
+ }
+ }
+ if (numGenerated > pairNumGenerated) {
+ if (mixType == 1) {
+ mixBuffersRingMix(partialBuf + pairNumGenerated, NULL, numGenerated - pairNumGenerated);
+ } else {
+ mixBuffersRing(partialBuf + pairNumGenerated, NULL, numGenerated - pairNumGenerated);
+ }
+ }
+ }
+
+ for (unsigned int i = 0; i < numGenerated; i++) {
+ *leftBuf++ = partialBuf[i] * stereoVolume.leftVol;
+ }
+ for (unsigned int i = 0; i < numGenerated; i++) {
+ *rightBuf++ = partialBuf[i] * stereoVolume.rightVol;
+ }
+ while (numGenerated < length) {
+ *leftBuf++ = 0.0f;
+ *rightBuf++ = 0.0f;
+ numGenerated++;
+ }
+ return true;
+}
+
+bool Partial::shouldReverb() {
+ if (!isActive()) {
+ return false;
+ }
+ return patchCache->reverb;
+}
+
+void Partial::startAbort() {
+ // This is called when the partial manager needs to terminate partials for re-use by a new Poly.
+ tva->startAbort();
+}
+
+void Partial::startDecayAll() {
+ tva->startDecay();
+ tvp->startDecay();
+ tvf->startDecay();
+}
diff --git a/audio/softsynth/mt32/Partial.h b/audio/softsynth/mt32/Partial.h
new file mode 100644
index 0000000000..95218c858c
--- /dev/null
+++ b/audio/softsynth/mt32/Partial.h
@@ -0,0 +1,119 @@
+/* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher
+ * Copyright (C) 2011 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef MT32EMU_PARTIAL_H
+#define MT32EMU_PARTIAL_H
+
+namespace MT32Emu {
+
+class Synth;
+class Part;
+class TVA;
+struct ControlROMPCMStruct;
+
+struct StereoVolume {
+ float leftVol;
+ float rightVol;
+};
+
+// A partial represents one of up to four waveform generators currently playing within a poly.
+class Partial {
+private:
+ Synth *synth;
+ const int debugPartialNum; // Only used for debugging
+ // Number of the sample currently being rendered by generateSamples(), or 0 if no run is in progress
+ // This is only kept available for debugging purposes.
+ unsigned long sampleNum;
+
+ int ownerPart; // -1 if unassigned
+ int mixType;
+ int structurePosition; // 0 or 1 of a structure pair
+ StereoVolume stereoVolume;
+
+ // Distance in (possibly fractional) samples from the start of the current pulse
+ float wavePos;
+
+ float lastFreq;
+
+ float myBuffer[MAX_SAMPLES_PER_RUN];
+
+ // Only used for PCM partials
+ int pcmNum;
+ // FIXME: Give this a better name (e.g. pcmWaveInfo)
+ PCMWaveEntry *pcmWave;
+
+ // Final pulse width value, with velfollow applied, matching what is sent to the LA32.
+ // Range: 0-255
+ int pulseWidthVal;
+
+ float pcmPosition;
+
+ Poly *poly;
+
+ LA32Ramp ampRamp;
+ LA32Ramp cutoffModifierRamp;
+
+ float *mixBuffersRingMix(float *buf1, float *buf2, unsigned long len);
+ float *mixBuffersRing(float *buf1, float *buf2, unsigned long len);
+
+ float getPCMSample(unsigned int position);
+
+public:
+ const PatchCache *patchCache;
+ TVA *tva;
+ TVP *tvp;
+ TVF *tvf;
+
+ PatchCache cachebackup;
+
+ Partial *pair;
+ bool alreadyOutputed;
+
+ Partial(Synth *synth, int debugPartialNum);
+ ~Partial();
+
+ int debugGetPartialNum() const;
+ unsigned long debugGetSampleNum() const;
+
+ int getOwnerPart() const;
+ int getKey() const;
+ const Poly *getPoly() const;
+ bool isActive() const;
+ void activate(int part);
+ void deactivate(void);
+ void startPartial(const Part *part, Poly *usePoly, const PatchCache *useCache, const MemParams::RhythmTemp *rhythmTemp, Partial *pairPartial);
+ void startAbort();
+ void startDecayAll();
+ bool shouldReverb();
+ bool hasRingModulatingSlave() const;
+ bool isRingModulatingSlave() const;
+ bool isPCM() const;
+ const ControlROMPCMStruct *getControlROMPCMStruct() const;
+ Synth *getSynth() const;
+
+ // Returns true only if data written to buffer
+ // This function (unlike the one below it) returns processed stereo samples
+ // made from combining this single partial with its pair, if it has one.
+ bool produceOutput(float *leftBuf, float *rightBuf, unsigned long length);
+
+ // This function writes mono sample output to the provided buffer, and returns the number of samples written
+ unsigned long generateSamples(float *partialBuf, unsigned long length);
+};
+
+}
+
+#endif
diff --git a/audio/softsynth/mt32/PartialManager.cpp b/audio/softsynth/mt32/PartialManager.cpp
new file mode 100644
index 0000000000..42a3eaa179
--- /dev/null
+++ b/audio/softsynth/mt32/PartialManager.cpp
@@ -0,0 +1,250 @@
+/* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher
+ * Copyright (C) 2011 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+//#include <cstring>
+
+#include "mt32emu.h"
+#include "PartialManager.h"
+
+using namespace MT32Emu;
+
+PartialManager::PartialManager(Synth *useSynth, Part **useParts) {
+ synth = useSynth;
+ parts = useParts;
+ for (int i = 0; i < MT32EMU_MAX_PARTIALS; i++) {
+ partialTable[i] = new Partial(synth, i);
+ }
+}
+
+PartialManager::~PartialManager(void) {
+ for (int i = 0; i < MT32EMU_MAX_PARTIALS; i++) {
+ delete partialTable[i];
+ }
+}
+
+void PartialManager::clearAlreadyOutputed() {
+ for (int i = 0; i < MT32EMU_MAX_PARTIALS; i++) {
+ partialTable[i]->alreadyOutputed = false;
+ }
+}
+
+bool PartialManager::shouldReverb(int i) {
+ return partialTable[i]->shouldReverb();
+}
+
+bool PartialManager::produceOutput(int i, float *leftBuf, float *rightBuf, Bit32u bufferLength) {
+ return partialTable[i]->produceOutput(leftBuf, rightBuf, bufferLength);
+}
+
+void PartialManager::deactivateAll() {
+ for (int i = 0; i < MT32EMU_MAX_PARTIALS; i++) {
+ partialTable[i]->deactivate();
+ }
+}
+
+unsigned int PartialManager::setReserve(Bit8u *rset) {
+ unsigned int pr = 0;
+ for (int x = 0; x <= 8; x++) {
+ numReservedPartialsForPart[x] = rset[x];
+ pr += rset[x];
+ }
+ return pr;
+}
+
+Partial *PartialManager::allocPartial(int partNum) {
+ Partial *outPartial = NULL;
+
+ // Get the first inactive partial
+ for (int partialNum = 0; partialNum < MT32EMU_MAX_PARTIALS; partialNum++) {
+ if (!partialTable[partialNum]->isActive()) {
+ outPartial = partialTable[partialNum];
+ break;
+ }
+ }
+ if (outPartial != NULL) {
+ outPartial->activate(partNum);
+ }
+ return outPartial;
+}
+
+unsigned int PartialManager::getFreePartialCount(void) {
+ int count = 0;
+ for (int i = 0; i < MT32EMU_MAX_PARTIALS; i++) {
+ if (!partialTable[i]->isActive()) {
+ count++;
+ }
+ }
+ return count;
+}
+
+// This function is solely used to gather data for debug output at the moment.
+void PartialManager::getPerPartPartialUsage(unsigned int perPartPartialUsage[9]) {
+ memset(perPartPartialUsage, 0, 9 * sizeof(unsigned int));
+ for (unsigned int i = 0; i < MT32EMU_MAX_PARTIALS; i++) {
+ if (partialTable[i]->isActive()) {
+ perPartPartialUsage[partialTable[i]->getOwnerPart()]++;
+ }
+ }
+}
+
+// Finds the lowest-priority part that is exceeding its reserved partial allocation and has a poly
+// in POLY_Releasing, then kills its first releasing poly.
+// Parts with higher priority than minPart are not checked.
+// Assumes that getFreePartials() has been called to make numReservedPartialsForPart up-to-date.
+bool PartialManager::abortFirstReleasingPolyWhereReserveExceeded(int minPart) {
+ if (minPart == 8) {
+ // Rhythm is highest priority
+ minPart = -1;
+ }
+ for (int partNum = 7; partNum >= minPart; partNum--) {
+ int usePartNum = partNum == -1 ? 8 : partNum;
+ if (parts[usePartNum]->getActivePartialCount() > numReservedPartialsForPart[usePartNum]) {
+ // This part has exceeded its reserved partial count.
+ // If it has any releasing polys, kill its first one and we're done.
+ if (parts[usePartNum]->abortFirstPoly(POLY_Releasing)) {
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+// Finds the lowest-priority part that is exceeding its reserved partial allocation and has a poly, then kills
+// its first poly in POLY_Held - or failing that, its first poly in any state.
+// Parts with higher priority than minPart are not checked.
+// Assumes that getFreePartials() has been called to make numReservedPartialsForPart up-to-date.
+bool PartialManager::abortFirstPolyPreferHeldWhereReserveExceeded(int minPart) {
+ if (minPart == 8) {
+ // Rhythm is highest priority
+ minPart = -1;
+ }
+ for (int partNum = 7; partNum >= minPart; partNum--) {
+ int usePartNum = partNum == -1 ? 8 : partNum;
+ if (parts[usePartNum]->getActivePartialCount() > numReservedPartialsForPart[usePartNum]) {
+ // This part has exceeded its reserved partial count.
+ // If it has any polys, kill its first (preferably held) one and we're done.
+ if (parts[usePartNum]->abortFirstPolyPreferHeld()) {
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+bool PartialManager::freePartials(unsigned int needed, int partNum) {
+ // CONFIRMED: Barring bugs, this matches the real LAPC-I according to information from Mok.
+
+ // BUG: There's a bug in the LAPC-I implementation:
+ // When allocating for rhythm part, or when allocating for a part that is using fewer partials than it has reserved,
+ // held and playing polys on the rhythm part can potentially be aborted before releasing polys on the rhythm part.
+ // This bug isn't present on MT-32.
+ // I consider this to be a bug because I think that playing polys should always have priority over held polys,
+ // and held polys should always have priority over releasing polys.
+
+ // NOTE: This code generally aborts polys in parts (according to certain conditions) in the following order:
+ // 7, 6, 5, 4, 3, 2, 1, 0, 8 (rhythm)
+ // (from lowest priority, meaning most likely to have polys aborted, to highest priority, meaning least likely)
+
+ if (needed == 0) {
+ return true;
+ }
+
+ // Note that calling getFreePartialCount() also ensures that numReservedPartialsPerPart is up-to-date
+ if (getFreePartialCount() >= needed) {
+ return true;
+ }
+
+ // Note: These #ifdefs are temporary until we have proper "quirk" configuration.
+ // Also, the MT-32 version isn't properly confirmed yet.
+#ifdef MT32EMU_QUIRK_FREE_PARTIALS_MT32
+ // On MT-32, we bail out before even killing releasing partials if the allocating part has exceeded its reserve and is configured for priority-to-earlier-polys.
+ if (parts[partNum]->getActiveNonReleasingPartialCount() + needed > numReservedPartialsForPart[partNum] && (synth->getPart(partNum)->getPatchTemp()->patch.assignMode & 1)) {
+ return false;
+ }
+#endif
+
+ for (;;) {
+#ifdef MT32EMU_QUIRK_FREE_PARTIALS_MT32
+ // Abort releasing polys in parts that have exceeded their partial reservation (working backwards from part 7, with rhythm last)
+ if (!abortFirstReleasingPolyWhereReserveExceeded(-1)) {
+ break;
+ }
+#else
+ // Abort releasing polys in non-rhythm parts that have exceeded their partial reservation (working backwards from part 7)
+ if (!abortFirstReleasingPolyWhereReserveExceeded(0)) {
+ break;
+ }
+#endif
+ if (getFreePartialCount() >= needed) {
+ return true;
+ }
+ }
+
+ if (parts[partNum]->getActiveNonReleasingPartialCount() + needed > numReservedPartialsForPart[partNum]) {
+ // With the new partials we're freeing for, we would end up using more partials than we have reserved.
+ if (synth->getPart(partNum)->getPatchTemp()->patch.assignMode & 1) {
+ // Priority is given to earlier polys, so just give up
+ return false;
+ }
+ // Only abort held polys in the target part and parts that have a lower priority
+ // (higher part number = lower priority, except for rhythm, which has the highest priority).
+ for (;;) {
+ if (!abortFirstPolyPreferHeldWhereReserveExceeded(partNum)) {
+ break;
+ }
+ if (getFreePartialCount() >= needed) {
+ return true;
+ }
+ }
+ if (needed > numReservedPartialsForPart[partNum]) {
+ return false;
+ }
+ } else {
+ // At this point, we're certain that we've reserved enough partials to play our poly.
+ // Check all parts from lowest to highest priority to see whether they've exceeded their
+ // reserve, and abort their polys until until we have enough free partials or they're within
+ // their reserve allocation.
+ for (;;) {
+ if (!abortFirstPolyPreferHeldWhereReserveExceeded(-1)) {
+ break;
+ }
+ if (getFreePartialCount() >= needed) {
+ return true;
+ }
+ }
+ }
+
+ // Abort polys in the target part until there are enough free partials for the new one
+ for (;;) {
+ if (!parts[partNum]->abortFirstPolyPreferHeld()) {
+ break;
+ }
+ if (getFreePartialCount() >= needed) {
+ return true;
+ }
+ }
+
+ // Aww, not enough partials for you.
+ return false;
+}
+
+const Partial *PartialManager::getPartial(unsigned int partialNum) const {
+ if (partialNum > MT32EMU_MAX_PARTIALS - 1) {
+ return NULL;
+ }
+ return partialTable[partialNum];
+}
diff --git a/audio/softsynth/mt32/PartialManager.h b/audio/softsynth/mt32/PartialManager.h
new file mode 100644
index 0000000000..bb78672457
--- /dev/null
+++ b/audio/softsynth/mt32/PartialManager.h
@@ -0,0 +1,54 @@
+/* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher
+ * Copyright (C) 2011 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef MT32EMU_PARTIALMANAGER_H
+#define MT32EMU_PARTIALMANAGER_H
+
+namespace MT32Emu {
+
+class Synth;
+
+class PartialManager {
+private:
+ Synth *synth; // Only used for sending debug output
+ Part **parts;
+
+ Partial *partialTable[MT32EMU_MAX_PARTIALS];
+ Bit8u numReservedPartialsForPart[9];
+
+ bool abortFirstReleasingPolyWhereReserveExceeded(int minPart);
+ bool abortFirstPolyPreferHeldWhereReserveExceeded(int minPart);
+
+public:
+
+ PartialManager(Synth *synth, Part **parts);
+ ~PartialManager();
+ Partial *allocPartial(int partNum);
+ unsigned int getFreePartialCount(void);
+ void getPerPartPartialUsage(unsigned int perPartPartialUsage[9]);
+ bool freePartials(unsigned int needed, int partNum);
+ unsigned int setReserve(Bit8u *rset);
+ void deactivateAll();
+ bool produceOutput(int i, float *leftBuf, float *rightBuf, Bit32u bufferLength);
+ bool shouldReverb(int i);
+ void clearAlreadyOutputed();
+ const Partial *getPartial(unsigned int partialNum) const;
+};
+
+}
+
+#endif
diff --git a/audio/softsynth/mt32/Poly.cpp b/audio/softsynth/mt32/Poly.cpp
new file mode 100644
index 0000000000..a2f00db73c
--- /dev/null
+++ b/audio/softsynth/mt32/Poly.cpp
@@ -0,0 +1,174 @@
+/* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher
+ * Copyright (C) 2011 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "mt32emu.h"
+
+namespace MT32Emu {
+
+Poly::Poly(Part *usePart) {
+ part = usePart;
+ key = 255;
+ velocity = 255;
+ sustain = false;
+ activePartialCount = 0;
+ for (int i = 0; i < 4; i++) {
+ partials[i] = NULL;
+ }
+ state = POLY_Inactive;
+}
+
+void Poly::reset(unsigned int newKey, unsigned int newVelocity, bool newSustain, Partial **newPartials) {
+ if (isActive()) {
+ // FIXME: Throw out some big ugly debug output with a lot of exclamation marks - we should never get here
+ terminate();
+ }
+
+ key = newKey;
+ velocity = newVelocity;
+ sustain = newSustain;
+
+ activePartialCount = 0;
+ for (int i = 0; i < 4; i++) {
+ partials[i] = newPartials[i];
+ if (newPartials[i] != NULL) {
+ activePartialCount++;
+ state = POLY_Playing;
+ }
+ }
+}
+
+bool Poly::noteOff(bool pedalHeld) {
+ // Generally, non-sustaining instruments ignore note off. They die away eventually anyway.
+ // Key 0 (only used by special cases on rhythm part) reacts to note off even if non-sustaining or pedal held.
+ if (state == POLY_Inactive || state == POLY_Releasing) {
+ return false;
+ }
+ if (pedalHeld) {
+ state = POLY_Held;
+ } else {
+ startDecay();
+ }
+ return true;
+}
+
+bool Poly::stopPedalHold() {
+ if (state != POLY_Held) {
+ return false;
+ }
+ return startDecay();
+}
+
+bool Poly::startDecay() {
+ if (state == POLY_Inactive || state == POLY_Releasing) {
+ return false;
+ }
+ state = POLY_Releasing;
+
+ for (int t = 0; t < 4; t++) {
+ Partial *partial = partials[t];
+ if (partial != NULL) {
+ partial->startDecayAll();
+ }
+ }
+ return true;
+}
+
+bool Poly::startAbort() {
+ if (state == POLY_Inactive) {
+ return false;
+ }
+ for (int t = 0; t < 4; t++) {
+ Partial *partial = partials[t];
+ if (partial != NULL) {
+ partial->startAbort();
+ }
+ }
+ return true;
+}
+
+void Poly::terminate() {
+ if (state == POLY_Inactive) {
+ return;
+ }
+ for (int t = 0; t < 4; t++) {
+ Partial *partial = partials[t];
+ if (partial != NULL) {
+ partial->deactivate();
+ }
+ }
+ if (state != POLY_Inactive) {
+ // FIXME: Throw out lots of debug output - this should never happen
+ // (Deactivating the partials above should've made them each call partialDeactivated(), ultimately changing the state to POLY_Inactive)
+ state = POLY_Inactive;
+ }
+}
+
+void Poly::backupCacheToPartials(PatchCache cache[4]) {
+ for (int partialNum = 0; partialNum < 4; partialNum++) {
+ Partial *partial = partials[partialNum];
+ if (partial != NULL && partial->patchCache == &cache[partialNum]) {
+ partial->cachebackup = cache[partialNum];
+ partial->patchCache = &partial->cachebackup;
+ }
+ }
+}
+
+/**
+ * Returns the internal key identifier.
+ * For non-rhythm, this is within the range 12 to 108.
+ * For rhythm on MT-32, this is 0 or 1 (special cases) or within the range 24 to 87.
+ * For rhythm on devices with extended PCM sounds (e.g. CM-32L), this is 0, 1 or 24 to 108
+ */
+unsigned int Poly::getKey() const {
+ return key;
+}
+
+unsigned int Poly::getVelocity() const {
+ return velocity;
+}
+
+bool Poly::canSustain() const {
+ return sustain;
+}
+
+PolyState Poly::getState() const {
+ return state;
+}
+
+unsigned int Poly::getActivePartialCount() const {
+ return activePartialCount;
+}
+
+bool Poly::isActive() const {
+ return state != POLY_Inactive;
+}
+
+// This is called by Partial to inform the poly that the Partial has deactivated
+void Poly::partialDeactivated(Partial *partial) {
+ for (int i = 0; i < 4; i++) {
+ if (partials[i] == partial) {
+ partials[i] = NULL;
+ activePartialCount--;
+ }
+ }
+ if (activePartialCount == 0) {
+ state = POLY_Inactive;
+ }
+ part->partialDeactivated(this);
+}
+
+}
diff --git a/audio/softsynth/mt32/Poly.h b/audio/softsynth/mt32/Poly.h
new file mode 100644
index 0000000000..cd15a776f5
--- /dev/null
+++ b/audio/softsynth/mt32/Poly.h
@@ -0,0 +1,67 @@
+/* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher
+ * Copyright (C) 2011 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef MT32EMU_POLY_H
+#define MT32EMU_POLY_H
+
+namespace MT32Emu {
+
+class Part;
+
+enum PolyState {
+ POLY_Playing,
+ POLY_Held, // This marks keys that have been released on the keyboard, but are being held by the pedal
+ POLY_Releasing,
+ POLY_Inactive
+};
+
+class Poly {
+private:
+ Part *part;
+ unsigned int key;
+ unsigned int velocity;
+ unsigned int activePartialCount;
+ bool sustain;
+
+ PolyState state;
+
+ Partial *partials[4];
+
+public:
+ Poly(Part *part);
+ void reset(unsigned int key, unsigned int velocity, bool sustain, Partial **partials);
+ bool noteOff(bool pedalHeld);
+ bool stopPedalHold();
+ bool startDecay();
+ bool startAbort();
+ void terminate();
+
+ void backupCacheToPartials(PatchCache cache[4]);
+
+ unsigned int getKey() const;
+ unsigned int getVelocity() const;
+ bool canSustain() const;
+ PolyState getState() const;
+ unsigned int getActivePartialCount() const;
+ bool isActive() const;
+
+ void partialDeactivated(Partial *partial);
+};
+
+}
+
+#endif /* POLY_H_ */
diff --git a/audio/softsynth/mt32/Structures.h b/audio/softsynth/mt32/Structures.h
new file mode 100644
index 0000000000..e4d98ad1fc
--- /dev/null
+++ b/audio/softsynth/mt32/Structures.h
@@ -0,0 +1,217 @@
+/* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher
+ * Copyright (C) 2011 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef MT32EMU_STRUCTURES_H
+#define MT32EMU_STRUCTURES_H
+
+namespace MT32Emu {
+
+// MT32EMU_MEMADDR() converts from sysex-padded, MT32EMU_SYSEXMEMADDR converts to it
+// Roland provides documentation using the sysex-padded addresses, so we tend to use that in code and output
+#define MT32EMU_MEMADDR(x) ((((x) & 0x7f0000) >> 2) | (((x) & 0x7f00) >> 1) | ((x) & 0x7f))
+#define MT32EMU_SYSEXMEMADDR(x) ((((x) & 0x1FC000) << 2) | (((x) & 0x3F80) << 1) | ((x) & 0x7f))
+
+#ifdef _MSC_VER
+#define MT32EMU_ALIGN_PACKED __declspec(align(1))
+#else
+#define MT32EMU_ALIGN_PACKED __attribute__((packed))
+#endif
+
+typedef unsigned int Bit32u;
+typedef signed int Bit32s;
+typedef unsigned short int Bit16u;
+typedef signed short int Bit16s;
+typedef unsigned char Bit8u;
+typedef signed char Bit8s;
+
+// The following structures represent the MT-32's memory
+// Since sysex allows this memory to be written to in blocks of bytes,
+// we keep this packed so that we can copy data into the various
+// banks directly
+#if defined(_MSC_VER) || defined (__MINGW32__)
+#pragma pack(push, 1)
+#else
+#pragma pack(1)
+#endif
+
+struct TimbreParam {
+ struct CommonParam {
+ char name[10];
+ Bit8u partialStructure12; // 1 & 2 0-12 (1-13)
+ Bit8u partialStructure34; // 3 & 4 0-12 (1-13)
+ Bit8u partialMute; // 0-15 (0000-1111)
+ Bit8u noSustain; // ENV MODE 0-1 (Normal, No sustain)
+ } MT32EMU_ALIGN_PACKED common;
+
+ struct PartialParam {
+ struct WGParam {
+ Bit8u pitchCoarse; // 0-96 (C1,C#1-C9)
+ Bit8u pitchFine; // 0-100 (-50 to +50 (cents - confirmed by Mok))
+ Bit8u pitchKeyfollow; // 0-16 (-1, -1/2, -1/4, 0, 1/8, 1/4, 3/8, 1/2, 5/8, 3/4, 7/8, 1, 5/4, 3/2, 2, s1, s2)
+ Bit8u pitchBenderEnabled; // 0-1 (OFF, ON)
+ Bit8u waveform; // MT-32: 0-1 (SQU/SAW); LAPC-I: WG WAVEFORM/PCM BANK 0 - 3 (SQU/1, SAW/1, SQU/2, SAW/2)
+ Bit8u pcmWave; // 0-127 (1-128)
+ Bit8u pulseWidth; // 0-100
+ Bit8u pulseWidthVeloSensitivity; // 0-14 (-7 - +7)
+ } MT32EMU_ALIGN_PACKED wg;
+
+ struct PitchEnvParam {
+ Bit8u depth; // 0-10
+ Bit8u veloSensitivity; // 0-100
+ Bit8u timeKeyfollow; // 0-4
+ Bit8u time[4]; // 0-100
+ Bit8u level[5]; // 0-100 (-50 - +50) // [3]: SUSTAIN LEVEL, [4]: END LEVEL
+ } MT32EMU_ALIGN_PACKED pitchEnv;
+
+ struct PitchLFOParam {
+ Bit8u rate; // 0-100
+ Bit8u depth; // 0-100
+ Bit8u modSensitivity; // 0-100
+ } MT32EMU_ALIGN_PACKED pitchLFO;
+
+ struct TVFParam {
+ Bit8u cutoff; // 0-100
+ Bit8u resonance; // 0-30
+ Bit8u keyfollow; // -1, -1/2, -1/4, 0, 1/8, 1/4, 3/8, 1/2, 5/8, 3/4, 7/8, 1, 5/4, 3/2, 2
+ Bit8u biasPoint; // 0-127 (<1A-<7C >1A-7C)
+ Bit8u biasLevel; // 0-14 (-7 - +7)
+ Bit8u envDepth; // 0-100
+ Bit8u envVeloSensitivity; // 0-100
+ Bit8u envDepthKeyfollow; // DEPTH KEY FOLL0W 0-4
+ Bit8u envTimeKeyfollow; // TIME KEY FOLLOW 0-4
+ Bit8u envTime[5]; // 0-100
+ Bit8u envLevel[4]; // 0-100 // [3]: SUSTAIN LEVEL
+ } MT32EMU_ALIGN_PACKED tvf;
+
+ struct TVAParam {
+ Bit8u level; // 0-100
+ Bit8u veloSensitivity; // 0-100
+ Bit8u biasPoint1; // 0-127 (<1A-<7C >1A-7C)
+ Bit8u biasLevel1; // 0-12 (-12 - 0)
+ Bit8u biasPoint2; // 0-127 (<1A-<7C >1A-7C)
+ Bit8u biasLevel2; // 0-12 (-12 - 0)
+ Bit8u envTimeKeyfollow; // TIME KEY FOLLOW 0-4
+ Bit8u envTimeVeloSensitivity; // VELOS KEY FOLL0W 0-4
+ Bit8u envTime[5]; // 0-100
+ Bit8u envLevel[4]; // 0-100 // [3]: SUSTAIN LEVEL
+ } MT32EMU_ALIGN_PACKED tva;
+ } MT32EMU_ALIGN_PACKED partial[4];
+} MT32EMU_ALIGN_PACKED;
+
+struct PatchParam {
+ Bit8u timbreGroup; // TIMBRE GROUP 0-3 (group A, group B, Memory, Rhythm)
+ Bit8u timbreNum; // TIMBRE NUMBER 0-63
+ Bit8u keyShift; // KEY SHIFT 0-48 (-24 - +24 semitones)
+ Bit8u fineTune; // FINE TUNE 0-100 (-50 - +50 cents)
+ Bit8u benderRange; // BENDER RANGE 0-24
+ Bit8u assignMode; // ASSIGN MODE 0-3 (POLY1, POLY2, POLY3, POLY4)
+ Bit8u reverbSwitch; // REVERB SWITCH 0-1 (OFF,ON)
+ Bit8u dummy; // (DUMMY)
+} MT32EMU_ALIGN_PACKED;
+
+const unsigned int SYSTEM_MASTER_TUNE_OFF = 0;
+const unsigned int SYSTEM_REVERB_MODE_OFF = 1;
+const unsigned int SYSTEM_REVERB_TIME_OFF = 2;
+const unsigned int SYSTEM_REVERB_LEVEL_OFF = 3;
+const unsigned int SYSTEM_RESERVE_SETTINGS_START_OFF = 4;
+const unsigned int SYSTEM_RESERVE_SETTINGS_END_OFF = 12;
+const unsigned int SYSTEM_CHAN_ASSIGN_START_OFF = 13;
+const unsigned int SYSTEM_CHAN_ASSIGN_END_OFF = 21;
+const unsigned int SYSTEM_MASTER_VOL_OFF = 22;
+
+struct MemParams {
+ // NOTE: The MT-32 documentation only specifies PatchTemp areas for parts 1-8.
+ // The LAPC-I documentation specified an additional area for rhythm at the end,
+ // where all parameters but fine tune, assign mode and output level are ignored
+ struct PatchTemp {
+ PatchParam patch;
+ Bit8u outputLevel; // OUTPUT LEVEL 0-100
+ Bit8u panpot; // PANPOT 0-14 (R-L)
+ Bit8u dummyv[6];
+ } MT32EMU_ALIGN_PACKED patchTemp[9];
+
+ struct RhythmTemp {
+ Bit8u timbre; // TIMBRE 0-94 (M1-M64,R1-30,OFF); LAPC-I: 0-127 (M01-M64,R01-R63)
+ Bit8u outputLevel; // OUTPUT LEVEL 0-100
+ Bit8u panpot; // PANPOT 0-14 (R-L)
+ Bit8u reverbSwitch; // REVERB SWITCH 0-1 (OFF,ON)
+ } MT32EMU_ALIGN_PACKED rhythmTemp[85];
+
+ TimbreParam timbreTemp[8];
+
+ PatchParam patches[128];
+
+ // NOTE: There are only 30 timbres in the "rhythm" bank for MT-32; the additional 34 are for LAPC-I and above
+ struct PaddedTimbre {
+ TimbreParam timbre;
+ Bit8u padding[10];
+ } MT32EMU_ALIGN_PACKED timbres[64 + 64 + 64 + 64]; // Group A, Group B, Memory, Rhythm
+
+ struct System {
+ Bit8u masterTune; // MASTER TUNE 0-127 432.1-457.6Hz
+ Bit8u reverbMode; // REVERB MODE 0-3 (room, hall, plate, tap delay)
+ Bit8u reverbTime; // REVERB TIME 0-7 (1-8)
+ Bit8u reverbLevel; // REVERB LEVEL 0-7 (1-8)
+ Bit8u reserveSettings[9]; // PARTIAL RESERVE (PART 1) 0-32
+ Bit8u chanAssign[9]; // MIDI CHANNEL (PART1) 0-16 (1-16,OFF)
+ Bit8u masterVol; // MASTER VOLUME 0-100
+ } MT32EMU_ALIGN_PACKED system;
+};
+
+#if defined(_MSC_VER) || defined (__MINGW32__)
+#pragma pack(pop)
+#else
+#pragma pack()
+#endif
+
+struct ControlROMPCMStruct;
+
+struct PCMWaveEntry {
+ Bit32u addr;
+ Bit32u len;
+ bool loop;
+ ControlROMPCMStruct *controlROMPCMStruct;
+};
+
+// This is basically a per-partial, pre-processed combination of timbre and patch/rhythm settings
+struct PatchCache {
+ bool playPartial;
+ bool PCMPartial;
+ int pcm;
+ char waveform;
+
+ Bit32u structureMix;
+ int structurePosition;
+ int structurePair;
+
+ // The following fields are actually common to all partials in the timbre
+ bool dirty;
+ Bit32u partialCount;
+ bool sustain;
+ bool reverb;
+
+ TimbreParam::PartialParam srcPartial;
+
+ // The following directly points into live sysex-addressable memory
+ const TimbreParam::PartialParam *partialParam;
+};
+
+class Partial; // Forward reference for class defined in partial.h
+
+}
+
+#endif
diff --git a/audio/softsynth/mt32/Synth.cpp b/audio/softsynth/mt32/Synth.cpp
new file mode 100644
index 0000000000..0861053b5c
--- /dev/null
+++ b/audio/softsynth/mt32/Synth.cpp
@@ -0,0 +1,1620 @@
+/* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher
+ * Copyright (C) 2011 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+//#include <cerrno>
+//#include <cmath>
+//#include <cstdlib>
+//#include <cstring>
+
+#define FORBIDDEN_SYMBOL_EXCEPTION_printf
+#define FORBIDDEN_SYMBOL_EXCEPTION_vprintf
+
+#include "mt32emu.h"
+#include "mmath.h"
+#include "PartialManager.h"
+
+#if MT32EMU_USE_AREVERBMODEL == 1
+#include "AReverbModel.h"
+#else
+#include "FreeverbModel.h"
+#endif
+#include "DelayReverb.h"
+
+namespace MT32Emu {
+
+const ControlROMMap ControlROMMaps[7] = {
+ // ID IDc IDbytes PCMmap PCMc tmbrA tmbrAO, tmbrAC tmbrB tmbrBO, tmbrBC tmbrR trC rhythm rhyC rsrv panpot prog rhyMax patMax sysMax timMax
+ {0x4014, 22, "\000 ver1.04 14 July 87 ", 0x3000, 128, 0x8000, 0x0000, false, 0xC000, 0x4000, false, 0x3200, 30, 0x73A6, 85, 0x57C7, 0x57E2, 0x57D0, 0x5252, 0x525E, 0x526E, 0x520A},
+ {0x4014, 22, "\000 ver1.05 06 Aug, 87 ", 0x3000, 128, 0x8000, 0x0000, false, 0xC000, 0x4000, false, 0x3200, 30, 0x7414, 85, 0x57C7, 0x57E2, 0x57D0, 0x5252, 0x525E, 0x526E, 0x520A},
+ {0x4014, 22, "\000 ver1.06 31 Aug, 87 ", 0x3000, 128, 0x8000, 0x0000, false, 0xC000, 0x4000, false, 0x3200, 30, 0x7414, 85, 0x57D9, 0x57F4, 0x57E2, 0x5264, 0x5270, 0x5280, 0x521C},
+ {0x4010, 22, "\000 ver1.07 10 Oct, 87 ", 0x3000, 128, 0x8000, 0x0000, false, 0xC000, 0x4000, false, 0x3200, 30, 0x73fe, 85, 0x57B1, 0x57CC, 0x57BA, 0x523C, 0x5248, 0x5258, 0x51F4}, // MT-32 revision 1
+ {0x4010, 22, "\000verX.XX 30 Sep, 88 ", 0x3000, 128, 0x8000, 0x0000, false, 0xC000, 0x4000, false, 0x3200, 30, 0x741C, 85, 0x57E5, 0x5800, 0x57EE, 0x5270, 0x527C, 0x528C, 0x5228}, // MT-32 Blue Ridge mod
+ {0x2205, 22, "\000CM32/LAPC1.00 890404", 0x8100, 256, 0x8000, 0x8000, false, 0x8080, 0x8000, false, 0x8500, 64, 0x8580, 85, 0x4F65, 0x4F80, 0x4F6E, 0x48A1, 0x48A5, 0x48BE, 0x48D5},
+ {0x2205, 22, "\000CM32/LAPC1.02 891205", 0x8100, 256, 0x8000, 0x8000, true, 0x8080, 0x8000, true, 0x8500, 64, 0x8580, 85, 0x4F93, 0x4FAE, 0x4F9C, 0x48CB, 0x48CF, 0x48E8, 0x48FF} // CM-32L
+ // (Note that all but CM-32L ROM actually have 86 entries for rhythmTemp)
+};
+
+static inline Bit16s *streamOffset(Bit16s *stream, Bit32u pos) {
+ return stream == NULL ? NULL : stream + pos;
+}
+
+static inline void clearIfNonNull(Bit16s *stream, Bit32u len) {
+ if (stream != NULL) {
+ memset(stream, 0, len * sizeof(Bit16s));
+ }
+}
+
+static inline void mix(float *target, const float *stream, Bit32u len) {
+ while (len--) {
+ *target += *stream;
+ stream++;
+ target++;
+ }
+}
+
+static inline void clearFloats(float *leftBuf, float *rightBuf, Bit32u len) {
+ // FIXME: Use memset() where compatibility is guaranteed (if this turns out to be a win)
+ while (len--) {
+ *leftBuf++ = 0.0f;
+ *rightBuf++ = 0.0f;
+ }
+}
+
+static inline Bit16s clipBit16s(Bit32s a) {
+ // Clamp values above 32767 to 32767, and values below -32768 to -32768
+ if ((a + 32768) & ~65535) {
+ return (a >> 31) ^ 32767;
+ }
+ return a;
+}
+
+static void floatToBit16s_nice(Bit16s *target, const float *source, Bit32u len, float outputGain) {
+ float gain = outputGain * 16384.0f;
+ while (len--) {
+ // Since we're not shooting for accuracy here, don't worry about the rounding mode.
+ *target = clipBit16s((Bit32s)(*source * gain));
+ source++;
+ target++;
+ }
+}
+
+static void floatToBit16s_pure(Bit16s *target, const float *source, Bit32u len, float /*outputGain*/) {
+ while (len--) {
+ *target = clipBit16s((Bit32s)floor(*source * 8192.0f));
+ source++;
+ target++;
+ }
+}
+
+static void floatToBit16s_reverb(Bit16s *target, const float *source, Bit32u len, float outputGain) {
+ float gain = outputGain * 8192.0f;
+ while (len--) {
+ *target = clipBit16s((Bit32s)floor(*source * gain));
+ source++;
+ target++;
+ }
+}
+
+static void floatToBit16s_generation1(Bit16s *target, const float *source, Bit32u len, float outputGain) {
+ float gain = outputGain * 8192.0f;
+ while (len--) {
+ *target = clipBit16s((Bit32s)floor(*source * gain));
+ *target = (*target & 0x8000) | ((*target << 1) & 0x7FFE);
+ source++;
+ target++;
+ }
+}
+
+static void floatToBit16s_generation2(Bit16s *target, const float *source, Bit32u len, float outputGain) {
+ float gain = outputGain * 8192.0f;
+ while (len--) {
+ *target = clipBit16s((Bit32s)floor(*source * gain));
+ *target = (*target & 0x8000) | ((*target << 1) & 0x7FFE) | ((*target >> 14) & 0x0001);
+ source++;
+ target++;
+ }
+}
+
+Bit8u Synth::calcSysexChecksum(const Bit8u *data, Bit32u len, Bit8u checksum) {
+ for (unsigned int i = 0; i < len; i++) {
+ checksum = checksum + data[i];
+ }
+ checksum = checksum & 0x7f;
+ if (checksum) {
+ checksum = 0x80 - checksum;
+ }
+ return checksum;
+}
+
+Synth::Synth() {
+ isOpen = false;
+ reverbEnabled = true;
+ reverbOverridden = false;
+
+#if MT32EMU_USE_AREVERBMODEL == 1
+ reverbModels[0] = new AReverbModel(&AReverbModel::REVERB_MODE_0_SETTINGS);
+ reverbModels[1] = new AReverbModel(&AReverbModel::REVERB_MODE_1_SETTINGS);
+ reverbModels[2] = new AReverbModel(&AReverbModel::REVERB_MODE_2_SETTINGS);
+#else
+ reverbModels[0] = new FreeverbModel(0.76f, 0.687770909f, 0.63f, 0, 0.5f);
+ reverbModels[1] = new FreeverbModel(2.0f, 0.712025098f, 0.86f, 1, 0.5f);
+ reverbModels[2] = new FreeverbModel(0.4f, 0.939522749f, 0.38f, 2, 0.05f);
+#endif
+
+ reverbModels[3] = new DelayReverb();
+ reverbModel = NULL;
+ setDACInputMode(DACInputMode_NICE);
+ setOutputGain(1.0f);
+ setReverbOutputGain(0.68f);
+ partialManager = NULL;
+ memset(parts, 0, sizeof(parts));
+ renderedSampleCount = 0;
+}
+
+Synth::~Synth() {
+ close(); // Make sure we're closed and everything is freed
+ for (int i = 0; i < 4; i++) {
+ delete reverbModels[i];
+ }
+}
+
+int Synth::report(ReportType type, const void *data) {
+ if (myProp.report != NULL) {
+ return myProp.report(myProp.userData, type, data);
+ }
+ return 0;
+}
+
+unsigned int Synth::getSampleRate() const {
+ return myProp.sampleRate;
+}
+
+void Synth::printDebug(const char *fmt, ...) {
+ va_list ap;
+ va_start(ap, fmt);
+ if (myProp.printDebug != NULL) {
+ myProp.printDebug(myProp.userData, fmt, ap);
+ } else {
+#if MT32EMU_DEBUG_SAMPLESTAMPS > 0
+ printf("[%u] ", renderedSampleCount);
+#endif
+ vprintf(fmt, ap);
+ printf("\n");
+ }
+ va_end(ap);
+}
+
+void Synth::setReverbEnabled(bool newReverbEnabled) {
+ reverbEnabled = newReverbEnabled;
+}
+
+bool Synth::isReverbEnabled() const {
+ return reverbEnabled;
+}
+
+void Synth::setReverbOverridden(bool newReverbOverridden) {
+ reverbOverridden = newReverbOverridden;
+}
+
+bool Synth::isReverbOverridden() const {
+ return reverbOverridden;
+}
+
+void Synth::setDACInputMode(DACInputMode mode) {
+ switch(mode) {
+ case DACInputMode_GENERATION1:
+ la32FloatToBit16sFunc = floatToBit16s_generation1;
+ reverbFloatToBit16sFunc = floatToBit16s_reverb;
+ break;
+ case DACInputMode_GENERATION2:
+ la32FloatToBit16sFunc = floatToBit16s_generation2;
+ reverbFloatToBit16sFunc = floatToBit16s_reverb;
+ break;
+ case DACInputMode_PURE:
+ la32FloatToBit16sFunc = floatToBit16s_pure;
+ reverbFloatToBit16sFunc = floatToBit16s_pure;
+ break;
+ case DACInputMode_NICE:
+ default:
+ la32FloatToBit16sFunc = floatToBit16s_nice;
+ reverbFloatToBit16sFunc = floatToBit16s_reverb;
+ break;
+ }
+}
+
+void Synth::setOutputGain(float newOutputGain) {
+ outputGain = newOutputGain;
+}
+
+void Synth::setReverbOutputGain(float newReverbOutputGain) {
+ reverbOutputGain = newReverbOutputGain;
+}
+
+Common::File *Synth::openFile(const char *filename) {
+ if (myProp.openFile != NULL) {
+ return myProp.openFile(myProp.userData, filename);
+ }
+ char pathBuf[2048];
+ if (myProp.baseDir != NULL) {
+ strcpy(&pathBuf[0], myProp.baseDir);
+ strcat(&pathBuf[0], filename);
+ filename = pathBuf;
+ }
+ Common::File *file = new Common::File();
+ if (!file->open(filename)) {
+ delete file;
+ return NULL;
+ }
+ return file;
+}
+
+void Synth::closeFile(Common::File *file) {
+ if (myProp.closeFile != NULL) {
+ myProp.closeFile(myProp.userData, file);
+ } else {
+ file->close();
+ delete file;
+ }
+}
+
+LoadResult Synth::loadControlROM(const char *filename) {
+ Common::File *file = openFile(filename); // ROM File
+ if (file == NULL) {
+ return LoadResult_NotFound;
+ }
+ size_t fileSize = file->size();
+ if (fileSize != CONTROL_ROM_SIZE) {
+ printDebug("Control ROM file %s size mismatch: %i", filename, fileSize);
+ }
+ file->read(controlROMData, CONTROL_ROM_SIZE);
+ if (file->err()) {
+ closeFile(file);
+ return LoadResult_Unreadable;
+ }
+ closeFile(file);
+
+ // Control ROM successfully loaded, now check whether it's a known type
+ controlROMMap = NULL;
+ for (unsigned int i = 0; i < sizeof(ControlROMMaps) / sizeof(ControlROMMaps[0]); i++) {
+ if (memcmp(&controlROMData[ControlROMMaps[i].idPos], ControlROMMaps[i].idBytes, ControlROMMaps[i].idLen) == 0) {
+ controlROMMap = &ControlROMMaps[i];
+ return LoadResult_OK;
+ }
+ }
+ printDebug("%s does not match a known control ROM type", filename);
+ return LoadResult_Invalid;
+}
+
+LoadResult Synth::loadPCMROM(const char *filename) {
+ Common::File *file = openFile(filename); // ROM File
+ if (file == NULL) {
+ return LoadResult_NotFound;
+ }
+ size_t fileSize = file->size();
+ if (fileSize < (size_t)(2 * pcmROMSize)) {
+ printDebug("PCM ROM file is too short (expected %d, got %d)", 2 * pcmROMSize, fileSize);
+ closeFile(file);
+ return LoadResult_Invalid;
+ }
+ if (file->err()) {
+ closeFile(file);
+ return LoadResult_Unreadable;
+ }
+ LoadResult rc = LoadResult_OK;
+ for (int i = 0; i < pcmROMSize; i++) {
+ Bit8u s = file->readByte();
+ Bit8u c = file->readByte();
+
+ int order[16] = {0, 9, 1, 2, 3, 4, 5, 6, 7, 10, 11, 12, 13, 14, 15, 8};
+
+ signed short log = 0;
+ for (int u = 0; u < 15; u++) {
+ int bit;
+ if (order[u] < 8) {
+ bit = (s >> (7 - order[u])) & 0x1;
+ } else {
+ bit = (c >> (7 - (order[u] - 8))) & 0x1;
+ }
+ log = log | (short)(bit << (15 - u));
+ }
+ bool negative = log < 0;
+ log &= 0x7FFF;
+
+ // CONFIRMED from sample analysis to be 99.99%+ accurate with current TVA multiplier
+ float lin = EXP2F((32787 - log) / -2048.0f);
+
+ if (negative) {
+ lin = -lin;
+ }
+
+ pcmROMData[i] = lin;
+ }
+ closeFile(file);
+ return rc;
+}
+
+bool Synth::initPCMList(Bit16u mapAddress, Bit16u count) {
+ ControlROMPCMStruct *tps = (ControlROMPCMStruct *)&controlROMData[mapAddress];
+ for (int i = 0; i < count; i++) {
+ int rAddr = tps[i].pos * 0x800;
+ int rLenExp = (tps[i].len & 0x70) >> 4;
+ int rLen = 0x800 << rLenExp;
+ if (rAddr + rLen > pcmROMSize) {
+ printDebug("Control ROM error: Wave map entry %d points to invalid PCM address 0x%04X, length 0x%04X", i, rAddr, rLen);
+ return false;
+ }
+ pcmWaves[i].addr = rAddr;
+ pcmWaves[i].len = rLen;
+ pcmWaves[i].loop = (tps[i].len & 0x80) != 0;
+ pcmWaves[i].controlROMPCMStruct = &tps[i];
+ //int pitch = (tps[i].pitchMSB << 8) | tps[i].pitchLSB;
+ //bool unaffectedByMasterTune = (tps[i].len & 0x01) == 0;
+ //printDebug("PCM %d: pos=%d, len=%d, pitch=%d, loop=%s, unaffectedByMasterTune=%s", i, rAddr, rLen, pitch, pcmWaves[i].loop ? "YES" : "NO", unaffectedByMasterTune ? "YES" : "NO");
+ }
+ return false;
+}
+
+bool Synth::initCompressedTimbre(int timbreNum, const Bit8u *src, unsigned int srcLen) {
+ // "Compressed" here means that muted partials aren't present in ROM (except in the case of partial 0 being muted).
+ // Instead the data from the previous unmuted partial is used.
+ if (srcLen < sizeof(TimbreParam::CommonParam)) {
+ return false;
+ }
+ TimbreParam *timbre = &mt32ram.timbres[timbreNum].timbre;
+ timbresMemoryRegion->write(timbreNum, 0, src, sizeof(TimbreParam::CommonParam), true);
+ unsigned int srcPos = sizeof(TimbreParam::CommonParam);
+ unsigned int memPos = sizeof(TimbreParam::CommonParam);
+ for (int t = 0; t < 4; t++) {
+ if (t != 0 && ((timbre->common.partialMute >> t) & 0x1) == 0x00) {
+ // This partial is muted - we'll copy the previously copied partial, then
+ srcPos -= sizeof(TimbreParam::PartialParam);
+ } else if (srcPos + sizeof(TimbreParam::PartialParam) >= srcLen) {
+ return false;
+ }
+ timbresMemoryRegion->write(timbreNum, memPos, src + srcPos, sizeof(TimbreParam::PartialParam));
+ srcPos += sizeof(TimbreParam::PartialParam);
+ memPos += sizeof(TimbreParam::PartialParam);
+ }
+ return true;
+}
+
+bool Synth::initTimbres(Bit16u mapAddress, Bit16u offset, int count, int startTimbre, bool compressed) {
+ const Bit8u *timbreMap = &controlROMData[mapAddress];
+ for (Bit16u i = 0; i < count * 2; i += 2) {
+ Bit16u address = (timbreMap[i + 1] << 8) | timbreMap[i];
+ if (!compressed && (address + offset + sizeof(TimbreParam) > CONTROL_ROM_SIZE)) {
+ printDebug("Control ROM error: Timbre map entry 0x%04x for timbre %d points to invalid timbre address 0x%04x", i, startTimbre, address);
+ return false;
+ }
+ address += offset;
+ if (compressed) {
+ if (!initCompressedTimbre(startTimbre, &controlROMData[address], CONTROL_ROM_SIZE - address)) {
+ printDebug("Control ROM error: Timbre map entry 0x%04x for timbre %d points to invalid timbre at 0x%04x", i, startTimbre, address);
+ return false;
+ }
+ } else {
+ timbresMemoryRegion->write(startTimbre, 0, &controlROMData[address], sizeof(TimbreParam), true);
+ }
+ startTimbre++;
+ }
+ return true;
+}
+
+bool Synth::open(SynthProperties &useProp) {
+ if (isOpen) {
+ return false;
+ }
+ prerenderReadIx = prerenderWriteIx = 0;
+ myProp = useProp;
+#if MT32EMU_MONITOR_INIT
+ printDebug("Initialising Constant Tables");
+#endif
+ tables.init();
+#if !MT32EMU_REDUCE_REVERB_MEMORY
+ for (int i = 0; i < 4; i++) {
+ reverbModels[i]->open(useProp.sampleRate);
+ }
+#endif
+ if (useProp.baseDir != NULL) {
+ char *baseDirCopy = new char[strlen(useProp.baseDir) + 1];
+ strcpy(baseDirCopy, useProp.baseDir);
+ myProp.baseDir = baseDirCopy;
+ }
+
+ // This is to help detect bugs
+ memset(&mt32ram, '?', sizeof(mt32ram));
+
+#if MT32EMU_MONITOR_INIT
+ printDebug("Loading Control ROM");
+#endif
+ if (loadControlROM("CM32L_CONTROL.ROM") != LoadResult_OK) {
+ if (loadControlROM("MT32_CONTROL.ROM") != LoadResult_OK) {
+ printDebug("Init Error - Missing or invalid MT32_CONTROL.ROM");
+ //report(ReportType_errorControlROM, &errno);
+ return false;
+ }
+ }
+
+ initMemoryRegions();
+
+ // 512KB PCM ROM for MT-32, etc.
+ // 1MB PCM ROM for CM-32L, LAPC-I, CM-64, CM-500
+ // Note that the size below is given in samples (16-bit), not bytes
+ pcmROMSize = controlROMMap->pcmCount == 256 ? 512 * 1024 : 256 * 1024;
+ pcmROMData = new float[pcmROMSize];
+
+#if MT32EMU_MONITOR_INIT
+ printDebug("Loading PCM ROM");
+#endif
+ if (loadPCMROM("CM32L_PCM.ROM") != LoadResult_OK) {
+ if (loadPCMROM("MT32_PCM.ROM") != LoadResult_OK) {
+ printDebug("Init Error - Missing MT32_PCM.ROM");
+ //report(ReportType_errorPCMROM, &errno);
+ return false;
+ }
+ }
+
+#if MT32EMU_MONITOR_INIT
+ printDebug("Initialising Timbre Bank A");
+#endif
+ if (!initTimbres(controlROMMap->timbreAMap, controlROMMap->timbreAOffset, 0x40, 0, controlROMMap->timbreACompressed)) {
+ return false;
+ }
+
+#if MT32EMU_MONITOR_INIT
+ printDebug("Initialising Timbre Bank B");
+#endif
+ if (!initTimbres(controlROMMap->timbreBMap, controlROMMap->timbreBOffset, 0x40, 64, controlROMMap->timbreBCompressed)) {
+ return false;
+ }
+
+#if MT32EMU_MONITOR_INIT
+ printDebug("Initialising Timbre Bank R");
+#endif
+ if (!initTimbres(controlROMMap->timbreRMap, 0, controlROMMap->timbreRCount, 192, true)) {
+ return false;
+ }
+
+#if MT32EMU_MONITOR_INIT
+ printDebug("Initialising Timbre Bank M");
+#endif
+ // CM-64 seems to initialise all bytes in this bank to 0.
+ memset(&mt32ram.timbres[128], 0, sizeof(mt32ram.timbres[128]) * 64);
+
+ partialManager = new PartialManager(this, parts);
+
+ pcmWaves = new PCMWaveEntry[controlROMMap->pcmCount];
+
+#if MT32EMU_MONITOR_INIT
+ printDebug("Initialising PCM List");
+#endif
+ initPCMList(controlROMMap->pcmTable, controlROMMap->pcmCount);
+
+#if MT32EMU_MONITOR_INIT
+ printDebug("Initialising Rhythm Temp");
+#endif
+ memcpy(mt32ram.rhythmTemp, &controlROMData[controlROMMap->rhythmSettings], controlROMMap->rhythmSettingsCount * 4);
+
+#if MT32EMU_MONITOR_INIT
+ printDebug("Initialising Patches");
+#endif
+ for (Bit8u i = 0; i < 128; i++) {
+ PatchParam *patch = &mt32ram.patches[i];
+ patch->timbreGroup = i / 64;
+ patch->timbreNum = i % 64;
+ patch->keyShift = 24;
+ patch->fineTune = 50;
+ patch->benderRange = 12;
+ patch->assignMode = 0;
+ patch->reverbSwitch = 1;
+ patch->dummy = 0;
+ }
+
+#if MT32EMU_MONITOR_INIT
+ printDebug("Initialising System");
+#endif
+ // The MT-32 manual claims that "Standard pitch" is 442Hz.
+ mt32ram.system.masterTune = 0x4A; // Confirmed on CM-64
+ mt32ram.system.reverbMode = 0; // Confirmed
+ mt32ram.system.reverbTime = 5; // Confirmed
+ mt32ram.system.reverbLevel = 3; // Confirmed
+ memcpy(mt32ram.system.reserveSettings, &controlROMData[controlROMMap->reserveSettings], 9); // Confirmed
+ for (Bit8u i = 0; i < 9; i++) {
+ // This is the default: {1, 2, 3, 4, 5, 6, 7, 8, 9}
+ // An alternative configuration can be selected by holding "Master Volume"
+ // and pressing "PART button 1" on the real MT-32's frontpanel.
+ // The channel assignment is then {0, 1, 2, 3, 4, 5, 6, 7, 9}
+ mt32ram.system.chanAssign[i] = i + 1;
+ }
+ mt32ram.system.masterVol = 100; // Confirmed
+ refreshSystem();
+
+ for (int i = 0; i < 9; i++) {
+ MemParams::PatchTemp *patchTemp = &mt32ram.patchTemp[i];
+
+ // Note that except for the rhythm part, these patch fields will be set in setProgram() below anyway.
+ patchTemp->patch.timbreGroup = 0;
+ patchTemp->patch.timbreNum = 0;
+ patchTemp->patch.keyShift = 24;
+ patchTemp->patch.fineTune = 50;
+ patchTemp->patch.benderRange = 12;
+ patchTemp->patch.assignMode = 0;
+ patchTemp->patch.reverbSwitch = 1;
+ patchTemp->patch.dummy = 0;
+
+ patchTemp->outputLevel = 80;
+ patchTemp->panpot = controlROMData[controlROMMap->panSettings + i];
+ memset(patchTemp->dummyv, 0, sizeof(patchTemp->dummyv));
+ patchTemp->dummyv[1] = 127;
+
+ if (i < 8) {
+ parts[i] = new Part(this, i);
+ parts[i]->setProgram(controlROMData[controlROMMap->programSettings + i]);
+ } else {
+ parts[i] = new RhythmPart(this, i);
+ }
+ }
+
+ // For resetting mt32 mid-execution
+ mt32default = mt32ram;
+
+ isOpen = true;
+ isEnabled = false;
+
+#if MT32EMU_MONITOR_INIT
+ printDebug("*** Initialisation complete ***");
+#endif
+ return true;
+}
+
+void Synth::close() {
+ if (!isOpen) {
+ return;
+ }
+
+ delete partialManager;
+ partialManager = NULL;
+
+ for (int i = 0; i < 9; i++) {
+ delete parts[i];
+ parts[i] = NULL;
+ }
+
+ delete[] myProp.baseDir;
+ myProp.baseDir = NULL;
+
+ delete[] pcmWaves;
+ delete[] pcmROMData;
+
+ deleteMemoryRegions();
+
+ for (int i = 0; i < 4; i++) {
+ reverbModels[i]->close();
+ }
+ reverbModel = NULL;
+ isOpen = false;
+}
+
+void Synth::playMsg(Bit32u msg) {
+ // FIXME: Implement active sensing
+ unsigned char code = (unsigned char)((msg & 0x0000F0) >> 4);
+ unsigned char chan = (unsigned char)(msg & 0x00000F);
+ unsigned char note = (unsigned char)((msg & 0x00FF00) >> 8);
+ unsigned char velocity = (unsigned char)((msg & 0xFF0000) >> 16);
+ isEnabled = true;
+
+ //printDebug("Playing chan %d, code 0x%01x note: 0x%02x", chan, code, note);
+
+ char part = chantable[chan];
+ if (part < 0 || part > 8) {
+#if MT32EMU_MONITOR_MIDI > 0
+ printDebug("Play msg on unreg chan %d (%d): code=0x%01x, vel=%d", chan, part, code, velocity);
+#endif
+ return;
+ }
+ playMsgOnPart(part, code, note, velocity);
+}
+
+void Synth::playMsgOnPart(unsigned char part, unsigned char code, unsigned char note, unsigned char velocity) {
+ Bit32u bend;
+
+ //printDebug("Synth::playMsgOnPart(%02x, %02x, %02x, %02x)", part, code, note, velocity);
+ switch (code) {
+ case 0x8:
+ //printDebug("Note OFF - Part %d", part);
+ // The MT-32 ignores velocity for note off
+ parts[part]->noteOff(note);
+ break;
+ case 0x9:
+ //printDebug("Note ON - Part %d, Note %d Vel %d", part, note, velocity);
+ if (velocity == 0) {
+ // MIDI defines note-on with velocity 0 as being the same as note-off with velocity 40
+ parts[part]->noteOff(note);
+ } else {
+ parts[part]->noteOn(note, velocity);
+ }
+ break;
+ case 0xB: // Control change
+ switch (note) {
+ case 0x01: // Modulation
+ //printDebug("Modulation: %d", velocity);
+ parts[part]->setModulation(velocity);
+ break;
+ case 0x06:
+ parts[part]->setDataEntryMSB(velocity);
+ break;
+ case 0x07: // Set volume
+ //printDebug("Volume set: %d", velocity);
+ parts[part]->setVolume(velocity);
+ break;
+ case 0x0A: // Pan
+ //printDebug("Pan set: %d", velocity);
+ parts[part]->setPan(velocity);
+ break;
+ case 0x0B:
+ //printDebug("Expression set: %d", velocity);
+ parts[part]->setExpression(velocity);
+ break;
+ case 0x40: // Hold (sustain) pedal
+ //printDebug("Hold pedal set: %d", velocity);
+ parts[part]->setHoldPedal(velocity >= 64);
+ break;
+
+ case 0x62:
+ case 0x63:
+ parts[part]->setNRPN();
+ break;
+ case 0x64:
+ parts[part]->setRPNLSB(velocity);
+ break;
+ case 0x65:
+ parts[part]->setRPNMSB(velocity);
+ break;
+
+ case 0x79: // Reset all controllers
+ //printDebug("Reset all controllers");
+ parts[part]->resetAllControllers();
+ break;
+
+ case 0x7B: // All notes off
+ //printDebug("All notes off");
+ parts[part]->allNotesOff();
+ break;
+
+ case 0x7C:
+ case 0x7D:
+ case 0x7E:
+ case 0x7F:
+ // CONFIRMED:Mok: A real LAPC-I responds to these controllers as follows:
+ parts[part]->setHoldPedal(false);
+ parts[part]->allNotesOff();
+ break;
+
+ default:
+#if MT32EMU_MONITOR_MIDI > 0
+ printDebug("Unknown MIDI Control code: 0x%02x - vel 0x%02x", note, velocity);
+#endif
+ break;
+ }
+
+ break;
+ case 0xC: // Program change
+ //printDebug("Program change %01x", note);
+ parts[part]->setProgram(note);
+ break;
+ case 0xE: // Pitch bender
+ bend = (velocity << 7) | (note);
+ //printDebug("Pitch bender %02x", bend);
+ parts[part]->setBend(bend);
+ break;
+ default:
+#if MT32EMU_MONITOR_MIDI > 0
+ printDebug("Unknown Midi code: 0x%01x - %02x - %02x", code, note, velocity);
+#endif
+ break;
+ }
+
+ //midiOutShortMsg(m_out, msg);
+}
+
+void Synth::playSysex(const Bit8u *sysex, Bit32u len) {
+ if (len < 2) {
+ printDebug("playSysex: Message is too short for sysex (%d bytes)", len);
+ }
+ if (sysex[0] != 0xF0) {
+ printDebug("playSysex: Message lacks start-of-sysex (0xF0)");
+ return;
+ }
+ // Due to some programs (e.g. Java) sending buffers with junk at the end, we have to go through and find the end marker rather than relying on len.
+ Bit32u endPos;
+ for (endPos = 1; endPos < len; endPos++) {
+ if (sysex[endPos] == 0xF7) {
+ break;
+ }
+ }
+ if (endPos == len) {
+ printDebug("playSysex: Message lacks end-of-sysex (0xf7)");
+ return;
+ }
+ playSysexWithoutFraming(sysex + 1, endPos - 1);
+}
+
+void Synth::playSysexWithoutFraming(const Bit8u *sysex, Bit32u len) {
+ if (len < 4) {
+ printDebug("playSysexWithoutFraming: Message is too short (%d bytes)!", len);
+ return;
+ }
+ if (sysex[0] != SYSEX_MANUFACTURER_ROLAND) {
+ printDebug("playSysexWithoutFraming: Header not intended for this device manufacturer: %02x %02x %02x %02x", (int)sysex[0], (int)sysex[1], (int)sysex[2], (int)sysex[3]);
+ return;
+ }
+ if (sysex[2] == SYSEX_MDL_D50) {
+ printDebug("playSysexWithoutFraming: Header is intended for model D-50 (not yet supported): %02x %02x %02x %02x", (int)sysex[0], (int)sysex[1], (int)sysex[2], (int)sysex[3]);
+ return;
+ } else if (sysex[2] != SYSEX_MDL_MT32) {
+ printDebug("playSysexWithoutFraming: Header not intended for model MT-32: %02x %02x %02x %02x", (int)sysex[0], (int)sysex[1], (int)sysex[2], (int)sysex[3]);
+ return;
+ }
+ playSysexWithoutHeader(sysex[1], sysex[3], sysex + 4, len - 4);
+}
+
+void Synth::playSysexWithoutHeader(unsigned char device, unsigned char command, const Bit8u *sysex, Bit32u len) {
+ if (device > 0x10) {
+ // We have device ID 0x10 (default, but changeable, on real MT-32), < 0x10 is for channels
+ printDebug("playSysexWithoutHeader: Message is not intended for this device ID (provided: %02x, expected: 0x10 or channel)", (int)device);
+ return;
+ }
+ // This is checked early in the real devices (before any sysex length checks or further processing)
+ // FIXME: Response to SYSEX_CMD_DAT reset with partials active (and in general) is untested.
+ if ((command == SYSEX_CMD_DT1 || command == SYSEX_CMD_DAT) && sysex[0] == 0x7F) {
+ reset();
+ return;
+ }
+ if (len < 4) {
+ printDebug("playSysexWithoutHeader: Message is too short (%d bytes)!", len);
+ return;
+ }
+ unsigned char checksum = calcSysexChecksum(sysex, len - 1, 0);
+ if (checksum != sysex[len - 1]) {
+ printDebug("playSysexWithoutHeader: Message checksum is incorrect (provided: %02x, expected: %02x)!", sysex[len - 1], checksum);
+ return;
+ }
+ len -= 1; // Exclude checksum
+ switch (command) {
+ case SYSEX_CMD_DAT:
+ if (hasActivePartials()) {
+ printDebug("playSysexWithoutHeader: Got SYSEX_CMD_DAT but partials are active - ignoring");
+ // FIXME: We should send SYSEX_CMD_RJC in this case
+ break;
+ }
+ // Deliberate fall-through
+ case SYSEX_CMD_DT1:
+ writeSysex(device, sysex, len);
+ break;
+ case SYSEX_CMD_RQD:
+ if (hasActivePartials()) {
+ printDebug("playSysexWithoutHeader: Got SYSEX_CMD_RQD but partials are active - ignoring");
+ // FIXME: We should send SYSEX_CMD_RJC in this case
+ break;
+ }
+ // Deliberate fall-through
+ case SYSEX_CMD_RQ1:
+ readSysex(device, sysex, len);
+ break;
+ default:
+ printDebug("playSysexWithoutHeader: Unsupported command %02x", command);
+ return;
+ }
+}
+
+void Synth::readSysex(unsigned char /*device*/, const Bit8u * /*sysex*/, Bit32u /*len*/) const {
+ // NYI
+}
+
+void Synth::writeSysex(unsigned char device, const Bit8u *sysex, Bit32u len) {
+ Bit32u addr = (sysex[0] << 16) | (sysex[1] << 8) | (sysex[2]);
+ addr = MT32EMU_MEMADDR(addr);
+ sysex += 3;
+ len -= 3;
+ //printDebug("Sysex addr: 0x%06x", MT32EMU_SYSEXMEMADDR(addr));
+ // NOTE: Please keep both lower and upper bounds in each check, for ease of reading
+
+ // Process channel-specific sysex by converting it to device-global
+ if (device < 0x10) {
+#if MT32EMU_MONITOR_SYSEX > 0
+ printDebug("WRITE-CHANNEL: Channel %d temp area 0x%06x", device, MT32EMU_SYSEXMEMADDR(addr));
+#endif
+ if (/*addr >= MT32EMU_MEMADDR(0x000000) && */addr < MT32EMU_MEMADDR(0x010000)) {
+ int offset;
+ if (chantable[device] == -1) {
+#if MT32EMU_MONITOR_SYSEX > 0
+ printDebug(" (Channel not mapped to a part... 0 offset)");
+#endif
+ offset = 0;
+ } else if (chantable[device] == 8) {
+#if MT32EMU_MONITOR_SYSEX > 0
+ printDebug(" (Channel mapped to rhythm... 0 offset)");
+#endif
+ offset = 0;
+ } else {
+ offset = chantable[device] * sizeof(MemParams::PatchTemp);
+#if MT32EMU_MONITOR_SYSEX > 0
+ printDebug(" (Setting extra offset to %d)", offset);
+#endif
+ }
+ addr += MT32EMU_MEMADDR(0x030000) + offset;
+ } else if (/*addr >= MT32EMU_MEMADDR(0x010000) && */ addr < MT32EMU_MEMADDR(0x020000)) {
+ addr += MT32EMU_MEMADDR(0x030110) - MT32EMU_MEMADDR(0x010000);
+ } else if (/*addr >= MT32EMU_MEMADDR(0x020000) && */ addr < MT32EMU_MEMADDR(0x030000)) {
+ int offset;
+ if (chantable[device] == -1) {
+#if MT32EMU_MONITOR_SYSEX > 0
+ printDebug(" (Channel not mapped to a part... 0 offset)");
+#endif
+ offset = 0;
+ } else if (chantable[device] == 8) {
+#if MT32EMU_MONITOR_SYSEX > 0
+ printDebug(" (Channel mapped to rhythm... 0 offset)");
+#endif
+ offset = 0;
+ } else {
+ offset = chantable[device] * sizeof(TimbreParam);
+#if MT32EMU_MONITOR_SYSEX > 0
+ printDebug(" (Setting extra offset to %d)", offset);
+#endif
+ }
+ addr += MT32EMU_MEMADDR(0x040000) - MT32EMU_MEMADDR(0x020000) + offset;
+ } else {
+#if MT32EMU_MONITOR_SYSEX > 0
+ printDebug(" Invalid channel");
+#endif
+ return;
+ }
+ }
+
+ // Process device-global sysex (possibly converted from channel-specific sysex above)
+ for (;;) {
+ // Find the appropriate memory region
+ const MemoryRegion *region = findMemoryRegion(addr);
+
+ if (region == NULL) {
+ printDebug("Sysex write to unrecognised address %06x, len %d", MT32EMU_SYSEXMEMADDR(addr), len);
+ break;
+ }
+ writeMemoryRegion(region, addr, region->getClampedLen(addr, len), sysex);
+
+ Bit32u next = region->next(addr, len);
+ if (next == 0) {
+ break;
+ }
+ addr += next;
+ sysex += next;
+ len -= next;
+ }
+}
+
+void Synth::readMemory(Bit32u addr, Bit32u len, Bit8u *data) {
+ const MemoryRegion *region = findMemoryRegion(addr);
+ if (region != NULL) {
+ readMemoryRegion(region, addr, len, data);
+ }
+}
+
+void Synth::initMemoryRegions() {
+ // Timbre max tables are slightly more complicated than the others, which are used directly from the ROM.
+ // The ROM (sensibly) just has maximums for TimbreParam.commonParam followed by just one TimbreParam.partialParam,
+ // so we produce a table with all partialParams filled out, as well as padding for PaddedTimbre, for quick lookup.
+ paddedTimbreMaxTable = new Bit8u[sizeof(MemParams::PaddedTimbre)];
+ memcpy(&paddedTimbreMaxTable[0], &controlROMData[controlROMMap->timbreMaxTable], sizeof(TimbreParam::CommonParam) + sizeof(TimbreParam::PartialParam)); // commonParam and one partialParam
+ int pos = sizeof(TimbreParam::CommonParam) + sizeof(TimbreParam::PartialParam);
+ for (int i = 0; i < 3; i++) {
+ memcpy(&paddedTimbreMaxTable[pos], &controlROMData[controlROMMap->timbreMaxTable + sizeof(TimbreParam::CommonParam)], sizeof(TimbreParam::PartialParam));
+ pos += sizeof(TimbreParam::PartialParam);
+ }
+ memset(&paddedTimbreMaxTable[pos], 0, 10); // Padding
+ patchTempMemoryRegion = new PatchTempMemoryRegion(this, (Bit8u *)&mt32ram.patchTemp[0], &controlROMData[controlROMMap->patchMaxTable]);
+ rhythmTempMemoryRegion = new RhythmTempMemoryRegion(this, (Bit8u *)&mt32ram.rhythmTemp[0], &controlROMData[controlROMMap->rhythmMaxTable]);
+ timbreTempMemoryRegion = new TimbreTempMemoryRegion(this, (Bit8u *)&mt32ram.timbreTemp[0], paddedTimbreMaxTable);
+ patchesMemoryRegion = new PatchesMemoryRegion(this, (Bit8u *)&mt32ram.patches[0], &controlROMData[controlROMMap->patchMaxTable]);
+ timbresMemoryRegion = new TimbresMemoryRegion(this, (Bit8u *)&mt32ram.timbres[0], paddedTimbreMaxTable);
+ systemMemoryRegion = new SystemMemoryRegion(this, (Bit8u *)&mt32ram.system, &controlROMData[controlROMMap->systemMaxTable]);
+ displayMemoryRegion = new DisplayMemoryRegion(this);
+ resetMemoryRegion = new ResetMemoryRegion(this);
+}
+
+void Synth::deleteMemoryRegions() {
+ delete patchTempMemoryRegion;
+ patchTempMemoryRegion = NULL;
+ delete rhythmTempMemoryRegion;
+ rhythmTempMemoryRegion = NULL;
+ delete timbreTempMemoryRegion;
+ timbreTempMemoryRegion = NULL;
+ delete patchesMemoryRegion;
+ patchesMemoryRegion = NULL;
+ delete timbresMemoryRegion;
+ timbresMemoryRegion = NULL;
+ delete systemMemoryRegion;
+ systemMemoryRegion = NULL;
+ delete displayMemoryRegion;
+ displayMemoryRegion = NULL;
+ delete resetMemoryRegion;
+ resetMemoryRegion = NULL;
+
+ delete[] paddedTimbreMaxTable;
+ paddedTimbreMaxTable = NULL;
+}
+
+MemoryRegion *Synth::findMemoryRegion(Bit32u addr) {
+ MemoryRegion *regions[] = {
+ patchTempMemoryRegion,
+ rhythmTempMemoryRegion,
+ timbreTempMemoryRegion,
+ patchesMemoryRegion,
+ timbresMemoryRegion,
+ systemMemoryRegion,
+ displayMemoryRegion,
+ resetMemoryRegion,
+ NULL
+ };
+ for (int pos = 0; regions[pos] != NULL; pos++) {
+ if (regions[pos]->contains(addr)) {
+ return regions[pos];
+ }
+ }
+ return NULL;
+}
+
+void Synth::readMemoryRegion(const MemoryRegion *region, Bit32u addr, Bit32u len, Bit8u *data) {
+ unsigned int first = region->firstTouched(addr);
+ //unsigned int last = region->lastTouched(addr, len);
+ unsigned int off = region->firstTouchedOffset(addr);
+ len = region->getClampedLen(addr, len);
+
+ unsigned int m;
+
+ if (region->isReadable()) {
+ region->read(first, off, data, len);
+ } else {
+ // FIXME: We might want to do these properly in future
+ for (m = 0; m < len; m += 2) {
+ data[m] = 0xff;
+ if (m + 1 < len) {
+ data[m+1] = (Bit8u)region->type;
+ }
+ }
+ }
+}
+
+void Synth::writeMemoryRegion(const MemoryRegion *region, Bit32u addr, Bit32u len, const Bit8u *data) {
+ unsigned int first = region->firstTouched(addr);
+ unsigned int last = region->lastTouched(addr, len);
+ unsigned int off = region->firstTouchedOffset(addr);
+ switch (region->type) {
+ case MR_PatchTemp:
+ region->write(first, off, data, len);
+ //printDebug("Patch temp: Patch %d, offset %x, len %d", off/16, off % 16, len);
+
+ for (unsigned int i = first; i <= last; i++) {
+ int absTimbreNum = mt32ram.patchTemp[i].patch.timbreGroup * 64 + mt32ram.patchTemp[i].patch.timbreNum;
+ char timbreName[11];
+ memcpy(timbreName, mt32ram.timbres[absTimbreNum].timbre.common.name, 10);
+ timbreName[10] = 0;
+#if MT32EMU_MONITOR_SYSEX > 0
+ printDebug("WRITE-PARTPATCH (%d-%d@%d..%d): %d; timbre=%d (%s), outlevel=%d", first, last, off, off + len, i, absTimbreNum, timbreName, mt32ram.patchTemp[i].outputLevel);
+#endif
+ if (parts[i] != NULL) {
+ if (i != 8) {
+ // Note: Confirmed on CM-64 that we definitely *should* update the timbre here,
+ // but only in the case that the sysex actually writes to those values
+ if (i == first && off > 2) {
+#if MT32EMU_MONITOR_SYSEX > 0
+ printDebug(" (Not updating timbre, since those values weren't touched)");
+#endif
+ } else {
+ parts[i]->setTimbre(&mt32ram.timbres[parts[i]->getAbsTimbreNum()].timbre);
+ }
+ }
+ parts[i]->refresh();
+ }
+ }
+ break;
+ case MR_RhythmTemp:
+ region->write(first, off, data, len);
+ for (unsigned int i = first; i <= last; i++) {
+ int timbreNum = mt32ram.rhythmTemp[i].timbre;
+ char timbreName[11];
+ if (timbreNum < 94) {
+ memcpy(timbreName, mt32ram.timbres[128 + timbreNum].timbre.common.name, 10);
+ timbreName[10] = 0;
+ } else {
+ strcpy(timbreName, "[None]");
+ }
+#if MT32EMU_MONITOR_SYSEX > 0
+ printDebug("WRITE-RHYTHM (%d-%d@%d..%d): %d; level=%02x, panpot=%02x, reverb=%02x, timbre=%d (%s)", first, last, off, off + len, i, mt32ram.rhythmTemp[i].outputLevel, mt32ram.rhythmTemp[i].panpot, mt32ram.rhythmTemp[i].reverbSwitch, mt32ram.rhythmTemp[i].timbre, timbreName);
+#endif
+ }
+ if (parts[8] != NULL) {
+ parts[8]->refresh();
+ }
+ break;
+ case MR_TimbreTemp:
+ region->write(first, off, data, len);
+ for (unsigned int i = first; i <= last; i++) {
+ char instrumentName[11];
+ memcpy(instrumentName, mt32ram.timbreTemp[i].common.name, 10);
+ instrumentName[10] = 0;
+#if MT32EMU_MONITOR_SYSEX > 0
+ printDebug("WRITE-PARTTIMBRE (%d-%d@%d..%d): timbre=%d (%s)", first, last, off, off + len, i, instrumentName);
+#endif
+ if (parts[i] != NULL) {
+ parts[i]->refresh();
+ }
+ }
+ break;
+ case MR_Patches:
+ region->write(first, off, data, len);
+#if MT32EMU_MONITOR_SYSEX > 0
+ for (unsigned int i = first; i <= last; i++) {
+ PatchParam *patch = &mt32ram.patches[i];
+ int patchAbsTimbreNum = patch->timbreGroup * 64 + patch->timbreNum;
+ char instrumentName[11];
+ memcpy(instrumentName, mt32ram.timbres[patchAbsTimbreNum].timbre.common.name, 10);
+ instrumentName[10] = 0;
+ Bit8u *n = (Bit8u *)patch;
+ printDebug("WRITE-PATCH (%d-%d@%d..%d): %d; timbre=%d (%s) %02X%02X%02X%02X%02X%02X%02X%02X", first, last, off, off + len, i, patchAbsTimbreNum, instrumentName, n[0], n[1], n[2], n[3], n[4], n[5], n[6], n[7]);
+ }
+#endif
+ break;
+ case MR_Timbres:
+ // Timbres
+ first += 128;
+ last += 128;
+ region->write(first, off, data, len);
+ for (unsigned int i = first; i <= last; i++) {
+#if MT32EMU_MONITOR_TIMBRES >= 1
+ TimbreParam *timbre = &mt32ram.timbres[i].timbre;
+ char instrumentName[11];
+ memcpy(instrumentName, timbre->common.name, 10);
+ instrumentName[10] = 0;
+ printDebug("WRITE-TIMBRE (%d-%d@%d..%d): %d; name=\"%s\"", first, last, off, off + len, i, instrumentName);
+#if MT32EMU_MONITOR_TIMBRES >= 2
+#define DT(x) printDebug(" " #x ": %d", timbre->x)
+ DT(common.partialStructure12);
+ DT(common.partialStructure34);
+ DT(common.partialMute);
+ DT(common.noSustain);
+
+#define DTP(x) \
+ DT(partial[x].wg.pitchCoarse); \
+ DT(partial[x].wg.pitchFine); \
+ DT(partial[x].wg.pitchKeyfollow); \
+ DT(partial[x].wg.pitchBenderEnabled); \
+ DT(partial[x].wg.waveform); \
+ DT(partial[x].wg.pcmWave); \
+ DT(partial[x].wg.pulseWidth); \
+ DT(partial[x].wg.pulseWidthVeloSensitivity); \
+ DT(partial[x].pitchEnv.depth); \
+ DT(partial[x].pitchEnv.veloSensitivity); \
+ DT(partial[x].pitchEnv.timeKeyfollow); \
+ DT(partial[x].pitchEnv.time[0]); \
+ DT(partial[x].pitchEnv.time[1]); \
+ DT(partial[x].pitchEnv.time[2]); \
+ DT(partial[x].pitchEnv.time[3]); \
+ DT(partial[x].pitchEnv.level[0]); \
+ DT(partial[x].pitchEnv.level[1]); \
+ DT(partial[x].pitchEnv.level[2]); \
+ DT(partial[x].pitchEnv.level[3]); \
+ DT(partial[x].pitchEnv.level[4]); \
+ DT(partial[x].pitchLFO.rate); \
+ DT(partial[x].pitchLFO.depth); \
+ DT(partial[x].pitchLFO.modSensitivity); \
+ DT(partial[x].tvf.cutoff); \
+ DT(partial[x].tvf.resonance); \
+ DT(partial[x].tvf.keyfollow); \
+ DT(partial[x].tvf.biasPoint); \
+ DT(partial[x].tvf.biasLevel); \
+ DT(partial[x].tvf.envDepth); \
+ DT(partial[x].tvf.envVeloSensitivity); \
+ DT(partial[x].tvf.envDepthKeyfollow); \
+ DT(partial[x].tvf.envTimeKeyfollow); \
+ DT(partial[x].tvf.envTime[0]); \
+ DT(partial[x].tvf.envTime[1]); \
+ DT(partial[x].tvf.envTime[2]); \
+ DT(partial[x].tvf.envTime[3]); \
+ DT(partial[x].tvf.envTime[4]); \
+ DT(partial[x].tvf.envLevel[0]); \
+ DT(partial[x].tvf.envLevel[1]); \
+ DT(partial[x].tvf.envLevel[2]); \
+ DT(partial[x].tvf.envLevel[3]); \
+ DT(partial[x].tva.level); \
+ DT(partial[x].tva.veloSensitivity); \
+ DT(partial[x].tva.biasPoint1); \
+ DT(partial[x].tva.biasLevel1); \
+ DT(partial[x].tva.biasPoint2); \
+ DT(partial[x].tva.biasLevel2); \
+ DT(partial[x].tva.envTimeKeyfollow); \
+ DT(partial[x].tva.envTimeVeloSensitivity); \
+ DT(partial[x].tva.envTime[0]); \
+ DT(partial[x].tva.envTime[1]); \
+ DT(partial[x].tva.envTime[2]); \
+ DT(partial[x].tva.envTime[3]); \
+ DT(partial[x].tva.envTime[4]); \
+ DT(partial[x].tva.envLevel[0]); \
+ DT(partial[x].tva.envLevel[1]); \
+ DT(partial[x].tva.envLevel[2]); \
+ DT(partial[x].tva.envLevel[3]);
+
+ DTP(0);
+ DTP(1);
+ DTP(2);
+ DTP(3);
+#undef DTP
+#undef DT
+#endif
+#endif
+ // FIXME:KG: Not sure if the stuff below should be done (for rhythm and/or parts)...
+ // Does the real MT-32 automatically do this?
+ for (unsigned int part = 0; part < 9; part++) {
+ if (parts[part] != NULL) {
+ parts[part]->refreshTimbre(i);
+ }
+ }
+ }
+ break;
+ case MR_System:
+ region->write(0, off, data, len);
+
+ report(ReportType_devReconfig, NULL);
+ // FIXME: We haven't properly confirmed any of this behaviour
+ // In particular, we tend to reset things such as reverb even if the write contained
+ // the same parameters as were already set, which may be wrong.
+ // On the other hand, the real thing could be resetting things even when they aren't touched
+ // by the write at all.
+#if MT32EMU_MONITOR_SYSEX > 0
+ printDebug("WRITE-SYSTEM:");
+#endif
+ if (off <= SYSTEM_MASTER_TUNE_OFF && off + len > SYSTEM_MASTER_TUNE_OFF) {
+ refreshSystemMasterTune();
+ }
+ if (off <= SYSTEM_REVERB_LEVEL_OFF && off + len > SYSTEM_REVERB_MODE_OFF) {
+ refreshSystemReverbParameters();
+ }
+ if (off <= SYSTEM_RESERVE_SETTINGS_END_OFF && off + len > SYSTEM_RESERVE_SETTINGS_START_OFF) {
+ refreshSystemReserveSettings();
+ }
+ if (off <= SYSTEM_CHAN_ASSIGN_END_OFF && off + len > SYSTEM_CHAN_ASSIGN_START_OFF) {
+ int firstPart = off - SYSTEM_CHAN_ASSIGN_START_OFF;
+ if(firstPart < 0)
+ firstPart = 0;
+ int lastPart = off + len - SYSTEM_CHAN_ASSIGN_START_OFF;
+ if(lastPart > 9)
+ lastPart = 9;
+ refreshSystemChanAssign(firstPart, lastPart);
+ }
+ if (off <= SYSTEM_MASTER_VOL_OFF && off + len > SYSTEM_MASTER_VOL_OFF) {
+ refreshSystemMasterVol();
+ }
+ break;
+ case MR_Display:
+ char buf[MAX_SYSEX_SIZE];
+ memcpy(&buf, &data[0], len);
+ buf[len] = 0;
+#if MT32EMU_MONITOR_SYSEX > 0
+ printDebug("WRITE-LCD: %s", buf);
+#endif
+ report(ReportType_lcdMessage, buf);
+ break;
+ case MR_Reset:
+ reset();
+ break;
+ }
+}
+
+void Synth::refreshSystemMasterTune() {
+#if MT32EMU_MONITOR_SYSEX > 0
+ //FIXME:KG: This is just an educated guess.
+ // The LAPC-I documentation claims a range of 427.5Hz-452.6Hz (similar to what we have here)
+ // The MT-32 documentation claims a range of 432.1Hz-457.6Hz
+ float masterTune = 440.0f * EXP2F((mt32ram.system.masterTune - 64.0f) / (128.0f * 12.0f));
+ printDebug(" Master Tune: %f", masterTune);
+#endif
+}
+
+void Synth::refreshSystemReverbParameters() {
+#if MT32EMU_MONITOR_SYSEX > 0
+ printDebug(" Reverb: mode=%d, time=%d, level=%d", mt32ram.system.reverbMode, mt32ram.system.reverbTime, mt32ram.system.reverbLevel);
+#endif
+ if (reverbOverridden && reverbModel != NULL) {
+#if MT32EMU_MONITOR_SYSEX > 0
+ printDebug(" (Reverb overridden - ignoring)");
+#endif
+ return;
+ }
+ report(ReportType_newReverbMode, &mt32ram.system.reverbMode);
+ report(ReportType_newReverbTime, &mt32ram.system.reverbTime);
+ report(ReportType_newReverbLevel, &mt32ram.system.reverbLevel);
+
+ ReverbModel *newReverbModel = reverbModels[mt32ram.system.reverbMode];
+#if MT32EMU_REDUCE_REVERB_MEMORY
+ if (reverbModel != newReverbModel) {
+ if (reverbModel != NULL) {
+ reverbModel->close();
+ }
+ newReverbModel->open(myProp.sampleRate);
+ }
+#endif
+ reverbModel = newReverbModel;
+ reverbModel->setParameters(mt32ram.system.reverbTime, mt32ram.system.reverbLevel);
+}
+
+void Synth::refreshSystemReserveSettings() {
+ Bit8u *rset = mt32ram.system.reserveSettings;
+#if MT32EMU_MONITOR_SYSEX > 0
+ printDebug(" Partial reserve: 1=%02d 2=%02d 3=%02d 4=%02d 5=%02d 6=%02d 7=%02d 8=%02d Rhythm=%02d", rset[0], rset[1], rset[2], rset[3], rset[4], rset[5], rset[6], rset[7], rset[8]);
+#endif
+ partialManager->setReserve(rset);
+}
+
+void Synth::refreshSystemChanAssign(unsigned int firstPart, unsigned int lastPart) {
+ memset(chantable, -1, sizeof(chantable));
+
+ // CONFIRMED: In the case of assigning a channel to multiple parts, the lower part wins.
+ for (unsigned int i = 0; i <= 8; i++) {
+ if (parts[i] != NULL && i >= firstPart && i <= lastPart) {
+ // CONFIRMED: Decay is started for all polys, and all controllers are reset, for every part whose assignment was touched by the sysex write.
+ parts[i]->allSoundOff();
+ parts[i]->resetAllControllers();
+ }
+ int chan = mt32ram.system.chanAssign[i];
+ if (chan != 16 && chantable[chan] == -1) {
+ chantable[chan] = i;
+ }
+ }
+
+#if MT32EMU_MONITOR_SYSEX > 0
+ Bit8u *rset = mt32ram.system.chanAssign;
+ printDebug(" Part assign: 1=%02d 2=%02d 3=%02d 4=%02d 5=%02d 6=%02d 7=%02d 8=%02d Rhythm=%02d", rset[0], rset[1], rset[2], rset[3], rset[4], rset[5], rset[6], rset[7], rset[8]);
+#endif
+}
+
+void Synth::refreshSystemMasterVol() {
+#if MT32EMU_MONITOR_SYSEX > 0
+ printDebug(" Master volume: %d", mt32ram.system.masterVol);
+#endif
+}
+
+void Synth::refreshSystem() {
+ refreshSystemMasterTune();
+ refreshSystemReverbParameters();
+ refreshSystemReserveSettings();
+ refreshSystemChanAssign(0, 8);
+ refreshSystemMasterVol();
+}
+
+void Synth::reset() {
+#if MT32EMU_MONITOR_SYSEX > 0
+ printDebug("RESET");
+#endif
+ report(ReportType_devReset, NULL);
+ partialManager->deactivateAll();
+ mt32ram = mt32default;
+ for (int i = 0; i < 9; i++) {
+ parts[i]->reset();
+ if (i != 8) {
+ parts[i]->setProgram(controlROMData[controlROMMap->programSettings + i]);
+ } else {
+ parts[8]->refresh();
+ }
+ }
+ refreshSystem();
+ isEnabled = false;
+}
+
+void Synth::render(Bit16s *stream, Bit32u len) {
+ if (!isEnabled) {
+ memset(stream, 0, len * sizeof(Bit16s) * 2);
+ return;
+ }
+ while (len > 0) {
+ Bit32u thisLen = len > MAX_SAMPLES_PER_RUN ? MAX_SAMPLES_PER_RUN : len;
+ renderStreams(tmpNonReverbLeft, tmpNonReverbRight, tmpReverbDryLeft, tmpReverbDryRight, tmpReverbWetLeft, tmpReverbWetRight, thisLen);
+ for (Bit32u i = 0; i < thisLen; i++) {
+ stream[0] = clipBit16s((Bit32s)tmpNonReverbLeft[i] + (Bit32s)tmpReverbDryLeft[i] + (Bit32s)tmpReverbWetLeft[i]);
+ stream[1] = clipBit16s((Bit32s)tmpNonReverbRight[i] + (Bit32s)tmpReverbDryRight[i] + (Bit32s)tmpReverbWetRight[i]);
+ stream += 2;
+ }
+ len -= thisLen;
+ }
+}
+
+bool Synth::prerender() {
+ int newPrerenderWriteIx = (prerenderWriteIx + 1) % MAX_PRERENDER_SAMPLES;
+ if (newPrerenderWriteIx == prerenderReadIx) {
+ // The prerender buffer is full
+ return false;
+ }
+ doRenderStreams(
+ prerenderNonReverbLeft + prerenderWriteIx,
+ prerenderNonReverbRight + prerenderWriteIx,
+ prerenderReverbDryLeft + prerenderWriteIx,
+ prerenderReverbDryRight + prerenderWriteIx,
+ prerenderReverbWetLeft + prerenderWriteIx,
+ prerenderReverbWetRight + prerenderWriteIx,
+ 1);
+ prerenderWriteIx = newPrerenderWriteIx;
+ return true;
+}
+
+static inline void maybeCopy(Bit16s *out, Bit32u outPos, Bit16s *in, Bit32u inPos, Bit32u len) {
+ if (out == NULL) {
+ return;
+ }
+ memcpy(out + outPos, in + inPos, len * sizeof(Bit16s));
+}
+
+void Synth::copyPrerender(Bit16s *nonReverbLeft, Bit16s *nonReverbRight, Bit16s *reverbDryLeft, Bit16s *reverbDryRight, Bit16s *reverbWetLeft, Bit16s *reverbWetRight, Bit32u pos, Bit32u len) {
+ maybeCopy(nonReverbLeft, pos, prerenderNonReverbLeft, prerenderReadIx, len);
+ maybeCopy(nonReverbRight, pos, prerenderNonReverbRight, prerenderReadIx, len);
+ maybeCopy(reverbDryLeft, pos, prerenderReverbDryLeft, prerenderReadIx, len);
+ maybeCopy(reverbDryRight, pos, prerenderReverbDryRight, prerenderReadIx, len);
+ maybeCopy(reverbWetLeft, pos, prerenderReverbWetLeft, prerenderReadIx, len);
+ maybeCopy(reverbWetRight, pos, prerenderReverbWetRight, prerenderReadIx, len);
+}
+
+void Synth::checkPrerender(Bit16s *nonReverbLeft, Bit16s *nonReverbRight, Bit16s *reverbDryLeft, Bit16s *reverbDryRight, Bit16s *reverbWetLeft, Bit16s *reverbWetRight, Bit32u &pos, Bit32u &len) {
+ if (prerenderReadIx > prerenderWriteIx) {
+ // There's data in the prerender buffer, and the write index has wrapped.
+ Bit32u prerenderCopyLen = MAX_PRERENDER_SAMPLES - prerenderReadIx;
+ if (prerenderCopyLen > len) {
+ prerenderCopyLen = len;
+ }
+ copyPrerender(nonReverbLeft, nonReverbRight, reverbDryLeft, reverbDryRight, reverbWetLeft, reverbWetRight, pos, prerenderCopyLen);
+ len -= prerenderCopyLen;
+ pos += prerenderCopyLen;
+ prerenderReadIx = (prerenderReadIx + prerenderCopyLen) % MAX_PRERENDER_SAMPLES;
+ }
+ if (prerenderReadIx < prerenderWriteIx) {
+ // There's data in the prerender buffer, and the write index is ahead of the read index.
+ Bit32u prerenderCopyLen = prerenderWriteIx - prerenderReadIx;
+ if (prerenderCopyLen > len) {
+ prerenderCopyLen = len;
+ }
+ copyPrerender(nonReverbLeft, nonReverbRight, reverbDryLeft, reverbDryRight, reverbWetLeft, reverbWetRight, pos, prerenderCopyLen);
+ len -= prerenderCopyLen;
+ pos += prerenderCopyLen;
+ prerenderReadIx += prerenderCopyLen;
+ }
+ if (prerenderReadIx == prerenderWriteIx) {
+ // If the ring buffer's empty, reset it to start at 0 to minimise wrapping,
+ // which requires two writes instead of one.
+ prerenderReadIx = prerenderWriteIx = 0;
+ }
+}
+
+void Synth::renderStreams(Bit16s *nonReverbLeft, Bit16s *nonReverbRight, Bit16s *reverbDryLeft, Bit16s *reverbDryRight, Bit16s *reverbWetLeft, Bit16s *reverbWetRight, Bit32u len) {
+ if (!isEnabled) {
+ clearIfNonNull(nonReverbLeft, len);
+ clearIfNonNull(nonReverbRight, len);
+ clearIfNonNull(reverbDryLeft, len);
+ clearIfNonNull(reverbDryRight, len);
+ clearIfNonNull(reverbWetLeft, len);
+ clearIfNonNull(reverbWetRight, len);
+ return;
+ }
+ Bit32u pos = 0;
+
+ // First, check for data in the prerender buffer and spit that out before generating anything new.
+ // Note that the prerender buffer is rarely used - see comments elsewhere for details.
+ checkPrerender(nonReverbLeft, nonReverbRight, reverbDryLeft, reverbDryRight, reverbWetLeft, reverbWetRight, pos, len);
+
+ while (len > 0) {
+ Bit32u thisLen = len > MAX_SAMPLES_PER_RUN ? MAX_SAMPLES_PER_RUN : len;
+ doRenderStreams(
+ streamOffset(nonReverbLeft, pos),
+ streamOffset(nonReverbRight, pos),
+ streamOffset(reverbDryLeft, pos),
+ streamOffset(reverbDryRight, pos),
+ streamOffset(reverbWetLeft, pos),
+ streamOffset(reverbWetRight, pos),
+ thisLen);
+ len -= thisLen;
+ pos += thisLen;
+ }
+}
+
+// FIXME: Using more temporary buffers than we need to
+void Synth::doRenderStreams(Bit16s *nonReverbLeft, Bit16s *nonReverbRight, Bit16s *reverbDryLeft, Bit16s *reverbDryRight, Bit16s *reverbWetLeft, Bit16s *reverbWetRight, Bit32u len) {
+ clearFloats(&tmpBufMixLeft[0], &tmpBufMixRight[0], len);
+ if (!reverbEnabled) {
+ for (unsigned int i = 0; i < MT32EMU_MAX_PARTIALS; i++) {
+ if (partialManager->produceOutput(i, &tmpBufPartialLeft[0], &tmpBufPartialRight[0], len)) {
+ mix(&tmpBufMixLeft[0], &tmpBufPartialLeft[0], len);
+ mix(&tmpBufMixRight[0], &tmpBufPartialRight[0], len);
+ }
+ }
+ if (nonReverbLeft != NULL) {
+ la32FloatToBit16sFunc(nonReverbLeft, &tmpBufMixLeft[0], len, outputGain);
+ }
+ if (nonReverbRight != NULL) {
+ la32FloatToBit16sFunc(nonReverbRight, &tmpBufMixRight[0], len, outputGain);
+ }
+ clearIfNonNull(reverbDryLeft, len);
+ clearIfNonNull(reverbDryRight, len);
+ clearIfNonNull(reverbWetLeft, len);
+ clearIfNonNull(reverbWetRight, len);
+ } else {
+ for (unsigned int i = 0; i < MT32EMU_MAX_PARTIALS; i++) {
+ if (!partialManager->shouldReverb(i)) {
+ if (partialManager->produceOutput(i, &tmpBufPartialLeft[0], &tmpBufPartialRight[0], len)) {
+ mix(&tmpBufMixLeft[0], &tmpBufPartialLeft[0], len);
+ mix(&tmpBufMixRight[0], &tmpBufPartialRight[0], len);
+ }
+ }
+ }
+ if (nonReverbLeft != NULL) {
+ la32FloatToBit16sFunc(nonReverbLeft, &tmpBufMixLeft[0], len, outputGain);
+ }
+ if (nonReverbRight != NULL) {
+ la32FloatToBit16sFunc(nonReverbRight, &tmpBufMixRight[0], len, outputGain);
+ }
+
+ clearFloats(&tmpBufMixLeft[0], &tmpBufMixRight[0], len);
+ for (unsigned int i = 0; i < MT32EMU_MAX_PARTIALS; i++) {
+ if (partialManager->shouldReverb(i)) {
+ if (partialManager->produceOutput(i, &tmpBufPartialLeft[0], &tmpBufPartialRight[0], len)) {
+ mix(&tmpBufMixLeft[0], &tmpBufPartialLeft[0], len);
+ mix(&tmpBufMixRight[0], &tmpBufPartialRight[0], len);
+ }
+ }
+ }
+ if (reverbDryLeft != NULL) {
+ la32FloatToBit16sFunc(reverbDryLeft, &tmpBufMixLeft[0], len, outputGain);
+ }
+ if (reverbDryRight != NULL) {
+ la32FloatToBit16sFunc(reverbDryRight, &tmpBufMixRight[0], len, outputGain);
+ }
+
+ // FIXME: Note that on the real devices, reverb input and output are signed linear 16-bit (well, kinda, there's some fudging) PCM, not float.
+ reverbModel->process(&tmpBufMixLeft[0], &tmpBufMixRight[0], &tmpBufReverbOutLeft[0], &tmpBufReverbOutRight[0], len);
+ if (reverbWetLeft != NULL) {
+ reverbFloatToBit16sFunc(reverbWetLeft, &tmpBufReverbOutLeft[0], len, reverbOutputGain);
+ }
+ if (reverbWetRight != NULL) {
+ reverbFloatToBit16sFunc(reverbWetRight, &tmpBufReverbOutRight[0], len, reverbOutputGain);
+ }
+ }
+ partialManager->clearAlreadyOutputed();
+ renderedSampleCount += len;
+}
+
+void Synth::printPartialUsage(unsigned long sampleOffset) {
+ unsigned int partialUsage[9];
+ partialManager->getPerPartPartialUsage(partialUsage);
+ if (sampleOffset > 0) {
+ printDebug("[+%lu] Partial Usage: 1:%02d 2:%02d 3:%02d 4:%02d 5:%02d 6:%02d 7:%02d 8:%02d R: %02d TOTAL: %02d", sampleOffset, partialUsage[0], partialUsage[1], partialUsage[2], partialUsage[3], partialUsage[4], partialUsage[5], partialUsage[6], partialUsage[7], partialUsage[8], MT32EMU_MAX_PARTIALS - partialManager->getFreePartialCount());
+ } else {
+ printDebug("Partial Usage: 1:%02d 2:%02d 3:%02d 4:%02d 5:%02d 6:%02d 7:%02d 8:%02d R: %02d TOTAL: %02d", partialUsage[0], partialUsage[1], partialUsage[2], partialUsage[3], partialUsage[4], partialUsage[5], partialUsage[6], partialUsage[7], partialUsage[8], MT32EMU_MAX_PARTIALS - partialManager->getFreePartialCount());
+ }
+}
+
+bool Synth::hasActivePartials() const {
+ if (prerenderReadIx != prerenderWriteIx) {
+ // Data in the prerender buffer means that the current isActive() states are "in the future".
+ // It also means that partials are definitely active at this render point.
+ return true;
+ }
+ for (int partialNum = 0; partialNum < MT32EMU_MAX_PARTIALS; partialNum++) {
+ if (partialManager->getPartial(partialNum)->isActive()) {
+ return true;
+ }
+ }
+ return false;
+}
+
+bool Synth::isActive() const {
+ if (hasActivePartials()) {
+ return true;
+ }
+ if (reverbEnabled) {
+ return reverbModel->isActive();
+ }
+ return false;
+}
+
+const Partial *Synth::getPartial(unsigned int partialNum) const {
+ return partialManager->getPartial(partialNum);
+}
+
+const Part *Synth::getPart(unsigned int partNum) const {
+ if (partNum > 8) {
+ return NULL;
+ }
+ return parts[partNum];
+}
+
+void MemoryRegion::read(unsigned int entry, unsigned int off, Bit8u *dst, unsigned int len) const {
+ off += entry * entrySize;
+ // This method should never be called with out-of-bounds parameters,
+ // or on an unsupported region - seeing any of this debug output indicates a bug in the emulator
+ if (off > entrySize * entries - 1) {
+#if MT32EMU_MONITOR_SYSEX > 0
+ synth->printDebug("read[%d]: parameters start out of bounds: entry=%d, off=%d, len=%d", type, entry, off, len);
+#endif
+ return;
+ }
+ if (off + len > entrySize * entries) {
+#if MT32EMU_MONITOR_SYSEX > 0
+ synth->printDebug("read[%d]: parameters end out of bounds: entry=%d, off=%d, len=%d", type, entry, off, len);
+#endif
+ len = entrySize * entries - off;
+ }
+ Bit8u *src = getRealMemory();
+ if (src == NULL) {
+#if MT32EMU_MONITOR_SYSEX > 0
+ synth->printDebug("read[%d]: unreadable region: entry=%d, off=%d, len=%d", type, entry, off, len);
+#endif
+ return;
+ }
+ memcpy(dst, src + off, len);
+}
+
+void MemoryRegion::write(unsigned int entry, unsigned int off, const Bit8u *src, unsigned int len, bool init) const {
+ unsigned int memOff = entry * entrySize + off;
+ // This method should never be called with out-of-bounds parameters,
+ // or on an unsupported region - seeing any of this debug output indicates a bug in the emulator
+ if (off > entrySize * entries - 1) {
+#if MT32EMU_MONITOR_SYSEX > 0
+ synth->printDebug("write[%d]: parameters start out of bounds: entry=%d, off=%d, len=%d", type, entry, off, len);
+#endif
+ return;
+ }
+ if (off + len > entrySize * entries) {
+#if MT32EMU_MONITOR_SYSEX > 0
+ synth->printDebug("write[%d]: parameters end out of bounds: entry=%d, off=%d, len=%d", type, entry, off, len);
+#endif
+ len = entrySize * entries - off;
+ }
+ Bit8u *dest = getRealMemory();
+ if (dest == NULL) {
+#if MT32EMU_MONITOR_SYSEX > 0
+ synth->printDebug("write[%d]: unwritable region: entry=%d, off=%d, len=%d", type, entry, off, len);
+#endif
+ }
+
+ for (unsigned int i = 0; i < len; i++) {
+ Bit8u desiredValue = src[i];
+ Bit8u maxValue = getMaxValue(memOff);
+ // maxValue == 0 means write-protected unless called from initialisation code, in which case it really means the maximum value is 0.
+ if (maxValue != 0 || init) {
+ if (desiredValue > maxValue) {
+#if MT32EMU_MONITOR_SYSEX > 0
+ synth->printDebug("write[%d]: Wanted 0x%02x at %d, but max 0x%02x", type, desiredValue, memOff, maxValue);
+#endif
+ desiredValue = maxValue;
+ }
+ dest[memOff] = desiredValue;
+ } else if (desiredValue != 0) {
+#if MT32EMU_MONITOR_SYSEX > 0
+ // Only output debug info if they wanted to write non-zero, since a lot of things cause this to spit out a lot of debug info otherwise.
+ synth->printDebug("write[%d]: Wanted 0x%02x at %d, but write-protected", type, desiredValue, memOff);
+#endif
+ }
+ memOff++;
+ }
+}
+
+}
diff --git a/audio/softsynth/mt32/Synth.h b/audio/softsynth/mt32/Synth.h
new file mode 100644
index 0000000000..ccabce7282
--- /dev/null
+++ b/audio/softsynth/mt32/Synth.h
@@ -0,0 +1,471 @@
+/* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher
+ * Copyright (C) 2011 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef MT32EMU_SYNTH_H
+#define MT32EMU_SYNTH_H
+
+//#include <cstdarg>
+
+namespace MT32Emu {
+
+class TableInitialiser;
+class Partial;
+class PartialManager;
+class Part;
+
+/**
+ * Methods for emulating the connection between the LA32 and the DAC, which involves
+ * some hacks in the real devices for doubling the volume.
+ * See also http://en.wikipedia.org/wiki/Roland_MT-32#Digital_overflow
+ */
+enum DACInputMode {
+ // Produces samples at double the volume, without tricks.
+ // * Nicer overdrive characteristics than the DAC hacks (it simply clips samples within range)
+ // * Higher quality than the real devices
+ DACInputMode_NICE,
+
+ // Produces samples that exactly match the bits output from the emulated LA32.
+ // * Nicer overdrive characteristics than the DAC hacks (it simply clips samples within range)
+ // * Much less likely to overdrive than any other mode.
+ // * Half the volume of any of the other modes, meaning its volume relative to the reverb
+ // output when mixed together directly will sound wrong.
+ // * Perfect for developers while debugging :)
+ DACInputMode_PURE,
+
+ // Re-orders the LA32 output bits as in early generation MT-32s (according to Wikipedia).
+ // Bit order at DAC (where each number represents the original LA32 output bit number, and XX means the bit is always low):
+ // 15 13 12 11 10 09 08 07 06 05 04 03 02 01 00 XX
+ DACInputMode_GENERATION1,
+
+ // Re-orders the LA32 output bits as in later generations (personally confirmed on my CM-32L - KG).
+ // Bit order at DAC (where each number represents the original LA32 output bit number):
+ // 15 13 12 11 10 09 08 07 06 05 04 03 02 01 00 14
+ DACInputMode_GENERATION2
+};
+
+enum ReportType {
+ // Errors
+ ReportType_errorControlROM = 1,
+ ReportType_errorPCMROM,
+ ReportType_errorSampleRate,
+
+ // Progress
+ ReportType_progressInit,
+
+ // HW spec
+ ReportType_availableSSE,
+ ReportType_available3DNow,
+ ReportType_usingSSE,
+ ReportType_using3DNow,
+
+ // General info
+ ReportType_lcdMessage,
+ ReportType_devReset,
+ ReportType_devReconfig,
+ ReportType_newReverbMode,
+ ReportType_newReverbTime,
+ ReportType_newReverbLevel
+};
+
+enum LoadResult {
+ LoadResult_OK,
+ LoadResult_NotFound,
+ LoadResult_Unreadable,
+ LoadResult_Invalid
+};
+
+struct SynthProperties {
+ // Sample rate to use in mixing
+ unsigned int sampleRate;
+
+ // Deprecated - ignored. Use Synth::setReverbEnabled() instead.
+ bool useReverb;
+ // Deprecated - ignored. Use Synth::setReverbOverridden() instead.
+ bool useDefaultReverb;
+ // Deprecated - ignored. Use Synth::playSysex*() to configure reverb instead.
+ unsigned char reverbType;
+ // Deprecated - ignored. Use Synth::playSysex*() to configure reverb instead.
+ unsigned char reverbTime;
+ // Deprecated - ignored. Use Synth::playSysex*() to configure reverb instead.
+ unsigned char reverbLevel;
+ // The name of the directory in which the ROM and data files are stored (with trailing slash/backslash)
+ // Not used if "openFile" is set. May be NULL in any case.
+ const char *baseDir;
+ // This is used as the first argument to all callbacks
+ void *userData;
+ // Callback for reporting various errors and information. May be NULL
+ int (*report)(void *userData, ReportType type, const void *reportData);
+ // Callback for debug messages, in vprintf() format
+ void (*printDebug)(void *userData, const char *fmt, va_list list);
+ // Callback for providing an implementation of File, opened and ready for use
+ // May be NULL, in which case a default implementation will be used.
+ Common::File *(*openFile)(void *userData, const char *filename);
+ // Callback for closing a File. May be NULL, in which case the File will automatically be close()d/deleted.
+ void (*closeFile)(void *userData, Common::File *file);
+};
+
+// This is the specification of the Callback routine used when calling the RecalcWaveforms
+// function
+typedef void (*recalcStatusCallback)(int percDone);
+
+typedef void (*FloatToBit16sFunc)(Bit16s *target, const float *source, Bit32u len, float outputGain);
+
+const Bit8u SYSEX_MANUFACTURER_ROLAND = 0x41;
+
+const Bit8u SYSEX_MDL_MT32 = 0x16;
+const Bit8u SYSEX_MDL_D50 = 0x14;
+
+const Bit8u SYSEX_CMD_RQ1 = 0x11; // Request data #1
+const Bit8u SYSEX_CMD_DT1 = 0x12; // Data set 1
+const Bit8u SYSEX_CMD_WSD = 0x40; // Want to send data
+const Bit8u SYSEX_CMD_RQD = 0x41; // Request data
+const Bit8u SYSEX_CMD_DAT = 0x42; // Data set
+const Bit8u SYSEX_CMD_ACK = 0x43; // Acknowledge
+const Bit8u SYSEX_CMD_EOD = 0x45; // End of data
+const Bit8u SYSEX_CMD_ERR = 0x4E; // Communications error
+const Bit8u SYSEX_CMD_RJC = 0x4F; // Rejection
+
+const int MAX_SYSEX_SIZE = 512;
+
+const unsigned int CONTROL_ROM_SIZE = 64 * 1024;
+
+struct ControlROMPCMStruct {
+ Bit8u pos;
+ Bit8u len;
+ Bit8u pitchLSB;
+ Bit8u pitchMSB;
+};
+
+struct ControlROMMap {
+ Bit16u idPos;
+ Bit16u idLen;
+ const char *idBytes;
+ Bit16u pcmTable; // 4 * pcmCount bytes
+ Bit16u pcmCount;
+ Bit16u timbreAMap; // 128 bytes
+ Bit16u timbreAOffset;
+ bool timbreACompressed;
+ Bit16u timbreBMap; // 128 bytes
+ Bit16u timbreBOffset;
+ bool timbreBCompressed;
+ Bit16u timbreRMap; // 2 * timbreRCount bytes
+ Bit16u timbreRCount;
+ Bit16u rhythmSettings; // 4 * rhythmSettingsCount bytes
+ Bit16u rhythmSettingsCount;
+ Bit16u reserveSettings; // 9 bytes
+ Bit16u panSettings; // 8 bytes
+ Bit16u programSettings; // 8 bytes
+ Bit16u rhythmMaxTable; // 4 bytes
+ Bit16u patchMaxTable; // 16 bytes
+ Bit16u systemMaxTable; // 23 bytes
+ Bit16u timbreMaxTable; // 72 bytes
+};
+
+enum MemoryRegionType {
+ MR_PatchTemp, MR_RhythmTemp, MR_TimbreTemp, MR_Patches, MR_Timbres, MR_System, MR_Display, MR_Reset
+};
+
+class MemoryRegion {
+private:
+ Synth *synth;
+ Bit8u *realMemory;
+ Bit8u *maxTable;
+public:
+ MemoryRegionType type;
+ Bit32u startAddr, entrySize, entries;
+
+ MemoryRegion(Synth *useSynth, Bit8u *useRealMemory, Bit8u *useMaxTable, MemoryRegionType useType, Bit32u useStartAddr, Bit32u useEntrySize, Bit32u useEntries) {
+ synth = useSynth;
+ realMemory = useRealMemory;
+ maxTable = useMaxTable;
+ type = useType;
+ startAddr = useStartAddr;
+ entrySize = useEntrySize;
+ entries = useEntries;
+ }
+ int lastTouched(Bit32u addr, Bit32u len) const {
+ return (offset(addr) + len - 1) / entrySize;
+ }
+ int firstTouchedOffset(Bit32u addr) const {
+ return offset(addr) % entrySize;
+ }
+ int firstTouched(Bit32u addr) const {
+ return offset(addr) / entrySize;
+ }
+ Bit32u regionEnd() const {
+ return startAddr + entrySize * entries;
+ }
+ bool contains(Bit32u addr) const {
+ return addr >= startAddr && addr < regionEnd();
+ }
+ int offset(Bit32u addr) const {
+ return addr - startAddr;
+ }
+ Bit32u getClampedLen(Bit32u addr, Bit32u len) const {
+ if (addr + len > regionEnd())
+ return regionEnd() - addr;
+ return len;
+ }
+ Bit32u next(Bit32u addr, Bit32u len) const {
+ if (addr + len > regionEnd()) {
+ return regionEnd() - addr;
+ }
+ return 0;
+ }
+ Bit8u getMaxValue(int off) const {
+ if (maxTable == NULL)
+ return 0xFF;
+ return maxTable[off % entrySize];
+ }
+ Bit8u *getRealMemory() const {
+ return realMemory;
+ }
+ bool isReadable() const {
+ return getRealMemory() != NULL;
+ }
+ void read(unsigned int entry, unsigned int off, Bit8u *dst, unsigned int len) const;
+ void write(unsigned int entry, unsigned int off, const Bit8u *src, unsigned int len, bool init = false) const;
+};
+
+class PatchTempMemoryRegion : public MemoryRegion {
+public:
+ PatchTempMemoryRegion(Synth *useSynth, Bit8u *useRealMemory, Bit8u *useMaxTable) : MemoryRegion(useSynth, useRealMemory, useMaxTable, MR_PatchTemp, MT32EMU_MEMADDR(0x030000), sizeof(MemParams::PatchTemp), 9) {}
+};
+class RhythmTempMemoryRegion : public MemoryRegion {
+public:
+ RhythmTempMemoryRegion(Synth *useSynth, Bit8u *useRealMemory, Bit8u *useMaxTable) : MemoryRegion(useSynth, useRealMemory, useMaxTable, MR_RhythmTemp, MT32EMU_MEMADDR(0x030110), sizeof(MemParams::RhythmTemp), 85) {}
+};
+class TimbreTempMemoryRegion : public MemoryRegion {
+public:
+ TimbreTempMemoryRegion(Synth *useSynth, Bit8u *useRealMemory, Bit8u *useMaxTable) : MemoryRegion(useSynth, useRealMemory, useMaxTable, MR_TimbreTemp, MT32EMU_MEMADDR(0x040000), sizeof(TimbreParam), 8) {}
+};
+class PatchesMemoryRegion : public MemoryRegion {
+public:
+ PatchesMemoryRegion(Synth *useSynth, Bit8u *useRealMemory, Bit8u *useMaxTable) : MemoryRegion(useSynth, useRealMemory, useMaxTable, MR_Patches, MT32EMU_MEMADDR(0x050000), sizeof(PatchParam), 128) {}
+};
+class TimbresMemoryRegion : public MemoryRegion {
+public:
+ TimbresMemoryRegion(Synth *useSynth, Bit8u *useRealMemory, Bit8u *useMaxTable) : MemoryRegion(useSynth, useRealMemory, useMaxTable, MR_Timbres, MT32EMU_MEMADDR(0x080000), sizeof(MemParams::PaddedTimbre), 64 + 64 + 64 + 64) {}
+};
+class SystemMemoryRegion : public MemoryRegion {
+public:
+ SystemMemoryRegion(Synth *useSynth, Bit8u *useRealMemory, Bit8u *useMaxTable) : MemoryRegion(useSynth, useRealMemory, useMaxTable, MR_System, MT32EMU_MEMADDR(0x100000), sizeof(MemParams::System), 1) {}
+};
+class DisplayMemoryRegion : public MemoryRegion {
+public:
+ DisplayMemoryRegion(Synth *useSynth) : MemoryRegion(useSynth, NULL, NULL, MR_Display, MT32EMU_MEMADDR(0x200000), MAX_SYSEX_SIZE - 1, 1) {}
+};
+class ResetMemoryRegion : public MemoryRegion {
+public:
+ ResetMemoryRegion(Synth *useSynth) : MemoryRegion(useSynth, NULL, NULL, MR_Reset, MT32EMU_MEMADDR(0x7F0000), 0x3FFF, 1) {}
+};
+
+class ReverbModel {
+public:
+ virtual ~ReverbModel() {}
+ // After construction or a close(), open() will be called at least once before any other call (with the exception of close()).
+ virtual void open(unsigned int sampleRate) = 0;
+ // May be called multiple times without an open() in between.
+ virtual void close() = 0;
+ virtual void setParameters(Bit8u time, Bit8u level) = 0;
+ virtual void process(const float *inLeft, const float *inRight, float *outLeft, float *outRight, unsigned long numSamples) = 0;
+ virtual bool isActive() const = 0;
+};
+
+class Synth {
+friend class Part;
+friend class RhythmPart;
+friend class Poly;
+friend class Partial;
+friend class Tables;
+friend class MemoryRegion;
+friend class TVA;
+friend class TVF;
+friend class TVP;
+private:
+ PatchTempMemoryRegion *patchTempMemoryRegion;
+ RhythmTempMemoryRegion *rhythmTempMemoryRegion;
+ TimbreTempMemoryRegion *timbreTempMemoryRegion;
+ PatchesMemoryRegion *patchesMemoryRegion;
+ TimbresMemoryRegion *timbresMemoryRegion;
+ SystemMemoryRegion *systemMemoryRegion;
+ DisplayMemoryRegion *displayMemoryRegion;
+ ResetMemoryRegion *resetMemoryRegion;
+
+ Bit8u *paddedTimbreMaxTable;
+
+ bool isEnabled;
+
+ PCMWaveEntry *pcmWaves; // Array
+
+ const ControlROMMap *controlROMMap;
+ Bit8u controlROMData[CONTROL_ROM_SIZE];
+ float *pcmROMData;
+ int pcmROMSize; // This is in 16-bit samples, therefore half the number of bytes in the ROM
+
+ Bit8s chantable[32];
+
+ Bit32u renderedSampleCount;
+
+ Tables tables;
+
+ MemParams mt32ram, mt32default;
+
+ ReverbModel *reverbModels[4];
+ ReverbModel *reverbModel;
+ bool reverbEnabled;
+ bool reverbOverridden;
+
+ FloatToBit16sFunc la32FloatToBit16sFunc;
+ FloatToBit16sFunc reverbFloatToBit16sFunc;
+ float outputGain;
+ float reverbOutputGain;
+
+ bool isOpen;
+
+ PartialManager *partialManager;
+ Part *parts[9];
+
+ // FIXME: We can reorganise things so that we don't need all these separate tmpBuf, tmp and prerender buffers.
+ // This should be rationalised when things have stabilised a bit (if prerender buffers don't die in the mean time).
+
+ float tmpBufPartialLeft[MAX_SAMPLES_PER_RUN];
+ float tmpBufPartialRight[MAX_SAMPLES_PER_RUN];
+ float tmpBufMixLeft[MAX_SAMPLES_PER_RUN];
+ float tmpBufMixRight[MAX_SAMPLES_PER_RUN];
+ float tmpBufReverbOutLeft[MAX_SAMPLES_PER_RUN];
+ float tmpBufReverbOutRight[MAX_SAMPLES_PER_RUN];
+
+ Bit16s tmpNonReverbLeft[MAX_SAMPLES_PER_RUN];
+ Bit16s tmpNonReverbRight[MAX_SAMPLES_PER_RUN];
+ Bit16s tmpReverbDryLeft[MAX_SAMPLES_PER_RUN];
+ Bit16s tmpReverbDryRight[MAX_SAMPLES_PER_RUN];
+ Bit16s tmpReverbWetLeft[MAX_SAMPLES_PER_RUN];
+ Bit16s tmpReverbWetRight[MAX_SAMPLES_PER_RUN];
+
+ // These ring buffers are only used to simulate delays present on the real device.
+ // In particular, when a partial needs to be aborted to free it up for use by a new Poly,
+ // the controller will busy-loop waiting for the sound to finish.
+ Bit16s prerenderNonReverbLeft[MAX_PRERENDER_SAMPLES];
+ Bit16s prerenderNonReverbRight[MAX_PRERENDER_SAMPLES];
+ Bit16s prerenderReverbDryLeft[MAX_PRERENDER_SAMPLES];
+ Bit16s prerenderReverbDryRight[MAX_PRERENDER_SAMPLES];
+ Bit16s prerenderReverbWetLeft[MAX_PRERENDER_SAMPLES];
+ Bit16s prerenderReverbWetRight[MAX_PRERENDER_SAMPLES];
+ int prerenderReadIx;
+ int prerenderWriteIx;
+
+ SynthProperties myProp;
+
+ bool prerender();
+ void copyPrerender(Bit16s *nonReverbLeft, Bit16s *nonReverbRight, Bit16s *reverbDryLeft, Bit16s *reverbDryRight, Bit16s *reverbWetLeft, Bit16s *reverbWetRight, Bit32u pos, Bit32u len);
+ void checkPrerender(Bit16s *nonReverbLeft, Bit16s *nonReverbRight, Bit16s *reverbDryLeft, Bit16s *reverbDryRight, Bit16s *reverbWetLeft, Bit16s *reverbWetRight, Bit32u &pos, Bit32u &len);
+ void doRenderStreams(Bit16s *nonReverbLeft, Bit16s *nonReverbRight, Bit16s *reverbDryLeft, Bit16s *reverbDryRight, Bit16s *reverbWetLeft, Bit16s *reverbWetRight, Bit32u len);
+
+ void playAddressedSysex(unsigned char channel, const Bit8u *sysex, Bit32u len);
+ void readSysex(unsigned char channel, const Bit8u *sysex, Bit32u len) const;
+ void initMemoryRegions();
+ void deleteMemoryRegions();
+ MemoryRegion *findMemoryRegion(Bit32u addr);
+ void writeMemoryRegion(const MemoryRegion *region, Bit32u addr, Bit32u len, const Bit8u *data);
+ void readMemoryRegion(const MemoryRegion *region, Bit32u addr, Bit32u len, Bit8u *data);
+
+ LoadResult loadControlROM(const char *filename);
+ LoadResult loadPCMROM(const char *filename);
+
+ bool initPCMList(Bit16u mapAddress, Bit16u count);
+ bool initTimbres(Bit16u mapAddress, Bit16u offset, int timbreCount, int startTimbre, bool compressed);
+ bool initCompressedTimbre(int drumNum, const Bit8u *mem, unsigned int memLen);
+
+ void refreshSystemMasterTune();
+ void refreshSystemReverbParameters();
+ void refreshSystemReserveSettings();
+ void refreshSystemChanAssign(unsigned int firstPart, unsigned int lastPart);
+ void refreshSystemMasterVol();
+ void refreshSystem();
+ void reset();
+
+ unsigned int getSampleRate() const;
+
+ void printPartialUsage(unsigned long sampleOffset = 0);
+protected:
+ int report(ReportType type, const void *reportData);
+ Common::File *openFile(const char *filename);
+ void closeFile(Common::File *file);
+ void printDebug(const char *fmt, ...);
+
+public:
+ static Bit8u calcSysexChecksum(const Bit8u *data, Bit32u len, Bit8u checksum);
+
+ Synth();
+ ~Synth();
+
+ // Used to initialise the MT-32. Must be called before any other function.
+ // Returns true if initialization was sucessful, otherwise returns false.
+ bool open(SynthProperties &useProp);
+
+ // Closes the MT-32 and deallocates any memory used by the synthesizer
+ void close(void);
+
+ // Sends a 4-byte MIDI message to the MT-32 for immediate playback
+ void playMsg(Bit32u msg);
+ void playMsgOnPart(unsigned char part, unsigned char code, unsigned char note, unsigned char velocity);
+
+ // Sends a string of Sysex commands to the MT-32 for immediate interpretation
+ // The length is in bytes
+ void playSysex(const Bit8u *sysex, Bit32u len);
+ void playSysexWithoutFraming(const Bit8u *sysex, Bit32u len);
+ void playSysexWithoutHeader(unsigned char device, unsigned char command, const Bit8u *sysex, Bit32u len);
+ void writeSysex(unsigned char channel, const Bit8u *sysex, Bit32u len);
+
+ void setReverbEnabled(bool reverbEnabled);
+ bool isReverbEnabled() const;
+ void setReverbOverridden(bool reverbOverridden);
+ bool isReverbOverridden() const;
+ void setDACInputMode(DACInputMode mode);
+
+ // Sets output gain factor. Applied to all output samples and unrelated with the synth's Master volume.
+ void setOutputGain(float);
+
+ // Sets output gain factor for the reverb wet output. setOutputGain() doesn't change reverb output gain.
+ void setReverbOutputGain(float);
+
+ // Renders samples to the specified output stream.
+ // The length is in frames, not bytes (in 16-bit stereo,
+ // one frame is 4 bytes).
+ void render(Bit16s *stream, Bit32u len);
+
+ // Renders samples to the specified output streams (any or all of which may be NULL).
+ void renderStreams(Bit16s *nonReverbLeft, Bit16s *nonReverbRight, Bit16s *reverbDryLeft, Bit16s *reverbDryRight, Bit16s *reverbWetLeft, Bit16s *reverbWetRight, Bit32u len);
+
+ // Returns true when there is at least one active partial, otherwise false.
+ bool hasActivePartials() const;
+
+ // Returns true if hasActivePartials() returns true, or reverb is (somewhat unreliably) detected as being active.
+ bool isActive() const;
+
+ const Partial *getPartial(unsigned int partialNum) const;
+
+ void readMemory(Bit32u addr, Bit32u len, Bit8u *data);
+
+ // partNum should be 0..7 for Part 1..8, or 8 for Rhythm
+ const Part *getPart(unsigned int partNum) const;
+};
+
+}
+
+#endif
diff --git a/audio/softsynth/mt32/TVA.cpp b/audio/softsynth/mt32/TVA.cpp
new file mode 100644
index 0000000000..c3be6db591
--- /dev/null
+++ b/audio/softsynth/mt32/TVA.cpp
@@ -0,0 +1,365 @@
+/* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher
+ * Copyright (C) 2011 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * This class emulates the calculations performed by the 8095 microcontroller in order to configure the LA-32's amplitude ramp for a single partial at each stage of its TVA envelope.
+ * Unless we introduced bugs, it should be pretty much 100% accurate according to Mok's specifications.
+*/
+//#include <cmath>
+
+#include "mt32emu.h"
+#include "mmath.h"
+
+namespace MT32Emu {
+
+// CONFIRMED: Matches a table in ROM - haven't got around to coming up with a formula for it yet.
+static Bit8u biasLevelToAmpSubtractionCoeff[13] = {255, 187, 137, 100, 74, 54, 40, 29, 21, 15, 10, 5, 0};
+
+TVA::TVA(const Partial *usePartial, LA32Ramp *useAmpRamp) :
+ partial(usePartial), ampRamp(useAmpRamp), system_(&usePartial->getSynth()->mt32ram.system) {
+}
+
+void TVA::startRamp(Bit8u newTarget, Bit8u newIncrement, int newPhase) {
+ target = newTarget;
+ phase = newPhase;
+ ampRamp->startRamp(newTarget, newIncrement);
+#if MT32EMU_MONITOR_TVA >= 1
+ partial->getSynth()->printDebug("[+%lu] [Partial %d] TVA,ramp,%d,%d,%d,%d", partial->debugGetSampleNum(), partial->debugGetPartialNum(), (newIncrement & 0x80) ? -1 : 1, (newIncrement & 0x7F), newPhase);
+#endif
+}
+
+void TVA::end(int newPhase) {
+ phase = newPhase;
+ playing = false;
+#if MT32EMU_MONITOR_TVA >= 1
+ partial->getSynth()->printDebug("[+%lu] [Partial %d] TVA,end,%d", partial->debugGetSampleNum(), partial->debugGetPartialNum(), newPhase);
+#endif
+}
+
+static int multBias(Bit8u biasLevel, int bias) {
+ return (bias * biasLevelToAmpSubtractionCoeff[biasLevel]) >> 5;
+}
+
+static int calcBiasAmpSubtraction(Bit8u biasPoint, Bit8u biasLevel, int key) {
+ if ((biasPoint & 0x40) == 0) {
+ int bias = biasPoint + 33 - key;
+ if (bias > 0) {
+ return multBias(biasLevel, bias);
+ }
+ } else {
+ int bias = biasPoint - 31 - key;
+ if (bias < 0) {
+ bias = -bias;
+ return multBias(biasLevel, bias);
+ }
+ }
+ return 0;
+}
+
+static int calcBiasAmpSubtractions(const TimbreParam::PartialParam *partialParam, int key) {
+ int biasAmpSubtraction1 = calcBiasAmpSubtraction(partialParam->tva.biasPoint1, partialParam->tva.biasLevel1, key);
+ if (biasAmpSubtraction1 > 255) {
+ return 255;
+ }
+ int biasAmpSubtraction2 = calcBiasAmpSubtraction(partialParam->tva.biasPoint2, partialParam->tva.biasLevel2, key);
+ if (biasAmpSubtraction2 > 255) {
+ return 255;
+ }
+ int biasAmpSubtraction = biasAmpSubtraction1 + biasAmpSubtraction2;
+ if (biasAmpSubtraction > 255) {
+ return 255;
+ }
+ return biasAmpSubtraction;
+}
+
+static int calcVeloAmpSubtraction(Bit8u veloSensitivity, unsigned int velocity) {
+ // FIXME:KG: Better variable names
+ int velocityMult = veloSensitivity - 50;
+ int absVelocityMult = velocityMult < 0 ? -velocityMult : velocityMult;
+ velocityMult = (signed)((unsigned)(velocityMult * ((signed)velocity - 64)) << 2);
+ return absVelocityMult - (velocityMult >> 8); // PORTABILITY NOTE: Assumes arithmetic shift
+}
+
+static int calcBasicAmp(const Tables *tables, const Partial *partial, const MemParams::System *system_, const TimbreParam::PartialParam *partialParam, const MemParams::PatchTemp *patchTemp, const MemParams::RhythmTemp *rhythmTemp, int biasAmpSubtraction, int veloAmpSubtraction, Bit8u expression) {
+ int amp = 155;
+
+ if (!partial->isRingModulatingSlave()) {
+ amp -= tables->masterVolToAmpSubtraction[system_->masterVol];
+ if (amp < 0) {
+ return 0;
+ }
+ amp -= tables->levelToAmpSubtraction[patchTemp->outputLevel];
+ if (amp < 0) {
+ return 0;
+ }
+ amp -= tables->levelToAmpSubtraction[expression];
+ if (amp < 0) {
+ return 0;
+ }
+ if (rhythmTemp != NULL) {
+ amp -= tables->levelToAmpSubtraction[rhythmTemp->outputLevel];
+ if (amp < 0) {
+ return 0;
+ }
+ }
+ }
+ amp -= biasAmpSubtraction;
+ if (amp < 0) {
+ return 0;
+ }
+ amp -= tables->levelToAmpSubtraction[partialParam->tva.level];
+ if (amp < 0) {
+ return 0;
+ }
+ amp -= veloAmpSubtraction;
+ if (amp < 0) {
+ return 0;
+ }
+ if (amp > 155) {
+ amp = 155;
+ }
+ amp -= partialParam->tvf.resonance >> 1;
+ if (amp < 0) {
+ return 0;
+ }
+ return amp;
+}
+
+int calcKeyTimeSubtraction(Bit8u envTimeKeyfollow, int key) {
+ if (envTimeKeyfollow == 0) {
+ return 0;
+ }
+ return (key - 60) >> (5 - envTimeKeyfollow); // PORTABILITY NOTE: Assumes arithmetic shift
+}
+
+void TVA::reset(const Part *newPart, const TimbreParam::PartialParam *newPartialParam, const MemParams::RhythmTemp *newRhythmTemp) {
+ part = newPart;
+ partialParam = newPartialParam;
+ patchTemp = newPart->getPatchTemp();
+ rhythmTemp = newRhythmTemp;
+
+ playing = true;
+
+ Tables *tables = &partial->getSynth()->tables;
+
+ int key = partial->getPoly()->getKey();
+ int velocity = partial->getPoly()->getVelocity();
+
+ keyTimeSubtraction = calcKeyTimeSubtraction(partialParam->tva.envTimeKeyfollow, key);
+
+ biasAmpSubtraction = calcBiasAmpSubtractions(partialParam, key);
+ veloAmpSubtraction = calcVeloAmpSubtraction(partialParam->tva.veloSensitivity, velocity);
+
+ int newTarget = calcBasicAmp(tables, partial, system_, partialParam, patchTemp, newRhythmTemp, biasAmpSubtraction, veloAmpSubtraction, part->getExpression());
+ int newPhase;
+ if (partialParam->tva.envTime[0] == 0) {
+ // Initially go to the TVA_PHASE_ATTACK target amp, and spend the next phase going from there to the TVA_PHASE_2 target amp
+ // Note that this means that velocity never affects time for this partial.
+ newTarget += partialParam->tva.envLevel[0];
+ newPhase = TVA_PHASE_ATTACK; // The first target used in nextPhase() will be TVA_PHASE_2
+ } else {
+ // Initially go to the base amp determined by TVA level, part volume, etc., and spend the next phase going from there to the full TVA_PHASE_ATTACK target amp.
+ newPhase = TVA_PHASE_BASIC; // The first target used in nextPhase() will be TVA_PHASE_ATTACK
+ }
+
+ ampRamp->reset();//currentAmp = 0;
+
+ // "Go downward as quickly as possible".
+ // Since the current value is 0, the LA32Ramp will notice that we're already at or below the target and trying to go downward,
+ // and therefore jump to the target immediately and raise an interrupt.
+ startRamp((Bit8u)newTarget, 0x80 | 127, newPhase);
+}
+
+void TVA::startAbort() {
+ startRamp(64, 0x80 | 127, TVA_PHASE_RELEASE);
+}
+
+void TVA::startDecay() {
+ if (phase >= TVA_PHASE_RELEASE) {
+ return;
+ }
+ Bit8u newIncrement;
+ if (partialParam->tva.envTime[4] == 0) {
+ newIncrement = 1;
+ } else {
+ newIncrement = -partialParam->tva.envTime[4];
+ }
+ // The next time nextPhase() is called, it will think TVA_PHASE_RELEASE has finished and the partial will be aborted
+ startRamp(0, newIncrement, TVA_PHASE_RELEASE);
+}
+
+void TVA::handleInterrupt() {
+ nextPhase();
+}
+
+void TVA::recalcSustain() {
+ // We get pinged periodically by the pitch code to recalculate our values when in sustain.
+ // This is done so that the TVA will respond to things like MIDI expression and volume changes while it's sustaining, which it otherwise wouldn't do.
+
+ // The check for envLevel[3] == 0 strikes me as slightly dumb. FIXME: Explain why
+ if (phase != TVA_PHASE_SUSTAIN || partialParam->tva.envLevel[3] == 0) {
+ return;
+ }
+ // We're sustaining. Recalculate all the values
+ Tables *tables = &partial->getSynth()->tables;
+ int newTarget = calcBasicAmp(tables, partial, system_, partialParam, patchTemp, rhythmTemp, biasAmpSubtraction, veloAmpSubtraction, part->getExpression());
+ newTarget += partialParam->tva.envLevel[3];
+ // Since we're in TVA_PHASE_SUSTAIN at this point, we know that target has been reached and an interrupt fired, so we can rely on it being the current amp.
+ int targetDelta = newTarget - target;
+
+ // Calculate an increment to get to the new amp value in a short, more or less consistent amount of time
+ Bit8u newIncrement;
+ if (targetDelta >= 0) {
+ newIncrement = tables->envLogarithmicTime[(Bit8u)targetDelta] - 2;
+ } else {
+ newIncrement = (tables->envLogarithmicTime[(Bit8u)-targetDelta] - 2) | 0x80;
+ }
+ // Configure so that once the transition's complete and nextPhase() is called, we'll just re-enter sustain phase (or decay phase, depending on parameters at the time).
+ startRamp(newTarget, newIncrement, TVA_PHASE_SUSTAIN - 1);
+}
+
+bool TVA::isPlaying() const {
+ return playing;
+}
+
+int TVA::getPhase() const {
+ return phase;
+}
+
+void TVA::nextPhase() {
+ Tables *tables = &partial->getSynth()->tables;
+
+ if (phase >= TVA_PHASE_DEAD || !playing) {
+ partial->getSynth()->printDebug("TVA::nextPhase(): Shouldn't have got here with phase %d, playing=%s", phase, playing ? "true" : "false");
+ return;
+ }
+ int newPhase = phase + 1;
+
+ if (newPhase == TVA_PHASE_DEAD) {
+ end(newPhase);
+ return;
+ }
+
+ bool allLevelsZeroFromNowOn = false;
+ if (partialParam->tva.envLevel[3] == 0) {
+ if (newPhase == TVA_PHASE_4) {
+ allLevelsZeroFromNowOn = true;
+ } else if (partialParam->tva.envLevel[2] == 0) {
+ if (newPhase == TVA_PHASE_3) {
+ allLevelsZeroFromNowOn = true;
+ } else if (partialParam->tva.envLevel[1] == 0) {
+ if (newPhase == TVA_PHASE_2) {
+ allLevelsZeroFromNowOn = true;
+ } else if (partialParam->tva.envLevel[0] == 0) {
+ if (newPhase == TVA_PHASE_ATTACK) { // this line added, missing in ROM - FIXME: Add description of repercussions
+ allLevelsZeroFromNowOn = true;
+ }
+ }
+ }
+ }
+ }
+
+ int newTarget;
+ int newIncrement;
+ int envPointIndex = phase;
+
+ if (!allLevelsZeroFromNowOn) {
+ newTarget = calcBasicAmp(tables, partial, system_, partialParam, patchTemp, rhythmTemp, biasAmpSubtraction, veloAmpSubtraction, part->getExpression());
+
+ if (newPhase == TVA_PHASE_SUSTAIN || newPhase == TVA_PHASE_RELEASE) {
+ if (partialParam->tva.envLevel[3] == 0) {
+ end(newPhase);
+ return;
+ }
+ if (!partial->getPoly()->canSustain()) {
+ newPhase = TVA_PHASE_RELEASE;
+ newTarget = 0;
+ newIncrement = -partialParam->tva.envTime[4];
+ if (newIncrement == 0) {
+ // We can't let the increment be 0, or there would be no emulated interrupt.
+ // So we do an "upward" increment, which should set the amp to 0 extremely quickly
+ // and cause an "interrupt" to bring us back to nextPhase().
+ newIncrement = 1;
+ }
+ } else {
+ newTarget += partialParam->tva.envLevel[3];
+ newIncrement = 0;
+ }
+ } else {
+ newTarget += partialParam->tva.envLevel[envPointIndex];
+ }
+ } else {
+ newTarget = 0;
+ }
+
+ if ((newPhase != TVA_PHASE_SUSTAIN && newPhase != TVA_PHASE_RELEASE) || allLevelsZeroFromNowOn) {
+ int envTimeSetting = partialParam->tva.envTime[envPointIndex];
+
+ if (newPhase == TVA_PHASE_ATTACK) {
+ envTimeSetting -= ((signed)partial->getPoly()->getVelocity() - 64) >> (6 - partialParam->tva.envTimeVeloSensitivity); // PORTABILITY NOTE: Assumes arithmetic shift
+
+ if (envTimeSetting <= 0 && partialParam->tva.envTime[envPointIndex] != 0) {
+ envTimeSetting = 1;
+ }
+ } else {
+ envTimeSetting -= keyTimeSubtraction;
+ }
+ if (envTimeSetting > 0) {
+ int targetDelta = newTarget - target;
+ if (targetDelta <= 0) {
+ if (targetDelta == 0) {
+ // target and newTarget are the same.
+ // We can't have an increment of 0 or we wouldn't get an emulated interrupt.
+ // So instead make the target one less than it really should be and set targetDelta accordingly.
+ targetDelta = -1;
+ newTarget--;
+ if (newTarget < 0) {
+ // Oops, newTarget is less than zero now, so let's do it the other way:
+ // Make newTarget one more than it really should've been and set targetDelta accordingly.
+ // FIXME (apparent bug in real firmware):
+ // This means targetDelta will be positive just below here where it's inverted, and we'll end up using envLogarithmicTime[-1], and we'll be setting newIncrement to be descending later on, etc..
+ targetDelta = 1;
+ newTarget = -newTarget;
+ }
+ }
+ targetDelta = -targetDelta;
+ newIncrement = tables->envLogarithmicTime[(Bit8u)targetDelta] - envTimeSetting;
+ if (newIncrement <= 0) {
+ newIncrement = 1;
+ }
+ newIncrement = newIncrement | 0x80;
+ } else {
+ // FIXME: The last 22 or so entries in this table are 128 - surely that fucks things up, since that ends up being -128 signed?
+ newIncrement = tables->envLogarithmicTime[(Bit8u)targetDelta] - envTimeSetting;
+ if (newIncrement <= 0) {
+ newIncrement = 1;
+ }
+ }
+ } else {
+ newIncrement = newTarget >= target ? (0x80 | 127) : 127;
+ }
+
+ // FIXME: What's the point of this? It's checked or set to non-zero everywhere above
+ if (newIncrement == 0) {
+ newIncrement = 1;
+ }
+ }
+
+ startRamp((Bit8u)newTarget, (Bit8u)newIncrement, newPhase);
+}
+
+}
diff --git a/audio/softsynth/mt32/TVA.h b/audio/softsynth/mt32/TVA.h
new file mode 100644
index 0000000000..a104fe4c1f
--- /dev/null
+++ b/audio/softsynth/mt32/TVA.h
@@ -0,0 +1,94 @@
+/* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher
+ * Copyright (C) 2011 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef MT32EMU_TVA_H
+#define MT32EMU_TVA_H
+
+namespace MT32Emu {
+
+class Part;
+
+// Note that when entering nextPhase(), newPhase is set to phase + 1, and the descriptions/names below refer to
+// newPhase's value.
+enum {
+ // In this phase, the base amp (as calculated in calcBasicAmp()) is targeted with an instant time.
+ // This phase is entered by reset() only if time[0] != 0.
+ TVA_PHASE_BASIC = 0,
+
+ // In this phase, level[0] is targeted within time[0], and velocity potentially affects time
+ TVA_PHASE_ATTACK = 1,
+
+ // In this phase, level[1] is targeted within time[1]
+ TVA_PHASE_2 = 2,
+
+ // In this phase, level[2] is targeted within time[2]
+ TVA_PHASE_3 = 3,
+
+ // In this phase, level[3] is targeted within time[3]
+ TVA_PHASE_4 = 4,
+
+ // In this phase, immediately goes to PHASE_RELEASE unless the poly is set to sustain.
+ // Aborts the partial if level[3] is 0.
+ // Otherwise level[3] is continued, no phase change will occur until some external influence (like pedal release)
+ TVA_PHASE_SUSTAIN = 5,
+
+ // In this phase, 0 is targeted within time[4] (the time calculation is quite different from the other phases)
+ TVA_PHASE_RELEASE = 6,
+
+ // It's PHASE_DEAD, Jim.
+ TVA_PHASE_DEAD = 7
+};
+
+class TVA {
+private:
+ const Partial * const partial;
+ LA32Ramp *ampRamp;
+ const MemParams::System * const system_;
+
+ const Part *part;
+ const TimbreParam::PartialParam *partialParam;
+ const MemParams::PatchTemp *patchTemp;
+ const MemParams::RhythmTemp *rhythmTemp;
+
+ bool playing;
+
+ int biasAmpSubtraction;
+ int veloAmpSubtraction;
+ int keyTimeSubtraction;
+
+ Bit8u target;
+ int phase;
+
+ void startRamp(Bit8u newTarget, Bit8u newIncrement, int newPhase);
+ void end(int newPhase);
+ void nextPhase();
+
+public:
+ TVA(const Partial *partial, LA32Ramp *ampRamp);
+ void reset(const Part *part, const TimbreParam::PartialParam *partialParam, const MemParams::RhythmTemp *rhythmTemp);
+ void handleInterrupt();
+ void recalcSustain();
+ void startDecay();
+ void startAbort();
+
+ bool isPlaying() const;
+ int getPhase() const;
+};
+
+}
+
+#endif /* TVA_H_ */
diff --git a/audio/softsynth/mt32/TVF.cpp b/audio/softsynth/mt32/TVF.cpp
new file mode 100644
index 0000000000..58f72e5a9b
--- /dev/null
+++ b/audio/softsynth/mt32/TVF.cpp
@@ -0,0 +1,230 @@
+/* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher
+ * Copyright (C) 2011 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+//#include <cmath>
+
+#include "mt32emu.h"
+#include "mmath.h"
+
+namespace MT32Emu {
+
+// Note that when entering nextPhase(), newPhase is set to phase + 1, and the descriptions/names below refer to
+// newPhase's value.
+enum {
+ // When this is the target phase, level[0] is targeted within time[0]
+ // Note that this phase is always set up in reset(), not nextPhase()
+ PHASE_ATTACK = 1,
+
+ // When this is the target phase, level[1] is targeted within time[1]
+ PHASE_2 = 2,
+
+ // When this is the target phase, level[2] is targeted within time[2]
+ PHASE_3 = 3,
+
+ // When this is the target phase, level[3] is targeted within time[3]
+ PHASE_4 = 4,
+
+ // When this is the target phase, immediately goes to PHASE_RELEASE unless the poly is set to sustain.
+ // Otherwise level[3] is continued with increment 0 - no phase change will occur until some external influence (like pedal release)
+ PHASE_SUSTAIN = 5,
+
+ // 0 is targeted within time[4] (the time calculation is quite different from the other phases)
+ PHASE_RELEASE = 6,
+
+ // 0 is targeted with increment 0 (thus theoretically staying that way forever)
+ PHASE_DONE = 7
+};
+
+static int calcBaseCutoff(const TimbreParam::PartialParam *partialParam, Bit32u basePitch, unsigned int key) {
+ // This table matches the values used by a real LAPC-I.
+ static const Bit8s biasLevelToBiasMult[] = {85, 42, 21, 16, 10, 5, 2, 0, -2, -5, -10, -16, -21, -74, -85};
+ // These values represent unique options with no consistent pattern, so we have to use something like a table in any case.
+ // The table entries, when divided by 21, match approximately what the manual claims:
+ // -1, -1/2, -1/4, 0, 1/8, 1/4, 3/8, 1/2, 5/8, 3/4, 7/8, 1, 5/4, 3/2, 2, s1, s2
+ // Note that the entry for 1/8 is rounded to 2 (from 1/8 * 21 = 2.625), which seems strangely inaccurate compared to the others.
+ static const Bit8s keyfollowMult21[] = {-21, -10, -5, 0, 2, 5, 8, 10, 13, 16, 18, 21, 26, 32, 42, 21, 21};
+ int baseCutoff = keyfollowMult21[partialParam->tvf.keyfollow] - keyfollowMult21[partialParam->wg.pitchKeyfollow];
+ // baseCutoff range now: -63 to 63
+ baseCutoff *= (int)key - 60;
+ // baseCutoff range now: -3024 to 3024
+ int biasPoint = partialParam->tvf.biasPoint;
+ if ((biasPoint & 0x40) == 0) {
+ // biasPoint range here: 0 to 63
+ int bias = biasPoint + 33 - key; // bias range here: -75 to 84
+ if (bias > 0) {
+ bias = -bias; // bias range here: -1 to -84
+ baseCutoff += bias * biasLevelToBiasMult[partialParam->tvf.biasLevel]; // Calculation range: -7140 to 7140
+ // baseCutoff range now: -10164 to 10164
+ }
+ } else {
+ // biasPoint range here: 64 to 127
+ int bias = biasPoint - 31 - key; // bias range here: -75 to 84
+ if (bias < 0) {
+ baseCutoff += bias * biasLevelToBiasMult[partialParam->tvf.biasLevel]; // Calculation range: тˆ’6375 to 6375
+ // baseCutoff range now: -9399 to 9399
+ }
+ }
+ // baseCutoff range now: -10164 to 10164
+ baseCutoff += ((partialParam->tvf.cutoff << 4) - 800);
+ // baseCutoff range now: -10964 to 10964
+ if (baseCutoff >= 0) {
+ // FIXME: Potentially bad if baseCutoff ends up below -2056?
+ int pitchDeltaThing = (basePitch >> 4) + baseCutoff - 3584;
+ if (pitchDeltaThing > 0) {
+ baseCutoff -= pitchDeltaThing;
+ }
+ } else if (baseCutoff < -2048) {
+ baseCutoff = -2048;
+ }
+ baseCutoff += 2056;
+ baseCutoff >>= 4; // PORTABILITY NOTE: Hmm... Depends whether it could've been below -2056, but maybe arithmetic shift assumed?
+ if (baseCutoff > 255) {
+ baseCutoff = 255;
+ }
+ return (Bit8u)baseCutoff;
+}
+
+TVF::TVF(const Partial *usePartial, LA32Ramp *useCutoffModifierRamp) :
+ partial(usePartial), cutoffModifierRamp(useCutoffModifierRamp) {
+}
+
+void TVF::startRamp(Bit8u newTarget, Bit8u newIncrement, int newPhase) {
+ target = newTarget;
+ phase = newPhase;
+ cutoffModifierRamp->startRamp(newTarget, newIncrement);
+#if MT32EMU_MONITOR_TVF >= 1
+ partial->getSynth()->printDebug("[+%lu] [Partial %d] TVF,ramp,%d,%d,%d,%d", partial->debugGetSampleNum(), partial->debugGetPartialNum(), newTarget, (newIncrement & 0x80) ? -1 : 1, (newIncrement & 0x7F), newPhase);
+#endif
+}
+
+void TVF::reset(const TimbreParam::PartialParam *newPartialParam, unsigned int basePitch) {
+ partialParam = newPartialParam;
+
+ unsigned int key = partial->getPoly()->getKey();
+ unsigned int velocity = partial->getPoly()->getVelocity();
+
+ Tables *tables = &partial->getSynth()->tables;
+
+ baseCutoff = calcBaseCutoff(newPartialParam, basePitch, key);
+#if MT32EMU_MONITOR_TVF >= 1
+ partial->getSynth()->printDebug("[+%lu] [Partial %d] TVF,base,%d", partial->debugGetSampleNum(), partial->debugGetPartialNum(), baseCutoff);
+#endif
+
+ int newLevelMult = velocity * newPartialParam->tvf.envVeloSensitivity;
+ newLevelMult >>= 6;
+ newLevelMult += 109 - newPartialParam->tvf.envVeloSensitivity;
+ newLevelMult += ((signed)key - 60) >> (4 - newPartialParam->tvf.envDepthKeyfollow);
+ if (newLevelMult < 0) {
+ newLevelMult = 0;
+ }
+ newLevelMult *= newPartialParam->tvf.envDepth;
+ newLevelMult >>= 6;
+ if (newLevelMult > 255) {
+ newLevelMult = 255;
+ }
+ levelMult = newLevelMult;
+
+ if (newPartialParam->tvf.envTimeKeyfollow != 0) {
+ keyTimeSubtraction = ((signed)key - 60) >> (5 - newPartialParam->tvf.envTimeKeyfollow);
+ } else {
+ keyTimeSubtraction = 0;
+ }
+
+ int newTarget = (newLevelMult * newPartialParam->tvf.envLevel[0]) >> 8;
+ int envTimeSetting = newPartialParam->tvf.envTime[0] - keyTimeSubtraction;
+ int newIncrement;
+ if (envTimeSetting <= 0) {
+ newIncrement = (0x80 | 127);
+ } else {
+ newIncrement = tables->envLogarithmicTime[newTarget] - envTimeSetting;
+ if (newIncrement <= 0) {
+ newIncrement = 1;
+ }
+ }
+ cutoffModifierRamp->reset();
+ startRamp(newTarget, newIncrement, PHASE_2 - 1);
+}
+
+Bit8u TVF::getBaseCutoff() const {
+ return baseCutoff;
+}
+
+void TVF::handleInterrupt() {
+ nextPhase();
+}
+
+void TVF::startDecay() {
+ if (phase >= PHASE_RELEASE) {
+ return;
+ }
+ if (partialParam->tvf.envTime[4] == 0) {
+ startRamp(0, 1, PHASE_DONE - 1);
+ } else {
+ startRamp(0, -partialParam->tvf.envTime[4], PHASE_DONE - 1);
+ }
+}
+
+void TVF::nextPhase() {
+ Tables *tables = &partial->getSynth()->tables;
+ int newPhase = phase + 1;
+
+ switch (newPhase) {
+ case PHASE_DONE:
+ startRamp(0, 0, newPhase);
+ return;
+ case PHASE_SUSTAIN:
+ case PHASE_RELEASE:
+ // FIXME: Afaict newPhase should never be PHASE_RELEASE here. And if it were, this is an odd way to handle it.
+ if (!partial->getPoly()->canSustain()) {
+ phase = newPhase; // FIXME: Correct?
+ startDecay(); // FIXME: This should actually start decay even if phase is already 6. Does that matter?
+ return;
+ }
+ startRamp((levelMult * partialParam->tvf.envLevel[3]) >> 8, 0, newPhase);
+ return;
+ }
+
+ int envPointIndex = phase;
+ int envTimeSetting = partialParam->tvf.envTime[envPointIndex] - keyTimeSubtraction;
+
+ int newTarget = (levelMult * partialParam->tvf.envLevel[envPointIndex]) >> 8;
+ int newIncrement;
+ if (envTimeSetting > 0) {
+ int targetDelta = newTarget - target;
+ if (targetDelta == 0) {
+ if (newTarget == 0) {
+ targetDelta = 1;
+ newTarget = 1;
+ } else {
+ targetDelta = -1;
+ newTarget--;
+ }
+ }
+ newIncrement = tables->envLogarithmicTime[targetDelta < 0 ? -targetDelta : targetDelta] - envTimeSetting;
+ if (newIncrement <= 0) {
+ newIncrement = 1;
+ }
+ if (targetDelta < 0) {
+ newIncrement |= 0x80;
+ }
+ } else {
+ newIncrement = newTarget >= target ? (0x80 | 127) : 127;
+ }
+ startRamp(newTarget, newIncrement, newPhase);
+}
+
+}
diff --git a/audio/softsynth/mt32/TVF.h b/audio/softsynth/mt32/TVF.h
new file mode 100644
index 0000000000..490d8de504
--- /dev/null
+++ b/audio/softsynth/mt32/TVF.h
@@ -0,0 +1,54 @@
+/* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher
+ * Copyright (C) 2011 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef MT32EMU_TVF_H
+#define MT32EMU_TVF_H
+
+namespace MT32Emu {
+
+class TVF {
+private:
+ const Partial * const partial;
+ LA32Ramp *cutoffModifierRamp;
+ const TimbreParam::PartialParam *partialParam;
+
+ Bit8u baseCutoff;
+ int keyTimeSubtraction;
+ unsigned int levelMult;
+
+ Bit8u target;
+ unsigned int phase;
+
+ void startRamp(Bit8u newTarget, Bit8u newIncrement, int newPhase);
+ void nextPhase();
+
+public:
+ TVF(const Partial *partial, LA32Ramp *cutoffModifierRamp);
+ void reset(const TimbreParam::PartialParam *partialParam, Bit32u basePitch);
+ // Returns the base cutoff (without envelope modification).
+ // The base cutoff is calculated when reset() is called and remains static
+ // for the lifetime of the partial.
+ // Barring bugs, the number returned is confirmed accurate
+ // (based on specs from Mok).
+ Bit8u getBaseCutoff() const;
+ void handleInterrupt();
+ void startDecay();
+};
+
+}
+
+#endif
diff --git a/audio/softsynth/mt32/TVP.cpp b/audio/softsynth/mt32/TVP.cpp
new file mode 100644
index 0000000000..0b339e8d71
--- /dev/null
+++ b/audio/softsynth/mt32/TVP.cpp
@@ -0,0 +1,321 @@
+/* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher
+ * Copyright (C) 2011 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+//#include <cmath>
+//#include <cstdlib>
+
+#include "mt32emu.h"
+
+namespace MT32Emu {
+
+// FIXME: Add Explanation
+static Bit16u lowerDurationToDivisor[] = {34078, 37162, 40526, 44194, 48194, 52556, 57312, 62499};
+
+// These values represent unique options with no consistent pattern, so we have to use something like a table in any case.
+// The table matches exactly what the manual claims (when divided by 8192):
+// -1, -1/2, -1/4, 0, 1/8, 1/4, 3/8, 1/2, 5/8, 3/4, 7/8, 1, 5/4, 3/2, 2, s1, s2
+// ...except for the last two entries, which are supposed to be "1 cent above 1" and "2 cents above 1", respectively. They can only be roughly approximated with this integer math.
+static Bit16s pitchKeyfollowMult[] = {-8192, -4096, -2048, 0, 1024, 2048, 3072, 4096, 5120, 6144, 7168, 8192, 10240, 12288, 16384, 8198, 8226};
+
+// Note: Keys < 60 use keyToPitchTable[60 - key], keys >= 60 use keyToPitchTable[key - 60].
+// FIXME: This table could really be shorter, since we never use e.g. key 127.
+static Bit16u keyToPitchTable[] = {
+ 0, 341, 683, 1024, 1365, 1707, 2048, 2389,
+ 2731, 3072, 3413, 3755, 4096, 4437, 4779, 5120,
+ 5461, 5803, 6144, 6485, 6827, 7168, 7509, 7851,
+ 8192, 8533, 8875, 9216, 9557, 9899, 10240, 10581,
+ 10923, 11264, 11605, 11947, 12288, 12629, 12971, 13312,
+ 13653, 13995, 14336, 14677, 15019, 15360, 15701, 16043,
+ 16384, 16725, 17067, 17408, 17749, 18091, 18432, 18773,
+ 19115, 19456, 19797, 20139, 20480, 20821, 21163, 21504,
+ 21845, 22187, 22528, 22869
+};
+
+TVP::TVP(const Partial *usePartial) :
+ partial(usePartial), system_(&usePartial->getSynth()->mt32ram.system) {
+ unsigned int sampleRate = usePartial->getSynth()->myProp.sampleRate;
+ // We want to do processing 4000 times per second. FIXME: This is pretty arbitrary.
+ maxCounter = sampleRate / 4000;
+ // The timer runs at 500kHz. We only need to bother updating it every maxCounter samples, before we do processing.
+ // This is how much to increment it by every maxCounter samples.
+ processTimerIncrement = 500000 * maxCounter / sampleRate;
+}
+
+static Bit16s keyToPitch(unsigned int key) {
+ // We're using a table to do: return round_to_nearest_or_even((key - 60) * (4096.0 / 12.0))
+ // Banker's rounding is just slightly annoying to do in C++
+ int k = (int)key;
+ Bit16s pitch = keyToPitchTable[abs(k - 60)];
+ return key < 60 ? -pitch : pitch;
+}
+
+static inline Bit32s coarseToPitch(Bit8u coarse) {
+ return (coarse - 36) * 4096 / 12; // One semitone per coarse offset
+}
+
+static inline Bit32s fineToPitch(Bit8u fine) {
+ return (fine - 50) * 4096 / 1200; // One cent per fine offset
+}
+
+static Bit32u calcBasePitch(const Partial *partial, const TimbreParam::PartialParam *partialParam, const MemParams::PatchTemp *patchTemp, unsigned int key) {
+ Bit32s basePitch = keyToPitch(key);
+ basePitch = (basePitch * pitchKeyfollowMult[partialParam->wg.pitchKeyfollow]) >> 13; // PORTABILITY NOTE: Assumes arithmetic shift
+ basePitch += coarseToPitch(partialParam->wg.pitchCoarse);
+ basePitch += fineToPitch(partialParam->wg.pitchFine);
+ // NOTE:Mok: This is done on MT-32, but not LAPC-I:
+ //pitch += coarseToPitch(patchTemp->patch.keyShift + 12);
+ basePitch += fineToPitch(patchTemp->patch.fineTune);
+
+ const ControlROMPCMStruct *controlROMPCMStruct = partial->getControlROMPCMStruct();
+ if (controlROMPCMStruct != NULL) {
+ basePitch += (Bit32s)((((Bit32s)controlROMPCMStruct->pitchMSB) << 8) | (Bit32s)controlROMPCMStruct->pitchLSB);
+ } else {
+ if ((partialParam->wg.waveform & 1) == 0) {
+ basePitch += 37133; // This puts Middle C at around 261.64Hz (assuming no other modifications, masterTune of 64, etc.)
+ } else {
+ // Sawtooth waves are effectively double the frequency of square waves.
+ // Thus we add 4096 less than for square waves here, which results in halving the frequency.
+ basePitch += 33037;
+ }
+ }
+ if (basePitch < 0) {
+ basePitch = 0;
+ }
+ if (basePitch > 59392) {
+ basePitch = 59392;
+ }
+ return (Bit32u)basePitch;
+}
+
+static Bit32u calcVeloMult(Bit8u veloSensitivity, unsigned int velocity) {
+ if (veloSensitivity == 0 || veloSensitivity > 3) {
+ // Note that on CM-32L/LAPC-I veloSensitivity is never > 3, since it's clipped to 3 by the max tables.
+ return 21845; // aka floor(4096 / 12 * 64), aka ~64 semitones
+ }
+ // When velocity is 127, the multiplier is 21845, aka ~64 semitones (regardless of veloSensitivity).
+ // The lower the velocity, the lower the multiplier. The veloSensitivity determines the amount decreased per velocity value.
+ // The minimum multiplier (with velocity 0, veloSensitivity 3) is 170 (~half a semitone).
+ Bit32u veloMult = 32768;
+ veloMult -= (127 - velocity) << (5 + veloSensitivity);
+ veloMult *= 21845;
+ veloMult >>= 15;
+ return veloMult;
+}
+
+static Bit32s calcTargetPitchOffsetWithoutLFO(const TimbreParam::PartialParam *partialParam, int levelIndex, unsigned int velocity) {
+ int veloMult = calcVeloMult(partialParam->pitchEnv.veloSensitivity, velocity);
+ int targetPitchOffsetWithoutLFO = partialParam->pitchEnv.level[levelIndex] - 50;
+ targetPitchOffsetWithoutLFO = (Bit32s)(targetPitchOffsetWithoutLFO * veloMult) >> (16 - partialParam->pitchEnv.depth); // PORTABILITY NOTE: Assumes arithmetic shift
+ return targetPitchOffsetWithoutLFO;
+}
+
+void TVP::reset(const Part *usePart, const TimbreParam::PartialParam *usePartialParam) {
+ part = usePart;
+ partialParam = usePartialParam;
+ patchTemp = part->getPatchTemp();
+
+ unsigned int key = partial->getPoly()->getKey();
+ unsigned int velocity = partial->getPoly()->getVelocity();
+
+ // FIXME: We're using a per-TVP timer instead of a system-wide one for convenience.
+ timeElapsed = 0;
+
+ basePitch = calcBasePitch(partial, partialParam, patchTemp, key);
+ currentPitchOffset = calcTargetPitchOffsetWithoutLFO(partialParam, 0, velocity);
+ targetPitchOffsetWithoutLFO = currentPitchOffset;
+ phase = 0;
+
+ if (partialParam->pitchEnv.timeKeyfollow) {
+ timeKeyfollowSubtraction = (key - 60) >> (5 - partialParam->pitchEnv.timeKeyfollow); // PORTABILITY NOTE: Assumes arithmetic shift
+ } else {
+ timeKeyfollowSubtraction = 0;
+ }
+ lfoPitchOffset = 0;
+ counter = 0;
+ pitch = basePitch;
+
+ // These don't really need to be initialised, but it aids debugging.
+ pitchOffsetChangePerBigTick = 0;
+ targetPitchOffsetReachedBigTick = 0;
+ shifts = 0;
+}
+
+Bit32u TVP::getBasePitch() const {
+ return basePitch;
+}
+
+void TVP::updatePitch() {
+ Bit32s newPitch = basePitch + currentPitchOffset;
+ if (!partial->isPCM() || (partial->getControlROMPCMStruct()->len & 0x01) == 0) { // FIXME: Use !partial->pcmWaveEntry->unaffectedByMasterTune instead
+ // FIXME: masterTune recalculation doesn't really happen here, and there are various bugs not yet emulated
+ // 171 is ~half a semitone.
+ newPitch += ((system_->masterTune - 64) * 171) >> 6; // PORTABILITY NOTE: Assumes arithmetic shift.
+ }
+ if ((partialParam->wg.pitchBenderEnabled & 1) != 0) {
+ newPitch += part->getPitchBend();
+ }
+ if (newPitch < 0) {
+ newPitch = 0;
+ }
+ if (newPitch > 59392) {
+ newPitch = 59392;
+ }
+ pitch = (Bit16u)newPitch;
+
+ // FIXME: We're doing this here because that's what the CM-32L does - we should probably move this somewhere more appropriate in future.
+ partial->tva->recalcSustain();
+}
+
+void TVP::targetPitchOffsetReached() {
+ currentPitchOffset = targetPitchOffsetWithoutLFO + lfoPitchOffset;
+
+ switch (phase) {
+ case 3:
+ case 4:
+ {
+ int newLFOPitchOffset = (part->getModulation() * partialParam->pitchLFO.modSensitivity) >> 7;
+ newLFOPitchOffset = (newLFOPitchOffset + partialParam->pitchLFO.depth) << 1;
+ if (pitchOffsetChangePerBigTick > 0) {
+ // Go in the opposite direction to last time
+ newLFOPitchOffset = -newLFOPitchOffset;
+ }
+ lfoPitchOffset = newLFOPitchOffset;
+ int targetPitchOffset = targetPitchOffsetWithoutLFO + lfoPitchOffset;
+ setupPitchChange(targetPitchOffset, 101 - partialParam->pitchLFO.rate);
+ updatePitch();
+ break;
+ }
+ case 6:
+ updatePitch();
+ break;
+ default:
+ nextPhase();
+ }
+}
+
+void TVP::nextPhase() {
+ phase++;
+ int envIndex = phase == 6 ? 4 : phase;
+
+ targetPitchOffsetWithoutLFO = calcTargetPitchOffsetWithoutLFO(partialParam, envIndex, partial->getPoly()->getVelocity()); // pitch we'll reach at the end
+
+ int changeDuration = partialParam->pitchEnv.time[envIndex - 1];
+ changeDuration -= timeKeyfollowSubtraction;
+ if (changeDuration > 0) {
+ setupPitchChange(targetPitchOffsetWithoutLFO, changeDuration); // changeDuration between 0 and 112 now
+ updatePitch();
+ } else {
+ targetPitchOffsetReached();
+ }
+}
+
+// Shifts val to the left until bit 31 is 1 and returns the number of shifts
+static Bit8u normalise(Bit32u &val) {
+ Bit8u leftShifts;
+ for (leftShifts = 0; leftShifts < 31; leftShifts++) {
+ if ((val & 0x80000000) != 0) {
+ break;
+ }
+ val = val << 1;
+ }
+ return leftShifts;
+}
+
+void TVP::setupPitchChange(int targetPitchOffset, Bit8u changeDuration) {
+ bool negativeDelta = targetPitchOffset < currentPitchOffset;
+ Bit32s pitchOffsetDelta = targetPitchOffset - currentPitchOffset;
+ if (pitchOffsetDelta > 32767 || pitchOffsetDelta < -32768) {
+ pitchOffsetDelta = 32767;
+ }
+ if (negativeDelta) {
+ pitchOffsetDelta = -pitchOffsetDelta;
+ }
+ // We want to maximise the number of bits of the Bit16s "pitchOffsetChangePerBigTick" we use in order to get the best possible precision later
+ Bit32u absPitchOffsetDelta = pitchOffsetDelta << 16;
+ Bit8u normalisationShifts = normalise(absPitchOffsetDelta); // FIXME: Double-check: normalisationShifts is usually between 0 and 15 here, unless the delta is 0, in which case it's 31
+ absPitchOffsetDelta = absPitchOffsetDelta >> 1; // Make room for the sign bit
+
+ changeDuration--; // changeDuration's now between 0 and 111
+ unsigned int upperDuration = changeDuration >> 3; // upperDuration's now between 0 and 13
+ shifts = normalisationShifts + upperDuration + 2;
+ Bit16u divisor = lowerDurationToDivisor[changeDuration & 7];
+ Bit16s newPitchOffsetChangePerBigTick = ((absPitchOffsetDelta & 0xFFFF0000) / divisor) >> 1; // Result now fits within 15 bits. FIXME: Check nothing's getting sign-extended incorrectly
+ if (negativeDelta) {
+ newPitchOffsetChangePerBigTick = -newPitchOffsetChangePerBigTick;
+ }
+ pitchOffsetChangePerBigTick = newPitchOffsetChangePerBigTick;
+
+ int currentBigTick = timeElapsed >> 8;
+ int durationInBigTicks = divisor >> (12 - upperDuration);
+ if (durationInBigTicks > 32767) {
+ durationInBigTicks = 32767;
+ }
+ // The result of the addition may exceed 16 bits, but wrapping is fine and intended here.
+ targetPitchOffsetReachedBigTick = currentBigTick + durationInBigTicks;
+}
+
+void TVP::startDecay() {
+ phase = 5;
+ lfoPitchOffset = 0;
+ targetPitchOffsetReachedBigTick = timeElapsed >> 8; // FIXME: Afaict there's no good reason for this - check
+}
+
+Bit16u TVP::nextPitch() {
+ // FIXME: Write explanation of counter and time increment
+ if (counter == 0) {
+ timeElapsed += processTimerIncrement;
+ timeElapsed = timeElapsed & 0x00FFFFFF;
+ process();
+ }
+ counter = (counter + 1) % maxCounter;
+ return pitch;
+}
+
+void TVP::process() {
+ if (phase == 0) {
+ targetPitchOffsetReached();
+ return;
+ }
+ if (phase == 5) {
+ nextPhase();
+ return;
+ }
+ if (phase > 7) {
+ updatePitch();
+ return;
+ }
+
+ Bit16s negativeBigTicksRemaining = (timeElapsed >> 8) - targetPitchOffsetReachedBigTick;
+ if (negativeBigTicksRemaining >= 0) {
+ // We've reached the time for a phase change
+ targetPitchOffsetReached();
+ return;
+ }
+ // FIXME: Write explanation for this stuff
+ int rightShifts = shifts;
+ if (rightShifts > 13) {
+ rightShifts -= 13;
+ negativeBigTicksRemaining = negativeBigTicksRemaining >> rightShifts; // PORTABILITY NOTE: Assumes arithmetic shift
+ rightShifts = 13;
+ }
+ int newResult = ((Bit32s)(negativeBigTicksRemaining * pitchOffsetChangePerBigTick)) >> rightShifts; // PORTABILITY NOTE: Assumes arithmetic shift
+ newResult += targetPitchOffsetWithoutLFO + lfoPitchOffset;
+ currentPitchOffset = newResult;
+ updatePitch();
+}
+
+}
diff --git a/audio/softsynth/mt32/TVP.h b/audio/softsynth/mt32/TVP.h
new file mode 100644
index 0000000000..f6f62f8d39
--- /dev/null
+++ b/audio/softsynth/mt32/TVP.h
@@ -0,0 +1,67 @@
+/* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher
+ * Copyright (C) 2011 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef MT32EMU_TVP_H
+#define MT32EMU_TVP_H
+
+namespace MT32Emu {
+
+class TVP {
+private:
+ const Partial * const partial;
+ const MemParams::System * const system_; // FIXME: Only necessary because masterTune calculation is done in the wrong place atm.
+
+ const Part *part;
+ const TimbreParam::PartialParam *partialParam;
+ const MemParams::PatchTemp *patchTemp;
+
+ int maxCounter;
+ int processTimerIncrement;
+ int counter;
+ Bit32u timeElapsed;
+
+ int phase;
+ Bit32u basePitch;
+ Bit32s targetPitchOffsetWithoutLFO;
+ Bit32s currentPitchOffset;
+
+ Bit16s lfoPitchOffset;
+ // In range -12 - 36
+ Bit8s timeKeyfollowSubtraction;
+
+ Bit16s pitchOffsetChangePerBigTick;
+ Bit16u targetPitchOffsetReachedBigTick;
+ unsigned int shifts;
+
+ Bit16u pitch;
+
+ void updatePitch();
+ void setupPitchChange(int targetPitchOffset, Bit8u changeDuration);
+ void targetPitchOffsetReached();
+ void nextPhase();
+ void process();
+public:
+ TVP(const Partial *partial);
+ void reset(const Part *part, const TimbreParam::PartialParam *partialParam);
+ Bit32u getBasePitch() const;
+ Bit16u nextPitch();
+ void startDecay();
+};
+
+}
+
+#endif
diff --git a/audio/softsynth/mt32/Tables.cpp b/audio/softsynth/mt32/Tables.cpp
new file mode 100644
index 0000000000..c9bd40b7a4
--- /dev/null
+++ b/audio/softsynth/mt32/Tables.cpp
@@ -0,0 +1,119 @@
+/* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher
+ * Copyright (C) 2011 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+//#include <cmath>
+//#include <cstdlib>
+//#include <cstring>
+
+#include "mt32emu.h"
+#include "mmath.h"
+
+using namespace MT32Emu;
+
+Tables::Tables() {
+ initialised = false;
+}
+
+void Tables::init() {
+ if (initialised) {
+ return;
+ }
+ initialised = true;
+
+ int lf;
+ for (lf = 0; lf <= 100; lf++) {
+ // CONFIRMED:KG: This matches a ROM table found by Mok
+ float fVal = (2.0f - LOG10F((float)lf + 1.0f)) * 128.0f;
+ int val = (int)(fVal + 1.0);
+ if (val > 255) {
+ val = 255;
+ }
+ levelToAmpSubtraction[lf] = (Bit8u)val;
+ }
+
+ envLogarithmicTime[0] = 64;
+ for (lf = 1; lf <= 255; lf++) {
+ // CONFIRMED:KG: This matches a ROM table found by Mok
+ envLogarithmicTime[lf] = (Bit8u)ceil(64.0f + LOG2F((float)lf) * 8.0f);
+ }
+
+#ifdef EMULATE_LAPC_I // Dummy #ifdef - we'll have runtime emulation mode selection in future.
+ // CONFIRMED: Based on a table found by Mok in the LAPC-I control ROM
+ // Note that this matches the MT-32 table, but with the values clamped to a maximum of 8.
+ memset(masterVolToAmpSubtraction, 8, 71);
+ memset(masterVolToAmpSubtraction + 71, 7, 3);
+ memset(masterVolToAmpSubtraction + 74, 6, 4);
+ memset(masterVolToAmpSubtraction + 78, 5, 3);
+ memset(masterVolToAmpSubtraction + 81, 4, 4);
+ memset(masterVolToAmpSubtraction + 85, 3, 3);
+ memset(masterVolToAmpSubtraction + 88, 2, 4);
+ memset(masterVolToAmpSubtraction + 92, 1, 4);
+ memset(masterVolToAmpSubtraction + 96, 0, 5);
+#else
+ // CONFIRMED: Based on a table found by Mok in the MT-32 control ROM
+ masterVolToAmpSubtraction[0] = 255;
+ for (int masterVol = 1; masterVol <= 100; masterVol++) {
+ masterVolToAmpSubtraction[masterVol] = (int)(106.31 - 16.0f * LOG2F((float)masterVol));
+ }
+#endif
+
+ for (int i = 0; i <= 100; i++) {
+ pulseWidth100To255[i] = (int)(i * 255 / 100.0f + 0.5f);
+ //synth->printDebug("%d: %d", i, pulseWidth100To255[i]);
+ }
+
+ // Ratio of negative segment to wave length
+ for (int i = 0; i < 128; i++) {
+ // Formula determined from sample analysis.
+ float pt = 0.5f / 127.0f * i;
+ pulseLenFactor[i] = (1.241857812f - pt) * pt; // seems to be 2 ^ (5 / 16) = 1.241857812f
+ }
+
+ for (int i = 0; i < 65536; i++) {
+ // Aka (slightly slower): EXP2F(pitchVal / 4096.0f - 16.0f) * 32000.0f
+ pitchToFreq[i] = EXP2F(i / 4096.0f - 1.034215715f);
+ }
+
+ // found from sample analysis
+ for (int i = 0; i < 1024; i++) {
+ cutoffToCosineLen[i] = EXP2F(i / -128.0f);
+ }
+
+ // found from sample analysis
+ for (int i = 0; i < 1024; i++) {
+ cutoffToFilterAmp[i] = EXP2F(-0.125f * (128.0f - i / 8.0f));
+ }
+
+ // found from sample analysis
+ for (int i = 0; i < 32; i++) {
+ resAmpMax[i] = EXP2F(1.0f - (32 - i) / 4.0f);
+ }
+
+ // found from sample analysis
+ resAmpFadeFactor[7] = 1.0f / 8.0f;
+ resAmpFadeFactor[6] = 2.0f / 8.0f;
+ resAmpFadeFactor[5] = 3.0f / 8.0f;
+ resAmpFadeFactor[4] = 5.0f / 8.0f;
+ resAmpFadeFactor[3] = 8.0f / 8.0f;
+ resAmpFadeFactor[2] = 12.0f / 8.0f;
+ resAmpFadeFactor[1] = 16.0f / 8.0f;
+ resAmpFadeFactor[0] = 31.0f / 8.0f;
+
+ for (int i = 0; i < 5120; i++) {
+ sinf10[i] = sin(FLOAT_PI * i / 2048.0f);
+ }
+}
diff --git a/audio/softsynth/mt32/Tables.h b/audio/softsynth/mt32/Tables.h
new file mode 100644
index 0000000000..a2b5ff5d56
--- /dev/null
+++ b/audio/softsynth/mt32/Tables.h
@@ -0,0 +1,64 @@
+/* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher
+ * Copyright (C) 2011 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef MT32EMU_TABLES_H
+#define MT32EMU_TABLES_H
+
+namespace MT32Emu {
+
+const int MIDDLEC = 60;
+
+class Synth;
+
+class Tables {
+ bool initialised;
+
+public:
+ // Constant LUTs
+
+ // CONFIRMED: This is used to convert several parameters to amp-modifying values in the TVA envelope:
+ // - PatchTemp.outputLevel
+ // - RhythmTemp.outlevel
+ // - PartialParam.tva.level
+ // - expression
+ // It's used to determine how much to subtract from the amp envelope's target value
+ Bit8u levelToAmpSubtraction[101];
+
+ // CONFIRMED: ...
+ Bit8u envLogarithmicTime[256];
+
+ // CONFIRMED: ...
+ Bit8u masterVolToAmpSubtraction[101];
+
+ // CONFIRMED:
+ Bit8u pulseWidth100To255[101];
+
+ float pulseLenFactor[128];
+ float pitchToFreq[65536];
+ float cutoffToCosineLen[1024];
+ float cutoffToFilterAmp[1024];
+ float resAmpMax[32];
+ float resAmpFadeFactor[8];
+ float sinf10[5120];
+
+ Tables();
+ void init();
+};
+
+}
+
+#endif
diff --git a/audio/softsynth/mt32/freeverb.cpp b/audio/softsynth/mt32/freeverb.cpp
index 67f065c20e..de8f2632cb 100644
--- a/audio/softsynth/mt32/freeverb.cpp
+++ b/audio/softsynth/mt32/freeverb.cpp
@@ -1,245 +1,245 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * 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.
- *
- */
-
-// Comb filter implementation
+// Allpass filter implementation
//
-// Written by
+// Written by Jezar at Dreampoint, June 2000
// http://www.dreampoint.co.uk
// This code is public domain
-#include "audio/softsynth/mt32/freeverb.h"
+#include "freeverb.h"
-comb::comb() {
- filterstore = 0;
+allpass::allpass()
+{
bufidx = 0;
}
-void comb::setbuffer(float *buf, int size) {
+void allpass::setbuffer(float *buf, int size)
+{
buffer = buf;
bufsize = size;
}
-void comb::mute() {
- for (int i = 0; i < bufsize; i++)
- buffer[i] = 0;
-}
-
-void comb::setdamp(float val) {
- damp1 = val;
- damp2 = 1 - val;
-}
-
-float comb::getdamp() {
- return damp1;
+void allpass::mute()
+{
+ for (int i=0; i<bufsize; i++)
+ buffer[i]=0;
}
-void comb::setfeedback(float val) {
+void allpass::setfeedback(float val)
+{
feedback = val;
}
-float comb::getfeedback() {
+float allpass::getfeedback()
+{
return feedback;
}
-// Allpass filter implementation
+void allpass::deletebuffer()
+{
+ delete[] buffer;
+ buffer = 0;
+}
+// Comb filter implementation
+//
+// Written by Jezar at Dreampoint, June 2000
+// http://www.dreampoint.co.uk
+// This code is public domain
-allpass::allpass() {
+comb::comb()
+{
+ filterstore = 0;
bufidx = 0;
}
-void allpass::setbuffer(float *buf, int size) {
+void comb::setbuffer(float *buf, int size)
+{
buffer = buf;
bufsize = size;
}
-void allpass::mute() {
- for (int i = 0; i < bufsize; i++)
- buffer[i] = 0;
+void comb::mute()
+{
+ for (int i=0; i<bufsize; i++)
+ buffer[i]=0;
+}
+
+void comb::setdamp(float val)
+{
+ damp1 = val;
+ damp2 = 1-val;
+}
+
+float comb::getdamp()
+{
+ return damp1;
}
-void allpass::setfeedback(float val) {
+void comb::setfeedback(float val)
+{
feedback = val;
}
-float allpass::getfeedback() {
+float comb::getfeedback()
+{
return feedback;
}
+void comb::deletebuffer()
+{
+ delete[] buffer;
+ buffer = 0;
+}
// Reverb model implementation
+//
+// Written by Jezar at Dreampoint, June 2000
+// Modifications by Jerome Fisher, 2009, 2011
+// http://www.dreampoint.co.uk
+// This code is public domain
-revmodel::revmodel() {
- // Tie the components to their buffers
- combL[0].setbuffer(bufcombL1,combtuningL1);
- combR[0].setbuffer(bufcombR1,combtuningR1);
- combL[1].setbuffer(bufcombL2,combtuningL2);
- combR[1].setbuffer(bufcombR2,combtuningR2);
- combL[2].setbuffer(bufcombL3,combtuningL3);
- combR[2].setbuffer(bufcombR3,combtuningR3);
- combL[3].setbuffer(bufcombL4,combtuningL4);
- combR[3].setbuffer(bufcombR4,combtuningR4);
- combL[4].setbuffer(bufcombL5,combtuningL5);
- combR[4].setbuffer(bufcombR5,combtuningR5);
- combL[5].setbuffer(bufcombL6,combtuningL6);
- combR[5].setbuffer(bufcombR6,combtuningR6);
- combL[6].setbuffer(bufcombL7,combtuningL7);
- combR[6].setbuffer(bufcombR7,combtuningR7);
- combL[7].setbuffer(bufcombL8,combtuningL8);
- combR[7].setbuffer(bufcombR8,combtuningR8);
- allpassL[0].setbuffer(bufallpassL1,allpasstuningL1);
- allpassR[0].setbuffer(bufallpassR1,allpasstuningR1);
- allpassL[1].setbuffer(bufallpassL2,allpasstuningL2);
- allpassR[1].setbuffer(bufallpassR2,allpasstuningR2);
- allpassL[2].setbuffer(bufallpassL3,allpasstuningL3);
- allpassR[2].setbuffer(bufallpassR3,allpasstuningR3);
- allpassL[3].setbuffer(bufallpassL4,allpasstuningL4);
- allpassR[3].setbuffer(bufallpassR4,allpasstuningR4);
+revmodel::revmodel(float scaletuning)
+{
+ int i;
+ int bufsize;
+
+ // Allocate buffers for the components
+ for (i = 0; i < numcombs; i++) {
+ bufsize = int(scaletuning * combtuning[i]);
+ combL[i].setbuffer(new float[bufsize], bufsize);
+ bufsize += int(scaletuning * stereospread);
+ combR[i].setbuffer(new float[bufsize], bufsize);
+ }
+ for (i = 0; i < numallpasses; i++) {
+ bufsize = int(scaletuning * allpasstuning[i]);
+ allpassL[i].setbuffer(new float[bufsize], bufsize);
+ allpassL[i].setfeedback(0.5f);
+ bufsize += int(scaletuning * stereospread);
+ allpassR[i].setbuffer(new float[bufsize], bufsize);
+ allpassR[i].setfeedback(0.5f);
+ }
// Set default values
- allpassL[0].setfeedback(0.5f);
- allpassR[0].setfeedback(0.5f);
- allpassL[1].setfeedback(0.5f);
- allpassR[1].setfeedback(0.5f);
- allpassL[2].setfeedback(0.5f);
- allpassR[2].setfeedback(0.5f);
- allpassL[3].setfeedback(0.5f);
- allpassR[3].setfeedback(0.5f);
- setmode(initialmode);
- setwet(initialwet);
- setroomsize(initialroom);
- setdry(initialdry);
- setdamp(initialdamp);
- setwidth(initialwidth);
+ dry = initialdry;
+ wet = initialwet*scalewet;
+ damp = initialdamp*scaledamp;
+ roomsize = (initialroom*scaleroom) + offsetroom;
+ width = initialwidth;
+ mode = initialmode;
+ update();
// Buffer will be full of rubbish - so we MUST mute them
mute();
}
-void revmodel::mute() {
+revmodel::~revmodel()
+{
+ int i;
+
+ for (i = 0; i < numcombs; i++) {
+ combL[i].deletebuffer();
+ combR[i].deletebuffer();
+ }
+ for (i = 0; i < numallpasses; i++) {
+ allpassL[i].deletebuffer();
+ allpassR[i].deletebuffer();
+ }
+}
+
+void revmodel::mute()
+{
int i;
if (getmode() >= freezemode)
return;
- for (i = 0; i < numcombs; i++) {
+ for (i=0;i<numcombs;i++)
+ {
combL[i].mute();
combR[i].mute();
}
-
- for (i = 0; i < numallpasses; i++) {
+ for (i=0;i<numallpasses;i++)
+ {
allpassL[i].mute();
allpassR[i].mute();
}
-}
-
-void revmodel::processreplace(float *inputL, float *inputR, float *outputL, float *outputR, long numsamples, int skip) {
- float outL, outR, input;
-
- while (numsamples-- > 0) {
- int i;
-
- outL = outR = 0;
- input = (*inputL + *inputR) * gain;
-
- // Accumulate comb filters in parallel
- for (i = 0; i < numcombs; i++) {
- outL += combL[i].process(input);
- outR += combR[i].process(input);
- }
- // Feed through allpasses in series
- for (i = 0; i < numallpasses; i++) {
- outL = allpassL[i].process(outL);
- outR = allpassR[i].process(outR);
- }
-
- // Calculate output REPLACING anything already there
- *outputL = outL * wet1 + outR * wet2 + *inputL * dry;
- *outputR = outR * wet1 + outL * wet2 + *inputR * dry;
-
- // Increment sample pointers, allowing for interleave (if any)
- inputL += skip;
- inputR += skip;
- outputL += skip;
- outputR += skip;
- }
+ // Init LPF history
+ filtprev1 = 0;
+ filtprev2 = 0;
}
-void revmodel::processmix(float *inputL, float *inputR, float *outputL, float *outputR, long numsamples, int skip) {
- float outL, outR, input;
+void revmodel::process(const float *inputL, const float *inputR, float *outputL, float *outputR, long numsamples)
+{
+ float outL,outR,input;
- while (numsamples-- > 0) {
+ while (numsamples-- > 0)
+ {
int i;
outL = outR = 0;
input = (*inputL + *inputR) * gain;
+ // Implementation of 2-stage IIR single-pole low-pass filter
+ // found at the entrance of reverb processing on real devices
+ filtprev1 += (input - filtprev1) * filtval;
+ filtprev2 += (filtprev1 - filtprev2) * filtval;
+ input = filtprev2;
+
+ int s = -1;
// Accumulate comb filters in parallel
- for (i = 0; i < numcombs; i++) {
- outL += combL[i].process(input);
- outR += combR[i].process(input);
+ for (i=0; i<numcombs; i++)
+ {
+ outL += s * combL[i].process(input);
+ outR += s * combR[i].process(input);
+ s = -s;
}
// Feed through allpasses in series
- for (i = 0; i < numallpasses; i++) {
+ for (i=0; i<numallpasses; i++)
+ {
outL = allpassL[i].process(outL);
outR = allpassR[i].process(outR);
}
- // Calculate output MIXING with anything already there
- *outputL += outL * wet1 + outR * wet2 + *inputL * dry;
- *outputR += outR * wet1 + outL * wet2 + *inputR * dry;
-
- // Increment sample pointers, allowing for interleave (if any)
- inputL += skip;
- inputR += skip;
- outputL += skip;
- outputR += skip;
+ // Calculate output REPLACING anything already there
+ *outputL = outL*wet1 + outR*wet2;
+ *outputR = outR*wet1 + outL*wet2;
+
+ inputL++;
+ inputR++;
+ outputL++;
+ outputR++;
}
}
-void revmodel::update() {
- // Recalculate internal values after parameter change
+void revmodel::update()
+{
+// Recalculate internal values after parameter change
int i;
- wet1 = wet * (width / 2 + 0.5f);
- wet2 = wet * ((1 - width) / 2);
+ wet1 = wet*(width/2 + 0.5f);
+ wet2 = wet*((1-width)/2);
- if (mode >= freezemode) {
+ if (mode >= freezemode)
+ {
roomsize1 = 1;
damp1 = 0;
gain = muted;
- } else {
+ }
+ else
+ {
roomsize1 = roomsize;
damp1 = damp;
gain = fixedgain;
}
- for (i = 0; i < numcombs; i++) {
+ for (i=0; i<numcombs; i++)
+ {
combL[i].setfeedback(roomsize1);
combR[i].setfeedback(roomsize1);
}
- for (i = 0; i < numcombs; i++) {
+ for (i=0; i<numcombs; i++)
+ {
combL[i].setdamp(damp1);
combR[i].setdamp(damp1);
}
@@ -250,58 +250,75 @@ void revmodel::update() {
// because as you develop the reverb model, you may
// wish to take dynamic action when they are called.
-void revmodel::setroomsize(float value) {
- roomsize = (value * scaleroom) + offsetroom;
+void revmodel::setroomsize(float value)
+{
+ roomsize = (value*scaleroom) + offsetroom;
update();
}
-float revmodel::getroomsize() {
- return (roomsize - offsetroom) / scaleroom;
+float revmodel::getroomsize()
+{
+ return (roomsize-offsetroom)/scaleroom;
}
-void revmodel::setdamp(float value) {
- damp = value * scaledamp;
+void revmodel::setdamp(float value)
+{
+ damp = value*scaledamp;
update();
}
-float revmodel::getdamp() {
- return damp / scaledamp;
+float revmodel::getdamp()
+{
+ return damp/scaledamp;
}
-void revmodel::setwet(float value) {
- wet = value * scalewet;
+void revmodel::setwet(float value)
+{
+ wet = value*scalewet;
update();
}
-float revmodel::getwet() {
- return wet / scalewet;
+float revmodel::getwet()
+{
+ return wet/scalewet;
}
-void revmodel::setdry(float value) {
- dry = value * scaledry;
+void revmodel::setdry(float value)
+{
+ dry = value*scaledry;
}
-float revmodel::getdry() {
- return dry / scaledry;
+float revmodel::getdry()
+{
+ return dry/scaledry;
}
-void revmodel::setwidth(float value) {
+void revmodel::setwidth(float value)
+{
width = value;
update();
}
-float revmodel::getwidth() {
+float revmodel::getwidth()
+{
return width;
}
-void revmodel::setmode(float value) {
+void revmodel::setmode(float value)
+{
mode = value;
update();
}
-float revmodel::getmode() {
+float revmodel::getmode()
+{
if (mode >= freezemode)
return 1;
else
return 0;
}
+
+void revmodel::setfiltval(float value)
+{
+ filtval = value;
+}
diff --git a/audio/softsynth/mt32/freeverb.h b/audio/softsynth/mt32/freeverb.h
index 39ae463970..ae4d48169e 100644
--- a/audio/softsynth/mt32/freeverb.h
+++ b/audio/softsynth/mt32/freeverb.h
@@ -1,24 +1,32 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * 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.
- *
- */
+#ifndef _freeverb_
+#define _freeverb_
+
+// Reverb model tuning values
+//
+// Written by Jezar at Dreampoint, June 2000
+// http://www.dreampoint.co.uk
+// This code is public domain
+
+const int numcombs = 8;
+const int numallpasses = 4;
+const float muted = 0;
+const float fixedgain = 0.015f;
+const float scalewet = 3;
+const float scaledry = 2;
+const float scaledamp = 0.4f;
+const float scaleroom = 0.28f;
+const float offsetroom = 0.7f;
+const float initialroom = 0.5f;
+const float initialdamp = 0.5f;
+const float initialwet = 1/scalewet;
+const float initialdry = 0;
+const float initialwidth = 1;
+const float initialmode = 0;
+const float freezemode = 0.5f;
+const int stereospread = 23;
+
+const int combtuning[] = {1116, 1188, 1277, 1356, 1422, 1491, 1557, 1617};
+const int allpasstuning[] = {556, 441, 341, 225};
// Macro for killing denormalled numbers
//
@@ -27,215 +35,155 @@
// Based on IS_DENORMAL macro by Jon Watte
// This code is public domain
-#ifndef FREEVERB_H
-#define FREEVERB_H
-
-// FIXME: Fix this really ugly hack
-inline float undenormalise(void *sample) {
- if (((*(unsigned int*)sample) & 0x7f800000) == 0)
+static inline float undenormalise(float x) {
+ union {
+ float f;
+ unsigned int i;
+ } u;
+ u.f = x;
+ if ((u.i & 0x7f800000) == 0) {
return 0.0f;
- return *(float*)sample;
+ }
+ return x;
}
-// Comb filter class declaration
+// Allpass filter declaration
+//
+// Written by Jezar at Dreampoint, June 2000
+// http://www.dreampoint.co.uk
+// This code is public domain
-class comb {
+class allpass
+{
public:
- comb();
- void setbuffer(float *buf, int size);
- inline float process(float inp);
- void mute();
- void setdamp(float val);
- float getdamp();
- void setfeedback(float val);
- float getfeedback();
-private:
- float feedback;
- float filterstore;
- float damp1;
- float damp2;
- float *buffer;
- int bufsize;
- int bufidx;
+ allpass();
+ void setbuffer(float *buf, int size);
+ void deletebuffer();
+ inline float process(float inp);
+ void mute();
+ void setfeedback(float val);
+ float getfeedback();
+// private:
+ float feedback;
+ float *buffer;
+ int bufsize;
+ int bufidx;
};
// Big to inline - but crucial for speed
-inline float comb::process(float input) {
+inline float allpass::process(float input)
+{
float output;
+ float bufout;
- output = buffer[bufidx];
- undenormalise(&output);
-
- filterstore = (output * damp2) + (filterstore * damp1);
- undenormalise(&filterstore);
+ bufout = undenormalise(buffer[bufidx]);
- buffer[bufidx] = input + (filterstore * feedback);
+ output = -input + bufout;
+ buffer[bufidx] = input + (bufout*feedback);
- if (++bufidx >= bufsize)
- bufidx = 0;
+ if (++bufidx>=bufsize) bufidx = 0;
return output;
}
-// Allpass filter declaration
+// Comb filter class declaration
+//
+// Written by Jezar at Dreampoint, June 2000
+// http://www.dreampoint.co.uk
+// This code is public domain
-class allpass {
+class comb
+{
public:
- allpass();
- void setbuffer(float *buf, int size);
- inline float process(float inp);
- void mute();
- void setfeedback(float val);
- float getfeedback();
+ comb();
+ void setbuffer(float *buf, int size);
+ void deletebuffer();
+ inline float process(float inp);
+ void mute();
+ void setdamp(float val);
+ float getdamp();
+ void setfeedback(float val);
+ float getfeedback();
private:
- float feedback;
- float *buffer;
- int bufsize;
- int bufidx;
+ float feedback;
+ float filterstore;
+ float damp1;
+ float damp2;
+ float *buffer;
+ int bufsize;
+ int bufidx;
};
// Big to inline - but crucial for speed
-inline float allpass::process(float input) {
+inline float comb::process(float input)
+{
float output;
- float bufout;
- bufout = buffer[bufidx];
- undenormalise(&bufout);
+ output = undenormalise(buffer[bufidx]);
- output = -input + bufout;
- buffer[bufidx] = input + (bufout * feedback);
+ filterstore = undenormalise((output*damp2) + (filterstore*damp1));
+
+ buffer[bufidx] = input + (filterstore*feedback);
- if (++bufidx >= bufsize)
- bufidx = 0;
+ if (++bufidx>=bufsize) bufidx = 0;
return output;
}
-
-// Reverb model tuning values
-
-const int numcombs = 8;
-const int numallpasses = 4;
-const float muted = 0;
-const float fixedgain = 0.015f;
-const float scalewet = 3;
-const float scaledry = 2;
-const float scaledamp = 0.4f;
-const float scaleroom = 0.28f;
-const float offsetroom = 0.7f;
-const float initialroom = 0.5f;
-const float initialdamp = 0.5f;
-const float initialwet = 1 / scalewet;
-const float initialdry = 0;
-const float initialwidth = 1;
-const float initialmode = 0;
-const float freezemode = 0.5f;
-const int stereospread = 23;
-
-// These values assume 44.1KHz sample rate
-// they will probably be OK for 48KHz sample rate
-// but would need scaling for 96KHz (or other) sample rates.
-// The values were obtained by listening tests.
-const int combtuningL1 = 1116;
-const int combtuningR1 = 1116 + stereospread;
-const int combtuningL2 = 1188;
-const int combtuningR2 = 1188 + stereospread;
-const int combtuningL3 = 1277;
-const int combtuningR3 = 1277 + stereospread;
-const int combtuningL4 = 1356;
-const int combtuningR4 = 1356 + stereospread;
-const int combtuningL5 = 1422;
-const int combtuningR5 = 1422 + stereospread;
-const int combtuningL6 = 1491;
-const int combtuningR6 = 1491 + stereospread;
-const int combtuningL7 = 1557;
-const int combtuningR7 = 1557 + stereospread;
-const int combtuningL8 = 1617;
-const int combtuningR8 = 1617 + stereospread;
-const int allpasstuningL1 = 556;
-const int allpasstuningR1 = 556 + stereospread;
-const int allpasstuningL2 = 441;
-const int allpasstuningR2 = 441 + stereospread;
-const int allpasstuningL3 = 341;
-const int allpasstuningR3 = 341 + stereospread;
-const int allpasstuningL4 = 225;
-const int allpasstuningR4 = 225 + stereospread;
-
-
// Reverb model declaration
+//
+// Written by Jezar at Dreampoint, June 2000
+// Modifications by Jerome Fisher, 2009
+// http://www.dreampoint.co.uk
+// This code is public domain
-class revmodel {
+class revmodel
+{
public:
- revmodel();
- void mute();
- void processmix(float *inputL, float *inputR, float *outputL, float *outputR, long numsamples, int skip);
- void processreplace(float *inputL, float *inputR, float *outputL, float *outputR, long numsamples, int skip);
- void setroomsize(float value);
- float getroomsize();
- void setdamp(float value);
- float getdamp();
- void setwet(float value);
- float getwet();
- void setdry(float value);
- float getdry();
- void setwidth(float value);
- float getwidth();
- void setmode(float value);
- float getmode();
+ revmodel(float scaletuning);
+ ~revmodel();
+ void mute();
+ void process(const float *inputL, const float *inputR, float *outputL, float *outputR, long numsamples);
+ void setroomsize(float value);
+ float getroomsize();
+ void setdamp(float value);
+ float getdamp();
+ void setwet(float value);
+ float getwet();
+ void setdry(float value);
+ float getdry();
+ void setwidth(float value);
+ float getwidth();
+ void setmode(float value);
+ float getmode();
+ void setfiltval(float value);
private:
- void update();
-
- float gain;
- float roomsize, roomsize1;
- float damp, damp1;
- float wet, wet1, wet2;
- float dry;
- float width;
- float mode;
-
- // The following are all declared inline
- // to remove the need for dynamic allocation
- // with its subsequent error-checking messiness
+ void update();
+private:
+ float gain;
+ float roomsize,roomsize1;
+ float damp,damp1;
+ float wet,wet1,wet2;
+ float dry;
+ float width;
+ float mode;
+
+ // LPF stuff
+ float filtval;
+ float filtprev1;
+ float filtprev2;
// Comb filters
- comb combL[numcombs];
- comb combR[numcombs];
+ comb combL[numcombs];
+ comb combR[numcombs];
// Allpass filters
allpass allpassL[numallpasses];
allpass allpassR[numallpasses];
-
- // Buffers for the combs
- float bufcombL1[combtuningL1];
- float bufcombR1[combtuningR1];
- float bufcombL2[combtuningL2];
- float bufcombR2[combtuningR2];
- float bufcombL3[combtuningL3];
- float bufcombR3[combtuningR3];
- float bufcombL4[combtuningL4];
- float bufcombR4[combtuningR4];
- float bufcombL5[combtuningL5];
- float bufcombR5[combtuningR5];
- float bufcombL6[combtuningL6];
- float bufcombR6[combtuningR6];
- float bufcombL7[combtuningL7];
- float bufcombR7[combtuningR7];
- float bufcombL8[combtuningL8];
- float bufcombR8[combtuningR8];
-
- // Buffers for the allpasses
- float bufallpassL1[allpasstuningL1];
- float bufallpassR1[allpasstuningR1];
- float bufallpassL2[allpasstuningL2];
- float bufallpassR2[allpasstuningR2];
- float bufallpassL3[allpasstuningL3];
- float bufallpassR3[allpasstuningR3];
- float bufallpassL4[allpasstuningL4];
- float bufallpassR4[allpasstuningR4];
};
-#endif
+#endif//_freeverb_
diff --git a/audio/softsynth/mt32/i386.cpp b/audio/softsynth/mt32/i386.cpp
deleted file mode 100644
index f092189d76..0000000000
--- a/audio/softsynth/mt32/i386.cpp
+++ /dev/null
@@ -1,849 +0,0 @@
-/* Copyright (c) 2003-2005 Various contributors
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- * IN THE SOFTWARE.
- */
-
-#include "mt32emu.h"
-
-#ifdef MT32EMU_HAVE_X86
-
-namespace MT32Emu {
-
-#ifndef _MSC_VER
-
-#define eflag(value) __asm__ __volatile__("pushfl \n popfl \n" : : "a"(value))
-#define cpuid_flag (1 << 21)
-
-static inline bool atti386_DetectCPUID() {
- unsigned int result;
-
- // Is there a cpuid?
- result = cpuid_flag; // set test
- eflag(result);
- if (!(result & cpuid_flag))
- return false;
-
- result = 0; // clear test
- eflag(result);
- if (result & cpuid_flag)
- return false;
-
- return true;
-}
-
-static inline bool atti386_DetectSIMD() {
- unsigned int result;
-
- if (atti386_DetectCPUID() == false)
- return false;
-
- /* check cpuid */
- __asm__ __volatile__(
- "pushl %%ebx \n" \
- "movl $1, %%eax \n" \
- "cpuid \n" \
- "movl %%edx, %0 \n" \
- "popl %%ebx \n" \
- : "=r"(result) : : "eax", "ecx", "edx");
-
- if (result & (1 << 25))
- return true;
-
- return false;
-}
-
-static inline bool atti386_Detect3DNow() {
- unsigned int result;
-
- if (atti386_DetectCPUID() == false)
- return false;
-
- // get cpuid
- __asm__ __volatile__(
- "pushl %%ebx \n" \
- "movl $0x80000001, %%eax \n" \
- "cpuid \n" \
- "movl %%edx, %0 \n" \
- "popl %%ebx \n" \
- : "=r"(result) : : "eax", "ecx", "edx");
-
- if (result & 0x80000000)
- return true;
-
- return false;
-}
-
-
-static inline float atti386_iir_filter_sse(float *output, float *hist1_ptr, float *coef_ptr) {
- __asm__ __volatile__ (
- "pushl %1 \n" \
- "pushl %2 \n" \
- "movss 0(%0), %%xmm1 \n" \
- "movups 0(%1), %%xmm2 \n" \
- "movlps 0(%2), %%xmm3 \n" \
- " \n" \
- "shufps $0x44, %%xmm3, %%xmm3 \n" \
- " \n" \
- "mulps %%xmm3, %%xmm2 \n" \
- " \n" \
- "subss %%xmm2, %%xmm1 \n" \
- "shufps $0x39, %%xmm2, %%xmm2 \n" \
- "subss %%xmm2, %%xmm1 \n" \
- " \n" \
- "movss %%xmm1, 0(%2) \n" \
- " \n" \
- "shufps $0x39, %%xmm2, %%xmm2 \n" \
- "addss %%xmm2, %%xmm1 \n" \
- " \n" \
- "shufps $0x39, %%xmm2, %%xmm2 \n" \
- "addss %%xmm2, %%xmm1 \n" \
- " \n" \
- "movss %%xmm3, 4(%2) \n" \
- " \n" \
- "addl $16, %1 \n" \
- "addl $8, %2 \n" \
- " \n" \
- "movups 0(%1), %%xmm2 \n" \
- " \n" \
- "movlps 0(%2), %%xmm3 \n" \
- "shufps $0x44, %%xmm3, %%xmm3 \n" \
- " \n" \
- "mulps %%xmm3, %%xmm2 \n" \
- " \n" \
- "subss %%xmm2, %%xmm1 \n" \
- "shufps $0x39, %%xmm2, %%xmm2 \n" \
- "subss %%xmm2, %%xmm1 \n" \
- " \n" \
- "movss %%xmm1, 0(%2) \n" \
- " \n" \
- "shufps $0x39, %%xmm2, %%xmm2 \n" \
- "addss %%xmm2, %%xmm1 \n" \
- " \n" \
- "shufps $0x39, %%xmm2, %%xmm2 \n" \
- "addss %%xmm2, %%xmm1 \n" \
- " \n" \
- "movss %%xmm3, 4(%2) \n" \
- "movss %%xmm1, 0(%0) \n" \
- "popl %2 \n" \
- "popl %1 \n" \
- : : "r"(output), "r"(coef_ptr), "r"(hist1_ptr)
- : "memory"
-#ifdef __SSE__
- , "xmm1", "xmm2", "xmm3"
-#endif
- );
-
- return *output;
-}
-
-static inline float atti386_iir_filter_3DNow(float output, float *hist1_ptr, float *coef_ptr) {
- float tmp;
-
- __asm__ __volatile__ (
- "movq %0, %%mm1 \n" \
- " \n" \
- "movl %1, %%edi \n" \
- "movq 0(%%edi), %%mm2 \n" \
- " \n" \
- "movl %2, %%eax; \n" \
- "movq 0(%%eax), %%mm3 \n" \
- " \n" \
- "pfmul %%mm3, %%mm2 \n" \
- "pfsub %%mm2, %%mm1 \n" \
- " \n" \
- "psrlq $32, %%mm2 \n" \
- "pfsub %%mm2, %%mm1 \n" \
- " \n" \
- "movd %%mm1, %3 \n" \
- " \n" \
- "addl $8, %%edi \n" \
- "movq 0(%%edi), %%mm2 \n" \
- "movq 0(%%eax), %%mm3 \n" \
- " \n" \
- "pfmul %%mm3, %%mm2 \n" \
- "pfadd %%mm2, %%mm1 \n" \
- " \n" \
- "psrlq $32, %%mm2 \n" \
- "pfadd %%mm2, %%mm1 \n" \
- " \n" \
- "pushl %3 \n" \
- "popl 0(%%eax) \n" \
- " \n" \
- "movd %%mm3, 4(%%eax) \n" \
- " \n" \
- "addl $8, %%edi \n" \
- "addl $8, %%eax \n" \
- " \n" \
- "movq 0(%%edi), %%mm2 \n" \
- "movq 0(%%eax), %%mm3 \n" \
- " \n" \
- "pfmul %%mm3, %%mm2 \n" \
- "pfsub %%mm2, %%mm1 \n" \
- " \n" \
- "psrlq $32, %%mm2 \n" \
- "pfsub %%mm2, %%mm1 \n" \
- " \n" \
- "movd %%mm1, %3 \n" \
- " \n" \
- "addl $8, %%edi \n" \
- "movq 0(%%edi), %%mm2 \n" \
- "movq 0(%%eax), %%mm3 \n" \
- " \n" \
- "pfmul %%mm3, %%mm2 \n" \
- "pfadd %%mm2, %%mm1 \n" \
- " \n" \
- "psrlq $32, %%mm2 \n" \
- "pfadd %%mm2, %%mm1 \n" \
- " \n" \
- "pushl %3 \n" \
- "popl 0(%%eax) \n" \
- "movd %%mm3, 4(%%eax) \n" \
- " \n" \
- "movd %%mm1, %0 \n" \
- "femms \n" \
- : "=m"(output) : "g"(coef_ptr), "g"(hist1_ptr), "m"(tmp)
- : "eax", "edi", "memory"
-#ifdef __MMX__
- , "mm1", "mm2", "mm3"
-#endif
- );
-
- return output;
-}
-
-static inline void atti386_produceOutput1(int tmplen, Bit16s myvolume, Bit16s *useBuf, Bit16s *snd) {
- __asm__ __volatile__(
- "movl %0, %%ecx \n" \
- "movw %1, %%ax \n" \
- "shll $16, %%eax \n" \
- "movw %1, %%ax \n" \
- "movd %%eax, %%mm3 \n" \
- "movd %%eax, %%mm2 \n" \
- "psllq $32, %%mm3 \n" \
- "por %%mm2, %%mm3 \n" \
- "movl %2, %%esi \n" \
- "movl %3, %%edi \n" \
- "1: \n" \
- "movq 0(%%esi), %%mm1 \n" \
- "movq 0(%%edi), %%mm2 \n" \
- "pmulhw %%mm3, %%mm1 \n" \
- "paddw %%mm2, %%mm1 \n" \
- "movq %%mm1, 0(%%edi) \n" \
- " \n" \
- "addl $8, %%esi \n" \
- "addl $8, %%edi \n" \
- " \n" \
- "decl %%ecx \n" \
- "cmpl $0, %%ecx \n" \
- "jg 1b \n" \
- "emms \n" \
- : : "g"(tmplen), "g"(myvolume), "g"(useBuf), "g"(snd)
- : "eax", "ecx", "edi", "esi", "memory"
-#ifdef __MMX__
- , "mm1", "mm2", "mm3"
-#endif
- );
-}
-
-static inline void atti386_produceOutput2(Bit32u len, Bit16s *snd, float *sndbufl, float *sndbufr, float *multFactor) {
- __asm__ __volatile__(
- "movl %4, %%ecx \n" \
- "shrl $1, %%ecx \n" \
- "addl $4, %%ecx \n" \
- "pushl %%ecx \n" \
- " \n" \
- "movl %0, %%esi \n" \
- "movups 0(%%esi), %%xmm1 \n" \
- " \n" \
- "movl %1, %%esi \n" \
- "movl %2, %%edi \n" \
- "1: \n" \
- "xorl %%eax, %%eax \n" \
- "movw 0(%1), %%ax \n" \
- "cwde \n" \
- "incl %1 \n" \
- "incl %1 \n" \
- "movd %%eax, %%mm1 \n" \
- "psrlq $32, %%mm1 \n" \
- "movw 0(%1), %%ax \n" \
- "incl %1 \n" \
- "incl %1 \n" \
- "movd %%eax, %%mm2 \n" \
- "por %%mm2, %%mm1 \n" \
- " \n" \
- "decl %%ecx \n" \
- "jnz 1b \n" \
- " \n" \
- "popl %%ecx \n" \
- "movl %1, %%esi \n" \
- "movl %3, %%edi \n" \
- "incl %%esi \n" \
- "2: \n" \
- "decl %%ecx \n" \
- "jnz 2b \n" \
- : : "g"(multFactor), "r"(snd), "g"(sndbufl), "g"(sndbufr), "g"(len)
- : "eax", "ecx", "edi", "esi", "mm1", "mm2", "xmm1", "memory");
-}
-
-static inline void atti386_mixBuffers(Bit16s * buf1, Bit16s *buf2, int len) {
- __asm__ __volatile__(
- "movl %0, %%ecx \n" \
- "movl %1, %%esi \n" \
- "movl %2, %%edi \n" \
- "1: \n" \
- "movq 0(%%edi), %%mm1 \n" \
- "movq 0(%%esi), %%mm2 \n" \
- "paddw %%mm2, %%mm1 \n" \
- "movq %%mm1, 0(%%esi) \n" \
- "addl $8, %%edi \n" \
- "addl $8, %%esi \n" \
- "decl %%ecx \n" \
- "cmpl $0, %%ecx \n" \
- "jg 1b \n" \
- "emms \n" \
- : : "g"(len), "g"(buf1), "g"(buf2)
- : "ecx", "edi", "esi", "memory"
-#ifdef __MMX__
- , "mm1", "mm2"
-#endif
- );
-}
-
-static inline void atti386_mixBuffersRingMix(Bit16s * buf1, Bit16s *buf2, int len) {
- __asm__ __volatile__(
- "movl %0, %%ecx \n" \
- "movl %1, %%esi \n" \
- "movl %2, %%edi \n" \
- "1: \n" \
- "movq 0(%%esi), %%mm1 \n" \
- "movq 0(%%edi), %%mm2 \n" \
- "movq %%mm1, %%mm3 \n" \
- "pmulhw %%mm2, %%mm1 \n" \
- "paddw %%mm3, %%mm1 \n" \
- "movq %%mm1, 0(%%esi) \n" \
- "addl $8, %%edi \n" \
- "addl $8, %%esi \n" \
- "decl %%ecx \n" \
- "cmpl $0, %%ecx \n" \
- "jg 1b \n" \
- "emms \n" \
- : : "g"(len), "g"(buf1), "g"(buf2)
- : "ecx", "edi", "esi", "memory"
-#ifdef __MMX__
- , "mm1", "mm2", "mm3"
-#endif
- );
-}
-
-static inline void atti386_mixBuffersRing(Bit16s * buf1, Bit16s *buf2, int len) {
- __asm__ __volatile__(
- "movl %0, %%ecx \n" \
- "movl %1, %%esi \n" \
- "movl %2, %%edi \n" \
- "1: \n" \
- "movq 0(%%esi), %%mm1 \n" \
- "movq 0(%%edi), %%mm2 \n" \
- "pmulhw %%mm2, %%mm1 \n" \
- "movq %%mm1, 0(%%esi) \n" \
- "addl $8, %%edi \n" \
- "addl $8, %%esi \n" \
- "decl %%ecx \n" \
- "cmpl $0, %%ecx \n" \
- "jg 1b \n" \
- "emms \n" \
- : : "g"(len), "g"(buf1), "g"(buf2)
- : "ecx", "edi", "esi", "memory"
-#ifdef __MMX__
- , "mm1", "mm2"
-#endif
- );
-}
-
-static inline void atti386_partialProductOutput(int quadlen, Bit16s leftvol, Bit16s rightvol, Bit16s *partialBuf, Bit16s *p1buf) {
- __asm__ __volatile__(
- "movl %0, %%ecx \n" \
- "movw %1, %%ax \n" \
- "shll $16, %%eax \n" \
- "movw %2, %%ax \n" \
- "movd %%eax, %%mm1 \n" \
- "movd %%eax, %%mm2 \n" \
- "psllq $32, %%mm1 \n" \
- "por %%mm2, %%mm1 \n" \
- "movl %3, %%edi \n" \
- "movl %4, %%esi \n" \
- "pushl %%ebx \n" \
- "1: \n" \
- "movw 0(%%esi), %%bx \n" \
- "addl $2, %%esi \n" \
- "movw 0(%%esi), %%dx \n" \
- "addl $2, %%esi \n" \
- "" \
- "movw %%dx, %%ax \n" \
- "shll $16, %%eax \n" \
- "movw %%dx, %%ax \n" \
- "movd %%eax, %%mm2 \n" \
- "psllq $32, %%mm2 \n" \
- "movw %%bx, %%ax \n" \
- "shll $16, %%eax \n" \
- "movw %%bx, %%ax \n" \
- "movd %%eax, %%mm3 \n" \
- "por %%mm3, %%mm2 \n" \
- "" \
- "pmulhw %%mm1, %%mm2 \n" \
- "movq %%mm2, 0(%%edi) \n" \
- "addl $8, %%edi \n" \
- "" \
- "decl %%ecx \n" \
- "cmpl $0, %%ecx \n" \
- "jg 1b \n" \
- "emms \n" \
- "popl %%ebx \n" \
- : : "g"(quadlen), "g"(leftvol), "g"(rightvol), "g"(partialBuf), "g"(p1buf)
- : "eax", "ecx", "edx", "edi", "esi", "memory"
-#ifdef __MMX__
- , "mm1", "mm2", "mm3"
-#endif
- );
-}
-
-#endif
-
-bool DetectSIMD() {
-#ifdef _MSC_VER
- bool found_simd;
- __asm {
- pushfd
- pop eax // get EFLAGS into eax
- mov ebx,eax // keep a copy
- xor eax,0x200000
- // toggle CPUID bit
-
- push eax
- popfd // set new EFLAGS
- pushfd
- pop eax // EFLAGS back into eax
-
- xor eax,ebx
- // have we changed the ID bit?
-
- je NO_SIMD
- // No, no CPUID instruction
-
- // we could toggle the
- // ID bit so CPUID is present
- mov eax,1
-
- cpuid // get processor features
- test edx,1<<25 // check the SIMD bit
- jz NO_SIMD
- mov found_simd,1
- jmp DONE
- NO_SIMD:
- mov found_simd,0
- DONE:
- }
- return found_simd;
-#else
- return atti386_DetectSIMD();
-#endif
-}
-
-bool Detect3DNow() {
-#ifdef _MSC_VER
- bool found3D = false;
- __asm {
- pushfd
- pop eax
- mov edx, eax
- xor eax, 00200000h
- push eax
- popfd
- pushfd
- pop eax
- xor eax, edx
- jz NO_3DNOW
-
- mov eax, 80000000h
- cpuid
-
- cmp eax, 80000000h
- jbe NO_3DNOW
-
- mov eax, 80000001h
- cpuid
- test edx, 80000000h
- jz NO_3DNOW
- mov found3D, 1
-NO_3DNOW:
-
- }
- return found3D;
-#else
- return atti386_Detect3DNow();
-#endif
-}
-
-float iir_filter_sse(float input,float *hist1_ptr, float *coef_ptr) {
- float output;
-
- // 1st number of coefficients array is overall input scale factor, or filter gain
- output = input * (*coef_ptr++);
-
-#ifdef _MSC_VER
- __asm {
-
- movss xmm1, output
-
- mov eax, coef_ptr
- movups xmm2, [eax]
-
- mov eax, hist1_ptr
- movlps xmm3, [eax]
- shufps xmm3, xmm3, 44h
- // hist1_ptr+1, hist1_ptr, hist1_ptr+1, hist1_ptr
-
- mulps xmm2, xmm3
-
- subss xmm1, xmm2
- // Rotate elements right
- shufps xmm2, xmm2, 39h
- subss xmm1, xmm2
-
- // Store new_hist
- movss DWORD PTR [eax], xmm1
-
- // Rotate elements right
- shufps xmm2, xmm2, 39h
- addss xmm1, xmm2
-
- // Rotate elements right
- shufps xmm2, xmm2, 39h
- addss xmm1, xmm2
-
- // Store previous hist
- movss DWORD PTR [eax+4], xmm3
-
- add coef_ptr, 16
- add hist1_ptr, 8
-
- mov eax, coef_ptr
- movups xmm2, [eax]
-
- mov eax, hist1_ptr
- movlps xmm3, [eax]
- shufps xmm3, xmm3, 44h
- // hist1_ptr+1, hist1_ptr, hist1_ptr+1, hist1_ptr
-
- mulps xmm2, xmm3
-
- subss xmm1, xmm2
- // Rotate elements right
- shufps xmm2, xmm2, 39h
- subss xmm1, xmm2
-
- // Store new_hist
- movss DWORD PTR [eax], xmm1
-
- // Rotate elements right
- shufps xmm2, xmm2, 39h
- addss xmm1, xmm2
-
- // Rotate elements right
- shufps xmm2, xmm2, 39h
- addss xmm1, xmm2
-
- // Store previous hist
- movss DWORD PTR [eax+4], xmm3
-
- movss output, xmm1
- }
-#else
- output = atti386_iir_filter_sse(&output, hist1_ptr, coef_ptr);
-#endif
- return output;
-}
-
-float iir_filter_3dnow(float input,float *hist1_ptr, float *coef_ptr) {
- float output;
-
- // 1st number of coefficients array is overall input scale factor, or filter gain
- output = input * (*coef_ptr++);
-
- // I find it very sad that 3DNow requires twice as many instructions as Intel's SSE
- // Intel does have the upper hand here.
-#ifdef _MSC_VER
- float tmp;
- __asm {
- movq mm1, output
- mov ebx, coef_ptr
- movq mm2, [ebx]
-
- mov eax, hist1_ptr;
- movq mm3, [eax]
-
- pfmul mm2, mm3
- pfsub mm1, mm2
-
- psrlq mm2, 32
- pfsub mm1, mm2
-
- // Store new hist
- movd tmp, mm1
-
- add ebx, 8
- movq mm2, [ebx]
- movq mm3, [eax]
-
- pfmul mm2, mm3
- pfadd mm1, mm2
-
- psrlq mm2, 32
- pfadd mm1, mm2
-
- push tmp
- pop DWORD PTR [eax]
-
- movd DWORD PTR [eax+4], mm3
-
- add ebx, 8
- add eax, 8
-
- movq mm2, [ebx]
- movq mm3, [eax]
-
- pfmul mm2, mm3
- pfsub mm1, mm2
-
- psrlq mm2, 32
- pfsub mm1, mm2
-
- // Store new hist
- movd tmp, mm1
-
- add ebx, 8
- movq mm2, [ebx]
- movq mm3, [eax]
-
- pfmul mm2, mm3
- pfadd mm1, mm2
-
- psrlq mm2, 32
- pfadd mm1, mm2
-
- push tmp
- pop DWORD PTR [eax]
- movd DWORD PTR [eax+4], mm3
-
- movd output, mm1
-
- femms
- }
-#else
- output = atti386_iir_filter_3DNow(output, hist1_ptr, coef_ptr);
-#endif
- return output;
-}
-
-#if MT32EMU_USE_MMX > 0
-
-int i386_partialProductOutput(int len, Bit16s leftvol, Bit16s rightvol, Bit16s *partialBuf, Bit16s *mixedBuf) {
- int tmplen = len >> 1;
- if (tmplen == 0) {
- return 0;
- }
-#ifdef _MSC_VER
- __asm {
- mov ecx,tmplen
- mov ax, leftvol
- shl eax,16
- mov ax, rightvol
- movd mm1, eax
- movd mm2, eax
- psllq mm1, 32
- por mm1, mm2
- mov edi, partialBuf
- mov esi, mixedBuf
-mmxloop1:
- mov bx, [esi]
- add esi,2
- mov dx, [esi]
- add esi,2
-
- mov ax, dx
- shl eax, 16
- mov ax, dx
- movd mm2,eax
- psllq mm2, 32
- mov ax, bx
- shl eax, 16
- mov ax, bx
- movd mm3,eax
- por mm2,mm3
-
- pmulhw mm2, mm1
- movq [edi], mm2
- add edi, 8
-
- dec ecx
- cmp ecx,0
- jg mmxloop1
- emms
- }
-#else
- atti386_partialProductOutput(tmplen, leftvol, rightvol, partialBuf, mixedBuf);
-#endif
- return tmplen << 1;
-}
-
-int i386_mixBuffers(Bit16s * buf1, Bit16s *buf2, int len) {
- int tmplen = len >> 2;
- if (tmplen == 0) {
- return 0;
- }
-#ifdef _MSC_VER
- __asm {
- mov ecx, tmplen
- mov esi, buf1
- mov edi, buf2
-
-mixloop1:
- movq mm1, [edi]
- movq mm2, [esi]
- paddw mm1,mm2
- movq [esi],mm1
- add edi,8
- add esi,8
-
- dec ecx
- cmp ecx,0
- jg mixloop1
- emms
- }
-#else
- atti386_mixBuffers(buf1, buf2, tmplen);
-#endif
- return tmplen << 2;
-}
-
-
-int i386_mixBuffersRingMix(Bit16s * buf1, Bit16s *buf2, int len) {
- int tmplen = len >> 2;
- if (tmplen == 0) {
- return 0;
- }
-#ifdef _MSC_VER
- __asm {
- mov ecx, tmplen
- mov esi, buf1
- mov edi, buf2
-
-mixloop2:
- movq mm1, [esi]
- movq mm2, [edi]
- movq mm3, mm1
- pmulhw mm1, mm2
- paddw mm1,mm3
- movq [esi],mm1
- add edi,8
- add esi,8
-
- dec ecx
- cmp ecx,0
- jg mixloop2
- emms
- }
-#else
- atti386_mixBuffersRingMix(buf1, buf2, tmplen);
-#endif
- return tmplen << 2;
-}
-
-int i386_mixBuffersRing(Bit16s * buf1, Bit16s *buf2, int len) {
- int tmplen = len >> 2;
- if (tmplen == 0) {
- return 0;
- }
-#ifdef _MSC_VER
- __asm {
- mov ecx, tmplen
- mov esi, buf1
- mov edi, buf2
-
-mixloop3:
- movq mm1, [esi]
- movq mm2, [edi]
- pmulhw mm1, mm2
- movq [esi],mm1
- add edi,8
- add esi,8
-
- dec ecx
- cmp ecx,0
- jg mixloop3
- emms
- }
-#else
- atti386_mixBuffersRing(buf1, buf2, tmplen);
-#endif
- return tmplen << 2;
-}
-
-int i386_produceOutput1(Bit16s *useBuf, Bit16s *stream, Bit32u len, Bit16s volume) {
- int tmplen = (len >> 1);
- if (tmplen == 0) {
- return 0;
- }
-#ifdef _MSC_VER
- __asm {
- mov ecx, tmplen
- mov ax,volume
- shl eax,16
- mov ax,volume
- movd mm3,eax
- movd mm2,eax
- psllq mm3, 32
- por mm3,mm2
- mov esi, useBuf
- mov edi, stream
-mixloop4:
- movq mm1, [esi]
- movq mm2, [edi]
- pmulhw mm1, mm3
- paddw mm1,mm2
- movq [edi], mm1
-
- add esi,8
- add edi,8
-
- dec ecx
- cmp ecx,0
- jg mixloop4
- emms
- }
-#else
- atti386_produceOutput1(tmplen, volume, useBuf, stream);
-#endif
- return tmplen << 1;
-}
-
-#endif
-
-}
-
-#endif
diff --git a/audio/softsynth/mt32/i386.h b/audio/softsynth/mt32/i386.h
deleted file mode 100644
index e8644411cd..0000000000
--- a/audio/softsynth/mt32/i386.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/* Copyright (c) 2003-2005 Various contributors
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- * IN THE SOFTWARE.
- */
-
-#ifndef MT32EMU_I386_H
-#define MT32EMU_I386_H
-
-namespace MT32Emu {
-#ifdef MT32EMU_HAVE_X86
-
-// Function that detects the availablity of SSE SIMD instructions
-bool DetectSIMD();
-// Function that detects the availablity of 3DNow instructions
-bool Detect3DNow();
-
-float iir_filter_sse(float input,float *hist1_ptr, float *coef_ptr);
-float iir_filter_3dnow(float input,float *hist1_ptr, float *coef_ptr);
-float iir_filter_normal(float input,float *hist1_ptr, float *coef_ptr);
-
-#if MT32EMU_USE_MMX > 0
-int i386_partialProductOutput(int len, Bit16s leftvol, Bit16s rightvol, Bit16s *partialBuf, Bit16s *mixedBuf);
-int i386_mixBuffers(Bit16s * buf1, Bit16s *buf2, int len);
-int i386_mixBuffersRingMix(Bit16s * buf1, Bit16s *buf2, int len);
-int i386_mixBuffersRing(Bit16s * buf1, Bit16s *buf2, int len);
-int i386_produceOutput1(Bit16s *useBuf, Bit16s *stream, Bit32u len, Bit16s volume);
-#endif
-
-#endif
-
-}
-
-#endif
diff --git a/audio/softsynth/mt32/mmath.h b/audio/softsynth/mt32/mmath.h
new file mode 100644
index 0000000000..226d73e27e
--- /dev/null
+++ b/audio/softsynth/mt32/mmath.h
@@ -0,0 +1,73 @@
+/* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher
+ * Copyright (C) 2011 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef MT32EMU_MMATH_H
+#define MT32EMU_MMATH_H
+
+#define FIXEDPOINT_UDIV(x, y, point) (((x) << (point)) / ((y)))
+#define FIXEDPOINT_SDIV(x, y, point) (((x) * (1 << point)) / ((y)))
+#define FIXEDPOINT_UMULT(x, y, point) (((x) * (y)) >> point)
+#define FIXEDPOINT_SMULT(x, y, point) (((x) * (y)) / (1 << point))
+
+#define FIXEDPOINT_MAKE(x, point) ((Bit32u)((1 << point) * x))
+
+namespace MT32Emu {
+
+// Mathematical constants
+const double DOUBLE_PI = 3.141592653589793;
+const double DOUBLE_LN_10 = 2.302585092994046;
+const float FLOAT_PI = 3.1415927f;
+const float FLOAT_2PI = 6.2831853f;
+const float FLOAT_LN_2 = 0.6931472f;
+const float FLOAT_LN_10 = 2.3025851f;
+
+static inline float POWF(float x, float y) {
+ return pow(x, y);
+}
+
+static inline float EXPF(float x) {
+ return exp(x);
+}
+
+static inline float EXP2F(float x) {
+#ifdef __APPLE__
+ // on OSX exp2f() is 1.59 times faster than "exp() and the multiplication with FLOAT_LN_2"
+ return exp2(x);
+#else
+ return exp(FLOAT_LN_2 * x);
+#endif
+}
+
+static inline float EXP10F(float x) {
+ return exp(FLOAT_LN_10 * x);
+}
+
+static inline float LOGF(float x) {
+ return log(x);
+}
+
+static inline float LOG2F(float x) {
+ return log(x) / FLOAT_LN_2;
+}
+
+static inline float LOG10F(float x) {
+ return log10(x);
+}
+
+}
+
+#endif
diff --git a/audio/softsynth/mt32/module.mk b/audio/softsynth/mt32/module.mk
index a8329bc98c..995e450076 100644
--- a/audio/softsynth/mt32/module.mk
+++ b/audio/softsynth/mt32/module.mk
@@ -1,13 +1,19 @@
MODULE := audio/softsynth/mt32
MODULE_OBJS := \
- mt32_file.o \
- i386.o \
- part.o \
- partial.o \
- partialManager.o \
- synth.o \
- tables.o \
+ AReverbModel.o \
+ DelayReverb.o \
+ FreeverbModel.o \
+ LA32Ramp.o \
+ Part.o \
+ Partial.o \
+ PartialManager.o \
+ Poly.o \
+ Synth.o \
+ TVA.o \
+ TVF.o \
+ TVP.o \
+ Tables.o \
freeverb.o
# Include common rules
diff --git a/audio/softsynth/mt32/mt32_file.cpp b/audio/softsynth/mt32/mt32_file.cpp
deleted file mode 100644
index 643082b086..0000000000
--- a/audio/softsynth/mt32/mt32_file.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-/* Copyright (c) 2003-2005 Various contributors
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- * IN THE SOFTWARE.
- */
-
-
-#include "mt32emu.h"
-
-namespace MT32Emu {
-
-bool File::readBit16u(Bit16u *in) {
- Bit8u b[2];
- if (read(&b[0], 2) != 2)
- return false;
- *in = ((b[0] << 8) | b[1]);
- return true;
-}
-
-bool File::readBit32u(Bit32u *in) {
- Bit8u b[4];
- if (read(&b[0], 4) != 4)
- return false;
- *in = ((b[0] << 24) | (b[1] << 16) | (b[2] << 8) | b[3]);
- return true;
-}
-
-bool File::writeBit16u(Bit16u out) {
- if (!writeBit8u((Bit8u)((out & 0xFF00) >> 8))) {
- return false;
- }
- if (!writeBit8u((Bit8u)(out & 0x00FF))) {
- return false;
- }
- return true;
-}
-
-bool File::writeBit32u(Bit32u out) {
- if (!writeBit8u((Bit8u)((out & 0xFF000000) >> 24))) {
- return false;
- }
- if (!writeBit8u((Bit8u)((out & 0x00FF0000) >> 16))) {
- return false;
- }
- if (!writeBit8u((Bit8u)((out & 0x0000FF00) >> 8))) {
- return false;
- }
- if (!writeBit8u((Bit8u)(out & 0x000000FF))) {
- return false;
- }
- return true;
-}
-
-} // End of namespace MT32Emu
diff --git a/audio/softsynth/mt32/mt32_file.h b/audio/softsynth/mt32/mt32_file.h
deleted file mode 100644
index e6641660ee..0000000000
--- a/audio/softsynth/mt32/mt32_file.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* Copyright (c) 2003-2005 Various contributors
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- * IN THE SOFTWARE.
- */
-
-#ifndef MT32EMU_FILE_H
-#define MT32EMU_FILE_H
-
-#include "common/scummsys.h"
-
-namespace MT32Emu {
-
-class File {
-public:
- enum OpenMode {
- OpenMode_read = 0,
- OpenMode_write = 1
- };
- virtual ~File() {}
- virtual void close() = 0;
- virtual size_t read(void *in, size_t size) = 0;
- virtual bool readBit8u(Bit8u *in) = 0;
- virtual bool readBit16u(Bit16u *in);
- virtual bool readBit32u(Bit32u *in);
- virtual size_t write(const void *out, size_t size) = 0;
- virtual bool writeBit8u(Bit8u out) = 0;
- // Note: May write a single byte to the file before failing
- virtual bool writeBit16u(Bit16u out);
- // Note: May write some (<4) bytes to the file before failing
- virtual bool writeBit32u(Bit32u out);
- virtual bool isEOF() = 0;
-};
-
-} // End of namespace MT32Emu
-
-#endif
diff --git a/audio/softsynth/mt32/mt32emu.h b/audio/softsynth/mt32/mt32emu.h
index 6eedf04bc0..091819b95c 100644
--- a/audio/softsynth/mt32/mt32emu.h
+++ b/audio/softsynth/mt32/mt32emu.h
@@ -1,37 +1,70 @@
-/* Copyright (c) 2003-2005 Various contributors
+/* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher
+ * Copyright (C) 2011 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
*
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 2.1 of the License, or
+ * (at your option) any later version.
*
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
*
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- * IN THE SOFTWARE.
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MT32EMU_MT32EMU_H
#define MT32EMU_MT32EMU_H
// Debugging
-// Show the instruments played
-#define MT32EMU_MONITOR_INSTRUMENTS 1
-// Shows number of partials MT-32 is playing, and on which parts
+
+// 0: Standard debug output is not stamped with the rendered sample count
+// 1: Standard debug output is stamped with the rendered sample count
+// NOTE: The "samplestamp" corresponds to the end of the last completed rendering run.
+// This is important to bear in mind for debug output that occurs during a run.
+#define MT32EMU_DEBUG_SAMPLESTAMPS 0
+
+// 0: No debug output for initialisation progress
+// 1: Debug output for initialisation progress
+#define MT32EMU_MONITOR_INIT 0
+
+// 0: No debug output for MIDI events
+// 1: Debug output for weird MIDI events
+#define MT32EMU_MONITOR_MIDI 0
+
+// 0: No debug output for note on/off
+// 1: Basic debug output for note on/off
+// 2: Comprehensive debug output for note on/off
+#define MT32EMU_MONITOR_INSTRUMENTS 0
+
+// 0: No debug output for partial allocations
+// 1: Show partial stats when an allocation fails
+// 2: Show partial stats with every new poly
+// 3: Show individual partial allocations/deactivations
#define MT32EMU_MONITOR_PARTIALS 0
-// Determines how the waveform cache file is handled (must be regenerated after sampling rate change)
-#define MT32EMU_WAVECACHEMODE 0 // Load existing cache if possible, otherwise generate and save cache
-//#define MT32EMU_WAVECACHEMODE 1 // Load existing cache if possible, otherwise generate but don't save cache
-//#define MT32EMU_WAVECACHEMODE 2 // Ignore existing cache, generate and save cache
-//#define MT32EMU_WAVECACHEMODE 3 // Ignore existing cache, generate but don't save cache
+
+// 0: No debug output for sysex
+// 1: Basic debug output for sysex
+#define MT32EMU_MONITOR_SYSEX 0
+
+// 0: No debug output for sysex writes to the timbre areas
+// 1: Debug output with the name and location of newly-written timbres
+// 2: Complete dump of timbre parameters for newly-written timbres
+#define MT32EMU_MONITOR_TIMBRES 0
+
+// 0: No TVA/TVF-related debug output.
+// 1: Shows changes to TVA/TVF target, increment and phase.
+#define MT32EMU_MONITOR_TVA 0
+#define MT32EMU_MONITOR_TVF 0
+
+
+// 0: Use LUTs to speedup WG
+// 1: Use precise float math
+#define MT32EMU_ACCURATE_WG 0
+
+#define MT32EMU_USE_EXTINT 0
// Configuration
// The maximum number of partials playing simultaneously
@@ -39,32 +72,43 @@
// The maximum number of notes playing simultaneously per part.
// No point making it more than MT32EMU_MAX_PARTIALS, since each note needs at least one partial.
#define MT32EMU_MAX_POLY 32
-// This calculates the exact frequencies of notes as they are played, instead of offsetting from pre-cached semitones. Potentially very slow.
-#define MT32EMU_ACCURATENOTES 0
-
-#if (defined (_MSC_VER) && defined(_M_IX86))
-#define MT32EMU_HAVE_X86
-#elif defined(__GNUC__)
-#if __GNUC__ >= 3 && defined(__i386__)
-#define MT32EMU_HAVE_X86
-#endif
-#endif
-#ifdef MT32EMU_HAVE_X86
-#define MT32EMU_USE_MMX 1
-#else
-#define MT32EMU_USE_MMX 0
-#endif
+// If non-zero, deletes reverb buffers that are not in use to save memory.
+// If zero, keeps reverb buffers for all modes around all the time to avoid allocating/freeing in the critical path.
+#define MT32EMU_REDUCE_REVERB_MEMORY 1
+
+// 0: Use standard Freeverb
+// 1: Use AReverb (currently not properly tuned)
+#define MT32EMU_USE_AREVERBMODEL 0
+
+namespace MT32Emu
+{
+// The higher this number, the more memory will be used, but the more samples can be processed in one run -
+// various parts of sample generation can be processed more efficiently in a single run.
+// A run's maximum length is that given to Synth::render(), so giving a value here higher than render() is ever
+// called with will give no gain (but simply waste the memory).
+// Note that this value does *not* in any way impose limitations on the length given to render(), and has no effect
+// on the generated audio.
+// This value must be >= 1.
+const unsigned int MAX_SAMPLES_PER_RUN = 4096;
-#include "freeverb.h"
+// This determines the amount of memory available for simulating delays.
+// If set too low, partials aborted to allow other partials to play will not end gracefully, but will terminate
+// abruptly and potentially cause a pop/crackle in the audio output.
+// This value must be >= 1.
+const unsigned int MAX_PRERENDER_SAMPLES = 1024;
+}
-#include "structures.h"
-#include "i386.h"
-#include "mt32_file.h"
-#include "tables.h"
-#include "partial.h"
-#include "partialManager.h"
-#include "part.h"
-#include "synth.h"
+#include "Structures.h"
+#include "common/file.h"
+#include "Tables.h"
+#include "Poly.h"
+#include "LA32Ramp.h"
+#include "TVA.h"
+#include "TVP.h"
+#include "TVF.h"
+#include "Partial.h"
+#include "Part.h"
+#include "Synth.h"
#endif
diff --git a/audio/softsynth/mt32/part.cpp b/audio/softsynth/mt32/part.cpp
deleted file mode 100644
index 9f9269cba5..0000000000
--- a/audio/softsynth/mt32/part.cpp
+++ /dev/null
@@ -1,633 +0,0 @@
-/* Copyright (c) 2003-2005 Various contributors
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- * IN THE SOFTWARE.
- */
-
-#include <string.h>
-#include <math.h>
-
-#include "mt32emu.h"
-
-namespace MT32Emu {
-
-static const Bit8u PartialStruct[13] = {
- 0, 0, 2, 2, 1, 3,
- 3, 0, 3, 0, 2, 1, 3 };
-
-static const Bit8u PartialMixStruct[13] = {
- 0, 1, 0, 1, 1, 0,
- 1, 3, 3, 2, 2, 2, 2 };
-
-static const float floatKeyfollow[17] = {
- -1.0f, -1.0f/2.0f, -1.0f/4.0f, 0.0f,
- 1.0f/8.0f, 1.0f/4.0f, 3.0f/8.0f, 1.0f/2.0f, 5.0f/8.0f, 3.0f/4.0f, 7.0f/8.0f, 1.0f,
- 5.0f/4.0f, 3.0f/2.0f, 2.0f,
- 1.0009765625f, 1.0048828125f
-};
-
-//FIXME:KG: Put this dpoly stuff somewhere better
-bool dpoly::isActive() const {
- return partials[0] != NULL || partials[1] != NULL || partials[2] != NULL || partials[3] != NULL;
-}
-
-Bit32u dpoly::getAge() const {
- for (int i = 0; i < 4; i++) {
- if (partials[i] != NULL) {
- return partials[i]->age;
- }
- }
- return 0;
-}
-
-RhythmPart::RhythmPart(Synth *useSynth, unsigned int usePartNum): Part(useSynth, usePartNum) {
- strcpy(name, "Rhythm");
- rhythmTemp = &synth->mt32ram.rhythmSettings[0];
- refresh();
-}
-
-Part::Part(Synth *useSynth, unsigned int usePartNum) {
- this->synth = useSynth;
- this->partNum = usePartNum;
- patchCache[0].dirty = true;
- holdpedal = false;
- patchTemp = &synth->mt32ram.patchSettings[partNum];
- if (usePartNum == 8) {
- // Nasty hack for rhythm
- timbreTemp = NULL;
- } else {
- sprintf(name, "Part %d", partNum + 1);
- timbreTemp = &synth->mt32ram.timbreSettings[partNum];
- }
- currentInstr[0] = 0;
- currentInstr[10] = 0;
- expression = 127;
- volumeMult = 0;
- volumesetting.leftvol = 32767;
- volumesetting.rightvol = 32767;
- bend = 0.0f;
- memset(polyTable,0,sizeof(polyTable));
- memset(patchCache, 0, sizeof(patchCache));
-}
-
-void Part::setHoldPedal(bool pedalval) {
- if (holdpedal && !pedalval) {
- holdpedal = false;
- stopPedalHold();
- } else {
- holdpedal = pedalval;
- }
-}
-
-void RhythmPart::setBend(unsigned int midiBend) {
- synth->printDebug("%s: Setting bend (%d) not supported on rhythm", name, midiBend);
- return;
-}
-
-void Part::setBend(unsigned int midiBend) {
- // FIXME:KG: Slightly unbalanced increments, but I wanted min -1.0, center 0.0 and max 1.0
- if (midiBend <= 0x2000) {
- bend = ((signed int)midiBend - 0x2000) / (float)0x2000;
- } else {
- bend = ((signed int)midiBend - 0x2000) / (float)0x1FFF;
- }
- // Loop through all partials to update their bend
- for (int i = 0; i < MT32EMU_MAX_POLY; i++) {
- for (int j = 0; j < 4; j++) {
- if (polyTable[i].partials[j] != NULL) {
- polyTable[i].partials[j]->setBend(bend);
- }
- }
- }
-}
-
-void RhythmPart::setModulation(unsigned int midiModulation) {
- synth->printDebug("%s: Setting modulation (%d) not supported on rhythm", name, midiModulation);
-}
-
-void Part::setModulation(unsigned int midiModulation) {
- // Just a bloody guess, as always, before I get things figured out
- for (int t = 0; t < 4; t++) {
- if (patchCache[t].playPartial) {
- int newrate = (patchCache[t].modsense * midiModulation) >> 7;
- //patchCache[t].lfoperiod = lfotable[newrate];
- patchCache[t].lfodepth = newrate;
- //FIXME:KG: timbreTemp->partial[t].lfo.depth =
- }
- }
-}
-
-void RhythmPart::refresh() {
- updateVolume();
- // (Re-)cache all the mapped timbres ahead of time
- for (unsigned int drumNum = 0; drumNum < synth->controlROMMap->rhythmSettingsCount; drumNum++) {
- int drumTimbreNum = rhythmTemp[drumNum].timbre;
- if (drumTimbreNum >= 127) // 94 on MT-32
- continue;
- Bit16s pan = rhythmTemp[drumNum].panpot; // They use R-L 0-14...
- // FIXME:KG: Panning cache should be backed up to partials using it, too
- if (pan < 7) {
- drumPan[drumNum].leftvol = pan * 4681;
- drumPan[drumNum].rightvol = 32767;
- } else {
- drumPan[drumNum].rightvol = (14 - pan) * 4681;
- drumPan[drumNum].leftvol = 32767;
- }
- PatchCache *cache = drumCache[drumNum];
- backupCacheToPartials(cache);
- for (int t = 0; t < 4; t++) {
- // Common parameters, stored redundantly
- cache[t].dirty = true;
- cache[t].pitchShift = 0.0f;
- cache[t].benderRange = 0.0f;
- cache[t].pansetptr = &drumPan[drumNum];
- cache[t].reverb = rhythmTemp[drumNum].reverbSwitch > 0;
- }
- }
-}
-
-void Part::refresh() {
- updateVolume();
- backupCacheToPartials(patchCache);
- for (int t = 0; t < 4; t++) {
- // Common parameters, stored redundantly
- patchCache[t].dirty = true;
- patchCache[t].pitchShift = (patchTemp->patch.keyShift - 24) + (patchTemp->patch.fineTune - 50) / 100.0f;
- patchCache[t].benderRange = patchTemp->patch.benderRange;
- patchCache[t].pansetptr = &volumesetting;
- patchCache[t].reverb = patchTemp->patch.reverbSwitch > 0;
- }
- memcpy(currentInstr, timbreTemp->common.name, 10);
-}
-
-const char *Part::getCurrentInstr() const {
- return &currentInstr[0];
-}
-
-void RhythmPart::refreshTimbre(unsigned int absTimbreNum) {
- for (int m = 0; m < 85; m++) {
- if (rhythmTemp[m].timbre == absTimbreNum - 128)
- drumCache[m][0].dirty = true;
- }
-}
-
-void Part::refreshTimbre(unsigned int absTimbreNum) {
- if (getAbsTimbreNum() == absTimbreNum) {
- memcpy(currentInstr, timbreTemp->common.name, 10);
- patchCache[0].dirty = true;
- }
-}
-
-int Part::fixBiaslevel(int srcpnt, int *dir) {
- int noteat = srcpnt & 0x3F;
- int outnote;
- if (srcpnt < 64)
- *dir = 0;
- else
- *dir = 1;
- outnote = 33 + noteat;
- //synth->printDebug("Bias note %d, dir %d", outnote, *dir);
-
- return outnote;
-}
-
-int Part::fixKeyfollow(int srckey) {
- if (srckey>=0 && srckey<=16) {
- int keyfix[17] = { -256*16, -128*16, -64*16, 0, 32*16, 64*16, 96*16, 128*16, (128+32)*16, 192*16, (192+32)*16, 256*16, (256+64)*16, (256+128)*16, (512)*16, 4100, 4116};
- return keyfix[srckey];
- } else {
- //LOG(LOG_ERROR|LOG_MISC,"Missed key: %d", srckey);
- return 256;
- }
-}
-
-void Part::abortPoly(dpoly *poly) {
- if (!poly->isPlaying) {
- return;
- }
- for (int i = 0; i < 4; i++) {
- Partial *partial = poly->partials[i];
- if (partial != NULL) {
- partial->deactivate();
- }
- }
- poly->isPlaying = false;
-}
-
-void Part::setPatch(const PatchParam *patch) {
- patchTemp->patch = *patch;
-}
-
-void RhythmPart::setTimbre(TimbreParam * /*timbre*/) {
- synth->printDebug("%s: Attempted to call setTimbre() - doesn't make sense for rhythm", name);
-}
-
-void Part::setTimbre(TimbreParam *timbre) {
- *timbreTemp = *timbre;
-}
-
-unsigned int RhythmPart::getAbsTimbreNum() const {
- synth->printDebug("%s: Attempted to call getAbsTimbreNum() - doesn't make sense for rhythm", name);
- return 0;
-}
-
-unsigned int Part::getAbsTimbreNum() const {
- return (patchTemp->patch.timbreGroup * 64) + patchTemp->patch.timbreNum;
-}
-
-void RhythmPart::setProgram(unsigned int patchNum) {
- synth->printDebug("%s: Attempt to set program (%d) on rhythm is invalid", name, patchNum);
-}
-
-void Part::setProgram(unsigned int patchNum) {
- setPatch(&synth->mt32ram.patches[patchNum]);
- setTimbre(&synth->mt32ram.timbres[getAbsTimbreNum()].timbre);
-
- refresh();
-
- allSoundOff(); //FIXME:KG: Is this correct?
-}
-
-void Part::backupCacheToPartials(PatchCache cache[4]) {
- // check if any partials are still playing with the old patch cache
- // if so then duplicate the cached data from the part to the partial so that
- // we can change the part's cache without affecting the partial.
- // We delay this until now to avoid a copy operation with every note played
- for (int m = 0; m < MT32EMU_MAX_POLY; m++) {
- for (int i = 0; i < 4; i++) {
- Partial *partial = polyTable[m].partials[i];
- if (partial != NULL && partial->patchCache == &cache[i]) {
- partial->cachebackup = cache[i];
- partial->patchCache = &partial->cachebackup;
- }
- }
- }
-}
-
-void Part::cacheTimbre(PatchCache cache[4], const TimbreParam *timbre) {
- backupCacheToPartials(cache);
- int partialCount = 0;
- for (int t = 0; t < 4; t++) {
- cache[t].PCMPartial = false;
- if (((timbre->common.pmute >> t) & 0x1) == 1) {
- cache[t].playPartial = true;
- partialCount++;
- } else {
- cache[t].playPartial = false;
- continue;
- }
-
- // Calculate and cache common parameters
-
- cache[t].pcm = timbre->partial[t].wg.pcmwave;
- cache[t].useBender = (timbre->partial[t].wg.bender == 1);
-
- switch (t) {
- case 0:
- cache[t].PCMPartial = (PartialStruct[(int)timbre->common.pstruct12] & 0x2) ? true : false;
- cache[t].structureMix = PartialMixStruct[(int)timbre->common.pstruct12];
- cache[t].structurePosition = 0;
- cache[t].structurePair = 1;
- break;
- case 1:
- cache[t].PCMPartial = (PartialStruct[(int)timbre->common.pstruct12] & 0x1) ? true : false;
- cache[t].structureMix = PartialMixStruct[(int)timbre->common.pstruct12];
- cache[t].structurePosition = 1;
- cache[t].structurePair = 0;
- break;
- case 2:
- cache[t].PCMPartial = (PartialStruct[(int)timbre->common.pstruct34] & 0x2) ? true : false;
- cache[t].structureMix = PartialMixStruct[(int)timbre->common.pstruct34];
- cache[t].structurePosition = 0;
- cache[t].structurePair = 3;
- break;
- case 3:
- cache[t].PCMPartial = (PartialStruct[(int)timbre->common.pstruct34] & 0x1) ? true : false;
- cache[t].structureMix = PartialMixStruct[(int)timbre->common.pstruct34];
- cache[t].structurePosition = 1;
- cache[t].structurePair = 2;
- break;
- default:
- break;
- }
-
- cache[t].waveform = timbre->partial[t].wg.waveform;
- cache[t].pulsewidth = timbre->partial[t].wg.pulsewid;
- cache[t].pwsens = timbre->partial[t].wg.pwvelo;
- if (timbre->partial[t].wg.keyfollow > 16) {
- synth->printDebug("Bad keyfollow value in timbre!");
- cache[t].pitchKeyfollow = 1.0f;
- } else {
- cache[t].pitchKeyfollow = floatKeyfollow[timbre->partial[t].wg.keyfollow];
- }
-
- cache[t].pitch = timbre->partial[t].wg.coarse + (timbre->partial[t].wg.fine - 50) / 100.0f + 24.0f;
- cache[t].pitchEnv = timbre->partial[t].env;
- cache[t].pitchEnv.sensitivity = (char)((float)cache[t].pitchEnv.sensitivity * 1.27f);
- cache[t].pitchsustain = cache[t].pitchEnv.level[3];
-
- // Calculate and cache TVA envelope stuff
- cache[t].ampEnv = timbre->partial[t].tva;
- cache[t].ampEnv.level = (char)((float)cache[t].ampEnv.level * 1.27f);
-
- cache[t].ampbias[0] = fixBiaslevel(cache[t].ampEnv.biaspoint1, &cache[t].ampdir[0]);
- cache[t].ampblevel[0] = 12 - cache[t].ampEnv.biaslevel1;
- cache[t].ampbias[1] = fixBiaslevel(cache[t].ampEnv.biaspoint2, &cache[t].ampdir[1]);
- cache[t].ampblevel[1] = 12 - cache[t].ampEnv.biaslevel2;
- cache[t].ampdepth = cache[t].ampEnv.envvkf * cache[t].ampEnv.envvkf;
-
- // Calculate and cache filter stuff
- cache[t].filtEnv = timbre->partial[t].tvf;
- cache[t].filtkeyfollow = fixKeyfollow(cache[t].filtEnv.keyfollow);
- cache[t].filtEnv.envdepth = (char)((float)cache[t].filtEnv.envdepth * 1.27);
- cache[t].tvfbias = fixBiaslevel(cache[t].filtEnv.biaspoint, &cache[t].tvfdir);
- cache[t].tvfblevel = cache[t].filtEnv.biaslevel;
- cache[t].filtsustain = cache[t].filtEnv.envlevel[3];
-
- // Calculate and cache LFO stuff
- cache[t].lfodepth = timbre->partial[t].lfo.depth;
- cache[t].lfoperiod = synth->tables.lfoPeriod[(int)timbre->partial[t].lfo.rate];
- cache[t].lforate = timbre->partial[t].lfo.rate;
- cache[t].modsense = timbre->partial[t].lfo.modsense;
- }
- for (int t = 0; t < 4; t++) {
- // Common parameters, stored redundantly
- cache[t].dirty = false;
- cache[t].partialCount = partialCount;
- cache[t].sustain = (timbre->common.nosustain == 0);
- }
- //synth->printDebug("Res 1: %d 2: %d 3: %d 4: %d", cache[0].waveform, cache[1].waveform, cache[2].waveform, cache[3].waveform);
-
-#if MT32EMU_MONITOR_INSTRUMENTS == 1
- synth->printDebug("%s (%s): Recached timbre", name, currentInstr);
- for (int i = 0; i < 4; i++) {
- synth->printDebug(" %d: play=%s, pcm=%s (%d), wave=%d", i, cache[i].playPartial ? "YES" : "NO", cache[i].PCMPartial ? "YES" : "NO", timbre->partial[i].wg.pcmwave, timbre->partial[i].wg.waveform);
- }
-#endif
-}
-
-const char *Part::getName() const {
- return name;
-}
-
-void Part::updateVolume() {
- volumeMult = synth->tables.volumeMult[patchTemp->outlevel * expression / 127];
-}
-
-int Part::getVolume() const {
- // FIXME: Use the mappings for this in the control ROM
- return patchTemp->outlevel * 127 / 100;
-}
-
-void Part::setVolume(int midiVolume) {
- // FIXME: Use the mappings for this in the control ROM
- patchTemp->outlevel = (Bit8u)(midiVolume * 100 / 127);
- updateVolume();
- synth->printDebug("%s (%s): Set volume to %d", name, currentInstr, midiVolume);
-}
-
-void Part::setExpression(int midiExpression) {
- expression = midiExpression;
- updateVolume();
-}
-
-void RhythmPart::setPan(unsigned int midiPan)
-{
- // FIXME:KG: This is unchangeable for drums (they always use drumPan), is that correct?
- synth->printDebug("%s: Setting pan (%d) not supported on rhythm", name, midiPan);
-}
-
-void Part::setPan(unsigned int midiPan) {
- // FIXME:KG: Tweaked this a bit so that we have a left 100%, center and right 100%
- // (But this makes the range somewhat skewed)
- // Check against the real thing
- // NOTE: Panning is inverted compared to GM.
- if (midiPan < 64) {
- volumesetting.leftvol = (Bit16s)(midiPan * 512);
- volumesetting.rightvol = 32767;
- } else if (midiPan == 64) {
- volumesetting.leftvol = 32767;
- volumesetting.rightvol = 32767;
- } else {
- volumesetting.rightvol = (Bit16s)((127 - midiPan) * 520);
- volumesetting.leftvol = 32767;
- }
- patchTemp->panpot = (Bit8u)(midiPan * 14 / 127);
- //synth->printDebug("%s (%s): Set pan to %d", name, currentInstr, panpot);
-}
-
-void RhythmPart::playNote(unsigned int key, int vel) {
- if (key < 24 || key > 108)/*> 87 on MT-32)*/ {
- synth->printDebug("%s: Attempted to play invalid key %d", name, key);
- return;
- }
- int drumNum = key - 24;
- int drumTimbreNum = rhythmTemp[drumNum].timbre;
- if (drumTimbreNum >= 127) { // 94 on MT-32
- synth->printDebug("%s: Attempted to play unmapped key %d", name, key);
- return;
- }
- int absTimbreNum = drumTimbreNum + 128;
- TimbreParam *timbre = &synth->mt32ram.timbres[absTimbreNum].timbre;
- memcpy(currentInstr, timbre->common.name, 10);
-#if MT32EMU_MONITOR_INSTRUMENTS == 1
- synth->printDebug("%s (%s): starting poly (drum %d, timbre %d) - Vel %d Key %d", name, currentInstr, drumNum, absTimbreNum, vel, key);
-#endif
- if (drumCache[drumNum][0].dirty) {
- cacheTimbre(drumCache[drumNum], timbre);
- }
- playPoly(drumCache[drumNum], key, MIDDLEC, vel);
-}
-
-void Part::playNote(unsigned int key, int vel) {
- int freqNum = key;
- if (freqNum < 12) {
- synth->printDebug("%s (%s): Attempted to play invalid key %d < 12; moving up by octave", name, currentInstr, key);
- freqNum += 12;
- } else if (freqNum > 108) {
- synth->printDebug("%s (%s): Attempted to play invalid key %d > 108; moving down by octave", name, currentInstr, key);
- while (freqNum > 108) {
- freqNum -= 12;
- }
- }
- // POLY1 mode, Single Assign
- // Haven't found any software that uses any of the other poly modes
- // FIXME:KG: Should this also apply to rhythm?
- for (unsigned int i = 0; i < MT32EMU_MAX_POLY; i++) {
- if (polyTable[i].isActive() && (polyTable[i].key == key)) {
- //AbortPoly(&polyTable[i]);
- stopNote(key);
- break;
- }
- }
-#if MT32EMU_MONITOR_INSTRUMENTS == 1
- synth->printDebug("%s (%s): starting poly - Vel %d Key %d", name, currentInstr, vel, key);
-#endif
- if (patchCache[0].dirty) {
- cacheTimbre(patchCache, timbreTemp);
- }
- playPoly(patchCache, key, freqNum, vel);
-}
-
-void Part::playPoly(const PatchCache cache[4], unsigned int key, int freqNum, int vel) {
- unsigned int needPartials = cache[0].partialCount;
- unsigned int freePartials = synth->partialManager->getFreePartialCount();
-
- if (freePartials < needPartials) {
- if (!synth->partialManager->freePartials(needPartials - freePartials, partNum)) {
- synth->printDebug("%s (%s): Insufficient free partials to play key %d (vel=%d); needed=%d, free=%d", name, currentInstr, key, vel, needPartials, synth->partialManager->getFreePartialCount());
- return;
- }
- }
- // Find free poly
- int m;
- for (m = 0; m < MT32EMU_MAX_POLY; m++) {
- if (!polyTable[m].isActive()) {
- break;
- }
- }
- if (m == MT32EMU_MAX_POLY) {
- synth->printDebug("%s (%s): No free poly to play key %d (vel %d)", name, currentInstr, key, vel);
- return;
- }
-
- dpoly *tpoly = &polyTable[m];
-
- tpoly->isPlaying = true;
- tpoly->key = key;
- tpoly->isDecay = false;
- tpoly->freqnum = freqNum;
- tpoly->vel = vel;
- tpoly->pedalhold = false;
-
- bool allnull = true;
- for (int x = 0; x < 4; x++) {
- if (cache[x].playPartial) {
- tpoly->partials[x] = synth->partialManager->allocPartial(partNum);
- allnull = false;
- } else {
- tpoly->partials[x] = NULL;
- }
- }
-
- if (allnull)
- synth->printDebug("%s (%s): No partials to play for this instrument", name, this->currentInstr);
-
- tpoly->sustain = cache[0].sustain;
- tpoly->volumeptr = &volumeMult;
-
- for (int x = 0; x < 4; x++) {
- if (tpoly->partials[x] != NULL) {
- tpoly->partials[x]->startPartial(tpoly, &cache[x], tpoly->partials[cache[x].structurePair]);
- tpoly->partials[x]->setBend(bend);
- }
- }
-}
-
-static void startDecayPoly(dpoly *tpoly) {
- if (tpoly->isDecay) {
- return;
- }
- tpoly->isDecay = true;
-
- for (int t = 0; t < 4; t++) {
- Partial *partial = tpoly->partials[t];
- if (partial == NULL)
- continue;
- partial->startDecayAll();
- }
- tpoly->isPlaying = false;
-}
-
-void Part::allNotesOff() {
- // Note: Unchecked on real MT-32, but the MIDI specification states that all notes off (0x7B)
- // should treat the hold pedal as usual.
- // All *sound* off (0x78) should stop notes immediately regardless of the hold pedal.
- // The latter controller is not implemented on the MT-32 (according to the docs).
- for (int q = 0; q < MT32EMU_MAX_POLY; q++) {
- dpoly *tpoly = &polyTable[q];
- if (tpoly->isPlaying) {
- if (holdpedal)
- tpoly->pedalhold = true;
- else if (tpoly->sustain)
- startDecayPoly(tpoly);
- }
- }
-}
-
-void Part::allSoundOff() {
- for (int q = 0; q < MT32EMU_MAX_POLY; q++) {
- dpoly *tpoly = &polyTable[q];
- if (tpoly->isPlaying) {
- startDecayPoly(tpoly);
- }
- }
-}
-
-void Part::stopPedalHold() {
- for (int q = 0; q < MT32EMU_MAX_POLY; q++) {
- dpoly *tpoly;
- tpoly = &polyTable[q];
- if (tpoly->isActive() && tpoly->pedalhold)
- stopNote(tpoly->key);
- }
-}
-
-void Part::stopNote(unsigned int key) {
- // Non-sustaining instruments ignore stop commands.
- // They die away eventually anyway
-
-#if MT32EMU_MONITOR_INSTRUMENTS == 1
- synth->printDebug("%s (%s): stopping key %d", name, currentInstr, key);
-#endif
-
- if (key != 255) {
- for (int q = 0; q < MT32EMU_MAX_POLY; q++) {
- dpoly *tpoly = &polyTable[q];
- if (tpoly->isPlaying && tpoly->key == key) {
- if (holdpedal)
- tpoly->pedalhold = true;
- else if (tpoly->sustain)
- startDecayPoly(tpoly);
- }
- }
- return;
- }
-
- // Find oldest poly... yes, the MT-32 can be reconfigured to kill different poly first
- // This is simplest
- int oldest = -1;
- Bit32u oldage = 0;
-
- for (int q = 0; q < MT32EMU_MAX_POLY; q++) {
- dpoly *tpoly = &polyTable[q];
-
- if (tpoly->isPlaying && !tpoly->isDecay) {
- if (tpoly->getAge() >= oldage) {
- oldage = tpoly->getAge();
- oldest = q;
- }
- }
- }
-
- if (oldest != -1) {
- startDecayPoly(&polyTable[oldest]);
- }
-}
-
-}
diff --git a/audio/softsynth/mt32/part.h b/audio/softsynth/mt32/part.h
deleted file mode 100644
index 967298258c..0000000000
--- a/audio/softsynth/mt32/part.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/* Copyright (c) 2003-2005 Various contributors
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- * IN THE SOFTWARE.
- */
-
-#ifndef MT32EMU_PART_H
-#define MT32EMU_PART_H
-
-namespace MT32Emu {
-
-class Synth;
-
-class Part {
-private:
- // Pointers to the areas of the MT-32's memory dedicated to this part (for parts 1-8)
- MemParams::PatchTemp *patchTemp;
- TimbreParam *timbreTemp;
-
- // 0=Part 1, .. 7=Part 8, 8=Rhythm
- unsigned int partNum;
-
- bool holdpedal;
-
- StereoVolume volumesetting;
-
- PatchCache patchCache[4];
-
- float bend; // -1.0 .. +1.0
-
- dpoly polyTable[MT32EMU_MAX_POLY];
-
- void abortPoly(dpoly *poly);
-
- static int fixKeyfollow(int srckey);
- static int fixBiaslevel(int srcpnt, int *dir);
-
- void setPatch(const PatchParam *patch);
-
-protected:
- Synth *synth;
- char name[8]; // "Part 1".."Part 8", "Rhythm"
- char currentInstr[11];
- int expression;
- Bit32u volumeMult;
-
- void updateVolume();
- void backupCacheToPartials(PatchCache cache[4]);
- void cacheTimbre(PatchCache cache[4], const TimbreParam *timbre);
- void playPoly(const PatchCache cache[4], unsigned int key, int freqNum, int vel);
- const char *getName() const;
-
-public:
- Part(Synth *synth, unsigned int usePartNum);
- virtual ~Part() {}
- virtual void playNote(unsigned int key, int vel);
- void stopNote(unsigned int key);
- void allNotesOff();
- void allSoundOff();
- int getVolume() const;
- void setVolume(int midiVolume);
- void setExpression(int midiExpression);
- virtual void setPan(unsigned int midiPan);
- virtual void setBend(unsigned int midiBend);
- virtual void setModulation(unsigned int midiModulation);
- virtual void setProgram(unsigned int midiProgram);
- void setHoldPedal(bool pedalval);
- void stopPedalHold();
- virtual void refresh();
- virtual void refreshTimbre(unsigned int absTimbreNum);
- virtual void setTimbre(TimbreParam *timbre);
- virtual unsigned int getAbsTimbreNum() const;
- const char *getCurrentInstr() const;
-};
-
-class RhythmPart: public Part {
- // Pointer to the area of the MT-32's memory dedicated to rhythm
- const MemParams::RhythmTemp *rhythmTemp;
-
- // This caches the timbres/settings in use by the rhythm part
- PatchCache drumCache[85][4];
- StereoVolume drumPan[85];
-public:
- RhythmPart(Synth *synth, unsigned int usePartNum);
- void refresh();
- void refreshTimbre(unsigned int timbreNum);
- void setTimbre(TimbreParam *timbre);
- void playNote(unsigned int key, int vel);
- unsigned int getAbsTimbreNum() const;
- void setPan(unsigned int midiPan);
- void setBend(unsigned int midiBend);
- void setModulation(unsigned int midiModulation);
- void setProgram(unsigned int patchNum);
-};
-
-}
-#endif
diff --git a/audio/softsynth/mt32/partial.cpp b/audio/softsynth/mt32/partial.cpp
deleted file mode 100644
index c4f2e94ebe..0000000000
--- a/audio/softsynth/mt32/partial.cpp
+++ /dev/null
@@ -1,968 +0,0 @@
-/* Copyright (c) 2003-2005 Various contributors
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- * IN THE SOFTWARE.
- */
-
-#include <stdlib.h>
-#include <math.h>
-#include <string.h>
-
-#include "mt32emu.h"
-
-#if defined(MACOSX) || defined(SOLARIS) || defined(__MINGW32__)
-// Older versions of Mac OS X didn't supply a powf function, so using it
-// will cause a binary incompatibility when trying to run a binary built
-// on a newer OS X release on an older one. And Solaris 8 doesn't provide
-// powf, floorf, fabsf etc. at all.
-// Cross-compiled MinGW32 toolchains suffer from a cross-compile bug in
-// libstdc++. math/stubs.o should be empty, but it comes with a symbol for
-// powf, resulting in a linker error because of multiple definitions.
-// Hence we re-define them here. The only potential drawback is that it
-// might be a little bit slower this way.
-#define powf(x,y) ((float)pow(x,y))
-#define floorf(x) ((float)floor(x))
-#define fabsf(x) ((float)fabs(x))
-#endif
-
-#define FIXEDPOINT_UDIV(x, y, point) (((x) << (point)) / ((y)))
-#define FIXEDPOINT_SDIV(x, y, point) (((x) * (1 << point)) / ((y)))
-#define FIXEDPOINT_UMULT(x, y, point) (((x) * (y)) >> point)
-#define FIXEDPOINT_SMULT(x, y, point) (((x) * (y)) / (1 << point))
-
-using namespace MT32Emu;
-
-Partial::Partial(Synth *useSynth) {
- this->synth = useSynth;
- ownerPart = -1;
- poly = NULL;
- pair = NULL;
-#if MT32EMU_ACCURATENOTES == 1
- for (int i = 0; i < 3; i++) {
- noteLookupStorage.waveforms[i] = new Bit16s[65536];
- }
- noteLookup = &noteLookupStorage;
-#endif
-}
-
-Partial::~Partial() {
-#if MT32EMU_ACCURATENOTES == 1
- for (int i = 0; i < 3; i++) {
- delete[] noteLookupStorage.waveforms[i];
- }
- delete[] noteLookupStorage.wavTable;
-#endif
-}
-
-int Partial::getOwnerPart() const {
- return ownerPart;
-}
-
-bool Partial::isActive() {
- return ownerPart > -1;
-}
-
-const dpoly *Partial::getDpoly() const {
- return this->poly;
-}
-
-void Partial::activate(int part) {
- // This just marks the partial as being assigned to a part
- ownerPart = part;
-}
-
-void Partial::deactivate() {
- ownerPart = -1;
- if (poly != NULL) {
- for (int i = 0; i < 4; i++) {
- if (poly->partials[i] == this) {
- poly->partials[i] = NULL;
- break;
- }
- }
- if (pair != NULL) {
- pair->pair = NULL;
- }
- }
-}
-
-void Partial::initKeyFollow(int key) {
- // Setup partial keyfollow
- // Note follow relative to middle C
-
- // Calculate keyfollow for pitch
-#if 1
- float rel = key == -1 ? 0.0f : (key - MIDDLEC);
- float newPitch = rel * patchCache->pitchKeyfollow + patchCache->pitch + patchCache->pitchShift;
- //FIXME:KG: Does it truncate the keyfollowed pitch to a semitone (towards MIDDLEC)?
- //int newKey = (int)(rel * patchCache->pitchKeyfollow);
- //float newPitch = newKey + patchCache->pitch + patchCache->pitchShift;
-#else
- float rel = key == -1 ? 0.0f : (key + patchCache->pitchShift - MIDDLEC);
- float newPitch = rel * patchCache->pitchKeyfollow + patchCache->pitch;
-#endif
-#if MT32EMU_ACCURATENOTES == 1
- noteVal = newPitch;
- synth->printDebug("key=%d, pitch=%f, pitchKeyfollow=%f, pitchShift=%f, newPitch=%f", key, (double)patchCache->pitch, (double)patchCache->pitchKeyfollow, (double)patchCache->pitchShift, (double)newPitch);
-#else
- float newPitchInt;
- float newPitchFract = modff(newPitch, &newPitchInt);
- if (newPitchFract > 0.5f) {
- newPitchInt += 1.0f;
- newPitchFract -= 1.0f;
- }
- noteVal = (int)newPitchInt;
- fineShift = (int)(powf(2.0f, newPitchFract / 12.0f) * 4096.0f);
- synth->printDebug("key=%d, pitch=%f, pitchKeyfollow=%f, pitchShift=%f, newPitch=%f, noteVal=%d, fineShift=%d", key, (double)patchCache->pitch, (double)patchCache->pitchKeyfollow, (double)patchCache->pitchShift, (double)newPitch, noteVal, fineShift);
-#endif
- // FIXME:KG: Raise/lower by octaves until in the supported range.
- while (noteVal > HIGHEST_NOTE) // FIXME:KG: see tables.cpp: >108?
- noteVal -= 12;
- while (noteVal < LOWEST_NOTE) // FIXME:KG: see tables.cpp: <12?
- noteVal += 12;
- // Calculate keyfollow for filter
- int keyfollow = ((key - MIDDLEC) * patchCache->filtkeyfollow) / 4096;
- if (keyfollow > 108)
- keyfollow = 108;
- else if (keyfollow < -108)
- keyfollow = -108;
- filtVal = synth->tables.tvfKeyfollowMult[keyfollow + 108];
- realVal = synth->tables.tvfKeyfollowMult[(noteVal - MIDDLEC) + 108];
-}
-
-int Partial::getKey() const {
- if (poly == NULL) {
- return -1;
- } else {
- return poly->key;
- }
-}
-
-void Partial::startPartial(dpoly *usePoly, const PatchCache *useCache, Partial *pairPartial) {
- if (usePoly == NULL || useCache == NULL) {
- synth->printDebug("*** Error: Starting partial for owner %d, usePoly=%s, useCache=%s", ownerPart, usePoly == NULL ? "*** NULL ***" : "OK", useCache == NULL ? "*** NULL ***" : "OK");
- return;
- }
- patchCache = useCache;
- poly = usePoly;
- mixType = patchCache->structureMix;
- structurePosition = patchCache->structurePosition;
-
- play = true;
- initKeyFollow(poly->freqnum); // Initializes noteVal, filtVal and realVal
-#if MT32EMU_ACCURATENOTES == 0
- noteLookup = &synth->tables.noteLookups[noteVal - LOWEST_NOTE];
-#else
- Tables::initNote(synth, &noteLookupStorage, noteVal, (float)synth->myProp.sampleRate, synth->masterTune, synth->pcmWaves, NULL);
-#endif
- keyLookup = &synth->tables.keyLookups[poly->freqnum - 12];
-
- if (patchCache->PCMPartial) {
- pcmNum = patchCache->pcm;
- if (synth->controlROMMap->pcmCount > 128) {
- // CM-32L, etc. support two "banks" of PCMs, selectable by waveform type parameter.
- if (patchCache->waveform > 1) {
- pcmNum += 128;
- }
- }
- pcmWave = &synth->pcmWaves[pcmNum];
- } else {
- pcmWave = NULL;
- }
-
- lfoPos = 0;
- pulsewidth = patchCache->pulsewidth + synth->tables.pwVelfollowAdd[patchCache->pwsens][poly->vel];
- if (pulsewidth > 100) {
- pulsewidth = 100;
- } else if (pulsewidth < 0) {
- pulsewidth = 0;
- }
-
- for (int e = 0; e < 3; e++) {
- envs[e].envpos = 0;
- envs[e].envstat = -1;
- envs[e].envbase = 0;
- envs[e].envdist = 0;
- envs[e].envsize = 0;
- envs[e].sustaining = false;
- envs[e].decaying = false;
- envs[e].prevlevel = 0;
- envs[e].counter = 0;
- envs[e].count = 0;
- }
- ampEnvVal = 0;
- pitchEnvVal = 0;
- pitchSustain = false;
- loopPos = 0;
- partialOff.pcmoffset = partialOff.pcmplace = 0;
- pair = pairPartial;
- useNoisePair = pairPartial == NULL && (mixType == 1 || mixType == 2);
- age = 0;
- alreadyOutputed = false;
- memset(history,0,sizeof(history));
-}
-
-Bit16s *Partial::generateSamples(long length) {
- if (!isActive() || alreadyOutputed) {
- return NULL;
- }
- if (poly == NULL) {
- synth->printDebug("*** ERROR: poly is NULL at Partial::generateSamples()!");
- return NULL;
- }
-
- alreadyOutputed = true;
-
- // Generate samples
-
- Bit16s *partialBuf = &myBuffer[0];
- Bit32u volume = *poly->volumeptr;
- while (length--) {
- Bit32s envval;
- Bit32s sample = 0;
- if (!envs[EnvelopeType_amp].sustaining) {
- if (envs[EnvelopeType_amp].count <= 0) {
- Bit32u ampval = getAmpEnvelope();
- if (!play) {
- deactivate();
- break;
- }
- if (ampval > 100) {
- ampval = 100;
- }
-
- ampval = synth->tables.volumeMult[ampval];
- ampval = FIXEDPOINT_UMULT(ampval, synth->tables.tvaVelfollowMult[poly->vel][(int)patchCache->ampEnv.velosens], 8);
- //if (envs[EnvelopeType_amp].sustaining)
- ampEnvVal = ampval;
- }
- --envs[EnvelopeType_amp].count;
- }
-
- unsigned int lfoShift = 0x1000;
- if (pitchSustain) {
- // Calculate LFO position
- // LFO does not kick in completely until pitch envelope sustains
- if (patchCache->lfodepth > 0) {
- lfoPos++;
- if (lfoPos >= patchCache->lfoperiod)
- lfoPos = 0;
- int lfoatm = FIXEDPOINT_UDIV(lfoPos, patchCache->lfoperiod, 16);
- int lfoatr = synth->tables.sintable[lfoatm];
- lfoShift = synth->tables.lfoShift[patchCache->lfodepth][lfoatr];
- }
- } else {
- // Calculate Pitch envelope
- envval = getPitchEnvelope();
- int pd = patchCache->pitchEnv.depth;
- pitchEnvVal = synth->tables.pitchEnvVal[pd][envval];
- }
-
- int delta;
-
- // Wrap positions or end if necessary
- if (patchCache->PCMPartial) {
- // PCM partial
-
- delta = noteLookup->wavTable[pcmNum];
- int len = pcmWave->len;
- if (partialOff.pcmplace >= len) {
- if (pcmWave->loop) {
- //partialOff.pcmplace = partialOff.pcmoffset = 0;
- partialOff.pcmplace %= len;
- } else {
- play = false;
- deactivate();
- break;
- }
- }
- } else {
- // Synthesis partial
- delta = 0x10000;
- partialOff.pcmplace %= (Bit16u)noteLookup->div2;
- }
-
- // Build delta for position of next sample
- // Fix delta code
- Bit32u tdelta = delta;
-#if MT32EMU_ACCURATENOTES == 0
- tdelta = FIXEDPOINT_UMULT(tdelta, fineShift, 12);
-#endif
- tdelta = FIXEDPOINT_UMULT(tdelta, pitchEnvVal, 12);
- tdelta = FIXEDPOINT_UMULT(tdelta, lfoShift, 12);
- tdelta = FIXEDPOINT_UMULT(tdelta, bendShift, 12);
- delta = (int)tdelta;
-
- // Get waveform - either PCM or synthesized sawtooth or square
- if (ampEnvVal > 0) {
- if (patchCache->PCMPartial) {
- // Render PCM sample
- int ra, rb, dist;
- Bit32u taddr;
- Bit32u pcmAddr = pcmWave->addr;
- if (delta < 0x10000) {
- // Linear sound interpolation
- taddr = pcmAddr + partialOff.pcmplace;
- ra = synth->pcmROMData[taddr];
- taddr++;
- if (taddr == pcmAddr + pcmWave->len) {
- // Past end of PCM
- if (pcmWave->loop) {
- rb = synth->pcmROMData[pcmAddr];
- } else {
- rb = 0;
- }
- } else {
- rb = synth->pcmROMData[taddr];
- }
- dist = rb - ra;
- sample = (ra + ((dist * (Bit32s)(partialOff.pcmoffset >> 8)) >> 8));
- } else {
- // Sound decimation
- // The right way to do it is to use a lowpass filter on the waveform before selecting
- // a point. This is too slow. The following approximates this as fast as possible
- int idelta = delta >> 16;
- taddr = pcmAddr + partialOff.pcmplace;
- ra = synth->pcmROMData[taddr++];
- for (int ix = 0; ix < idelta - 1; ix++) {
- if (taddr == pcmAddr + pcmWave->len) {
- // Past end of PCM
- if (pcmWave->loop) {
- taddr = pcmAddr;
- } else {
- // Behave as if all subsequent samples were 0
- break;
- }
- }
- ra += synth->pcmROMData[taddr++];
- }
- sample = ra / idelta;
- }
- } else {
- // Render synthesised sample
- int toff = partialOff.pcmplace;
- int minorplace = partialOff.pcmoffset >> 14;
- Bit32s filterInput;
- Bit32s filtval = getFiltEnvelope();
-
- //synth->printDebug("Filtval: %d", filtval);
-
- if ((patchCache->waveform & 1) == 0) {
- // Square waveform. Made by combining two pregenerated bandlimited
- // sawtooth waveforms
- Bit32u ofsA = ((toff << 2) + minorplace) % noteLookup->waveformSize[0];
- int width = FIXEDPOINT_UMULT(noteLookup->div2, synth->tables.pwFactor[pulsewidth], 7);
- Bit32u ofsB = (ofsA + width) % noteLookup->waveformSize[0];
- Bit16s pa = noteLookup->waveforms[0][ofsA];
- Bit16s pb = noteLookup->waveforms[0][ofsB];
- filterInput = pa - pb;
- // Non-bandlimited squarewave
- /*
- ofs = FIXEDPOINT_UMULT(noteLookup->div2, synth->tables.pwFactor[patchCache->pulsewidth], 8);
- if (toff < ofs)
- sample = 1 * WGAMP;
- else
- sample = -1 * WGAMP;
- */
- } else {
- // Sawtooth. Made by combining the full cosine and half cosine according
- // to how it looks on the MT-32. What it really does it takes the
- // square wave and multiplies it by a full cosine
- int waveoff = (toff << 2) + minorplace;
- if (toff < noteLookup->sawTable[pulsewidth])
- filterInput = noteLookup->waveforms[1][waveoff % noteLookup->waveformSize[1]];
- else
- filterInput = noteLookup->waveforms[2][waveoff % noteLookup->waveformSize[2]];
- // This is the correct way
- // Seems slow to me (though bandlimited) -- doesn't seem to
- // sound any better though
- /*
- //int pw = (patchCache->pulsewidth * pulsemod[filtval]) >> 8;
-
- Bit32u ofs = toff % (noteLookup->div2 >> 1);
-
- Bit32u ofs3 = toff + FIXEDPOINT_UMULT(noteLookup->div2, synth->tables.pwFactor[patchCache->pulsewidth], 9);
- ofs3 = ofs3 % (noteLookup->div2 >> 1);
-
- pa = noteLookup->waveforms[0][ofs];
- pb = noteLookup->waveforms[0][ofs3];
- sample = ((pa - pb) * noteLookup->waveforms[2][toff]) / 2;
- */
- }
-
- //Very exact filter
- if (filtval > ((FILTERGRAN * 15) / 16))
- filtval = ((FILTERGRAN * 15) / 16);
- sample = (Bit32s)(floorf((synth->iirFilter)((float)filterInput, &history[0], synth->tables.filtCoeff[filtval][(int)patchCache->filtEnv.resonance])) / synth->tables.resonanceFactor[patchCache->filtEnv.resonance]);
- if (sample < -32768) {
- synth->printDebug("Overdriven amplitude for %d: %d:=%d < -32768", patchCache->waveform, filterInput, sample);
- sample = -32768;
- }
- else if (sample > 32767) {
- synth->printDebug("Overdriven amplitude for %d: %d:=%d > 32767", patchCache->waveform, filterInput, sample);
- sample = 32767;
- }
- }
- }
-
- // Add calculated delta to our waveform offset
- Bit32u absOff = ((partialOff.pcmplace << 16) | partialOff.pcmoffset);
- absOff += delta;
- partialOff.pcmplace = (Bit16u)((absOff & 0xFFFF0000) >> 16);
- partialOff.pcmoffset = (Bit16u)(absOff & 0xFFFF);
-
- // Put volume envelope over generated sample
- sample = FIXEDPOINT_SMULT(sample, ampEnvVal, 9);
- sample = FIXEDPOINT_SMULT(sample, volume, 7);
- envs[EnvelopeType_amp].envpos++;
- envs[EnvelopeType_pitch].envpos++;
- envs[EnvelopeType_filt].envpos++;
-
- *partialBuf++ = (Bit16s)sample;
- }
- // We may have deactivated and broken out of the loop before the end of the buffer,
- // if so then fill the remainder with 0s.
- if (++length > 0)
- memset(partialBuf, 0, length * 2);
- return &myBuffer[0];
-}
-
-void Partial::setBend(float factor) {
- if (!patchCache->useBender || factor == 0.0f) {
- bendShift = 4096;
- return;
- }
- // NOTE:KG: We can't do this smoothly with lookup tables, unless we use several MB.
- // FIXME:KG: Bend should be influenced by pitch key-follow too, according to docs.
- float bendSemitones = factor * patchCache->benderRange; // -24 .. 24
- float mult = powf(2.0f, bendSemitones / 12.0f);
- synth->printDebug("setBend(): factor=%f, benderRange=%f, semitones=%f, mult=%f\n", (double)factor, (double)patchCache->benderRange, (double)bendSemitones, (double)mult);
- bendShift = (int)(mult * 4096.0f);
-}
-
-Bit16s *Partial::mixBuffers(Bit16s * buf1, Bit16s *buf2, int len) {
- if (buf1 == NULL)
- return buf2;
- if (buf2 == NULL)
- return buf1;
-
- Bit16s *outBuf = buf1;
-#if MT32EMU_USE_MMX >= 1
- // KG: This seems to be fine
- int donelen = i386_mixBuffers(buf1, buf2, len);
- len -= donelen;
- buf1 += donelen;
- buf2 += donelen;
-#endif
- while (len--) {
- *buf1 = *buf1 + *buf2;
- buf1++, buf2++;
- }
- return outBuf;
-}
-
-Bit16s *Partial::mixBuffersRingMix(Bit16s * buf1, Bit16s *buf2, int len) {
- if (buf1 == NULL)
- return NULL;
- if (buf2 == NULL) {
- Bit16s *outBuf = buf1;
- while (len--) {
- if (*buf1 < -8192)
- *buf1 = -8192;
- else if (*buf1 > 8192)
- *buf1 = 8192;
- buf1++;
- }
- return outBuf;
- }
-
- Bit16s *outBuf = buf1;
-#if MT32EMU_USE_MMX >= 1
- // KG: This seems to be fine
- int donelen = i386_mixBuffersRingMix(buf1, buf2, len);
- len -= donelen;
- buf1 += donelen;
- buf2 += donelen;
-#endif
- while (len--) {
- float a, b;
- a = ((float)*buf1) / 8192.0f;
- b = ((float)*buf2) / 8192.0f;
- a = (a * b) + a;
- if (a > 1.0f)
- a = 1.0f;
- if (a < -1.0f)
- a = -1.0f;
- *buf1 = (Bit16s)(a * 8192.0f);
- buf1++;
- buf2++;
- //buf1[i] = (Bit16s)(((Bit32s)buf1[i] * (Bit32s)buf2[i]) >> 10) + buf1[i];
- }
- return outBuf;
-}
-
-Bit16s *Partial::mixBuffersRing(Bit16s * buf1, Bit16s *buf2, int len) {
- if (buf1 == NULL) {
- return NULL;
- }
- if (buf2 == NULL) {
- return NULL;
- }
-
- Bit16s *outBuf = buf1;
-#if MT32EMU_USE_MMX >= 1
- // FIXME:KG: Not really checked as working
- int donelen = i386_mixBuffersRing(buf1, buf2, len);
- len -= donelen;
- buf1 += donelen;
- buf2 += donelen;
-#endif
- while (len--) {
- float a, b;
- a = ((float)*buf1) / 8192.0f;
- b = ((float)*buf2) / 8192.0f;
- a *= b;
- if (a > 1.0f)
- a = 1.0f;
- if (a < -1.0f)
- a = -1.0f;
- *buf1 = (Bit16s)(a * 8192.0f);
- buf1++;
- buf2++;
- }
- return outBuf;
-}
-
-void Partial::mixBuffersStereo(Bit16s *buf1, Bit16s *buf2, Bit16s *outBuf, int len) {
- if (buf2 == NULL) {
- while (len--) {
- *outBuf++ = *buf1++;
- *outBuf++ = 0;
- }
- } else if (buf1 == NULL) {
- while (len--) {
- *outBuf++ = 0;
- *outBuf++ = *buf2++;
- }
- } else {
- while (len--) {
- *outBuf++ = *buf1++;
- *outBuf++ = *buf2++;
- }
- }
-}
-
-bool Partial::produceOutput(Bit16s *partialBuf, long length) {
- if (!isActive() || alreadyOutputed)
- return false;
- if (poly == NULL) {
- synth->printDebug("*** ERROR: poly is NULL at Partial::produceOutput()!");
- return false;
- }
-
- Bit16s *pairBuf = NULL;
- // Check for dependant partial
- if (pair != NULL) {
- if (!pair->alreadyOutputed) {
- // Note: pair may have become NULL after this
- pairBuf = pair->generateSamples(length);
- }
- } else if (useNoisePair) {
- // Generate noise for pairless ring mix
- pairBuf = synth->tables.noiseBuf;
- }
-
- Bit16s *myBuf = generateSamples(length);
-
- if (myBuf == NULL && pairBuf == NULL)
- return false;
-
- Bit16s *p1buf, *p2buf;
-
- if (structurePosition == 0 || pairBuf == NULL) {
- p1buf = myBuf;
- p2buf = pairBuf;
- } else {
- p2buf = myBuf;
- p1buf = pairBuf;
- }
-
- //synth->printDebug("mixType: %d", mixType);
-
- Bit16s *mixedBuf;
- switch (mixType) {
- case 0:
- // Standard sound mix
- mixedBuf = mixBuffers(p1buf, p2buf, length);
- break;
-
- case 1:
- // Ring modulation with sound mix
- mixedBuf = mixBuffersRingMix(p1buf, p2buf, length);
- break;
-
- case 2:
- // Ring modulation alone
- mixedBuf = mixBuffersRing(p1buf, p2buf, length);
- break;
-
- case 3:
- // Stereo mixing. One partial to one speaker channel, one to another.
- // FIXME:KG: Surely we should be multiplying by the left/right volumes here?
- mixBuffersStereo(p1buf, p2buf, partialBuf, length);
- return true;
-
- default:
- mixedBuf = mixBuffers(p1buf, p2buf, length);
- break;
- }
-
- if (mixedBuf == NULL)
- return false;
-
- Bit16s leftvol, rightvol;
- leftvol = patchCache->pansetptr->leftvol;
- rightvol = patchCache->pansetptr->rightvol;
-
-#if MT32EMU_USE_MMX >= 2
- // FIXME:KG: This appears to introduce crackle
- int donelen = i386_partialProductOutput(length, leftvol, rightvol, partialBuf, mixedBuf);
- length -= donelen;
- mixedBuf += donelen;
- partialBuf += donelen * 2;
-#endif
- while (length--) {
- *partialBuf++ = (Bit16s)(((Bit32s)*mixedBuf * (Bit32s)leftvol) >> 15);
- *partialBuf++ = (Bit16s)(((Bit32s)*mixedBuf * (Bit32s)rightvol) >> 15);
- mixedBuf++;
- }
- return true;
-}
-
-Bit32s Partial::getFiltEnvelope() {
- int reshigh;
-
- int cutoff, depth;
-
- EnvelopeStatus *tStat = &envs[EnvelopeType_filt];
-
- if (tStat->decaying) {
- reshigh = tStat->envbase;
- reshigh = (reshigh + ((tStat->envdist * tStat->envpos) / tStat->envsize));
- if (tStat->envpos >= tStat->envsize)
- reshigh = 0;
- } else {
- if (tStat->envstat==4) {
- reshigh = patchCache->filtsustain;
- if (!poly->sustain) {
- startDecay(EnvelopeType_filt, reshigh);
- }
- } else {
- if ((tStat->envstat==-1) || (tStat->envpos >= tStat->envsize)) {
- if (tStat->envstat==-1)
- tStat->envbase = 0;
- else
- tStat->envbase = patchCache->filtEnv.envlevel[tStat->envstat];
- tStat->envstat++;
- tStat->envpos = 0;
- if (tStat->envstat == 3) {
- tStat->envsize = synth->tables.envTime[(int)patchCache->filtEnv.envtime[tStat->envstat]];
- } else {
- Bit32u envTime = (int)patchCache->filtEnv.envtime[tStat->envstat];
- if (tStat->envstat > 1) {
- int envDiff = abs(patchCache->filtEnv.envlevel[tStat->envstat] - patchCache->filtEnv.envlevel[tStat->envstat - 1]);
- if (envTime > synth->tables.envDeltaMaxTime[envDiff]) {
- envTime = synth->tables.envDeltaMaxTime[envDiff];
- }
- }
-
- tStat->envsize = (synth->tables.envTime[envTime] * keyLookup->envTimeMult[(int)patchCache->filtEnv.envtkf]) >> 8;
- }
-
- tStat->envsize++;
- tStat->envdist = patchCache->filtEnv.envlevel[tStat->envstat] - tStat->envbase;
- }
-
- reshigh = tStat->envbase;
- reshigh = (reshigh + ((tStat->envdist * tStat->envpos) / tStat->envsize));
-
- }
- tStat->prevlevel = reshigh;
- }
-
- cutoff = patchCache->filtEnv.cutoff;
-
- //if (patchCache->waveform==1) reshigh = (reshigh * 3) >> 2;
-
- depth = patchCache->filtEnv.envdepth;
-
- //int sensedep = (depth * 127-patchCache->filtEnv.envsense) >> 7;
- depth = FIXEDPOINT_UMULT(depth, synth->tables.tvfVelfollowMult[poly->vel][(int)patchCache->filtEnv.envsense], 8);
-
- int bias = patchCache->tvfbias;
- int dist;
-
- if (bias != 0) {
- //FIXME:KG: Is this really based on pitch (as now), or key pressed?
- //synth->printDebug("Cutoff before %d", cutoff);
- if (patchCache->tvfdir == 0) {
- if (noteVal < bias) {
- dist = bias - noteVal;
- cutoff = FIXEDPOINT_UMULT(cutoff, synth->tables.tvfBiasMult[patchCache->tvfblevel][dist], 8);
- }
- } else {
- // > Bias
- if (noteVal > bias) {
- dist = noteVal - bias;
- cutoff = FIXEDPOINT_UMULT(cutoff, synth->tables.tvfBiasMult[patchCache->tvfblevel][dist], 8);
- }
-
- }
- //synth->printDebug("Cutoff after %d", cutoff);
- }
-
- depth = (depth * keyLookup->envDepthMult[patchCache->filtEnv.envdkf]) >> 8;
- reshigh = (reshigh * depth) >> 7;
-
- Bit32s tmp;
-
- cutoff *= filtVal;
- cutoff /= realVal; //FIXME:KG: With filter keyfollow 0, this makes no sense. What's correct?
-
- reshigh *= filtVal;
- reshigh /= realVal; //FIXME:KG: As above for cutoff
-
- if (patchCache->waveform == 1) {
- reshigh = (reshigh * 65) / 100;
- }
-
- if (cutoff > 100)
- cutoff = 100;
- else if (cutoff < 0)
- cutoff = 0;
- if (reshigh > 100)
- reshigh = 100;
- else if (reshigh < 0)
- reshigh = 0;
- tmp = noteLookup->nfiltTable[cutoff][reshigh];
- //tmp *= keyfollow;
- //tmp /= realfollow;
-
- //synth->printDebug("Cutoff %d, tmp %d, freq %d", cutoff, tmp, tmp * 256);
- return tmp;
-}
-
-bool Partial::shouldReverb() {
- if (!isActive())
- return false;
- return patchCache->reverb;
-}
-
-Bit32u Partial::getAmpEnvelope() {
- Bit32s tc;
-
- EnvelopeStatus *tStat = &envs[EnvelopeType_amp];
-
- if (!play)
- return 0;
-
- if (tStat->decaying) {
- tc = tStat->envbase;
- tc += (tStat->envdist * tStat->envpos) / tStat->envsize;
- if (tc < 0)
- tc = 0;
- if ((tStat->envpos >= tStat->envsize) || (tc == 0)) {
- play = false;
- // Don't have to worry about prevlevel storage or anything, this partial's about to die
- return 0;
- }
- } else {
- if ((tStat->envstat == -1) || (tStat->envpos >= tStat->envsize)) {
- if (tStat->envstat == -1)
- tStat->envbase = 0;
- else
- tStat->envbase = patchCache->ampEnv.envlevel[tStat->envstat];
- tStat->envstat++;
- tStat->envpos = 0;
- if (tStat->envstat == 4) {
- //synth->printDebug("Envstat %d, size %d", tStat->envstat, tStat->envsize);
- tc = patchCache->ampEnv.envlevel[3];
- if (!poly->sustain)
- startDecay(EnvelopeType_amp, tc);
- else
- tStat->sustaining = true;
- goto PastCalc;
- }
- Bit8u targetLevel = patchCache->ampEnv.envlevel[tStat->envstat];
- tStat->envdist = targetLevel - tStat->envbase;
- Bit32u envTime = patchCache->ampEnv.envtime[tStat->envstat];
- if (targetLevel == 0) {
- tStat->envsize = synth->tables.envDecayTime[envTime];
- } else {
- int envLevelDelta = abs(tStat->envdist);
- if (envTime > synth->tables.envDeltaMaxTime[envLevelDelta]) {
- envTime = synth->tables.envDeltaMaxTime[envLevelDelta];
- }
- tStat->envsize = synth->tables.envTime[envTime];
- }
-
- // Time keyfollow is used by all sections of the envelope (confirmed on CM-32L)
- tStat->envsize = FIXEDPOINT_UMULT(tStat->envsize, keyLookup->envTimeMult[(int)patchCache->ampEnv.envtkf], 8);
-
- switch (tStat->envstat) {
- case 0:
- //Spot for velocity time follow
- //Only used for first attack
- tStat->envsize = FIXEDPOINT_UMULT(tStat->envsize, synth->tables.envTimeVelfollowMult[(int)patchCache->ampEnv.envvkf][poly->vel], 8);
- //synth->printDebug("Envstat %d, size %d", tStat->envstat, tStat->envsize);
- break;
- case 1:
- case 2:
- case 3:
- //synth->printDebug("Envstat %d, size %d", tStat->envstat, tStat->envsize);
- break;
- default:
- synth->printDebug("Invalid TVA envelope number %d hit!", tStat->envstat);
- break;
- }
-
- tStat->envsize++;
-
- if (tStat->envdist != 0) {
- tStat->counter = abs(tStat->envsize / tStat->envdist);
- //synth->printDebug("Pos %d, envsize %d envdist %d", tStat->envstat, tStat->envsize, tStat->envdist);
- } else {
- tStat->counter = 0;
- //synth->printDebug("Pos %d, envsize %d envdist %d", tStat->envstat, tStat->envsize, tStat->envdist);
- }
- }
- tc = tStat->envbase;
- tc = (tc + ((tStat->envdist * tStat->envpos) / tStat->envsize));
- tStat->count = tStat->counter;
-PastCalc:
- tc = (tc * (Bit32s)patchCache->ampEnv.level) / 100;
- }
-
- // Prevlevel storage is bottle neck
- tStat->prevlevel = tc;
-
- //Bias level crap stuff now
-
- for (int i = 0; i < 2; i++) {
- if (patchCache->ampblevel[i]!=0) {
- int bias = patchCache->ampbias[i];
- if (patchCache->ampdir[i]==0) {
- // < Bias
- if (noteVal < bias) {
- int dist = bias - noteVal;
- tc = FIXEDPOINT_UMULT(tc, synth->tables.tvaBiasMult[patchCache->ampblevel[i]][dist], 8);
- }
- } else {
- // > Bias
- if (noteVal > bias) {
- int dist = noteVal - bias;
- tc = FIXEDPOINT_UMULT(tc, synth->tables.tvaBiasMult[patchCache->ampblevel[i]][dist], 8);
- }
- }
- }
- }
- if (tc < 0) {
- synth->printDebug("*** ERROR: tc < 0 (%d) at getAmpEnvelope()", tc);
- tc = 0;
- }
- return (Bit32u)tc;
-}
-
-Bit32s Partial::getPitchEnvelope() {
- EnvelopeStatus *tStat = &envs[EnvelopeType_pitch];
-
- Bit32s tc;
- pitchSustain = false;
- if (tStat->decaying) {
- if (tStat->envpos >= tStat->envsize)
- tc = patchCache->pitchEnv.level[4];
- else {
- tc = tStat->envbase;
- tc = (tc + ((tStat->envdist * tStat->envpos) / tStat->envsize));
- }
- } else {
- if (tStat->envstat==3) {
- tc = patchCache->pitchsustain;
- if (poly->sustain)
- pitchSustain = true;
- else
- startDecay(EnvelopeType_pitch, tc);
- } else {
- if ((tStat->envstat==-1) || (tStat->envpos >= tStat->envsize)) {
- tStat->envstat++;
-
- tStat->envbase = patchCache->pitchEnv.level[tStat->envstat];
-
- Bit32u envTime = patchCache->pitchEnv.time[tStat->envstat];
- int envDiff = abs(patchCache->pitchEnv.level[tStat->envstat] - patchCache->pitchEnv.level[tStat->envstat + 1]);
- if (envTime > synth->tables.envDeltaMaxTime[envDiff]) {
- envTime = synth->tables.envDeltaMaxTime[envDiff];
- }
-
- tStat->envsize = (synth->tables.envTime[envTime] * keyLookup->envTimeMult[(int)patchCache->pitchEnv.timekeyfollow]) >> 8;
-
- tStat->envpos = 0;
- tStat->envsize++;
- tStat->envdist = patchCache->pitchEnv.level[tStat->envstat + 1] - tStat->envbase;
- }
- tc = tStat->envbase;
- tc = (tc + ((tStat->envdist * tStat->envpos) / tStat->envsize));
- }
- tStat->prevlevel = tc;
- }
- return tc;
-}
-
-void Partial::startDecayAll() {
- startDecay(EnvelopeType_amp, envs[EnvelopeType_amp].prevlevel);
- startDecay(EnvelopeType_filt, envs[EnvelopeType_filt].prevlevel);
- startDecay(EnvelopeType_pitch, envs[EnvelopeType_pitch].prevlevel);
- pitchSustain = false;
-}
-
-void Partial::startDecay(EnvelopeType envnum, Bit32s startval) {
- EnvelopeStatus *tStat = &envs[envnum];
-
- tStat->sustaining = false;
- tStat->decaying = true;
- tStat->envpos = 0;
- tStat->envbase = startval;
-
- switch (envnum) {
- case EnvelopeType_amp:
- tStat->envsize = FIXEDPOINT_UMULT(synth->tables.envDecayTime[(int)patchCache->ampEnv.envtime[4]], keyLookup->envTimeMult[(int)patchCache->ampEnv.envtkf], 8);
- tStat->envdist = -startval;
- break;
- case EnvelopeType_filt:
- tStat->envsize = FIXEDPOINT_UMULT(synth->tables.envDecayTime[(int)patchCache->filtEnv.envtime[4]], keyLookup->envTimeMult[(int)patchCache->filtEnv.envtkf], 8);
- tStat->envdist = -startval;
- break;
- case EnvelopeType_pitch:
- tStat->envsize = FIXEDPOINT_UMULT(synth->tables.envDecayTime[(int)patchCache->pitchEnv.time[3]], keyLookup->envTimeMult[(int)patchCache->pitchEnv.timekeyfollow], 8);
- tStat->envdist = patchCache->pitchEnv.level[4] - startval;
- break;
- default:
- break;
- }
- tStat->envsize++;
-}
diff --git a/audio/softsynth/mt32/partial.h b/audio/softsynth/mt32/partial.h
deleted file mode 100644
index 93d8bcd985..0000000000
--- a/audio/softsynth/mt32/partial.h
+++ /dev/null
@@ -1,148 +0,0 @@
-/* Copyright (c) 2003-2005 Various contributors
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- * IN THE SOFTWARE.
- */
-
-#ifndef MT32EMU_PARTIAL_H
-#define MT32EMU_PARTIAL_H
-
-namespace MT32Emu {
-
-class Synth;
-struct NoteLookup;
-
-enum EnvelopeType {
- EnvelopeType_amp = 0,
- EnvelopeType_filt = 1,
- EnvelopeType_pitch = 2
-};
-
-struct EnvelopeStatus {
- Bit32s envpos;
- Bit32s envstat;
- Bit32s envbase;
- Bit32s envdist;
- Bit32s envsize;
-
- bool sustaining;
- bool decaying;
- Bit32s prevlevel;
-
- Bit32s counter;
- Bit32s count;
-};
-
-// Class definition of MT-32 partials. 32 in all.
-class Partial {
-private:
- Synth *synth;
-
- int ownerPart; // -1 if unassigned
- int mixType;
- int structurePosition; // 0 or 1 of a structure pair
- bool useNoisePair;
-
- Bit16s myBuffer[MAX_SAMPLE_OUTPUT];
-
- // Keyfollowed note value
-#if MT32EMU_ACCURATENOTES == 1
- NoteLookup noteLookupStorage;
- float noteVal;
-#else
- int noteVal;
- int fineShift;
-#endif
- const NoteLookup *noteLookup; // LUTs for this noteVal
- const KeyLookup *keyLookup; // LUTs for the clamped (12..108) key
-
- // Keyfollowed filter values
- int realVal;
- int filtVal;
-
- // Only used for PCM partials
- int pcmNum;
- PCMWaveEntry *pcmWave;
-
- int pulsewidth;
-
- Bit32u lfoPos;
- soundaddr partialOff;
-
- Bit32u ampEnvVal;
- Bit32u pitchEnvVal;
-
- float history[32];
-
- bool pitchSustain;
-
- int loopPos;
-
- dpoly *poly;
-
- int bendShift;
-
- Bit16s *mixBuffers(Bit16s *buf1, Bit16s *buf2, int len);
- Bit16s *mixBuffersRingMix(Bit16s *buf1, Bit16s *buf2, int len);
- Bit16s *mixBuffersRing(Bit16s *buf1, Bit16s *buf2, int len);
- void mixBuffersStereo(Bit16s *buf1, Bit16s *buf2, Bit16s *outBuf, int len);
-
- Bit32s getFiltEnvelope();
- Bit32u getAmpEnvelope();
- Bit32s getPitchEnvelope();
-
- void initKeyFollow(int freqNum);
-
-public:
- const PatchCache *patchCache;
- EnvelopeStatus envs[3];
- bool play;
-
- PatchCache cachebackup;
-
- Partial *pair;
- bool alreadyOutputed;
- Bit32u age;
-
- Partial(Synth *synth);
- ~Partial();
-
- int getOwnerPart() const;
- int getKey() const;
- const dpoly *getDpoly() const;
- bool isActive();
- void activate(int part);
- void deactivate(void);
- void startPartial(dpoly *usePoly, const PatchCache *useCache, Partial *pairPartial);
- void startDecay(EnvelopeType envnum, Bit32s startval);
- void startDecayAll();
- void setBend(float factor);
- bool shouldReverb();
-
- // Returns true only if data written to buffer
- // This function (unlike the one below it) returns processed stereo samples
- // made from combining this single partial with its pair, if it has one.
- bool produceOutput(Bit16s * partialBuf, long length);
-
- // This function produces mono sample output using the partial's private internal buffer
- Bit16s *generateSamples(long length);
-};
-
-}
-
-#endif
diff --git a/audio/softsynth/mt32/partialManager.cpp b/audio/softsynth/mt32/partialManager.cpp
deleted file mode 100644
index 3d3b6302db..0000000000
--- a/audio/softsynth/mt32/partialManager.cpp
+++ /dev/null
@@ -1,272 +0,0 @@
-/* Copyright (c) 2003-2005 Various contributors
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- * IN THE SOFTWARE.
- */
-
-#include <string.h>
-
-#include "mt32emu.h"
-
-using namespace MT32Emu;
-
-PartialManager::PartialManager(Synth *useSynth) {
- this->synth = useSynth;
- for (int i = 0; i < MT32EMU_MAX_PARTIALS; i++)
- partialTable[i] = new Partial(synth);
-}
-
-PartialManager::~PartialManager(void) {
- for (int i = 0; i < MT32EMU_MAX_PARTIALS; i++)
- delete partialTable[i];
-}
-
-void PartialManager::getPerPartPartialUsage(int usage[9]) {
- memset(usage, 0, 9 * sizeof (int));
- for (int i = 0; i < MT32EMU_MAX_PARTIALS; i++) {
- if (partialTable[i]->isActive())
- usage[partialTable[i]->getOwnerPart()]++;
- }
-}
-
-void PartialManager::clearAlreadyOutputed() {
- for (int i = 0; i < MT32EMU_MAX_PARTIALS; i++)
- partialTable[i]->alreadyOutputed = false;
-}
-
-void PartialManager::ageAll() {
- for (int i = 0; i < MT32EMU_MAX_PARTIALS; i++)
- partialTable[i]->age++;
-}
-
-bool PartialManager::shouldReverb(int i) {
- return partialTable[i]->shouldReverb();
-}
-
-bool PartialManager::produceOutput(int i, Bit16s *buffer, Bit32u bufferLength) {
- return partialTable[i]->produceOutput(buffer, bufferLength);
-}
-
-void PartialManager::deactivateAll() {
- for (int i = 0; i < MT32EMU_MAX_PARTIALS; i++) {
- partialTable[i]->deactivate();
- }
-}
-
-unsigned int PartialManager::setReserve(Bit8u *rset) {
- unsigned int pr = 0;
- for (int x = 0; x < 9; x++) {
- for (int y = 0; y < rset[x]; y++) {
- partialReserveTable[pr] = x;
- pr++;
- }
- }
- return pr;
-}
-
-Partial *PartialManager::allocPartial(int partNum) {
- Partial *outPartial = NULL;
-
- // Use the first inactive partial reserved for the specified part (if there are any)
- // Otherwise, use the last inactive partial, if any
- for (int i = 0; i < MT32EMU_MAX_PARTIALS; i++) {
- if (!partialTable[i]->isActive()) {
- outPartial = partialTable[i];
- if (partialReserveTable[i] == partNum)
- break;
- }
- }
- if (outPartial != NULL) {
- outPartial->activate(partNum);
- outPartial->age = 0;
- }
- return outPartial;
-}
-
-unsigned int PartialManager::getFreePartialCount(void) {
- int count = 0;
- memset(partialPart, 0, sizeof(partialPart));
- for (int i = 0; i < MT32EMU_MAX_PARTIALS; i++) {
- if (!partialTable[i]->isActive())
- count++;
- else
- partialPart[partialTable[i]->getOwnerPart()]++;
- }
- return count;
-}
-
-/*
-bool PartialManager::freePartials(unsigned int needed, int partNum) {
- int i;
- int myPartPrior = (int)mt32ram.system.reserveSettings[partNum];
- if (myPartPrior<partialPart[partNum]) {
- //This can have more parts, must kill off those with less priority
- int most, mostPart;
- while (needed > 0) {
- int selectPart = -1;
- //Find the worst offender with more partials than allocated and kill them
- most = -1;
- mostPart = -1;
- int diff;
-
- for (i=0;i<9;i++) {
- diff = partialPart[i] - (int)mt32ram.system.reserveSettings[i];
-
- if (diff>0) {
- if (diff>most) {
- most = diff;
- mostPart = i;
- }
- }
- }
- selectPart = mostPart;
- if (selectPart == -1) {
- // All parts are within the allocated limits, you suck
- // Look for first partial not of this part that's decaying perhaps?
- return false;
- }
- bool found;
- int oldest;
- int oldnum;
- while (partialPart[selectPart] > (int)mt32ram.system.reserveSettings[selectPart]) {
- oldest = -1;
- oldnum = -1;
- found = false;
- for (i = 0; i < MT32EMU_MAX_PARTIALS; i++) {
- if (partialTable[i]->isActive) {
- if (partialTable[i]->ownerPart == selectPart) {
- found = true;
- if (partialTable[i]->age > oldest) {
- oldest = partialTable[i]->age;
- oldnum = i;
- }
- }
- }
- }
- if (!found) break;
- partialTable[oldnum]->deactivate();
- --partialPart[selectPart];
- --needed;
- }
-
- }
- return true;
-
- } else {
- //This part has reached its max, must kill off its own
- bool found;
- int oldest;
- int oldnum;
- while (needed > 0) {
- oldest = -1;
- oldnum = -1;
- found = false;
- for (i = 0; i < MT32EMU_MAX_PARTIALS; i++) {
- if (partialTable[i]->isActive) {
- if (partialTable[i]->ownerPart == partNum) {
- found = true;
- if (partialTable[i]->age > oldest) {
- oldest = partialTable[i]->age;
- oldnum = i;
- }
- }
- }
- }
- if (!found) break;
- partialTable[oldnum]->deactivate();
- --needed;
- }
- // Couldn't free enough partials, sorry
- if (needed>0) return false;
- return true;
- }
-
-}
-*/
-bool PartialManager::freePartials(unsigned int needed, int partNum) {
- if (needed == 0) {
- return true;
- }
- // Reclaim partials reserved for this part
- // Kill those that are already decaying first
- /*
- for (int i = 0; i < MT32EMU_MAX_PARTIALS; i++) {
- if (partialReserveTable[i] == partNum) {
- if (partialTable[i]->ownerPart != partNum) {
- if (partialTable[i]->partCache->envs[AMPENV].decaying) {
- partialTable[i]->isActive = false;
- --needed;
- if (needed == 0)
- return true;
- }
- }
- }
- }*/
- // Then kill those with the lowest part priority -- oldest at the moment
- while (needed > 0) {
- Bit32u prior = 0;
- int priornum = -1;
-
- for (int i = 0; i < MT32EMU_MAX_PARTIALS; i++) {
- if (partialReserveTable[i] == partNum && partialTable[i]->isActive() && partialTable[i]->getOwnerPart() != partNum) {
- /*
- if (mt32ram.system.reserveSettings[partialTable[i]->ownerPart] < prior) {
- prior = mt32ram.system.reserveSettings[partialTable[i]->ownerPart];
- priornum = i;
- }*/
- if (partialTable[i]->age >= prior) {
- prior = partialTable[i]->age;
- priornum = i;
- }
- }
- }
- if (priornum != -1) {
- partialTable[priornum]->deactivate();
- --needed;
- } else {
- break;
- }
- }
-
- // Kill off the oldest partials within this part
- while (needed > 0) {
- Bit32u oldest = 0;
- int oldlist = -1;
- for (int i = 0; i < MT32EMU_MAX_PARTIALS; i++) {
- if (partialTable[i]->getOwnerPart() == partNum && partialTable[i]->isActive()) {
- if (partialTable[i]->age >= oldest) {
- oldest = partialTable[i]->age;
- oldlist = i;
- }
- }
- }
- if (oldlist != -1) {
- partialTable[oldlist]->deactivate();
- --needed;
- } else {
- break;
- }
- }
- return needed == 0;
-}
-
-const Partial *PartialManager::getPartial(unsigned int partialNum) const {
- if (partialNum > MT32EMU_MAX_PARTIALS - 1)
- return NULL;
- return partialTable[partialNum];
-}
diff --git a/audio/softsynth/mt32/partialManager.h b/audio/softsynth/mt32/partialManager.h
deleted file mode 100644
index b10f93ff02..0000000000
--- a/audio/softsynth/mt32/partialManager.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* Copyright (c) 2003-2005 Various contributors
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- * IN THE SOFTWARE.
- */
-
-#ifndef MT32EMU_PARTIALMANAGER_H
-#define MT32EMU_PARTIALMANAGER_H
-
-namespace MT32Emu {
-
-class Synth;
-
-class PartialManager {
-private:
- Synth *synth; // Only used for sending debug output
-
- Partial *partialTable[MT32EMU_MAX_PARTIALS];
- Bit32s partialReserveTable[MT32EMU_MAX_PARTIALS];
- Bit32s partialPart[9]; // The count of partials played per part
-
-public:
-
- PartialManager(Synth *synth);
- ~PartialManager();
- Partial *allocPartial(int partNum);
- unsigned int getFreePartialCount(void);
- bool freePartials(unsigned int needed, int partNum);
- unsigned int setReserve(Bit8u *rset);
- void deactivateAll();
- void ageAll();
- bool produceOutput(int i, Bit16s *buffer, Bit32u bufferLength);
- bool shouldReverb(int i);
- void clearAlreadyOutputed();
- void getPerPartPartialUsage(int usage[9]);
- const Partial *getPartial(unsigned int partialNum) const;
-};
-
-}
-
-#endif
diff --git a/audio/softsynth/mt32/structures.h b/audio/softsynth/mt32/structures.h
deleted file mode 100644
index ef58c1d20f..0000000000
--- a/audio/softsynth/mt32/structures.h
+++ /dev/null
@@ -1,284 +0,0 @@
-/* Copyright (c) 2003-2005 Various contributors
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- * IN THE SOFTWARE.
- */
-
-#ifndef MT32EMU_STRUCTURES_H
-#define MT32EMU_STRUCTURES_H
-
-namespace MT32Emu {
-
-const unsigned int MAX_SAMPLE_OUTPUT = 4096;
-
-// MT32EMU_MEMADDR() converts from sysex-padded, MT32EMU_SYSEXMEMADDR converts to it
-// Roland provides documentation using the sysex-padded addresses, so we tend to use that in code and output
-#define MT32EMU_MEMADDR(x) ((((x) & 0x7f0000) >> 2) | (((x) & 0x7f00) >> 1) | ((x) & 0x7f))
-#define MT32EMU_SYSEXMEMADDR(x) ((((x) & 0x1FC000) << 2) | (((x) & 0x3F80) << 1) | ((x) & 0x7f))
-
-#ifdef _MSC_VER
-#define MT32EMU_ALIGN_PACKED __declspec(align(1))
-typedef unsigned __int64 Bit64u;
-typedef signed __int64 Bit64s;
-#else
-#define MT32EMU_ALIGN_PACKED __attribute__((packed))
-typedef unsigned long long Bit64u;
-typedef signed long long Bit64s;
-#endif
-
-typedef unsigned int Bit32u;
-typedef signed int Bit32s;
-typedef unsigned short int Bit16u;
-typedef signed short int Bit16s;
-typedef unsigned char Bit8u;
-typedef signed char Bit8s;
-
-// The following structures represent the MT-32's memory
-// Since sysex allows this memory to be written to in blocks of bytes,
-// we keep this packed so that we can copy data into the various
-// banks directly
-#if defined(_MSC_VER) || defined (__MINGW32__)
-#pragma pack(push, 1)
-#else
-#pragma pack(1)
-#endif
-
-struct TimbreParam {
- struct commonParam {
- char name[10];
- Bit8u pstruct12; // 1&2 0-12 (1-13)
- Bit8u pstruct34; // #3&4 0-12 (1-13)
- Bit8u pmute; // 0-15 (0000-1111)
- Bit8u nosustain; // 0-1(Normal, No sustain)
- } MT32EMU_ALIGN_PACKED common;
-
- struct partialParam {
- struct wgParam {
- Bit8u coarse; // 0-96 (C1,C#1-C9)
- Bit8u fine; // 0-100 (-50 to +50 (cents?))
- Bit8u keyfollow; // 0-16 (-1,-1/2,0,1,1/8,1/4,3/8,1/2,5/8,3/4,7/8,1,5/4,3/2,2.s1,s2)
- Bit8u bender; // 0,1 (ON/OFF)
- Bit8u waveform; // MT-32: 0-1 (SQU/SAW); LAPC-I: WG WAVEFORM/PCM BANK 0 - 3 (SQU/1, SAW/1, SQU/2, SAW/2)
- Bit8u pcmwave; // 0-127 (1-128)
- Bit8u pulsewid; // 0-100
- Bit8u pwvelo; // 0-14 (-7 - +7)
- } MT32EMU_ALIGN_PACKED wg;
-
- struct envParam {
- Bit8u depth; // 0-10
- Bit8u sensitivity; // 1-100
- Bit8u timekeyfollow; // 0-4
- Bit8u time[4]; // 1-100
- Bit8u level[5]; // 1-100 (-50 - +50)
- } MT32EMU_ALIGN_PACKED env;
-
- struct lfoParam {
- Bit8u rate; // 0-100
- Bit8u depth; // 0-100
- Bit8u modsense; // 0-100
- } MT32EMU_ALIGN_PACKED lfo;
-
- struct tvfParam {
- Bit8u cutoff; // 0-100
- Bit8u resonance; // 0-30
- Bit8u keyfollow; // 0-16 (-1,-1/2,1/4,0,1,1/8,1/4,3/8,1/2,5/8,3/2,7/8,1,5/4,3/2,2,s1,s2)
- Bit8u biaspoint; // 0-127 (<1A-<7C >1A-7C)
- Bit8u biaslevel; // 0-14 (-7 - +7)
- Bit8u envdepth; // 0-100
- Bit8u envsense; // 0-100
- Bit8u envdkf; // DEPTH KEY FOLL0W 0-4
- Bit8u envtkf; // TIME KEY FOLLOW 0-4
- Bit8u envtime[5]; // 1-100
- Bit8u envlevel[4]; // 1-100
- } MT32EMU_ALIGN_PACKED tvf;
-
- struct tvaParam {
- Bit8u level; // 0-100
- Bit8u velosens; // 0-100
- Bit8u biaspoint1; // 0-127 (<1A-<7C >1A-7C)
- Bit8u biaslevel1; // 0-12 (-12 - 0)
- Bit8u biaspoint2; // 0-127 (<1A-<7C >1A-7C)
- Bit8u biaslevel2; // 0-12 (-12 - 0)
- Bit8u envtkf; // TIME KEY FOLLOW 0-4
- Bit8u envvkf; // VELOS KEY FOLL0W 0-4
- Bit8u envtime[5]; // 1-100
- Bit8u envlevel[4]; // 1-100
- } MT32EMU_ALIGN_PACKED tva;
- } MT32EMU_ALIGN_PACKED partial[4];
-} MT32EMU_ALIGN_PACKED;
-
-struct PatchParam {
- Bit8u timbreGroup; // TIMBRE GROUP 0-3 (group A, group B, Memory, Rhythm)
- Bit8u timbreNum; // TIMBRE NUMBER 0-63
- Bit8u keyShift; // KEY SHIFT 0-48 (-24 - +24 semitones)
- Bit8u fineTune; // FINE TUNE 0-100 (-50 - +50 cents)
- Bit8u benderRange; // BENDER RANGE 0-24
- Bit8u assignMode; // ASSIGN MODE 0-3 (POLY1, POLY2, POLY3, POLY4)
- Bit8u reverbSwitch; // REVERB SWITCH 0-1 (OFF,ON)
- Bit8u dummy; // (DUMMY)
-} MT32EMU_ALIGN_PACKED;
-
-struct MemParams {
- // NOTE: The MT-32 documentation only specifies PatchTemp areas for parts 1-8.
- // The LAPC-I documentation specified an additional area for rhythm at the end,
- // where all parameters but fine tune, assign mode and output level are ignored
- struct PatchTemp {
- PatchParam patch;
- Bit8u outlevel; // OUTPUT LEVEL 0-100
- Bit8u panpot; // PANPOT 0-14 (R-L)
- Bit8u dummyv[6];
- } MT32EMU_ALIGN_PACKED;
-
- PatchTemp patchSettings[9];
-
- struct RhythmTemp {
- Bit8u timbre; // TIMBRE 0-94 (M1-M64,R1-30,OFF)
- Bit8u outlevel; // OUTPUT LEVEL 0-100
- Bit8u panpot; // PANPOT 0-14 (R-L)
- Bit8u reverbSwitch; // REVERB SWITCH 0-1 (OFF,ON)
- } MT32EMU_ALIGN_PACKED;
-
- RhythmTemp rhythmSettings[85];
-
- TimbreParam timbreSettings[8];
-
- PatchParam patches[128];
-
- // NOTE: There are only 30 timbres in the "rhythm" bank for MT-32; the additional 34 are for LAPC-I and above
- struct PaddedTimbre {
- TimbreParam timbre;
- Bit8u padding[10];
- } MT32EMU_ALIGN_PACKED;
-
- PaddedTimbre timbres[64 + 64 + 64 + 64]; // Group A, Group B, Memory, Rhythm
-
- struct SystemArea {
- Bit8u masterTune; // MASTER TUNE 0-127 432.1-457.6Hz
- Bit8u reverbMode; // REVERB MODE 0-3 (room, hall, plate, tap delay)
- Bit8u reverbTime; // REVERB TIME 0-7 (1-8)
- Bit8u reverbLevel; // REVERB LEVEL 0-7 (1-8)
- Bit8u reserveSettings[9]; // PARTIAL RESERVE (PART 1) 0-32
- Bit8u chanAssign[9]; // MIDI CHANNEL (PART1) 0-16 (1-16,OFF)
- Bit8u masterVol; // MASTER VOLUME 0-100
- } MT32EMU_ALIGN_PACKED;
-
- SystemArea system;
-};
-
-#if defined(_MSC_VER) || defined (__MINGW32__)
-#pragma pack(pop)
-#else
-#pragma pack()
-#endif
-
-struct PCMWaveEntry {
- Bit32u addr;
- Bit32u len;
- double tune;
- bool loop;
-};
-
-struct soundaddr {
- Bit16u pcmplace;
- Bit16u pcmoffset;
-};
-
-struct StereoVolume {
- Bit16s leftvol;
- Bit16s rightvol;
-};
-
-// This is basically a per-partial, pre-processed combination of timbre and patch/rhythm settings
-struct PatchCache {
- bool playPartial;
- bool PCMPartial;
- int pcm;
- char waveform;
- int pulsewidth;
- int pwsens;
-
- float pitch;
-
- int lfodepth;
- int lforate;
- Bit32u lfoperiod;
- int modsense;
-
- float pitchKeyfollow;
-
- int filtkeyfollow;
-
- int tvfbias;
- int tvfblevel;
- int tvfdir;
-
- int ampbias[2];
- int ampblevel[2];
- int ampdir[2];
-
- int ampdepth;
- int amplevel;
-
- bool useBender;
- float benderRange; // 0.0, 1.0, .., 24.0 (semitones)
-
- TimbreParam::partialParam::envParam pitchEnv;
- TimbreParam::partialParam::tvaParam ampEnv;
- TimbreParam::partialParam::tvfParam filtEnv;
-
- Bit32s pitchsustain;
- Bit32s filtsustain;
-
- Bit32u structureMix;
- int structurePosition;
- int structurePair;
-
- // The following fields are actually common to all partials in the timbre
- bool dirty;
- Bit32u partialCount;
- bool sustain;
- float pitchShift;
- bool reverb;
- const StereoVolume *pansetptr;
-};
-
-class Partial; // Forward reference for class defined in partial.h
-
-struct dpoly {
- bool isPlaying;
-
- unsigned int key;
- int freqnum;
- int vel;
-
- bool isDecay;
-
- const Bit32u *volumeptr;
-
- Partial *partials[4];
-
- bool pedalhold; // This marks keys that have been released on the keyboard, but are being held by the pedal
- bool sustain;
-
- bool isActive() const;
- Bit32u getAge() const;
-};
-
-}
-
-#endif
diff --git a/audio/softsynth/mt32/synth.cpp b/audio/softsynth/mt32/synth.cpp
deleted file mode 100644
index 8c6c3193a9..0000000000
--- a/audio/softsynth/mt32/synth.cpp
+++ /dev/null
@@ -1,1202 +0,0 @@
-/* Copyright (c) 2003-2005 Various contributors
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- * IN THE SOFTWARE.
- */
-
-// FIXME: Avoid using printf
-#define FORBIDDEN_SYMBOL_EXCEPTION_printf
-
-// FIXME: Avoid using vprintf
-#define FORBIDDEN_SYMBOL_EXCEPTION_vprintf
-
-#include <math.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include "mt32emu.h"
-
-#if defined(MACOSX) || defined(SOLARIS) || defined(__MINGW32__)
-// Older versions of Mac OS X didn't supply a powf function, so using it
-// will cause a binary incompatibility when trying to run a binary built
-// on a newer OS X release on an older one. And Solaris 8 doesn't provide
-// powf, floorf, fabsf etc. at all.
-// Cross-compiled MinGW32 toolchains suffer from a cross-compile bug in
-// libstdc++. math/stubs.o should be empty, but it comes with a symbol for
-// powf, resulting in a linker error because of multiple definitions.
-// Hence we re-define them here. The only potential drawback is that it
-// might be a little bit slower this way.
-#define powf(x,y) ((float)pow(x,y))
-#define floorf(x) ((float)floor(x))
-#define fabsf(x) ((float)fabs(x))
-#endif
-
-namespace MT32Emu {
-
-const int MAX_SYSEX_SIZE = 512;
-
-const ControlROMMap ControlROMMaps[5] = {
- // ID IDc IDbytes PCMmap PCMc tmbrA tmbrAO, tmbrB tmbrBO, tmbrR trC rhythm rhyC rsrv panpot prog
- {0x4014, 22, "\000 ver1.04 14 July 87 ", 0x3000, 128, 0x8000, 0x0000, 0xC000, 0x4000, 0x3200, 30, 0x73A6, 85, 0x57C7, 0x57D0, 0x57E2}, // MT-32 revision 0
- {0x4014, 22, "\000 ver1.06 31 Aug, 87 ", 0x3000, 128, 0x8000, 0x0000, 0xC000, 0x4000, 0x3200, 30, 0x7414, 85, 0x57D9, 0x57E2, 0x57F4}, // MT-32 revision 0
- {0x4010, 22, "\000 ver1.07 10 Oct, 87 ", 0x3000, 128, 0x8000, 0x0000, 0xC000, 0x4000, 0x3200, 30, 0x73fe, 85, 0x57B1, 0x57BA, 0x57CC}, // MT-32 revision 1
- {0x4010, 22, "\000verX.XX 30 Sep, 88 ", 0x3000, 128, 0x8000, 0x0000, 0xC000, 0x4000, 0x3200, 30, 0x741C, 85, 0x57E5, 0x57EE, 0x5800}, // MT-32 Blue Ridge mod
- {0x2205, 22, "\000CM32/LAPC1.02 891205", 0x8100, 256, 0x8000, 0x8000, 0x8080, 0x8000, 0x8500, 64, 0x8580, 85, 0x4F93, 0x4F9C, 0x4FAE} // CM-32L
- // (Note that all but CM-32L ROM actually have 86 entries for rhythmTemp)
-};
-
-float iir_filter_normal(float input, float *hist1_ptr, float *coef_ptr) {
- float *hist2_ptr;
- float output,new_hist;
-
- hist2_ptr = hist1_ptr + 1; // next history
-
- // 1st number of coefficients array is overall input scale factor, or filter gain
- output = input * (*coef_ptr++);
-
- output = output - *hist1_ptr * (*coef_ptr++);
- new_hist = output - *hist2_ptr * (*coef_ptr++); // poles
-
- output = new_hist + *hist1_ptr * (*coef_ptr++);
- output = output + *hist2_ptr * (*coef_ptr++); // zeros
-
- *hist2_ptr++ = *hist1_ptr;
- *hist1_ptr++ = new_hist;
- hist1_ptr++;
- hist2_ptr++;
-
- // i = 1
- output = output - *hist1_ptr * (*coef_ptr++);
- new_hist = output - *hist2_ptr * (*coef_ptr++); // poles
-
- output = new_hist + *hist1_ptr * (*coef_ptr++);
- output = output + *hist2_ptr * (*coef_ptr++); // zeros
-
- *hist2_ptr++ = *hist1_ptr;
- *hist1_ptr++ = new_hist;
-
- return(output);
-}
-
-Bit8u Synth::calcSysexChecksum(const Bit8u *data, Bit32u len, Bit8u checksum) {
- for (unsigned int i = 0; i < len; i++) {
- checksum = checksum + data[i];
- }
- checksum = checksum & 0x7f;
- if (checksum)
- checksum = 0x80 - checksum;
- return checksum;
-}
-
-Synth::Synth() {
- isOpen = false;
- reverbModel = NULL;
- partialManager = NULL;
- memset(parts, 0, sizeof(parts));
-}
-
-Synth::~Synth() {
- close(); // Make sure we're closed and everything is freed
-}
-
-int Synth::report(ReportType type, const void *data) {
- if (myProp.report != NULL) {
- return myProp.report(myProp.userData, type, data);
- }
- return 0;
-}
-
-void Synth::printDebug(const char *fmt, ...) {
- va_list ap;
- va_start(ap, fmt);
- if (myProp.printDebug != NULL) {
- myProp.printDebug(myProp.userData, fmt, ap);
- } else {
- vprintf(fmt, ap);
- printf("\n");
- }
- va_end(ap);
-}
-
-void Synth::initReverb(Bit8u newRevMode, Bit8u newRevTime, Bit8u newRevLevel) {
- // FIXME:KG: I don't think it's necessary to recreate the reverbModel... Just set the parameters
- delete reverbModel;
- reverbModel = new revmodel();
-
- switch (newRevMode) {
- case 0:
- reverbModel->setroomsize(.1f);
- reverbModel->setdamp(.75f);
- break;
- case 1:
- reverbModel->setroomsize(.5f);
- reverbModel->setdamp(.5f);
- break;
- case 2:
- reverbModel->setroomsize(.5f);
- reverbModel->setdamp(.1f);
- break;
- case 3:
- reverbModel->setroomsize(1.0f);
- reverbModel->setdamp(.75f);
- break;
- default:
- reverbModel->setroomsize(.1f);
- reverbModel->setdamp(.5f);
- break;
- }
- reverbModel->setdry(1);
- reverbModel->setwet((float)newRevLevel / 8.0f);
- reverbModel->setwidth((float)newRevTime / 8.0f);
-}
-
-File *Synth::openFile(const char *filename, File::OpenMode mode) {
- // It should never happen that openFile is NULL in our use case.
- // Just to cover the case where something is horrible wrong we
- // use an assert here.
- assert(myProp.openFile != NULL);
- return myProp.openFile(myProp.userData, filename, mode);
-}
-
-void Synth::closeFile(File *file) {
- if (myProp.closeFile != NULL) {
- myProp.closeFile(myProp.userData, file);
- } else {
- file->close();
- delete file;
- }
-}
-
-bool Synth::loadPreset(File *file) {
- bool inSys = false;
- Bit8u sysexBuf[MAX_SYSEX_SIZE];
- Bit16u syslen = 0;
- bool rc = true;
- for (;;) {
- Bit8u c;
- if (!file->readBit8u(&c)) {
- if (!file->isEOF()) {
- rc = false;
- }
- break;
- }
- sysexBuf[syslen] = c;
- if (inSys) {
- syslen++;
- if (c == 0xF7) {
- playSysex(&sysexBuf[0], syslen);
- inSys = false;
- syslen = 0;
- } else if (syslen == MAX_SYSEX_SIZE) {
- printDebug("MAX_SYSEX_SIZE (%d) exceeded while processing preset, ignoring message", MAX_SYSEX_SIZE);
- inSys = false;
- syslen = 0;
- }
- } else if (c == 0xF0) {
- syslen++;
- inSys = true;
- }
- }
- return rc;
-}
-
-bool Synth::loadControlROM(const char *filename) {
- File *file = openFile(filename, File::OpenMode_read); // ROM File
- if (file == NULL) {
- return false;
- }
- bool rc = (file->read(controlROMData, CONTROL_ROM_SIZE) == CONTROL_ROM_SIZE);
-
- closeFile(file);
- if (!rc)
- return rc;
-
- // Control ROM successfully loaded, now check whether it's a known type
- controlROMMap = NULL;
- for (unsigned int i = 0; i < sizeof (ControlROMMaps) / sizeof (ControlROMMaps[0]); i++) {
- if (memcmp(&controlROMData[ControlROMMaps[i].idPos], ControlROMMaps[i].idBytes, ControlROMMaps[i].idLen) == 0) {
- controlROMMap = &ControlROMMaps[i];
- return true;
- }
- }
- return false;
-}
-
-bool Synth::loadPCMROM(const char *filename) {
- File *file = openFile(filename, File::OpenMode_read); // ROM File
- if (file == NULL) {
- return false;
- }
- bool rc = true;
- int i;
- for (i = 0; i < pcmROMSize; i++) {
- Bit8u s;
- if (!file->readBit8u(&s)) {
- if (!file->isEOF()) {
- rc = false;
- }
- break;
- }
- Bit8u c;
- if (!file->readBit8u(&c)) {
- if (!file->isEOF()) {
- rc = false;
- } else {
- printDebug("PCM ROM file has an odd number of bytes! Ignoring last");
- }
- break;
- }
-
- short e;
- int bit;
- int u;
- int order[16] = {0, 9, 1 ,2, 3, 4, 5, 6, 7, 10, 11, 12, 13, 14, 15, 8};
-
- e = 0;
- for (u = 0; u < 15; u++) {
- if (order[u] < 8)
- bit = (s >> (7 - order[u])) & 0x1;
- else
- bit = (c >> (7 - (order[u] - 8))) & 0x1;
- e = e | (short)(bit << (15 - u));
- }
-
- /*
- //Bit16s e = ( ((s & 0x7f) << 4) | ((c & 0x40) << 6) | ((s & 0x80) << 6) | ((c & 0x3f))) << 2;
- if (e<0)
- e = -32767 - e;
- int ut = abs(e);
- int dif = 0x7fff - ut;
- x = exp(((float)((float)0x8000-(float)dif) / (float)0x1000));
- e = (int)((float)e * (x/3200));
- */
-
- // File is companded (dB?), convert to linear PCM
- // MINDB = -96
- // MAXDB = -15
- float testval;
- testval = (float)((~e) & 0x7fff);
- testval = -(testval / 400.00f);
- //testval = -(testval / 341.32291666666666666666666666667);
- float vol = powf(8, testval / 20) * 32767.0f;
-
- if (e > 0)
- vol = -vol;
-
- pcmROMData[i] = (Bit16s)vol;
- }
- if (i != pcmROMSize) {
- printDebug("PCM ROM file is too short (expected %d, got %d)", pcmROMSize, i);
- rc = false;
- }
- closeFile(file);
- return rc;
-}
-
-bool Synth::initPCMList(Bit16u mapAddress, Bit16u count) {
- ControlROMPCMStruct *tps = (ControlROMPCMStruct *)&controlROMData[mapAddress];
- for (int i = 0; i < count; i++) {
- int rAddr = tps[i].pos * 0x800;
- int rLenExp = (tps[i].len & 0x70) >> 4;
- int rLen = 0x800 << rLenExp;
- bool rLoop = (tps[i].len & 0x80) != 0;
- //Bit8u rFlag = tps[i].len & 0x0F;
- Bit16u rTuneOffset = (tps[i].pitchMSB << 8) | tps[i].pitchLSB;
- // The number below is confirmed to a reasonable degree of accuracy on CM-32L
- double STANDARDFREQ = 442.0;
- float rTune = (float)(STANDARDFREQ * pow(2.0, (0x5000 - rTuneOffset) / 4056.0 - 9.0 / 12.0));
- //printDebug("%f,%d,%d", (double)pTune, tps[i].pitchCoarse, tps[i].pitchFine);
- if (rAddr + rLen > pcmROMSize) {
- printDebug("Control ROM error: Wave map entry %d points to invalid PCM address 0x%04X, length 0x%04X", i, rAddr, rLen);
- return false;
- }
- pcmWaves[i].addr = rAddr;
- pcmWaves[i].len = rLen;
- pcmWaves[i].loop = rLoop;
- pcmWaves[i].tune = rTune;
- }
- return false;
-}
-
-bool Synth::initRhythmTimbre(int timbreNum, const Bit8u *mem, unsigned int memLen) {
- if (memLen < sizeof(TimbreParam::commonParam)) {
- return false;
- }
- TimbreParam *timbre = &mt32ram.timbres[timbreNum].timbre;
- memcpy(&timbre->common, mem, 14);
- unsigned int memPos = 14;
- char drumname[11];
- memset(drumname, 0, 11);
- memcpy(drumname, timbre->common.name, 10);
- for (int t = 0; t < 4; t++) {
- if (((timbre->common.pmute >> t) & 0x1) == 0x1) {
- if (memPos + 58 >= memLen) {
- return false;
- }
- memcpy(&timbre->partial[t], mem + memPos, 58);
- memPos += 58;
- }
- }
- return true;
-}
-
-bool Synth::initRhythmTimbres(Bit16u mapAddress, Bit16u count) {
- const Bit8u *drumMap = &controlROMData[mapAddress];
- int timbreNum = 192;
- for (Bit16u i = 0; i < count * 2; i += 2) {
- Bit16u address = (drumMap[i + 1] << 8) | drumMap[i];
- /*
- // This check is nonsensical when the control ROM is the full 64KB addressable by 16-bit absolute pointers (which it is)
- if (address >= CONTROL_ROM_SIZE) {
- printDebug("Control ROM error: Timbre map entry 0x%04x points to invalid timbre address 0x%04x", i, address);
- return false;
- }
- */
- if (!initRhythmTimbre(timbreNum++, &controlROMData[address], CONTROL_ROM_SIZE - address)) {
- printDebug("Control ROM error: Timbre map entry 0x%04x points to invalid timbre 0x%04x", i, address);
- return false;
- }
- }
- return true;
-}
-
-bool Synth::initTimbres(Bit16u mapAddress, Bit16u offset, int startTimbre) {
- for (Bit16u i = mapAddress; i < mapAddress + 0x80; i += 2) {
- Bit16u address = (controlROMData[i + 1] << 8) | controlROMData[i];
- if (address + sizeof(TimbreParam) > CONTROL_ROM_SIZE) {
- printDebug("Control ROM error: Timbre map entry 0x%04x points to invalid timbre address 0x%04x", i, address);
- return false;
- }
- address = address + offset;
- TimbreParam *timbre = &mt32ram.timbres[startTimbre++].timbre;
- memcpy(timbre, &controlROMData[address], sizeof(TimbreParam));
- }
- return true;
-}
-
-bool Synth::open(SynthProperties &useProp) {
- if (isOpen)
- return false;
-
- myProp = useProp;
- if (useProp.baseDir != NULL) {
- myProp.baseDir = new char[strlen(useProp.baseDir) + 1];
- strcpy(myProp.baseDir, useProp.baseDir);
- }
-
- // This is to help detect bugs
- memset(&mt32ram, '?', sizeof(mt32ram));
-
- printDebug("Loading Control ROM");
- if (!loadControlROM("CM32L_CONTROL.ROM")) {
- if (!loadControlROM("MT32_CONTROL.ROM")) {
- printDebug("Init Error - Missing or invalid MT32_CONTROL.ROM");
- report(ReportType_errorControlROM, NULL);
- return false;
- }
- }
-
- // 512KB PCM ROM for MT-32, etc.
- // 1MB PCM ROM for CM-32L, LAPC-I, CM-64, CM-500
- // Note that the size below is given in samples (16-bit), not bytes
- pcmROMSize = controlROMMap->pcmCount == 256 ? 512 * 1024 : 256 * 1024;
- pcmROMData = new Bit16s[pcmROMSize];
-
- printDebug("Loading PCM ROM");
- if (!loadPCMROM("CM32L_PCM.ROM")) {
- if (!loadPCMROM("MT32_PCM.ROM")) {
- printDebug("Init Error - Missing MT32_PCM.ROM");
- report(ReportType_errorPCMROM, NULL);
- return false;
- }
- }
-
- printDebug("Initializing Timbre Bank A");
- if (!initTimbres(controlROMMap->timbreAMap, controlROMMap->timbreAOffset, 0)) {
- return false;
- }
-
- printDebug("Initializing Timbre Bank B");
- if (!initTimbres(controlROMMap->timbreBMap, controlROMMap->timbreBOffset, 64)) {
- return false;
- }
-
- printDebug("Initializing Timbre Bank R");
- if (!initRhythmTimbres(controlROMMap->timbreRMap, controlROMMap->timbreRCount)) {
- return false;
- }
-
- printDebug("Initializing Timbre Bank M");
- // CM-64 seems to initialize all bytes in this bank to 0.
- memset(&mt32ram.timbres[128], 0, sizeof (mt32ram.timbres[128]) * 64);
-
- partialManager = new PartialManager(this);
-
- pcmWaves = new PCMWaveEntry[controlROMMap->pcmCount];
-
- printDebug("Initializing PCM List");
- initPCMList(controlROMMap->pcmTable, controlROMMap->pcmCount);
-
- printDebug("Initializing Rhythm Temp");
- memcpy(mt32ram.rhythmSettings, &controlROMData[controlROMMap->rhythmSettings], controlROMMap->rhythmSettingsCount * 4);
-
- printDebug("Initializing Patches");
- for (Bit8u i = 0; i < 128; i++) {
- PatchParam *patch = &mt32ram.patches[i];
- patch->timbreGroup = i / 64;
- patch->timbreNum = i % 64;
- patch->keyShift = 24;
- patch->fineTune = 50;
- patch->benderRange = 12;
- patch->assignMode = 0;
- patch->reverbSwitch = 1;
- patch->dummy = 0;
- }
-
- printDebug("Initializing System");
- // The MT-32 manual claims that "Standard pitch" is 442Hz.
- mt32ram.system.masterTune = 0x40; // Confirmed on CM-64 as 0x4A, but SCUMM games use 0x40 and we don't want to initialize twice
- mt32ram.system.reverbMode = 0; // Confirmed
- mt32ram.system.reverbTime = 5; // Confirmed
- mt32ram.system.reverbLevel = 3; // Confirmed
- memcpy(mt32ram.system.reserveSettings, &controlROMData[controlROMMap->reserveSettings], 9); // Confirmed
- for (Bit8u i = 0; i < 9; i++) {
- // This is the default: {1, 2, 3, 4, 5, 6, 7, 8, 9}
- // An alternative configuration can be selected by holding "Master Volume"
- // and pressing "PART button 1" on the real MT-32's frontpanel.
- // The channel assignment is then {0, 1, 2, 3, 4, 5, 6, 7, 9}
- mt32ram.system.chanAssign[i] = i + 1;
- }
- mt32ram.system.masterVol = 100; // Confirmed
- if (!refreshSystem())
- return false;
-
- for (int i = 0; i < 8; i++) {
- mt32ram.patchSettings[i].outlevel = 80;
- mt32ram.patchSettings[i].panpot = controlROMData[controlROMMap->panSettings + i];
- memset(mt32ram.patchSettings[i].dummyv, 0, sizeof(mt32ram.patchSettings[i].dummyv));
- parts[i] = new Part(this, i);
- parts[i]->setProgram(controlROMData[controlROMMap->programSettings + i]);
- }
- parts[8] = new RhythmPart(this, 8);
-
- // For resetting mt32 mid-execution
- mt32default = mt32ram;
-
- iirFilter = &iir_filter_normal;
-
-#ifdef MT32EMU_HAVE_X86
- bool availableSSE = DetectSIMD();
- bool available3DNow = Detect3DNow();
-
- if (availableSSE)
- report(ReportType_availableSSE, NULL);
- if (available3DNow)
- report(ReportType_available3DNow, NULL);
-
- if (available3DNow) {
- printDebug("Detected and using SIMD (AMD 3DNow) extensions");
- iirFilter = &iir_filter_3dnow;
- report(ReportType_using3DNow, NULL);
- } else if (availableSSE) {
- printDebug("Detected and using SIMD (Intel SSE) extensions");
- iirFilter = &iir_filter_sse;
- report(ReportType_usingSSE, NULL);
- }
-#endif
-
- isOpen = true;
- isEnabled = false;
-
- printDebug("*** Initialisation complete ***");
- return true;
-}
-
-void Synth::close(void) {
- if (!isOpen)
- return;
-
- tables.freeNotes();
- if (partialManager != NULL) {
- delete partialManager;
- partialManager = NULL;
- }
-
- if (reverbModel != NULL) {
- delete reverbModel;
- reverbModel = NULL;
- }
-
- for (int i = 0; i < 9; i++) {
- if (parts[i] != NULL) {
- delete parts[i];
- parts[i] = NULL;
- }
- }
- if (myProp.baseDir != NULL) {
- delete myProp.baseDir;
- myProp.baseDir = NULL;
- }
-
- delete[] pcmWaves;
- delete[] pcmROMData;
- isOpen = false;
-}
-
-void Synth::playMsg(Bit32u msg) {
- // FIXME: Implement active sensing
- unsigned char code = (unsigned char)((msg & 0x0000F0) >> 4);
- unsigned char chan = (unsigned char) (msg & 0x00000F);
- unsigned char note = (unsigned char)((msg & 0x00FF00) >> 8);
- unsigned char velocity = (unsigned char)((msg & 0xFF0000) >> 16);
- isEnabled = true;
-
- //printDebug("Playing chan %d, code 0x%01x note: 0x%02x", chan, code, note);
-
- signed char part = chantable[chan];
- if (part < 0 || part > 8) {
- printDebug("Play msg on unreg chan %d (%d): code=0x%01x, vel=%d", chan, part, code, velocity);
- return;
- }
- playMsgOnPart(part, code, note, velocity);
-}
-
-void Synth::playMsgOnPart(unsigned char part, unsigned char code, unsigned char note, unsigned char velocity) {
- Bit32u bend;
-
- //printDebug("Synth::playMsg(0x%02x)",msg);
- switch (code) {
- case 0x8:
- //printDebug("Note OFF - Part %d", part);
- // The MT-32 ignores velocity for note off
- parts[part]->stopNote(note);
- break;
- case 0x9:
- //printDebug("Note ON - Part %d, Note %d Vel %d", part, note, velocity);
- if (velocity == 0) {
- // MIDI defines note-on with velocity 0 as being the same as note-off with velocity 40
- parts[part]->stopNote(note);
- } else {
- parts[part]->playNote(note, velocity);
- }
- break;
- case 0xB: // Control change
- switch (note) {
- case 0x01: // Modulation
- //printDebug("Modulation: %d", velocity);
- parts[part]->setModulation(velocity);
- break;
- case 0x07: // Set volume
- //printDebug("Volume set: %d", velocity);
- parts[part]->setVolume(velocity);
- break;
- case 0x0A: // Pan
- //printDebug("Pan set: %d", velocity);
- parts[part]->setPan(velocity);
- break;
- case 0x0B:
- //printDebug("Expression set: %d", velocity);
- parts[part]->setExpression(velocity);
- break;
- case 0x40: // Hold (sustain) pedal
- //printDebug("Hold pedal set: %d", velocity);
- parts[part]->setHoldPedal(velocity>=64);
- break;
-
- case 0x79: // Reset all controllers
- //printDebug("Reset all controllers");
- //FIXME: Check for accuracy against real thing
- parts[part]->setVolume(100);
- parts[part]->setExpression(127);
- parts[part]->setPan(64);
- parts[part]->setBend(0x2000);
- parts[part]->setHoldPedal(false);
- break;
-
- case 0x7B: // All notes off
- //printDebug("All notes off");
- parts[part]->allNotesOff();
- break;
-
- default:
- printDebug("Unknown MIDI Control code: 0x%02x - vel 0x%02x", note, velocity);
- break;
- }
-
- break;
- case 0xC: // Program change
- //printDebug("Program change %01x", note);
- parts[part]->setProgram(note);
- break;
- case 0xE: // Pitch bender
- bend = (velocity << 7) | (note);
- //printDebug("Pitch bender %02x", bend);
- parts[part]->setBend(bend);
- break;
- default:
- printDebug("Unknown Midi code: 0x%01x - %02x - %02x", code, note, velocity);
- break;
- }
-
- //midiOutShortMsg(m_out, msg);
-}
-
-void Synth::playSysex(const Bit8u *sysex, Bit32u len) {
- if (len < 2) {
- printDebug("playSysex: Message is too short for sysex (%d bytes)", len);
- }
- if (sysex[0] != 0xF0) {
- printDebug("playSysex: Message lacks start-of-sysex (0xF0)");
- return;
- }
- // Due to some programs (e.g. Java) sending buffers with junk at the end, we have to go through and find the end marker rather than relying on len.
- Bit32u endPos;
- for (endPos = 1; endPos < len; endPos++)
- {
- if (sysex[endPos] == 0xF7)
- break;
- }
- if (endPos == len) {
- printDebug("playSysex: Message lacks end-of-sysex (0xf7)");
- return;
- }
- playSysexWithoutFraming(sysex + 1, endPos - 1);
-}
-
-void Synth::playSysexWithoutFraming(const Bit8u *sysex, Bit32u len) {
- if (len < 4) {
- printDebug("playSysexWithoutFraming: Message is too short (%d bytes)!", len);
- return;
- }
- if (sysex[0] != SYSEX_MANUFACTURER_ROLAND) {
- printDebug("playSysexWithoutFraming: Header not intended for this device manufacturer: %02x %02x %02x %02x", (int)sysex[0], (int)sysex[1], (int)sysex[2], (int)sysex[3]);
- return;
- }
- if (sysex[2] == SYSEX_MDL_D50) {
- printDebug("playSysexWithoutFraming: Header is intended for model D-50 (not yet supported): %02x %02x %02x %02x", (int)sysex[0], (int)sysex[1], (int)sysex[2], (int)sysex[3]);
- return;
- }
- else if (sysex[2] != SYSEX_MDL_MT32) {
- printDebug("playSysexWithoutFraming: Header not intended for model MT-32: %02x %02x %02x %02x", (int)sysex[0], (int)sysex[1], (int)sysex[2], (int)sysex[3]);
- return;
- }
- playSysexWithoutHeader(sysex[1], sysex[3], sysex + 4, len - 4);
-}
-
-void Synth::playSysexWithoutHeader(unsigned char device, unsigned char command, const Bit8u *sysex, Bit32u len) {
- if (device > 0x10) {
- // We have device ID 0x10 (default, but changeable, on real MT-32), < 0x10 is for channels
- printDebug("playSysexWithoutHeader: Message is not intended for this device ID (provided: %02x, expected: 0x10 or channel)", (int)device);
- return;
- }
- if (len < 4) {
- printDebug("playSysexWithoutHeader: Message is too short (%d bytes)!", len);
- return;
- }
- unsigned char checksum = calcSysexChecksum(sysex, len - 1, 0);
- if (checksum != sysex[len - 1]) {
- printDebug("playSysexWithoutHeader: Message checksum is incorrect (provided: %02x, expected: %02x)!", sysex[len - 1], checksum);
- return;
- }
- len -= 1; // Exclude checksum
- switch (command) {
- case SYSEX_CMD_DT1:
- writeSysex(device, sysex, len);
- break;
- case SYSEX_CMD_RQ1:
- readSysex(device, sysex, len);
- break;
- default:
- printDebug("playSysexWithoutFraming: Unsupported command %02x", command);
- return;
- }
-}
-
-void Synth::readSysex(unsigned char /*device*/, const Bit8u * /*sysex*/, Bit32u /*len*/) {
-}
-
-const MemoryRegion memoryRegions[8] = {
- {MR_PatchTemp, MT32EMU_MEMADDR(0x030000), sizeof(MemParams::PatchTemp), 9},
- {MR_RhythmTemp, MT32EMU_MEMADDR(0x030110), sizeof(MemParams::RhythmTemp), 85},
- {MR_TimbreTemp, MT32EMU_MEMADDR(0x040000), sizeof(TimbreParam), 8},
- {MR_Patches, MT32EMU_MEMADDR(0x050000), sizeof(PatchParam), 128},
- {MR_Timbres, MT32EMU_MEMADDR(0x080000), sizeof(MemParams::PaddedTimbre), 64 + 64 + 64 + 64},
- {MR_System, MT32EMU_MEMADDR(0x100000), sizeof(MemParams::SystemArea), 1},
- {MR_Display, MT32EMU_MEMADDR(0x200000), MAX_SYSEX_SIZE - 1, 1},
- {MR_Reset, MT32EMU_MEMADDR(0x7F0000), 0x3FFF, 1}
-};
-
-const int NUM_REGIONS = sizeof(memoryRegions) / sizeof(MemoryRegion);
-
-void Synth::writeSysex(unsigned char device, const Bit8u *sysex, Bit32u len) {
- Bit32u addr = (sysex[0] << 16) | (sysex[1] << 8) | (sysex[2]);
- addr = MT32EMU_MEMADDR(addr);
- sysex += 3;
- len -= 3;
- //printDebug("Sysex addr: 0x%06x", MT32EMU_SYSEXMEMADDR(addr));
- // NOTE: Please keep both lower and upper bounds in each check, for ease of reading
-
- // Process channel-specific sysex by converting it to device-global
- if (device < 0x10) {
- printDebug("WRITE-CHANNEL: Channel %d temp area 0x%06x", device, MT32EMU_SYSEXMEMADDR(addr));
- if (/*addr >= MT32EMU_MEMADDR(0x000000) && */addr < MT32EMU_MEMADDR(0x010000)) {
- int offset;
- if (chantable[device] == -1) {
- printDebug(" (Channel not mapped to a partial... 0 offset)");
- offset = 0;
- } else if (chantable[device] == 8) {
- printDebug(" (Channel mapped to rhythm... 0 offset)");
- offset = 0;
- } else {
- offset = chantable[device] * sizeof(MemParams::PatchTemp);
- printDebug(" (Setting extra offset to %d)", offset);
- }
- addr += MT32EMU_MEMADDR(0x030000) + offset;
- } else if (/*addr >= 0x010000 && */ addr < MT32EMU_MEMADDR(0x020000)) {
- addr += MT32EMU_MEMADDR(0x030110) - MT32EMU_MEMADDR(0x010000);
- } else if (/*addr >= 0x020000 && */ addr < MT32EMU_MEMADDR(0x030000)) {
- int offset;
- if (chantable[device] == -1) {
- printDebug(" (Channel not mapped to a partial... 0 offset)");
- offset = 0;
- } else if (chantable[device] == 8) {
- printDebug(" (Channel mapped to rhythm... 0 offset)");
- offset = 0;
- } else {
- offset = chantable[device] * sizeof(TimbreParam);
- printDebug(" (Setting extra offset to %d)", offset);
- }
- addr += MT32EMU_MEMADDR(0x040000) - MT32EMU_MEMADDR(0x020000) + offset;
- } else {
- printDebug("PlaySysexWithoutHeader: Invalid channel %d address 0x%06x", device, MT32EMU_SYSEXMEMADDR(addr));
- return;
- }
- }
-
- // Process device-global sysex (possibly converted from channel-specific sysex above)
- for (;;) {
- // Find the appropriate memory region
- int regionNum;
- const MemoryRegion *region = NULL; // Initialized to please compiler
- for (regionNum = 0; regionNum < NUM_REGIONS; regionNum++) {
- region = &memoryRegions[regionNum];
- if (region->contains(addr)) {
- writeMemoryRegion(region, addr, region->getClampedLen(addr, len), sysex);
- break;
- }
- }
- if (regionNum == NUM_REGIONS) {
- printDebug("Sysex write to unrecognized address %06x, len %d", MT32EMU_SYSEXMEMADDR(addr), len);
- break;
- }
- Bit32u next = region->next(addr, len);
- if (next == 0) {
- break;
- }
- addr += next;
- sysex += next;
- len -= next;
- }
-}
-
-void Synth::readMemory(Bit32u addr, Bit32u len, Bit8u *data) {
- int regionNum;
- const MemoryRegion *region = NULL;
- for (regionNum = 0; regionNum < NUM_REGIONS; regionNum++) {
- region = &memoryRegions[regionNum];
- if (region->contains(addr)) {
- readMemoryRegion(region, addr, len, data);
- break;
- }
- }
-}
-
-void Synth::readMemoryRegion(const MemoryRegion *region, Bit32u addr, Bit32u len, Bit8u *data) {
- unsigned int first = region->firstTouched(addr);
- //unsigned int last = region->lastTouched(addr, len);
- unsigned int off = region->firstTouchedOffset(addr);
- len = region->getClampedLen(addr, len);
-
- unsigned int m;
-
- switch (region->type) {
- case MR_PatchTemp:
- for (m = 0; m < len; m++)
- data[m] = ((Bit8u *)&mt32ram.patchSettings[first])[off + m];
- break;
- case MR_RhythmTemp:
- for (m = 0; m < len; m++)
- data[m] = ((Bit8u *)&mt32ram.rhythmSettings[first])[off + m];
- break;
- case MR_TimbreTemp:
- for (m = 0; m < len; m++)
- data[m] = ((Bit8u *)&mt32ram.timbreSettings[first])[off + m];
- break;
- case MR_Patches:
- for (m = 0; m < len; m++)
- data[m] = ((Bit8u *)&mt32ram.patches[first])[off + m];
- break;
- case MR_Timbres:
- for (m = 0; m < len; m++)
- data[m] = ((Bit8u *)&mt32ram.timbres[first])[off + m];
- break;
- case MR_System:
- for (m = 0; m < len; m++)
- data[m] = ((Bit8u *)&mt32ram.system)[m + off];
- break;
- default:
- for (m = 0; m < len; m += 2) {
- data[m] = 0xff;
- if (m + 1 < len) {
- data[m+1] = (Bit8u)region->type;
- }
- }
- // TODO: Don't care about the others ATM
- break;
- }
-
-}
-
-void Synth::writeMemoryRegion(const MemoryRegion *region, Bit32u addr, Bit32u len, const Bit8u *data) {
- unsigned int first = region->firstTouched(addr);
- unsigned int last = region->lastTouched(addr, len);
- unsigned int off = region->firstTouchedOffset(addr);
- switch (region->type) {
- case MR_PatchTemp:
- for (unsigned int m = 0; m < len; m++) {
- ((Bit8u *)&mt32ram.patchSettings[first])[off + m] = data[m];
- }
- //printDebug("Patch temp: Patch %d, offset %x, len %d", off/16, off % 16, len);
-
- for (unsigned int i = first; i <= last; i++) {
- int absTimbreNum = mt32ram.patchSettings[i].patch.timbreGroup * 64 + mt32ram.patchSettings[i].patch.timbreNum;
- char timbreName[11];
- memcpy(timbreName, mt32ram.timbres[absTimbreNum].timbre.common.name, 10);
- timbreName[10] = 0;
- printDebug("WRITE-PARTPATCH (%d-%d@%d..%d): %d; timbre=%d (%s), outlevel=%d", first, last, off, off + len, i, absTimbreNum, timbreName, mt32ram.patchSettings[i].outlevel);
- if (parts[i] != NULL) {
- if (i != 8) {
- // Note: Confirmed on CM-64 that we definitely *should* update the timbre here,
- // but only in the case that the sysex actually writes to those values
- if (i == first && off > 2) {
- printDebug(" (Not updating timbre, since those values weren't touched)");
- } else {
- parts[i]->setTimbre(&mt32ram.timbres[parts[i]->getAbsTimbreNum()].timbre);
- }
- }
- parts[i]->refresh();
- }
- }
- break;
- case MR_RhythmTemp:
- for (unsigned int m = 0; m < len; m++)
- ((Bit8u *)&mt32ram.rhythmSettings[first])[off + m] = data[m];
- for (unsigned int i = first; i <= last; i++) {
- int timbreNum = mt32ram.rhythmSettings[i].timbre;
- char timbreName[11];
- if (timbreNum < 94) {
- memcpy(timbreName, mt32ram.timbres[128 + timbreNum].timbre.common.name, 10);
- timbreName[10] = 0;
- } else {
- strcpy(timbreName, "[None]");
- }
- printDebug("WRITE-RHYTHM (%d-%d@%d..%d): %d; level=%02x, panpot=%02x, reverb=%02x, timbre=%d (%s)", first, last, off, off + len, i, mt32ram.rhythmSettings[i].outlevel, mt32ram.rhythmSettings[i].panpot, mt32ram.rhythmSettings[i].reverbSwitch, mt32ram.rhythmSettings[i].timbre, timbreName);
- }
- if (parts[8] != NULL) {
- parts[8]->refresh();
- }
- break;
- case MR_TimbreTemp:
- for (unsigned int m = 0; m < len; m++)
- ((Bit8u *)&mt32ram.timbreSettings[first])[off + m] = data[m];
- for (unsigned int i = first; i <= last; i++) {
- char instrumentName[11];
- memcpy(instrumentName, mt32ram.timbreSettings[i].common.name, 10);
- instrumentName[10] = 0;
- printDebug("WRITE-PARTTIMBRE (%d-%d@%d..%d): timbre=%d (%s)", first, last, off, off + len, i, instrumentName);
- if (parts[i] != NULL) {
- parts[i]->refresh();
- }
- }
- break;
- case MR_Patches:
- for (unsigned int m = 0; m < len; m++)
- ((Bit8u *)&mt32ram.patches[first])[off + m] = data[m];
- for (unsigned int i = first; i <= last; i++) {
- PatchParam *patch = &mt32ram.patches[i];
- int patchAbsTimbreNum = patch->timbreGroup * 64 + patch->timbreNum;
- char instrumentName[11];
- memcpy(instrumentName, mt32ram.timbres[patchAbsTimbreNum].timbre.common.name, 10);
- instrumentName[10] = 0;
- Bit8u *n = (Bit8u *)patch;
- printDebug("WRITE-PATCH (%d-%d@%d..%d): %d; timbre=%d (%s) %02X%02X%02X%02X%02X%02X%02X%02X", first, last, off, off + len, i, patchAbsTimbreNum, instrumentName, n[0], n[1], n[2], n[3], n[4], n[5], n[6], n[7]);
- // FIXME:KG: The below is definitely dodgy. We just guess that this is the patch that the part was using
- // based on a timbre match (but many patches could have the same timbre!)
- // If this refresh is really correct, we should store the patch number in use by each part.
- /*
- for (int part = 0; part < 8; part++) {
- if (parts[part] != NULL) {
- int partPatchAbsTimbreNum = mt32ram.patchSettings[part].patch.timbreGroup * 64 + mt32ram.patchSettings[part].patch.timbreNum;
- if (parts[part]->getAbsTimbreNum() == patchAbsTimbreNum) {
- parts[part]->setPatch(patch);
- parts[part]->RefreshPatch();
- }
- }
- }
- */
- }
- break;
- case MR_Timbres:
- // Timbres
- first += 128;
- last += 128;
- for (unsigned int m = 0; m < len; m++)
- ((Bit8u *)&mt32ram.timbres[first])[off + m] = data[m];
- for (unsigned int i = first; i <= last; i++) {
- char instrumentName[11];
- memcpy(instrumentName, mt32ram.timbres[i].timbre.common.name, 10);
- instrumentName[10] = 0;
- printDebug("WRITE-TIMBRE (%d-%d@%d..%d): %d; name=\"%s\"", first, last, off, off + len, i, instrumentName);
- // FIXME:KG: Not sure if the stuff below should be done (for rhythm and/or parts)...
- // Does the real MT-32 automatically do this?
- for (unsigned int part = 0; part < 9; part++) {
- if (parts[part] != NULL) {
- parts[part]->refreshTimbre(i);
- }
- }
- }
- break;
- case MR_System:
- for (unsigned int m = 0; m < len; m++)
- ((Bit8u *)&mt32ram.system)[m + off] = data[m];
-
- report(ReportType_devReconfig, NULL);
-
- printDebug("WRITE-SYSTEM:");
- refreshSystem();
- break;
- case MR_Display:
- char buf[MAX_SYSEX_SIZE];
- memcpy(&buf, &data[0], len);
- buf[len] = 0;
- printDebug("WRITE-LCD: %s", buf);
- report(ReportType_lcdMessage, buf);
- break;
- case MR_Reset:
- printDebug("RESET");
- report(ReportType_devReset, NULL);
- partialManager->deactivateAll();
- mt32ram = mt32default;
- for (int i = 0; i < 9; i++) {
- parts[i]->refresh();
- }
- isEnabled = false;
- break;
- }
-}
-
-bool Synth::refreshSystem() {
- memset(chantable, -1, sizeof(chantable));
-
- for (unsigned int i = 0; i < 9; i++) {
- //LOG(LOG_MISC|LOG_ERROR,"Part %d set to MIDI channel %d",i,mt32ram.system.chanAssign[i]);
- if (mt32ram.system.chanAssign[i] == 16 && parts[i] != NULL) {
- parts[i]->allSoundOff();
- } else {
- chantable[(int)mt32ram.system.chanAssign[i]] = (char)i;
- }
- }
- //FIXME:KG: This is just an educated guess.
- // The LAPC-I documentation claims a range of 427.5Hz-452.6Hz (similar to what we have here)
- // The MT-32 documentation claims a range of 432.1Hz-457.6Hz
- masterTune = 440.0f * powf(2.0f, (mt32ram.system.masterTune - 64.0f) / (128.0f * 12.0f));
- printDebug(" Master Tune: %f", (double)masterTune);
- printDebug(" Reverb: mode=%d, time=%d, level=%d", mt32ram.system.reverbMode, mt32ram.system.reverbTime, mt32ram.system.reverbLevel);
- report(ReportType_newReverbMode, &mt32ram.system.reverbMode);
- report(ReportType_newReverbTime, &mt32ram.system.reverbTime);
- report(ReportType_newReverbLevel, &mt32ram.system.reverbLevel);
-
- if (myProp.useDefaultReverb) {
- initReverb(mt32ram.system.reverbMode, mt32ram.system.reverbTime, mt32ram.system.reverbLevel);
- } else {
- initReverb(myProp.reverbType, myProp.reverbTime, mt32ram.system.reverbLevel);
- }
-
- Bit8u *rset = mt32ram.system.reserveSettings;
- printDebug(" Partial reserve: 1=%02d 2=%02d 3=%02d 4=%02d 5=%02d 6=%02d 7=%02d 8=%02d Rhythm=%02d", rset[0], rset[1], rset[2], rset[3], rset[4], rset[5], rset[6], rset[7], rset[8]);
- int pr = partialManager->setReserve(rset);
- if (pr != 32)
- printDebug(" (Partial Reserve Table with less than 32 partials reserved!)");
- rset = mt32ram.system.chanAssign;
- printDebug(" Part assign: 1=%02d 2=%02d 3=%02d 4=%02d 5=%02d 6=%02d 7=%02d 8=%02d Rhythm=%02d", rset[0], rset[1], rset[2], rset[3], rset[4], rset[5], rset[6], rset[7], rset[8]);
- printDebug(" Master volume: %d", mt32ram.system.masterVol);
- masterVolume = (Bit16u)(mt32ram.system.masterVol * 32767 / 100);
- if (!tables.init(this, pcmWaves, (float)myProp.sampleRate, masterTune)) {
- report(ReportType_errorSampleRate, NULL);
- return false;
- }
- return true;
-}
-
-bool Synth::dumpTimbre(File *file, const TimbreParam *timbre, Bit32u address) {
- // Sysex header
- if (!file->writeBit8u(0xF0))
- return false;
- if (!file->writeBit8u(0x41))
- return false;
- if (!file->writeBit8u(0x10))
- return false;
- if (!file->writeBit8u(0x16))
- return false;
- if (!file->writeBit8u(0x12))
- return false;
-
- char lsb = (char)(address & 0x7f);
- char isb = (char)((address >> 7) & 0x7f);
- char msb = (char)(((address >> 14) & 0x7f) | 0x08);
-
- //Address
- if (!file->writeBit8u(msb))
- return false;
- if (!file->writeBit8u(isb))
- return false;
- if (!file->writeBit8u(lsb))
- return false;
-
- //Data
- if (file->write(timbre, 246) != 246)
- return false;
-
- //Checksum
- unsigned char checksum = calcSysexChecksum((const Bit8u *)timbre, 246, msb + isb + lsb);
- if (!file->writeBit8u(checksum))
- return false;
-
- //End of sysex
- if (!file->writeBit8u(0xF7))
- return false;
- return true;
-}
-
-int Synth::dumpTimbres(const char *filename, int start, int len) {
- File *file = openFile(filename, File::OpenMode_write);
- if (file == NULL)
- return -1;
-
- for (int timbreNum = start; timbreNum < start + len; timbreNum++) {
- int useaddr = (timbreNum - start) * 256;
- TimbreParam *timbre = &mt32ram.timbres[timbreNum].timbre;
- if (!dumpTimbre(file, timbre, useaddr))
- break;
- }
- closeFile(file);
- return 0;
-}
-
-void ProduceOutput1(Bit16s *useBuf, Bit16s *stream, Bit32u len, Bit16s volume) {
-#if MT32EMU_USE_MMX > 2
- //FIXME:KG: This appears to introduce crackle
- int donelen = i386_produceOutput1(useBuf, stream, len, volume);
- len -= donelen;
- stream += donelen * 2;
- useBuf += donelen * 2;
-#endif
- int end = len * 2;
- while (end--) {
- *stream = *stream + (Bit16s)(((Bit32s)*useBuf++ * (Bit32s)volume)>>15);
- stream++;
- }
-}
-
-void Synth::render(Bit16s *stream, Bit32u len) {
- memset(stream, 0, len * sizeof (Bit16s) * 2);
- if (!isEnabled)
- return;
- while (len > 0) {
- Bit32u thisLen = len > MAX_SAMPLE_OUTPUT ? MAX_SAMPLE_OUTPUT : len;
- doRender(stream, thisLen);
- len -= thisLen;
- stream += 2 * thisLen;
- }
-}
-
-void Synth::doRender(Bit16s *stream, Bit32u len) {
- partialManager->ageAll();
-
- if (myProp.useReverb) {
- for (unsigned int i = 0; i < MT32EMU_MAX_PARTIALS; i++) {
- if (partialManager->shouldReverb(i)) {
- if (partialManager->produceOutput(i, &tmpBuffer[0], len)) {
- ProduceOutput1(&tmpBuffer[0], stream, len, masterVolume);
- }
- }
- }
- Bit32u m = 0;
- for (unsigned int i = 0; i < len; i++) {
- sndbufl[i] = (float)stream[m] / 32767.0f;
- m++;
- sndbufr[i] = (float)stream[m] / 32767.0f;
- m++;
- }
- reverbModel->processreplace(sndbufl, sndbufr, outbufl, outbufr, len, 1);
- m=0;
- for (unsigned int i = 0; i < len; i++) {
- stream[m] = (Bit16s)(outbufl[i] * 32767.0f);
- m++;
- stream[m] = (Bit16s)(outbufr[i] * 32767.0f);
- m++;
- }
- for (unsigned int i = 0; i < MT32EMU_MAX_PARTIALS; i++) {
- if (!partialManager->shouldReverb(i)) {
- if (partialManager->produceOutput(i, &tmpBuffer[0], len)) {
- ProduceOutput1(&tmpBuffer[0], stream, len, masterVolume);
- }
- }
- }
- } else {
- for (unsigned int i = 0; i < MT32EMU_MAX_PARTIALS; i++) {
- if (partialManager->produceOutput(i, &tmpBuffer[0], len))
- ProduceOutput1(&tmpBuffer[0], stream, len, masterVolume);
- }
- }
-
- partialManager->clearAlreadyOutputed();
-
-#if MT32EMU_MONITOR_PARTIALS == 1
- samplepos += len;
- if (samplepos > myProp.SampleRate * 5) {
- samplepos = 0;
- int partialUsage[9];
- partialManager->GetPerPartPartialUsage(partialUsage);
- printDebug("1:%02d 2:%02d 3:%02d 4:%02d 5:%02d 6:%02d 7:%02d 8:%02d", partialUsage[0], partialUsage[1], partialUsage[2], partialUsage[3], partialUsage[4], partialUsage[5], partialUsage[6], partialUsage[7]);
- printDebug("Rhythm: %02d TOTAL: %02d", partialUsage[8], MT32EMU_MAX_PARTIALS - partialManager->GetFreePartialCount());
- }
-#endif
-}
-
-const Partial *Synth::getPartial(unsigned int partialNum) const {
- return partialManager->getPartial(partialNum);
-}
-
-const Part *Synth::getPart(unsigned int partNum) const {
- if (partNum > 8)
- return NULL;
- return parts[partNum];
-}
-
-}
diff --git a/audio/softsynth/mt32/synth.h b/audio/softsynth/mt32/synth.h
deleted file mode 100644
index 0ef2c9d135..0000000000
--- a/audio/softsynth/mt32/synth.h
+++ /dev/null
@@ -1,299 +0,0 @@
-/* Copyright (c) 2003-2005 Various contributors
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- * IN THE SOFTWARE.
- */
-
-#ifndef MT32EMU_SYNTH_H
-#define MT32EMU_SYNTH_H
-
-#include "common/scummsys.h"
-
-class revmodel;
-
-namespace MT32Emu {
-
-class File;
-class Partial;
-class PartialManager;
-class Part;
-
-enum ReportType {
- // Errors
- ReportType_errorControlROM = 1,
- ReportType_errorPCMROM,
- ReportType_errorSampleRate,
-
- // Progress
- ReportType_progressInit,
-
- // HW spec
- ReportType_availableSSE,
- ReportType_available3DNow,
- ReportType_usingSSE,
- ReportType_using3DNow,
-
- // General info
- ReportType_lcdMessage,
- ReportType_devReset,
- ReportType_devReconfig,
- ReportType_newReverbMode,
- ReportType_newReverbTime,
- ReportType_newReverbLevel
-};
-
-struct SynthProperties {
- // Sample rate to use in mixing
- int sampleRate;
-
- // Flag to activate reverb. True = use reverb, False = no reverb
- bool useReverb;
- // True to use software set reverb settings, False to set reverb settings in
- // following parameters
- bool useDefaultReverb;
- // When not using the default settings, this specifies one of the 4 reverb types
- // 1 = Room 2 = Hall 3 = Plate 4 = Tap
- unsigned char reverbType;
- // This specifies the delay time, from 0-7 (not sure of the actual MT-32's measurement)
- unsigned char reverbTime;
- // This specifies the reverb level, from 0-7 (not sure of the actual MT-32's measurement)
- unsigned char reverbLevel;
- // The name of the directory in which the ROM and data files are stored (with trailing slash/backslash)
- // Not used if "openFile" is set. May be NULL in any case.
- char *baseDir;
- // This is used as the first argument to all callbacks
- void *userData;
- // Callback for reporting various errors and information. May be NULL
- int (*report)(void *userData, ReportType type, const void *reportData);
- // Callback for debug messages, in vprintf() format
- void (*printDebug)(void *userData, const char *fmt, va_list list);
- // Callback for providing an implementation of File, opened and ready for use
- // May be NULL, in which case a default implementation will be used.
- File *(*openFile)(void *userData, const char *filename, File::OpenMode mode);
- // Callback for closing a File. May be NULL, in which case the File will automatically be close()d/deleted.
- void (*closeFile)(void *userData, File *file);
-};
-
-// This is the specification of the Callback routine used when calling the RecalcWaveforms
-// function
-typedef void (*recalcStatusCallback)(int percDone);
-
-// This external function recreates the base waveform file (waveforms.raw) using a specifed
-// sampling rate. The callback routine provides interactivity to let the user know what
-// percentage is complete in regenerating the waveforms. When a NULL pointer is used as the
-// callback routine, no status is reported.
-bool RecalcWaveforms(char * baseDir, int sampRate, recalcStatusCallback callBack);
-
-typedef float (*iir_filter_type)(float input,float *hist1_ptr, float *coef_ptr);
-
-const Bit8u SYSEX_MANUFACTURER_ROLAND = 0x41;
-
-const Bit8u SYSEX_MDL_MT32 = 0x16;
-const Bit8u SYSEX_MDL_D50 = 0x14;
-
-const Bit8u SYSEX_CMD_RQ1 = 0x11; // Request data #1
-const Bit8u SYSEX_CMD_DT1 = 0x12; // Data set 1
-const Bit8u SYSEX_CMD_WSD = 0x40; // Want to send data
-const Bit8u SYSEX_CMD_RQD = 0x41; // Request data
-const Bit8u SYSEX_CMD_DAT = 0x42; // Data set
-const Bit8u SYSEX_CMD_ACK = 0x43; // Acknowledge
-const Bit8u SYSEX_CMD_EOD = 0x45; // End of data
-const Bit8u SYSEX_CMD_ERR = 0x4E; // Communications error
-const Bit8u SYSEX_CMD_RJC = 0x4F; // Rejection
-
-const unsigned int CONTROL_ROM_SIZE = 64 * 1024;
-
-struct ControlROMPCMStruct
-{
- Bit8u pos;
- Bit8u len;
- Bit8u pitchLSB;
- Bit8u pitchMSB;
-};
-
-struct ControlROMMap {
- Bit16u idPos;
- Bit16u idLen;
- const char *idBytes;
- Bit16u pcmTable;
- Bit16u pcmCount;
- Bit16u timbreAMap;
- Bit16u timbreAOffset;
- Bit16u timbreBMap;
- Bit16u timbreBOffset;
- Bit16u timbreRMap;
- Bit16u timbreRCount;
- Bit16u rhythmSettings;
- Bit16u rhythmSettingsCount;
- Bit16u reserveSettings;
- Bit16u panSettings;
- Bit16u programSettings;
-};
-
-enum MemoryRegionType {
- MR_PatchTemp, MR_RhythmTemp, MR_TimbreTemp, MR_Patches, MR_Timbres, MR_System, MR_Display, MR_Reset
-};
-
-class MemoryRegion {
-public:
- MemoryRegionType type;
- Bit32u startAddr, entrySize, entries;
-
- int lastTouched(Bit32u addr, Bit32u len) const {
- return (offset(addr) + len - 1) / entrySize;
- }
- int firstTouchedOffset(Bit32u addr) const {
- return offset(addr) % entrySize;
- }
- int firstTouched(Bit32u addr) const {
- return offset(addr) / entrySize;
- }
- Bit32u regionEnd() const {
- return startAddr + entrySize * entries;
- }
- bool contains(Bit32u addr) const {
- return addr >= startAddr && addr < regionEnd();
- }
- int offset(Bit32u addr) const {
- return addr - startAddr;
- }
- Bit32u getClampedLen(Bit32u addr, Bit32u len) const {
- if (addr + len > regionEnd())
- return regionEnd() - addr;
- return len;
- }
- Bit32u next(Bit32u addr, Bit32u len) const {
- if (addr + len > regionEnd()) {
- return regionEnd() - addr;
- }
- return 0;
- }
-};
-
-
-class Synth {
-friend class Part;
-friend class RhythmPart;
-friend class Partial;
-friend class Tables;
-private:
- bool isEnabled;
-
- iir_filter_type iirFilter;
-
- PCMWaveEntry *pcmWaves; // Array
-
- const ControlROMMap *controlROMMap;
- Bit8u controlROMData[CONTROL_ROM_SIZE];
- Bit16s *pcmROMData;
- int pcmROMSize; // This is in 16-bit samples, therefore half the number of bytes in the ROM
-
- Bit8s chantable[32];
-
- #if MT32EMU_MONITOR_PARTIALS == 1
- static Bit32s samplepos = 0;
- #endif
-
- Tables tables;
-
- MemParams mt32ram, mt32default;
-
- revmodel *reverbModel;
-
- float masterTune;
- Bit16u masterVolume;
-
- bool isOpen;
-
- PartialManager *partialManager;
- Part *parts[9];
-
- Bit16s tmpBuffer[MAX_SAMPLE_OUTPUT * 2];
- float sndbufl[MAX_SAMPLE_OUTPUT];
- float sndbufr[MAX_SAMPLE_OUTPUT];
- float outbufl[MAX_SAMPLE_OUTPUT];
- float outbufr[MAX_SAMPLE_OUTPUT];
-
- SynthProperties myProp;
-
- bool loadPreset(File *file);
- void initReverb(Bit8u newRevMode, Bit8u newRevTime, Bit8u newRevLevel);
- void doRender(Bit16s * stream, Bit32u len);
-
- void playAddressedSysex(unsigned char channel, const Bit8u *sysex, Bit32u len);
- void readSysex(unsigned char channel, const Bit8u *sysex, Bit32u len);
- void writeMemoryRegion(const MemoryRegion *region, Bit32u addr, Bit32u len, const Bit8u *data);
- void readMemoryRegion(const MemoryRegion *region, Bit32u addr, Bit32u len, Bit8u *data);
-
- bool loadControlROM(const char *filename);
- bool loadPCMROM(const char *filename);
- bool dumpTimbre(File *file, const TimbreParam *timbre, Bit32u addr);
- int dumpTimbres(const char *filename, int start, int len);
-
- bool initPCMList(Bit16u mapAddress, Bit16u count);
- bool initRhythmTimbres(Bit16u mapAddress, Bit16u count);
- bool initTimbres(Bit16u mapAddress, Bit16u offset, int startTimbre);
- bool initRhythmTimbre(int drumNum, const Bit8u *mem, unsigned int memLen);
- bool refreshSystem();
-
-protected:
- int report(ReportType type, const void *reportData);
- File *openFile(const char *filename, File::OpenMode mode);
- void closeFile(File *file);
- void printDebug(const char *fmt, ...) GCC_PRINTF(2, 3);
-
-public:
- static Bit8u calcSysexChecksum(const Bit8u *data, Bit32u len, Bit8u checksum);
-
- Synth();
- ~Synth();
-
- // Used to initialize the MT-32. Must be called before any other function.
- // Returns true if initialization was sucessful, otherwise returns false.
- bool open(SynthProperties &useProp);
-
- // Closes the MT-32 and deallocates any memory used by the synthesizer
- void close(void);
-
- // Sends a 4-byte MIDI message to the MT-32 for immediate playback
- void playMsg(Bit32u msg);
- void playMsgOnPart(unsigned char part, unsigned char code, unsigned char note, unsigned char velocity);
-
- // Sends a string of Sysex commands to the MT-32 for immediate interpretation
- // The length is in bytes
- void playSysex(const Bit8u *sysex, Bit32u len);
- void playSysexWithoutFraming(const Bit8u *sysex, Bit32u len);
- void playSysexWithoutHeader(unsigned char device, unsigned char command, const Bit8u *sysex, Bit32u len);
- void writeSysex(unsigned char channel, const Bit8u *sysex, Bit32u len);
-
- // This callback routine is used to have the MT-32 generate samples to the specified
- // output stream. The length is in whole samples, not bytes. (I.E. in 16-bit stereo,
- // one sample is 4 bytes)
- void render(Bit16s * stream, Bit32u len);
-
- const Partial *getPartial(unsigned int partialNum) const;
-
- void readMemory(Bit32u addr, Bit32u len, Bit8u *data);
-
- // partNum should be 0..7 for Part 1..8, or 8 for Rhythm
- const Part *getPart(unsigned int partNum) const;
-};
-
-}
-
-#endif
diff --git a/audio/softsynth/mt32/tables.cpp b/audio/softsynth/mt32/tables.cpp
deleted file mode 100644
index 9fdb595467..0000000000
--- a/audio/softsynth/mt32/tables.cpp
+++ /dev/null
@@ -1,761 +0,0 @@
-/* Copyright (c) 2003-2005 Various contributors
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- * IN THE SOFTWARE.
- */
-
-
-// FIXME: Avoid using rand
-#define FORBIDDEN_SYMBOL_EXCEPTION_rand
-
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-
-#include "mt32emu.h"
-
-#if defined(MACOSX) || defined(SOLARIS) || defined(__MINGW32__)
-// Older versions of Mac OS X didn't supply a powf function, so using it
-// will cause a binary incompatibility when trying to run a binary built
-// on a newer OS X release on an older one. And Solaris 8 doesn't provide
-// powf, floorf, fabsf etc. at all.
-// Cross-compiled MinGW32 toolchains suffer from a cross-compile bug in
-// libstdc++. math/stubs.o should be empty, but it comes with a symbol for
-// powf, resulting in a linker error because of multiple definitions.
-// Hence we re-define them here. The only potential drawback is that it
-// might be a little bit slower this way.
-#define powf(x,y) ((float)pow(x,y))
-#define floorf(x) ((float)floor(x))
-#define fabsf(x) ((float)fabs(x))
-#endif
-
-#define FIXEDPOINT_MAKE(x, point) ((Bit32u)((1 << point) * x))
-
-namespace MT32Emu {
-
-//Amplitude time velocity follow exponential coefficients
-static const double tvcatconst[5] = {0.0, 0.002791309, 0.005942882, 0.012652792, 0.026938637};
-static const double tvcatmult[5] = {1.0, 1.072662811, 1.169129367, 1.288579123, 1.229630539};
-
-// These are division constants for the TVF depth key follow
-static const Bit32u depexp[5] = {3000, 950, 485, 255, 138};
-
-//Envelope time keyfollow exponential coefficients
-static const double tkcatconst[5] = {0.0, 0.005853144, 0.011148054, 0.019086143, 0.043333215};
-static const double tkcatmult[5] = {1.0, 1.058245688, 1.048488989, 1.016049301, 1.097538067};
-
-// Begin filter stuff
-
-// Pre-warp the coefficients of a numerator or denominator.
-// Note that a0 is assumed to be 1, so there is no wrapping
-// of it.
-static void prewarp(double *a1, double *a2, double fc, double fs) {
- double wp;
-
- wp = 2.0 * fs * tan(DOUBLE_PI * fc / fs);
-
- *a2 = *a2 / (wp * wp);
- *a1 = *a1 / wp;
-}
-
-// Transform the numerator and denominator coefficients
-// of s-domain biquad section into corresponding
-// z-domain coefficients.
-//
-// Store the 4 IIR coefficients in array pointed by coef
-// in following order:
-// beta1, beta2 (denominator)
-// alpha1, alpha2 (numerator)
-//
-// Arguments:
-// a0-a2 - s-domain numerator coefficients
-// b0-b2 - s-domain denominator coefficients
-// k - filter gain factor. initially set to 1
-// and modified by each biquad section in such
-// a way, as to make it the coefficient by
-// which to multiply the overall filter gain
-// in order to achieve a desired overall filter gain,
-// specified in initial value of k.
-// fs - sampling rate (Hz)
-// coef - array of z-domain coefficients to be filled in.
-//
-// Return:
-// On return, set coef z-domain coefficients
-static void bilinear(double a0, double a1, double a2, double b0, double b1, double b2, double *k, double fs, float *coef) {
- double ad, bd;
-
- // alpha (Numerator in s-domain)
- ad = 4. * a2 * fs * fs + 2. * a1 * fs + a0;
- // beta (Denominator in s-domain)
- bd = 4. * b2 * fs * fs + 2. * b1* fs + b0;
-
- // update gain constant for this section
- *k *= ad/bd;
-
- // Denominator
- *coef++ = (float)((2. * b0 - 8. * b2 * fs * fs) / bd); // beta1
- *coef++ = (float)((4. * b2 * fs * fs - 2. * b1 * fs + b0) / bd); // beta2
-
- // Nominator
- *coef++ = (float)((2. * a0 - 8. * a2 * fs * fs) / ad); // alpha1
- *coef = (float)((4. * a2 * fs * fs - 2. * a1 * fs + a0) / ad); // alpha2
-}
-
-// a0-a2: numerator coefficients
-// b0-b2: denominator coefficients
-// fc: Filter cutoff frequency
-// fs: sampling rate
-// k: overall gain factor
-// coef: pointer to 4 iir coefficients
-static void szxform(double *a0, double *a1, double *a2, double *b0, double *b1, double *b2, double fc, double fs, double *k, float *coef) {
- // Calculate a1 and a2 and overwrite the original values
- prewarp(a1, a2, fc, fs);
- prewarp(b1, b2, fc, fs);
- bilinear(*a0, *a1, *a2, *b0, *b1, *b2, k, fs, coef);
-}
-
-static void initFilter(float fs, float fc, float *icoeff, float Q) {
- float *coef;
- double a0, a1, a2, b0, b1, b2;
-
- double k = 1.5; // Set overall filter gain factor
- coef = icoeff + 1; // Skip k, or gain
-
- // Section 1
- a0 = 1.0;
- a1 = 0;
- a2 = 0;
- b0 = 1.0;
- b1 = 0.765367 / Q; // Divide by resonance or Q
- b2 = 1.0;
- szxform(&a0, &a1, &a2, &b0, &b1, &b2, fc, fs, &k, coef);
- coef += 4; // Point to next filter section
-
- // Section 2
- a0 = 1.0;
- a1 = 0;
- a2 = 0;
- b0 = 1.0;
- b1 = 1.847759 / Q;
- b2 = 1.0;
- szxform(&a0, &a1, &a2, &b0, &b1, &b2, fc, fs, &k, coef);
-
- icoeff[0] = (float)k;
-}
-
-void Tables::initFiltCoeff(float samplerate) {
- for (int j = 0; j < FILTERGRAN; j++) {
- for (int res = 0; res < 31; res++) {
- float tres = resonanceFactor[res];
- initFilter((float)samplerate, (((float)(j+1.0)/FILTERGRAN)) * ((float)samplerate/2), filtCoeff[j][res], tres);
- }
- }
-}
-
-void Tables::initEnvelopes(float samplerate) {
- for (int lf = 0; lf <= 100; lf++) {
- float elf = (float)lf;
-
- // General envelope
- // This formula fits observation of the CM-32L by +/- 0.03s or so for the second time value in the filter,
- // when all other times were 0 and all levels were 100. Note that variations occur depending on the level
- // delta of the section, which we're not fully emulating.
- float seconds = powf(2.0f, (elf / 8.0f) + 7.0f) / 32768.0f;
- int samples = (int)(seconds * samplerate);
- envTime[lf] = samples;
-
- // Cap on envelope times depending on the level delta
- if (elf == 0) {
- envDeltaMaxTime[lf] = 63;
- } else {
- float cap = 11.0f * (float)log(elf) + 64;
- if (cap > 100.0f) {
- cap = 100.0f;
- }
- envDeltaMaxTime[lf] = (int)cap;
- }
-
-
- // This (approximately) represents the time durations when the target level is 0.
- // Not sure why this is a special case, but it's seen to be from the real thing.
- seconds = powf(2, (elf / 8.0f) + 6) / 32768.0f;
- envDecayTime[lf] = (int)(seconds * samplerate);
-
- // I am certain of this: Verified by hand LFO log
- lfoPeriod[lf] = (Bit32u)(((float)samplerate) / (powf(1.088883372f, (float)lf) * 0.021236044f));
- }
-}
-
-void Tables::initMT32ConstantTables(Synth *synth) {
- int lf;
- synth->printDebug("Initializing Pitch Tables");
- for (lf = -108; lf <= 108; lf++) {
- tvfKeyfollowMult[lf + 108] = (int)(256 * powf(2.0f, (float)(lf / 24.0f)));
- //synth->printDebug("KT %d = %d", f, keytable[f+108]);
- }
-
- for (int res = 0; res < 31; res++) {
- resonanceFactor[res] = powf((float)res / 30.0f, 5.0f) + 1.0f;
- }
-
- int period = 65536;
-
- for (int ang = 0; ang < period; ang++) {
- int halfang = (period / 2);
- int angval = ang % halfang;
- float tval = (((float)angval / (float)halfang) - 0.5f) * 2;
- if (ang >= halfang)
- tval = -tval;
- sintable[ang] = (Bit16s)(tval * 50.0f) + 50;
- }
-
- int velt, dep;
- float tempdep;
- for (velt = 0; velt < 128; velt++) {
- for (dep = 0; dep < 5; dep++) {
- if (dep > 0) {
- float ff = (float)(exp(3.5f * tvcatconst[dep] * (59.0f - (float)velt)) * tvcatmult[dep]);
- tempdep = 256.0f * ff;
- envTimeVelfollowMult[dep][velt] = (int)tempdep;
- //if ((velt % 16) == 0) {
- // synth->printDebug("Key %d, depth %d, factor %d", velt, dep, (int)tempdep);
- //}
- } else
- envTimeVelfollowMult[dep][velt] = 256;
- }
-
- for (dep = -7; dep < 8; dep++) {
- float fldep = (float)abs(dep) / 7.0f;
- fldep = powf(fldep,2.5f);
- if (dep < 0)
- fldep = fldep * -1.0f;
- pwVelfollowAdd[dep+7][velt] = Bit32s((fldep * (float)velt * 100) / 128.0);
- }
- }
-
- for (dep = 0; dep <= 100; dep++) {
- for (velt = 0; velt < 128; velt++) {
- float fdep = (float)dep * 0.000347013f; // Another MT-32 constant
- float fv = ((float)velt - 64.0f)/7.26f;
- float flogdep = powf(10, fdep * fv);
- float fbase;
-
- if (velt > 64)
- synth->tables.tvfVelfollowMult[velt][dep] = (int)(flogdep * 256.0);
- else {
- //lff = 1 - (pow(((128.0 - (float)lf) / 64.0),.25) * ((float)velt / 96));
- fbase = 1 - (powf(((float)dep / 100.0f),.25f) * ((float)(64-velt) / 96.0f));
- synth->tables.tvfVelfollowMult[velt][dep] = (int)(fbase * 256.0);
- }
- //synth->printDebug("Filvel dep %d velt %d = %x", dep, velt, filveltable[velt][dep]);
- }
- }
-
- for (lf = 0; lf < 128; lf++) {
- float veloFract = lf / 127.0f;
- for (int velsens = 0; velsens <= 100; velsens++) {
- float sensFract = (velsens - 50) / 50.0f;
- if (velsens < 50) {
- tvaVelfollowMult[lf][velsens] = FIXEDPOINT_MAKE(1.0f / powf(2.0f, veloFract * -sensFract * 127.0f / 20.0f), 8);
- } else {
- tvaVelfollowMult[lf][velsens] = FIXEDPOINT_MAKE(1.0f / powf(2.0f, (1.0f - veloFract) * sensFract * 127.0f / 20.0f), 8);
- }
- }
- }
-
- for (lf = 0; lf <= 100; lf++) {
- // Converts the 0-100 range used by the MT-32 to volume multiplier
- volumeMult[lf] = FIXEDPOINT_MAKE(powf((float)lf / 100.0f, FLOAT_LN), 7);
- }
-
- for (lf = 0; lf <= 100; lf++) {
- float mv = lf / 100.0f;
- float pt = mv - 0.5f;
- if (pt < 0)
- pt = 0;
-
- // Original (CC version)
- //pwFactor[lf] = (int)(pt * 210.04f) + 128;
-
- // Approximation from sample comparison
- pwFactor[lf] = (int)(pt * 179.0f) + 128;
- }
-
- for (unsigned int i = 0; i < MAX_SAMPLE_OUTPUT; i++) {
- int myRand;
- myRand = rand();
- //myRand = ((myRand - 16383) * 7168) >> 16;
- // This one is slower but works with all values of RAND_MAX
- myRand = (int)((myRand - RAND_MAX / 2) / (float)RAND_MAX * (7168 / 2));
- //FIXME:KG: Original ultimately set the lowest two bits to 0, for no obvious reason
- noiseBuf[i] = (Bit16s)myRand;
- }
-
- float tdist;
- float padjtable[51];
- for (lf = 0; lf <= 50; lf++) {
- if (lf == 0)
- padjtable[lf] = 7;
- else if (lf == 1)
- padjtable[lf] = 6;
- else if (lf == 2)
- padjtable[lf] = 5;
- else if (lf == 3)
- padjtable[lf] = 4;
- else if (lf == 4)
- padjtable[lf] = 4 - (0.333333f);
- else if (lf == 5)
- padjtable[lf] = 4 - (0.333333f * 2);
- else if (lf == 6)
- padjtable[lf] = 3;
- else if ((lf > 6) && (lf <= 12)) {
- tdist = (lf-6.0f) / 6.0f;
- padjtable[lf] = 3.0f - tdist;
- } else if ((lf > 12) && (lf <= 25)) {
- tdist = (lf - 12.0f) / 13.0f;
- padjtable[lf] = 2.0f - tdist;
- } else {
- tdist = (lf - 25.0f) / 25.0f;
- padjtable[lf] = 1.0f - tdist;
- }
- //synth->printDebug("lf %d = padj %f", lf, (double)padjtable[lf]);
- }
-
- float lfp, depf, finalval, tlf;
- int depat, pval, depti;
- for (lf = 0; lf <= 10; lf++) {
- // I believe the depth is cubed or something
-
- for (depat = 0; depat <= 100; depat++) {
- if (lf > 0) {
- depti = abs(depat - 50);
- tlf = (float)lf - padjtable[depti];
- if (tlf < 0)
- tlf = 0;
- lfp = (float)exp(0.713619942f * tlf) / 407.4945111f;
-
- if (depat < 50)
- finalval = 4096.0f * powf(2, -lfp);
- else
- finalval = 4096.0f * powf(2, lfp);
- pval = (int)finalval;
-
- pitchEnvVal[lf][depat] = pval;
- //synth->printDebug("lf %d depat %d pval %d tlf %f lfp %f", lf,depat,pval, (double)tlf, (double)lfp);
- } else {
- pitchEnvVal[lf][depat] = 4096;
- //synth->printDebug("lf %d depat %d pval 4096", lf, depat);
- }
- }
- }
- for (lf = 0; lf <= 100; lf++) {
- // It's linear - verified on MT-32 - one of the few things linear
- lfp = ((float)lf * 0.1904f) / 310.55f;
-
- for (depat = 0; depat <= 100; depat++) {
- depf = ((float)depat - 50.0f) / 50.0f;
- //finalval = pow(2, lfp * depf * .5);
- finalval = 4096.0f + (4096.0f * lfp * depf);
-
- pval = (int)finalval;
-
- lfoShift[lf][depat] = pval;
-
- //synth->printDebug("lf %d depat %d pval %x", lf,depat,pval);
- }
- }
-
- for (lf = 0; lf <= 12; lf++) {
- for (int distval = 0; distval < 128; distval++) {
- float amplog, dval;
- if (lf == 0) {
- amplog = 0;
- dval = 1;
- tvaBiasMult[lf][distval] = 256;
- } else {
- /*
- amplog = powf(1.431817011f, (float)lf) / FLOAT_PI;
- dval = ((128.0f - (float)distval) / 128.0f);
- amplog = exp(amplog);
- dval = powf(amplog, dval) / amplog;
- tvaBiasMult[lf][distval] = (int)(dval * 256.0);
- */
- // Lets assume for a second it's linear
-
- // Distance of full volume reduction
- amplog = (float)(12.0f / (float)lf) * 24.0f;
- if (distval > amplog) {
- tvaBiasMult[lf][distval] = 0;
- } else {
- dval = (amplog - (float)distval) / amplog;
- tvaBiasMult[lf][distval] = (int)(dval * 256.0f);
- }
- }
- //synth->printDebug("Ampbias lf %d distval %d = %f (%x) %f", lf, distval, (double)dval, tvaBiasMult[lf][distval],(double)amplog);
- }
- }
-
- for (lf = 0; lf <= 14; lf++) {
- for (int distval = 0; distval < 128; distval++) {
- float filval = fabsf((float)((lf - 7) * 12) / 7.0f);
- float amplog, dval;
- if (lf == 7) {
- amplog = 0;
- dval = 1;
- tvfBiasMult[lf][distval] = 256;
- } else {
- //amplog = pow(1.431817011, filval) / FLOAT_PI;
- amplog = powf(1.531817011f, filval) / FLOAT_PI;
- dval = (128.0f - (float)distval) / 128.0f;
- amplog = (float)exp(amplog);
- dval = powf(amplog,dval)/amplog;
- if (lf < 8) {
- tvfBiasMult[lf][distval] = (int)(dval * 256.0f);
- } else {
- dval = powf(dval, 0.3333333f);
- if (dval < 0.01f)
- dval = 0.01f;
- dval = 1 / dval;
- tvfBiasMult[lf][distval] = (int)(dval * 256.0f);
- }
- }
- //synth->printDebug("Fbias lf %d distval %d = %f (%x) %f", lf, distval, (double)dval, tvfBiasMult[lf][distval],(double)amplog);
- }
- }
-}
-
-// Per-note table initialisation follows
-
-static void initSaw(NoteLookup *noteLookup, Bit32s div2) {
- int tmpdiv = div2 << 16;
- for (int rsaw = 0; rsaw <= 100; rsaw++) {
- float fsaw;
- if (rsaw < 50)
- fsaw = 50.0f;
- else
- fsaw = (float)rsaw;
-
- //(66 - (((A8 - 50) / 50) ^ 0.63) * 50) / 132
- float sawfact = (66.0f - (powf((fsaw - 50.0f) / 50.0f, 0.63f) * 50.0f)) / 132.0f;
- noteLookup->sawTable[rsaw] = (int)(sawfact * (float)tmpdiv) >> 16;
- //synth->printDebug("F %d divtable %d saw %d sawtable %d", f, div, rsaw, sawtable[f][rsaw]);
- }
-}
-
-static void initDep(KeyLookup *keyLookup, float f) {
- for (int dep = 0; dep < 5; dep++) {
- if (dep == 0) {
- keyLookup->envDepthMult[dep] = 256;
- keyLookup->envTimeMult[dep] = 256;
- } else {
- float depfac = 3000.0f;
- float ff, tempdep;
- depfac = (float)depexp[dep];
-
- ff = (f - (float)MIDDLEC) / depfac;
- tempdep = powf(2, ff) * 256.0f;
- keyLookup->envDepthMult[dep] = (int)tempdep;
-
- ff = (float)(exp(tkcatconst[dep] * ((float)MIDDLEC - f)) * tkcatmult[dep]);
- keyLookup->envTimeMult[dep] = (int)(ff * 256.0f);
- }
- }
- //synth->printDebug("F %f d1 %x d2 %x d3 %x d4 %x d5 %x", (double)f, noteLookup->fildepTable[0], noteLookup->fildepTable[1], noteLookup->fildepTable[2], noteLookup->fildepTable[3], noteLookup->fildepTable[4]);
-}
-
-Bit16s Tables::clampWF(Synth *synth, const char *n, float ampVal, double input) {
- Bit32s x = (Bit32s)(input * ampVal);
- if (x < -ampVal - 1) {
- synth->printDebug("%s==%d<-WGAMP-1!", n, x);
- x = (Bit32s)(-ampVal - 1);
- } else if (x > ampVal) {
- synth->printDebug("%s==%d>WGAMP!", n, x);
- x = (Bit32s)ampVal;
- }
- return (Bit16s)x;
-}
-
-File *Tables::initWave(Synth *synth, NoteLookup *noteLookup, float ampVal, float div2, File *file) {
- int iDiv2 = (int)div2;
- noteLookup->waveformSize[0] = iDiv2 << 1;
- noteLookup->waveformSize[1] = iDiv2 << 1;
- noteLookup->waveformSize[2] = iDiv2 << 2;
- for (int i = 0; i < 3; i++) {
- if (noteLookup->waveforms[i] == NULL) {
- noteLookup->waveforms[i] = new Bit16s[noteLookup->waveformSize[i]];
- }
- }
- if (file != NULL) {
- for (int i = 0; i < 3 && file != NULL; i++) {
- size_t len = noteLookup->waveformSize[i];
- for (unsigned int j = 0; j < len; j++) {
- if (!file->readBit16u((Bit16u *)&noteLookup->waveforms[i][j])) {
- synth->printDebug("Error reading wave file cache!");
- file->close();
- file = NULL;
- break;
- }
- }
- }
- }
- if (file == NULL) {
- double sd = DOUBLE_PI / div2;
-
- for (int fa = 0; fa < (iDiv2 << 1); fa++) {
- // sa ranges from 0 to 2PI
- double sa = fa * sd;
-
- // Calculate a sample for the bandlimited sawtooth wave
- double saw = 0.0;
- int sincs = iDiv2 >> 1;
- double sinus = 1.0;
- for (int sincNum = 1; sincNum <= sincs; sincNum++) {
- saw += sin(sinus * sa) / sinus;
- sinus++;
- }
-
- // This works pretty well
- // Multiplied by 0.84 so that the spikes caused by bandlimiting don't overdrive the amplitude
- noteLookup->waveforms[0][fa] = clampWF(synth, "saw", ampVal, -saw / (0.5 * DOUBLE_PI) * 0.84);
- noteLookup->waveforms[1][fa] = clampWF(synth, "cos", ampVal, -cos(sa / 2.0));
- noteLookup->waveforms[2][fa * 2] = clampWF(synth, "cosoff_0", ampVal, -cos(sa - DOUBLE_PI));
- noteLookup->waveforms[2][fa * 2 + 1] = clampWF(synth, "cosoff_1", ampVal, -cos((sa + (sd / 2)) - DOUBLE_PI));
- }
- }
- return file;
-}
-
-static void initFiltTable(NoteLookup *noteLookup, float freq, float rate) {
- for (int tr = 0; tr <= 200; tr++) {
- float ftr = (float)tr;
-
- // Verified exact on MT-32
- if (tr > 100)
- ftr = 100.0f + (powf((ftr - 100.0f) / 100.0f, 3.0f) * 100.0f);
-
- // I think this is the one
- float brsq = powf(10.0f, (tr / 50.0f) - 1.0f);
- noteLookup->filtTable[0][tr] = (int)((freq * brsq) / (rate / 2) * FILTERGRAN);
- if (noteLookup->filtTable[0][tr]>=((FILTERGRAN*15)/16))
- noteLookup->filtTable[0][tr] = ((FILTERGRAN*15)/16);
-
- float brsa = powf(10.0f, ((tr / 55.0f) - 1.0f)) / 2.0f;
- noteLookup->filtTable[1][tr] = (int)((freq * brsa) / (rate / 2) * FILTERGRAN);
- if (noteLookup->filtTable[1][tr]>=((FILTERGRAN*15)/16))
- noteLookup->filtTable[1][tr] = ((FILTERGRAN*15)/16);
- }
-}
-
-static void initNFiltTable(NoteLookup *noteLookup, float freq, float rate) {
- for (int cf = 0; cf <= 100; cf++) {
- float cfmult = (float)cf;
-
- for (int tf = 0;tf <= 100; tf++) {
- float tfadd = (float)tf;
-
- //float freqsum = exp((cfmult + tfadd) / 30.0f) / 4.0f;
- //float freqsum = 0.15f * exp(0.45f * ((cfmult + tfadd) / 10.0f));
-
- float freqsum = powf(2.0f, ((cfmult + tfadd) - 40.0f) / 16.0f);
-
- noteLookup->nfiltTable[cf][tf] = (int)((freq * freqsum) / (rate / 2) * FILTERGRAN);
- if (noteLookup->nfiltTable[cf][tf] >= ((FILTERGRAN * 15) / 16))
- noteLookup->nfiltTable[cf][tf] = ((FILTERGRAN * 15) / 16);
- }
- }
-}
-
-File *Tables::initNote(Synth *synth, NoteLookup *noteLookup, float note, float rate, float masterTune, PCMWaveEntry *pcmWaves, File *file) {
- float freq = (float)(masterTune * pow(2.0, ((double)note - MIDDLEA) / 12.0));
- float div2 = rate * 2.0f / freq;
- noteLookup->div2 = (int)div2;
-
- if (noteLookup->div2 == 0)
- noteLookup->div2 = 1;
-
- initSaw(noteLookup, noteLookup->div2);
-
- //synth->printDebug("Note %f; freq=%f, div=%f", (double)note, (double)freq, (double) rate / freq);
- file = initWave(synth, noteLookup, WGAMP, div2, file);
-
- // Create the pitch tables
- if (noteLookup->wavTable == NULL)
- noteLookup->wavTable = new Bit32u[synth->controlROMMap->pcmCount];
- double rateMult = 32000.0 / rate;
- double tuner = freq * 65536.0f;
- for (int pc = 0; pc < synth->controlROMMap->pcmCount; pc++) {
- noteLookup->wavTable[pc] = (int)(tuner / pcmWaves[pc].tune * rateMult);
- }
-
- initFiltTable(noteLookup, freq, rate);
- initNFiltTable(noteLookup, freq, rate);
- return file;
-}
-
-bool Tables::initNotes(Synth *synth, PCMWaveEntry *pcmWaves, float rate, float masterTune) {
- const char *NoteNames[12] = {
- "C ", "C#", "D ", "D#", "E ", "F ", "F#", "G ", "G#", "A ", "A#", "B "
- };
- char filename[64];
- int intRate = (int)rate;
- char version[4] = {0, 0, 0, 5};
- sprintf(filename, "waveformcache-%d-%.2f.raw", intRate, (double)masterTune);
-
- File *file = NULL;
- char header[20];
- memcpy(header, "MT32WAVE", 8);
- int pos = 8;
- // Version...
- for (int i = 0; i < 4; i++)
- header[pos++] = version[i];
- header[pos++] = (char)((intRate >> 24) & 0xFF);
- header[pos++] = (char)((intRate >> 16) & 0xFF);
- header[pos++] = (char)((intRate >> 8) & 0xFF);
- header[pos++] = (char)(intRate & 0xFF);
- int intTuning = (int)masterTune;
- header[pos++] = (char)((intTuning >> 8) & 0xFF);
- header[pos++] = (char)(intTuning & 0xFF);
- header[pos++] = 0;
- header[pos] = (char)((masterTune - intTuning) * 10);
-#if MT32EMU_WAVECACHEMODE < 2
- bool reading = false;
- file = synth->openFile(filename, File::OpenMode_read);
- if (file != NULL) {
- char fileHeader[20];
- if (file->read(fileHeader, 20) == 20) {
- if (memcmp(fileHeader, header, 20) == 0) {
- Bit16u endianCheck;
- if (file->readBit16u(&endianCheck)) {
- if (endianCheck == 1) {
- reading = true;
- } else {
- synth->printDebug("Endian check in %s does not match expected", filename);
- }
- } else {
- synth->printDebug("Unable to read endian check in %s", filename);
- }
- } else {
- synth->printDebug("Header of %s does not match expected", filename);
- }
- } else {
- synth->printDebug("Error reading 16 bytes of %s", filename);
- }
- if (!reading) {
- file->close();
- file = NULL;
- }
- } else {
- synth->printDebug("Unable to open %s for reading", filename);
- }
-#endif
-
- float progress = 0.0f;
- bool abort = false;
- synth->report(ReportType_progressInit, &progress);
- for (int f = LOWEST_NOTE; f <= HIGHEST_NOTE; f++) {
- synth->printDebug("Initializing note %s%d", NoteNames[f % 12], (f / 12) - 2);
- NoteLookup *noteLookup = &noteLookups[f - LOWEST_NOTE];
- file = initNote(synth, noteLookup, (float)f, rate, masterTune, pcmWaves, file);
- progress = (f - LOWEST_NOTE + 1) / (float)NUM_NOTES;
- abort = synth->report(ReportType_progressInit, &progress) != 0;
- if (abort)
- break;
- }
-
-#if MT32EMU_WAVECACHEMODE == 0 || MT32EMU_WAVECACHEMODE == 2
- if (file == NULL) {
- file = synth->openFile(filename, File::OpenMode_write);
- if (file != NULL) {
- if (file->write(header, 20) == 20 && file->writeBit16u(1)) {
- for (int f = 0; f < NUM_NOTES; f++) {
- for (int i = 0; i < 3 && file != NULL; i++) {
- int len = noteLookups[f].waveformSize[i];
- for (int j = 0; j < len; j++) {
- if (!file->writeBit16u(noteLookups[f].waveforms[i][j])) {
- synth->printDebug("Error writing waveform cache file");
- file->close();
- file = NULL;
- break;
- }
- }
- }
- }
- } else {
- synth->printDebug("Error writing 16-byte header to %s - won't continue saving", filename);
- }
- } else {
- synth->printDebug("Unable to open %s for writing - won't be created", filename);
- }
- }
-#endif
-
- if (file != NULL)
- synth->closeFile(file);
- return !abort;
-}
-
-void Tables::freeNotes() {
- for (int t = 0; t < 3; t++) {
- for (int m = 0; m < NUM_NOTES; m++) {
- if (noteLookups[m].waveforms[t] != NULL) {
- delete[] noteLookups[m].waveforms[t];
- noteLookups[m].waveforms[t] = NULL;
- noteLookups[m].waveformSize[t] = 0;
- }
- if (noteLookups[m].wavTable != NULL) {
- delete[] noteLookups[m].wavTable;
- noteLookups[m].wavTable = NULL;
- }
- }
- }
- initializedMasterTune = 0.0f;
-}
-
-Tables::Tables() {
- initializedSampleRate = 0.0f;
- initializedMasterTune = 0.0f;
- memset(&noteLookups, 0, sizeof(noteLookups));
-}
-
-bool Tables::init(Synth *synth, PCMWaveEntry *pcmWaves, float sampleRate, float masterTune) {
- if (sampleRate <= 0.0f) {
- synth->printDebug("Bad sampleRate (%f <= 0.0f)", (double)sampleRate);
- return false;
- }
- if (initializedSampleRate == 0.0f) {
- initMT32ConstantTables(synth);
- }
- if (initializedSampleRate != sampleRate) {
- initFiltCoeff(sampleRate);
- initEnvelopes(sampleRate);
- for (int key = 12; key <= 108; key++) {
- initDep(&keyLookups[key - 12], (float)key);
- }
- }
- if (initializedSampleRate != sampleRate || initializedMasterTune != masterTune) {
- freeNotes();
- if (!initNotes(synth, pcmWaves, sampleRate, masterTune)) {
- return false;
- }
- initializedSampleRate = sampleRate;
- initializedMasterTune = masterTune;
- }
- return true;
-}
-
-}
diff --git a/audio/softsynth/mt32/tables.h b/audio/softsynth/mt32/tables.h
deleted file mode 100644
index 9950323e7b..0000000000
--- a/audio/softsynth/mt32/tables.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/* Copyright (c) 2003-2005 Various contributors
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- * IN THE SOFTWARE.
- */
-
-#ifndef MT32EMU_TABLES_H
-#define MT32EMU_TABLES_H
-
-namespace MT32Emu {
-
-// Mathematical constants
-const double DOUBLE_PI = 3.1415926535897932384626433832795;
-const double DOUBLE_LN = 2.3025850929940456840179914546844;
-const float FLOAT_PI = 3.1415926535897932384626433832795f;
-const float FLOAT_LN = 2.3025850929940456840179914546844f;
-
-// Filter settings
-const int FILTERGRAN = 512;
-
-// Amplitude of waveform generator
-// FIXME: This value is the amplitude possible whilst avoiding
-// overdriven values immediately after filtering when playing
-// back SQ3MT.MID. Needs to be checked.
-const int WGAMP = 12382;
-
-const int MIDDLEC = 60;
-const int MIDDLEA = 69; // By this I mean "A above middle C"
-
-// FIXME:KG: may only need to do 12 to 108
-// 12..108 is the range allowed by note on commands, but the key can be modified by pitch keyfollow
-// and adjustment for timbre pitch, so the results can be outside that range.
-// Should we move it (by octave) into the 12..108 range, or keep it in 0..127 range,
-// or something else altogether?
-const int LOWEST_NOTE = 12;
-const int HIGHEST_NOTE = 127;
-const int NUM_NOTES = HIGHEST_NOTE - LOWEST_NOTE + 1; // Number of slots for note LUT
-
-class Synth;
-
-struct NoteLookup {
- Bit32u div2;
- Bit32u *wavTable;
- Bit32s sawTable[101];
- int filtTable[2][201];
- int nfiltTable[101][101];
- Bit16s *waveforms[3];
- Bit32u waveformSize[3];
-};
-
-struct KeyLookup {
- Bit32s envTimeMult[5]; // For envelope time adjustment for key pressed
- Bit32s envDepthMult[5];
-};
-
-class Tables {
- float initializedSampleRate;
- float initializedMasterTune;
- void initMT32ConstantTables(Synth *synth);
- static Bit16s clampWF(Synth *synth, const char *n, float ampVal, double input);
- static File *initWave(Synth *synth, NoteLookup *noteLookup, float ampsize, float div2, File *file);
- bool initNotes(Synth *synth, PCMWaveEntry *pcmWaves, float rate, float tuning);
- void initEnvelopes(float sampleRate);
- void initFiltCoeff(float samplerate);
-public:
- // Constant LUTs
- Bit32s tvfKeyfollowMult[217];
- Bit32s tvfVelfollowMult[128][101];
- Bit32s tvfBiasMult[15][128];
- Bit32u tvaVelfollowMult[128][101];
- Bit32s tvaBiasMult[13][128];
- Bit16s noiseBuf[MAX_SAMPLE_OUTPUT];
- Bit16s sintable[65536];
- Bit32s pitchEnvVal[16][101];
- Bit32s envTimeVelfollowMult[5][128];
- Bit32s pwVelfollowAdd[15][128];
- float resonanceFactor[31];
- Bit32u lfoShift[101][101];
- Bit32s pwFactor[101];
- Bit32s volumeMult[101];
-
- // LUTs varying with sample rate
- Bit32u envTime[101];
- Bit32u envDeltaMaxTime[101];
- Bit32u envDecayTime[101];
- Bit32u lfoPeriod[101];
- float filtCoeff[FILTERGRAN][31][8];
-
- // Various LUTs for each note and key
- NoteLookup noteLookups[NUM_NOTES];
- KeyLookup keyLookups[97];
-
- Tables();
- bool init(Synth *synth, PCMWaveEntry *pcmWaves, float sampleRate, float masterTune);
- File *initNote(Synth *synth, NoteLookup *noteLookup, float note, float rate, float tuning, PCMWaveEntry *pcmWaves, File *file);
- void freeNotes();
-};
-
-}
-
-#endif
diff --git a/audio/softsynth/opl/dbopl.cpp b/audio/softsynth/opl/dbopl.cpp
index 02c2317b25..43eb40e7ba 100644
--- a/audio/softsynth/opl/dbopl.cpp
+++ b/audio/softsynth/opl/dbopl.cpp
@@ -1131,14 +1131,14 @@ void Chip::WriteBD( Bit8u val ) {
#define REGOP( _FUNC_ ) \
index = ( ( reg >> 3) & 0x20 ) | ( reg & 0x1f ); \
if ( OpOffsetTable[ index ] ) { \
- Operator* regOp = (Operator*)( ((char *)this ) + OpOffsetTable[ index ] ); \
+ Operator* regOp = (Operator *)( ((char *)this ) + OpOffsetTable[ index ] ); \
regOp->_FUNC_( this, val ); \
}
#define REGCHAN( _FUNC_ ) \
index = ( ( reg >> 4) & 0x10 ) | ( reg & 0xf ); \
if ( ChanOffsetTable[ index ] ) { \
- Channel* regChan = (Channel*)( ((char *)this ) + ChanOffsetTable[ index ] ); \
+ Channel* regChan = (Channel *)( ((char *)this ) + ChanOffsetTable[ index ] ); \
regChan->_FUNC_( this, val ); \
}
diff --git a/audio/softsynth/sid.h b/audio/softsynth/sid.h
index 19577e94d1..88da0eb326 100644
--- a/audio/softsynth/sid.h
+++ b/audio/softsynth/sid.h
@@ -55,7 +55,7 @@ class WaveformGenerator {
public:
WaveformGenerator();
- void set_sync_source(WaveformGenerator*);
+ void set_sync_source(WaveformGenerator *);
void updateClock(cycle_count delta_t);
void synchronize();
@@ -272,7 +272,7 @@ class Voice {
public:
Voice();
- void set_sync_source(Voice*);
+ void set_sync_source(Voice *);
void reset();
void writeCONTROL_REG(reg8);
diff --git a/backends/events/default/default-events.cpp b/backends/events/default/default-events.cpp
index 78072b0021..99d12c73dc 100644
--- a/backends/events/default/default-events.cpp
+++ b/backends/events/default/default-events.cpp
@@ -60,6 +60,8 @@ DefaultEventManager::DefaultEventManager(Common::EventSource *boss) :
// EventDispatcher will automatically free the keymapper
_dispatcher.registerMapper(_keymapper);
_remap = false;
+#else
+ _dispatcher.registerMapper(new Common::DefaultEventMapper());
#endif
}
@@ -100,67 +102,7 @@ bool DefaultEventManager::pollEvent(Common::Event &event) {
_currentKeyDown.flags = event.kbd.flags;
_keyRepeatTime = time + kKeyRepeatInitialDelay;
- // Global Main Menu
- if (event.kbd.hasFlags(Common::KBD_CTRL) && event.kbd.keycode == Common::KEYCODE_F5) {
- 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
- // instead. This way, we don't have to add special cases
- // to engines (like it was the case for LURE in the RTL branch).
- //
- // However, this has other consequences, possibly negative ones.
- // Like, what happens with key repeat for the trigger key?
-
- //pushEvent(menuEvent);
- event = menuEvent;
-
- // FIXME: Since now we do not push another MAINMENU event onto
- // our event stack, the GMM would never open, so we have to do
- // that here. Of course when the engine would handle MAINMENU
- // as an event now and open up the GMM itself it would open the
- // menu twice.
- if (g_engine && !g_engine->isPaused())
- g_engine->openMainMenuDialog();
-
- if (_shouldQuit)
- event.type = Common::EVENT_QUIT;
- else if (_shouldRTL)
- event.type = Common::EVENT_RTL;
- }
- }
-#ifdef ENABLE_VKEYBD
- else if (event.kbd.keycode == Common::KEYCODE_F7 && event.kbd.hasFlags(0)) {
- if (_vk->isDisplaying()) {
- _vk->close(true);
- } else {
- if (g_engine)
- g_engine->pauseEngine(true);
- _vk->show();
- if (g_engine)
- g_engine->pauseEngine(false);
- result = false;
- }
- }
-#endif
-#ifdef ENABLE_KEYMAPPER
- else if (event.kbd.keycode == Common::KEYCODE_F8 && event.kbd.hasFlags(0)) {
- if (!_remap) {
- _remap = true;
- Common::RemapDialog _remapDialog;
- if (g_engine)
- g_engine->pauseEngine(true);
- _remapDialog.runModal();
- if (g_engine)
- g_engine->pauseEngine(false);
- _remap = false;
- }
- }
-#endif
- else if (event.kbd.keycode == Common::KEYCODE_BACKSPACE) {
+ if (event.kbd.keycode == Common::KEYCODE_BACKSPACE) {
// WORKAROUND: Some engines incorrectly attempt to use the
// ascii value instead of the keycode to detect the backspace
// key (a non-portable behavior). This fails at least on
@@ -214,7 +156,34 @@ bool DefaultEventManager::pollEvent(Common::Event &event) {
else if (_shouldRTL)
event.type = Common::EVENT_RTL;
break;
-
+#ifdef ENABLE_VKEYBD
+ case Common::EVENT_VIRTUAL_KEYBOARD:
+ if (_vk->isDisplaying()) {
+ _vk->close(true);
+ } else {
+ if (g_engine)
+ g_engine->pauseEngine(true);
+ _vk->show();
+ if (g_engine)
+ g_engine->pauseEngine(false);
+ result = false;
+ }
+ break;
+#endif
+#ifdef ENABLE_KEYMAPPER
+ case Common::EVENT_KEYMAPPER_REMAP:
+ if (!_remap) {
+ _remap = true;
+ Common::RemapDialog _remapDialog;
+ if (g_engine)
+ g_engine->pauseEngine(true);
+ _remapDialog.runModal();
+ if (g_engine)
+ g_engine->pauseEngine(false);
+ _remap = false;
+ }
+ break;
+#endif
case Common::EVENT_RTL:
if (ConfMan.getBool("confirm_exit")) {
if (g_engine)
diff --git a/backends/events/default/default-events.h b/backends/events/default/default-events.h
index 3a8025f5e8..4d89b78861 100644
--- a/backends/events/default/default-events.h
+++ b/backends/events/default/default-events.h
@@ -92,6 +92,8 @@ public:
#endif
#ifdef ENABLE_KEYMAPPER
+ // IMPORTANT NOTE: This is part of the WIP Keymapper. If you plan to use
+ // this, please talk to tsoliman and/or LordHoto.
virtual Common::Keymapper *getKeymapper() { return _keymapper; }
#endif
};
diff --git a/backends/events/maemosdl/maemosdl-events.cpp b/backends/events/maemosdl/maemosdl-events.cpp
index 07af368064..0046d297eb 100644
--- a/backends/events/maemosdl/maemosdl-events.cpp
+++ b/backends/events/maemosdl/maemosdl-events.cpp
@@ -33,10 +33,25 @@ MaemoSdlEventSource::MaemoSdlEventSource() : SdlEventSource(), _clickEnabled(tru
}
+struct KeymapEntry {
+ SDLKey sym;
+ Common::KeyCode keycode;
+ uint16 ascii;
+};
+
+static const KeymapEntry keymapEntries[] = {
+ {SDLK_F4, Common::KEYCODE_F11, 0},
+ {SDLK_F5, Common::KEYCODE_F12, 0},
+ {SDLK_F6, Common::KEYCODE_F13, 0},
+ {SDLK_F7, Common::KEYCODE_F14, 0},
+ {SDLK_F8, Common::KEYCODE_F15, 0},
+ {SDLK_LAST, Common::KEYCODE_INVALID, 0}
+};
+
bool MaemoSdlEventSource::remapKey(SDL_Event &ev, Common::Event &event) {
Model model = Model(((OSystem_SDL_Maemo *)g_system)->getModel());
- debug(10, "Model: %s %u %s %s", model.hwId, model.modelType, model.hwAlias, model.hwKeyboard ? "true" : "false");
+ debug(10, "Model: %s %u %s %s", model.hwId, model.modelType, model.hwAlias, model.hasHwKeyboard ? "true" : "false");
// List of special N810 keys:
// SDLK_F4 -> menu
@@ -45,6 +60,20 @@ bool MaemoSdlEventSource::remapKey(SDL_Event &ev, Common::Event &event) {
// SDLK_F7 -> zoom +
// SDLK_F8 -> zoom -
+#ifdef ENABLE_KEYMAPPER
+ if (ev.type == SDL_KEYDOWN || ev.type == SDL_KEYUP) {
+ const KeymapEntry *entry;
+ for (entry = keymapEntries; entry->sym != SDLK_LAST; ++entry) {
+ if (ev.key.keysym.sym == entry->sym) {
+ SDLModToOSystemKeyFlags(SDL_GetModState(), event);
+ event.type = ev.type == SDL_KEYDOWN ? Common::EVENT_KEYDOWN : Common::EVENT_KEYUP;
+ event.kbd.keycode = entry->keycode;
+ event.kbd.ascii = entry->ascii;
+ return true;
+ }
+ }
+ }
+#else
switch (ev.type) {
case SDL_KEYDOWN:{
if (ev.key.keysym.sym == SDLK_F4
@@ -56,7 +85,7 @@ bool MaemoSdlEventSource::remapKey(SDL_Event &ev, Common::Event &event) {
debug(9, "remapping to main menu");
return true;
} else if (ev.key.keysym.sym == SDLK_F6) {
- if (!model.hwKeyboard) {
+ if (!model.hasHwKeyboard) {
event.type = Common::EVENT_KEYDOWN;
event.kbd.keycode = Common::KEYCODE_F7;
event.kbd.ascii = Common::ASCII_F7;
@@ -95,7 +124,7 @@ bool MaemoSdlEventSource::remapKey(SDL_Event &ev, Common::Event &event) {
event.type = Common::EVENT_MAINMENU;
return true;
} else if (ev.key.keysym.sym == SDLK_F6) {
- if (!model.hwKeyboard) {
+ if (!model.hasHwKeyboard) {
event.type = Common::EVENT_KEYUP;
event.kbd.keycode = Common::KEYCODE_F7;
event.kbd.ascii = Common::ASCII_F7;
@@ -124,9 +153,7 @@ bool MaemoSdlEventSource::remapKey(SDL_Event &ev, Common::Event &event) {
debug(9, "remapping to F7 up (virtual keyboard)");
return true;
} else {
- _clickEnabled = !_clickEnabled;
- ((SurfaceSdlGraphicsManager*) _graphicsManager)->displayMessageOnOSD(
- _clickEnabled ? _("Clicking Enabled") : _("Clicking Disabled"));
+ toggleClickMode();
debug(9, "remapping to click toggle");
return true;
}
@@ -134,6 +161,7 @@ bool MaemoSdlEventSource::remapKey(SDL_Event &ev, Common::Event &event) {
break;
}
}
+#endif
// Invoke parent implementation of this method
return SdlEventSource::remapKey(ev, event);
}
@@ -158,6 +186,32 @@ bool MaemoSdlEventSource::handleMouseButtonUp(SDL_Event &ev, Common::Event &even
return SdlEventSource::handleMouseButtonUp(ev, event);
}
+bool MaemoSdlEventSource::toggleClickMode() {
+ _clickEnabled = !_clickEnabled;
+ ((SurfaceSdlGraphicsManager *) _graphicsManager)->displayMessageOnOSD(
+ _clickEnabled ? _("Clicking Enabled") : _("Clicking Disabled"));
+
+ return _clickEnabled;
+}
+
+MaemoSdlEventObserver::MaemoSdlEventObserver(MaemoSdlEventSource *eventSource) {
+ assert(eventSource);
+ _eventSource = eventSource;
+}
+
+bool MaemoSdlEventObserver::notifyEvent(const Common::Event &event) {
+#ifdef ENABLE_KEYMAPPER
+ if (event.type != Common::EVENT_CUSTOM_BACKEND)
+ return false;
+ if (event.customType == kEventClickMode) {
+ assert(_eventSource);
+ _eventSource->toggleClickMode();
+ return true;
+ }
+#endif
+ return false;
+}
+
} // namespace Maemo
#endif // if defined(MAEMO)
diff --git a/backends/events/maemosdl/maemosdl-events.h b/backends/events/maemosdl/maemosdl-events.h
index 5c06c4bc22..f3f05feeca 100644
--- a/backends/events/maemosdl/maemosdl-events.h
+++ b/backends/events/maemosdl/maemosdl-events.h
@@ -37,6 +37,8 @@ namespace Maemo {
class MaemoSdlEventSource : public SdlEventSource {
public:
MaemoSdlEventSource();
+
+ bool toggleClickMode();
protected:
virtual bool remapKey(SDL_Event &ev, Common::Event &event);
virtual bool handleMouseButtonDown(SDL_Event &ev, Common::Event &event);
@@ -45,6 +47,15 @@ protected:
bool _clickEnabled;
};
+class MaemoSdlEventObserver : public Common::EventObserver {
+public:
+ MaemoSdlEventObserver(MaemoSdlEventSource *eventSource);
+
+ virtual bool notifyEvent(const Common::Event &event);
+private:
+ MaemoSdlEventSource *_eventSource;
+};
+
} // namespace Maemo
#endif // include guard
diff --git a/backends/events/webossdl/webossdl-events.cpp b/backends/events/webossdl/webossdl-events.cpp
index d01e51fafe..286289f7a6 100644
--- a/backends/events/webossdl/webossdl-events.cpp
+++ b/backends/events/webossdl/webossdl-events.cpp
@@ -151,8 +151,8 @@ bool WebOSSdlEventSource::handleMouseButtonDown(SDL_Event &ev,
event.type = Common::EVENT_LBUTTONDOWN;
processMouseEvent(event, _curX, _curY);
}
- // If we're not in touchpad mode, move the cursor to the tap
- if (!_touchpadMode) {
+ // If we're not in trackpad mode, move the cursor to the tap
+ if (!_trackpadMode) {
_curX = MIN(_screenX, MAX(0, 0 + ev.motion.x));
_curY = MIN(_screenY, MAX(0, 0 + ev.motion.y));
// If we're already clicking, hold it until after the move.
@@ -254,7 +254,7 @@ bool WebOSSdlEventSource::handleMouseMotion(SDL_Event &ev,
// If only one finger is on the screen and moving, that's
// the mouse pointer.
if (!_fingerDown[1] && !_fingerDown[2]) {
- if (_touchpadMode) {
+ if (_trackpadMode) {
_curX = MIN(_screenX, MAX(0, _curX + ev.motion.xrel));
_curY = MIN(_screenY, MAX(0, _curY + ev.motion.yrel));
} else {
@@ -301,16 +301,16 @@ bool WebOSSdlEventSource::handleMouseMotion(SDL_Event &ev,
_queuedEscapeUpTime = g_system->getMillis() +
QUEUED_KEY_DELAY;
} else if (_dragDiffX[0] > 0 && _dragDiffX[1] > 0) {
- // A swipe right toggles touchpad mode
- _touchpadMode = !_touchpadMode;
- g_system->showMouse(_touchpadMode);
- // I18N: Touchpad mode toggle status.
- Common::String dialogMsg(_("Touchpad mode is now"));
+ // A swipe right toggles trackpad mode
+ _trackpadMode = !_trackpadMode;
+ g_system->showMouse(_trackpadMode);
+ // I18N: Trackpad mode toggle status.
+ Common::String dialogMsg(_("Trackpad mode is now"));
dialogMsg += " ";
- // I18N: Touchpad mode on or off.
- dialogMsg += (_touchpadMode ? _("ON") : _("OFF"));
+ // I18N: Trackpad mode on or off.
+ dialogMsg += (_trackpadMode ? _("ON") : _("OFF"));
dialogMsg += ".\n";
- // I18N: Instructions to toggle Touchpad mode.
+ // I18N: Instructions to toggle Trackpad mode.
dialogMsg +=
_("Swipe two fingers to the right to toggle.");
GUI::TimedMessageDialog dialog(dialogMsg, 1500);
@@ -376,12 +376,12 @@ bool WebOSSdlEventSource::pollEvent(Common::Event &event) {
if (_firstPoll) {
// Set the initial dimensions
calculateDimensions();
-
- // Having a mouse pointer on screen when not in Touchpad mode is poor
+
+ // Having a mouse pointer on screen when not in Trackpad mode is poor
// interface design, because the user won't know whether to tap buttons
// or drag the pointer to them. On the first poll, set the appropriate
// pointer visibility.
- g_system->showMouse(_touchpadMode);
+ g_system->showMouse(_trackpadMode);
_firstPoll = false;
}
diff --git a/backends/events/webossdl/webossdl-events.h b/backends/events/webossdl/webossdl-events.h
index a36ee535a3..99ed3105f8 100644
--- a/backends/events/webossdl/webossdl-events.h
+++ b/backends/events/webossdl/webossdl-events.h
@@ -45,7 +45,7 @@ public:
_dragStartTime(0), _dragging(false),
_curX(0), _curY(0),
_screenX(0), _screenY(0),
- _touchpadMode(false), _autoDragMode(true),
+ _trackpadMode(false), _autoDragMode(true),
_doClick(true),
_queuedDragTime(0), _queuedEscapeUpTime(0), _queuedSpaceUpTime(0),
_queuedRUpTime(0),
@@ -80,8 +80,8 @@ protected:
// The drag distance for linear gestures
int _swipeDistX, _swipeDistY;
- // Indicates if we're in touchpad mode or tap-to-move mode.
- bool _touchpadMode;
+ // Indicates if we're in trackpad mode or tap-to-move mode.
+ bool _trackpadMode;
// Indicates if we're in automatic drag mode.
bool _autoDragMode;
diff --git a/backends/fs/symbian/symbian-fs.cpp b/backends/fs/symbian/symbian-fs.cpp
index 9f70e7a7c9..fc78f7580b 100644
--- a/backends/fs/symbian/symbian-fs.cpp
+++ b/backends/fs/symbian/symbian-fs.cpp
@@ -70,7 +70,7 @@ SymbianFilesystemNode::SymbianFilesystemNode(const Common::String &path) {
TPtrC8 ptr((const unsigned char*)_path.c_str(),_path.size());
fname.Copy(ptr);
- if (static_cast<OSystem_SDL_Symbian*>(g_system)->FsSession().Entry(fname, fileAttribs) == KErrNone) {
+ if (static_cast<OSystem_SDL_Symbian *>(g_system)->FsSession().Entry(fname, fileAttribs) == KErrNone) {
_isValid = true;
_isDirectory = fileAttribs.IsDir();
} else {
@@ -87,7 +87,7 @@ bool SymbianFilesystemNode::exists() const {
TFileName fname;
TPtrC8 ptr((const unsigned char*) _path.c_str(), _path.size());
fname.Copy(ptr);
- bool fileExists = BaflUtils::FileExists(static_cast<OSystem_SDL_Symbian*> (g_system)->FsSession(), fname);
+ bool fileExists = BaflUtils::FileExists(static_cast<OSystem_SDL_Symbian *> (g_system)->FsSession(), fname);
if (!fileExists) {
TParsePtrC parser(fname);
if (parser.PathPresent() && parser.Path().Compare(_L("\\")) == KErrNone && !parser.NameOrExtPresent()) {
@@ -125,7 +125,7 @@ bool SymbianFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, b
if (_isPseudoRoot) {
// Drives enumeration
- RFs& fs = static_cast<OSystem_SDL_Symbian*>(g_system)->FsSession();
+ RFs& fs = static_cast<OSystem_SDL_Symbian *>(g_system)->FsSession();
TInt driveNumber;
TChar driveLetter;
TUint driveLetterValue;
@@ -153,7 +153,7 @@ bool SymbianFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, b
sprintf(path,"%c:\\", driveNumber+'A');
SymbianFilesystemNode entry(false);
- entry._displayName = (char*) driveString8.PtrZ(); // drive_name
+ entry._displayName = (char *) driveString8.PtrZ(); // drive_name
entry._isDirectory = true;
entry._isValid = true;
entry._isPseudoRoot = false;
@@ -170,7 +170,7 @@ bool SymbianFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, b
if (_path.lastChar() != '\\')
fname.Append('\\');
- if (static_cast<OSystem_SDL_Symbian*>(g_system)->FsSession().GetDir(fname, KEntryAttNormal|KEntryAttDir, 0, dirPtr) == KErrNone) {
+ if (static_cast<OSystem_SDL_Symbian *>(g_system)->FsSession().GetDir(fname, KEntryAttNormal|KEntryAttDir, 0, dirPtr) == KErrNone) {
CleanupStack::PushL(dirPtr);
TInt cnt = dirPtr->Count();
for (TInt loop = 0; loop < cnt; loop++) {
diff --git a/backends/fs/symbian/symbianstream.cpp b/backends/fs/symbian/symbianstream.cpp
index 39249578f7..fa7842d3b1 100644
--- a/backends/fs/symbian/symbianstream.cpp
+++ b/backends/fs/symbian/symbianstream.cpp
@@ -70,22 +70,22 @@ TSymbianFileEntry* CreateSymbianFileEntry(const char* name, const char* mode) {
switch (mode[0]) {
case 'a':
- if (fileEntry->_fileHandle.Open(static_cast<OSystem_SDL_Symbian*>(g_system)->FsSession(), tempFileName, fileMode) != KErrNone) {
- if (fileEntry->_fileHandle.Create(static_cast<OSystem_SDL_Symbian*>(g_system)->FsSession(), tempFileName, fileMode) != KErrNone) {
+ if (fileEntry->_fileHandle.Open(static_cast<OSystem_SDL_Symbian *>(g_system)->FsSession(), tempFileName, fileMode) != KErrNone) {
+ if (fileEntry->_fileHandle.Create(static_cast<OSystem_SDL_Symbian *>(g_system)->FsSession(), tempFileName, fileMode) != KErrNone) {
delete fileEntry;
fileEntry = NULL;
}
}
break;
case 'r':
- if (fileEntry->_fileHandle.Open(static_cast<OSystem_SDL_Symbian*>(g_system)->FsSession(), tempFileName, fileMode) != KErrNone) {
+ if (fileEntry->_fileHandle.Open(static_cast<OSystem_SDL_Symbian *>(g_system)->FsSession(), tempFileName, fileMode) != KErrNone) {
delete fileEntry;
fileEntry = NULL;
}
break;
case 'w':
- if (fileEntry->_fileHandle.Replace(static_cast<OSystem_SDL_Symbian*>(g_system)->FsSession(), tempFileName, fileMode) != KErrNone) {
+ if (fileEntry->_fileHandle.Replace(static_cast<OSystem_SDL_Symbian *>(g_system)->FsSession(), tempFileName, fileMode) != KErrNone) {
delete fileEntry;
fileEntry = NULL;
}
@@ -96,7 +96,7 @@ TSymbianFileEntry* CreateSymbianFileEntry(const char* name, const char* mode) {
}
size_t ReadData(const void* ptr, size_t size, size_t numItems, TSymbianFileEntry* handle) {
- TSymbianFileEntry* entry = ((TSymbianFileEntry*)(handle));
+ TSymbianFileEntry* entry = ((TSymbianFileEntry *)(handle));
TUint32 totsize = size*numItems;
TPtr8 pointer ( (unsigned char*) ptr, totsize);
@@ -169,29 +169,29 @@ SymbianStdioStream::SymbianStdioStream(void *handle) : _handle(handle) {
}
SymbianStdioStream::~SymbianStdioStream() {
- ((TSymbianFileEntry*)(_handle))->_fileHandle.Close();
+ ((TSymbianFileEntry *)(_handle))->_fileHandle.Close();
- delete (TSymbianFileEntry*)(_handle);
+ delete (TSymbianFileEntry *)(_handle);
}
bool SymbianStdioStream::err() const {
- return ((TSymbianFileEntry*)(_handle))->_lastError != 0;
+ return ((TSymbianFileEntry *)(_handle))->_lastError != 0;
}
void SymbianStdioStream::clearErr() {
- ((TSymbianFileEntry*)(_handle))->_lastError = 0;
- ((TSymbianFileEntry*)(_handle))->_eofReached = 0;
+ ((TSymbianFileEntry *)(_handle))->_lastError = 0;
+ ((TSymbianFileEntry *)(_handle))->_eofReached = 0;
}
bool SymbianStdioStream::eos() const {
- TSymbianFileEntry* entry = ((TSymbianFileEntry*)(_handle));
+ TSymbianFileEntry* entry = ((TSymbianFileEntry *)(_handle));
return entry->_eofReached != 0;
}
int32 SymbianStdioStream::pos() const {
TInt pos = 0;
- TSymbianFileEntry* entry = ((TSymbianFileEntry*)(_handle));
+ TSymbianFileEntry* entry = ((TSymbianFileEntry *)(_handle));
entry->_lastError = entry->_fileHandle.Seek(ESeekCurrent, pos);
if (entry->_lastError == KErrNone && entry->_inputPos != KErrNotFound) {
@@ -204,7 +204,7 @@ int32 SymbianStdioStream::pos() const {
int32 SymbianStdioStream::size() const {
TInt length = 0;
- ((TSymbianFileEntry*)(_handle))->_fileHandle.Size(length);
+ ((TSymbianFileEntry *)(_handle))->_fileHandle.Size(length);
return length;
}
@@ -214,7 +214,7 @@ bool SymbianStdioStream::seek(int32 offs, int whence) {
TSeek seekMode = ESeekStart;
TInt pos = offs;
- TSymbianFileEntry* entry = ((TSymbianFileEntry*)(_handle));
+ TSymbianFileEntry* entry = ((TSymbianFileEntry *)(_handle));
switch (whence) {
case SEEK_SET:
@@ -246,11 +246,11 @@ uint32 SymbianStdioStream::read(void *ptr, uint32 len) {
uint32 SymbianStdioStream::write(const void *ptr, uint32 len) {
TPtrC8 pointer( (unsigned char*) ptr, len);
- ((TSymbianFileEntry*)(_handle))->_inputPos = KErrNotFound;
- ((TSymbianFileEntry*)(_handle))->_lastError = ((TSymbianFileEntry*)(_handle))->_fileHandle.Write(pointer);
- ((TSymbianFileEntry*)(_handle))->_eofReached = EFalse;
+ ((TSymbianFileEntry *)(_handle))->_inputPos = KErrNotFound;
+ ((TSymbianFileEntry *)(_handle))->_lastError = ((TSymbianFileEntry *)(_handle))->_fileHandle.Write(pointer);
+ ((TSymbianFileEntry *)(_handle))->_eofReached = EFalse;
- if (((TSymbianFileEntry*)(_handle))->_lastError == KErrNone) {
+ if (((TSymbianFileEntry *)(_handle))->_lastError == KErrNone) {
return len;
}
@@ -258,7 +258,7 @@ uint32 SymbianStdioStream::write(const void *ptr, uint32 len) {
}
bool SymbianStdioStream::flush() {
- ((TSymbianFileEntry*)(_handle))->_fileHandle.Flush();
+ ((TSymbianFileEntry *)(_handle))->_fileHandle.Flush();
return true;
}
diff --git a/backends/fs/windows/windows-fs.cpp b/backends/fs/windows/windows-fs.cpp
index c32ad2da94..030f394f81 100644
--- a/backends/fs/windows/windows-fs.cpp
+++ b/backends/fs/windows/windows-fs.cpp
@@ -87,7 +87,7 @@ void WindowsFilesystemNode::addFile(AbstractFSList &list, ListMode mode, const c
char* WindowsFilesystemNode::toAscii(TCHAR *str) {
#ifndef UNICODE
- return (char*)str;
+ return (char *)str;
#else
static char asciiString[MAX_PATH];
WideCharToMultiByte(CP_ACP, 0, str, _tcslen(str) + 1, asciiString, sizeof(asciiString), NULL, NULL);
diff --git a/backends/graphics/null/null-graphics.h b/backends/graphics/null/null-graphics.h
index 28b24f6aca..2e6b24d147 100644
--- a/backends/graphics/null/null-graphics.h
+++ b/backends/graphics/null/null-graphics.h
@@ -27,7 +27,7 @@
static const OSystem::GraphicsMode s_noGraphicsModes[] = { {0, 0, 0} };
-class NullGraphicsManager : GraphicsManager {
+class NullGraphicsManager : public GraphicsManager {
public:
virtual ~NullGraphicsManager() {}
@@ -38,6 +38,7 @@ public:
const OSystem::GraphicsMode *getSupportedGraphicsModes() const { return s_noGraphicsModes; }
int getDefaultGraphicsMode() const { return 0; }
bool setGraphicsMode(int mode) { return true; }
+ void resetGraphicsScale(){}
int getGraphicsMode() const { return 0; }
inline Graphics::PixelFormat getScreenFormat() const {
return Graphics::PixelFormat::createFormatCLUT8();
diff --git a/backends/graphics/opengl/glerrorcheck.cpp b/backends/graphics/opengl/glerrorcheck.cpp
index 682207c7ef..439593577d 100644
--- a/backends/graphics/opengl/glerrorcheck.cpp
+++ b/backends/graphics/opengl/glerrorcheck.cpp
@@ -26,6 +26,7 @@
#include "backends/graphics/opengl/glerrorcheck.h"
#include "common/textconsole.h"
+#include "common/str.h"
#ifdef WIN32
#if defined(ARRAYSIZE) && !defined(_WINDOWS_)
@@ -44,7 +45,7 @@
#include <GL/gl.h>
#endif
-static const char *getGlErrStr(GLenum error) {
+static Common::String getGlErrStr(GLenum error) {
switch (error) {
case GL_NO_ERROR: return "GL_NO_ERROR";
case GL_INVALID_ENUM: return "GL_INVALID_ENUM";
@@ -54,16 +55,13 @@ static const char *getGlErrStr(GLenum error) {
case GL_OUT_OF_MEMORY: return "GL_OUT_OF_MEMORY";
}
- // FIXME: Convert to use Common::String::format()
- static char buf[40];
- snprintf(buf, sizeof(buf), "(Unknown GL error code 0x%x)", error);
- return buf;
+ return Common::String::format("(Unknown GL error code 0x%x)", error);
}
void checkGlError(const char *file, int line) {
GLenum error = glGetError();
if (error != GL_NO_ERROR)
- warning("%s:%d: GL error: %s", file, line, getGlErrStr(error));
+ warning("%s:%d: GL error: %s", file, line, getGlErrStr(error).c_str());
}
#endif
diff --git a/backends/graphics/opengl/gltexture.cpp b/backends/graphics/opengl/gltexture.cpp
index b7f5c90105..ce69dc4aab 100644
--- a/backends/graphics/opengl/gltexture.cpp
+++ b/backends/graphics/opengl/gltexture.cpp
@@ -11,7 +11,7 @@
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * 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
@@ -60,8 +60,7 @@ void GLTexture::initGLExtensions() {
return;
// Get a string with all extensions
- const char* ext_string =
- reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS));
+ const char *ext_string = (const char *)glGetString(GL_EXTENSIONS);
CHECK_GL_ERROR();
Common::StringTokenizer tokenizer(ext_string, " ");
// Iterate all string tokens
@@ -132,7 +131,7 @@ void GLTexture::allocBuffer(GLuint w, GLuint h) {
// Allocate room for the texture
glTexImage2D(GL_TEXTURE_2D, 0, _internalFormat,
- _textureWidth, _textureHeight, 0, _glFormat, _glType, NULL); CHECK_GL_ERROR();
+ _textureWidth, _textureHeight, 0, _glFormat, _glType, NULL); CHECK_GL_ERROR();
_refresh = false;
}
@@ -146,15 +145,15 @@ void GLTexture::updateBuffer(const void *buf, int pitch, GLuint x, GLuint y, GLu
glBindTexture(GL_TEXTURE_2D, _textureName); CHECK_GL_ERROR();
// Check if the buffer has its data contiguously
- if (static_cast<int>(w) * _bytesPerPixel == pitch) {
+ if ((int)w * _bytesPerPixel == pitch) {
glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, w, h,
- _glFormat, _glType, buf); CHECK_GL_ERROR();
+ _glFormat, _glType, buf); CHECK_GL_ERROR();
} else {
// Update the texture row by row
- const byte *src = static_cast<const byte *>(buf);
+ const byte *src = (const byte *)buf;
do {
glTexSubImage2D(GL_TEXTURE_2D, 0, x, y,
- w, 1, _glFormat, _glType, src); CHECK_GL_ERROR();
+ w, 1, _glFormat, _glType, src); CHECK_GL_ERROR();
++y;
src += pitch;
} while (--h);
diff --git a/backends/graphics/opengl/gltexture.h b/backends/graphics/opengl/gltexture.h
index d8c42eeb2d..8ff9838ff7 100644
--- a/backends/graphics/opengl/gltexture.h
+++ b/backends/graphics/opengl/gltexture.h
@@ -68,29 +68,29 @@ public:
static void initGLExtensions();
GLTexture(byte bpp, GLenum internalFormat, GLenum format, GLenum type);
- virtual ~GLTexture();
+ ~GLTexture();
/**
* Refresh the texture after a context change. The
* process will be completed on next allocBuffer call.
*/
- virtual void refresh();
+ void refresh();
/**
* Allocates memory needed for the given size.
*/
- virtual void allocBuffer(GLuint width, GLuint height);
+ void allocBuffer(GLuint width, GLuint height);
/**
* Updates the texture pixels.
*/
- virtual void updateBuffer(const void *buf, int pitch, GLuint x, GLuint y,
+ void updateBuffer(const void *buf, int pitch, GLuint x, GLuint y,
GLuint w, GLuint h);
/**
* Draws the texture to the screen buffer.
*/
- virtual void drawTexture(GLshort x, GLshort y, GLshort w, GLshort h);
+ void drawTexture(GLshort x, GLshort y, GLshort w, GLshort h);
/**
* Get the texture width.
@@ -113,7 +113,7 @@ public:
*/
void setFilter(GLint filter) { _filter = filter; }
-protected:
+private:
const byte _bytesPerPixel;
const GLenum _internalFormat;
const GLenum _glFormat;
diff --git a/backends/graphics/opengl/opengl-graphics.cpp b/backends/graphics/opengl/opengl-graphics.cpp
index edc7a5f28e..45804b5d6e 100644
--- a/backends/graphics/opengl/opengl-graphics.cpp
+++ b/backends/graphics/opengl/opengl-graphics.cpp
@@ -81,8 +81,8 @@ OpenGLGraphicsManager::~OpenGLGraphicsManager() {
bool OpenGLGraphicsManager::hasFeature(OSystem::Feature f) {
return
- (f == OSystem::kFeatureAspectRatioCorrection) ||
- (f == OSystem::kFeatureCursorPalette);
+ (f == OSystem::kFeatureAspectRatioCorrection) ||
+ (f == OSystem::kFeatureCursorPalette);
}
void OpenGLGraphicsManager::setFeatureState(OSystem::Feature f, bool enable) {
@@ -269,9 +269,9 @@ OSystem::TransactionError OpenGLGraphicsManager::endGFXTransaction() {
}
if (_videoMode.fullscreen == _oldVideoMode.fullscreen &&
- _videoMode.mode == _oldVideoMode.mode &&
- _videoMode.screenWidth == _oldVideoMode.screenWidth &&
- _videoMode.screenHeight == _oldVideoMode.screenHeight) {
+ _videoMode.mode == _oldVideoMode.mode &&
+ _videoMode.screenWidth == _oldVideoMode.screenWidth &&
+ _videoMode.screenHeight == _oldVideoMode.screenHeight) {
_oldVideoMode.setup = false;
}
@@ -420,7 +420,7 @@ void OpenGLGraphicsManager::setShakePos(int shakeOffset) {
_shakePos = shakeOffset;
}
-void OpenGLGraphicsManager::setFocusRectangle(const Common::Rect& rect) {
+void OpenGLGraphicsManager::setFocusRectangle(const Common::Rect &rect) {
}
void OpenGLGraphicsManager::clearFocusRectangle() {
@@ -487,7 +487,8 @@ void OpenGLGraphicsManager::copyRectToOverlay(const OverlayColor *buf, int pitch
}
if (y < 0) {
- h += y; buf -= y * pitch;
+ h += y;
+ buf -= y * pitch;
y = 0;
}
@@ -500,26 +501,13 @@ void OpenGLGraphicsManager::copyRectToOverlay(const OverlayColor *buf, int pitch
if (w <= 0 || h <= 0)
return;
- if (_overlayFormat.aBits() == 1) {
- // Copy buffer with the alpha bit on for all pixels for correct
- // overlay drawing.
- const uint16 *src = (const uint16 *)buf;
- uint16 *dst = (uint16 *)_overlayData.pixels + y * _overlayData.w + x;
- for (int i = 0; i < h; i++) {
- for (int e = 0; e < w; e++)
- dst[e] = src[e] | 0x1;
- src += pitch;
- dst += _overlayData.w;
- }
- } else {
- // Copy buffer data to internal overlay surface
- const byte *src = (const byte *)buf;
- byte *dst = (byte *)_overlayData.pixels + y * _overlayData.pitch;
- for (int i = 0; i < h; i++) {
- memcpy(dst + x * _overlayData.format.bytesPerPixel, src, w * _overlayData.format.bytesPerPixel);
- src += pitch * sizeof(buf[0]);
- dst += _overlayData.pitch;
- }
+ // Copy buffer data to internal overlay surface
+ const byte *src = (const byte *)buf;
+ byte *dst = (byte *)_overlayData.pixels + y * _overlayData.pitch;
+ for (int i = 0; i < h; i++) {
+ memcpy(dst + x * _overlayData.format.bytesPerPixel, src, w * _overlayData.format.bytesPerPixel);
+ src += pitch * sizeof(buf[0]);
+ dst += _overlayData.pitch;
}
// Extend dirty area if not full screen redraw is flagged
@@ -594,10 +582,8 @@ void OpenGLGraphicsManager::warpMouse(int x, int y) {
scaledY += _displayY;
}
+ setMousePosition(scaledX, scaledY);
setInternalMousePosition(scaledX, scaledY);
-
- _cursorState.x = scaledX;
- _cursorState.y = scaledY;
}
void OpenGLGraphicsManager::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int cursorTargetScale, const Graphics::PixelFormat *format) {
@@ -613,7 +599,7 @@ void OpenGLGraphicsManager::setMouseCursor(const byte *buf, uint w, uint h, int
// Allocate space for cursor data
if (_cursorData.w != w || _cursorData.h != h ||
- _cursorData.format.bytesPerPixel != _cursorFormat.bytesPerPixel)
+ _cursorData.format.bytesPerPixel != _cursorFormat.bytesPerPixel)
_cursorData.create(w, h, _cursorFormat);
// Save cursor data
@@ -717,7 +703,7 @@ void OpenGLGraphicsManager::refreshGameScreen() {
} else {
// Update the texture
_gameTexture->updateBuffer((byte *)_screenData.pixels + y * _screenData.pitch +
- x * _screenData.format.bytesPerPixel, _screenData.pitch, x, y, w, h);
+ x * _screenData.format.bytesPerPixel, _screenData.pitch, x, y, w, h);
}
_screenNeedsRedraw = false;
@@ -759,7 +745,7 @@ void OpenGLGraphicsManager::refreshOverlay() {
} else {
// Update the texture
_overlayTexture->updateBuffer((byte *)_overlayData.pixels + y * _overlayData.pitch +
- x * _overlayData.format.bytesPerPixel, _overlayData.pitch, x, y, w, h);
+ x * _overlayData.format.bytesPerPixel, _overlayData.pitch, x, y, w, h);
}
_overlayNeedsRedraw = false;
@@ -1043,10 +1029,10 @@ void OpenGLGraphicsManager::internUpdateScreen() {
// Draw the cursor
if (_overlayVisible)
_cursorTexture->drawTexture(_cursorState.x - _cursorState.rHotX,
- _cursorState.y - _cursorState.rHotY, _cursorState.rW, _cursorState.rH);
+ _cursorState.y - _cursorState.rHotY, _cursorState.rW, _cursorState.rH);
else
_cursorTexture->drawTexture(_cursorState.x - _cursorState.vHotX,
- _cursorState.y - _cursorState.vHotY, _cursorState.vW, _cursorState.vH);
+ _cursorState.y - _cursorState.vHotY, _cursorState.vW, _cursorState.vH);
glPopMatrix();
}
@@ -1170,23 +1156,23 @@ void OpenGLGraphicsManager::loadTextures() {
if (
#ifdef USE_RGB_COLOR
- _transactionDetails.formatChanged ||
+ _transactionDetails.formatChanged ||
#endif
- _oldVideoMode.screenWidth != _videoMode.screenWidth ||
- _oldVideoMode.screenHeight != _videoMode.screenHeight)
+ _oldVideoMode.screenWidth != _videoMode.screenWidth ||
+ _oldVideoMode.screenHeight != _videoMode.screenHeight)
_screenData.create(_videoMode.screenWidth, _videoMode.screenHeight,
#ifdef USE_RGB_COLOR
- _screenFormat
+ _screenFormat
#else
- Graphics::PixelFormat::createFormatCLUT8()
+ Graphics::PixelFormat::createFormatCLUT8()
#endif
- );
+ );
if (_oldVideoMode.overlayWidth != _videoMode.overlayWidth ||
- _oldVideoMode.overlayHeight != _videoMode.overlayHeight)
+ _oldVideoMode.overlayHeight != _videoMode.overlayHeight)
_overlayData.create(_videoMode.overlayWidth, _videoMode.overlayHeight,
- _overlayFormat);
+ _overlayFormat);
_screenNeedsRedraw = true;
_overlayNeedsRedraw = true;
@@ -1263,8 +1249,8 @@ uint OpenGLGraphicsManager::getAspectRatio() const {
// ratio correction is enabled, but it's better than the previous 4/3 mode
// mess at least...
if (_videoMode.aspectRatioCorrection
- && ((_videoMode.screenWidth == 320 && _videoMode.screenHeight == 200)
- || (_videoMode.screenWidth == 640 && _videoMode.screenHeight == 400)))
+ && ((_videoMode.screenWidth == 320 && _videoMode.screenHeight == 200)
+ || (_videoMode.screenWidth == 640 && _videoMode.screenHeight == 400)))
return 13333;
else if (_videoMode.mode == OpenGL::GFX_NORMAL)
return _videoMode.hardwareWidth * 10000 / _videoMode.hardwareHeight;
@@ -1276,15 +1262,13 @@ void OpenGLGraphicsManager::adjustMousePosition(int16 &x, int16 &y) {
if (_overlayVisible)
return;
- if (!_overlayVisible) {
- x -= _displayX;
- y -= _displayY;
+ x -= _displayX;
+ y -= _displayY;
- if (_displayWidth != _videoMode.screenWidth)
- x = x * _videoMode.screenWidth / _displayWidth;
- if (_displayHeight != _videoMode.screenHeight)
- y = y * _videoMode.screenHeight / _displayHeight;
- }
+ if (_displayWidth != _videoMode.screenWidth)
+ x = x * _videoMode.screenWidth / _displayWidth;
+ if (_displayHeight != _videoMode.screenHeight)
+ y = y * _videoMode.screenHeight / _displayHeight;
}
bool OpenGLGraphicsManager::saveScreenshot(const char *filename) {
@@ -1359,7 +1343,7 @@ const char *OpenGLGraphicsManager::getCurrentModeName() {
#ifdef USE_OSD
const Graphics::Font *OpenGLGraphicsManager::getFontOSD() {
- return FontMan.getFontByUsage(Graphics::FontManager::kLocalizedFont);
+ return FontMan.getFontByUsage(Graphics::FontManager::kLocalizedFont);
}
void OpenGLGraphicsManager::updateOSD() {
diff --git a/backends/graphics/opengl/opengl-graphics.h b/backends/graphics/opengl/opengl-graphics.h
index 6ded680eae..ad8765bab1 100644
--- a/backends/graphics/opengl/opengl-graphics.h
+++ b/backends/graphics/opengl/opengl-graphics.h
@@ -217,6 +217,7 @@ protected:
uint getAspectRatio() const;
+ void setFormatIsBGR(bool isBGR) { _formatBGR = isBGR; }
bool _formatBGR;
//
@@ -285,6 +286,14 @@ protected:
int _cursorTargetScale;
bool _cursorNeedsRedraw;
+ /**
+ * Set up the mouse position for graphics output.
+ *
+ * @param x X coordinate in native coordinates.
+ * @param y Y coordinate in native coordinates.
+ */
+ void setMousePosition(int x, int y) { _cursorState.x = x; _cursorState.y = y; }
+
virtual void refreshCursor();
virtual void refreshCursorScale();
@@ -312,20 +321,20 @@ protected:
#ifdef USE_OSD
/**
- * The OSD contents.
+ * Returns the font used for on screen display
*/
- Common::Array<Common::String> _osdLines;
-
- /**
- * Returns the font used for on screen display
- */
- virtual const Graphics::Font *getFontOSD();
+ virtual const Graphics::Font *getFontOSD();
/**
* Update the OSD texture / surface.
*/
void updateOSD();
+ /**
+ * The OSD contents.
+ */
+ Common::Array<Common::String> _osdLines;
+
GLTexture *_osdTexture;
Graphics::Surface _osdSurface;
uint8 _osdAlpha;
diff --git a/backends/graphics/openglsdl/openglsdl-graphics.cpp b/backends/graphics/openglsdl/openglsdl-graphics.cpp
index f2b3168e36..b37d631c6d 100644
--- a/backends/graphics/openglsdl/openglsdl-graphics.cpp
+++ b/backends/graphics/openglsdl/openglsdl-graphics.cpp
@@ -376,7 +376,7 @@ bool OpenGLSdlGraphicsManager::loadGFXMode() {
}
// Check if the screen is BGR format
- _formatBGR = _hwscreen->format->Rshift != 0;
+ setFormatIsBGR(_hwscreen->format->Rshift != 0);
if (isFullscreen) {
_lastFullscreenModeWidth = _videoMode.hardwareWidth;
@@ -460,10 +460,6 @@ void OpenGLSdlGraphicsManager::toggleFullScreen(int loop) {
_activeFullscreenMode = -2;
setFullscreenMode(!isFullscreen);
}
-
- // HACK: We need to force a refresh here, since we change the
- // fullscreen mode.
- _transactionDetails.needRefresh = true;
endGFXTransaction();
// Ignore resize events for the next 10 frames
@@ -486,7 +482,7 @@ void OpenGLSdlGraphicsManager::toggleFullScreen(int loop) {
}
bool OpenGLSdlGraphicsManager::notifyEvent(const Common::Event &event) {
- switch ((int)event.type) {
+ switch (event.type) {
case Common::EVENT_KEYDOWN:
if (event.kbd.hasFlags(Common::KBD_ALT)) {
// Alt-Return and Alt-Enter toggle full screen mode
@@ -671,8 +667,7 @@ void OpenGLSdlGraphicsManager::transformMouseCoordinates(Common::Point &point) {
}
void OpenGLSdlGraphicsManager::notifyMousePos(Common::Point mouse) {
- _cursorState.x = mouse.x;
- _cursorState.y = mouse.y;
+ setMousePosition(mouse.x, mouse.y);
}
#endif
diff --git a/backends/keymapper/action.cpp b/backends/keymapper/action.cpp
index 6ee506e7c3..e5b2d9415a 100644
--- a/backends/keymapper/action.cpp
+++ b/backends/keymapper/action.cpp
@@ -28,10 +28,8 @@
namespace Common {
-Action::Action(Keymap *boss, const char *i, String des, ActionType typ,
- KeyType prefKey, int pri, int flg)
- : _boss(boss), description(des), type(typ), preferredKey(prefKey),
- priority(pri), flags(flg), _hwKey(0) {
+Action::Action(Keymap *boss, const char *i, String des)
+ : _boss(boss), description(des), _hwKey(0) {
assert(i);
assert(_boss);
diff --git a/backends/keymapper/action.h b/backends/keymapper/action.h
index e5bf6d51dd..3132260512 100644
--- a/backends/keymapper/action.h
+++ b/backends/keymapper/action.h
@@ -27,7 +27,6 @@
#ifdef ENABLE_KEYMAPPER
-#include "backends/keymapper/types.h"
#include "common/events.h"
#include "common/func.h"
#include "common/list.h"
@@ -54,11 +53,6 @@ struct Action {
/** Events to be sent when mapped key is pressed */
List<Event> events;
- ActionType type;
- KeyType preferredKey;
- int priority;
- int group;
- int flags;
private:
/** Hardware key that is mapped to this Action */
@@ -66,15 +60,19 @@ private:
Keymap *_boss;
public:
- Action(Keymap *boss, const char *id, String des = "",
- ActionType typ = kGenericActionType,
- KeyType prefKey = kGenericKeyType,
- int pri = 0, int flg = 0 );
+ Action(Keymap *boss, const char *id, String des = "");
void addEvent(const Event &evt) {
events.push_back(evt);
}
+ void addEvent(const EventType evtType) {
+ Event evt;
+
+ evt.type = evtType;
+ events.push_back(evt);
+ }
+
void addKeyEvent(const KeyState &ks) {
Event evt;
@@ -84,24 +82,15 @@ public:
}
void addLeftClickEvent() {
- Event evt;
-
- evt.type = EVENT_LBUTTONDOWN;
- addEvent(evt);
+ addEvent(EVENT_LBUTTONDOWN);
}
void addMiddleClickEvent() {
- Event evt;
-
- evt.type = EVENT_MBUTTONDOWN;
- addEvent(evt);
+ addEvent(EVENT_MBUTTONDOWN);
}
void addRightClickEvent() {
- Event evt;
-
- evt.type = EVENT_RBUTTONDOWN;
- addEvent(evt);
+ addEvent(EVENT_RBUTTONDOWN);
}
Keymap *getParent() {
@@ -113,15 +102,6 @@ public:
};
-struct ActionPriorityComp : public BinaryFunction<Action, Action, bool> {
- bool operator()(const Action *x, const Action *y) const {
- return x->priority > y->priority;
- }
- bool operator()(const Action &x, const Action &y) const {
- return x.priority > y.priority;
- }
-};
-
} // End of namespace Common
#endif // #ifdef ENABLE_KEYMAPPER
diff --git a/backends/keymapper/hardware-key.h b/backends/keymapper/hardware-key.h
index 32df042525..9fd8d1981a 100644
--- a/backends/keymapper/hardware-key.h
+++ b/backends/keymapper/hardware-key.h
@@ -27,20 +27,16 @@
#ifdef ENABLE_KEYMAPPER
-#include "backends/keymapper/types.h"
#include "common/textconsole.h"
namespace Common {
-
-#define HWKEY_ID_SIZE (30)
-
/**
* Describes an available hardware key
*/
struct HardwareKey {
/** unique id used for saving/loading to config */
- char hwKeyId[HWKEY_ID_SIZE];
+ String id;
/** Human readable description */
String description;
@@ -51,17 +47,30 @@ struct HardwareKey {
*/
KeyState key;
- KeyType type;
- ActionType preferredAction;
+ HardwareKey(String i, KeyState ky = KeyState(), String desc = "")
+ : id(i), key(ky), description(desc) { }
+};
- HardwareKey(const char *i, KeyState ky = KeyState(), String desc = "",
- KeyType typ = kGenericKeyType, ActionType prefAct = kGenericActionType)
- : key(ky), description(desc), type(typ), preferredAction(prefAct) {
- assert(i);
- Common::strlcpy(hwKeyId, i, HWKEY_ID_SIZE);
- }
+/**
+ * Entry in a static table of available non-modifier keys
+ */
+struct KeyTableEntry {
+ const char *hwId;
+ KeyCode keycode;
+ uint16 ascii;
+ const char *desc;
+ bool shiftable;
};
+/**
+ * Entry in a static table of available key modifiers
+ */
+struct ModifierTableEntry {
+ byte flag;
+ const char *id;
+ const char *desc;
+ bool shiftable;
+};
/**
* Simple class to encapsulate a device's set of HardwareKeys.
@@ -71,30 +80,41 @@ struct HardwareKey {
class HardwareKeySet {
public:
+ /**
+ * Add hardware keys to the set out of key and modifier tables.
+ * @param keys table of available keys
+ * @param modifiers table of available modifiers
+ */
+ HardwareKeySet(const KeyTableEntry keys[], const ModifierTableEntry modifiers[]) {
+ addHardwareKeys(keys, modifiers);
+ }
+
+ HardwareKeySet() { }
+
virtual ~HardwareKeySet() {
- List<const HardwareKey*>::const_iterator it;
+ List<const HardwareKey *>::const_iterator it;
for (it = _keys.begin(); it != _keys.end(); it++)
delete *it;
}
- void addHardwareKey(HardwareKey *key) {
+ void addHardwareKey(const HardwareKey *key) {
checkForKey(key);
_keys.push_back(key);
}
- const HardwareKey *findHardwareKey(const char *id) const {
- List<const HardwareKey*>::const_iterator it;
+ const HardwareKey *findHardwareKey(String id) const {
+ List<const HardwareKey *>::const_iterator it;
for (it = _keys.begin(); it != _keys.end(); it++) {
- if (strncmp((*it)->hwKeyId, id, HWKEY_ID_SIZE) == 0)
+ if ((*it)->id == id)
return (*it);
}
return 0;
}
const HardwareKey *findHardwareKey(const KeyState& keystate) const {
- List<const HardwareKey*>::const_iterator it;
+ List<const HardwareKey *>::const_iterator it;
for (it = _keys.begin(); it != _keys.end(); it++) {
if ((*it)->key == keystate)
@@ -103,7 +123,7 @@ public:
return 0;
}
- const List<const HardwareKey*> &getHardwareKeys() const {
+ const List<const HardwareKey *> &getHardwareKeys() const {
return _keys;
}
@@ -111,24 +131,55 @@ public:
return _keys.size();
}
+ /**
+ * Add hardware keys to the set out of key and modifier tables.
+ * @param keys table of available keys
+ * @param modifiers table of available modifiers
+ */
+ void addHardwareKeys(const KeyTableEntry keys[], const ModifierTableEntry modifiers[]) {
+ const KeyTableEntry *key;
+ const ModifierTableEntry *mod;
+ char fullKeyId[50];
+ char fullKeyDesc[100];
+ uint16 ascii;
+
+ for (mod = modifiers; mod->id; mod++) {
+ for (key = keys; key->hwId; key++) {
+ ascii = key->ascii;
+
+ if (mod->shiftable && key->shiftable) {
+ snprintf(fullKeyId, 50, "%s%c", mod->id, toupper(key->hwId[0]));
+ snprintf(fullKeyDesc, 100, "%s%c", mod->desc, toupper(key->desc[0]));
+ ascii = toupper(key->ascii);
+ } else if (mod->shiftable) {
+ snprintf(fullKeyId, 50, "S+%s%s", mod->id, key->hwId);
+ snprintf(fullKeyDesc, 100, "Shift+%s%s", mod->desc, key->desc);
+ } else {
+ snprintf(fullKeyId, 50, "%s%s", mod->id, key->hwId);
+ snprintf(fullKeyDesc, 100, "%s%s", mod->desc, key->desc);
+ }
+
+ addHardwareKey(new HardwareKey(fullKeyId, KeyState(key->keycode, ascii, mod->flag), fullKeyDesc));
+ }
+ }
+ }
private:
- void checkForKey(HardwareKey *key) {
- List<const HardwareKey*>::iterator it;
+ void checkForKey(const HardwareKey *key) {
+ List<const HardwareKey *>::iterator it;
for (it = _keys.begin(); it != _keys.end(); it++) {
- if (strncmp((*it)->hwKeyId, key->hwKeyId, HWKEY_ID_SIZE) == 0)
- error("Error adding HardwareKey '%s' - id of %s already in use!", key->description.c_str(), key->hwKeyId);
+ if ((*it)->id == key->id)
+ error("Error adding HardwareKey '%s' - id of %s already in use!", key->description.c_str(), key->id.c_str());
else if ((*it)->key == key->key)
error("Error adding HardwareKey '%s' - key already in use!", key->description.c_str());
}
}
- List<const HardwareKey*> _keys;
+ List<const HardwareKey *> _keys;
};
-
} // End of namespace Common
#endif // #ifdef ENABLE_KEYMAPPER
diff --git a/backends/keymapper/keymap.cpp b/backends/keymapper/keymap.cpp
index 6fc1b1e08d..3913fd149e 100644
--- a/backends/keymapper/keymap.cpp
+++ b/backends/keymapper/keymap.cpp
@@ -24,14 +24,17 @@
#ifdef ENABLE_KEYMAPPER
+#include "common/system.h"
+
#include "backends/keymapper/hardware-key.h"
+#include "backends/keymapper/keymapper-defaults.h"
#define KEYMAP_KEY_PREFIX "keymap_"
namespace Common {
Keymap::Keymap(const Keymap& km) : _actions(km._actions), _keymap(), _configDomain(0) {
- List<Action*>::iterator it;
+ List<Action *>::iterator it;
for (it = _actions.begin(); it != _actions.end(); ++it) {
const HardwareKey *hwKey = (*it)->getMappedKey();
@@ -43,7 +46,7 @@ Keymap::Keymap(const Keymap& km) : _actions(km._actions), _keymap(), _configDoma
}
Keymap::~Keymap() {
- List<Action*>::iterator it;
+ List<Action *>::iterator it;
for (it = _actions.begin(); it != _actions.end(); ++it)
delete *it;
@@ -57,7 +60,7 @@ void Keymap::addAction(Action *action) {
}
void Keymap::registerMapping(Action *action, const HardwareKey *hwKey) {
- HashMap<KeyState, Action*>::iterator it;
+ HashMap<KeyState, Action *>::iterator it;
it = _keymap.find(hwKey->key);
@@ -82,7 +85,7 @@ Action *Keymap::getAction(const char *id) {
}
Action *Keymap::findAction(const char *id) {
- List<Action*>::iterator it;
+ List<Action *>::iterator it;
for (it = _actions.begin(); it != _actions.end(); ++it) {
if (strncmp((*it)->id, id, ACTION_ID_SIZE) == 0)
@@ -92,7 +95,7 @@ Action *Keymap::findAction(const char *id) {
}
const Action *Keymap::findAction(const char *id) const {
- List<Action*>::const_iterator it;
+ List<Action *>::const_iterator it;
for (it = _actions.begin(); it != _actions.end(); ++it) {
if (strncmp((*it)->id, id, ACTION_ID_SIZE) == 0)
@@ -103,7 +106,7 @@ const Action *Keymap::findAction(const char *id) const {
}
Action *Keymap::getMappedAction(const KeyState& ks) const {
- HashMap<KeyState, Action*>::iterator it;
+ HashMap<KeyState, Action *>::iterator it;
it = _keymap.find(ks);
@@ -121,35 +124,50 @@ void Keymap::loadMappings(const HardwareKeySet *hwKeys) {
if (!_configDomain)
return;
- ConfigManager::Domain::iterator it;
- String prefix = KEYMAP_KEY_PREFIX + _name + "_";
-
- for (it = _configDomain->begin(); it != _configDomain->end(); ++it) {
- const String& key = it->_key;
-
- if (!key.hasPrefix(prefix.c_str()))
- continue;
+ if (_actions.empty())
+ return;
- // parse Action ID
- const char *actionId = key.c_str() + prefix.size();
- Action *ua = getAction(actionId);
+ Common::KeymapperDefaultBindings *defaults = g_system->getKeymapperDefaultBindings();
- if (!ua) {
- warning("'%s' keymap does not contain Action with ID %s",
- _name.c_str(), actionId);
- _configDomain->erase(key);
+ HashMap<String, const HardwareKey *> mappedKeys;
+ List<Action*>::iterator it;
+ String prefix = KEYMAP_KEY_PREFIX + _name + "_";
- continue;
+ for (it = _actions.begin(); it != _actions.end(); ++it) {
+ Action* ua = *it;
+ String actionId(ua->id);
+ String confKey = prefix + actionId;
+
+ String hwKeyId = _configDomain->getVal(confKey);
+
+ bool defaulted = false;
+ // fall back to the platform-specific defaults
+ if (hwKeyId.empty() && defaults) {
+ hwKeyId = defaults->getDefaultBinding(_name, actionId);
+ if (!hwKeyId.empty())
+ defaulted = true;
}
+ // there's no mapping
+ if (hwKeyId.empty())
+ continue;
- const HardwareKey *hwKey = hwKeys->findHardwareKey(it->_value.c_str());
+ const HardwareKey *hwKey = hwKeys->findHardwareKey(hwKeyId.c_str());
if (!hwKey) {
- warning("HardwareKey with ID '%s' not known", it->_value.c_str());
- _configDomain->erase(key);
+ warning("HardwareKey with ID '%s' not known", hwKeyId.c_str());
continue;
}
+ if (defaulted) {
+ if (mappedKeys.contains(hwKeyId)) {
+ debug(1, "Action [%s] not falling back to hardcoded default value [%s] because the key is in use", confKey.c_str(), hwKeyId.c_str());
+ continue;
+ }
+ warning("Action [%s] fell back to hardcoded default value [%s]", confKey.c_str(), hwKeyId.c_str());
+ }
+
+ mappedKeys.setVal(hwKeyId, hwKey);
+ // map the key
ua->mapKey(hwKey);
}
}
@@ -158,7 +176,7 @@ void Keymap::saveMappings() {
if (!_configDomain)
return;
- List<Action*>::const_iterator it;
+ List<Action *>::const_iterator it;
String prefix = KEYMAP_KEY_PREFIX + _name + "_";
for (it = _actions.begin(); it != _actions.end(); ++it) {
@@ -167,19 +185,17 @@ void Keymap::saveMappings() {
actIdLen = (actIdLen > ACTION_ID_SIZE) ? ACTION_ID_SIZE : actIdLen;
String actId((*it)->id, (*it)->id + actIdLen);
- char hwId[HWKEY_ID_SIZE+1];
-
- memset(hwId, 0, HWKEY_ID_SIZE+1);
+ String hwId = "";
if ((*it)->getMappedKey()) {
- memcpy(hwId, (*it)->getMappedKey()->hwKeyId, HWKEY_ID_SIZE);
+ hwId = (*it)->getMappedKey()->id;
}
_configDomain->setVal(prefix + actId, hwId);
}
}
bool Keymap::isComplete(const HardwareKeySet *hwKeys) {
- List<Action*>::iterator it;
+ List<Action *>::iterator it;
bool allMapped = true;
uint numberMapped = 0;
@@ -194,147 +210,6 @@ bool Keymap::isComplete(const HardwareKeySet *hwKeys) {
return allMapped || (numberMapped == hwKeys->size());
}
-// TODO:
-// - current weakness:
-// - if an action finds a key with required type but a parent action with
-// higher priority is using it, that key is never used
-void Keymap::automaticMapping(HardwareKeySet *hwKeys) {
-#if 0 //disabling the broken automapper for now
- // Create copies of action and key lists.
- List<Action*> actions(_actions);
- List<const HardwareKey*> keys(hwKeys->getHardwareKeys());
-
- List<Action*>::iterator actIt;
- List<const HardwareKey*>::iterator keyIt, selectedKey;
-
- // Remove actions and keys from local lists that have already been mapped.
- actIt = actions.begin();
-
- while (actIt != actions.end()) {
- Action *act = *actIt;
- const HardwareKey *key = act->getMappedKey();
-
- if (key) {
- keys.remove(key);
- actIt = actions.erase(actIt);
- } else {
- ++actIt;
- }
- }
-
- // Sort remaining actions by priority.
- ActionPriorityComp priorityComp;
- sort(actions.begin(), actions.end(), priorityComp);
-
- // First mapping pass:
- // - Match if a key's preferred action type is the same as the action's
- // type, or vice versa.
- // - Priority is given to:
- // - keys that match action types over key types.
- // - keys that have not been used by parent maps.
- // - If a key has been used by a parent map the new action must have a
- // higher priority than the parent action.
- // - As soon as the number of skipped actions equals the number of keys
- // remaining we stop matching. This means that the second pass will assign keys
- // to these higher priority skipped actions.
- uint skipped = 0;
- actIt = actions.begin();
-
- while (actIt != actions.end() && skipped < keys.size()) {
- selectedKey = keys.end();
- int matchRank = 0;
- Action *act = *actIt;
-
- for (keyIt = keys.begin(); keyIt != keys.end(); ++keyIt) {
- if ((*keyIt)->preferredAction == act->type && act->type != kGenericActionType) {
- Action *parentAct = getParentMappedAction((*keyIt)->key);
-
- if (!parentAct) {
- selectedKey = keyIt;
- break;
- } else if (parentAct->priority <= act->priority && matchRank < 3) {
- selectedKey = keyIt;
- matchRank = 3;
- }
- } else if ((*keyIt)->type == act->preferredKey && act->preferredKey != kGenericKeyType && matchRank < 2) {
- Action *parentAct = getParentMappedAction((*keyIt)->key);
-
- if (!parentAct) {
- selectedKey = keyIt;
- matchRank = 2;
- } else if (parentAct->priority <= act->priority && matchRank < 1) {
- selectedKey = keyIt;
- matchRank = 1;
- }
- }
- }
- if (selectedKey != keys.end()) {
- // Map action and delete action & key from local lists.
- act->mapKey(*selectedKey);
- keys.erase(selectedKey);
- actIt = actions.erase(actIt);
- } else {
- // Skip action (will be mapped in next pass).
- ++actIt;
- ++skipped;
- }
- }
-
- // Second mapping pass:
- // - Maps any remaining actions to keys
- // - priority given to:
- // - keys that have no parent action
- // - keys whose parent action has lower priority than the new action
- // - keys whose parent action has the lowest priority
- // - is guaranteed to match a key if they are not all used up
- for (actIt = actions.begin(); actIt != actions.end(); ++actIt) {
- selectedKey = keys.end();
-
- int matchRank = 0;
- int lowestPriority = 0;
- Action *act = *actIt;
-
- for (keyIt = keys.begin(); keyIt != keys.end(); ++keyIt) {
- Action *parentAct = getParentMappedAction((*keyIt)->key);
-
- if (!parentAct) {
- selectedKey = keyIt;
- break;
- } else if (matchRank < 2) {
- if (parentAct->priority <= act->priority) {
- matchRank = 2;
- selectedKey = keyIt;
- } else if (parentAct->priority < lowestPriority || matchRank == 0) {
- matchRank = 1;
- lowestPriority = parentAct->priority;
- selectedKey = keyIt;
- }
- }
- }
-
- if (selectedKey != keys.end()) {
- act->mapKey(*selectedKey);
- keys.erase(selectedKey);
- } else {// no match = no keys left
- break;
- }
- }
-#endif
-}
-
-Action *Keymap::getParentMappedAction(KeyState key) {
- if (_parent) {
- Action *act = _parent->getMappedAction(key);
-
- if (act)
- return act;
- else
- return _parent->getParentMappedAction(key);
- } else {
- return 0;
- }
-}
-
} // End of namespace Common
#endif // #ifdef ENABLE_KEYMAPPER
diff --git a/backends/keymapper/keymap.h b/backends/keymapper/keymap.h
index 73f2293653..2e9f08533e 100644
--- a/backends/keymapper/keymap.h
+++ b/backends/keymapper/keymap.h
@@ -52,7 +52,7 @@ template<> struct Hash<KeyState>
class Keymap {
public:
- Keymap(const String& name, Keymap *parent = 0) : _name(name), _parent(parent) {}
+ Keymap(const String& name) : _name(name) {}
Keymap(const Keymap& km);
~Keymap();
@@ -67,7 +67,7 @@ public:
/**
* Get the list of all the Actions contained in this Keymap
*/
- List<Action*>& getActions() { return _actions; }
+ List<Action *>& getActions() { return _actions; }
/**
* Find the Action that a key is mapped to
@@ -91,9 +91,6 @@ public:
*/
void saveMappings();
-
- void automaticMapping(HardwareKeySet *hwKeys);
-
/**
* Returns true if all UserAction's in Keymap are mapped, or,
* all HardwareKey's from the given set have been used up.
@@ -101,7 +98,6 @@ public:
bool isComplete(const HardwareKeySet *hwKeys);
const String& getName() { return _name; }
- Keymap *getParent() { return _parent; }
private:
friend struct Action;
@@ -131,14 +127,9 @@ private:
Action *findAction(const char *id);
const Action *findAction(const char *id) const;
- void internalMapKey(Action *action, HardwareKey *hwKey);
-
- Action *getParentMappedAction(KeyState key);
-
String _name;
- Keymap *_parent;
- List<Action*> _actions;
- HashMap<KeyState, Action*> _keymap;
+ List<Action *> _actions;
+ HashMap<KeyState, Action *> _keymap;
ConfigManager::Domain *_configDomain;
};
diff --git a/backends/keymapper/keymapper-defaults.h b/backends/keymapper/keymapper-defaults.h
new file mode 100644
index 0000000000..5b84ebeaa9
--- /dev/null
+++ b/backends/keymapper/keymapper-defaults.h
@@ -0,0 +1,56 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* 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.
+*
+*/
+
+#ifdef ENABLE_KEYMAPPER
+
+#ifndef KEYMAPPER_DEFAULTS_H
+#define KEYMAPPER_DEFAULTS_H
+
+#include "common/scummsys.h"
+#include "common/hashmap.h"
+#include "common/str.h"
+#include "common/hash-str.h"
+
+namespace Common {
+
+class KeymapperDefaultBindings : HashMap<String, String> {
+public:
+ /**
+ * This sets a default hwKey for a given Keymap Action
+ * @param keymapId String representing Keymap id (Keymap.name)
+ * @param actionId String representing Action id (Action.id)
+ * @param hwKeyId String representing the HardwareKey id (HardwareKey.hwKeyId)
+ */
+ void setDefaultBinding(String keymapId, String actionId, String hwKeyId) { setVal(keymapId + "_" + actionId, hwKeyId); }
+ /**
+ * This retrieves the assigned default hwKey for a given Keymap Action
+ * @param keymapId String representing Keymap id (Keymap.name)
+ * @param actionId String representing Action id (Action.id)
+ * @return hwKeyId String representing the HardwareKey id (HardwareKey.hwKeyId)
+ */
+ String getDefaultBinding(String keymapId, String actionId) { return getVal(keymapId + "_" + actionId); }
+};
+
+} //namespace Common
+
+#endif // #ifndef KEYMAPPER_DEFAULTS_H
+#endif // #ifdef ENABLE_KEYMAPPER
diff --git a/backends/keymapper/keymapper.cpp b/backends/keymapper/keymapper.cpp
index 025e917273..189f862469 100644
--- a/backends/keymapper/keymapper.cpp
+++ b/backends/keymapper/keymapper.cpp
@@ -104,7 +104,6 @@ void Keymapper::initKeymap(Domain &domain, Keymap *map) {
map->loadMappings(_hardwareKeys);
if (map->isComplete(_hardwareKeys) == false) {
- map->automaticMapping(_hardwareKeys);
map->saveMappings();
ConfMan.flushToDisk();
}
@@ -120,7 +119,7 @@ void Keymapper::cleanupGameKeymaps() {
// the game specific (=deleted) ones.
Stack<MapRecord> newStack;
- for (int i = 0; i < _activeMaps.size(); i++) {
+ for (Stack<MapRecord>::size_type i = 0; i < _activeMaps.size(); i++) {
if (_activeMaps[i].global)
newStack.push(_activeMaps[i]);
}
@@ -143,8 +142,10 @@ Keymap *Keymapper::getKeymap(const String& name, bool *globalReturn) {
return keymap;
}
-bool Keymapper::pushKeymap(const String& name, bool inherit) {
+bool Keymapper::pushKeymap(const String& name, bool transparent) {
bool global;
+
+ assert(!name.empty());
Keymap *newMap = getKeymap(name, &global);
if (!newMap) {
@@ -152,42 +153,61 @@ bool Keymapper::pushKeymap(const String& name, bool inherit) {
return false;
}
- pushKeymap(newMap, inherit, global);
+ pushKeymap(newMap, transparent, global);
return true;
}
-void Keymapper::pushKeymap(Keymap *newMap, bool inherit, bool global) {
- MapRecord mr = {newMap, inherit, global};
+void Keymapper::pushKeymap(Keymap *newMap, bool transparent, bool global) {
+ MapRecord mr = {newMap, transparent, global};
_activeMaps.push(mr);
}
-void Keymapper::popKeymap() {
- if (!_activeMaps.empty())
- _activeMaps.pop();
+void Keymapper::popKeymap(const char *name) {
+ if (!_activeMaps.empty()) {
+ if (name) {
+ String topKeymapName = _activeMaps.top().keymap->getName();
+ if (topKeymapName.equals(name))
+ _activeMaps.pop();
+ else
+ warning("An attempt to pop wrong keymap was blocked (expected %s but was %s)", name, topKeymapName.c_str());
+ } else {
+ _activeMaps.pop();
+ }
+ }
+
}
-bool Keymapper::notifyEvent(const Common::Event &ev) {
+List<Event> Keymapper::mapEvent(const Event &ev, EventSource *source) {
+ if (source && !source->allowMapping()) {
+ return DefaultEventMapper::mapEvent(ev, source);
+ }
+
+ List<Event> mappedEvents;
+
if (ev.type == Common::EVENT_KEYDOWN)
- return mapKeyDown(ev.kbd);
+ mappedEvents = mapKeyDown(ev.kbd);
else if (ev.type == Common::EVENT_KEYUP)
- return mapKeyUp(ev.kbd);
+ mappedEvents = mapKeyUp(ev.kbd);
+
+ if (!mappedEvents.empty())
+ return mappedEvents;
else
- return false;
+ return DefaultEventMapper::mapEvent(ev, source);
}
-bool Keymapper::mapKeyDown(const KeyState& key) {
+List<Event> Keymapper::mapKeyDown(const KeyState& key) {
return mapKey(key, true);
}
-bool Keymapper::mapKeyUp(const KeyState& key) {
+List<Event> Keymapper::mapKeyUp(const KeyState& key) {
return mapKey(key, false);
}
-bool Keymapper::mapKey(const KeyState& key, bool keyDown) {
+List<Event> Keymapper::mapKey(const KeyState& key, bool keyDown) {
if (!_enabled || _activeMaps.empty())
- return false;
+ return List<Event>();
Action *action = 0;
@@ -198,14 +218,14 @@ bool Keymapper::mapKey(const KeyState& key, bool keyDown) {
debug(5, "Keymapper::mapKey keymap: %s", mr.keymap->getName().c_str());
action = mr.keymap->getMappedAction(key);
- if (action || !mr.inherit)
+ if (action || !mr.transparent)
break;
}
if (action)
_keysDown[key] = action;
} else {
- HashMap<KeyState, Action*>::iterator it = _keysDown.find(key);
+ HashMap<KeyState, Action *>::iterator it = _keysDown.find(key);
if (it != _keysDown.end()) {
action = it->_value;
@@ -214,11 +234,9 @@ bool Keymapper::mapKey(const KeyState& key, bool keyDown) {
}
if (!action)
- return false;
+ return List<Event>();
- executeAction(action, keyDown);
-
- return true;
+ return executeAction(action, keyDown);
}
Action *Keymapper::getAction(const KeyState& key) {
@@ -227,7 +245,8 @@ Action *Keymapper::getAction(const KeyState& key) {
return action;
}
-void Keymapper::executeAction(const Action *action, bool keyDown) {
+List<Event> Keymapper::executeAction(const Action *action, bool keyDown) {
+ List<Event> mappedEvents;
List<Event>::const_iterator it;
for (it = action->events.begin(); it != action->events.end(); ++it) {
@@ -258,14 +277,18 @@ void Keymapper::executeAction(const Action *action, bool keyDown) {
case EVENT_MBUTTONUP:
if (keyDown) evt.type = EVENT_MBUTTONDOWN;
break;
+ case EVENT_MAINMENU:
+ if (!keyDown) evt.type = EVENT_MAINMENU;
+ break;
default:
// don't deliver other events on key up
if (!keyDown) continue;
}
evt.mouse = _eventMan->getMousePos();
- addEvent(evt);
+ mappedEvents.push_back(evt);
}
+ return mappedEvents;
}
const HardwareKey *Keymapper::findHardwareKey(const KeyState& key) {
diff --git a/backends/keymapper/keymapper.h b/backends/keymapper/keymapper.h
index d38109f210..31bfcbc080 100644
--- a/backends/keymapper/keymapper.h
+++ b/backends/keymapper/keymapper.h
@@ -37,13 +37,14 @@
namespace Common {
const char *const kGuiKeymapName = "gui";
+const char *const kGlobalKeymapName = "global";
-class Keymapper : public Common::EventMapper, private Common::ArtificialEventSource {
+class Keymapper : public Common::DefaultEventMapper {
public:
struct MapRecord {
Keymap* keymap;
- bool inherit;
+ bool transparent;
bool global;
};
@@ -76,6 +77,9 @@ public:
Keymapper(EventManager *eventMan);
~Keymapper();
+ // EventMapper interface
+ virtual List<Event> mapEvent(const Event &ev, EventSource *source);
+
/**
* Registers a HardwareKeySet with the Keymapper
* @note should only be called once (during backend initialisation)
@@ -85,7 +89,7 @@ public:
/**
* Get a list of all registered HardwareKeys
*/
- const List<const HardwareKey*> &getHardwareKeys() const {
+ const List<const HardwareKey *> &getHardwareKeys() const {
assert(_hardwareKeys);
return _hardwareKeys->getHardwareKeys();
}
@@ -121,21 +125,20 @@ public:
/**
* Push a new keymap to the top of the active stack, activating
* it for use.
- * @param name name of the keymap to push
- * @param inherit if true keymapper will iterate down the
- * stack if it cannot find a key in the new map
- * @return true if succesful
+ * @param name name of the keymap to push
+ * @param transparent if true keymapper will iterate down the
+ * stack if it cannot find a key in the new map
+ * @return true if succesful
*/
- bool pushKeymap(const String& name, bool inherit = false);
+ bool pushKeymap(const String& name, bool transparent = false);
/**
* Pop the top keymap off the active stack.
+ * @param name (optional) name of keymap expected to be popped
+ * if provided, will not pop unless name is the same
+ * as the top keymap
*/
- void popKeymap();
-
- // Implementation of the EventMapper interface
- bool notifyEvent(const Common::Event &ev);
- bool pollEvent(Common::Event &ev) { return Common::ArtificialEventSource::pollEvent(ev); }
+ void popKeymap(const char *name = 0);
/**
* @brief Map a key press event.
@@ -143,21 +146,21 @@ public:
* the Action's events are pushed into the EventManager's event queue.
* @param key key that was pressed
* @param keyDown true for key down, false for key up
- * @return true if key was mapped
+ * @return mapped events
*/
- bool mapKey(const KeyState& key, bool keyDown);
+ List<Event> mapKey(const KeyState& key, bool keyDown);
/**
* @brief Map a key down event.
* @see mapKey
*/
- bool mapKeyDown(const KeyState& key);
+ List<Event> mapKeyDown(const KeyState& key);
/**
* @brief Map a key up event.
* @see mapKey
*/
- bool mapKeyUp(const KeyState& key);
+ List<Event> mapKeyUp(const KeyState& key);
/**
* Enable/disable the keymapper
@@ -182,17 +185,17 @@ private:
HardwareKeySet *_hardwareKeys;
- void pushKeymap(Keymap *newMap, bool inherit, bool global);
+ void pushKeymap(Keymap *newMap, bool transparent, bool global);
Action *getAction(const KeyState& key);
- void executeAction(const Action *act, bool keyDown);
+ List<Event> executeAction(const Action *act, bool keyDown);
EventManager *_eventMan;
bool _enabled;
Stack<MapRecord> _activeMaps;
- HashMap<KeyState, Action*> _keysDown;
+ HashMap<KeyState, Action *> _keysDown;
};
diff --git a/backends/keymapper/remap-dialog.cpp b/backends/keymapper/remap-dialog.cpp
index c0654fc0ea..a869909196 100644
--- a/backends/keymapper/remap-dialog.cpp
+++ b/backends/keymapper/remap-dialog.cpp
@@ -39,7 +39,7 @@ enum {
};
RemapDialog::RemapDialog()
- : Dialog("KeyMapper"), _keymapTable(0), _activeRemapAction(0), _topAction(0), _remapTimeout(0) {
+ : Dialog("KeyMapper"), _keymapTable(0), _activeRemapAction(0), _topAction(0), _remapTimeout(0), _topKeymapIsGui(false) {
_keymapper = g_system->getEventManager()->getKeymapper();
assert(_keymapper);
@@ -57,12 +57,13 @@ RemapDialog::~RemapDialog() {
}
void RemapDialog::open() {
- bool divider = false;
const Stack<Keymapper::MapRecord> &activeKeymaps = _keymapper->getActiveStack();
if (activeKeymaps.size() > 0) {
- _kmPopUp->appendEntry(activeKeymaps.top().keymap->getName() + _(" (Active)"));
- divider = true;
+ if (activeKeymaps.top().keymap->getName() == Common::kGuiKeymapName)
+ _topKeymapIsGui = true;
+ // Add the entry for the "effective" special view. See RemapDialog::loadKeymap()
+ _kmPopUp->appendEntry(activeKeymaps.top().keymap->getName() + _(" (Effective)"));
}
Keymapper::Domain *_globalKeymaps = &_keymapper->getGlobalDomain();
@@ -84,27 +85,45 @@ void RemapDialog::open() {
keymapCount += _gameKeymaps->size();
}
+ if (activeKeymaps.size() > 1) {
+ keymapCount += activeKeymaps.size() - 1;
+ }
+
debug(3, "RemapDialog::open keymaps: %d", keymapCount);
- _keymapTable = (Keymap **)malloc(sizeof(Keymap*) * keymapCount);
+ _keymapTable = (Keymap **)malloc(sizeof(Keymap *) * keymapCount);
Keymapper::Domain::iterator it;
uint32 idx = 0;
+ if (activeKeymaps.size() > 1) {
+ int topIndex = activeKeymaps.size() - 1;
+ bool active = activeKeymaps[topIndex].transparent;
+ for (int i = topIndex - 1; i >= 0; --i) {
+ Keymapper::MapRecord mr = activeKeymaps[i];
+ // Add an entry for each keymap in the stack after the top keymap. Mark it Active if it is
+ // reachable or Blocked if an opaque keymap is on top of it thus blocking access to it.
+ _kmPopUp->appendEntry(mr.keymap->getName() + (active ? _(" (Active)") : _(" (Blocked)")), idx);
+ _keymapTable[idx++] = mr.keymap;
+ active &= mr.transparent;
+ }
+ }
+
+ _kmPopUp->appendEntry("");
+
+ // Now add entries for all known keymaps. Note that there will be duplicates with the stack entries.
+
if (_globalKeymaps) {
- if (divider)
- _kmPopUp->appendEntry("");
for (it = _globalKeymaps->begin(); it != _globalKeymaps->end(); ++it) {
+ // "global" means its keybindings apply to all games; saved in a global conf domain
_kmPopUp->appendEntry(it->_value->getName() + _(" (Global)"), idx);
_keymapTable[idx++] = it->_value;
}
- divider = true;
}
if (_gameKeymaps) {
- if (divider)
- _kmPopUp->appendEntry("");
for (it = _gameKeymaps->begin(); it != _gameKeymaps->end(); ++it) {
+ // "game" means its keybindings are saved per-target
_kmPopUp->appendEntry(it->_value->getName() + _(" (Game)"), idx);
_keymapTable[idx++] = it->_value;
}
@@ -149,7 +168,7 @@ void RemapDialog::reflowLayout() {
int labelWidth = colWidth - (keyButtonWidth + spacing + clearButtonWidth + spacing);
_rowCount = (areaH + spacing) / (buttonHeight + spacing);
- debug("rowCount = %d" , _rowCount);
+ debug(7, "rowCount = %d" , _rowCount);
if (colWidth <= 0 || _rowCount <= 0)
error("Remap dialog too small to display any keymaps");
@@ -302,19 +321,22 @@ void RemapDialog::loadKeymap() {
debug(3, "RemapDialog::loadKeymap active keymaps: %u", activeKeymaps.size());
if (!activeKeymaps.empty() && _kmPopUp->getSelected() == 0) {
- // load active keymaps
+ // This is the "effective" view which shows all effective actions:
+ // - all of the topmost keymap action
+ // - all mapped actions that are reachable
- List<const HardwareKey*> freeKeys(_keymapper->getHardwareKeys());
+ List<const HardwareKey *> freeKeys(_keymapper->getHardwareKeys());
int topIndex = activeKeymaps.size() - 1;
- // skip the top gui keymap since it is for the keymapper itself
- // TODO: Don't use the keymap name as a way to discriminate GUI maps
- if (topIndex > 0 && activeKeymaps[topIndex].keymap->getName().equals(kGuiKeymapName))
+
+ // This is a WORKAROUND for changing the popup list selected item and changing it back
+ // to the top entry. Upon changing it back, the top keymap is always "gui".
+ if (!_topKeymapIsGui && activeKeymaps[topIndex].keymap->getName() == kGuiKeymapName)
--topIndex;
// add most active keymap's keys
Keymapper::MapRecord top = activeKeymaps[topIndex];
- List<Action*>::iterator actIt;
+ List<Action *>::iterator actIt;
debug(3, "RemapDialog::loadKeymap top keymap: %s", top.keymap->getName().c_str());
for (actIt = top.keymap->getActions().begin(); actIt != top.keymap->getActions().end(); ++actIt) {
Action *act = *actIt;
@@ -327,11 +349,11 @@ void RemapDialog::loadKeymap() {
}
// loop through remaining finding mappings for unmapped keys
- if (top.inherit && topIndex >= 0) {
+ if (top.transparent && topIndex >= 0) {
for (int i = topIndex - 1; i >= 0; --i) {
Keymapper::MapRecord mr = activeKeymaps[i];
debug(3, "RemapDialog::loadKeymap keymap: %s", mr.keymap->getName().c_str());
- List<const HardwareKey*>::iterator keyIt = freeKeys.begin();
+ List<const HardwareKey *>::iterator keyIt = freeKeys.begin();
while (keyIt != freeKeys.end()) {
Action *act = mr.keymap->getMappedAction((*keyIt)->key);
@@ -345,15 +367,18 @@ void RemapDialog::loadKeymap() {
}
}
- if (mr.inherit == false || freeKeys.empty())
+ if (mr.transparent == false || freeKeys.empty())
break;
}
}
} else if (_kmPopUp->getSelected() != -1) {
+ // This is the regular view of a keymap that isn't the topmost one.
+ // It shows all of that keymap's actions
+
Keymap *km = _keymapTable[_kmPopUp->getSelectedTag()];
- List<Action*>::iterator it;
+ List<Action *>::iterator it;
for (it = km->getActions().begin(); it != km->getActions().end(); ++it) {
ActionInfo info = {*it, false, (*it)->description};
diff --git a/backends/keymapper/remap-dialog.h b/backends/keymapper/remap-dialog.h
index 1cb930bd42..143deca4cf 100644
--- a/backends/keymapper/remap-dialog.h
+++ b/backends/keymapper/remap-dialog.h
@@ -91,6 +91,8 @@ protected:
bool _changes;
+ bool _topKeymapIsGui;
+
};
} // End of namespace Common
diff --git a/backends/keymapper/types.h b/backends/keymapper/types.h
deleted file mode 100644
index ed2e498bd0..0000000000
--- a/backends/keymapper/types.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
-*
-* ScummVM is the legal property of its developers, whose names
-* are too numerous to list here. Please refer to the COPYRIGHT
-* file distributed with this source distribution.
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License
-* as published by the Free Software Foundation; either version 2
-* of the License, or (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* 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.
-*
-*/
-
-#ifndef KEYMAPPER_TYPES_H
-#define KEYMAPPER_TYPES_H
-
-#include "common/scummsys.h"
-
-#ifdef ENABLE_KEYMAPPER
-
-namespace Common {
-
-enum KeyType {
- kGenericKeyType,
- kDirUpKeyType,
- kDirDownKeyType,
- kDirLeftKeyType,
- kDirRightKeyType,
- kActionKeyType,
- kTriggerLeftKeyType,
- kTriggerRightKeyType,
- kStartKeyType,
- kSelectKeyType,
- /* ... */
-
- kKeyTypeMax
-};
-
-enum ActionType {
- kGenericActionType,
-
- // common actions
- kDirUpActionType,
- kDirDownActionType,
- kDirLeftActionType,
- kDirRightActionType,
- kLeftClickActionType,
- kRightClickActionType,
- kSaveActionType,
- kMenuActionType,
- kQuitActionType,
- kVirtualKeyboardActionType,
- kKeyRemapActionType,
- kVolumeUpActionType,
- kVolumeDownActionType,
-
-
- kActionTypeMax
-};
-
-} // End of namespace Common
-
-#endif // #ifdef ENABLE_KEYMAPPER
-
-#endif // #ifndef KEYMAPPER_TYPES_H
diff --git a/backends/midi/coreaudio.cpp b/backends/midi/coreaudio.cpp
index 4b707eace6..43c801287d 100644
--- a/backends/midi/coreaudio.cpp
+++ b/backends/midi/coreaudio.cpp
@@ -26,23 +26,37 @@
#ifdef MACOSX
+#include <AvailabilityMacros.h>
-// HACK to disable deprecated warnings under Mac OS X 10.5. Apple deprecated the
+// With the release of Mac OS X 10.5 in October 2007, Apple deprecated the
// AUGraphNewNode & AUGraphGetNodeInfo APIs in favor of the new AUGraphAddNode &
// AUGraphNodeInfo APIs. While it is easy to switch to those, it breaks
// compatibility with all pre-10.5 systems.
-// If you want to retain compatibility with old systems, enable the following
-// switch. But Apple will eventually remove these APIs, at which point the
-// switch needs to be disabled.
//
-// Also note that only the new API is available on the iPhone!
-#define USE_DEPRECATED_COREAUDIO_API
-
+// Since 10.5 was the last system to support PowerPC, we use the old, deprecated
+// APIs on PowerPC based systems by default. On all other systems (such as Mac
+// OS X running on Intel hardware, or iOS running on ARM), we use the new API by
+// default.
+//
+// This leaves Mac OS X 10.4 running on x86 processors as the only system
+// combination that this code will not support by default. It seems quite
+// reasonable to assume that anybody with an Intel system has since then moved
+// on to a newer Mac OS X release. But if for some reason you absolutely need to
+// build an x86 version of this code using the old, deprecated API, you can
+// simply do so by manually enable the USE_DEPRECATED_COREAUDIO_API switch (e.g.
+// by adding setting it suitably in CPPFLAGS).
+#if !defined(USE_DEPRECATED_COREAUDIO_API)
+ #if TARGET_CPU_PPC || TARGET_CPU_PPC64 || !defined(MAC_OS_X_VERSION_10_6)
+ #define USE_DEPRECATED_COREAUDIO_API 1
+ #else
+ #define USE_DEPRECATED_COREAUDIO_API 0
+ #endif
+#endif
-#ifdef USE_DEPRECATED_COREAUDIO_API
-#include <AvailabilityMacros.h>
-#undef DEPRECATED_ATTRIBUTE
-#define DEPRECATED_ATTRIBUTE
+#if USE_DEPRECATED_COREAUDIO_API
+ // Try to silence warnings about use of deprecated APIs
+ #undef DEPRECATED_ATTRIBUTE
+ #define DEPRECATED_ATTRIBUTE
#endif
@@ -114,7 +128,7 @@ int MidiDriver_CORE::open() {
RequireNoErr(NewAUGraph(&_auGraph));
AUNode outputNode, synthNode;
-#ifdef USE_DEPRECATED_COREAUDIO_API
+#if USE_DEPRECATED_COREAUDIO_API
ComponentDescription desc;
#else
AudioComponentDescription desc;
@@ -126,7 +140,7 @@ int MidiDriver_CORE::open() {
desc.componentManufacturer = kAudioUnitManufacturer_Apple;
desc.componentFlags = 0;
desc.componentFlagsMask = 0;
-#ifdef USE_DEPRECATED_COREAUDIO_API
+#if USE_DEPRECATED_COREAUDIO_API
RequireNoErr(AUGraphNewNode(_auGraph, &desc, 0, NULL, &outputNode));
#else
RequireNoErr(AUGraphAddNode(_auGraph, &desc, &outputNode));
@@ -136,7 +150,7 @@ int MidiDriver_CORE::open() {
desc.componentType = kAudioUnitType_MusicDevice;
desc.componentSubType = kAudioUnitSubType_DLSSynth;
desc.componentManufacturer = kAudioUnitManufacturer_Apple;
-#ifdef USE_DEPRECATED_COREAUDIO_API
+#if USE_DEPRECATED_COREAUDIO_API
RequireNoErr(AUGraphNewNode(_auGraph, &desc, 0, NULL, &synthNode));
#else
RequireNoErr(AUGraphAddNode(_auGraph, &desc, &synthNode));
@@ -150,7 +164,7 @@ int MidiDriver_CORE::open() {
RequireNoErr(AUGraphInitialize(_auGraph));
// Get the music device from the graph.
-#ifdef USE_DEPRECATED_COREAUDIO_API
+#if USE_DEPRECATED_COREAUDIO_API
RequireNoErr(AUGraphGetNodeInfo(_auGraph, synthNode, NULL, NULL, NULL, &_synth));
#else
RequireNoErr(AUGraphNodeInfo(_auGraph, synthNode, NULL, &_synth));
diff --git a/backends/modular-backend.h b/backends/modular-backend.h
index b864da0df5..072ee805b6 100644
--- a/backends/modular-backend.h
+++ b/backends/modular-backend.h
@@ -105,13 +105,6 @@ public:
//@}
- /** @name Events and Time */
- //@{
-
- virtual Common::HardwareKeySet *getHardwareKeySet() { return 0; }
-
- //@}
-
/** @name Mutex handling */
//@{
diff --git a/backends/module.mk b/backends/module.mk
index 6be595a65e..37209ffcef 100644
--- a/backends/module.mk
+++ b/backends/module.mk
@@ -98,6 +98,7 @@ MODULE_OBJS += \
fs/windows/windows-fs-factory.o \
midi/windows.o \
plugins/win32/win32-provider.o \
+ saves/windows/windows-saves.o \
taskbar/win32/win32-taskbar.o
endif
diff --git a/backends/mutex/null/null-mutex.h b/backends/mutex/null/null-mutex.h
index fdb32b241c..7ae10cedb8 100644
--- a/backends/mutex/null/null-mutex.h
+++ b/backends/mutex/null/null-mutex.h
@@ -28,7 +28,7 @@
/**
* Null mutex manager
*/
-class NullMutexManager : MutexManager {
+class NullMutexManager : public MutexManager {
public:
virtual OSystem::MutexRef createMutex() { return OSystem::MutexRef(); }
virtual void lockMutex(OSystem::MutexRef mutex) {}
diff --git a/backends/platform/android/android.cpp b/backends/platform/android/android.cpp
index aba31320ea..902599d50f 100644
--- a/backends/platform/android/android.cpp
+++ b/backends/platform/android/android.cpp
@@ -134,6 +134,7 @@ OSystem_Android::OSystem_Android(int audio_sample_rate, int audio_buffer_size) :
_enable_zoning(false),
_mixer(0),
_shake_offset(0),
+ _queuedEventTime(0),
_event_queue_lock(createMutex()),
_touch_pt_down(),
_touch_pt_scroll(),
diff --git a/backends/platform/android/android.h b/backends/platform/android/android.h
index f39a8f1144..47a6515a2a 100644
--- a/backends/platform/android/android.h
+++ b/backends/platform/android/android.h
@@ -220,6 +220,8 @@ public:
private:
Common::Queue<Common::Event> _event_queue;
+ Common::Event _queuedEvent;
+ uint32 _queuedEventTime;
MutexRef _event_queue_lock;
Common::Point _touch_pt_down, _touch_pt_scroll, _touch_pt_dt;
diff --git a/backends/platform/android/events.cpp b/backends/platform/android/events.cpp
index 2a16e69411..a58b93e3bb 100644
--- a/backends/platform/android/events.cpp
+++ b/backends/platform/android/events.cpp
@@ -211,11 +211,13 @@ static const Common::KeyCode jkeymap[] = {
};
// floating point. use sparingly
-template <class T>
+template<class T>
static inline T scalef(T in, float numerator, float denominator) {
return static_cast<float>(in) * numerator / denominator;
}
+static const int kQueuedInputEventDelay = 50;
+
void OSystem_Android::setupKeymapper() {
#ifdef ENABLE_KEYMAPPER
using namespace Common;
@@ -225,22 +227,19 @@ void OSystem_Android::setupKeymapper() {
HardwareKeySet *keySet = new HardwareKeySet();
keySet->addHardwareKey(
- new HardwareKey("n", KeyState(KEYCODE_n), "n (vk)",
- kTriggerLeftKeyType,
- kVirtualKeyboardActionType));
+ new HardwareKey("n", KeyState(KEYCODE_n), "n (vk)"));
mapper->registerHardwareKeySet(keySet);
- Keymap *globalMap = new Keymap("global");
+ Keymap *globalMap = new Keymap(kGlobalKeymapName);
Action *act;
- act = new Action(globalMap, "VIRT", "Display keyboard",
- kVirtualKeyboardActionType);
+ act = new Action(globalMap, "VIRT", "Display keyboard");
act->addKeyEvent(KeyState(KEYCODE_F7, ASCII_F7, 0));
mapper->addGlobalKeymap(globalMap);
- mapper->pushKeymap("global");
+ mapper->pushKeymap(kGlobalKeymapName);
#endif
}
@@ -601,13 +600,18 @@ void OSystem_Android::pushEvent(int type, int arg1, int arg2, int arg3,
lockMutex(_event_queue_lock);
+ if (_queuedEventTime)
+ _event_queue.push(_queuedEvent);
+
if (!_touchpad_mode)
_event_queue.push(e);
e.type = down;
_event_queue.push(e);
+
e.type = up;
- _event_queue.push(e);
+ _queuedEvent = e;
+ _queuedEventTime = getMillis() + kQueuedInputEventDelay;
unlockMutex(_event_queue_lock);
}
@@ -702,9 +706,14 @@ void OSystem_Android::pushEvent(int type, int arg1, int arg2, int arg3,
lockMutex(_event_queue_lock);
+ if (_queuedEventTime)
+ _event_queue.push(_queuedEvent);
+
_event_queue.push(e);
+
e.type = up;
- _event_queue.push(e);
+ _queuedEvent = e;
+ _queuedEventTime = getMillis() + kQueuedInputEventDelay;
unlockMutex(_event_queue_lock);
return;
@@ -800,6 +809,13 @@ bool OSystem_Android::pollEvent(Common::Event &event) {
lockMutex(_event_queue_lock);
+ if (_queuedEventTime && (getMillis() > _queuedEventTime)) {
+ event = _queuedEvent;
+ _queuedEventTime = 0;
+ unlockMutex(_event_queue_lock);
+ return true;
+ }
+
if (_event_queue.empty()) {
unlockMutex(_event_queue_lock);
return false;
diff --git a/backends/platform/android/texture.cpp b/backends/platform/android/texture.cpp
index e211e5941f..95c96e0d25 100644
--- a/backends/platform/android/texture.cpp
+++ b/backends/platform/android/texture.cpp
@@ -61,7 +61,7 @@ static inline GLfixed xdiv(int numerator, int denominator) {
return (numerator << 16) / denominator;
}
-template <class T>
+template<class T>
static T nextHigher2(T k) {
if (k == 0)
return 1;
diff --git a/backends/platform/bada/application.cpp b/backends/platform/bada/application.cpp
index bf585d2782..ba8e544983 100644
--- a/backends/platform/bada/application.cpp
+++ b/backends/platform/bada/application.cpp
@@ -68,7 +68,7 @@ void BadaScummVM::OnUserEventReceivedN(RequestId requestId,
// assertion failure termination
String *message = NULL;
if (args) {
- message = (String*)args->GetAt(0);
+ message = (String *)args->GetAt(0);
}
if (!message) {
message = new String("Unknown error");
diff --git a/backends/platform/bada/audio.cpp b/backends/platform/bada/audio.cpp
index b868e91357..65a5a80fa5 100644
--- a/backends/platform/bada/audio.cpp
+++ b/backends/platform/bada/audio.cpp
@@ -238,7 +238,7 @@ void AudioThread::OnAudioOutBufferEndReached(Osp::Media::AudioOut &src) {
void AudioThread::OnTimerExpired(Timer &timer) {
if (_ready < NUM_AUDIO_BUFFERS) {
uint len = _audioBuffer[_head].GetCapacity();
- int samples = _mixer->mixCallback((byte*)_audioBuffer[_head].GetPointer(), len);
+ int samples = _mixer->mixCallback((byte *)_audioBuffer[_head].GetPointer(), len);
if (samples) {
_head = (_head + 1) % NUM_AUDIO_BUFFERS;
_ready++;
diff --git a/backends/platform/bada/fs.cpp b/backends/platform/bada/fs.cpp
index 0ae0cde43d..37ca496d18 100644
--- a/backends/platform/bada/fs.cpp
+++ b/backends/platform/bada/fs.cpp
@@ -170,17 +170,17 @@ uint32 BadaFileStream::read(void *ptr, uint32 len) {
uint32 available = bufferLength - bufferIndex;
if (len <= available) {
// use allocation
- memcpy((byte*)ptr, &buffer[bufferIndex], len);
+ memcpy((byte *)ptr, &buffer[bufferIndex], len);
bufferIndex += len;
result = len;
} else {
// use remaining allocation
- memcpy((byte*)ptr, &buffer[bufferIndex], available);
+ memcpy((byte *)ptr, &buffer[bufferIndex], available);
uint32 remaining = len - available;
result = available;
if (remaining) {
- result += file->Read(((byte*)ptr) + available, remaining);
+ result += file->Read(((byte *)ptr) + available, remaining);
}
bufferIndex = bufferLength = 0;
}
@@ -192,11 +192,11 @@ uint32 BadaFileStream::read(void *ptr, uint32 len) {
if (bufferLength < len) {
len = bufferLength;
}
- memcpy((byte*)ptr, buffer, len);
+ memcpy((byte *)ptr, buffer, len);
result = bufferIndex = len;
}
} else {
- result = file->Read((byte*)ptr, len);
+ result = file->Read((byte *)ptr, len);
bufferIndex = bufferLength = 0;
}
} else {
diff --git a/backends/platform/bada/missing.cpp b/backends/platform/bada/missing.cpp
index a5433ec61a..10d45ca4b5 100644
--- a/backends/platform/bada/missing.cpp
+++ b/backends/platform/bada/missing.cpp
@@ -96,7 +96,7 @@ int sprintf(char *str, const char *format, ...) {
char *strdup(const char *strSource) {
char *buffer;
int len = strlen(strSource) + 1;
- buffer = (char*)malloc(len);
+ buffer = (char *)malloc(len);
if (buffer) {
memcpy(buffer, strSource, len);
}
diff --git a/backends/platform/bada/portdefs.h b/backends/platform/bada/portdefs.h
index 7d85a9ec35..813c5acde3 100644
--- a/backends/platform/bada/portdefs.h
+++ b/backends/platform/bada/portdefs.h
@@ -65,9 +65,9 @@ void stderr_vfprintf(void*, const char *format, va_list ap);
#undef fputs
#undef fflush
-#define stderr (void*)0
-#define stdout (void*)1
-#define stdin (void*)2
+#define stderr (void *)0
+#define stdout (void *)1
+#define stdin (void *)2
#define fputs(str, file)
#define fflush(file)
#define sscanf simple_sscanf
diff --git a/backends/platform/dc/audio.cpp b/backends/platform/dc/audio.cpp
index 35cb51f349..4f01531486 100644
--- a/backends/platform/dc/audio.cpp
+++ b/backends/platform/dc/audio.cpp
@@ -59,7 +59,7 @@ void OSystem_Dreamcast::checkSound()
if (n<100)
return;
- _mixer->mixCallback((byte*)temp_sound_buffer,
+ _mixer->mixCallback((byte *)temp_sound_buffer,
2*SAMPLES_TO_BYTES(n));
if (fillpos+n > curr_ring_buffer_samples) {
diff --git a/backends/platform/dc/dcloader.cpp b/backends/platform/dc/dcloader.cpp
index 675f7ad8c7..56193c282a 100644
--- a/backends/platform/dc/dcloader.cpp
+++ b/backends/platform/dc/dcloader.cpp
@@ -385,8 +385,8 @@ void *DLObject::symbol(const char *name)
for (int c = symbol_cnt; c--; s++)
if ((s->st_info>>4 == 1 || s->st_info>>4 == 2) &&
strtab[s->st_name] == '_' && !strcmp(name, strtab+s->st_name+1)) {
- DBG(("=> %p\n", (void*)s->st_value));
- return (void*)s->st_value;
+ DBG(("=> %p\n", (void *)s->st_value));
+ return (void *)s->st_value;
}
seterror("Symbol \"%s\" not found.", name);
diff --git a/backends/platform/dc/display.cpp b/backends/platform/dc/display.cpp
index 76658c6590..e886b55869 100644
--- a/backends/platform/dc/display.cpp
+++ b/backends/platform/dc/display.cpp
@@ -334,8 +334,8 @@ void OSystem_Dreamcast::updateScreenTextures(void)
unsigned short *dst = (unsigned short *)screen_tx[_screen_buffer];
unsigned char *src = screen;
- // while ((*((volatile unsigned int *)(void*)0xa05f810c) & 0x3ff) != 200);
- // *((volatile unsigned int *)(void*)0xa05f8040) = 0xff0000;
+ // while ((*((volatile unsigned int *)(void *)0xa05f810c) & 0x3ff) != 200);
+ // *((volatile unsigned int *)(void *)0xa05f8040) = 0xff0000;
if (_screenFormat == 0)
for ( int y = 0; y<_screen_h; y++ )
@@ -379,7 +379,7 @@ void OSystem_Dreamcast::updateScreenPolygons(void)
struct polygon_list mypoly;
struct packed_colour_vertex_list myvertex;
- // *((volatile unsigned int *)(void*)0xa05f8040) = 0x00ff00;
+ // *((volatile unsigned int *)(void *)0xa05f8040) = 0x00ff00;
mypoly.cmd =
TA_CMD_POLYGON|TA_CMD_POLYGON_TYPE_OPAQUE|TA_CMD_POLYGON_SUBLIST|
@@ -395,7 +395,7 @@ void OSystem_Dreamcast::updateScreenPolygons(void)
mypoly.red = mypoly.green = mypoly.blue = mypoly.alpha = 0;
ta_begin_frame();
- // *((volatile unsigned int *)(void*)0xa05f8040) = 0x0000ff;
+ // *((volatile unsigned int *)(void *)0xa05f8040) = 0x0000ff;
ta_commit_list(&mypoly);
myvertex.cmd = TA_CMD_VERTEX;
@@ -493,12 +493,12 @@ void OSystem_Dreamcast::updateScreenPolygons(void)
_softkbd.draw(330.0*sin(0.013*_softkbd_motion) - 320.0, 200.0,
120-_softkbd_motion);
- // *((volatile unsigned int *)(void*)0xa05f8040) = 0xffff00;
+ // *((volatile unsigned int *)(void *)0xa05f8040) = 0xffff00;
drawMouse(_ms_cur_x, _ms_cur_y, _ms_cur_w, _ms_cur_h, _ms_buf, _ms_visible);
- // *((volatile unsigned int *)(void*)0xa05f8040) = 0xff00ff;
+ // *((volatile unsigned int *)(void *)0xa05f8040) = 0xff00ff;
ta_commit_frame();
- // *((volatile unsigned int *)(void*)0xa05f8040) = 0x0;
+ // *((volatile unsigned int *)(void *)0xa05f8040) = 0x0;
_last_screen_refresh = Timer();
}
diff --git a/backends/platform/ds/arm7/source/main.cpp b/backends/platform/ds/arm7/source/main.cpp
index 2e9cacc669..6e714b22fa 100644
--- a/backends/platform/ds/arm7/source/main.cpp
+++ b/backends/platform/ds/arm7/source/main.cpp
@@ -46,10 +46,10 @@
#include "cartreset_nolibfat.h"
-#define TOUCH_CAL_X1 (*(vs16*)0x027FFCD8)
-#define TOUCH_CAL_Y1 (*(vs16*)0x027FFCDA)
-#define TOUCH_CAL_X2 (*(vs16*)0x027FFCDE)
-#define TOUCH_CAL_Y2 (*(vs16*)0x027FFCE0)
+#define TOUCH_CAL_X1 (*(vs16 *)0x027FFCD8)
+#define TOUCH_CAL_Y1 (*(vs16 *)0x027FFCDA)
+#define TOUCH_CAL_X2 (*(vs16 *)0x027FFCDE)
+#define TOUCH_CAL_Y2 (*(vs16 *)0x027FFCE0)
#define SCREEN_WIDTH 256
#define SCREEN_HEIGHT 192
s32 TOUCH_WIDTH = TOUCH_CAL_X2 - TOUCH_CAL_X1;
@@ -71,10 +71,10 @@ int temp;
int adpcmBufferNum = 0;
// those are pixel positions of the two points you click when calibrating
-#define TOUCH_CNTRL_X1 (*(vu8*)0x027FFCDC)
-#define TOUCH_CNTRL_Y1 (*(vu8*)0x027FFCDD)
-#define TOUCH_CNTRL_X2 (*(vu8*)0x027FFCE2)
-#define TOUCH_CNTRL_Y2 (*(vu8*)0x027FFCE3)
+#define TOUCH_CNTRL_X1 (*(vu8 *)0x027FFCDC)
+#define TOUCH_CNTRL_Y1 (*(vu8 *)0x027FFCDD)
+#define TOUCH_CNTRL_X2 (*(vu8 *)0x027FFCE2)
+#define TOUCH_CNTRL_Y2 (*(vu8 *)0x027FFCE3)
//////////////////////////////////////////////////////////////////////
@@ -330,7 +330,7 @@ void performSleep() {
// int saveInts = REG_IE;
// REG_IE = (1 << 22) | IRQ_VBLANK; // Lid open
-// *((u32*) (0x0380FFF8)) = *((u32*) (0x0380FFF8)) | (REG_IE & REG_IF);
+// *((u32 *) (0x0380FFF8)) = *((u32 *) (0x0380FFF8)) | (REG_IE & REG_IF);
// VBLANK_INTR_WAIT_FLAGS = IRQ_VBLANK;
diff --git a/backends/platform/ds/arm9/source/blitters.cpp b/backends/platform/ds/arm9/source/blitters.cpp
index 0076b302fd..1e8d56615d 100644
--- a/backends/platform/ds/arm9/source/blitters.cpp
+++ b/backends/platform/ds/arm9/source/blitters.cpp
@@ -222,8 +222,8 @@ static inline void RescaleBlock_5x1555_To_4x1555( u16 s0, u16 s1, u16 s2, u16 s3
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;
+ ((u32 *)dest)[0] = d10;
+ ((u32 *)dest)[1] = d32;
}
#else
static inline void RescaleBlock_5x1555_To_4x1555( u16 s0, u16 s1, u16 s2, u16 s3, u16 s4,
@@ -290,7 +290,7 @@ static inline void RescaleBlock_5x8888_To_4x1555( u32 s0, u32 s1, u32 s2, u32 s3
gd0 = DIV_BY_5[gd0]; gd1 = DIV_BY_5[gd1];
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;
+ ((u32 *)dest)[0] = d10;
u32 d2 = 2*s2 + 2*s3 + s3;
u32 d3 = s3 + 4*s4;
@@ -307,7 +307,7 @@ static inline void RescaleBlock_5x8888_To_4x1555( u32 s0, u32 s1, u32 s2, u32 s3
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;
+ ((u32 *)dest)[1] = d32;
}
// Can't work in place
@@ -377,7 +377,7 @@ void Rescale_320x256xPAL8_To_256x256x1555(u16 *dest, const u8 *src, int destStri
void Rescale_320x256xPAL8_To_256x256x1555(u16 *dest, const u8 *src, int destStride, int srcStride, const u16 *palette) {
u16 fastRam[256];
for (size_t i = 0; i < 128; ++i)
- ((u32*)fastRam)[i] = ((const u32*)palette)[i];
+ ((u32 *)fastRam)[i] = ((const u32*)palette)[i];
for (size_t i = 0; i < 200; ++i) {
Rescale_320xPAL8Scanline_To_256x1555Scanline(dest + i*destStride, src + i *srcStride, fastRam);
diff --git a/backends/platform/ds/arm9/source/dsmain.cpp b/backends/platform/ds/arm9/source/dsmain.cpp
index dfd906d816..cedbdcb167 100644
--- a/backends/platform/ds/arm9/source/dsmain.cpp
+++ b/backends/platform/ds/arm9/source/dsmain.cpp
@@ -926,7 +926,7 @@ void displayMode16Bit() {
SUB_BG0_Y0 = 0;
consoleInit(NULL, 0, BgType_Text4bpp, BgSize_T_256x256, 4, 0, false, true);
-// consoleInitDefault((u16*)SCREEN_BASE_BLOCK_SUB(4), (u16*)CHAR_BASE_BLOCK_SUB(0), 16);
+// consoleInitDefault((u16 *)SCREEN_BASE_BLOCK_SUB(4), (u16 *)CHAR_BASE_BLOCK_SUB(0), 16);
for (int r = 0; r < 32 * 32; r++) {
((u16 *) SCREEN_BASE_BLOCK_SUB(4))[r] = buffer[r];
@@ -2414,7 +2414,7 @@ void initHardware() {
BG_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);
+// consoleInitDefault((u16 *)SCREEN_BASE_BLOCK(0), (u16 *)CHAR_BASE_BLOCK(1), 16);
//consolePrintSet(0, 6);
//irqs are nice
@@ -2886,7 +2886,7 @@ void dsExceptionHandler() {
setExceptionHandler(NULL);
u32 currentMode = getCPSR() & 0x1f;
- u32 thumbState = ((*(u32*)0x027FFD90) & 0x20);
+ u32 thumbState = ((*(u32 *)0x027FFD90) & 0x20);
u32 codeAddress, exceptionAddress = 0;
diff --git a/backends/platform/gph/caanoo-bundle.mk b/backends/platform/gph/caanoo-bundle.mk
index 8aabca9028..2cf8e62b37 100755
--- a/backends/platform/gph/caanoo-bundle.mk
+++ b/backends/platform/gph/caanoo-bundle.mk
@@ -14,11 +14,11 @@ caanoo-bundle: $(EXECUTABLE)
echo "Please put your save games in this dir" >> "$(bundle_name)/scummvm/saves/PUT_SAVES_IN_THIS_DIR"
- $(CP) $(srcdir)/backends/platform/gph/devices/caanoo/scummvm.gpe $(bundle_name)/scummvm/
- $(CP) $(srcdir)/backends/platform/gph/devices/common/scummvm.png $(bundle_name)/scummvm/
- $(CP) $(srcdir)/backends/platform/gph/devices/common/scummvmb.png $(bundle_name)/scummvm/
- $(CP) $(srcdir)/backends/platform/gph/devices/common/README-GPH $(bundle_name)/scummvm/
- $(CP) $(srcdir)/backends/platform/gph/devices/common/scummvm.ini $(bundle_name)/
+ $(CP) $(srcdir)/dists/gph/caanoo/scummvm.gpe $(bundle_name)/scummvm/
+ $(CP) $(srcdir)/dists/gph/scummvm.png $(bundle_name)/scummvm/
+ $(CP) $(srcdir)/dists/gph/scummvmb.png $(bundle_name)/scummvm/
+ $(CP) $(srcdir)/dists/gph/README-GPH $(bundle_name)/scummvm/
+ $(CP) $(srcdir)/dists/gph/scummvm.ini $(bundle_name)/
$(INSTALL) -c -m 644 $(DIST_FILES_DOCS) $(bundle_name)/scummvm/
$(INSTALL) -c -m 644 $(DIST_FILES_THEMES) $(bundle_name)/scummvm/
@@ -45,11 +45,11 @@ caanoo-bundle-debug: $(EXECUTABLE)
echo "Please put your save games in this dir" >> "$(bundle_name)/scummvm/saves/PUT_SAVES_IN_THIS_DIR"
- $(CP) $(srcdir)/backends/platform/gph/devices/caanoo/scummvm-gdb.gpe $(bundle_name)/scummvm/scummvm.gpe
- $(CP) $(srcdir)/backends/platform/gph/devices/common/scummvm.png $(bundle_name)/scummvm/
- $(CP) $(srcdir)/backends/platform/gph/devices/common/scummvmb.png $(bundle_name)/scummvm/
- $(CP) $(srcdir)/backends/platform/gph/devices/common/README-GPH $(bundle_name)/scummvm/
- $(CP) $(srcdir)/backends/platform/gph/devices/common/scummvm.ini $(bundle_name)/
+ $(CP) $(srcdir)/dists/gph/caanoo/scummvm-gdb.gpe $(bundle_name)/scummvm/scummvm.gpe
+ $(CP) $(srcdir)/dists/gph/scummvm.png $(bundle_name)/scummvm/
+ $(CP) $(srcdir)/dists/gph/scummvmb.png $(bundle_name)/scummvm/
+ $(CP) $(srcdir)/dists/gph/README-GPH $(bundle_name)/scummvm/
+ $(CP) $(srcdir)/dists/gph/scummvm.ini $(bundle_name)/
$(INSTALL) -c -m 644 $(DIST_FILES_DOCS) $(bundle_name)/scummvm/
$(INSTALL) -c -m 644 $(DIST_FILES_THEMES) $(bundle_name)/scummvm/
diff --git a/backends/platform/gph/gp2x-bundle.mk b/backends/platform/gph/gp2x-bundle.mk
index 810ff8b8f0..9fcb379e04 100644
--- a/backends/platform/gph/gp2x-bundle.mk
+++ b/backends/platform/gph/gp2x-bundle.mk
@@ -12,15 +12,15 @@ gp2x-bundle: $(EXECUTABLE)
echo "Please put your save games in this dir" >> "$(bundle_name)/saves/PUT_SAVES_IN_THIS_DIR"
- $(CP) $(srcdir)/backends/platform/gph/devices/gp2x/scummvm.gpe $(bundle_name)/
- $(CP) $(srcdir)/backends/platform/gph/devices/common/scummvm.png $(bundle_name)/
- $(CP) $(srcdir)/backends/platform/gph/devices/common/README-GPH $(bundle_name)/
- $(CP) $(srcdir)/backends/platform/gph/devices/gp2x/mmuhack/mmuhack.o $(bundle_name)/
+ $(CP) $(srcdir)/dists/gph/gp2x/scummvm.gpe $(bundle_name)
+ $(CP) $(srcdir)/dists/gph/scummvm.png $(bundle_name)
+ $(CP) $(srcdir)/dists/gph/README-GPH $(bundle_name)
+ $(CP) $(srcdir)/dists/gph/gp2x/mmuhack/mmuhack.o $(bundle_name)
- $(INSTALL) -c -m 644 $(DIST_FILES_DOCS) $(bundle_name)/
- $(INSTALL) -c -m 644 $(DIST_FILES_THEMES) $(bundle_name)/
+ $(INSTALL) -c -m 644 $(DIST_FILES_DOCS) $(bundle_name)
+ $(INSTALL) -c -m 644 $(DIST_FILES_THEMES) $(bundle_name)
$(INSTALL) -c -m 644 $(DIST_FILES_ENGINEDATA) $(bundle_name)/engine-data
- $(CP) $(srcdir)/backends/vkeybd/packs/vkeybd_default.zip $(bundle_name)/
+ $(CP) $(srcdir)/backends/vkeybd/packs/vkeybd_default.zip $(bundle_name)
$(STRIP) $(EXECUTABLE) -o $(bundle_name)/$(EXECUTABLE)
@@ -39,18 +39,19 @@ gp2x-bundle-debug: $(EXECUTABLE)
$(MKDIR) "$(bundle_name)"
$(MKDIR) "$(bundle_name)/saves"
$(MKDIR) "$(bundle_name)/engine-data"
+ $(MKDIR) "$(bundle_name)/lib"
echo "Please put your save games in this dir" >> "$(bundle_name)/saves/PUT_SAVES_IN_THIS_DIR"
- $(CP) $(srcdir)/backends/platform/gph/devices/gp2x/scummvm.gpe $(bundle_name)/
- $(CP) $(srcdir)/backends/platform/gph/devices/common/scummvm.png $(bundle_name)/
- $(CP) $(srcdir)/backends/platform/gph/devices/common/README-GPH $(bundle_name)/
- $(CP) $(srcdir)/backends/platform/gph/devices/gp2x/mmuhack/mmuhack.o $(bundle_name)/
+ $(CP) $(srcdir)/dists/gph/gp2x/scummvm.gpe $(bundle_name)
+ $(CP) $(srcdir)/dists/gph/scummvm.png $(bundle_name)
+ $(CP) $(srcdir)/dists/gph/README-GPH $(bundle_name)
+ $(CP) $(srcdir)/dists/gph/gp2x/mmuhack/mmuhack.o $(bundle_name)
- $(INSTALL) -c -m 644 $(DIST_FILES_DOCS) $(bundle_name)/
- $(INSTALL) -c -m 644 $(DIST_FILES_THEMES) $(bundle_name)/
+ $(INSTALL) -c -m 644 $(DIST_FILES_DOCS) $(bundle_name)
+ $(INSTALL) -c -m 644 $(DIST_FILES_THEMES) $(bundle_name)
$(INSTALL) -c -m 644 $(DIST_FILES_ENGINEDATA) $(bundle_name)/engine-data
- $(CP) $(srcdir)/backends/vkeybd/packs/vkeybd_default.zip $(bundle_name)/
+ $(CP) $(srcdir)/backends/vkeybd/packs/vkeybd_default.zip $(bundle_name)
$(INSTALL) -c -m 777 $(srcdir)/$(EXECUTABLE) $(bundle_name)/$(EXECUTABLE)
diff --git a/backends/platform/gph/gp2xwiz-bundle.mk b/backends/platform/gph/gp2xwiz-bundle.mk
index 65e2952fde..4f49850813 100755
--- a/backends/platform/gph/gp2xwiz-bundle.mk
+++ b/backends/platform/gph/gp2xwiz-bundle.mk
@@ -13,11 +13,11 @@ gp2xwiz-bundle: $(EXECUTABLE)
echo "Please put your save games in this dir" >> "$(bundle_name)/scummvm/saves/PUT_SAVES_IN_THIS_DIR"
- $(CP) $(srcdir)/backends/platform/gph/devices/gp2xwiz/scummvm.gpe $(bundle_name)/scummvm/
- $(CP) $(srcdir)/backends/platform/gph/devices/common/scummvm.png $(bundle_name)/scummvm/
- $(CP) $(srcdir)/backends/platform/gph/devices/common/scummvmb.png $(bundle_name)/scummvm/
- $(CP) $(srcdir)/backends/platform/gph/devices/common/README-GPH $(bundle_name)/scummvm/
- $(CP) $(srcdir)/backends/platform/gph/devices/common/scummvm.ini $(bundle_name)/
+ $(CP) $(srcdir)/dists/gph/gp2xwiz/scummvm.gpe $(bundle_name)/scummvm/
+ $(CP) $(srcdir)/dists/gph/scummvm.png $(bundle_name)/scummvm/
+ $(CP) $(srcdir)/dists/gph/scummvmb.png $(bundle_name)/scummvm/
+ $(CP) $(srcdir)/dists/gph/README-GPH $(bundle_name)/scummvm/
+ $(CP) $(srcdir)/dists/gph/scummvm.ini $(bundle_name)/
$(INSTALL) -c -m 644 $(DIST_FILES_DOCS) $(bundle_name)/scummvm/
$(INSTALL) -c -m 644 $(DIST_FILES_THEMES) $(bundle_name)/scummvm/
@@ -47,11 +47,11 @@ gp2xwiz-bundle-debug: $(EXECUTABLE)
echo "Please put your save games in this dir" >> "$(bundle_name)/scummvm/saves/PUT_SAVES_IN_THIS_DIR"
- $(CP) $(srcdir)/backends/platform/gph/devices/gp2xwiz/scummvm-gdb.gpe $(bundle_name)/scummvm/scummvm.gpe
- $(CP) $(srcdir)/backends/platform/gph/devices/common/scummvm.png $(bundle_name)/scummvm/
- $(CP) $(srcdir)/backends/platform/gph/devices/common/scummvmb.png $(bundle_name)/scummvm/
- $(CP) $(srcdir)/backends/platform/gph/devices/common/README-GPH $(bundle_name)/scummvm/
- $(CP) $(srcdir)/backends/platform/gph/devices/common/scummvm.ini $(bundle_name)/
+ $(CP) $(srcdir)/dists/gph/gp2xwiz/scummvm-gdb.gpe $(bundle_name)/scummvm/scummvm.gpe
+ $(CP) $(srcdir)/dists/gph/scummvm.png $(bundle_name)/scummvm/
+ $(CP) $(srcdir)/dists/gph/scummvmb.png $(bundle_name)/scummvm/
+ $(CP) $(srcdir)/dists/gph/README-GPH $(bundle_name)/scummvm/
+ $(CP) $(srcdir)/dists/gph/scummvm.ini $(bundle_name)/
$(INSTALL) -c -m 644 $(DIST_FILES_DOCS) $(bundle_name)/scummvm/
$(INSTALL) -c -m 644 $(DIST_FILES_THEMES) $(bundle_name)/scummvm/
diff --git a/backends/platform/iphone/blit_arm.s b/backends/platform/iphone/blit_arm.s
deleted file mode 100644
index 04f9a87614..0000000000
--- a/backends/platform/iphone/blit_arm.s
+++ /dev/null
@@ -1,137 +0,0 @@
-@ ScummVM - Graphic Adventure Engine
-@
-@ ScummVM is the legal property of its developers, whose names
-@ are too numerous to list here. Please refer to the COPYRIGHT
-@ file distributed with this source distribution.
-@
-@ This program is free software@ you can redistribute it and/or
-@ modify it under the terms of the GNU General Public License
-@ as published by the Free Software Foundation@ either version 2
-@ of the License, or (at your option) any later version.
-@
-@ This program is distributed in the hope that it will be useful,
-@ 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.
-@
-@ @author Robin Watts (robin@wss.co.uk)
-
- .text
-
- .global _blitLandscapeScreenRect16bpp
- .global _blitLandscapeScreenRect8bpp
-
-
-_blitLandscapeScreenRect16bpp:
- @ r0 = dst
- @ r1 = src
- @ r2 = w
- @ r3 = h
- @ <> = _screenWidth
- @ <> = _screenHeight
- mov r12,r13
- stmfd r13!,{r4-r11,r14}
- ldmfd r12,{r12,r14} @ r12 = _screenWidth
- @ r14 = _screenHeight
- add r14,r14,r3 @ r14 = _screenHeight + h
- mvn r11,#0
- mla r11,r3,r12,r11 @ r11= _screenWidth*h-1
- add r12,r12,r12
-xloop:
- subs r4,r3,#5 @ r4 = y = h
- ble thin
-yloop:
- ldrh r5, [r1],r12 @ r5 = *src src += _screenWidth
- ldrh r6, [r1],r12 @ r6 = *src src += _screenWidth
- ldrh r7, [r1],r12 @ r7 = *src src += _screenWidth
- ldrh r8, [r1],r12 @ r8 = *src src += _screenWidth
- ldrh r9, [r1],r12 @ r9 = *src src += _screenWidth
- ldrh r10,[r1],r12 @ r10= *src src += _screenWidth
- subs r4,r4,#6
- strh r5, [r0],#2 @ *dst++ = r5
- strh r6, [r0],#2 @ *dst++ = r6
- strh r7, [r0],#2 @ *dst++ = r7
- strh r8, [r0],#2 @ *dst++ = r8
- strh r9, [r0],#2 @ *dst++ = r9
- strh r10,[r0],#2 @ *dst++ = r10
- bgt yloop
-thin:
- adds r4,r4,#5
- beq lineend
-thin_loop:
- ldrh r5,[r1],r12 @ r5 = *src src += _screenWidth
- subs r4,r4,#1
- strh r5,[r0],#2 @ *dst++ = r5
- bgt thin_loop
-lineend:
- sub r0,r0,r14,LSL #1 @ dst -= _screenHeight + h
- sub r1,r1,r11,LSL #1 @ src += 1-_screenWidth*h
- subs r2,r2,#1
- bgt xloop
-
- ldmfd r13!,{r4-r11,PC}
-
-_blitLandscapeScreenRect8bpp:
- @ r0 = dst
- @ r1 = src
- @ r2 = w
- @ r3 = h
- @ <> = _palette
- @ <> = _screenWidth
- @ <> = _screenHeight
- mov r12,r13
- stmfd r13!,{r4-r11,r14}
- ldmfd r12,{r11,r12,r14} @ r11 = _palette
- @ r12 = _screenWidth
- @ r14 = _screenHeight
- add r14,r14,r3 @ r14 = _screenHeight + h
- mvn r6,#0
- mla r6,r3,r12,r6 @ r6 = _screenWidth*h-1
-xloop8:
- mov r4,r3 @ r4 = y = h
- subs r4,r3,#4 @ r4 = y = h
- ble thin8
-yloop8:
- ldrb r5, [r1],r12 @ r5 = *src src += _screenWidth
- ldrb r7, [r1],r12 @ r7 = *src src += _screenWidth
- ldrb r8, [r1],r12 @ r8 = *src src += _screenWidth
- ldrb r9, [r1],r12 @ r9 = *src src += _screenWidth
- ldrb r10,[r1],r12 @ r10= *src src += _screenWidth
- add r5, r5, r5
- add r7, r7, r7
- add r8, r8, r8
- add r9, r9, r9
- add r10,r10,r10
- ldrh r5, [r11,r5]
- ldrh r7, [r11,r7]
- ldrh r8, [r11,r8]
- ldrh r9, [r11,r9]
- ldrh r10,[r11,r10]
- subs r4,r4,#5
- strh r5, [r0],#2 @ *dst++ = r5
- strh r7, [r0],#2 @ *dst++ = r7
- strh r8, [r0],#2 @ *dst++ = r8
- strh r9, [r0],#2 @ *dst++ = r9
- strh r10,[r0],#2 @ *dst++ = r10
- bgt yloop8
-thin8:
- adds r4,r4,#4
- beq lineend8
-thin_loop8:
- ldrb r5,[r1],r12 @ r5 = *src src += _screenWidth
- add r5,r5,r5
- ldrh r5,[r11,r5]
- subs r4,r4,#1
- strh r5,[r0],#2 @ *dst++ = r5
- bgt thin_loop8
-lineend8:
- sub r0,r0,r14,LSL #1 @ dst -= _screenHeight + h
- sub r1,r1,r6 @ src += 1-_screenWidth*h
- subs r2,r2,#1
- bgt xloop8
-
- ldmfd r13!,{r4-r11,PC}
diff --git a/backends/platform/iphone/iphone_common.h b/backends/platform/iphone/iphone_common.h
index 0cbcb77bcb..6e97d9d853 100644
--- a/backends/platform/iphone/iphone_common.h
+++ b/backends/platform/iphone/iphone_common.h
@@ -20,6 +20,10 @@
*
*/
+#ifndef BACKENDS_PLATFORM_IPHONE_IPHONE_COMMON_H
+#define BACKENDS_PLATFORM_IPHONE_IPHONE_COMMON_H
+
+#include "graphics/surface.h"
enum InputEvent {
kInputMouseDown,
@@ -41,43 +45,52 @@ enum ScreenOrientation {
kScreenOrientationFlippedLandscape
};
-typedef enum
-{
+enum UIViewSwipeDirection {
kUIViewSwipeUp = 1,
kUIViewSwipeDown = 2,
kUIViewSwipeLeft = 4,
kUIViewSwipeRight = 8
-} UIViewSwipeDirection;
+};
-#ifdef IPHONE_OFFICIAL
-void iphone_main(int argc, char **argv);
-#endif
+enum GraphicsModes {
+ kGraphicsModeLinear = 0,
+ kGraphicsModeNone = 1
+};
-// We need this to be able to call functions from/in Objective-C.
-#ifdef __cplusplus
-extern "C" {
-#endif
+struct VideoContext {
+ VideoContext() : screenWidth(), screenHeight(), overlayVisible(false),
+ overlayWidth(), overlayHeight(), mouseX(), mouseY(),
+ mouseHotspotX(), mouseHotspotY(), mouseWidth(), mouseHeight(),
+ mouseIsVisible(), graphicsMode(kGraphicsModeLinear), shakeOffsetY() {
+ }
-// On the C++ side
-#ifndef IPHONE_OFFICIAL
-void iphone_main(int argc, char *argv[]);
-#endif
+ // Game screen state
+ uint screenWidth, screenHeight;
+ Graphics::Surface screenTexture;
+
+ // Overlay state
+ bool overlayVisible;
+ uint overlayWidth, overlayHeight;
+ Graphics::Surface overlayTexture;
+
+ // Mouse cursor state
+ uint mouseX, mouseY;
+ int mouseHotspotX, mouseHotspotY;
+ uint mouseWidth, mouseHeight;
+ bool mouseIsVisible;
+
+ // Misc state
+ GraphicsModes graphicsMode;
+ int shakeOffsetY;
+};
// On the ObjC side
-void iPhone_updateScreen(int mouseX, int mouseY);
-void iPhone_updateScreenRect(unsigned short* screen, int x1, int y1, int x2, int y2);
-void iPhone_updateOverlayRect(unsigned short* screen, int x1, int y1, int x2, int y2);
-void iPhone_initSurface(int width, int height);
-bool iPhone_fetchEvent(int *outEvent, float *outX, float *outY);
-const char* iPhone_getDocumentsDir();
+void iPhone_updateScreen();
+bool iPhone_fetchEvent(int *outEvent, int *outX, int *outY);
+const char *iPhone_getDocumentsDir();
bool iPhone_isHighResDevice();
-int iPhone_getScreenHeight();
-int iPhone_getScreenWidth();
-void iPhone_enableOverlay(int state);
-void iPhone_setMouseCursor(short* buffer, int width, int height);
+void iPhone_setMouseCursor(unsigned short *buffer);
uint getSizeNextPOT(uint size);
-#ifdef __cplusplus
-}
#endif
diff --git a/backends/platform/iphone/iphone_keyboard.h b/backends/platform/iphone/iphone_keyboard.h
index eecad09398..2d1238c92f 100644
--- a/backends/platform/iphone/iphone_keyboard.h
+++ b/backends/platform/iphone/iphone_keyboard.h
@@ -20,17 +20,22 @@
*
*/
-#import <UIKit/UIKit.h>
-#import <UIKit/UITextView.h>
+#ifndef BACKENDS_PLATFORM_IPHONE_IPHONE_KEYBOARD_H
+#define BACKENDS_PLATFORM_IPHONE_IPHONE_KEYBOARD_H
+
+#include <UIKit/UIKit.h>
+#include <UIKit/UITextView.h>
@interface SoftKeyboard : UIView {
id inputDelegate;
- UITextView* inputView;
+ UITextView *inputView;
}
- (id)initWithFrame:(CGRect)frame;
-- (UITextView*)inputView;
+- (UITextView *)inputView;
- (void)setInputDelegate:(id)delegate;
- (void)handleKeyPress:(unichar)c;
@end
+
+#endif
diff --git a/backends/platform/iphone/iphone_keyboard.m b/backends/platform/iphone/iphone_keyboard.mm
index 1624d02977..b00930ab31 100644
--- a/backends/platform/iphone/iphone_keyboard.m
+++ b/backends/platform/iphone/iphone_keyboard.mm
@@ -20,7 +20,7 @@
*
*/
-#import "iphone_keyboard.h"
+#include "iphone_keyboard.h"
@interface UITextInputTraits
- (void)setAutocorrectionType:(int)type;
@@ -29,17 +29,17 @@
@end
@interface TextInputHandler : UITextView {
- SoftKeyboard* softKeyboard;
+ SoftKeyboard *softKeyboard;
}
-- (id)initWithKeyboard:(SoftKeyboard*)keyboard;
+- (id)initWithKeyboard:(SoftKeyboard *)keyboard;
@end
@implementation TextInputHandler
-- (id)initWithKeyboard:(SoftKeyboard*)keyboard; {
+- (id)initWithKeyboard:(SoftKeyboard *)keyboard; {
self = [super initWithFrame:CGRectMake(0.0f, 0.0f, 0.0f, 0.0f)];
softKeyboard = keyboard;
@@ -80,7 +80,7 @@
return self;
}
-- (UITextView*)inputView {
+- (UITextView *)inputView {
return inputView;
}
diff --git a/backends/platform/iphone/iphone_main.m b/backends/platform/iphone/iphone_main.mm
index c2ec328bf5..20406e6342 100644
--- a/backends/platform/iphone/iphone_main.m
+++ b/backends/platform/iphone/iphone_main.mm
@@ -20,38 +20,41 @@
*
*/
-#import <UIKit/UIKit.h>
-#import <Foundation/NSThread.h>
+// Disable symbol overrides so that we can use system headers.
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+
+#include <UIKit/UIKit.h>
+#include <Foundation/NSThread.h>
#include "iphone_video.h"
void iphone_main(int argc, char *argv[]);
@interface iPhoneMain : UIApplication {
- UIWindow* _window;
- iPhoneView* _view;
+ UIWindow *_window;
+ iPhoneView *_view;
}
-- (void) mainLoop: (id)param;
-- (iPhoneView*) getView;
-- (UIWindow*) getWindow;
+- (void)mainLoop:(id)param;
+- (iPhoneView *)getView;
+- (UIWindow *)getWindow;
- (void)didRotate:(NSNotification *)notification;
@end
static int gArgc;
-static char** gArgv;
+static char **gArgv;
-int main(int argc, char** argv) {
+int main(int argc, char **argv) {
gArgc = argc;
gArgv = argv;
- NSAutoreleasePool *autoreleasePool = [
- [ NSAutoreleasePool alloc ] init
- ];
+ NSAutoreleasePool *autoreleasePool = [
+ [NSAutoreleasePool alloc] init
+ ];
- int returnCode = UIApplicationMain(argc, argv, @"iPhoneMain", @"iPhoneMain");
- [ autoreleasePool release ];
- return returnCode;
+ int returnCode = UIApplicationMain(argc, argv, @"iPhoneMain", @"iPhoneMain");
+ [autoreleasePool release];
+ return returnCode;
}
@implementation iPhoneMain
@@ -63,14 +66,14 @@ int main(int argc, char** argv) {
return self;
}
-- (void) mainLoop: (id)param {
+- (void)mainLoop:(id)param {
[[NSAutoreleasePool alloc] init];
iphone_main(gArgc, gArgv);
exit(0);
}
-- (iPhoneView*) getView {
+- (iPhoneView *)getView {
return _view;
}
@@ -78,38 +81,36 @@ int main(int argc, char** argv) {
CGRect rect = [[UIScreen mainScreen] bounds];
// hide the status bar
- [application setStatusBarStyle:UIStatusBarStyleBlackTranslucent animated:NO];
- [application setStatusBarHidden:YES animated:YES];
+ [application setStatusBarStyle:UIStatusBarStyleBlackTranslucent animated:NO];
+ [application setStatusBarHidden:YES animated:YES];
_window = [[UIWindow alloc] initWithFrame:rect];
[_window retain];
- _view = [[iPhoneView alloc] initWithFrame: rect];
+ _view = [[iPhoneView alloc] initWithFrame:rect];
_view.multipleTouchEnabled = YES;
- [_window setContentView: _view];
+ [_window setContentView:_view];
[_window addSubview:_view];
[_window makeKeyAndVisible];
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
[[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(didRotate:)
- name:@"UIDeviceOrientationDidChangeNotification" object:nil];
+ selector:@selector(didRotate:)
+ name:@"UIDeviceOrientationDidChangeNotification"
+ object:nil];
[NSThread detachNewThreadSelector:@selector(mainLoop:) toTarget:self withObject:nil];
}
-- (void)applicationDidResume
-{
+- (void)applicationDidResume {
}
-- (void)applicationWillSuspend
-{
+- (void)applicationWillSuspend {
}
-- (void)applicationWillTerminate
-{
+- (void)applicationWillTerminate {
}
- (void)applicationSuspend:(struct __GSEvent *)event {
@@ -122,14 +123,14 @@ int main(int argc, char** argv) {
// Workaround, need to "hide" and unhide the statusbar to properly remove it,
// since the Springboard has put it back without apparently flagging our application.
- [self setStatusBarHidden:YES animated:YES];
- [self setStatusBarStyle:UIStatusBarStyleBlackTranslucent animated:NO];
- [self setStatusBarHidden:YES animated:YES];
+ [self setStatusBarHidden:YES animated:YES];
+ [self setStatusBarStyle:UIStatusBarStyleBlackTranslucent animated:NO];
+ [self setStatusBarHidden:YES animated:YES];
}
- (void)didRotate:(NSNotification *)notification {
- int screenOrientation = [[UIDevice currentDevice] orientation];
- [_view deviceOrientationChanged: screenOrientation];
+ UIDeviceOrientation screenOrientation = [[UIDevice currentDevice] orientation];
+ [_view deviceOrientationChanged:screenOrientation];
}
- (UIWindow*) getWindow {
diff --git a/backends/platform/iphone/iphone_video.h b/backends/platform/iphone/iphone_video.h
index 223f025978..1d9d7e7d35 100644
--- a/backends/platform/iphone/iphone_video.h
+++ b/backends/platform/iphone/iphone_video.h
@@ -20,48 +20,52 @@
*
*/
-#ifndef _IPHONE_VIDEO__H
-#define _IPHONE_VIDEO__H
+#ifndef BACKENDS_PLATFORM_IPHONE_IPHONE_VIDEO_H
+#define BACKENDS_PLATFORM_IPHONE_IPHONE_VIDEO_H
-#import <UIKit/UIKit.h>
-#import <Foundation/Foundation.h>
-#import <QuartzCore/QuartzCore.h>
+#include <UIKit/UIKit.h>
+#include <Foundation/Foundation.h>
+#include <QuartzCore/QuartzCore.h>
-#import <OpenGLES/EAGL.h>
-#import <OpenGLES/ES1/gl.h>
-#import <OpenGLES/ES1/glext.h>
+#include <OpenGLES/EAGL.h>
+#include <OpenGLES/ES1/gl.h>
+#include <OpenGLES/ES1/glext.h>
-#import "iphone_keyboard.h"
+#include "iphone_keyboard.h"
+#include "iphone_common.h"
-@interface iPhoneView : UIView
-{
- void* _screenSurface;
- NSMutableArray* _events;
- SoftKeyboard* _keyboardView;
- CALayer* _screenLayer;
+@interface iPhoneView : UIView {
+ VideoContext _videoContext;
- int _widthOffset;
- int _heightOffset;
+ NSMutableArray *_events;
+ SoftKeyboard *_keyboardView;
- EAGLContext* _context;
+ EAGLContext *_context;
GLuint _viewRenderbuffer;
GLuint _viewFramebuffer;
- GLint _backingWidth;
- GLint _backingHeight;
- GLint _visibleWidth;
- GLint _visibleHeight;
GLuint _screenTexture;
GLuint _overlayTexture;
GLuint _mouseCursorTexture;
+
+ UIDeviceOrientation _orientation;
+
+ GLfloat _gameScreenVertCoords[4 * 2];
+ GLfloat _gameScreenTexCoords[4 * 2];
+
+ GLfloat _overlayVertCoords[4 * 2];
+ GLfloat _overlayTexCoords[4 * 2];
}
- (id)initWithFrame:(struct CGRect)frame;
-- (void)drawRect:(CGRect)frame;
+- (VideoContext *)getVideoContext;
-- (void *)getSurface;
+- (void)drawRect:(CGRect)frame;
- (void)initSurface;
+- (void)setViewTransformation;
+
+- (void)setGraphicsMode;
- (void)updateSurface;
- (void)updateMainSurface;
@@ -69,11 +73,11 @@
- (void)updateMouseSurface;
- (void)clearColorBuffer;
--(void)updateMouseCursor;
+- (void)updateMouseCursor;
- (id)getEvent;
-- (void)deviceOrientationChanged:(int)orientation;
+- (void)deviceOrientationChanged:(UIDeviceOrientation)orientation;
- (void)applicationSuspend;
@@ -81,6 +85,6 @@
@end
+extern iPhoneView *g_iPhoneViewInstance;
-
-#endif /* _IPHONE_VIDEO__H */
+#endif
diff --git a/backends/platform/iphone/iphone_video.m b/backends/platform/iphone/iphone_video.m
deleted file mode 100644
index eb16676428..0000000000
--- a/backends/platform/iphone/iphone_video.m
+++ /dev/null
@@ -1,756 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * 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.
- *
- */
-
-#include "iphone_video.h"
-#include "iphone_common.h"
-
-static iPhoneView *sharedInstance = nil;
-static int _width = 0;
-static int _height = 0;
-static int _fullWidth;
-static int _fullHeight;
-static CGRect _screenRect;
-
-static char* _textureBuffer = 0;
-static int _textureWidth = 0;
-static int _textureHeight = 0;
-
-static char* _overlayTexBuffer = 0;
-static int _overlayTexWidth = 0;
-static int _overlayTexHeight = 0;
-static int _overlayWidth = 0;
-static int _overlayHeight = 0;
-static float _overlayPortraitRatio = 1.0f;
-
-NSLock* _lock = nil;
-static int _needsScreenUpdate = 0;
-static int _overlayIsEnabled = 0;
-
-static UITouch* _firstTouch = NULL;
-static UITouch* _secondTouch = NULL;
-
-static short* _mouseCursor = NULL;
-static int _mouseCursorHeight = 0;
-static int _mouseCursorWidth = 0;
-static int _mouseX = 0;
-static int _mouseY = 0;
-
-// static long lastTick = 0;
-// static int frames = 0;
-
-#define printOpenGLError() printOglError(__FILE__, __LINE__)
-
-int printOglError(const char *file, int line)
-{
- int retCode = 0;
-
- // returns 1 if an OpenGL error occurred, 0 otherwise.
- GLenum glErr = glGetError();
- while( glErr != GL_NO_ERROR)
- {
- fprintf(stderr, "glError: %u (%s: %d)\n", glErr, file, line );
- retCode = 1;
- glErr = glGetError();
- }
- return retCode;
-}
-
-void iPhone_setMouseCursor(short* buffer, int width, int height) {
- _mouseCursor = buffer;
-
- _mouseCursorWidth = width;
- _mouseCursorHeight = height;
-
- [sharedInstance performSelectorOnMainThread:@selector(updateMouseCursor) withObject:nil waitUntilDone: YES];
-}
-
-void iPhone_enableOverlay(int state) {
- _overlayIsEnabled = state;
-
- [sharedInstance performSelectorOnMainThread:@selector(clearColorBuffer) withObject:nil waitUntilDone: YES];
-}
-
-int iPhone_getScreenHeight() {
- return _overlayHeight;
-}
-
-int iPhone_getScreenWidth() {
- return _overlayWidth;
-}
-
-bool iPhone_isHighResDevice() {
- return _fullHeight > 480;
-}
-
-void iPhone_updateScreen(int mouseX, int mouseY) {
- //printf("Mouse: (%i, %i)\n", mouseX, mouseY);
-
- //_mouseX = _overlayHeight - (float)mouseX / _width * _overlayHeight;
- //_mouseY = (float)mouseY / _height * _overlayWidth;
-
- //_mouseX = _overlayHeight - mouseX;
- //_mouseY = mouseY;
-
- _mouseX = (_overlayWidth - mouseX) / (float)_overlayWidth * _overlayHeight;
- _mouseY = mouseY / (float)_overlayHeight * _overlayWidth;
-
- if (!_needsScreenUpdate) {
- _needsScreenUpdate = 1;
- [sharedInstance performSelectorOnMainThread:@selector(updateSurface) withObject:nil waitUntilDone: NO];
- }
-}
-
-void iPhone_updateScreenRect(unsigned short* screen, int x1, int y1, int x2, int y2) {
- int y;
- for (y = y1; y < y2; ++y)
- memcpy(&_textureBuffer[(y * _textureWidth + x1 )* 2], &screen[y * _width + x1], (x2 - x1) * 2);
-}
-
-void iPhone_updateOverlayRect(unsigned short* screen, int x1, int y1, int x2, int y2) {
- int y;
- //printf("Overlaywidth: %u, fullwidth %u\n", _overlayWidth, _fullWidth);
- for (y = y1; y < y2; ++y)
- memcpy(&_overlayTexBuffer[(y * _overlayTexWidth + x1 )* 2], &screen[y * _overlayWidth + x1], (x2 - x1) * 2);
-}
-
-void iPhone_initSurface(int width, int height) {
- _width = width;
- _height = height;
- [sharedInstance performSelectorOnMainThread:@selector(initSurface) withObject:nil waitUntilDone: YES];
-}
-
-bool iPhone_fetchEvent(int *outEvent, float *outX, float *outY) {
- id event = [sharedInstance getEvent];
- if (event == nil) {
- return false;
- }
-
- id type = [event objectForKey:@"type"];
-
- if (type == nil) {
- printf("fetchEvent says: No type!\n");
- return false;
- }
-
- *outEvent = [type intValue];
- *outX = [[event objectForKey:@"x"] floatValue];
- *outY = [[event objectForKey:@"y"] floatValue];
- return true;
-}
-
-uint getSizeNextPOT(uint size) {
- if ((size & (size - 1)) || !size) {
- int log = 0;
-
- while (size >>= 1)
- ++log;
-
- size = (2 << log);
- }
-
- return size;
-}
-
-const char* iPhone_getDocumentsDir() {
- NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
- NSString *documentsDirectory = [paths objectAtIndex:0];
- return [documentsDirectory UTF8String];
-}
-
-bool getLocalMouseCoords(CGPoint *point) {
- if (_overlayIsEnabled) {
- point->x = point->x / _overlayHeight;
- point->y = point->y / _overlayWidth;
- } else {
- if (point->x < _screenRect.origin.x || point->x >= _screenRect.origin.x + _screenRect.size.width ||
- point->y < _screenRect.origin.y || point->y >= _screenRect.origin.y + _screenRect.size.height) {
- return false;
- }
-
- point->x = (point->x - _screenRect.origin.x) / _screenRect.size.width;
- point->y = (point->y - _screenRect.origin.y) / _screenRect.size.height;
- }
-
- return true;
-}
-
-
-@implementation iPhoneView
-
-+ (Class) layerClass
-{
- return [CAEAGLLayer class];
-}
-
-- (id)initWithFrame:(struct CGRect)frame {
- self = [super initWithFrame: frame];
-
- if([[UIScreen mainScreen] respondsToSelector: NSSelectorFromString(@"scale")])
- {
- if([self respondsToSelector: NSSelectorFromString(@"contentScaleFactor")])
- {
- //self.contentScaleFactor = [[UIScreen mainScreen] scale];
- }
- }
-
- _fullWidth = frame.size.width;
- _fullHeight = frame.size.height;
- _screenLayer = nil;
-
- sharedInstance = self;
-
- _lock = [NSLock new];
- _keyboardView = nil;
- _context = nil;
- _screenTexture = 0;
- _overlayTexture = 0;
- _mouseCursorTexture = 0;
-
- return self;
-}
-
--(void) dealloc {
- [super dealloc];
-
- if (_keyboardView != nil) {
- [_keyboardView dealloc];
- }
-
- if (_screenTexture)
- free(_textureBuffer);
-
- free(_overlayTexBuffer);
-}
-
-- (void *)getSurface {
- return _screenSurface;
-}
-
-- (void)drawRect:(CGRect)frame {
- // if (lastTick == 0) {
- // lastTick = time(0);
- // }
- //
- // frames++;
- // if (time(0) > lastTick) {
- // lastTick = time(0);
- // printf("FPS: %i\n", frames);
- // frames = 0;
- // }
-}
-
-- (void)updateSurface {
- if (!_needsScreenUpdate) {
- return;
- }
- _needsScreenUpdate = 0;
-
- if (_overlayIsEnabled) {
- glClear(GL_COLOR_BUFFER_BIT); printOpenGLError();
- }
-
- [self updateMainSurface];
-
- if (_overlayIsEnabled) {
- [self updateOverlaySurface];
- [self updateMouseSurface];
- }
-
- glBindRenderbufferOES(GL_RENDERBUFFER_OES, _viewRenderbuffer); printOpenGLError();
- [_context presentRenderbuffer:GL_RENDERBUFFER_OES];
-
-}
-
--(void)updateMouseCursor {
- if (_mouseCursorTexture == 0) {
- glGenTextures(1, &_mouseCursorTexture); printOpenGLError();
- glBindTexture(GL_TEXTURE_2D, _mouseCursorTexture); printOpenGLError();
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); printOpenGLError();
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); printOpenGLError();
- }
-
- glBindTexture(GL_TEXTURE_2D, _mouseCursorTexture); printOpenGLError();
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, getSizeNextPOT(_mouseCursorWidth), getSizeNextPOT(_mouseCursorHeight), 0, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, _mouseCursor); printOpenGLError();
-
- free(_mouseCursor);
- _mouseCursor = NULL;
-}
-
-- (void)updateMainSurface {
- GLfloat vertices[] = {
- 0.0f + _heightOffset, 0.0f + _widthOffset,
- _visibleWidth - _heightOffset, 0.0f + _widthOffset,
- 0.0f + _heightOffset, _visibleHeight - _widthOffset,
- _visibleWidth - _heightOffset, _visibleHeight - _widthOffset
- };
-
- float texWidth = _width / (float)_textureWidth;
- float texHeight = _height / (float)_textureHeight;
-
- const GLfloat texCoords[] = {
- texWidth, 0.0f,
- 0.0f, 0.0f,
- texWidth, texHeight,
- 0.0f, texHeight
- };
-
- glVertexPointer(2, GL_FLOAT, 0, vertices); printOpenGLError();
- glTexCoordPointer(2, GL_FLOAT, 0, texCoords); printOpenGLError();
-
- glBindTexture(GL_TEXTURE_2D, _screenTexture); printOpenGLError();
-
- // Unfortunately we have to update the whole texture every frame, since glTexSubImage2D is actually slower in all cases
- // due to the iPhone internals having to convert the whole texture back from its internal format when used.
- // In the future we could use several tiled textures instead.
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, _textureWidth, _textureHeight, 0, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, _textureBuffer); printOpenGLError();
- glDisable(GL_BLEND);
- glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); printOpenGLError();
-}
-
-- (void)updateOverlaySurface {
- GLfloat vertices[] = {
- 0.0f, 0.0f,
- _overlayHeight, 0.0f,
- 0.0f, _overlayWidth * _overlayPortraitRatio,
- _overlayHeight, _overlayWidth * _overlayPortraitRatio
- };
-
- float texWidth = _overlayWidth / (float)_overlayTexWidth;
- float texHeight = _overlayHeight / (float)_overlayTexHeight;
-
- const GLfloat texCoords[] = {
- texWidth, 0.0f,
- 0.0f, 0.0f,
- texWidth, texHeight,
- 0.0f, texHeight
- };
-
- glVertexPointer(2, GL_FLOAT, 0, vertices); printOpenGLError();
- glTexCoordPointer(2, GL_FLOAT, 0, texCoords); printOpenGLError();
-
- glBindTexture(GL_TEXTURE_2D, _overlayTexture); printOpenGLError();
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, _overlayTexWidth, _overlayTexHeight, 0, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, _overlayTexBuffer); printOpenGLError();
- glEnable(GL_BLEND);
- glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); printOpenGLError();
-}
-
-- (void)updateMouseSurface {
-
- int width = _mouseCursorWidth / (float)_backingWidth * _backingHeight;
- int height = _mouseCursorHeight / (float)_backingHeight * _backingWidth;
-
- GLfloat vertices[] = {
- _mouseX, _mouseY,
- _mouseX + height, _mouseY,
- _mouseX, _mouseY + width,
- _mouseX + height, _mouseY + width
- };
-
- //printf("Cursor: width %u height %u\n", _mouseCursorWidth, _mouseCursorHeight);
-
- float texWidth = _mouseCursorWidth / (float)getSizeNextPOT(_mouseCursorWidth);
- float texHeight = _mouseCursorHeight / (float)getSizeNextPOT(_mouseCursorHeight);
-
- const GLfloat texCoords[] = {
- texWidth, 0.0f,
- 0.0f, 0.0f,
- texWidth, texHeight,
- 0.0f, texHeight
- };
-
- glVertexPointer(2, GL_FLOAT, 0, vertices); printOpenGLError();
- glTexCoordPointer(2, GL_FLOAT, 0, texCoords); printOpenGLError();
-
- glBindTexture(GL_TEXTURE_2D, _mouseCursorTexture); printOpenGLError();
- glEnable(GL_BLEND);
- glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); printOpenGLError();
-}
-
-- (void)initSurface {
- _textureWidth = getSizeNextPOT(_width);
- _textureHeight = getSizeNextPOT(_height);
-
- UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];
-
- //printf("Window: (%d, %d), Surface: (%d, %d), Texture(%d, %d)\n", _fullWidth, _fullHeight, _width, _height, _textureWidth, _textureHeight);
-
- if (_context == nil) {
- orientation = UIDeviceOrientationLandscapeRight;
- CAEAGLLayer *eaglLayer = (CAEAGLLayer*) self.layer;
-
- eaglLayer.opaque = YES;
- eaglLayer.drawableProperties = [NSDictionary dictionaryWithObjectsAndKeys:
- [NSNumber numberWithBool:FALSE], kEAGLDrawablePropertyRetainedBacking, kEAGLColorFormatRGB565, kEAGLDrawablePropertyColorFormat, nil];
-
- _context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES1];
- if (!_context || [EAGLContext setCurrentContext:_context]) {
- glGenFramebuffersOES(1, &_viewFramebuffer); printOpenGLError();
- glGenRenderbuffersOES(1, &_viewRenderbuffer); printOpenGLError();
-
- glBindFramebufferOES(GL_FRAMEBUFFER_OES, _viewFramebuffer); printOpenGLError();
- glBindRenderbufferOES(GL_RENDERBUFFER_OES, _viewRenderbuffer); printOpenGLError();
- [_context renderbufferStorage:GL_RENDERBUFFER_OES fromDrawable:(id<EAGLDrawable>)self.layer];
- glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_COLOR_ATTACHMENT0_OES, GL_RENDERBUFFER_OES, _viewRenderbuffer); printOpenGLError();
-
- glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_WIDTH_OES, &_backingWidth); printOpenGLError();
- glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_HEIGHT_OES, &_backingHeight); printOpenGLError();
-
- if (glCheckFramebufferStatusOES(GL_FRAMEBUFFER_OES) != GL_FRAMEBUFFER_COMPLETE_OES) {
- NSLog(@"Failed to make complete framebuffer object %x.", glCheckFramebufferStatusOES(GL_FRAMEBUFFER_OES));
- return;
- }
-
- _overlayHeight = _backingWidth;
- _overlayWidth = _backingHeight;
- _overlayTexWidth = getSizeNextPOT(_overlayHeight);
- _overlayTexHeight = getSizeNextPOT(_overlayWidth);
-
- int textureSize = _overlayTexWidth * _overlayTexHeight * 2;
- _overlayTexBuffer = (char *)malloc(textureSize);
- memset(_overlayTexBuffer, 0, textureSize);
-
- glViewport(0, 0, _backingWidth, _backingHeight); printOpenGLError();
- glClearColor(0.0f, 0.0f, 0.0f, 1.0f); printOpenGLError();
-
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-
- glEnable(GL_TEXTURE_2D); printOpenGLError();
- glEnableClientState(GL_TEXTURE_COORD_ARRAY); printOpenGLError();
- glEnableClientState(GL_VERTEX_ARRAY); printOpenGLError();
- }
- }
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
-
- if (orientation == UIDeviceOrientationLandscapeRight) {
- glRotatef(-90, 0, 0, 1); printOpenGLError();
- } else if (orientation == UIDeviceOrientationLandscapeLeft) {
- glRotatef(90, 0, 0, 1); printOpenGLError();
- } else {
- glRotatef(180, 0, 0, 1); printOpenGLError();
- }
-
- glOrthof(0, _backingWidth, 0, _backingHeight, 0, 1); printOpenGLError();
-
- if (_screenTexture > 0) {
- glDeleteTextures(1, &_screenTexture); printOpenGLError();
- }
-
- glGenTextures(1, &_screenTexture); printOpenGLError();
- glBindTexture(GL_TEXTURE_2D, _screenTexture); printOpenGLError();
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); printOpenGLError();
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); printOpenGLError();
-
- if (_overlayTexture > 0) {
- glDeleteTextures(1, &_overlayTexture); printOpenGLError();
- }
-
- glGenTextures(1, &_overlayTexture); printOpenGLError();
- glBindTexture(GL_TEXTURE_2D, _overlayTexture); printOpenGLError();
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); printOpenGLError();
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); printOpenGLError();
-
- if (_textureBuffer) {
- free(_textureBuffer);
- }
-
- int textureSize = _textureWidth * _textureHeight * 2;
- _textureBuffer = (char*)malloc(textureSize);
- memset(_textureBuffer, 0, textureSize);
-
- glBindRenderbufferOES(GL_RENDERBUFFER_OES, _viewRenderbuffer); printOpenGLError();
-
- [self clearColorBuffer];
-
- if (_keyboardView != nil) {
- [_keyboardView removeFromSuperview];
- [[_keyboardView inputView] removeFromSuperview];
- }
-
- if (orientation == UIDeviceOrientationLandscapeLeft || orientation == UIDeviceOrientationLandscapeRight) {
- _visibleHeight = _backingHeight;
- _visibleWidth = _backingWidth;
-
- float ratioDifference = ((float)_height / (float)_width) / ((float)_fullWidth / (float)_fullHeight);
- int rectWidth, rectHeight;
- if (ratioDifference < 1.0f) {
- rectWidth = _fullWidth * ratioDifference;
- rectHeight = _fullHeight;
- _widthOffset = (_fullWidth - rectWidth) / 2;
- _heightOffset = 0;
- } else {
- rectWidth = _fullWidth;
- rectHeight = _fullHeight / ratioDifference;
- _heightOffset = (_fullHeight - rectHeight) / 2;
- _widthOffset = 0;
- }
-
- //printf("Rect: %i, %i, %i, %i\n", _widthOffset, _heightOffset, rectWidth, rectHeight);
- _screenRect = CGRectMake(_widthOffset, _heightOffset, rectWidth, rectHeight);
- _overlayPortraitRatio = 1.0f;
- } else {
- float ratio = (float)_height / (float)_width;
- int height = _fullWidth * ratio;
- //printf("Making rect (%u, %u)\n", _fullWidth, height);
- _screenRect = CGRectMake(0, 0, _fullWidth - 1, height - 1);
-
- _visibleHeight = height;
- _visibleWidth = _backingWidth;
- _heightOffset = 0.0f;
- _widthOffset = 0.0f;
-
- CGRect keyFrame = CGRectMake(0.0f, 0.0f, 0.0f, 0.0f);
- if (_keyboardView == nil) {
- _keyboardView = [[SoftKeyboard alloc] initWithFrame:keyFrame];
- [_keyboardView setInputDelegate:self];
- }
-
- [self addSubview:[_keyboardView inputView]];
- [self addSubview: _keyboardView];
- [[_keyboardView inputView] becomeFirstResponder];
- _overlayPortraitRatio = (_overlayHeight * ratio) / _overlayWidth;
- }
-}
-
-- (void)clearColorBuffer {
- // The color buffer is triple-buffered, so we clear it multiple times right away to avid doing any glClears later.
- int clearCount = 5;
- while (clearCount-- > 0) {
- glClear(GL_COLOR_BUFFER_BIT); printOpenGLError();
- [_context presentRenderbuffer:GL_RENDERBUFFER_OES];
- }
-}
-
-- (id)getEvent {
- if (_events == nil || [_events count] == 0) {
- return nil;
- }
-
-
- id event = [_events objectAtIndex: 0];
-
- [_events removeObjectAtIndex: 0];
-
- return event;
-}
-
-- (void)addEvent:(NSDictionary*)event {
-
- if (_events == nil)
- _events = [[NSMutableArray alloc] init];
-
- [_events addObject: event];
-}
-
-- (void)deviceOrientationChanged:(int)orientation {
- [self addEvent:
- [[NSDictionary alloc] initWithObjectsAndKeys:
- [NSNumber numberWithInt:kInputOrientationChanged], @"type",
- [NSNumber numberWithFloat:(float)orientation], @"x",
- [NSNumber numberWithFloat:0], @"y",
- nil
- ]
- ];
-}
-
-- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
-{
- NSSet *allTouches = [event allTouches];
-
- switch ([allTouches count]) {
- case 1:
- {
- UITouch *touch = [touches anyObject];
- CGPoint point = [touch locationInView:self];
- if (!getLocalMouseCoords(&point))
- return;
-
- _firstTouch = touch;
- [self addEvent:
- [[NSDictionary alloc] initWithObjectsAndKeys:
- [NSNumber numberWithInt:kInputMouseDown], @"type",
- [NSNumber numberWithFloat:point.x], @"x",
- [NSNumber numberWithFloat:point.y], @"y",
- nil
- ]
- ];
- break;
- }
- case 2:
- {
- UITouch *touch = [touches anyObject];
- CGPoint point = [touch locationInView:self];
- if (!getLocalMouseCoords(&point))
- return;
-
- _secondTouch = touch;
- [self addEvent:
- [[NSDictionary alloc] initWithObjectsAndKeys:
- [NSNumber numberWithInt:kInputMouseSecondDown], @"type",
- [NSNumber numberWithFloat:point.x], @"x",
- [NSNumber numberWithFloat:point.y], @"y",
- nil
- ]
- ];
- break;
- }
- }
-}
-
-- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
-{
- //NSSet *allTouches = [event allTouches];
-
- for (UITouch* touch in touches) {
- if (touch == _firstTouch) {
-
- CGPoint point = [touch locationInView:self];
- if (!getLocalMouseCoords(&point))
- return;
-
- [self addEvent:
- [[NSDictionary alloc] initWithObjectsAndKeys:
- [NSNumber numberWithInt:kInputMouseDragged], @"type",
- [NSNumber numberWithFloat:point.x], @"x",
- [NSNumber numberWithFloat:point.y], @"y",
- nil
- ]
- ];
-
- } else if (touch == _secondTouch) {
-
- CGPoint point = [touch locationInView:self];
- if (!getLocalMouseCoords(&point))
- return;
-
- [self addEvent:
- [[NSDictionary alloc] initWithObjectsAndKeys:
- [NSNumber numberWithInt:kInputMouseSecondDragged], @"type",
- [NSNumber numberWithFloat:point.x], @"x",
- [NSNumber numberWithFloat:point.y], @"y",
- nil
- ]
- ];
-
- }
- }
-}
-
-- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
-{
- NSSet *allTouches = [event allTouches];
-
- switch ([allTouches count]) {
- case 1:
- {
- UITouch *touch = [[allTouches allObjects] objectAtIndex:0];
- CGPoint point = [touch locationInView:self];
- if (!getLocalMouseCoords(&point))
- return;
-
- [self addEvent:
- [[NSDictionary alloc] initWithObjectsAndKeys:
- [NSNumber numberWithInt:kInputMouseUp], @"type",
- [NSNumber numberWithFloat:point.x], @"x",
- [NSNumber numberWithFloat:point.y], @"y",
- nil
- ]
- ];
- break;
- }
- case 2:
- {
- UITouch *touch = [[allTouches allObjects] objectAtIndex:1];
- CGPoint point = [touch locationInView:self];
- if (!getLocalMouseCoords(&point))
- return;
-
- [self addEvent:
- [[NSDictionary alloc] initWithObjectsAndKeys:
- [NSNumber numberWithInt:kInputMouseSecondUp], @"type",
- [NSNumber numberWithFloat:point.x], @"x",
- [NSNumber numberWithFloat:point.y], @"y",
- nil
- ]
- ];
- break;
- }
- }
-}
-
-- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event
-{
-
-}
-
-- (void)handleKeyPress:(unichar)c {
- [self addEvent:
- [[NSDictionary alloc] initWithObjectsAndKeys:
- [NSNumber numberWithInt:kInputKeyPressed], @"type",
- [NSNumber numberWithFloat:(float)c], @"x",
- [NSNumber numberWithFloat:0], @"y",
- nil
- ]
- ];
-}
-
-- (BOOL)canHandleSwipes {
- return TRUE;
-}
-
-- (int)swipe:(int)num withEvent:(struct __GSEvent *)event {
- //printf("swipe: %i\n", num);
-
- [self addEvent:
- [[NSDictionary alloc] initWithObjectsAndKeys:
- [NSNumber numberWithInt:kInputSwipe], @"type",
- [NSNumber numberWithFloat:(float)num], @"x",
- [NSNumber numberWithFloat:0], @"y",
- nil
- ]
- ];
-}
-
-- (void)applicationSuspend {
- [self addEvent:
- [[NSDictionary alloc] initWithObjectsAndKeys:
- [NSNumber numberWithInt:kInputApplicationSuspended], @"type",
- [NSNumber numberWithFloat:0], @"x",
- [NSNumber numberWithFloat:0], @"y",
- nil
- ]
- ];
-}
-
-- (void)applicationResume {
- [self addEvent:
- [[NSDictionary alloc] initWithObjectsAndKeys:
- [NSNumber numberWithInt:kInputApplicationResumed], @"type",
- [NSNumber numberWithFloat:0], @"x",
- [NSNumber numberWithFloat:0], @"y",
- nil
- ]
- ];
-}
-
-@end
diff --git a/backends/platform/iphone/iphone_video.mm b/backends/platform/iphone/iphone_video.mm
new file mode 100644
index 0000000000..cdd8d68b31
--- /dev/null
+++ b/backends/platform/iphone/iphone_video.mm
@@ -0,0 +1,853 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * 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.
+ *
+ */
+
+// Disable symbol overrides so that we can use system headers.
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+
+#include "iphone_video.h"
+
+#include "graphics/colormasks.h"
+
+iPhoneView *g_iPhoneViewInstance = nil;
+static int _fullWidth;
+static int _fullHeight;
+static CGRect _gameScreenRect;
+
+static CGRect _overlayRect;
+
+static int _needsScreenUpdate = 0;
+
+static UITouch *_firstTouch = NULL;
+static UITouch *_secondTouch = NULL;
+
+static unsigned short *_mouseCursor = NULL;
+
+static GLint _renderBufferWidth;
+static GLint _renderBufferHeight;
+
+static int _scaledShakeOffsetY;
+
+#if 0
+static long lastTick = 0;
+static int frames = 0;
+#endif
+
+#define printOpenGLError() printOglError(__FILE__, __LINE__)
+
+int printOglError(const char *file, int line) {
+ int retCode = 0;
+
+ // returns 1 if an OpenGL error occurred, 0 otherwise.
+ GLenum glErr = glGetError();
+ while (glErr != GL_NO_ERROR) {
+ fprintf(stderr, "glError: %u (%s: %d)\n", glErr, file, line);
+ retCode = 1;
+ glErr = glGetError();
+ }
+ return retCode;
+}
+
+void iPhone_setMouseCursor(unsigned short *buffer) {
+ _mouseCursor = buffer;
+ [g_iPhoneViewInstance performSelectorOnMainThread:@selector(updateMouseCursor) withObject:nil waitUntilDone: YES];
+}
+
+bool iPhone_isHighResDevice() {
+ return _fullHeight > 480;
+}
+
+void iPhone_updateScreen() {
+ //printf("Mouse: (%i, %i)\n", mouseX, mouseY);
+ if (!_needsScreenUpdate) {
+ _needsScreenUpdate = 1;
+ [g_iPhoneViewInstance performSelectorOnMainThread:@selector(updateSurface) withObject:nil waitUntilDone: NO];
+ }
+}
+
+bool iPhone_fetchEvent(int *outEvent, int *outX, int *outY) {
+ id event = [g_iPhoneViewInstance getEvent];
+ if (event == nil) {
+ return false;
+ }
+
+ id type = [event objectForKey:@"type"];
+
+ if (type == nil) {
+ printf("fetchEvent says: No type!\n");
+ return false;
+ }
+
+ *outEvent = [type intValue];
+ *outX = [[event objectForKey:@"x"] intValue];
+ *outY = [[event objectForKey:@"y"] intValue];
+ return true;
+}
+
+uint getSizeNextPOT(uint size) {
+ if ((size & (size - 1)) || !size) {
+ int log = 0;
+
+ while (size >>= 1)
+ ++log;
+
+ size = (2 << log);
+ }
+
+ return size;
+}
+
+const char *iPhone_getDocumentsDir() {
+ NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
+ NSString *documentsDirectory = [paths objectAtIndex:0];
+ return [documentsDirectory UTF8String];
+}
+
+@implementation iPhoneView
+
++ (Class)layerClass {
+ return [CAEAGLLayer class];
+}
+
+- (VideoContext *)getVideoContext {
+ return &_videoContext;
+}
+
+- (void)createContext {
+ CAEAGLLayer *eaglLayer = (CAEAGLLayer *)self.layer;
+
+ eaglLayer.opaque = YES;
+ eaglLayer.drawableProperties = [NSDictionary dictionaryWithObjectsAndKeys:
+ [NSNumber numberWithBool:FALSE], kEAGLDrawablePropertyRetainedBacking, kEAGLColorFormatRGB565, kEAGLDrawablePropertyColorFormat, nil];
+
+ _context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES1];
+
+ // In case creating the OpenGL ES context failed, we will error out here.
+ if (_context == nil) {
+ fprintf(stderr, "Could not create OpenGL ES context\n");
+ exit(-1);
+ }
+
+ if ([EAGLContext setCurrentContext:_context]) {
+ glGenFramebuffersOES(1, &_viewFramebuffer); printOpenGLError();
+ glGenRenderbuffersOES(1, &_viewRenderbuffer); printOpenGLError();
+
+ glBindFramebufferOES(GL_FRAMEBUFFER_OES, _viewFramebuffer); printOpenGLError();
+ glBindRenderbufferOES(GL_RENDERBUFFER_OES, _viewRenderbuffer); printOpenGLError();
+ [_context renderbufferStorage:GL_RENDERBUFFER_OES fromDrawable:(id<EAGLDrawable>)self.layer];
+
+ glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_COLOR_ATTACHMENT0_OES, GL_RENDERBUFFER_OES, _viewRenderbuffer); printOpenGLError();
+
+ // Retrieve the render buffer size. This *should* match the frame size,
+ // i.e. _fullWidth and _fullHeight.
+ glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_WIDTH_OES, &_renderBufferWidth); printOpenGLError();
+ glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_HEIGHT_OES, &_renderBufferHeight); printOpenGLError();
+
+ if (glCheckFramebufferStatusOES(GL_FRAMEBUFFER_OES) != GL_FRAMEBUFFER_COMPLETE_OES) {
+ NSLog(@"Failed to make complete framebuffer object %x.", glCheckFramebufferStatusOES(GL_FRAMEBUFFER_OES));
+ return;
+ }
+
+ _videoContext.overlayHeight = _renderBufferWidth;
+ _videoContext.overlayWidth = _renderBufferHeight;
+ uint overlayTextureWidth = getSizeNextPOT(_videoContext.overlayHeight);
+ uint overlayTextureHeight = getSizeNextPOT(_videoContext.overlayWidth);
+
+ // Since the overlay size won't change the whole run, we can
+ // precalculate the texture coordinates for the overlay texture here
+ // and just use it later on.
+ _overlayTexCoords[2] = _overlayTexCoords[6] = _videoContext.overlayWidth / (GLfloat)overlayTextureWidth;
+ _overlayTexCoords[5] = _overlayTexCoords[7] = _videoContext.overlayHeight / (GLfloat)overlayTextureHeight;
+
+ _videoContext.overlayTexture.create(overlayTextureWidth, overlayTextureHeight, Graphics::createPixelFormat<5551>());
+
+ glViewport(0, 0, _renderBufferWidth, _renderBufferHeight); printOpenGLError();
+ glClearColor(0.0f, 0.0f, 0.0f, 1.0f); printOpenGLError();
+
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+
+ glEnable(GL_TEXTURE_2D); printOpenGLError();
+ glEnableClientState(GL_TEXTURE_COORD_ARRAY); printOpenGLError();
+ glEnableClientState(GL_VERTEX_ARRAY); printOpenGLError();
+ }
+}
+
+- (id)initWithFrame:(struct CGRect)frame {
+ self = [super initWithFrame: frame];
+
+ if ([[UIScreen mainScreen] respondsToSelector: NSSelectorFromString(@"scale")]) {
+ if ([self respondsToSelector: NSSelectorFromString(@"contentScaleFactor")]) {
+ //self.contentScaleFactor = [[UIScreen mainScreen] scale];
+ }
+ }
+
+ _fullWidth = (int)frame.size.width;
+ _fullHeight = (int)frame.size.height;
+
+ g_iPhoneViewInstance = self;
+
+ _keyboardView = nil;
+ _screenTexture = 0;
+ _overlayTexture = 0;
+ _mouseCursorTexture = 0;
+
+ _gameScreenVertCoords[0] = _gameScreenVertCoords[1] =
+ _gameScreenVertCoords[2] = _gameScreenVertCoords[3] =
+ _gameScreenVertCoords[4] = _gameScreenVertCoords[5] =
+ _gameScreenVertCoords[6] = _gameScreenVertCoords[7] = 0;
+
+ _gameScreenTexCoords[0] = _gameScreenTexCoords[1] =
+ _gameScreenTexCoords[2] = _gameScreenTexCoords[3] =
+ _gameScreenTexCoords[4] = _gameScreenTexCoords[5] =
+ _gameScreenTexCoords[6] = _gameScreenTexCoords[7] = 0;
+
+ _overlayVertCoords[0] = _overlayVertCoords[1] =
+ _overlayVertCoords[2] = _overlayVertCoords[3] =
+ _overlayVertCoords[4] = _overlayVertCoords[5] =
+ _overlayVertCoords[6] = _overlayVertCoords[7] = 0;
+
+ _overlayTexCoords[0] = _overlayTexCoords[1] =
+ _overlayTexCoords[2] = _overlayTexCoords[3] =
+ _overlayTexCoords[4] = _overlayTexCoords[5] =
+ _overlayTexCoords[6] = _overlayTexCoords[7] = 0;
+
+ // Initialize the OpenGL ES context
+ [self createContext];
+
+ return self;
+}
+
+- (void)dealloc {
+ [super dealloc];
+
+ if (_keyboardView != nil) {
+ [_keyboardView dealloc];
+ }
+
+ _videoContext.screenTexture.free();
+ _videoContext.overlayTexture.free();
+}
+
+- (void)drawRect:(CGRect)frame {
+#if 0
+ if (lastTick == 0) {
+ lastTick = time(0);
+ }
+
+ frames++;
+ if (time(0) > lastTick) {
+ lastTick = time(0);
+ printf("FPS: %i\n", frames);
+ frames = 0;
+ }
+#endif
+}
+
+- (void)setFilterModeForTexture:(GLuint)tex {
+ if (!tex)
+ return;
+
+ glBindTexture(GL_TEXTURE_2D, tex); printOpenGLError();
+
+ GLint filter = GL_LINEAR;
+
+ switch (_videoContext.graphicsMode) {
+ case kGraphicsModeLinear:
+ filter = GL_LINEAR;
+ break;
+
+ case kGraphicsModeNone:
+ filter = GL_NEAREST;
+ break;
+ }
+
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filter); printOpenGLError();
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filter); printOpenGLError();
+}
+
+- (void)setGraphicsMode {
+ [self setFilterModeForTexture:_screenTexture];
+ [self setFilterModeForTexture:_overlayTexture];
+ [self setFilterModeForTexture:_mouseCursorTexture];
+}
+
+- (void)updateSurface {
+ if (!_needsScreenUpdate) {
+ return;
+ }
+ _needsScreenUpdate = 0;
+
+ glClear(GL_COLOR_BUFFER_BIT); printOpenGLError();
+
+ [self updateMainSurface];
+
+ if (_videoContext.overlayVisible)
+ [self updateOverlaySurface];
+
+ if (_videoContext.mouseIsVisible)
+ [self updateMouseSurface];
+
+ glBindRenderbufferOES(GL_RENDERBUFFER_OES, _viewRenderbuffer); printOpenGLError();
+ [_context presentRenderbuffer:GL_RENDERBUFFER_OES];
+
+}
+
+- (void)updateMouseCursor {
+ if (_mouseCursorTexture == 0) {
+ glGenTextures(1, &_mouseCursorTexture); printOpenGLError();
+ [self setFilterModeForTexture:_mouseCursorTexture];
+ }
+
+ glBindTexture(GL_TEXTURE_2D, _mouseCursorTexture); printOpenGLError();
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, getSizeNextPOT(_videoContext.mouseWidth), getSizeNextPOT(_videoContext.mouseHeight), 0, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, _mouseCursor); printOpenGLError();
+
+ free(_mouseCursor);
+ _mouseCursor = NULL;
+}
+
+- (void)updateMainSurface {
+ glVertexPointer(2, GL_FLOAT, 0, _gameScreenVertCoords); printOpenGLError();
+ glTexCoordPointer(2, GL_FLOAT, 0, _gameScreenTexCoords); printOpenGLError();
+
+ glBindTexture(GL_TEXTURE_2D, _screenTexture); printOpenGLError();
+
+ // Unfortunately we have to update the whole texture every frame, since glTexSubImage2D is actually slower in all cases
+ // due to the iPhone internals having to convert the whole texture back from its internal format when used.
+ // In the future we could use several tiled textures instead.
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, _videoContext.screenTexture.w, _videoContext.screenTexture.h, 0, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, _videoContext.screenTexture.pixels); printOpenGLError();
+ glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); printOpenGLError();
+}
+
+- (void)updateOverlaySurface {
+ glVertexPointer(2, GL_FLOAT, 0, _overlayVertCoords); printOpenGLError();
+ glTexCoordPointer(2, GL_FLOAT, 0, _overlayTexCoords); printOpenGLError();
+
+ glBindTexture(GL_TEXTURE_2D, _overlayTexture); printOpenGLError();
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, _videoContext.overlayTexture.w, _videoContext.overlayTexture.h, 0, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, _videoContext.overlayTexture.pixels); printOpenGLError();
+ glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); printOpenGLError();
+}
+
+- (void)updateMouseSurface {
+ int width = _videoContext.mouseWidth;
+ int height = _videoContext.mouseHeight;
+
+ int mouseX = _videoContext.mouseX;
+ int mouseY = _videoContext.mouseY;
+
+ int hotspotX = _videoContext.mouseHotspotX;
+ int hotspotY = _videoContext.mouseHotspotY;
+
+ CGRect *rect;
+ int maxWidth, maxHeight;
+
+ if (!_videoContext.overlayVisible) {
+ rect = &_gameScreenRect;
+ maxWidth = _videoContext.screenWidth;
+ maxHeight = _videoContext.screenHeight;
+ } else {
+ rect = &_overlayRect;
+ maxWidth = _videoContext.overlayWidth;
+ maxHeight = _videoContext.overlayHeight;
+ }
+
+ const GLfloat scaleX = CGRectGetWidth(*rect) / (GLfloat)maxWidth;
+ const GLfloat scaleY = CGRectGetHeight(*rect) / (GLfloat)maxHeight;
+
+ mouseX = (int)(mouseX * scaleX);
+ mouseY = (int)(mouseY * scaleY);
+ hotspotX = (int)(hotspotX * scaleX);
+ hotspotY = (int)(hotspotY * scaleY);
+ width = (int)(width * scaleX);
+ height = (int)(height * scaleY);
+
+ mouseX -= hotspotX;
+ mouseY -= hotspotY;
+
+ mouseX += (int)CGRectGetMinX(*rect);
+ mouseY += (int)CGRectGetMinY(*rect);
+
+ GLfloat vertices[] = {
+ // Top left
+ mouseX , mouseY,
+ // Top right
+ mouseX + width, mouseY,
+ // Bottom left
+ mouseX , mouseY + height,
+ // Bottom right
+ mouseX + width, mouseY + height
+ };
+
+ //printf("Cursor: width %u height %u\n", _videoContext.mouseWidth, _videoContext.mouseHeight);
+
+ float texWidth = _videoContext.mouseWidth / (float)getSizeNextPOT(_videoContext.mouseWidth);
+ float texHeight = _videoContext.mouseHeight / (float)getSizeNextPOT(_videoContext.mouseHeight);
+
+ const GLfloat texCoords[] = {
+ // Top left
+ 0 , 0,
+ // Top right
+ texWidth, 0,
+ // Bottom left
+ 0 , texHeight,
+ // Bottom right
+ texWidth, texHeight
+ };
+
+ glVertexPointer(2, GL_FLOAT, 0, vertices); printOpenGLError();
+ glTexCoordPointer(2, GL_FLOAT, 0, texCoords); printOpenGLError();
+
+ glBindTexture(GL_TEXTURE_2D, _mouseCursorTexture); printOpenGLError();
+ glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); printOpenGLError();
+}
+
+- (void)setUpOrientation:(UIDeviceOrientation)orientation width:(int *)width height:(int *)height {
+ _orientation = orientation;
+
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+
+ // We always force the origin (0,0) to be in the upper left corner.
+ switch (_orientation) {
+ case UIDeviceOrientationLandscapeRight:
+ glRotatef( 90, 0, 0, 1); printOpenGLError();
+ glOrthof(0, _renderBufferHeight, _renderBufferWidth, 0, 0, 1); printOpenGLError();
+
+ *width = _renderBufferHeight;
+ *height = _renderBufferWidth;
+ break;
+
+ case UIDeviceOrientationLandscapeLeft:
+ glRotatef(-90, 0, 0, 1); printOpenGLError();
+ glOrthof(0, _renderBufferHeight, _renderBufferWidth, 0, 0, 1); printOpenGLError();
+
+ *width = _renderBufferHeight;
+ *height = _renderBufferWidth;
+ break;
+
+ case UIDeviceOrientationPortrait:
+ default:
+ // We must force the portrait orientation here, since we might not know
+ // the real orientation.
+ _orientation = UIDeviceOrientationPortrait;
+
+ glOrthof(0, _renderBufferWidth, _renderBufferHeight, 0, 0, 1); printOpenGLError();
+
+ *width = _renderBufferWidth;
+ *height = _renderBufferHeight;
+ break;
+ }
+}
+
+- (void)initSurface {
+ uint screenTexWidth = getSizeNextPOT(_videoContext.screenWidth);
+ uint screenTexHeight = getSizeNextPOT(_videoContext.screenHeight);
+
+ _gameScreenTexCoords[2] = _gameScreenTexCoords[6] = _videoContext.screenWidth / (GLfloat)screenTexWidth;
+ _gameScreenTexCoords[5] = _gameScreenTexCoords[7] = _videoContext.screenHeight / (GLfloat)screenTexHeight;
+
+ int screenWidth, screenHeight;
+ [self setUpOrientation:[[UIDevice currentDevice] orientation] width:&screenWidth height:&screenHeight];
+
+ if (_screenTexture > 0) {
+ glDeleteTextures(1, &_screenTexture); printOpenGLError();
+ }
+
+ glGenTextures(1, &_screenTexture); printOpenGLError();
+ [self setFilterModeForTexture:_screenTexture];
+
+ if (_overlayTexture > 0) {
+ glDeleteTextures(1, &_overlayTexture); printOpenGLError();
+ }
+
+ glGenTextures(1, &_overlayTexture); printOpenGLError();
+ [self setFilterModeForTexture:_overlayTexture];
+
+ _videoContext.screenTexture.create(screenTexWidth, screenTexHeight, Graphics::createPixelFormat<565>());
+
+ glBindRenderbufferOES(GL_RENDERBUFFER_OES, _viewRenderbuffer); printOpenGLError();
+
+ [self clearColorBuffer];
+
+ if (_keyboardView != nil) {
+ [_keyboardView removeFromSuperview];
+ [[_keyboardView inputView] removeFromSuperview];
+ }
+
+ float overlayPortraitRatio;
+
+ if (_orientation == UIDeviceOrientationLandscapeLeft || _orientation == UIDeviceOrientationLandscapeRight) {
+ GLfloat gameScreenRatio = (GLfloat)_videoContext.screenWidth / (GLfloat)_videoContext.screenHeight;
+ GLfloat screenRatio = (GLfloat)screenWidth / (GLfloat)screenHeight;
+
+ // These are the width/height according to the portrait layout!
+ int rectWidth, rectHeight;
+ int xOffset, yOffset;
+
+ if (gameScreenRatio < screenRatio) {
+ // When the game screen ratio is less than the screen ratio
+ // we need to scale the width, since the game screen was higher
+ // compared to the width than our output screen is.
+ rectWidth = (int)(screenHeight * gameScreenRatio);
+ rectHeight = screenHeight;
+ xOffset = (screenWidth - rectWidth) / 2;
+ yOffset = 0;
+ } else {
+ // When the game screen ratio is bigger than the screen ratio
+ // we need to scale the height, since the game screen was wider
+ // compared to the height than our output screen is.
+ rectWidth = screenWidth;
+ rectHeight = (int)(screenWidth / gameScreenRatio);
+ xOffset = 0;
+ yOffset = (screenHeight - rectHeight) / 2;
+ }
+
+ //printf("Rect: %i, %i, %i, %i\n", xOffset, yOffset, rectWidth, rectHeight);
+ _gameScreenRect = CGRectMake(xOffset, yOffset, rectWidth, rectHeight);
+ overlayPortraitRatio = 1.0f;
+ } else {
+ float ratio = (float)_videoContext.screenHeight / (float)_videoContext.screenWidth;
+ int height = (int)(screenWidth * ratio);
+ //printf("Making rect (%u, %u)\n", screenWidth, height);
+ _gameScreenRect = CGRectMake(0, 0, screenWidth, height);
+
+ CGRect keyFrame = CGRectMake(0.0f, 0.0f, 0.0f, 0.0f);
+ if (_keyboardView == nil) {
+ _keyboardView = [[SoftKeyboard alloc] initWithFrame:keyFrame];
+ [_keyboardView setInputDelegate:self];
+ }
+
+ [self addSubview:[_keyboardView inputView]];
+ [self addSubview: _keyboardView];
+ [[_keyboardView inputView] becomeFirstResponder];
+ overlayPortraitRatio = (_videoContext.overlayHeight * ratio) / _videoContext.overlayWidth;
+ }
+
+ _overlayRect = CGRectMake(0, 0, screenWidth, screenHeight * overlayPortraitRatio);
+
+ _gameScreenVertCoords[0] = _gameScreenVertCoords[4] = CGRectGetMinX(_gameScreenRect);
+ _gameScreenVertCoords[1] = _gameScreenVertCoords[3] = CGRectGetMinY(_gameScreenRect);
+ _gameScreenVertCoords[2] = _gameScreenVertCoords[6] = CGRectGetMaxX(_gameScreenRect);
+ _gameScreenVertCoords[5] = _gameScreenVertCoords[7] = CGRectGetMaxY(_gameScreenRect);
+
+ _overlayVertCoords[2] = _overlayVertCoords[6] = CGRectGetMaxX(_overlayRect);
+ _overlayVertCoords[5] = _overlayVertCoords[7] = CGRectGetMaxY(_overlayRect);
+
+ [self setViewTransformation];
+}
+
+- (void)setViewTransformation {
+ // Set the modelview matrix. This matrix will be used for the shake offset
+ // support.
+ glMatrixMode(GL_MODELVIEW);
+ glLoadIdentity();
+
+ // Scale the shake offset according to the overlay size. We need this to
+ // adjust the overlay mouse click coordinates when an offset is set.
+ _scaledShakeOffsetY = (int)(_videoContext.shakeOffsetY / (GLfloat)_videoContext.screenHeight * CGRectGetHeight(_overlayRect));
+
+ // Apply the shakeing to the output screen.
+ glTranslatef(0, -_scaledShakeOffsetY, 0);
+}
+
+- (void)clearColorBuffer {
+ // The color buffer is triple-buffered, so we clear it multiple times right away to avid doing any glClears later.
+ int clearCount = 5;
+ while (clearCount-- > 0) {
+ glClear(GL_COLOR_BUFFER_BIT); printOpenGLError();
+ [_context presentRenderbuffer:GL_RENDERBUFFER_OES];
+ }
+}
+
+- (id)getEvent {
+ if (_events == nil || [_events count] == 0) {
+ return nil;
+ }
+
+ id event = [_events objectAtIndex: 0];
+
+ [_events removeObjectAtIndex: 0];
+
+ return event;
+}
+
+- (void)addEvent:(NSDictionary *)event {
+ if (_events == nil)
+ _events = [[NSMutableArray alloc] init];
+
+ [_events addObject: event];
+}
+
+/**
+ * Converts portrait mode coordinates into rotated mode coordinates.
+ */
+- (bool)convertToRotatedCoords:(CGPoint)point result:(CGPoint *)result {
+ switch (_orientation) {
+ case UIDeviceOrientationLandscapeLeft:
+ result->x = point.y;
+ result->y = _renderBufferWidth - point.x;
+ return true;
+
+ case UIDeviceOrientationLandscapeRight:
+ result->x = _renderBufferHeight - point.y;
+ result->y = point.x;
+ return true;
+
+ case UIDeviceOrientationPortrait:
+ result->x = point.x;
+ result->y = point.y;
+ return true;
+
+ default:
+ return false;
+ }
+}
+
+- (bool)getMouseCoords:(CGPoint)point eventX:(int *)x eventY:(int *)y {
+ if (![self convertToRotatedCoords:point result:&point])
+ return false;
+
+ CGRect *area;
+ int width, height, offsetY;
+ if (_videoContext.overlayVisible) {
+ area = &_overlayRect;
+ width = _videoContext.overlayWidth;
+ height = _videoContext.overlayHeight;
+ offsetY = _scaledShakeOffsetY;
+ } else {
+ area = &_gameScreenRect;
+ width = _videoContext.screenWidth;
+ height = _videoContext.screenHeight;
+ offsetY = _videoContext.shakeOffsetY;
+ }
+
+ point.x = (point.x - CGRectGetMinX(*area)) / CGRectGetWidth(*area);
+ point.y = (point.y - CGRectGetMinY(*area)) / CGRectGetHeight(*area);
+
+ *x = (int)(point.x * width);
+ // offsetY describes the translation of the screen in the upward direction,
+ // thus we need to add it here.
+ *y = (int)(point.y * height + offsetY);
+
+ // Clip coordinates
+ if (*x < 0 || *x > width || *y < 0 || *y > height)
+ return false;
+
+ return true;
+}
+
+- (void)deviceOrientationChanged:(UIDeviceOrientation)orientation {
+ switch (orientation) {
+ case UIDeviceOrientationLandscapeLeft:
+ case UIDeviceOrientationLandscapeRight:
+ case UIDeviceOrientationPortrait:
+ _orientation = orientation;
+ break;
+
+ default:
+ return;
+ }
+
+ [self addEvent:
+ [[NSDictionary alloc] initWithObjectsAndKeys:
+ [NSNumber numberWithInt:kInputOrientationChanged], @"type",
+ [NSNumber numberWithInt:orientation], @"x",
+ [NSNumber numberWithInt:0], @"y",
+ nil
+ ]
+ ];
+}
+
+- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
+ NSSet *allTouches = [event allTouches];
+ int x, y;
+
+ switch ([allTouches count]) {
+ case 1: {
+ UITouch *touch = [touches anyObject];
+ CGPoint point = [touch locationInView:self];
+ if (![self getMouseCoords:point eventX:&x eventY:&y])
+ return;
+
+ _firstTouch = touch;
+ [self addEvent:
+ [[NSDictionary alloc] initWithObjectsAndKeys:
+ [NSNumber numberWithInt:kInputMouseDown], @"type",
+ [NSNumber numberWithInt:x], @"x",
+ [NSNumber numberWithInt:y], @"y",
+ nil
+ ]
+ ];
+ break;
+ }
+
+ case 2: {
+ UITouch *touch = [touches anyObject];
+ CGPoint point = [touch locationInView:self];
+ if (![self getMouseCoords:point eventX:&x eventY:&y])
+ return;
+
+ _secondTouch = touch;
+ [self addEvent:
+ [[NSDictionary alloc] initWithObjectsAndKeys:
+ [NSNumber numberWithInt:kInputMouseSecondDown], @"type",
+ [NSNumber numberWithInt:x], @"x",
+ [NSNumber numberWithInt:y], @"y",
+ nil
+ ]
+ ];
+ break;
+ }
+ }
+}
+
+- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
+ //NSSet *allTouches = [event allTouches];
+ int x, y;
+
+ for (UITouch *touch in touches) {
+ if (touch == _firstTouch) {
+ CGPoint point = [touch locationInView:self];
+ if (![self getMouseCoords:point eventX:&x eventY:&y])
+ return;
+
+ [self addEvent:
+ [[NSDictionary alloc] initWithObjectsAndKeys:
+ [NSNumber numberWithInt:kInputMouseDragged], @"type",
+ [NSNumber numberWithInt:x], @"x",
+ [NSNumber numberWithInt:y], @"y",
+ nil
+ ]
+ ];
+ } else if (touch == _secondTouch) {
+ CGPoint point = [touch locationInView:self];
+ if (![self getMouseCoords:point eventX:&x eventY:&y])
+ return;
+
+ [self addEvent:
+ [[NSDictionary alloc] initWithObjectsAndKeys:
+ [NSNumber numberWithInt:kInputMouseSecondDragged], @"type",
+ [NSNumber numberWithInt:x], @"x",
+ [NSNumber numberWithInt:y], @"y",
+ nil
+ ]
+ ];
+ }
+ }
+}
+
+- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
+ NSSet *allTouches = [event allTouches];
+ int x, y;
+
+ switch ([allTouches count]) {
+ case 1: {
+ UITouch *touch = [[allTouches allObjects] objectAtIndex:0];
+ CGPoint point = [touch locationInView:self];
+ if (![self getMouseCoords:point eventX:&x eventY:&y])
+ return;
+
+ [self addEvent:
+ [[NSDictionary alloc] initWithObjectsAndKeys:
+ [NSNumber numberWithInt:kInputMouseUp], @"type",
+ [NSNumber numberWithInt:x], @"x",
+ [NSNumber numberWithInt:y], @"y",
+ nil
+ ]
+ ];
+ break;
+ }
+
+ case 2: {
+ UITouch *touch = [[allTouches allObjects] objectAtIndex:1];
+ CGPoint point = [touch locationInView:self];
+ if (![self getMouseCoords:point eventX:&x eventY:&y])
+ return;
+
+ [self addEvent:
+ [[NSDictionary alloc] initWithObjectsAndKeys:
+ [NSNumber numberWithInt:kInputMouseSecondUp], @"type",
+ [NSNumber numberWithInt:x], @"x",
+ [NSNumber numberWithInt:y], @"y",
+ nil
+ ]
+ ];
+ break;
+ }
+ }
+}
+
+- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event {
+}
+
+- (void)handleKeyPress:(unichar)c {
+ [self addEvent:
+ [[NSDictionary alloc] initWithObjectsAndKeys:
+ [NSNumber numberWithInt:kInputKeyPressed], @"type",
+ [NSNumber numberWithInt:c], @"x",
+ [NSNumber numberWithInt:0], @"y",
+ nil
+ ]
+ ];
+}
+
+- (BOOL)canHandleSwipes {
+ return TRUE;
+}
+
+- (int)swipe:(int)num withEvent:(struct __GSEvent *)event {
+ //printf("swipe: %i\n", num);
+
+ [self addEvent:
+ [[NSDictionary alloc] initWithObjectsAndKeys:
+ [NSNumber numberWithInt:kInputSwipe], @"type",
+ [NSNumber numberWithInt:num], @"x",
+ [NSNumber numberWithInt:0], @"y",
+ nil
+ ]
+ ];
+
+ return 0;
+}
+
+- (void)applicationSuspend {
+ [self addEvent:
+ [[NSDictionary alloc] initWithObjectsAndKeys:
+ [NSNumber numberWithInt:kInputApplicationSuspended], @"type",
+ [NSNumber numberWithInt:0], @"x",
+ [NSNumber numberWithInt:0], @"y",
+ nil
+ ]
+ ];
+}
+
+- (void)applicationResume {
+ [self addEvent:
+ [[NSDictionary alloc] initWithObjectsAndKeys:
+ [NSNumber numberWithInt:kInputApplicationResumed], @"type",
+ [NSNumber numberWithInt:0], @"x",
+ [NSNumber numberWithInt:0], @"y",
+ nil
+ ]
+ ];
+}
+
+@end
diff --git a/backends/platform/iphone/module.mk b/backends/platform/iphone/module.mk
index 9768e6ded4..ea5115782f 100644
--- a/backends/platform/iphone/module.mk
+++ b/backends/platform/iphone/module.mk
@@ -7,8 +7,7 @@ MODULE_OBJS := \
osys_video.o \
iphone_main.o \
iphone_video.o \
- iphone_keyboard.o \
- blit_arm.o
+ iphone_keyboard.o
# We don't use rules.mk but rather manually update OBJS and MODULE_DIRS.
MODULE_OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS))
diff --git a/backends/platform/iphone/osys_events.cpp b/backends/platform/iphone/osys_events.cpp
index 1ab1db0f27..85efbda208 100644
--- a/backends/platform/iphone/osys_events.cpp
+++ b/backends/platform/iphone/osys_events.cpp
@@ -40,98 +40,66 @@ bool OSystem_IPHONE::pollEvent(Common::Event &event) {
_timerCallbackNext = curTime + _timerCallbackTimer;
}
- if (_queuedInputEvent.type != (Common::EventType)0 && curTime >= _queuedEventTime) {
+ if (_queuedInputEvent.type != Common::EVENT_INVALID && curTime >= _queuedEventTime) {
event = _queuedInputEvent;
- _queuedInputEvent.type = (Common::EventType)0;
+ _queuedInputEvent.type = Common::EVENT_INVALID;
return true;
}
int eventType;
- float xUnit, yUnit;
-
- if (iPhone_fetchEvent(&eventType, &xUnit, &yUnit)) {
- int x = 0;
- int y = 0;
- switch (_screenOrientation) {
- case kScreenOrientationPortrait:
- if (_overlayVisible) {
- x = (int)(xUnit * _overlayWidth);
- y = (int)(yUnit * _overlayHeight);
- } else {
- x = (int)(xUnit * _screenWidth);
- y = (int)(yUnit * _screenHeight);
- }
- break;
- case kScreenOrientationLandscape:
- if (_overlayVisible) {
- x = (int)(yUnit * _overlayWidth);
- y = (int)((1.0 - xUnit) * _overlayHeight);
- } else {
- x = (int)(yUnit * _screenWidth);
- y = (int)((1.0 - xUnit) * _screenHeight);
- }
- break;
- case kScreenOrientationFlippedLandscape:
- if (_overlayVisible) {
- x = (int)((1.0 - yUnit) * _overlayWidth);
- y = (int)(xUnit * _overlayHeight);
- } else {
- x = (int)((1.0 - yUnit) * _screenWidth);
- y = (int)(xUnit * _screenHeight);
- }
- break;
- }
+ int x, y;
+ if (iPhone_fetchEvent(&eventType, &x, &y)) {
switch ((InputEvent)eventType) {
- case kInputMouseDown:
- if (!handleEvent_mouseDown(event, x, y))
- return false;
- break;
+ case kInputMouseDown:
+ if (!handleEvent_mouseDown(event, x, y))
+ return false;
+ break;
- case kInputMouseUp:
+ case kInputMouseUp:
if (!handleEvent_mouseUp(event, x, y))
return false;
- break;
-
- case kInputMouseDragged:
- if (!handleEvent_mouseDragged(event, x, y))
- return false;
- break;
- case kInputMouseSecondDragged:
- if (!handleEvent_mouseSecondDragged(event, x, y))
- return false;
- break;
- case kInputMouseSecondDown:
- _secondaryTapped = true;
- if (!handleEvent_secondMouseDown(event, x, y))
- return false;
- break;
- case kInputMouseSecondUp:
- _secondaryTapped = false;
- if (!handleEvent_secondMouseUp(event, x, y))
- return false;
- break;
- case kInputOrientationChanged:
- handleEvent_orientationChanged((int)xUnit);
- return false;
- break;
+ break;
- case kInputApplicationSuspended:
- suspendLoop();
+ case kInputMouseDragged:
+ if (!handleEvent_mouseDragged(event, x, y))
+ return false;
+ break;
+ case kInputMouseSecondDragged:
+ if (!handleEvent_mouseSecondDragged(event, x, y))
+ return false;
+ break;
+ case kInputMouseSecondDown:
+ _secondaryTapped = true;
+ if (!handleEvent_secondMouseDown(event, x, y))
+ return false;
+ break;
+ case kInputMouseSecondUp:
+ _secondaryTapped = false;
+ if (!handleEvent_secondMouseUp(event, x, y))
return false;
- break;
+ break;
+ case kInputOrientationChanged:
+ handleEvent_orientationChanged(x);
+ return false;
+ break;
- case kInputKeyPressed:
- handleEvent_keyPressed(event, (int)xUnit);
- break;
+ case kInputApplicationSuspended:
+ suspendLoop();
+ return false;
+ break;
- case kInputSwipe:
- if (!handleEvent_swipe(event, (int)xUnit))
- return false;
- break;
+ case kInputKeyPressed:
+ handleEvent_keyPressed(event, x);
+ break;
+
+ case kInputSwipe:
+ if (!handleEvent_swipe(event, x))
+ return false;
+ break;
- default:
- break;
+ default:
+ break;
}
return true;
@@ -154,8 +122,8 @@ bool OSystem_IPHONE::handleEvent_mouseDown(Common::Event &event, int x, int y) {
if (_mouseClickAndDragEnabled) {
event.type = Common::EVENT_LBUTTONDOWN;
- event.mouse.x = _mouseX;
- event.mouse.y = _mouseY;
+ event.mouse.x = _videoContext->mouseX;
+ event.mouse.y = _videoContext->mouseY;
return true;
} else {
_lastMouseDown = getMillis();
@@ -170,20 +138,19 @@ bool OSystem_IPHONE::handleEvent_mouseUp(Common::Event &event, int x, int y) {
_secondaryTapped = false;
if (!handleEvent_secondMouseUp(event, x, y))
return false;
- }
- else if (_mouseClickAndDragEnabled) {
+ } else if (_mouseClickAndDragEnabled) {
event.type = Common::EVENT_LBUTTONUP;
- event.mouse.x = _mouseX;
- event.mouse.y = _mouseY;
+ event.mouse.x = _videoContext->mouseX;
+ event.mouse.y = _videoContext->mouseY;
} else {
if (getMillis() - _lastMouseDown < 250) {
event.type = Common::EVENT_LBUTTONDOWN;
- event.mouse.x = _mouseX;
- event.mouse.y = _mouseY;
+ event.mouse.x = _videoContext->mouseX;
+ event.mouse.y = _videoContext->mouseY;
_queuedInputEvent.type = Common::EVENT_LBUTTONUP;
- _queuedInputEvent.mouse.x = _mouseX;
- _queuedInputEvent.mouse.y = _mouseY;
+ _queuedInputEvent.mouse.x = _videoContext->mouseX;
+ _queuedInputEvent.mouse.y = _videoContext->mouseY;
_lastMouseTap = getMillis();
_queuedEventTime = _lastMouseTap + kQueuedInputEventDelay;
} else
@@ -200,14 +167,13 @@ bool OSystem_IPHONE::handleEvent_secondMouseDown(Common::Event &event, int x, in
if (_mouseClickAndDragEnabled) {
event.type = Common::EVENT_LBUTTONUP;
- event.mouse.x = _mouseX;
- event.mouse.y = _mouseY;
+ event.mouse.x = _videoContext->mouseX;
+ event.mouse.y = _videoContext->mouseY;
_queuedInputEvent.type = Common::EVENT_RBUTTONDOWN;
- _queuedInputEvent.mouse.x = _mouseX;
- _queuedInputEvent.mouse.y = _mouseY;
- }
- else
+ _queuedInputEvent.mouse.x = _videoContext->mouseX;
+ _queuedInputEvent.mouse.y = _videoContext->mouseY;
+ } else
return false;
return true;
@@ -216,9 +182,9 @@ bool OSystem_IPHONE::handleEvent_secondMouseDown(Common::Event &event, int x, in
bool OSystem_IPHONE::handleEvent_secondMouseUp(Common::Event &event, int x, int y) {
int curTime = getMillis();
- if (curTime - _lastSecondaryDown < 400 ) {
+ if (curTime - _lastSecondaryDown < 400) {
//printf("Right tap!\n");
- if (curTime - _lastSecondaryTap < 400 && !_overlayVisible) {
+ if (curTime - _lastSecondaryTap < 400 && !_videoContext->overlayVisible) {
//printf("Right escape!\n");
event.type = Common::EVENT_KEYDOWN;
_queuedInputEvent.type = Common::EVENT_KEYUP;
@@ -231,11 +197,11 @@ bool OSystem_IPHONE::handleEvent_secondMouseUp(Common::Event &event, int x, int
} else if (!_mouseClickAndDragEnabled) {
//printf("Rightclick!\n");
event.type = Common::EVENT_RBUTTONDOWN;
- event.mouse.x = _mouseX;
- event.mouse.y = _mouseY;
+ event.mouse.x = _videoContext->mouseX;
+ event.mouse.y = _videoContext->mouseY;
_queuedInputEvent.type = Common::EVENT_RBUTTONUP;
- _queuedInputEvent.mouse.x = _mouseX;
- _queuedInputEvent.mouse.y = _mouseY;
+ _queuedInputEvent.mouse.x = _videoContext->mouseX;
+ _queuedInputEvent.mouse.y = _videoContext->mouseY;
_lastSecondaryTap = curTime;
_queuedEventTime = curTime + kQueuedInputEventDelay;
} else {
@@ -245,8 +211,8 @@ bool OSystem_IPHONE::handleEvent_secondMouseUp(Common::Event &event, int x, int
}
if (_mouseClickAndDragEnabled) {
event.type = Common::EVENT_RBUTTONUP;
- event.mouse.x = _mouseX;
- event.mouse.y = _mouseY;
+ event.mouse.x = _videoContext->mouseX;
+ event.mouse.y = _videoContext->mouseY;
}
return true;
@@ -262,17 +228,17 @@ bool OSystem_IPHONE::handleEvent_mouseDragged(Common::Event &event, int x, int y
//printf("Mouse dragged at (%u, %u)\n", x, y);
int mouseNewPosX;
int mouseNewPosY;
- if (_touchpadModeEnabled ) {
+ if (_touchpadModeEnabled) {
int deltaX = _lastPadX - x;
int deltaY = _lastPadY - y;
_lastPadX = x;
_lastPadY = y;
- mouseNewPosX = (int)(_mouseX - deltaX / 0.5f);
- mouseNewPosY = (int)(_mouseY - deltaY / 0.5f);
+ mouseNewPosX = (int)(_videoContext->mouseX - deltaX / 0.5f);
+ mouseNewPosY = (int)(_videoContext->mouseY - deltaY / 0.5f);
- int widthCap = _overlayVisible ? _overlayWidth : _screenWidth;
- int heightCap = _overlayVisible ? _overlayHeight : _screenHeight;
+ int widthCap = _videoContext->overlayVisible ? _videoContext->overlayWidth : _videoContext->screenWidth;
+ int heightCap = _videoContext->overlayVisible ? _videoContext->overlayHeight : _videoContext->screenHeight;
if (mouseNewPosX < 0)
mouseNewPosX = 0;
@@ -319,12 +285,9 @@ bool OSystem_IPHONE::handleEvent_mouseSecondDragged(Common::Event &event, int x,
if (absX < kMaxDeviation && vecY >= kNeededLength) {
// Swipe down
- event.type = Common::EVENT_KEYDOWN;
- _queuedInputEvent.type = Common::EVENT_KEYUP;
+ event.type = Common::EVENT_MAINMENU;
+ _queuedInputEvent.type = Common::EVENT_INVALID;
- event.kbd.flags = _queuedInputEvent.kbd.flags = 0;
- event.kbd.keycode = _queuedInputEvent.kbd.keycode = Common::KEYCODE_F5;
- event.kbd.ascii = _queuedInputEvent.kbd.ascii = Common::ASCII_F5;
_queuedEventTime = getMillis() + kQueuedInputEventDelay;
return true;
}
@@ -371,26 +334,26 @@ void OSystem_IPHONE::handleEvent_orientationChanged(int orientation) {
ScreenOrientation newOrientation;
switch (orientation) {
- case 1:
- newOrientation = kScreenOrientationPortrait;
- break;
- case 3:
- newOrientation = kScreenOrientationLandscape;
- break;
- case 4:
- newOrientation = kScreenOrientationFlippedLandscape;
- break;
- default:
- return;
+ case 1:
+ newOrientation = kScreenOrientationPortrait;
+ break;
+ case 3:
+ newOrientation = kScreenOrientationLandscape;
+ break;
+ case 4:
+ newOrientation = kScreenOrientationFlippedLandscape;
+ break;
+ default:
+ return;
}
if (_screenOrientation != newOrientation) {
_screenOrientation = newOrientation;
- iPhone_initSurface(_screenWidth, _screenHeight);
+ updateOutputSurface();
dirtyFullScreen();
- if (_overlayVisible)
+ if (_videoContext->overlayVisible)
dirtyFullOverlayScreen();
updateScreen();
}
@@ -403,50 +366,50 @@ void OSystem_IPHONE::handleEvent_keyPressed(Common::Event &event, int keyPresse
// We remap some of the iPhone keyboard keys.
// The first ten here are the row of symbols below the numeric keys.
switch (keyPressed) {
- case 45:
- keyPressed = Common::KEYCODE_F1;
- ascii = Common::ASCII_F1;
- break;
- case 47:
- keyPressed = Common::KEYCODE_F2;
- ascii = Common::ASCII_F2;
- break;
- case 58:
- keyPressed = Common::KEYCODE_F3;
- ascii = Common::ASCII_F3;
- break;
- case 59:
- keyPressed = Common::KEYCODE_F4;
- ascii = Common::ASCII_F4;
- break;
- case 40:
- keyPressed = Common::KEYCODE_F5;
- ascii = Common::ASCII_F5;
- break;
- case 41:
- keyPressed = Common::KEYCODE_F6;
- ascii = Common::ASCII_F6;
- break;
- case 36:
- keyPressed = Common::KEYCODE_F7;
- ascii = Common::ASCII_F7;
- break;
- case 38:
- keyPressed = Common::KEYCODE_F8;
- ascii = Common::ASCII_F8;
- break;
- case 64:
- keyPressed = Common::KEYCODE_F9;
- ascii = Common::ASCII_F9;
- break;
- case 34:
- keyPressed = Common::KEYCODE_F10;
- ascii = Common::ASCII_F10;
- break;
- case 10:
- keyPressed = Common::KEYCODE_RETURN;
- ascii = Common::ASCII_RETURN;
- break;
+ case 45:
+ keyPressed = Common::KEYCODE_F1;
+ ascii = Common::ASCII_F1;
+ break;
+ case 47:
+ keyPressed = Common::KEYCODE_F2;
+ ascii = Common::ASCII_F2;
+ break;
+ case 58:
+ keyPressed = Common::KEYCODE_F3;
+ ascii = Common::ASCII_F3;
+ break;
+ case 59:
+ keyPressed = Common::KEYCODE_F4;
+ ascii = Common::ASCII_F4;
+ break;
+ case 40:
+ keyPressed = Common::KEYCODE_F5;
+ ascii = Common::ASCII_F5;
+ break;
+ case 41:
+ keyPressed = Common::KEYCODE_F6;
+ ascii = Common::ASCII_F6;
+ break;
+ case 36:
+ keyPressed = Common::KEYCODE_F7;
+ ascii = Common::ASCII_F7;
+ break;
+ case 38:
+ keyPressed = Common::KEYCODE_F8;
+ ascii = Common::ASCII_F8;
+ break;
+ case 64:
+ keyPressed = Common::KEYCODE_F9;
+ ascii = Common::ASCII_F9;
+ break;
+ case 34:
+ keyPressed = Common::KEYCODE_F10;
+ ascii = Common::ASCII_F10;
+ break;
+ case 10:
+ keyPressed = Common::KEYCODE_RETURN;
+ ascii = Common::ASCII_RETURN;
+ break;
}
event.type = Common::EVENT_KEYDOWN;
_queuedInputEvent.type = Common::EVENT_KEYUP;
@@ -460,60 +423,60 @@ void OSystem_IPHONE::handleEvent_keyPressed(Common::Event &event, int keyPresse
bool OSystem_IPHONE::handleEvent_swipe(Common::Event &event, int direction) {
Common::KeyCode keycode = Common::KEYCODE_INVALID;
switch (_screenOrientation) {
- case kScreenOrientationPortrait:
- switch ((UIViewSwipeDirection)direction) {
- case kUIViewSwipeUp:
- keycode = Common::KEYCODE_UP;
- break;
- case kUIViewSwipeDown:
- keycode = Common::KEYCODE_DOWN;
- break;
- case kUIViewSwipeLeft:
- keycode = Common::KEYCODE_LEFT;
- break;
- case kUIViewSwipeRight:
- keycode = Common::KEYCODE_RIGHT;
- break;
- default:
- return false;
- }
+ case kScreenOrientationPortrait:
+ switch ((UIViewSwipeDirection)direction) {
+ case kUIViewSwipeUp:
+ keycode = Common::KEYCODE_UP;
+ break;
+ case kUIViewSwipeDown:
+ keycode = Common::KEYCODE_DOWN;
break;
- case kScreenOrientationLandscape:
- switch ((UIViewSwipeDirection)direction) {
- case kUIViewSwipeUp:
- keycode = Common::KEYCODE_LEFT;
- break;
- case kUIViewSwipeDown:
- keycode = Common::KEYCODE_RIGHT;
- break;
- case kUIViewSwipeLeft:
- keycode = Common::KEYCODE_DOWN;
- break;
- case kUIViewSwipeRight:
- keycode = Common::KEYCODE_UP;
- break;
- default:
- return false;
- }
+ case kUIViewSwipeLeft:
+ keycode = Common::KEYCODE_LEFT;
break;
- case kScreenOrientationFlippedLandscape:
- switch ((UIViewSwipeDirection)direction) {
- case kUIViewSwipeUp:
- keycode = Common::KEYCODE_RIGHT;
- break;
- case kUIViewSwipeDown:
- keycode = Common::KEYCODE_LEFT;
- break;
- case kUIViewSwipeLeft:
- keycode = Common::KEYCODE_UP;
- break;
- case kUIViewSwipeRight:
- keycode = Common::KEYCODE_DOWN;
- break;
- default:
- return false;
- }
+ case kUIViewSwipeRight:
+ keycode = Common::KEYCODE_RIGHT;
break;
+ default:
+ return false;
+ }
+ break;
+ case kScreenOrientationLandscape:
+ switch ((UIViewSwipeDirection)direction) {
+ case kUIViewSwipeUp:
+ keycode = Common::KEYCODE_LEFT;
+ break;
+ case kUIViewSwipeDown:
+ keycode = Common::KEYCODE_RIGHT;
+ break;
+ case kUIViewSwipeLeft:
+ keycode = Common::KEYCODE_DOWN;
+ break;
+ case kUIViewSwipeRight:
+ keycode = Common::KEYCODE_UP;
+ break;
+ default:
+ return false;
+ }
+ break;
+ case kScreenOrientationFlippedLandscape:
+ switch ((UIViewSwipeDirection)direction) {
+ case kUIViewSwipeUp:
+ keycode = Common::KEYCODE_RIGHT;
+ break;
+ case kUIViewSwipeDown:
+ keycode = Common::KEYCODE_LEFT;
+ break;
+ case kUIViewSwipeLeft:
+ keycode = Common::KEYCODE_UP;
+ break;
+ case kUIViewSwipeRight:
+ keycode = Common::KEYCODE_DOWN;
+ break;
+ default:
+ return false;
+ }
+ break;
}
event.kbd.keycode = _queuedInputEvent.kbd.keycode = keycode;
diff --git a/backends/platform/iphone/osys_main.cpp b/backends/platform/iphone/osys_main.cpp
index 4bc567c39d..dabf73bf58 100644
--- a/backends/platform/iphone/osys_main.cpp
+++ b/backends/platform/iphone/osys_main.cpp
@@ -45,7 +45,9 @@
const OSystem::GraphicsMode OSystem_IPHONE::s_supportedGraphicsModes[] = {
- {0, 0, 0}
+ { "linear", "Linear filtering", kGraphicsModeLinear },
+ { "none", "No filtering", kGraphicsModeNone },
+ { 0, 0, 0 }
};
AQCallbackStruct OSystem_IPHONE::s_AudioQueue;
@@ -53,28 +55,24 @@ SoundProc OSystem_IPHONE::s_soundCallback = NULL;
void *OSystem_IPHONE::s_soundParam = NULL;
OSystem_IPHONE::OSystem_IPHONE() :
- _mixer(NULL), _offscreen(NULL),
- _overlayVisible(false), _fullscreen(NULL),
- _mouseHeight(0), _mouseWidth(0), _mouseBuf(NULL), _lastMouseTap(0), _queuedEventTime(0),
- _secondaryTapped(false), _lastSecondaryTap(0),
+ _mixer(NULL), _gameScreenRaw(NULL),
+ _mouseBuf(NULL), _lastMouseTap(0), _queuedEventTime(0),
+ _mouseNeedTextureUpdate(false), _secondaryTapped(false), _lastSecondaryTap(0),
_screenOrientation(kScreenOrientationFlippedLandscape), _mouseClickAndDragEnabled(false),
_gestureStartX(-1), _gestureStartY(-1), _fullScreenIsDirty(false), _fullScreenOverlayIsDirty(false),
_mouseDirty(false), _timeSuspended(0), _lastDragPosX(-1), _lastDragPosY(-1), _screenChangeCount(0),
- _overlayHeight(0), _overlayWidth(0), _overlayBuffer(0)
-{
- _queuedInputEvent.type = (Common::EventType)0;
- _lastDrawnMouseRect = Common::Rect(0, 0, 0, 0);
-
+ _mouseCursorPaletteEnabled(false) {
+ _queuedInputEvent.type = Common::EVENT_INVALID;
_touchpadModeEnabled = !iPhone_isHighResDevice();
_fsFactory = new POSIXFilesystemFactory();
+ initVideoContext();
}
OSystem_IPHONE::~OSystem_IPHONE() {
AudioQueueDispose(s_AudioQueue.queue, true);
delete _mixer;
- delete _offscreen;
- delete _fullscreen;
+ free(_gameScreenRaw);
}
int OSystem_IPHONE::timerHandler(int t) {
@@ -102,26 +100,50 @@ void OSystem_IPHONE::initBackend() {
}
bool OSystem_IPHONE::hasFeature(Feature f) {
- return false;
+ switch (f) {
+ case kFeatureCursorPalette:
+ return true;
+
+ default:
+ return false;
+ }
}
void OSystem_IPHONE::setFeatureState(Feature f, bool enable) {
+ switch (f) {
+ case kFeatureCursorPalette:
+ if (_mouseCursorPaletteEnabled != enable) {
+ _mouseNeedTextureUpdate = true;
+ _mouseDirty = true;
+ _mouseCursorPaletteEnabled = enable;
+ }
+ break;
+
+ default:
+ break;
+ }
}
bool OSystem_IPHONE::getFeatureState(Feature f) {
- return false;
+ switch (f) {
+ case kFeatureCursorPalette:
+ return _mouseCursorPaletteEnabled;
+
+ default:
+ return false;
+ }
}
void OSystem_IPHONE::suspendLoop() {
bool done = false;
int eventType;
- float xUnit, yUnit;
+ int x, y;
uint32 startTime = getMillis();
stopSoundsystem();
while (!done) {
- if (iPhone_fetchEvent(&eventType, &xUnit, &yUnit))
+ if (iPhone_fetchEvent(&eventType, &x, &y))
if ((InputEvent)eventType == kInputApplicationResumed)
done = true;
usleep(100000);
@@ -226,7 +248,6 @@ Common::String OSystem_IPHONE::getDefaultConfigFileName() {
#endif
}
-
void OSystem_IPHONE::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) {
// Get URL of the Resource directory of the .app bundle
CFURLRef fileUrl = CFBundleCopyResourcesDirectoryURL(CFBundleGetMainBundle());
@@ -272,7 +293,7 @@ void iphone_main(int argc, char *argv[]) {
}
#ifdef IPHONE_OFFICIAL
- chdir( iPhone_getDocumentsDir() );
+ chdir(iPhone_getDocumentsDir());
#else
system("mkdir " SCUMMVM_ROOT_PATH);
system("mkdir " SCUMMVM_SAVE_PATH);
diff --git a/backends/platform/iphone/osys_main.h b/backends/platform/iphone/osys_main.h
index 37896cceeb..180d3e9d06 100644
--- a/backends/platform/iphone/osys_main.h
+++ b/backends/platform/iphone/osys_main.h
@@ -20,6 +20,9 @@
*
*/
+#ifndef BACKENDS_PLATFORM_IPHONE_OSYS_MAIN_H
+#define BACKENDS_PLATFORM_IPHONE_OSYS_MAIN_H
+
#include "graphics/surface.h"
#include "iphone_common.h"
#include "backends/base-backend.h"
@@ -42,16 +45,15 @@
typedef void (*SoundProc)(void *param, byte *buf, int len);
typedef int (*TimerProc)(int interval);
-typedef struct AQCallbackStruct {
- AudioQueueRef queue;
- uint32 frameCount;
- AudioQueueBufferRef buffers[AUDIO_BUFFERS];
- AudioStreamBasicDescription dataFormat;
-} AQCallbackStruct;
+struct AQCallbackStruct {
+ AudioQueueRef queue;
+ uint32 frameCount;
+ AudioQueueBufferRef buffers[AUDIO_BUFFERS];
+ AudioStreamBasicDescription dataFormat;
+};
class OSystem_IPHONE : public EventsBaseBackend, public PaletteManager {
protected:
-
static const OSystem::GraphicsMode s_supportedGraphicsModes[];
static AQCallbackStruct s_AudioQueue;
static SoundProc s_soundCallback;
@@ -59,33 +61,28 @@ protected:
Audio::MixerImpl *_mixer;
- Graphics::Surface _framebuffer;
- byte *_offscreen;
- OverlayColor *_overlayBuffer;
- uint16 _overlayHeight;
- uint16 _overlayWidth;
+ VideoContext *_videoContext;
- uint16 *_fullscreen;
+ Graphics::Surface _framebuffer;
+ byte *_gameScreenRaw;
- uint16 _palette[256];
- bool _overlayVisible;
- uint16 _screenWidth;
- uint16 _screenHeight;
+ // For use with the game texture
+ uint16 _gamePalette[256];
+ // For use with the mouse texture
+ uint16 _gamePaletteRGBA5551[256];
struct timeval _startTime;
uint32 _timeSuspended;
- bool _mouseVisible;
+ bool _mouseCursorPaletteEnabled;
+ uint16 _mouseCursorPalette[256];
byte *_mouseBuf;
byte _mouseKeyColor;
- uint _mouseWidth, _mouseHeight;
- uint _mouseX, _mouseY;
- int _mouseHotspotX, _mouseHotspotY;
bool _mouseDirty;
+ bool _mouseNeedTextureUpdate;
long _lastMouseDown;
long _lastMouseTap;
long _queuedEventTime;
- Common::Rect _lastDrawnMouseRect;
Common::Event _queuedInputEvent;
bool _secondaryTapped;
long _lastSecondaryDown;
@@ -121,7 +118,6 @@ public:
virtual bool getFeatureState(Feature f);
virtual const GraphicsMode *getSupportedGraphicsModes() const;
virtual int getDefaultGraphicsMode() const;
- bool setGraphicsMode(const char *name);
virtual bool setGraphicsMode(int mode);
virtual int getGraphicsMode() const;
virtual void initSize(uint width, uint height, const Graphics::PixelFormat *format);
@@ -154,6 +150,7 @@ public:
virtual void warpMouse(int x, int y);
virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor = 255, int cursorTargetScale = 1, const Graphics::PixelFormat *format = NULL);
+ virtual void setCursorPalette(const byte *colors, uint start, uint num);
virtual bool pollEvent(Common::Event &event);
virtual uint32 getMillis();
@@ -167,7 +164,7 @@ public:
static void mixCallback(void *sys, byte *samples, int len);
virtual void setupMixer(void);
virtual void setTimerCallback(TimerProc callback, int interval);
- virtual int getScreenChangeID() const { return _screenChangeCount; }
+ virtual int getScreenChangeID() const { return _screenChangeCount; }
virtual void quit();
virtual void addSysArchivesToSearchSet(Common::SearchSet &s, int priority = 0);
@@ -183,15 +180,15 @@ public:
virtual void logMessage(LogMessageType::Type type, const char *message);
protected:
+ void initVideoContext();
+ void updateOutputSurface();
+
void internUpdateScreen();
void dirtyFullScreen();
void dirtyFullOverlayScreen();
- void clipRectToScreen(int16 &x, int16 &y, int16 &w, int16 &h);
void suspendLoop();
- void drawDirtyRect(const Common::Rect& dirtyRect);
- void drawDirtyOverlayRect(const Common::Rect& dirtyRect);
- void drawMouseCursorOnRectUpdate(const Common::Rect& updatedRect, const Common::Rect& mouseRect);
- void updateHardwareSurfaceForRect(const Common::Rect& updatedRect);
+ void drawDirtyRect(const Common::Rect &dirtyRect);
+ void updateMouseTexture();
static void AQBufferCallback(void *in, AudioQueueRef inQ, AudioQueueBufferRef outQB);
static int timerHandler(int t);
@@ -208,3 +205,5 @@ protected:
bool handleEvent_mouseDragged(Common::Event &event, int x, int y);
bool handleEvent_mouseSecondDragged(Common::Event &event, int x, int y);
};
+
+#endif
diff --git a/backends/platform/iphone/osys_video.cpp b/backends/platform/iphone/osys_video.cpp
deleted file mode 100644
index fa425b108a..0000000000
--- a/backends/platform/iphone/osys_video.cpp
+++ /dev/null
@@ -1,503 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * 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.
- *
- */
-
-// Disable symbol overrides so that we can use system headers.
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
-
-#include "osys_main.h"
-
-const OSystem::GraphicsMode* OSystem_IPHONE::getSupportedGraphicsModes() const {
- return s_supportedGraphicsModes;
-}
-
-
-int OSystem_IPHONE::getDefaultGraphicsMode() const {
- return -1;
-}
-
-bool OSystem_IPHONE::setGraphicsMode(const char *mode) {
- return true;
-}
-
-bool OSystem_IPHONE::setGraphicsMode(int mode) {
- return true;
-}
-
-int OSystem_IPHONE::getGraphicsMode() const {
- return -1;
-}
-
-void OSystem_IPHONE::initSize(uint width, uint height, const Graphics::PixelFormat *format) {
- //printf("initSize(%i, %i)\n", width, height);
-
- _screenWidth = width;
- _screenHeight = height;
-
- free(_offscreen);
-
- _offscreen = (byte *)malloc(width * height);
- bzero(_offscreen, width * height);
-
- //free(_overlayBuffer);
-
- int fullSize = _screenWidth * _screenHeight * sizeof(OverlayColor);
- //_overlayBuffer = (OverlayColor *)malloc(fullSize);
- clearOverlay();
-
- free(_fullscreen);
-
- _fullscreen = (uint16 *)malloc(fullSize);
- bzero(_fullscreen, fullSize);
-
- iPhone_initSurface(width, height);
-
- if (_overlayBuffer == NULL) {
- _overlayHeight = iPhone_getScreenHeight();
- _overlayWidth = iPhone_getScreenWidth();
-
- printf("Overlay: (%u x %u)\n", _overlayWidth, _overlayHeight);
- _overlayBuffer = new OverlayColor[_overlayHeight * _overlayWidth];
- }
-
- _fullScreenIsDirty = false;
- dirtyFullScreen();
- _mouseVisible = false;
- _screenChangeCount++;
- updateScreen();
-}
-
-int16 OSystem_IPHONE::getHeight() {
- return _screenHeight;
-}
-
-int16 OSystem_IPHONE::getWidth() {
- return _screenWidth;
-}
-
-void OSystem_IPHONE::setPalette(const byte *colors, uint start, uint num) {
- assert(start + num <= 256);
- const byte *b = colors;
-
- for (uint i = start; i < start + num; ++i) {
- _palette[i] = Graphics::RGBToColor<Graphics::ColorMasks<565> >(b[0], b[1], b[2]);
- b += 3;
- }
-
- dirtyFullScreen();
-}
-
-void OSystem_IPHONE::grabPalette(byte *colors, uint start, uint num) {
- assert(start + num <= 256);
- byte *b = colors;
-
- for (uint i = start; i < start + num; ++i) {
- Graphics::colorToRGB<Graphics::ColorMasks<565> >(_palette[i], b[0], b[1], b[2]);
- b += 3;
- }
-}
-
-void OSystem_IPHONE::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) {
- //printf("copyRectToScreen(%i, %i, %i, %i)\n", x, y, w, h);
- //Clip the coordinates
- if (x < 0) {
- w += x;
- buf -= x;
- x = 0;
- }
-
- if (y < 0) {
- h += y;
- buf -= y * pitch;
- y = 0;
- }
-
- if (w > _screenWidth - x) {
- w = _screenWidth - x;
- }
-
- if (h > _screenHeight - y) {
- h = _screenHeight - y;
- }
-
- if (w <= 0 || h <= 0)
- return;
-
- if (!_fullScreenIsDirty) {
- _dirtyRects.push_back(Common::Rect(x, y, x + w, y + h));
- }
-
-
- byte *dst = _offscreen + y * _screenWidth + x;
- if (_screenWidth == pitch && pitch == w)
- memcpy(dst, buf, h * w);
- else {
- do {
- memcpy(dst, buf, w);
- buf += pitch;
- dst += _screenWidth;
- } while (--h);
- }
-}
-
-void OSystem_IPHONE::clipRectToScreen(int16 &x, int16 &y, int16 &w, int16 &h) {
- if (x < 0) {
- w += x;
- x = 0;
- }
-
- if (y < 0) {
- h += y;
- y = 0;
- }
-
- if (w > _screenWidth - x)
- w = _screenWidth - x;
-
- if (h > _screenHeight - y)
- h = _screenHeight - y;
-
- if (w < 0) {
- w = 0;
- }
-
- if (h < 0) {
- h = 0;
- }
-}
-
-void OSystem_IPHONE::updateScreen() {
- //printf("updateScreen(): %i dirty rects.\n", _dirtyRects.size());
-
- if (_dirtyRects.size() == 0 && _dirtyOverlayRects.size() == 0 && !_mouseDirty)
- return;
-
- internUpdateScreen();
- _fullScreenIsDirty = false;
- _fullScreenOverlayIsDirty = false;
-
- iPhone_updateScreen(_mouseX - _mouseHotspotX, _mouseY - _mouseHotspotY);
-}
-
-void OSystem_IPHONE::internUpdateScreen() {
- int16 mouseX = _mouseX - _mouseHotspotX;
- int16 mouseY = _mouseY - _mouseHotspotY;
- int16 mouseWidth = _mouseWidth;
- int16 mouseHeight = _mouseHeight;
-
- clipRectToScreen(mouseX, mouseY, mouseWidth, mouseHeight);
-
- Common::Rect mouseRect(mouseX, mouseY, mouseX + mouseWidth, mouseY + mouseHeight);
-
- if (_mouseDirty) {
- if (!_fullScreenIsDirty) {
- _dirtyRects.push_back(_lastDrawnMouseRect);
- _dirtyRects.push_back(mouseRect);
- }
- if (!_fullScreenOverlayIsDirty && _overlayVisible) {
- _dirtyOverlayRects.push_back(_lastDrawnMouseRect);
- _dirtyOverlayRects.push_back(mouseRect);
- }
- _mouseDirty = false;
- _lastDrawnMouseRect = mouseRect;
- }
-
- while (_dirtyRects.size()) {
- Common::Rect dirtyRect = _dirtyRects.remove_at(_dirtyRects.size() - 1);
-
- //printf("Drawing: (%i, %i) -> (%i, %i)\n", dirtyRect.left, dirtyRect.top, dirtyRect.right, dirtyRect.bottom);
-
- drawDirtyRect(dirtyRect);
-
- if (_overlayVisible)
- drawDirtyOverlayRect(dirtyRect);
- else
- drawMouseCursorOnRectUpdate(dirtyRect, mouseRect);
-
- updateHardwareSurfaceForRect(dirtyRect);
- }
-
- if (_overlayVisible) {
- while (_dirtyOverlayRects.size()) {
- Common::Rect dirtyRect = _dirtyOverlayRects.remove_at(_dirtyOverlayRects.size() - 1);
-
- //printf("Drawing: (%i, %i) -> (%i, %i)\n", dirtyRect.left, dirtyRect.top, dirtyRect.right, dirtyRect.bottom);
-
- drawDirtyOverlayRect(dirtyRect);
- //drawMouseCursorOnRectUpdate(dirtyRect, mouseRect);
- //updateHardwareSurfaceForRect(dirtyRect);
- }
- }
-}
-
-void OSystem_IPHONE::drawDirtyRect(const Common::Rect& dirtyRect) {
- int h = dirtyRect.bottom - dirtyRect.top;
- int w = dirtyRect.right - dirtyRect.left;
-
- byte *src = &_offscreen[dirtyRect.top * _screenWidth + dirtyRect.left];
- uint16 *dst = &_fullscreen[dirtyRect.top * _screenWidth + dirtyRect.left];
- for (int y = h; y > 0; y--) {
- for (int x = w; x > 0; x--)
- *dst++ = _palette[*src++];
-
- dst += _screenWidth - w;
- src += _screenWidth - w;
- }
-}
-
-void OSystem_IPHONE::drawDirtyOverlayRect(const Common::Rect& dirtyRect) {
- // int h = dirtyRect.bottom - dirtyRect.top;
- //
- // uint16 *src = (uint16 *)&_overlayBuffer[dirtyRect.top * _screenWidth + dirtyRect.left];
- // uint16 *dst = &_fullscreen[dirtyRect.top * _screenWidth + dirtyRect.left];
- // int x = (dirtyRect.right - dirtyRect.left) * 2;
- // for (int y = h; y > 0; y--) {
- // memcpy(dst, src, x);
- // src += _screenWidth;
- // dst += _screenWidth;
- // }
- iPhone_updateOverlayRect(_overlayBuffer, dirtyRect.left, dirtyRect.top, dirtyRect.right, dirtyRect.bottom);
-}
-
-void OSystem_IPHONE::drawMouseCursorOnRectUpdate(const Common::Rect& updatedRect, const Common::Rect& mouseRect) {
- //draw mouse on top
- if (_mouseVisible && (updatedRect.intersects(mouseRect))) {
- int srcX = 0;
- int srcY = 0;
- int left = _mouseX - _mouseHotspotX;
- if (left < 0) {
- srcX -= left;
- left = 0;
- }
- int top = _mouseY - _mouseHotspotY;
- if (top < 0) {
- srcY -= top;
- top = 0;
- }
-
- int bottom = top + _mouseHeight;
- if (bottom > _screenWidth)
- bottom = _screenWidth;
-
- int displayWidth = _mouseWidth;
- if (_mouseWidth + left > _screenWidth)
- displayWidth = _screenWidth - left;
-
- int displayHeight = _mouseHeight;
- if (_mouseHeight + top > _screenHeight)
- displayHeight = _screenHeight - top;
-
- byte *src = &_mouseBuf[srcY * _mouseWidth + srcX];
- uint16 *dst = &_fullscreen[top * _screenWidth + left];
- for (int y = displayHeight; y > srcY; y--) {
- for (int x = displayWidth; x > srcX; x--) {
- if (*src != _mouseKeyColor)
- *dst = _palette[*src];
- dst++;
- src++;
- }
- dst += _screenWidth - displayWidth + srcX;
- src += _mouseWidth - displayWidth + srcX;
- }
- }
-}
-
-void OSystem_IPHONE::updateHardwareSurfaceForRect(const Common::Rect& updatedRect) {
- iPhone_updateScreenRect(_fullscreen, updatedRect.left, updatedRect.top, updatedRect.right, updatedRect.bottom );
-}
-
-Graphics::Surface *OSystem_IPHONE::lockScreen() {
- //printf("lockScreen()\n");
-
- _framebuffer.pixels = _offscreen;
- _framebuffer.w = _screenWidth;
- _framebuffer.h = _screenHeight;
- _framebuffer.pitch = _screenWidth;
- _framebuffer.format = Graphics::PixelFormat::createFormatCLUT8();
-
- return &_framebuffer;
-}
-
-void OSystem_IPHONE::unlockScreen() {
- //printf("unlockScreen()\n");
- dirtyFullScreen();
-}
-
-void OSystem_IPHONE::setShakePos(int shakeOffset) {
- //printf("setShakePos(%i)\n", shakeOffset);
-}
-
-void OSystem_IPHONE::showOverlay() {
- //printf("showOverlay()\n");
- _overlayVisible = true;
- dirtyFullOverlayScreen();
- updateScreen();
- iPhone_enableOverlay(true);
-}
-
-void OSystem_IPHONE::hideOverlay() {
- //printf("hideOverlay()\n");
- _overlayVisible = false;
- _dirtyOverlayRects.clear();
- dirtyFullScreen();
- iPhone_enableOverlay(false);
-}
-
-void OSystem_IPHONE::clearOverlay() {
- //printf("clearOverlay()\n");
- bzero(_overlayBuffer, _overlayWidth * _overlayHeight * sizeof(OverlayColor));
- dirtyFullOverlayScreen();
-}
-
-void OSystem_IPHONE::grabOverlay(OverlayColor *buf, int pitch) {
- //printf("grabOverlay()\n");
- int h = _overlayHeight;
- OverlayColor *src = _overlayBuffer;
-
- do {
- memcpy(buf, src, _overlayWidth * sizeof(OverlayColor));
- src += _overlayWidth;
- buf += pitch;
- } while (--h);
-}
-
-void OSystem_IPHONE::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h) {
- //printf("copyRectToOverlay(buf, pitch=%i, x=%i, y=%i, w=%i, h=%i)\n", pitch, x, y, w, h);
-
- //Clip the coordinates
- if (x < 0) {
- w += x;
- buf -= x;
- x = 0;
- }
-
- if (y < 0) {
- h += y;
- buf -= y * pitch;
- y = 0;
- }
-
- if (w > _overlayWidth - x)
- w = _overlayWidth - x;
-
- if (h > _overlayHeight - y)
- h = _overlayHeight - y;
-
- if (w <= 0 || h <= 0)
- return;
-
- if (!_fullScreenOverlayIsDirty) {
- _dirtyOverlayRects.push_back(Common::Rect(x, y, x + w, y + h));
- }
-
- OverlayColor *dst = _overlayBuffer + (y * _overlayWidth + x);
- if (_overlayWidth == pitch && pitch == w)
- memcpy(dst, buf, h * w * sizeof(OverlayColor));
- else {
- do {
- memcpy(dst, buf, w * sizeof(OverlayColor));
- buf += pitch;
- dst += _overlayWidth;
- } while (--h);
- }
-}
-
-int16 OSystem_IPHONE::getOverlayHeight() {
- return _overlayHeight;
-}
-
-int16 OSystem_IPHONE::getOverlayWidth() {
- return _overlayWidth;
-}
-
-bool OSystem_IPHONE::showMouse(bool visible) {
- bool last = _mouseVisible;
- _mouseVisible = visible;
- _mouseDirty = true;
-
- return last;
-}
-
-void OSystem_IPHONE::warpMouse(int x, int y) {
- //printf("warpMouse()\n");
-
- _mouseX = x;
- _mouseY = y;
- _mouseDirty = true;
-}
-
-void OSystem_IPHONE::dirtyFullScreen() {
- if (!_fullScreenIsDirty) {
- _dirtyRects.clear();
- _dirtyRects.push_back(Common::Rect(0, 0, _screenWidth, _screenHeight));
- _fullScreenIsDirty = true;
- }
-}
-
-void OSystem_IPHONE::dirtyFullOverlayScreen() {
- if (!_fullScreenOverlayIsDirty) {
- _dirtyOverlayRects.clear();
- _dirtyOverlayRects.push_back(Common::Rect(0, 0, _overlayWidth, _overlayHeight));
- _fullScreenOverlayIsDirty = true;
- }
-}
-
-void OSystem_IPHONE::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int cursorTargetScale, const Graphics::PixelFormat *format) {
- //printf("setMouseCursor(%i, %i, scale %u)\n", hotspotX, hotspotY, cursorTargetScale);
-
- int texWidth = getSizeNextPOT(w);
- int texHeight = getSizeNextPOT(h);
- int bufferSize = texWidth * texHeight * sizeof(int16);
- int16* mouseBuf = (int16*)malloc(bufferSize);
- memset(mouseBuf, 0, bufferSize);
-
- for (uint x = 0; x < w; ++x) {
- for (uint y = 0; y < h; ++y) {
- byte color = buf[y * w + x];
- if (color != keycolor)
- mouseBuf[y * texWidth + x] = _palette[color] | 0x1;
- else
- mouseBuf[y * texWidth + x] = 0x0;
- }
- }
-
- iPhone_setMouseCursor(mouseBuf, w, h);
-
- if (_mouseBuf != NULL && (_mouseWidth != w || _mouseHeight != h)) {
- free(_mouseBuf);
- _mouseBuf = NULL;
- }
-
- if (_mouseBuf == NULL)
- _mouseBuf = (byte *)malloc(w * h);
-
- _mouseWidth = w;
- _mouseHeight = h;
-
- _mouseHotspotX = hotspotX;
- _mouseHotspotY = hotspotY;
-
- _mouseKeyColor = (byte)keycolor;
-
- memcpy(_mouseBuf, buf, w * h);
-
- _mouseDirty = true;
-}
diff --git a/backends/platform/iphone/osys_video.mm b/backends/platform/iphone/osys_video.mm
new file mode 100644
index 0000000000..7e2b1eee07
--- /dev/null
+++ b/backends/platform/iphone/osys_video.mm
@@ -0,0 +1,418 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * 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.
+ *
+ */
+
+// Disable symbol overrides so that we can use system headers.
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+
+#include "osys_main.h"
+
+#include "iphone_video.h"
+
+void OSystem_IPHONE::initVideoContext() {
+ _videoContext = [g_iPhoneViewInstance getVideoContext];
+}
+
+const OSystem::GraphicsMode *OSystem_IPHONE::getSupportedGraphicsModes() const {
+ return s_supportedGraphicsModes;
+}
+
+int OSystem_IPHONE::getDefaultGraphicsMode() const {
+ return kGraphicsModeLinear;
+}
+
+bool OSystem_IPHONE::setGraphicsMode(int mode) {
+ switch (mode) {
+ case kGraphicsModeNone:
+ case kGraphicsModeLinear:
+ _videoContext->graphicsMode = (GraphicsModes)mode;
+ [g_iPhoneViewInstance performSelectorOnMainThread:@selector(setGraphicsMode) withObject:nil waitUntilDone: YES];
+ return true;
+
+ default:
+ return false;
+ }
+}
+
+int OSystem_IPHONE::getGraphicsMode() const {
+ return _videoContext->graphicsMode;
+}
+
+void OSystem_IPHONE::initSize(uint width, uint height, const Graphics::PixelFormat *format) {
+ //printf("initSize(%i, %i)\n", width, height);
+
+ _videoContext->screenWidth = width;
+ _videoContext->screenHeight = height;
+ _videoContext->shakeOffsetY = 0;
+
+ free(_gameScreenRaw);
+
+ _gameScreenRaw = (byte *)malloc(width * height);
+ bzero(_gameScreenRaw, width * height);
+
+ updateOutputSurface();
+
+ clearOverlay();
+
+ _fullScreenIsDirty = false;
+ dirtyFullScreen();
+ _videoContext->mouseIsVisible = false;
+ _mouseCursorPaletteEnabled = false;
+ _screenChangeCount++;
+
+ updateScreen();
+}
+
+void OSystem_IPHONE::updateOutputSurface() {
+ [g_iPhoneViewInstance performSelectorOnMainThread:@selector(initSurface) withObject:nil waitUntilDone: YES];
+}
+
+int16 OSystem_IPHONE::getHeight() {
+ return _videoContext->screenHeight;
+}
+
+int16 OSystem_IPHONE::getWidth() {
+ return _videoContext->screenWidth;
+}
+
+void OSystem_IPHONE::setPalette(const byte *colors, uint start, uint num) {
+ assert(start + num <= 256);
+ const byte *b = colors;
+
+ for (uint i = start; i < start + num; ++i) {
+ _gamePalette[i] = Graphics::RGBToColor<Graphics::ColorMasks<565> >(b[0], b[1], b[2]);
+ _gamePaletteRGBA5551[i] = Graphics::RGBToColor<Graphics::ColorMasks<5551> >(b[0], b[1], b[2]);
+ b += 3;
+ }
+
+ dirtyFullScreen();
+}
+
+void OSystem_IPHONE::grabPalette(byte *colors, uint start, uint num) {
+ assert(start + num <= 256);
+ byte *b = colors;
+
+ for (uint i = start; i < start + num; ++i) {
+ Graphics::colorToRGB<Graphics::ColorMasks<565> >(_gamePalette[i], b[0], b[1], b[2]);
+ b += 3;
+ }
+}
+
+void OSystem_IPHONE::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) {
+ //printf("copyRectToScreen(%i, %i, %i, %i)\n", x, y, w, h);
+ //Clip the coordinates
+ if (x < 0) {
+ w += x;
+ buf -= x;
+ x = 0;
+ }
+
+ if (y < 0) {
+ h += y;
+ buf -= y * pitch;
+ y = 0;
+ }
+
+ if (w > (int)_videoContext->screenWidth - x) {
+ w = _videoContext->screenWidth - x;
+ }
+
+ if (h > (int)_videoContext->screenHeight - y) {
+ h = _videoContext->screenHeight - y;
+ }
+
+ if (w <= 0 || h <= 0)
+ return;
+
+ if (!_fullScreenIsDirty) {
+ _dirtyRects.push_back(Common::Rect(x, y, x + w, y + h));
+ }
+
+
+ byte *dst = _gameScreenRaw + y * _videoContext->screenWidth + x;
+ if ((int)_videoContext->screenWidth == pitch && pitch == w)
+ memcpy(dst, buf, h * w);
+ else {
+ do {
+ memcpy(dst, buf, w);
+ buf += pitch;
+ dst += _videoContext->screenWidth;
+ } while (--h);
+ }
+}
+
+void OSystem_IPHONE::updateScreen() {
+ //printf("updateScreen(): %i dirty rects.\n", _dirtyRects.size());
+
+ if (_dirtyRects.size() == 0 && _dirtyOverlayRects.size() == 0 && !_mouseDirty)
+ return;
+
+ internUpdateScreen();
+ _mouseDirty = false;
+ _fullScreenIsDirty = false;
+ _fullScreenOverlayIsDirty = false;
+
+ iPhone_updateScreen();
+}
+
+void OSystem_IPHONE::internUpdateScreen() {
+ if (_mouseNeedTextureUpdate) {
+ updateMouseTexture();
+ _mouseNeedTextureUpdate = false;
+ }
+
+ while (_dirtyRects.size()) {
+ Common::Rect dirtyRect = _dirtyRects.remove_at(_dirtyRects.size() - 1);
+
+ //printf("Drawing: (%i, %i) -> (%i, %i)\n", dirtyRect.left, dirtyRect.top, dirtyRect.right, dirtyRect.bottom);
+ drawDirtyRect(dirtyRect);
+ // TODO: Implement dirty rect code
+ //updateHardwareSurfaceForRect(dirtyRect);
+ }
+
+ if (_videoContext->overlayVisible) {
+ // TODO: Implement dirty rect code
+ _dirtyOverlayRects.clear();
+ /*while (_dirtyOverlayRects.size()) {
+ Common::Rect dirtyRect = _dirtyOverlayRects.remove_at(_dirtyOverlayRects.size() - 1);
+
+ //printf("Drawing: (%i, %i) -> (%i, %i)\n", dirtyRect.left, dirtyRect.top, dirtyRect.right, dirtyRect.bottom);
+ drawDirtyOverlayRect(dirtyRect);
+ }*/
+ }
+}
+
+void OSystem_IPHONE::drawDirtyRect(const Common::Rect &dirtyRect) {
+ int h = dirtyRect.bottom - dirtyRect.top;
+ int w = dirtyRect.right - dirtyRect.left;
+
+ byte *src = &_gameScreenRaw[dirtyRect.top * _videoContext->screenWidth + dirtyRect.left];
+ byte *dstRaw = (byte *)_videoContext->screenTexture.getBasePtr(dirtyRect.left, dirtyRect.top);
+ for (int y = h; y > 0; y--) {
+ uint16 *dst = (uint16 *)dstRaw;
+ for (int x = w; x > 0; x--)
+ *dst++ = _gamePalette[*src++];
+
+ dstRaw += _videoContext->screenTexture.pitch;
+ src += _videoContext->screenWidth - w;
+ }
+}
+
+Graphics::Surface *OSystem_IPHONE::lockScreen() {
+ //printf("lockScreen()\n");
+
+ _framebuffer.pixels = _gameScreenRaw;
+ _framebuffer.w = _videoContext->screenWidth;
+ _framebuffer.h = _videoContext->screenHeight;
+ _framebuffer.pitch = _videoContext->screenWidth;
+ _framebuffer.format = Graphics::PixelFormat::createFormatCLUT8();
+
+ return &_framebuffer;
+}
+
+void OSystem_IPHONE::unlockScreen() {
+ //printf("unlockScreen()\n");
+ dirtyFullScreen();
+}
+
+void OSystem_IPHONE::setShakePos(int shakeOffset) {
+ //printf("setShakePos(%i)\n", shakeOffset);
+ _videoContext->shakeOffsetY = shakeOffset;
+ [g_iPhoneViewInstance performSelectorOnMainThread:@selector(setViewTransformation) withObject:nil waitUntilDone: YES];
+ // HACK: We use this to force a redraw.
+ _mouseDirty = true;
+}
+
+void OSystem_IPHONE::showOverlay() {
+ //printf("showOverlay()\n");
+ _videoContext->overlayVisible = true;
+ dirtyFullOverlayScreen();
+ updateScreen();
+ [g_iPhoneViewInstance performSelectorOnMainThread:@selector(clearColorBuffer) withObject:nil waitUntilDone: YES];
+}
+
+void OSystem_IPHONE::hideOverlay() {
+ //printf("hideOverlay()\n");
+ _videoContext->overlayVisible = false;
+ _dirtyOverlayRects.clear();
+ dirtyFullScreen();
+ [g_iPhoneViewInstance performSelectorOnMainThread:@selector(clearColorBuffer) withObject:nil waitUntilDone: YES];
+}
+
+void OSystem_IPHONE::clearOverlay() {
+ //printf("clearOverlay()\n");
+ bzero(_videoContext->overlayTexture.getBasePtr(0, 0), _videoContext->overlayTexture.h * _videoContext->overlayTexture.pitch);
+ dirtyFullOverlayScreen();
+}
+
+void OSystem_IPHONE::grabOverlay(OverlayColor *buf, int pitch) {
+ //printf("grabOverlay()\n");
+ int h = _videoContext->overlayHeight;
+
+ const byte *src = (const byte *)_videoContext->overlayTexture.getBasePtr(0, 0);
+ do {
+ memcpy(buf, src, _videoContext->overlayWidth * sizeof(OverlayColor));
+ src += _videoContext->overlayTexture.pitch;
+ buf += pitch;
+ } while (--h);
+}
+
+void OSystem_IPHONE::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h) {
+ //printf("copyRectToOverlay(buf, pitch=%i, x=%i, y=%i, w=%i, h=%i)\n", pitch, x, y, w, h);
+
+ //Clip the coordinates
+ if (x < 0) {
+ w += x;
+ buf -= x;
+ x = 0;
+ }
+
+ if (y < 0) {
+ h += y;
+ buf -= y * pitch;
+ y = 0;
+ }
+
+ if (w > (int)_videoContext->overlayWidth - x)
+ w = _videoContext->overlayWidth - x;
+
+ if (h > (int)_videoContext->overlayHeight - y)
+ h = _videoContext->overlayHeight - y;
+
+ if (w <= 0 || h <= 0)
+ return;
+
+ if (!_fullScreenOverlayIsDirty) {
+ _dirtyOverlayRects.push_back(Common::Rect(x, y, x + w, y + h));
+ }
+
+ byte *dst = (byte *)_videoContext->overlayTexture.getBasePtr(x, y);
+ do {
+ memcpy(dst, buf, w * sizeof(OverlayColor));
+ buf += pitch;
+ dst += _videoContext->overlayTexture.pitch;
+ } while (--h);
+}
+
+int16 OSystem_IPHONE::getOverlayHeight() {
+ return _videoContext->overlayHeight;
+}
+
+int16 OSystem_IPHONE::getOverlayWidth() {
+ return _videoContext->overlayWidth;
+}
+
+bool OSystem_IPHONE::showMouse(bool visible) {
+ bool last = _videoContext->mouseIsVisible;
+ _videoContext->mouseIsVisible = visible;
+ _mouseDirty = true;
+
+ return last;
+}
+
+void OSystem_IPHONE::warpMouse(int x, int y) {
+ //printf("warpMouse()\n");
+
+ _videoContext->mouseX = x;
+ _videoContext->mouseY = y;
+ _mouseDirty = true;
+}
+
+void OSystem_IPHONE::dirtyFullScreen() {
+ if (!_fullScreenIsDirty) {
+ _dirtyRects.clear();
+ _dirtyRects.push_back(Common::Rect(0, 0, _videoContext->screenWidth, _videoContext->screenHeight));
+ _fullScreenIsDirty = true;
+ }
+}
+
+void OSystem_IPHONE::dirtyFullOverlayScreen() {
+ if (!_fullScreenOverlayIsDirty) {
+ _dirtyOverlayRects.clear();
+ _dirtyOverlayRects.push_back(Common::Rect(0, 0, _videoContext->overlayWidth, _videoContext->overlayHeight));
+ _fullScreenOverlayIsDirty = true;
+ }
+}
+
+void OSystem_IPHONE::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int cursorTargetScale, const Graphics::PixelFormat *format) {
+ //printf("setMouseCursor(%i, %i, scale %u)\n", hotspotX, hotspotY, cursorTargetScale);
+
+ if (_mouseBuf != NULL && (_videoContext->mouseWidth != w || _videoContext->mouseHeight != h)) {
+ free(_mouseBuf);
+ _mouseBuf = NULL;
+ }
+
+ if (_mouseBuf == NULL)
+ _mouseBuf = (byte *)malloc(w * h);
+
+ _videoContext->mouseWidth = w;
+ _videoContext->mouseHeight = h;
+
+ _videoContext->mouseHotspotX = hotspotX;
+ _videoContext->mouseHotspotY = hotspotY;
+
+ _mouseKeyColor = (byte)keycolor;
+
+ memcpy(_mouseBuf, buf, w * h);
+
+ _mouseDirty = true;
+ _mouseNeedTextureUpdate = true;
+}
+
+void OSystem_IPHONE::setCursorPalette(const byte *colors, uint start, uint num) {
+ assert(start + num <= 256);
+
+ for (uint i = start; i < start + num; ++i, colors += 3)
+ _mouseCursorPalette[i] = Graphics::RGBToColor<Graphics::ColorMasks<5551> >(colors[0], colors[1], colors[2]);
+
+ // FIXME: This is just stupid, our client code seems to assume that this
+ // automatically enables the cursor palette.
+ _mouseCursorPaletteEnabled = true;
+
+ if (_mouseCursorPaletteEnabled)
+ _mouseDirty = _mouseNeedTextureUpdate = true;
+}
+
+void OSystem_IPHONE::updateMouseTexture() {
+ int texWidth = getSizeNextPOT(_videoContext->mouseWidth);
+ int texHeight = getSizeNextPOT(_videoContext->mouseHeight);
+ int bufferSize = texWidth * texHeight * sizeof(int16);
+ uint16 *mouseBuf = (uint16 *)malloc(bufferSize);
+ memset(mouseBuf, 0, bufferSize);
+
+ const uint16 *palette;
+ if (_mouseCursorPaletteEnabled)
+ palette = _mouseCursorPalette;
+ else
+ palette = _gamePaletteRGBA5551;
+
+ for (uint x = 0; x < _videoContext->mouseWidth; ++x) {
+ for (uint y = 0; y < _videoContext->mouseHeight; ++y) {
+ const byte color = _mouseBuf[y * _videoContext->mouseWidth + x];
+ if (color != _mouseKeyColor)
+ mouseBuf[y * texWidth + x] = palette[color] | 0x1;
+ else
+ mouseBuf[y * texWidth + x] = 0x0;
+ }
+ }
+
+ iPhone_setMouseCursor(mouseBuf);
+}
diff --git a/backends/platform/linuxmoto/hardwarekeys.cpp b/backends/platform/linuxmoto/hardwarekeys.cpp
index e10e39a23d..da093c6508 100644
--- a/backends/platform/linuxmoto/hardwarekeys.cpp
+++ b/backends/platform/linuxmoto/hardwarekeys.cpp
@@ -33,60 +33,59 @@ struct Key {
KeyCode keycode;
uint16 ascii;
const char *desc;
- KeyType preferredAction;
bool shiftable;
};
static const Key keys[] = {
- { "FIRE", KEYCODE_RETURN, ASCII_RETURN, "Fire", kActionKeyType, false },
- { "CAMERA", KEYCODE_PAUSE, 0, "Camera", kActionKeyType, false },
- { "HANGUP", KEYCODE_ESCAPE, ASCII_ESCAPE, "Hangup", kStartKeyType, false },
- { "CALL", KEYCODE_SPACE, ASCII_SPACE, "Call", kActionKeyType, false },
- { "PLUS", KEYCODE_PLUS, '+', "+", kActionKeyType, false },
- { "MINUS", KEYCODE_MINUS, '-', "-", kActionKeyType, false },
+ { "FIRE", KEYCODE_RETURN, ASCII_RETURN, "Fire", false },
+ { "CAMERA", KEYCODE_PAUSE, 0, "Camera", false },
+ { "HANGUP", KEYCODE_ESCAPE, ASCII_ESCAPE, "Hangup", false },
+ { "CALL", KEYCODE_SPACE, ASCII_SPACE, "Call", false },
+ { "PLUS", KEYCODE_PLUS, '+', "+", false },
+ { "MINUS", KEYCODE_MINUS, '-', "-", false },
#ifdef MOTOMAGX
- {"BACKSPACE", KEYCODE_BACKSPACE, ASCII_BACKSPACE, "Backspace", kActionKeyType, false},
- {"TAB", KEYCODE_TAB, ASCII_TAB, "Tab", kActionKeyType, false},
- {"HASH", KEYCODE_HASH, '#', "#", kActionKeyType, false},
- {"ASTERISK", KEYCODE_ASTERISK, '*', "*", kActionKeyType, false},
- {"LEFTSOFT", KEYCODE_F9, ASCII_F9, "LeftSoft", kActionKeyType, false},
- {"RIGHTSOFT", KEYCODE_F11, ASCII_F11, "RightSoft", kActionKeyType, false},
- {"0", KEYCODE_0, '0', "0", kActionKeyType, false},
- {"1", KEYCODE_1, '1', "1", kActionKeyType, false},
- {"2", KEYCODE_2, '2', "2", kActionKeyType, false},
- {"3", KEYCODE_3, '3', "3", kActionKeyType, false},
- {"4", KEYCODE_4, '4', "4", kActionKeyType, false},
- {"5", KEYCODE_5, '5', "5", kActionKeyType, false},
- {"6", KEYCODE_6, '6', "6", kActionKeyType, false},
- {"7", KEYCODE_7, '7', "7", kActionKeyType, false},
- {"8", KEYCODE_8, '8', "8", kActionKeyType, false},
- {"9", KEYCODE_9, '9', "9", kActionKeyType, false},
+ {"BACKSPACE", KEYCODE_BACKSPACE, ASCII_BACKSPACE, "Backspace", false},
+ {"TAB", KEYCODE_TAB, ASCII_TAB, "Tab", false},
+ {"HASH", KEYCODE_HASH, '#', "#", false},
+ {"ASTERISK", KEYCODE_ASTERISK, '*', "*", false},
+ {"LEFTSOFT", KEYCODE_F9, ASCII_F9, "LeftSoft", false},
+ {"RIGHTSOFT", KEYCODE_F11, ASCII_F11, "RightSoft", false},
+ {"0", KEYCODE_0, '0', "0", false},
+ {"1", KEYCODE_1, '1', "1", false},
+ {"2", KEYCODE_2, '2', "2", false},
+ {"3", KEYCODE_3, '3', "3", false},
+ {"4", KEYCODE_4, '4', "4", false},
+ {"5", KEYCODE_5, '5', "5", false},
+ {"6", KEYCODE_6, '6', "6", false},
+ {"7", KEYCODE_7, '7', "7", false},
+ {"8", KEYCODE_8, '8', "8", false},
+ {"9", KEYCODE_9, '9', "9", false},
#endif
#ifdef MOTOEZX
- { "a", KEYCODE_a, 'a', "a", kActionKeyType, true },
- { "b", KEYCODE_b, 'b', "b", kActionKeyType, true },
- { "c", KEYCODE_c, 'c', "c", kActionKeyType, true },
- { "d", KEYCODE_d, 'd', "d", kActionKeyType, true },
- { "e", KEYCODE_e, 'e', "e", kActionKeyType, true },
- { "f", KEYCODE_f, 'f', "f", kActionKeyType, true },
- { "g", KEYCODE_g, 'g', "g", kActionKeyType, true },
- { "h", KEYCODE_h, 'h', "h", kActionKeyType, true },
- { "i", KEYCODE_i, 'i', "i", kActionKeyType, true },
- { "j", KEYCODE_j, 'j', "j", kActionKeyType, true },
+ { "a", KEYCODE_a, 'a', "a", true },
+ { "b", KEYCODE_b, 'b', "b", true },
+ { "c", KEYCODE_c, 'c', "c", true },
+ { "d", KEYCODE_d, 'd', "d", true },
+ { "e", KEYCODE_e, 'e', "e", true },
+ { "f", KEYCODE_f, 'f', "f", true },
+ { "g", KEYCODE_g, 'g', "g", true },
+ { "h", KEYCODE_h, 'h', "h", true },
+ { "i", KEYCODE_i, 'i', "i", true },
+ { "j", KEYCODE_j, 'j', "j", true },
#endif
// Numeric keypad
// Arrows + Home/End pad
- {"UP", KEYCODE_UP, 0, "Up", kDirUpKeyType, false},
- {"DOWN", KEYCODE_DOWN, 0, "Down", kDirDownKeyType, false},
- {"RIGHT", KEYCODE_RIGHT, 0, "Right", kDirRightKeyType, false},
- {"LEFT", KEYCODE_LEFT, 0, "Left", kDirLeftKeyType, false},
+ {"UP", KEYCODE_UP, 0, "Up", false},
+ {"DOWN", KEYCODE_DOWN, 0, "Down", false},
+ {"RIGHT", KEYCODE_RIGHT, 0, "Right", false},
+ {"LEFT", KEYCODE_LEFT, 0, "Left", false},
// Function keys
// Miscellaneous function keys
- {0, KEYCODE_INVALID, 0, 0, kGenericKeyType, false}
+ {0, KEYCODE_INVALID, 0, 0, false}
};
struct Mod {
@@ -106,9 +105,8 @@ static const Mod modifiers[] = {
{ KBD_SHIFT | KBD_CTRL | KBD_ALT, "C+A+", "Ctrl+Alt+", true },
{ 0, 0, 0, false }
};
-#endif
-
Common::HardwareKeySet *OSystem_LINUXMOTO::getHardwareKeySet() {
return OSystem_SDL::getHardwareKeySet();
}
+#endif
diff --git a/backends/platform/linuxmoto/linuxmoto-sdl.h b/backends/platform/linuxmoto/linuxmoto-sdl.h
index 97262ccbca..9a0be56e11 100644
--- a/backends/platform/linuxmoto/linuxmoto-sdl.h
+++ b/backends/platform/linuxmoto/linuxmoto-sdl.h
@@ -29,8 +29,10 @@ class OSystem_LINUXMOTO : public OSystem_POSIX {
public:
virtual void initBackend();
+#ifdef ENABLE_KEYMAPPER
// FIXME: This just calls parent methods, is it needed?
virtual Common::HardwareKeySet *getHardwareKeySet();
+#endif
};
#endif
diff --git a/backends/platform/maemo/maemo-common.h b/backends/platform/maemo/maemo-common.h
index f33aa24278..453c70c45f 100644
--- a/backends/platform/maemo/maemo-common.h
+++ b/backends/platform/maemo/maemo-common.h
@@ -28,9 +28,10 @@
namespace Maemo {
enum ModelType {
- kModelTypeN800 = 1,
- kModelTypeN810 = 2,
- kModelTypeN900 = 4,
+ kModelType770 = 1 << 0,
+ kModelTypeN800 = 1 << 1,
+ kModelTypeN810 = 1 << 2,
+ kModelTypeN900 = 1 << 3,
kModelTypeInvalid = 0
};
@@ -38,15 +39,22 @@ struct Model {
const char *hwId;
ModelType modelType;
const char *hwAlias;
- bool hwKeyboard;
+ bool hasHwKeyboard;
+ bool hasMenuKey;
};
static const Model models[] = {
- {"RX-34", kModelTypeN800, "N800", false},
- {"RX-44", kModelTypeN810, "N810", true},
- {"RX-48", kModelTypeN810, "N810W", true},
- {"RX-51", kModelTypeN900, "N900", true},
- {0, kModelTypeInvalid, 0, true}
+ {"SU-18", kModelType770, "770", false, true},
+ {"RX-34", kModelTypeN800, "N800", false, true},
+ {"RX-44", kModelTypeN810, "N810", true, true},
+ {"RX-48", kModelTypeN810, "N810W", true, true},
+ {"RX-51", kModelTypeN900, "N900", true, false},
+ {0, kModelTypeInvalid, 0, true, true}
+};
+
+enum CustomEventType {
+ kEventClickMode = 1,
+ kEventInvalid = 0
};
} // namespace Maemo
diff --git a/backends/platform/maemo/maemo-keys.h b/backends/platform/maemo/maemo-keys.h
new file mode 100644
index 0000000000..e1337515a7
--- /dev/null
+++ b/backends/platform/maemo/maemo-keys.h
@@ -0,0 +1,139 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * 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.
+ *
+ */
+
+#if defined(MAEMO)
+#if defined(ENABLE_KEYMAPPER)
+
+#ifndef PLATFORM_SDL_MAEMO_KEYS_H
+#define PLATFORM_SDL_MAEMO_KEYS_H
+
+#include "common/keyboard.h"
+
+#include "backends/keymapper/hardware-key.h"
+
+namespace Common {
+
+static const ModifierTableEntry maemoModifiers[] = {
+ { 0, "", "", false },
+ { KBD_CTRL, "C+", "Ctrl+", false },
+ { KBD_SHIFT, "", "", true },
+ { KBD_SHIFT | KBD_CTRL, "S+C+", "Shift+Ctrl+", true },
+ { 0, 0, 0, false }
+};
+
+static const KeyTableEntry maemoKeys[] = {
+ {"BACKSPACE", KEYCODE_BACKSPACE, ASCII_BACKSPACE, "Backspace", false},
+ {"TAB", KEYCODE_TAB, ASCII_TAB, "Tab", false},
+ {"CLEAR", KEYCODE_CLEAR, 0, "Clear", false},
+ {"RETURN", KEYCODE_RETURN, ASCII_RETURN, "MCenter", false},
+ {"ESCAPE", KEYCODE_ESCAPE, ASCII_ESCAPE, "Esc", false},
+ {"SPACE", KEYCODE_SPACE, ASCII_SPACE, "Space", false},
+ {"EXCLAIM", KEYCODE_EXCLAIM, '!', "!", false},
+ {"QUOTEDBL", KEYCODE_QUOTEDBL, '"', "\"", false},
+ {"HASH", KEYCODE_HASH, '#', "#", false},
+ {"DOLLAR", KEYCODE_DOLLAR, '$', "$", false},
+ {"AMPERSAND", KEYCODE_AMPERSAND, '&', "&", false},
+ {"QUOTE", KEYCODE_QUOTE, '\'', "'", false},
+ {"LEFTPAREN", KEYCODE_LEFTPAREN, '(', "(", false},
+ {"RIGHTPAREN", KEYCODE_RIGHTPAREN, ')', ")", false},
+ {"ASTERISK", KEYCODE_ASTERISK, '*', "*", false},
+ {"PLUS", KEYCODE_PLUS, '+', "+", false},
+ {"COMMA", KEYCODE_COMMA, ',', ",", false},
+ {"MINUS", KEYCODE_MINUS, '-', "-", false},
+ {"PERIOD", KEYCODE_PERIOD, '.', ".", false},
+ {"SLASH", KEYCODE_SLASH, '/', "/", false},
+ {"0", KEYCODE_0, '0', "0", false},
+ {"1", KEYCODE_1, '1', "1", false},
+ {"2", KEYCODE_2, '2', "2", false},
+ {"3", KEYCODE_3, '3', "3", false},
+ {"4", KEYCODE_4, '4', "4", false},
+ {"5", KEYCODE_5, '5', "5", false},
+ {"6", KEYCODE_6, '6', "6", false},
+ {"7", KEYCODE_7, '7', "7", false},
+ {"8", KEYCODE_8, '8', "8", false},
+ {"9", KEYCODE_9, '9', "9", false},
+ {"COLON", KEYCODE_COLON, ':', ":", false},
+ {"SEMICOLON", KEYCODE_SEMICOLON, ';', ";", false},
+ {"LESS", KEYCODE_LESS, '<', "<", false},
+ {"EQUALS", KEYCODE_EQUALS, '=', "=", false},
+ {"GREATER", KEYCODE_GREATER, '>', ">", false},
+ {"QUESTION", KEYCODE_QUESTION, '?', "?", false},
+ {"AT", KEYCODE_AT, '@', "@", false},
+
+ {"LEFTBRACKET", KEYCODE_LEFTBRACKET, '[', "[", false},
+ {"BACKSLASH", KEYCODE_BACKSLASH, '\\', "\\", false},
+ {"RIGHTBRACKET", KEYCODE_RIGHTBRACKET, ']', "]", false},
+ {"CARET", KEYCODE_CARET, '^', "^", false},
+ {"UNDERSCORE", KEYCODE_UNDERSCORE, '_', "_", false},
+ {"BACKQUOTE", KEYCODE_BACKQUOTE, '`', "`", false},
+ {"a", KEYCODE_a, 'a', "a", true},
+ {"b", KEYCODE_b, 'b', "b", true},
+ {"c", KEYCODE_c, 'c', "c", true},
+ {"d", KEYCODE_d, 'd', "d", true},
+ {"e", KEYCODE_e, 'e', "e", true},
+ {"f", KEYCODE_f, 'f', "f", true},
+ {"g", KEYCODE_g, 'g', "g", true},
+ {"h", KEYCODE_h, 'h', "h", true},
+ {"i", KEYCODE_i, 'i', "i", true},
+ {"j", KEYCODE_j, 'j', "j", true},
+ {"k", KEYCODE_k, 'k', "k", true},
+ {"l", KEYCODE_l, 'l', "l", true},
+ {"m", KEYCODE_m, 'm', "m", true},
+ {"n", KEYCODE_n, 'n', "n", true},
+ {"o", KEYCODE_o, 'o', "o", true},
+ {"p", KEYCODE_p, 'p', "p", true},
+ {"q", KEYCODE_q, 'q', "q", true},
+ {"r", KEYCODE_r, 'r', "r", true},
+ {"s", KEYCODE_s, 's', "s", true},
+ {"t", KEYCODE_t, 't', "t", true},
+ {"u", KEYCODE_u, 'u', "u", true},
+ {"v", KEYCODE_v, 'v', "v", true},
+ {"w", KEYCODE_w, 'w', "w", true},
+ {"x", KEYCODE_x, 'x', "x", true},
+ {"y", KEYCODE_y, 'y', "y", true},
+ {"z", KEYCODE_z, 'z', "z", true},
+ {"DELETE", KEYCODE_DELETE, 0, "Del", false},
+
+ {"KP_ENTER", KEYCODE_KP_ENTER, 0, "Enter", false},
+
+ // Arrows + Home/End pad
+ {"UP", KEYCODE_UP, 0, "Up", false},
+ {"DOWN", KEYCODE_DOWN, 0, "Down", false},
+ {"RIGHT", KEYCODE_RIGHT, 0, "Right", false},
+ {"LEFT", KEYCODE_LEFT, 0, "Left", false},
+
+ // Function keys
+ {"MENU", KEYCODE_F11, 0, "Menu", false},
+ {"HOME", KEYCODE_F12, 0, "Home", false},
+ {"FULLSCREEN", KEYCODE_F13, 0, "FullScreen", false},
+ {"ZOOMPLUS", KEYCODE_F14, 0, "Zoom+", false},
+ {"ZOOMMINUS", KEYCODE_F15, 0, "Zoom-", false},
+
+ {0, KEYCODE_INVALID, 0, 0, false}
+};
+
+} // namespace Common
+
+#endif // ifndef PLATFORM_SDL_MAEMO_KEYS_H
+
+#endif // if defined(ENABLE_KEYMAPPER)
+#endif // if defined(MAEMO)
diff --git a/backends/platform/maemo/maemo.cpp b/backends/platform/maemo/maemo.cpp
index 454a13631c..209e527e3f 100644
--- a/backends/platform/maemo/maemo.cpp
+++ b/backends/platform/maemo/maemo.cpp
@@ -28,9 +28,13 @@
#include "common/config-manager.h"
#include "backends/platform/maemo/maemo.h"
+#include "backends/platform/maemo/maemo-keys.h"
#include "backends/events/maemosdl/maemosdl-events.h"
#include "backends/graphics/maemosdl/maemosdl-graphics.h"
+#include "backends/keymapper/keymapper.h"
+#include "backends/keymapper/keymapper-defaults.h"
#include "common/textconsole.h"
+#include "common/translation.h"
#include <SDL/SDL_syswm.h>
@@ -43,6 +47,43 @@ OSystem_SDL_Maemo::OSystem_SDL_Maemo()
OSystem_POSIX() {
}
+OSystem_SDL_Maemo::~OSystem_SDL_Maemo() {
+ delete _eventObserver;
+#ifdef ENABLE_KEYMAPPER
+ delete _keymapperDefaultBindings;
+#endif
+}
+
+#ifdef ENABLE_KEYMAPPER
+static void registerDefaultKeyBindings(Common::KeymapperDefaultBindings *_keymapperDefaultBindings, Model _model) {
+ _keymapperDefaultBindings->setDefaultBinding("gui", "REM", "HOME");
+ _keymapperDefaultBindings->setDefaultBinding("global", "REM", "HOME");
+
+ if (_model.hasMenuKey && _model.hasHwKeyboard) {
+ _keymapperDefaultBindings->setDefaultBinding("gui", "FUL", "FULLSCREEN");
+ _keymapperDefaultBindings->setDefaultBinding("global", "FUL", "FULLSCREEN");
+ }
+
+ if (_model.hasHwKeyboard) {
+ _keymapperDefaultBindings->setDefaultBinding("gui", "VIR", "C+ZOOMMINUS");
+ _keymapperDefaultBindings->setDefaultBinding("global", "VIR", "C+ZOOMMINUS");
+ } else {
+ _keymapperDefaultBindings->setDefaultBinding("gui", "VIR", "FULLSCREEN");
+ _keymapperDefaultBindings->setDefaultBinding("global", "VIR", "FULLSCREEN");
+ }
+
+ if (_model.hasMenuKey )
+ _keymapperDefaultBindings->setDefaultBinding("global", "MEN", "MENU");
+ else
+ _keymapperDefaultBindings->setDefaultBinding("global", "MEN", "S+C+M");
+
+ _keymapperDefaultBindings->setDefaultBinding("gui", "CLO", "ESCAPE");
+
+ _keymapperDefaultBindings->setDefaultBinding("maemo", "RCL", "ZOOMPLUS");
+ _keymapperDefaultBindings->setDefaultBinding("maemo", "CLK", "ZOOMMINUS");
+}
+#endif
+
void OSystem_SDL_Maemo::initBackend() {
// Create the events manager
if (_eventSource == 0)
@@ -51,12 +92,25 @@ void OSystem_SDL_Maemo::initBackend() {
if (_graphicsManager == 0)
_graphicsManager = new MaemoSdlGraphicsManager(_eventSource);
+ if (_eventObserver == 0)
+ _eventObserver = new MaemoSdlEventObserver((MaemoSdlEventSource *)_eventSource);
+
+#ifdef ENABLE_KEYMAPPER
+ if (_keymapperDefaultBindings == 0)
+ _keymapperDefaultBindings = new Common::KeymapperDefaultBindings();
+#endif
+
ConfMan.set("vkeybdpath", DATA_PATH);
- _model = Model(detectModel());
+ _model = detectModel();
+
+#ifdef ENABLE_KEYMAPPER
+ registerDefaultKeyBindings(_keymapperDefaultBindings, _model);
+#endif
// Call parent implementation of this method
OSystem_POSIX::initBackend();
+ initObserver();
}
void OSystem_SDL_Maemo::quit() {
@@ -118,6 +172,41 @@ void OSystem_SDL_Maemo::setupIcon() {
// http://bugzilla.libsdl.org/show_bug.cgi?id=586
}
+#ifdef ENABLE_KEYMAPPER
+Common::HardwareKeySet *OSystem_SDL_Maemo::getHardwareKeySet() {
+ return new Common::HardwareKeySet(Common::maemoKeys, Common::maemoModifiers);
+}
+
+Common::Keymap *OSystem_SDL_Maemo::getGlobalKeymap() {
+ using namespace Common;
+ Keymap *globalMap = new Keymap("maemo");
+
+ Action *act;
+
+ act = new Action(globalMap, "CLKM", _("Click Mode"));
+ Event evt = Event();
+ evt.type = EVENT_CUSTOM_BACKEND;
+ evt.customType = Maemo::kEventClickMode;
+ act->addEvent(evt);
+
+ act = new Action(globalMap, "LCLK", _("Left Click"));
+ act->addLeftClickEvent();
+
+ act = new Action(globalMap, "MCLK", _("Middle Click"));
+ act->addMiddleClickEvent();
+
+ act = new Action(globalMap, "RCLK", _("Right Click"));
+ act->addRightClickEvent();
+
+ return globalMap;
+}
+#endif
+
+void OSystem_SDL_Maemo::initObserver() {
+ assert(_eventManager);
+ _eventManager->getEventDispatcher()->registerObserver(_eventObserver, 10, false);
+}
+
} //namespace Maemo
#endif
diff --git a/backends/platform/maemo/maemo.h b/backends/platform/maemo/maemo.h
index 32b52470bc..4b84ae573a 100644
--- a/backends/platform/maemo/maemo.h
+++ b/backends/platform/maemo/maemo.h
@@ -29,25 +29,36 @@
#include "backends/platform/maemo/maemo-common.h"
namespace Maemo {
+class MaemoSdlEventObserver;
class OSystem_SDL_Maemo : public OSystem_POSIX {
public:
OSystem_SDL_Maemo();
+ ~OSystem_SDL_Maemo();
virtual void initBackend();
virtual void quit();
virtual void fatalError();
virtual void setWindowCaption(const char *caption);
virtual void setupIcon();
+#ifdef ENABLE_KEYMAPPER
+ virtual Common::HardwareKeySet *getHardwareKeySet();
+ virtual Common::Keymap *getGlobalKeymap();
+ virtual Common::KeymapperDefaultBindings *getKeymapperDefaultBindings() { return _keymapperDefaultBindings; }
+#endif
Model getModel() { return _model; }
private:
virtual void setXWindowName(const char *caption);
+ void initObserver();
const Model detectModel();
Model _model;
-
+ MaemoSdlEventObserver *_eventObserver;
+#ifdef ENABLE_KEYMAPPER
+ Common::KeymapperDefaultBindings *_keymapperDefaultBindings;
+#endif
};
} // namespace Maemo
diff --git a/backends/platform/n64/osys_n64_utilities.cpp b/backends/platform/n64/osys_n64_utilities.cpp
index 94d727e421..f007a1bd25 100644
--- a/backends/platform/n64/osys_n64_utilities.cpp
+++ b/backends/platform/n64/osys_n64_utilities.cpp
@@ -100,9 +100,9 @@ void refillAudioBuffers(void) {
Audio::MixerImpl *localmixer = (Audio::MixerImpl *)osys->getMixer();
while (_requiredSoundSlots) {
- sndBuf = (byte*)getAIBuffer();
+ sndBuf = (byte *)getAIBuffer();
- localmixer->mixCallback((byte*)sndBuf, osys->_audioBufferSize);
+ localmixer->mixCallback((byte *)sndBuf, osys->_audioBufferSize);
putAIBuffer();
diff --git a/backends/platform/openpandora/op-bundle.mk b/backends/platform/openpandora/op-bundle.mk
index 089430f43c..284a0497a8 100755
--- a/backends/platform/openpandora/op-bundle.mk
+++ b/backends/platform/openpandora/op-bundle.mk
@@ -14,15 +14,15 @@ op-bundle: $(EXECUTABLE)
$(MKDIR) "$(bundle_name)/scummvm/icon"
$(MKDIR) "$(bundle_name)/scummvm/lib"
- $(CP) $(srcdir)/backends/platform/openpandora/build/runscummvm.sh $(bundle_name)/scummvm/
- $(CP) $(srcdir)/backends/platform/openpandora/build/PXML.xml $(bundle_name)/scummvm/data/
+ $(CP) $(srcdir)/dists/openpandora/runscummvm.sh $(bundle_name)/scummvm/
+ $(CP) $(srcdir)/dists/openpandora/PXML.xml $(bundle_name)/scummvm/data/
- $(CP) $(srcdir)/backends/platform/openpandora/build/icon/scummvm.png $(bundle_name)/scummvm/icon/
- $(CP) $(srcdir)/backends/platform/openpandora/build/icon/preview-pic.png $(bundle_name)/scummvm/icon/
+ $(CP) $(srcdir)/dists/openpandora/icon/scummvm.png $(bundle_name)/scummvm/icon/
+ $(CP) $(srcdir)/dists/openpandora/icon/preview-pic.png $(bundle_name)/scummvm/icon/
- $(CP) $(srcdir)/backends/platform/openpandora/build/README-OPENPANDORA $(bundle_name)/scummvm/docs/
- $(CP) $(srcdir)/backends/platform/openpandora/build/index.html $(bundle_name)/scummvm/docs/
+ $(CP) $(srcdir)/dists/openpandora/README-OPENPANDORA $(bundle_name)/scummvm/docs/
+ $(CP) $(srcdir)/dists/openpandora/index.html $(bundle_name)/scummvm/docs/
$(INSTALL) -c -m 644 $(DIST_FILES_DOCS) $(bundle_name)/scummvm/docs/
@@ -50,15 +50,15 @@ op-pnd: $(EXECUTABLE)
$(MKDIR) "$(bundle_name)/scummvm/icon"
$(MKDIR) "$(bundle_name)/scummvm/lib"
- $(CP) $(srcdir)/backends/platform/openpandora/build/runscummvm.sh $(bundle_name)/scummvm/
- $(CP) $(srcdir)/backends/platform/openpandora/build/PXML.xml $(bundle_name)/scummvm/data/
+ $(CP) $(srcdir)/dists/openpandora/runscummvm.sh $(bundle_name)/scummvm/
+ $(CP) $(srcdir)/dists/openpandora/PXML.xml $(bundle_name)/scummvm/data/
- $(CP) $(srcdir)/backends/platform/openpandora/build/icon/scummvm.png $(bundle_name)/scummvm/icon/
- $(CP) $(srcdir)/backends/platform/openpandora/build/icon/preview-pic.png $(bundle_name)/scummvm/icon/
+ $(CP) $(srcdir)/dists/openpandora/icon/scummvm.png $(bundle_name)/scummvm/icon/
+ $(CP) $(srcdir)/dists/openpandora/icon/preview-pic.png $(bundle_name)/scummvm/icon/
- $(CP) $(srcdir)/backends/platform/openpandora/build/README-OPENPANDORA $(bundle_name)/scummvm/docs/
- $(CP) $(srcdir)/backends/platform/openpandora/build/index.html $(bundle_name)/scummvm/docs/
+ $(CP) $(srcdir)/dists/openpandora/README-OPENPANDORA $(bundle_name)/scummvm/docs/
+ $(CP) $(srcdir)/dists/openpandora/index.html $(bundle_name)/scummvm/docs/
$(INSTALL) -c -m 644 $(DIST_FILES_DOCS) $(bundle_name)/scummvm/docs/
@@ -75,9 +75,10 @@ endif
$(CP) $(libloc)/../arm-angstrom-linux-gnueabi/usr/lib/libFLAC.so.8.2.0 $(bundle_name)/scummvm/lib/libFLAC.so.8
- $(srcdir)/backends/platform/openpandora/build/pnd_make.sh -p $(bundle_name).pnd -c -d $(bundle_name)/scummvm -x $(bundle_name)/scummvm/data/PXML.xml -i $(bundle_name)/scummvm/icon/scummvm.png
+ $(srcdir)/dists/openpandora/pnd_make.sh -p $(bundle_name).pnd -c -d $(bundle_name)/scummvm -x $(bundle_name)/scummvm/data/PXML.xml -i $(bundle_name)/scummvm/icon/scummvm.png
+
+ $(CP) $(srcdir)/dists/openpandora/README-PND.txt $(bundle_name)
- $(CP) $(srcdir)/backends/platform/openpandora/build/README-PND.txt $(bundle_name)
tar -cvjf $(bundle_name)-pnd.tar.bz2 $(bundle_name).pnd $(bundle_name)/README-PND.txt
rm -R ./$(bundle_name)
diff --git a/backends/platform/ps2/DmaPipe.cpp b/backends/platform/ps2/DmaPipe.cpp
index c6f6ab72ac..a346a67566 100644
--- a/backends/platform/ps2/DmaPipe.cpp
+++ b/backends/platform/ps2/DmaPipe.cpp
@@ -48,7 +48,7 @@ private:
DmaPipe::DmaPipe(uint32 size) {
size &= ~0x1F;
- _buf = (uint64*)memalign(64, size);
+ _buf = (uint64 *)memalign(64, size);
_curPipe = 0;
_pipes[0] = new SinglePipe(_buf, size >> 4);
_pipes[1] = new SinglePipe(_buf + (size >> 4), size >> 4);
@@ -260,7 +260,7 @@ void SinglePipe::init(void) {
_buf[0] = 0x0000000070000000;
_buf[1] = 0;
_chainHead = _buf;
- _chainSize = (uint16*)_chainHead;
+ _chainSize = (uint16 *)_chainHead;
_bufPos = _buf + 2;
}
@@ -272,7 +272,7 @@ void SinglePipe::appendChain(uint64 dmaTag) {
_chainHead = _bufPos;
_chainHead[0] = dmaTag;
_chainHead[1] = 0;
- _chainSize = (uint16*)_chainHead;
+ _chainSize = (uint16 *)_chainHead;
_bufPos += 2;
}
diff --git a/backends/platform/ps2/Gs2dScreen.cpp b/backends/platform/ps2/Gs2dScreen.cpp
index b70e8b13fa..8df6198c38 100644
--- a/backends/platform/ps2/Gs2dScreen.cpp
+++ b/backends/platform/ps2/Gs2dScreen.cpp
@@ -130,9 +130,9 @@ Gs2dScreen::Gs2dScreen(uint16 width, uint16 height, TVMode tvMode) {
_height = height;
_pitch = (width + 127) & ~127;
- _screenBuf = (uint8*)memalign(64, _width * _height);
- _overlayBuf = (uint16*)memalign(64, _width * _height * 2);
- _clut = (uint32*)memalign(64, 256 * 4);
+ _screenBuf = (uint8 *)memalign(64, _width * _height);
+ _overlayBuf = (uint16 *)memalign(64, _width * _height * 2);
+ _clut = (uint32 *)memalign(64, 256 * 4);
memset(_screenBuf, 0, _width * _height);
memset(_clut, 0, 256 * sizeof(uint32));
@@ -291,11 +291,11 @@ void Gs2dScreen::quit(void) {
}
void Gs2dScreen::createAnimTextures(void) {
- uint8 *buf = (uint8*)memalign(64, 16 * 64);
+ uint8 *buf = (uint8 *)memalign(64, 16 * 64);
memset(buf, 0, 16 * 64);
uint32 vramDest = _texPtrs[TEXT];
for (int i = 0; i < 16; i++) {
- uint32 *destPos = (uint32*)buf;
+ uint32 *destPos = (uint32 *)buf;
for (int ch = 15; ch >= 0; ch--) {
const uint32 *src = (const uint32*)(_binaryData + ((_binaryPattern[i] >> ch) & 1) * 4 * 14);
for (int line = 0; line < 14; line++)
@@ -331,8 +331,8 @@ void Gs2dScreen::newScreenSize(uint16 width, uint16 height) {
// malloc new buffers
free(_screenBuf);
free(_overlayBuf);
- _screenBuf = (uint8*)memalign(64, _width * _height);
- _overlayBuf = (uint16*)memalign(64, _width * _height * 2);
+ _screenBuf = (uint8 *)memalign(64, _width * _height);
+ _overlayBuf = (uint16 *)memalign(64, _width * _height * 2);
memset(_screenBuf, 0, _width * height);
memset(_overlayBuf, 0, _width * height * 2);
memset(_clut, 0, 256 * sizeof(uint32));
@@ -556,7 +556,7 @@ void Gs2dScreen::copyPrintfOverlay(const uint8 *buf) {
}
void Gs2dScreen::clearPrintfOverlay(void) {
- uint8 *tmpBuf = (uint8*)memalign(64, 320 * 200);
+ uint8 *tmpBuf = (uint8 *)memalign(64, 320 * 200);
memset(tmpBuf, 4, 320 * 200);
_dmaPipe->uploadTex(_texPtrs[PRINTF], 3 * 128, 0, 0, GS_PSMT8H, tmpBuf, 320, 200);
_dmaPipe->flush();
@@ -619,7 +619,7 @@ void Gs2dScreen::setMouseOverlay(const uint8 *buf, uint16 width, uint16 height,
_mTraCol = transpCol;
_clutChanged = true;
}
- uint8 *bufCopy = (uint8*)memalign(64, M_SIZE * M_SIZE); // make a copy to align to 64 bytes
+ uint8 *bufCopy = (uint8 *)memalign(64, M_SIZE * M_SIZE); // make a copy to align to 64 bytes
memset(bufCopy, _mTraCol, M_SIZE * M_SIZE);
for (int cnt = 0; cnt < height; cnt++)
memcpy(bufCopy + cnt * M_SIZE, buf + cnt * width, width);
diff --git a/backends/platform/ps2/fileio.cpp b/backends/platform/ps2/fileio.cpp
index ef01f3a693..1ec16a3817 100644
--- a/backends/platform/ps2/fileio.cpp
+++ b/backends/platform/ps2/fileio.cpp
@@ -52,7 +52,7 @@ Ps2File::Ps2File() {
_eof = false;
_err = false;
- _cacheBuf = (uint8*)memalign(64, CACHE_SIZE * 2);
+ _cacheBuf = (uint8 *)memalign(64, CACHE_SIZE * 2);
_cacheOpRunning = 0;
_filePos = _physFilePos = _cachePos = 0;
@@ -362,7 +362,7 @@ uint32 Ps2File::read(void *dest, uint32 len) {
_eof = true;
}
- uint8 *destBuf = (uint8*)dest;
+ uint8 *destBuf = (uint8 *)dest;
if ((_filePos < _cachePos) || (_filePos + len > _cachePos + _bytesInCache))
cacheReadSync(); // we have to read from CD, sync cache.
@@ -413,7 +413,7 @@ uint32 Ps2File::read(void *dest, uint32 len) {
#ifdef __PS2_FILE_SEMA__
SignalSema(_sema);
#endif
- return destBuf - (uint8*)dest;
+ return destBuf - (uint8 *)dest;
}
uint32 Ps2File::write(const void *src, uint32 len) {
@@ -518,7 +518,7 @@ FILE *ps2_fopen(const char *fname, const char *mode) {
}
int ps2_fclose(FILE *stream) {
- Ps2File *file = (Ps2File*)stream;
+ Ps2File *file = (Ps2File *)stream;
delete file;
@@ -528,10 +528,10 @@ int ps2_fclose(FILE *stream) {
size_t ps2_fread(void *buf, size_t r, size_t n, FILE *stream) {
assert(r != 0);
- return ((Ps2File*)stream)->read(buf, r * n) / r;
+ return ((Ps2File *)stream)->read(buf, r * n) / r;
}
size_t ps2_fwrite(const void *buf, size_t r, size_t n, FILE *stream) {
assert(r != 0);
- return ((Ps2File*)stream)->write(buf, r * n) / r;
+ return ((Ps2File *)stream)->write(buf, r * n) / r;
}
diff --git a/backends/platform/ps2/icon.cpp b/backends/platform/ps2/icon.cpp
index 9852e6d40b..bda4843647 100644
--- a/backends/platform/ps2/icon.cpp
+++ b/backends/platform/ps2/icon.cpp
@@ -960,13 +960,13 @@ void PS2Icon::setup(mcIcon *icon) {
memcpy(icon->head, "PS2D", 4);
icon->nlOffset = strlen(_info) + 1;
strcpy(title, _info);
- strcpy_sjis((short*)&(icon->title), title);
+ strcpy_sjis((short *)&(icon->title), title);
icon->trans = 0x10;
memcpy(icon->bgCol, _bgcolor, sizeof(_bgcolor));
memcpy(icon->lightDir, _lightdir, sizeof(_lightdir));
memcpy(icon->lightCol, _lightcol, sizeof(_lightcol));
memcpy(icon->lightAmbient, _ambient, sizeof(_ambient));
- strcpy((char*)icon->view, "scummvm.icn");
- strcpy((char*)icon->copy, "scummvm.icn");
- strcpy((char*)icon->del, "scummvm.icn");
+ strcpy((char *)icon->view, "scummvm.icn");
+ strcpy((char *)icon->copy, "scummvm.icn");
+ strcpy((char *)icon->del, "scummvm.icn");
}
diff --git a/backends/platform/ps2/ps2mutex.cpp b/backends/platform/ps2/ps2mutex.cpp
index 5b30fa7862..ae63fe5724 100644
--- a/backends/platform/ps2/ps2mutex.cpp
+++ b/backends/platform/ps2/ps2mutex.cpp
@@ -57,7 +57,7 @@ OSystem::MutexRef OSystem_PS2::createMutex(void) {
void OSystem_PS2::lockMutex(MutexRef mutex) {
WaitSema(_mutexSema);
- Ps2Mutex *sysMutex = (Ps2Mutex*)mutex;
+ Ps2Mutex *sysMutex = (Ps2Mutex *)mutex;
int tid = GetThreadId();
assert(tid != 0);
@@ -75,7 +75,7 @@ void OSystem_PS2::lockMutex(MutexRef mutex) {
void OSystem_PS2::unlockMutex(MutexRef mutex) {
WaitSema(_mutexSema);
- Ps2Mutex *sysMutex = (Ps2Mutex*)mutex;
+ Ps2Mutex *sysMutex = (Ps2Mutex *)mutex;
int tid = GetThreadId();
if (sysMutex->owner && sysMutex->count && (sysMutex->owner == tid))
@@ -90,7 +90,7 @@ void OSystem_PS2::unlockMutex(MutexRef mutex) {
void OSystem_PS2::deleteMutex(MutexRef mutex) {
WaitSema(_mutexSema);
- Ps2Mutex *sysMutex = (Ps2Mutex*)mutex;
+ Ps2Mutex *sysMutex = (Ps2Mutex *)mutex;
if (sysMutex->owner || sysMutex->count)
printf("WARNING: Deleting LOCKED mutex!\n");
DeleteSema(sysMutex->sema);
diff --git a/backends/platform/ps2/ps2pad.cpp b/backends/platform/ps2/ps2pad.cpp
index eeb9dfbd93..b6afc217e6 100644
--- a/backends/platform/ps2/ps2pad.cpp
+++ b/backends/platform/ps2/ps2pad.cpp
@@ -30,7 +30,7 @@
Ps2Pad::Ps2Pad(OSystem_PS2 *system) {
_system = system;
- _padBuf = (uint8*)memalign(64, 256);
+ _padBuf = (uint8 *)memalign(64, 256);
_padStatus = STAT_NONE;
padInit(0); // initialize library
diff --git a/backends/platform/ps2/systemps2.cpp b/backends/platform/ps2/systemps2.cpp
index 481227dd02..d4e993da63 100644
--- a/backends/platform/ps2/systemps2.cpp
+++ b/backends/platform/ps2/systemps2.cpp
@@ -384,8 +384,8 @@ void OSystem_PS2::initTimer(void) {
ee_thread_t timerThread, soundThread, thisThread;
ReferThreadStatus(GetThreadId(), &thisThread);
- _timerStack = (uint8*)malloc(TIMER_STACK_SIZE);
- _soundStack = (uint8*)malloc(SOUND_STACK_SIZE);
+ _timerStack = (uint8 *)malloc(TIMER_STACK_SIZE);
+ _soundStack = (uint8 *)malloc(SOUND_STACK_SIZE);
// give timer thread a higher priority than main thread
timerThread.initial_priority = thisThread.current_priority - 1;
@@ -435,7 +435,7 @@ void OSystem_PS2::timerThreadCallback(void) {
}
void OSystem_PS2::soundThreadCallback(void) {
- int16 *soundBufL = (int16*)memalign(64, SMP_PER_BLOCK * sizeof(int16) * 2);
+ int16 *soundBufL = (int16 *)memalign(64, SMP_PER_BLOCK * sizeof(int16) * 2);
int16 *soundBufR = soundBufL + SMP_PER_BLOCK;
int bufferedSamples = 0;
@@ -453,9 +453,9 @@ void OSystem_PS2::soundThreadCallback(void) {
if (bufferedSamples <= 8 * SMP_PER_BLOCK) {
// we have to produce more samples, call sound mixer
// the scratchpad at 0x70000000 is used as temporary soundbuffer
- //_scummSoundProc(_scummSoundParam, (uint8*)0x70000000, SMP_PER_BLOCK * 2 * sizeof(int16));
- // Audio::Mixer::mixCallback(_scummMixer, (byte*)0x70000000, SMP_PER_BLOCK * 2 * sizeof(int16));
- _scummMixer->mixCallback((byte*)0x70000000, SMP_PER_BLOCK * 2 * sizeof(int16));
+ //_scummSoundProc(_scummSoundParam, (uint8 *)0x70000000, SMP_PER_BLOCK * 2 * sizeof(int16));
+ // Audio::Mixer::mixCallback(_scummMixer, (byte *)0x70000000, SMP_PER_BLOCK * 2 * sizeof(int16));
+ _scummMixer->mixCallback((byte *)0x70000000, SMP_PER_BLOCK * 2 * sizeof(int16));
// demux data into 2 buffers, L and R
__asm__ (
@@ -635,7 +635,7 @@ void OSystem_PS2::clearOverlay(void) {
}
void OSystem_PS2::grabOverlay(OverlayColor *buf, int pitch) {
- _screen->grabOverlay((uint16*)buf, (uint16)pitch);
+ _screen->grabOverlay((uint16 *)buf, (uint16)pitch);
}
void OSystem_PS2::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h) {
@@ -738,12 +738,12 @@ void OSystem_PS2::msgPrintf(int millis, const char *format, ...) {
lnSta = lnEnd + 1;
}
- uint8 *scrBuf = (uint8*)memalign(64, 320 * 200);
+ uint8 *scrBuf = (uint8 *)memalign(64, 320 * 200);
memset(scrBuf, 4, 320 * 200);
uint8 *dstPos = scrBuf + ((200 - posY) >> 1) * 320 + (320 - maxWidth) / 2;
for (int y = 0; y < posY; y++) {
- uint8 *srcPos = (uint8*)surf.getBasePtr((300 - maxWidth) / 2, y);
+ uint8 *srcPos = (uint8 *)surf.getBasePtr((300 - maxWidth) / 2, y);
for (int x = 0; x < maxWidth; x++)
dstPos[x] = srcPos[x] + 5;
dstPos += 320;
diff --git a/backends/platform/psp/display_manager.cpp b/backends/platform/psp/display_manager.cpp
index cdb130e2a0..10a732b1e3 100644
--- a/backends/platform/psp/display_manager.cpp
+++ b/backends/platform/psp/display_manager.cpp
@@ -210,14 +210,14 @@ void MasterGuRenderer::guProgramDisplayBufferSizes() {
switch (GuRenderer::_displayManager->getOutputBitsPerPixel()) {
case 16:
sceGuDrawBuffer(GU_PSM_4444, (void *)0, PSP_BUFFER_WIDTH);
- sceGuDispBuffer(PSP_SCREEN_WIDTH, PSP_SCREEN_HEIGHT, (void*)(PSP_FRAME_SIZE * sizeof(uint16)), PSP_BUFFER_WIDTH);
- sceGuDepthBuffer((void*)(PSP_FRAME_SIZE * sizeof(uint16) * 2), PSP_BUFFER_WIDTH);
+ sceGuDispBuffer(PSP_SCREEN_WIDTH, PSP_SCREEN_HEIGHT, (void *)(PSP_FRAME_SIZE * sizeof(uint16)), PSP_BUFFER_WIDTH);
+ sceGuDepthBuffer((void *)(PSP_FRAME_SIZE * sizeof(uint16) * 2), PSP_BUFFER_WIDTH);
VramAllocator::instance().allocate(PSP_FRAME_SIZE * sizeof(uint16) * 2);
break;
case 32:
sceGuDrawBuffer(GU_PSM_8888, (void *)0, PSP_BUFFER_WIDTH);
- sceGuDispBuffer(PSP_SCREEN_WIDTH, PSP_SCREEN_HEIGHT, (void*)(PSP_FRAME_SIZE * sizeof(uint32)), PSP_BUFFER_WIDTH);
- sceGuDepthBuffer((void*)(PSP_FRAME_SIZE * sizeof(uint32) * 2), PSP_BUFFER_WIDTH);
+ sceGuDispBuffer(PSP_SCREEN_WIDTH, PSP_SCREEN_HEIGHT, (void *)(PSP_FRAME_SIZE * sizeof(uint32)), PSP_BUFFER_WIDTH);
+ sceGuDepthBuffer((void *)(PSP_FRAME_SIZE * sizeof(uint32) * 2), PSP_BUFFER_WIDTH);
VramAllocator::instance().allocate(PSP_FRAME_SIZE * sizeof(uint32) * 2);
break;
}
diff --git a/backends/platform/sdl/hardwarekeys.cpp b/backends/platform/sdl/hardwarekeys.cpp
index 9a33e357da..5fb4473ebd 100644
--- a/backends/platform/sdl/hardwarekeys.cpp
+++ b/backends/platform/sdl/hardwarekeys.cpp
@@ -28,159 +28,143 @@
using namespace Common;
-struct Key {
- const char *hwId;
- KeyCode keycode;
- uint16 ascii;
- const char *desc;
- KeyType preferredAction;
- bool shiftable;
-};
-
-static const Key keys[] = {
- {"BACKSPACE", KEYCODE_BACKSPACE, ASCII_BACKSPACE, "Backspace", kActionKeyType, false},
- {"TAB", KEYCODE_TAB, ASCII_TAB, "Tab", kActionKeyType, false},
- {"CLEAR", KEYCODE_CLEAR, 0, "Clear", kActionKeyType, false},
- {"RETURN", KEYCODE_RETURN, ASCII_RETURN, "Return", kActionKeyType, false},
- {"PAUSE", KEYCODE_PAUSE, 0, "Pause", kActionKeyType, false},
- {"ESCAPE", KEYCODE_ESCAPE, ASCII_ESCAPE, "Esc", kStartKeyType, false},
- {"SPACE", KEYCODE_SPACE, ASCII_SPACE, "Space", kActionKeyType, false},
- {"EXCLAIM", KEYCODE_EXCLAIM, '!', "!", kActionKeyType, false},
- {"QUOTEDBL", KEYCODE_QUOTEDBL, '"', "\"", kActionKeyType, false},
- {"HASH", KEYCODE_HASH, '#', "#", kActionKeyType, false},
- {"DOLLAR", KEYCODE_DOLLAR, '$', "$", kActionKeyType, false},
- {"AMPERSAND", KEYCODE_AMPERSAND, '&', "&", kActionKeyType, false},
- {"QUOTE", KEYCODE_QUOTE, '\'', "'", kActionKeyType, false},
- {"LEFTPAREN", KEYCODE_LEFTPAREN, '(', "(", kActionKeyType, false},
- {"RIGHTPAREN", KEYCODE_RIGHTPAREN, ')', ")", kActionKeyType, false},
- {"ASTERISK", KEYCODE_ASTERISK, '*', "*", kActionKeyType, false},
- {"PLUS", KEYCODE_PLUS, '+', "+", kActionKeyType, false},
- {"COMMA", KEYCODE_COMMA, ',', ",", kActionKeyType, false},
- {"MINUS", KEYCODE_MINUS, '-', "-", kActionKeyType, false},
- {"PERIOD", KEYCODE_PERIOD, '.', ".", kActionKeyType, false},
- {"SLASH", KEYCODE_SLASH, '/', "/", kActionKeyType, false},
- {"0", KEYCODE_0, '0', "0", kActionKeyType, false},
- {"1", KEYCODE_1, '1', "1", kActionKeyType, false},
- {"2", KEYCODE_2, '2', "2", kActionKeyType, false},
- {"3", KEYCODE_3, '3', "3", kActionKeyType, false},
- {"4", KEYCODE_4, '4', "4", kActionKeyType, false},
- {"5", KEYCODE_5, '5', "5", kActionKeyType, false},
- {"6", KEYCODE_6, '6', "6", kActionKeyType, false},
- {"7", KEYCODE_7, '7', "7", kActionKeyType, false},
- {"8", KEYCODE_8, '8', "8", kActionKeyType, false},
- {"9", KEYCODE_9, '9', "9", kActionKeyType, false},
- {"COLON", KEYCODE_COLON, ':', ":", kActionKeyType, false},
- {"SEMICOLON", KEYCODE_SEMICOLON, ';', ";", kActionKeyType, false},
- {"LESS", KEYCODE_LESS, '<', "<", kActionKeyType, false},
- {"EQUALS", KEYCODE_EQUALS, '=', "=", kActionKeyType, false},
- {"GREATER", KEYCODE_GREATER, '>', ">", kActionKeyType, false},
- {"QUESTION", KEYCODE_QUESTION, '?', "?", kActionKeyType, false},
- {"AT", KEYCODE_AT, '@', "@", kActionKeyType, false},
-
- {"LEFTBRACKET", KEYCODE_LEFTBRACKET, '[', "[", kActionKeyType, false},
- {"BACKSLASH", KEYCODE_BACKSLASH, '\\', "\\", kActionKeyType, false},
- {"RIGHTBRACKET", KEYCODE_RIGHTBRACKET, ']', "]", kActionKeyType, false},
- {"CARET", KEYCODE_CARET, '^', "^", kActionKeyType, false},
- {"UNDERSCORE", KEYCODE_UNDERSCORE, '_', "_", kActionKeyType, false},
- {"BACKQUOTE", KEYCODE_BACKQUOTE, '`', "`", kActionKeyType, false},
- {"a", KEYCODE_a, 'a', "a", kActionKeyType, true},
- {"b", KEYCODE_b, 'b', "b", kActionKeyType, true},
- {"c", KEYCODE_c, 'c', "c", kActionKeyType, true},
- {"d", KEYCODE_d, 'd', "d", kActionKeyType, true},
- {"e", KEYCODE_e, 'e', "e", kActionKeyType, true},
- {"f", KEYCODE_f, 'f', "f", kActionKeyType, true},
- {"g", KEYCODE_g, 'g', "g", kActionKeyType, true},
- {"h", KEYCODE_h, 'h', "h", kActionKeyType, true},
- {"i", KEYCODE_i, 'i', "i", kActionKeyType, true},
- {"j", KEYCODE_j, 'j', "j", kActionKeyType, true},
- {"k", KEYCODE_k, 'k', "k", kActionKeyType, true},
- {"l", KEYCODE_l, 'l', "l", kActionKeyType, true},
- {"m", KEYCODE_m, 'm', "m", kActionKeyType, true},
- {"n", KEYCODE_n, 'n', "n", kActionKeyType, true},
- {"o", KEYCODE_o, 'o', "o", kActionKeyType, true},
- {"p", KEYCODE_p, 'p', "p", kActionKeyType, true},
- {"q", KEYCODE_q, 'q', "q", kActionKeyType, true},
- {"r", KEYCODE_r, 'r', "r", kActionKeyType, true},
- {"s", KEYCODE_s, 's', "s", kActionKeyType, true},
- {"t", KEYCODE_t, 't', "t", kActionKeyType, true},
- {"u", KEYCODE_u, 'u', "u", kActionKeyType, true},
- {"v", KEYCODE_v, 'v', "v", kActionKeyType, true},
- {"w", KEYCODE_w, 'w', "w", kActionKeyType, true},
- {"x", KEYCODE_x, 'x', "x", kActionKeyType, true},
- {"y", KEYCODE_y, 'y', "y", kActionKeyType, true},
- {"z", KEYCODE_z, 'z', "z", kActionKeyType, true},
- {"DELETE", KEYCODE_DELETE, 0, "Del", kActionKeyType, false},
+static const KeyTableEntry sdlKeys[] = {
+ {"BACKSPACE", KEYCODE_BACKSPACE, ASCII_BACKSPACE, "Backspace", false},
+ {"TAB", KEYCODE_TAB, ASCII_TAB, "Tab", false},
+ {"CLEAR", KEYCODE_CLEAR, 0, "Clear", false},
+ {"RETURN", KEYCODE_RETURN, ASCII_RETURN, "Return", false},
+ {"PAUSE", KEYCODE_PAUSE, 0, "Pause", false},
+ {"ESCAPE", KEYCODE_ESCAPE, ASCII_ESCAPE, "Esc", false},
+ {"SPACE", KEYCODE_SPACE, ASCII_SPACE, "Space", false},
+ {"EXCLAIM", KEYCODE_EXCLAIM, '!', "!", false},
+ {"QUOTEDBL", KEYCODE_QUOTEDBL, '"', "\"", false},
+ {"HASH", KEYCODE_HASH, '#', "#", false},
+ {"DOLLAR", KEYCODE_DOLLAR, '$', "$", false},
+ {"AMPERSAND", KEYCODE_AMPERSAND, '&', "&", false},
+ {"QUOTE", KEYCODE_QUOTE, '\'', "'", false},
+ {"LEFTPAREN", KEYCODE_LEFTPAREN, '(', "(", false},
+ {"RIGHTPAREN", KEYCODE_RIGHTPAREN, ')', ")", false},
+ {"ASTERISK", KEYCODE_ASTERISK, '*', "*", false},
+ {"PLUS", KEYCODE_PLUS, '+', "+", false},
+ {"COMMA", KEYCODE_COMMA, ',', ",", false},
+ {"MINUS", KEYCODE_MINUS, '-', "-", false},
+ {"PERIOD", KEYCODE_PERIOD, '.', ".", false},
+ {"SLASH", KEYCODE_SLASH, '/', "/", false},
+ {"0", KEYCODE_0, '0', "0", false},
+ {"1", KEYCODE_1, '1', "1", false},
+ {"2", KEYCODE_2, '2', "2", false},
+ {"3", KEYCODE_3, '3', "3", false},
+ {"4", KEYCODE_4, '4', "4", false},
+ {"5", KEYCODE_5, '5', "5", false},
+ {"6", KEYCODE_6, '6', "6", false},
+ {"7", KEYCODE_7, '7', "7", false},
+ {"8", KEYCODE_8, '8', "8", false},
+ {"9", KEYCODE_9, '9', "9", false},
+ {"COLON", KEYCODE_COLON, ':', ":", false},
+ {"SEMICOLON", KEYCODE_SEMICOLON, ';', ";", false},
+ {"LESS", KEYCODE_LESS, '<', "<", false},
+ {"EQUALS", KEYCODE_EQUALS, '=', "=", false},
+ {"GREATER", KEYCODE_GREATER, '>', ">", false},
+ {"QUESTION", KEYCODE_QUESTION, '?', "?", false},
+ {"AT", KEYCODE_AT, '@', "@", false},
+
+ {"LEFTBRACKET", KEYCODE_LEFTBRACKET, '[', "[", false},
+ {"BACKSLASH", KEYCODE_BACKSLASH, '\\', "\\", false},
+ {"RIGHTBRACKET", KEYCODE_RIGHTBRACKET, ']', "]", false},
+ {"CARET", KEYCODE_CARET, '^', "^", false},
+ {"UNDERSCORE", KEYCODE_UNDERSCORE, '_', "_", false},
+ {"BACKQUOTE", KEYCODE_BACKQUOTE, '`', "`", false},
+ {"a", KEYCODE_a, 'a', "a", true},
+ {"b", KEYCODE_b, 'b', "b", true},
+ {"c", KEYCODE_c, 'c', "c", true},
+ {"d", KEYCODE_d, 'd', "d", true},
+ {"e", KEYCODE_e, 'e', "e", true},
+ {"f", KEYCODE_f, 'f', "f", true},
+ {"g", KEYCODE_g, 'g', "g", true},
+ {"h", KEYCODE_h, 'h', "h", true},
+ {"i", KEYCODE_i, 'i', "i", true},
+ {"j", KEYCODE_j, 'j', "j", true},
+ {"k", KEYCODE_k, 'k', "k", true},
+ {"l", KEYCODE_l, 'l', "l", true},
+ {"m", KEYCODE_m, 'm', "m", true},
+ {"n", KEYCODE_n, 'n', "n", true},
+ {"o", KEYCODE_o, 'o', "o", true},
+ {"p", KEYCODE_p, 'p', "p", true},
+ {"q", KEYCODE_q, 'q', "q", true},
+ {"r", KEYCODE_r, 'r', "r", true},
+ {"s", KEYCODE_s, 's', "s", true},
+ {"t", KEYCODE_t, 't', "t", true},
+ {"u", KEYCODE_u, 'u', "u", true},
+ {"v", KEYCODE_v, 'v', "v", true},
+ {"w", KEYCODE_w, 'w', "w", true},
+ {"x", KEYCODE_x, 'x', "x", true},
+ {"y", KEYCODE_y, 'y', "y", true},
+ {"z", KEYCODE_z, 'z', "z", true},
+ {"DELETE", KEYCODE_DELETE, 0, "Del", false},
// Numeric keypad
- {"KP0", KEYCODE_KP0, 0, "KP0", kActionKeyType, false},
- {"KP1", KEYCODE_KP1, 0, "KP1", kActionKeyType, false},
- {"KP2", KEYCODE_KP2, 0, "KP2", kActionKeyType, false},
- {"KP3", KEYCODE_KP3, 0, "KP3", kActionKeyType, false},
- {"KP4", KEYCODE_KP4, 0, "KP4", kActionKeyType, false},
- {"KP5", KEYCODE_KP5, 0, "KP5", kActionKeyType, false},
- {"KP6", KEYCODE_KP6, 0, "KP6", kActionKeyType, false},
- {"KP7", KEYCODE_KP7, 0, "KP7", kActionKeyType, false},
- {"KP8", KEYCODE_KP8, 0, "KP8", kActionKeyType, false},
- {"KP9", KEYCODE_KP9, 0, "KP9", kActionKeyType, false},
- {"KP_PERIOD", KEYCODE_KP_PERIOD, 0, "KP.", kActionKeyType, false},
- {"KP_DIVIDE", KEYCODE_KP_DIVIDE, 0, "KP/", kActionKeyType, false},
- {"KP_MULTIPLY", KEYCODE_KP_MULTIPLY, 0, "KP*", kActionKeyType, false},
- {"KP_MINUS", KEYCODE_KP_MINUS, 0, "KP-", kActionKeyType, false},
- {"KP_PLUS", KEYCODE_KP_PLUS, 0, "KP+", kActionKeyType, false},
- {"KP_ENTER", KEYCODE_KP_ENTER, 0, "KP Enter", kActionKeyType, false},
- {"KP_EQUALS", KEYCODE_KP_EQUALS, 0, "KP=", kActionKeyType, false},
+ {"KP0", KEYCODE_KP0, 0, "KP0", false},
+ {"KP1", KEYCODE_KP1, 0, "KP1", false},
+ {"KP2", KEYCODE_KP2, 0, "KP2", false},
+ {"KP3", KEYCODE_KP3, 0, "KP3", false},
+ {"KP4", KEYCODE_KP4, 0, "KP4", false},
+ {"KP5", KEYCODE_KP5, 0, "KP5", false},
+ {"KP6", KEYCODE_KP6, 0, "KP6", false},
+ {"KP7", KEYCODE_KP7, 0, "KP7", false},
+ {"KP8", KEYCODE_KP8, 0, "KP8", false},
+ {"KP9", KEYCODE_KP9, 0, "KP9", false},
+ {"KP_PERIOD", KEYCODE_KP_PERIOD, 0, "KP.", false},
+ {"KP_DIVIDE", KEYCODE_KP_DIVIDE, 0, "KP/", false},
+ {"KP_MULTIPLY", KEYCODE_KP_MULTIPLY, 0, "KP*", false},
+ {"KP_MINUS", KEYCODE_KP_MINUS, 0, "KP-", false},
+ {"KP_PLUS", KEYCODE_KP_PLUS, 0, "KP+", false},
+ {"KP_ENTER", KEYCODE_KP_ENTER, 0, "KP Enter", false},
+ {"KP_EQUALS", KEYCODE_KP_EQUALS, 0, "KP=", false},
// Arrows + Home/End pad
- {"UP", KEYCODE_UP, 0, "Up", kDirUpKeyType, false},
- {"DOWN", KEYCODE_DOWN, 0, "Down", kDirDownKeyType, false},
- {"RIGHT", KEYCODE_RIGHT, 0, "Right", kDirRightKeyType, false},
- {"LEFT", KEYCODE_LEFT, 0, "Left", kDirLeftKeyType, false},
- {"INSERT", KEYCODE_INSERT, 0, "Insert", kActionKeyType, false},
- {"HOME", KEYCODE_HOME, 0, "Home", kActionKeyType, false},
- {"END", KEYCODE_END, 0, "End", kActionKeyType, false},
- {"PAGEUP", KEYCODE_PAGEUP, 0, "PgUp", kActionKeyType, false},
- {"PAGEDOWN", KEYCODE_PAGEDOWN, 0, "PgDn", kActionKeyType, false},
+ {"UP", KEYCODE_UP, 0, "Up", false},
+ {"DOWN", KEYCODE_DOWN, 0, "Down", false},
+ {"RIGHT", KEYCODE_RIGHT, 0, "Right", false},
+ {"LEFT", KEYCODE_LEFT, 0, "Left", false},
+ {"INSERT", KEYCODE_INSERT, 0, "Insert", false},
+ {"HOME", KEYCODE_HOME, 0, "Home", false},
+ {"END", KEYCODE_END, 0, "End", false},
+ {"PAGEUP", KEYCODE_PAGEUP, 0, "PgUp", false},
+ {"PAGEDOWN", KEYCODE_PAGEDOWN, 0, "PgDn", false},
// Function keys
- {"F1", KEYCODE_F1, ASCII_F1, "F1", kActionKeyType, false},
- {"F2", KEYCODE_F2, ASCII_F2, "F2", kActionKeyType, false},
- {"F3", KEYCODE_F3, ASCII_F3, "F3", kActionKeyType, false},
- {"F4", KEYCODE_F4, ASCII_F4, "F4", kActionKeyType, false},
- {"F5", KEYCODE_F5, ASCII_F5, "F5", kActionKeyType, false},
- {"F6", KEYCODE_F6, ASCII_F6, "F6", kActionKeyType, false},
- {"F7", KEYCODE_F7, ASCII_F7, "F7", kActionKeyType, false},
- {"F8", KEYCODE_F8, ASCII_F8, "F8", kActionKeyType, false},
- {"F9", KEYCODE_F9, ASCII_F9, "F9", kActionKeyType, false},
- {"F10", KEYCODE_F10, ASCII_F10, "F10", kActionKeyType, false},
- {"F11", KEYCODE_F11, ASCII_F11, "F11", kActionKeyType, false},
- {"F12", KEYCODE_F12, ASCII_F12, "F12", kActionKeyType, false},
- {"F13", KEYCODE_F13, 0, "F13", kActionKeyType, false},
- {"F14", KEYCODE_F14, 0, "F14", kActionKeyType, false},
- {"F15", KEYCODE_F15, 0, "F15", kActionKeyType, false},
+ {"F1", KEYCODE_F1, ASCII_F1, "F1", false},
+ {"F2", KEYCODE_F2, ASCII_F2, "F2", false},
+ {"F3", KEYCODE_F3, ASCII_F3, "F3", false},
+ {"F4", KEYCODE_F4, ASCII_F4, "F4", false},
+ {"F5", KEYCODE_F5, ASCII_F5, "F5", false},
+ {"F6", KEYCODE_F6, ASCII_F6, "F6", false},
+ {"F7", KEYCODE_F7, ASCII_F7, "F7", false},
+ {"F8", KEYCODE_F8, ASCII_F8, "F8", false},
+ {"F9", KEYCODE_F9, ASCII_F9, "F9", false},
+ {"F10", KEYCODE_F10, ASCII_F10, "F10", false},
+ {"F11", KEYCODE_F11, ASCII_F11, "F11", false},
+ {"F12", KEYCODE_F12, ASCII_F12, "F12", false},
+ {"F13", KEYCODE_F13, 0, "F13", false},
+ {"F14", KEYCODE_F14, 0, "F14", false},
+ {"F15", KEYCODE_F15, 0, "F15", false},
// Miscellaneous function keys
- {"HELP", KEYCODE_HELP, 0, "Help", kActionKeyType, false},
- {"PRINT", KEYCODE_PRINT, 0, "Print", kActionKeyType, false},
- {"SYSREQ", KEYCODE_SYSREQ, 0, "SysRq", kActionKeyType, false},
- {"BREAK", KEYCODE_BREAK, 0, "Break", kActionKeyType, false},
- {"MENU", KEYCODE_MENU, 0, "Menu", kActionKeyType, false},
+ {"HELP", KEYCODE_HELP, 0, "Help", false},
+ {"PRINT", KEYCODE_PRINT, 0, "Print", false},
+ {"SYSREQ", KEYCODE_SYSREQ, 0, "SysRq", false},
+ {"BREAK", KEYCODE_BREAK, 0, "Break", false},
+ {"MENU", KEYCODE_MENU, 0, "Menu", false},
// Power Macintosh power key
- {"POWER", KEYCODE_POWER, 0, "Power", kActionKeyType, false},
+ {"POWER", KEYCODE_POWER, 0, "Power", false},
// Some european keyboards
- {"EURO", KEYCODE_EURO, 0, "Euro", kActionKeyType, false},
+ {"EURO", KEYCODE_EURO, 0, "Euro", false},
// Atari keyboard has Undo
- {"UNDO", KEYCODE_UNDO, 0, "Undo", kActionKeyType, false},
- {0, KEYCODE_INVALID, 0, 0, kGenericKeyType, false}
-};
-
-struct Mod {
- byte flag;
- const char *id;
- const char *desc;
- bool shiftable;
+ {"UNDO", KEYCODE_UNDO, 0, "Undo", false},
+ {0, KEYCODE_INVALID, 0, 0, false}
};
-static const Mod modifiers[] = {
+static const ModifierTableEntry sdlModifiers[] = {
{ 0, "", "", false },
{ KBD_CTRL, "C+", "Ctrl+", false },
{ KBD_ALT, "A+", "Alt+", false },
@@ -190,41 +174,8 @@ static const Mod modifiers[] = {
{ KBD_SHIFT | KBD_CTRL | KBD_ALT, "C+A+", "Ctrl+Alt+", true },
{ 0, 0, 0, false }
};
-#endif
-
Common::HardwareKeySet *OSystem_SDL::getHardwareKeySet() {
-#ifdef ENABLE_KEYMAPPER
- HardwareKeySet *keySet = new HardwareKeySet();
- const Key *key;
- const Mod *mod;
- char fullKeyId[50];
- char fullKeyDesc[100];
- uint16 ascii;
-
- for (mod = modifiers; mod->id; mod++) {
- for (key = keys; key->hwId; key++) {
- ascii = key->ascii;
-
- if (mod->shiftable && key->shiftable) {
- snprintf(fullKeyId, 50, "%s%c", mod->id, toupper(key->hwId[0]));
- snprintf(fullKeyDesc, 100, "%s%c", mod->desc, toupper(key->desc[0]));
- ascii = toupper(key->ascii);
- } else if (mod->shiftable) {
- snprintf(fullKeyId, 50, "S+%s%s", mod->id, key->hwId);
- snprintf(fullKeyDesc, 100, "Shift+%s%s", mod->desc, key->desc);
- } else {
- snprintf(fullKeyId, 50, "%s%s", mod->id, key->hwId);
- snprintf(fullKeyDesc, 100, "%s%s", mod->desc, key->desc);
- }
-
- keySet->addHardwareKey(new HardwareKey(fullKeyId, KeyState(key->keycode, ascii, mod->flag), fullKeyDesc, key->preferredAction ));
- }
- }
-
- return keySet;
-
-#else
- return 0;
-#endif
+ return new HardwareKeySet(sdlKeys, sdlModifiers);
}
+#endif
diff --git a/backends/platform/sdl/macosx/appmenu_osx.mm b/backends/platform/sdl/macosx/appmenu_osx.mm
index bb089a6b61..97c7edba3e 100755
--- a/backends/platform/sdl/macosx/appmenu_osx.mm
+++ b/backends/platform/sdl/macosx/appmenu_osx.mm
@@ -35,6 +35,11 @@
- (void)setAppleMenu:(NSMenu *)menu;
@end
+NSString *constructNSStringFromCString(const char* rawCString, NSStringEncoding stringEncoding) {
+ NSData *nsData = [NSData dataWithBytes:rawCString length:strlen(rawCString)];
+ return [[NSString alloc] initWithData:nsData encoding:stringEncoding];
+}
+
void replaceApplicationMenuItems() {
// Code mainly copied and adapted from SDLmain.m
@@ -50,34 +55,47 @@ void replaceApplicationMenuItems() {
// Create new application menu
appleMenu = [[NSMenu alloc] initWithTitle:@""];
+ NSString *nsString = NULL;
+
// Get current encoding
#ifdef USE_TRANSLATION
- NSStringEncoding stringEncoding = CFStringConvertEncodingToNSStringEncoding(CFStringConvertIANACharSetNameToEncoding((CFStringRef)[NSString stringWithCString:(TransMan.getCurrentCharset()).c_str() encoding:NSASCIIStringEncoding]));
+ nsString = constructNSStringFromCString((TransMan.getCurrentCharset()).c_str(), NSASCIIStringEncoding);
+ NSStringEncoding stringEncoding = CFStringConvertEncodingToNSStringEncoding(CFStringConvertIANACharSetNameToEncoding((CFStringRef)nsString));
+ [nsString release];
#else
NSStringEncoding stringEncoding = NSASCIIStringEncoding;
#endif
-
+
// Add "About ScummVM" menu item
- [appleMenu addItemWithTitle:[NSString stringWithCString:_("About ScummVM") encoding:stringEncoding] action:@selector(orderFrontStandardAboutPanel:) keyEquivalent:@""];
+ nsString = constructNSStringFromCString(_("About ScummVM"), stringEncoding);
+ [appleMenu addItemWithTitle:nsString action:@selector(orderFrontStandardAboutPanel:) keyEquivalent:@""];
+ [nsString release];
// Add separator
[appleMenu addItem:[NSMenuItem separatorItem]];
// Add "Hide ScummVM" menu item
- [appleMenu addItemWithTitle:[NSString stringWithCString:_("Hide ScummVM") encoding:stringEncoding] action:@selector(hide:) keyEquivalent:@"h"];
+ nsString = constructNSStringFromCString(_("Hide ScummVM"), stringEncoding);
+ [appleMenu addItemWithTitle:nsString action:@selector(hide:) keyEquivalent:@"h"];
+ [nsString release];
// Add "Hide Others" menu item
- menuItem = (NSMenuItem *)[appleMenu addItemWithTitle:[NSString stringWithCString:_("Hide Others") encoding:stringEncoding] action:@selector(hideOtherApplications:) keyEquivalent:@"h"];
+ nsString = constructNSStringFromCString(_("Hide Others"), stringEncoding);
+ menuItem = (NSMenuItem *)[appleMenu addItemWithTitle:nsString action:@selector(hideOtherApplications:) keyEquivalent:@"h"];
[menuItem setKeyEquivalentModifierMask:(NSAlternateKeyMask|NSCommandKeyMask)];
// Add "Show All" menu item
- [appleMenu addItemWithTitle:[NSString stringWithCString:_("Show All") encoding:stringEncoding] action:@selector(unhideAllApplications:) keyEquivalent:@""];
+ nsString = constructNSStringFromCString(_("Show All"), stringEncoding);
+ [appleMenu addItemWithTitle:nsString action:@selector(unhideAllApplications:) keyEquivalent:@""];
+ [nsString release];
// Add separator
[appleMenu addItem:[NSMenuItem separatorItem]];
// Add "Quit ScummVM" menu item
- [appleMenu addItemWithTitle:[NSString stringWithCString:_("Quit ScummVM") encoding:stringEncoding] action:@selector(terminate:) keyEquivalent:@"q"];
+ nsString = constructNSStringFromCString(_("Quit ScummVM"), stringEncoding);
+ [appleMenu addItemWithTitle:nsString action:@selector(terminate:) keyEquivalent:@"q"];
+ [nsString release];
// Put application menu into the menubar
menuItem = [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""];
@@ -89,16 +107,22 @@ void replaceApplicationMenuItems() {
// Create new "Window" menu
- windowMenu = [[NSMenu alloc] initWithTitle:[NSString stringWithCString:_("Window") encoding:stringEncoding]];
+ nsString = constructNSStringFromCString(_("Window"), stringEncoding);
+ windowMenu = [[NSMenu alloc] initWithTitle:nsString];
+ [nsString release];
// Add "Minimize" menu item
- menuItem = [[NSMenuItem alloc] initWithTitle:[NSString stringWithCString:_("Minimize") encoding:stringEncoding] action:@selector(performMiniaturize:) keyEquivalent:@"m"];
+ nsString = constructNSStringFromCString(_("Minimize"), stringEncoding);
+ menuItem = [[NSMenuItem alloc] initWithTitle:nsString action:@selector(performMiniaturize:) keyEquivalent:@"m"];
[windowMenu addItem:menuItem];
+ [nsString release];
// Put menu into the menubar
- menuItem = [[NSMenuItem alloc] initWithTitle:[NSString stringWithCString:_("Window") encoding:stringEncoding] action:nil keyEquivalent:@""];
+ nsString = constructNSStringFromCString(_("Window"), stringEncoding);
+ menuItem = [[NSMenuItem alloc] initWithTitle:nsString action:nil keyEquivalent:@""];
[menuItem setSubmenu:windowMenu];
[[NSApp mainMenu] addItem:menuItem];
+ [nsString release];
// Tell the application object that this is now the window menu.
[NSApp setWindowsMenu:windowMenu];
diff --git a/backends/platform/sdl/posix/posix.cpp b/backends/platform/sdl/posix/posix.cpp
index 05c779a4e0..7a8b1e7b70 100644
--- a/backends/platform/sdl/posix/posix.cpp
+++ b/backends/platform/sdl/posix/posix.cpp
@@ -175,7 +175,7 @@ bool OSystem_POSIX::displayLogFile() {
} else if (pid == 0) {
// Try xdg-open first
- execlp("xdg-open", "xdg-open", _logFilePath.c_str(), (char*)0);
+ execlp("xdg-open", "xdg-open", _logFilePath.c_str(), (char *)0);
// If we're here, that clearly failed.
@@ -184,7 +184,7 @@ bool OSystem_POSIX::displayLogFile() {
// Try xterm+less next
- execlp("xterm", "xterm", "-e", "less", _logFilePath.c_str(), (char*)0);
+ execlp("xterm", "xterm", "-e", "less", _logFilePath.c_str(), (char *)0);
// TODO: If less does not exist we could fall back to 'more'.
// However, we'll have to use 'xterm -hold' for that to prevent the
diff --git a/backends/platform/sdl/sdl.h b/backends/platform/sdl/sdl.h
index 22d79dbfe7..64e63b40a6 100644
--- a/backends/platform/sdl/sdl.h
+++ b/backends/platform/sdl/sdl.h
@@ -58,7 +58,9 @@ public:
virtual void engineInit();
virtual void engineDone();
#endif
+#ifdef ENABLE_KEYMAPPER
virtual Common::HardwareKeySet *getHardwareKeySet();
+#endif
virtual void quit();
virtual void fatalError();
diff --git a/backends/platform/sdl/win32/win32.cpp b/backends/platform/sdl/win32/win32.cpp
index 3e09aa2640..453d566c7b 100644
--- a/backends/platform/sdl/win32/win32.cpp
+++ b/backends/platform/sdl/win32/win32.cpp
@@ -38,6 +38,7 @@
#include <SDL_syswm.h> // For setting the icon
#include "backends/platform/sdl/win32/win32.h"
+#include "backends/saves/windows/windows-saves.h"
#include "backends/fs/windows/windows-fs-factory.h"
#include "backends/taskbar/win32/win32-taskbar.h"
@@ -74,6 +75,10 @@ void OSystem_Win32::initBackend() {
FreeConsole();
}
+ // Create the savefile manager
+ if (_savefileManager == 0)
+ _savefileManager = new WindowsSaveFileManager();
+
// Invoke parent implementation of this method
OSystem_SDL::initBackend();
}
diff --git a/backends/platform/webos/webos.cpp b/backends/platform/webos/webos.cpp
index bfb19ed3bc..710a3f79be 100644
--- a/backends/platform/webos/webos.cpp
+++ b/backends/platform/webos/webos.cpp
@@ -51,20 +51,18 @@ void OSystem_SDL_WebOS::initBackend() {
*
* @return The hardware key set with added webOS specific keys.
*/
-HardwareKeySet *OSystem_SDL_WebOS::getHardwareKeySet() {
#ifdef ENABLE_KEYMAPPER
+HardwareKeySet *OSystem_SDL_WebOS::getHardwareKeySet() {
// Get the original SDL hardware key set
HardwareKeySet *keySet = OSystem_SDL::getHardwareKeySet();
// Add WebOS specific keys
keySet->addHardwareKey(new HardwareKey("FORWARD",
- KeyState((KeyCode) 229, 229, 0), "Forward", kActionKeyType));
+ KeyState((KeyCode) 229, 229, 0), "Forward"));
// Return the modified hardware key set
return keySet;
-#else
- return 0;
-#endif
}
+#endif
#endif
diff --git a/backends/platform/webos/webos.h b/backends/platform/webos/webos.h
index 850aaf9ce2..71390a1d2c 100644
--- a/backends/platform/webos/webos.h
+++ b/backends/platform/webos/webos.h
@@ -31,7 +31,9 @@ public:
OSystem_SDL_WebOS();
virtual void initBackend();
+#ifdef ENABLE_KEYMAPPER
virtual Common::HardwareKeySet *getHardwareKeySet();
+#endif
};
#endif
diff --git a/backends/platform/wince/wince-sdl.cpp b/backends/platform/wince/wince-sdl.cpp
index 4e17827e5c..a57fcb9628 100644
--- a/backends/platform/wince/wince-sdl.cpp
+++ b/backends/platform/wince/wince-sdl.cpp
@@ -87,15 +87,15 @@ extern "C" void *__wrap_malloc(size_t size) {
void *ptr = __real_malloc(size+4);
// printf("malloc(%d) = %p\n", size, ptr);
if (ptr != NULL) {
- *((HANDLE*)ptr) = 0;
- return 4+(char*)ptr;
+ *((HANDLE *)ptr) = 0;
+ return 4+(char *)ptr;
}
return NULL;
}
HANDLE H = CreateFileMapping((HANDLE)INVALID_HANDLE_VALUE, 0, PAGE_READWRITE, 0, size+4, 0);
void *ptr = MapViewOfFile(H, FILE_MAP_ALL_ACCESS, 0, 0, 0);
- *((HANDLE*)ptr) = H;
- return 4+(char*)ptr;
+ *((HANDLE *)ptr) = H;
+ return 4+(char *)ptr;
}
extern "C" void __wrap_free(void *ptr) {
@@ -104,9 +104,9 @@ extern "C" void __wrap_free(void *ptr) {
printf("free(%p)\n", ptr);
*/
if (ptr != NULL) {
- HANDLE H = *(HANDLE*)((char *)ptr-4);
+ HANDLE H = *(HANDLE *)((char *)ptr-4);
if (H == 0) {
- __real_free((char*)ptr-4);
+ __real_free((char *)ptr-4);
return;
}
UnmapViewOfFile((char *)ptr-4);
diff --git a/backends/plugins/elf/elf-loader.cpp b/backends/plugins/elf/elf-loader.cpp
index d75010196a..d60ddce57e 100644
--- a/backends/plugins/elf/elf-loader.cpp
+++ b/backends/plugins/elf/elf-loader.cpp
@@ -480,7 +480,7 @@ void *DLObject::symbol(const char *name) {
!strcmp(name, _strtab + s->st_name)) {
// We found the symbol
debug(2, "elfloader: => 0x%08x", s->st_value);
- return (void*)s->st_value;
+ return (void *)s->st_value;
}
// We didn't find the symbol
diff --git a/backends/saves/windows/windows-saves.cpp b/backends/saves/windows/windows-saves.cpp
new file mode 100644
index 0000000000..87348c3416
--- /dev/null
+++ b/backends/saves/windows/windows-saves.cpp
@@ -0,0 +1,78 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * 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.
+ *
+ */
+
+#include "common/scummsys.h"
+
+#include "backends/saves/windows/windows-saves.h"
+
+#if defined(WIN32) && !defined(_WIN32_WCE) && !defined(DISABLE_DEFAULT_SAVEFILEMANAGER)
+
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+
+#include "common/config-manager.h"
+#include "common/savefile.h"
+
+WindowsSaveFileManager::WindowsSaveFileManager() {
+ char defaultSavepath[MAXPATHLEN];
+
+ OSVERSIONINFO win32OsVersion;
+ ZeroMemory(&win32OsVersion, sizeof(OSVERSIONINFO));
+ win32OsVersion.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
+ GetVersionEx(&win32OsVersion);
+ // Check for non-9X version of Windows.
+ if (win32OsVersion.dwPlatformId != VER_PLATFORM_WIN32_WINDOWS) {
+ // Use the Application Data directory of the user profile.
+ if (win32OsVersion.dwMajorVersion >= 5) {
+ if (!GetEnvironmentVariable("APPDATA", defaultSavepath, sizeof(defaultSavepath)))
+ error("Unable to access application data directory");
+ } else {
+ if (!GetEnvironmentVariable("USERPROFILE", defaultSavepath, sizeof(defaultSavepath)))
+ error("Unable to access user profile directory");
+
+ strcat(defaultSavepath, "\\Application Data");
+
+ // If the directory already exists (as it should in most cases),
+ // we don't want to fail, but we need to stop on other errors (such as ERROR_PATH_NOT_FOUND)
+ if (!CreateDirectory(defaultSavepath, NULL)) {
+ if (GetLastError() != ERROR_ALREADY_EXISTS)
+ error("Cannot create Application data folder");
+ }
+ }
+
+ strcat(defaultSavepath, "\\ScummVM");
+ if (!CreateDirectory(defaultSavepath, NULL)) {
+ if (GetLastError() != ERROR_ALREADY_EXISTS)
+ error("Cannot create ScummVM application data folder");
+ }
+
+ strcat(defaultSavepath, "\\Saved games");
+ if (!CreateDirectory(defaultSavepath, NULL)) {
+ if (GetLastError() != ERROR_ALREADY_EXISTS)
+ error("Cannot create ScummVM Saved games folder");
+ }
+
+ ConfMan.registerDefault("savepath", defaultSavepath);
+ }
+}
+
+#endif
diff --git a/backends/platform/iphone/blit_arm.h b/backends/saves/windows/windows-saves.h
index 77bb3578ab..a705aa2b7f 100644
--- a/backends/platform/iphone/blit_arm.h
+++ b/backends/saves/windows/windows-saves.h
@@ -20,16 +20,17 @@
*
*/
-extern "C" void blitLandscapeScreenRect16bpp(uint16 *dst, uint16 *src,
- int width,
- int height,
- int screenWidth,
- int screenHeight);
+#ifndef BACKEND_WINDOWS_SAVES_H
+#define BACKEND_WINDOWS_SAVES_H
-extern "C" void blitLandscapeScreenRect8bpp(uint16 *dst,
- byte *src,
- int width,
- int height,
- uint16 *palette,
- int screenWidth,
- int screenHeight);
+#include "backends/saves/default/default-saves.h"
+
+/**
+ * Provides a default savefile manager implementation for common platforms.
+ */
+class WindowsSaveFileManager : public DefaultSaveFileManager {
+public:
+ WindowsSaveFileManager();
+};
+
+#endif
diff --git a/backends/taskbar/win32/win32-taskbar.cpp b/backends/taskbar/win32/win32-taskbar.cpp
index 046ddb1cd0..5c9105b0eb 100644
--- a/backends/taskbar/win32/win32-taskbar.cpp
+++ b/backends/taskbar/win32/win32-taskbar.cpp
@@ -29,13 +29,9 @@
#if defined(WIN32) && defined(USE_TASKBAR)
// Needed for taskbar functions
-#if defined(__GNUC__)
-#ifdef __MINGW32__
+#if defined(__GNUC__) && defined(__MINGW32__) && !defined(__MINGW64__)
#include "backends/taskbar/win32/mingw-compat.h"
#else
- #error Only compilation with MingW is supported
-#endif
-#else
// We need certain functions that are excluded by default
#undef NONLS
#undef NOICONS
@@ -44,9 +40,12 @@
#undef ARRAYSIZE
#endif
- // Default MSVC headers for ITaskbarList3 and IShellLink
- #include <SDKDDKVer.h>
+ #if defined(_MSC_VER)
+ // Default MSVC headers for ITaskbarList3 and IShellLink
+ #include <SDKDDKVer.h>
+ #endif
#endif
+
#include <shlobj.h>
// For HWND
@@ -75,7 +74,7 @@ Win32TaskbarManager::Win32TaskbarManager() : _taskbar(NULL), _count(0), _icon(NU
0,
CLSCTX_INPROC_SERVER,
IID_ITaskbarList3,
- reinterpret_cast<void**> (&(_taskbar)));
+ reinterpret_cast<void **> (&(_taskbar)));
if (SUCCEEDED(hr)) {
// Initialize taskbar object
@@ -275,7 +274,7 @@ void Win32TaskbarManager::addRecent(const Common::String &name, const Common::St
GetModuleFileNameW(NULL, path, MAX_PATH);
// Create a shell link.
- if (SUCCEEDED(CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC, IID_IShellLinkW, reinterpret_cast<void**> (&link)))) {
+ if (SUCCEEDED(CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC, IID_IShellLinkW, reinterpret_cast<void **> (&link)))) {
// Convert game name and description to Unicode.
LPWSTR game = ansiToUnicode(name.c_str());
LPWSTR desc = ansiToUnicode(description.c_str());
@@ -297,7 +296,7 @@ void Win32TaskbarManager::addRecent(const Common::String &name, const Common::St
// The link's display name must be set via property store.
IPropertyStore* propStore;
- HRESULT hr = link->QueryInterface(IID_IPropertyStore, reinterpret_cast<void**> (&(propStore)));
+ HRESULT hr = link->QueryInterface(IID_IPropertyStore, reinterpret_cast<void **> (&(propStore)));
if (SUCCEEDED(hr)) {
PROPVARIANT pv;
pv.vt = VT_LPWSTR;
diff --git a/base/commandLine.cpp b/base/commandLine.cpp
index c3059ced2f..aa589ed15f 100644
--- a/base/commandLine.cpp
+++ b/base/commandLine.cpp
@@ -277,7 +277,7 @@ void registerDefaults() {
// resp. between "--some-option" and "--no-some-option".
#define DO_OPTION_BOOL(shortCmd, longCmd) \
if (isLongCmd ? (!strcmp(s+2, longCmd) || !strcmp(s+2, "no-"longCmd)) : (tolower(s[1]) == shortCmd)) { \
- bool boolValue = (islower(static_cast<unsigned char>(s[1])) != 0); \
+ bool boolValue = (Common::isLower(s[1]) != 0); \
s += 2; \
if (isLongCmd) { \
boolValue = !strcmp(s, longCmd); \
diff --git a/base/main.cpp b/base/main.cpp
index b4cfd45689..5e9f1d4f25 100644
--- a/base/main.cpp
+++ b/base/main.cpp
@@ -259,42 +259,52 @@ static void setupGraphics(OSystem &system) {
}
static void setupKeymapper(OSystem &system) {
-
#ifdef ENABLE_KEYMAPPER
using namespace Common;
Keymapper *mapper = system.getEventManager()->getKeymapper();
- Keymap *globalMap = new Keymap("global");
- Action *act;
- HardwareKeySet *keySet;
- keySet = system.getHardwareKeySet();
+ HardwareKeySet *keySet = system.getHardwareKeySet();
// Query backend for hardware keys and register them
mapper->registerHardwareKeySet(keySet);
// Now create the global keymap
- act = new Action(globalMap, "MENU", _("Menu"), kGenericActionType, kSelectKeyType);
- act->addKeyEvent(KeyState(KEYCODE_F5, ASCII_F5, 0));
+ Keymap *primaryGlobalKeymap = new Keymap(kGlobalKeymapName);
+ Action *act;
+ act = new Action(primaryGlobalKeymap, "MENU", _("Menu"));
+ act->addEvent(EVENT_MAINMENU);
- act = new Action(globalMap, "SKCT", _("Skip"), kGenericActionType, kActionKeyType);
+ act = new Action(primaryGlobalKeymap, "SKCT", _("Skip"));
act->addKeyEvent(KeyState(KEYCODE_ESCAPE, ASCII_ESCAPE, 0));
- act = new Action(globalMap, "PAUS", _("Pause"), kGenericActionType, kStartKeyType);
+ act = new Action(primaryGlobalKeymap, "PAUS", _("Pause"));
act->addKeyEvent(KeyState(KEYCODE_SPACE, ' ', 0));
- act = new Action(globalMap, "SKLI", _("Skip line"), kGenericActionType, kActionKeyType);
+ act = new Action(primaryGlobalKeymap, "SKLI", _("Skip line"));
act->addKeyEvent(KeyState(KEYCODE_PERIOD, '.', 0));
- act = new Action(globalMap, "VIRT", _("Display keyboard"), kVirtualKeyboardActionType);
- act->addKeyEvent(KeyState(KEYCODE_F7, ASCII_F7, 0));
+#ifdef ENABLE_VKEYBD
+ act = new Action(primaryGlobalKeymap, "VIRT", _("Display keyboard"));
+ act->addEvent(EVENT_VIRTUAL_KEYBOARD);
+#endif
+
+ act = new Action(primaryGlobalKeymap, "REMP", _("Remap keys"));
+ act->addEvent(EVENT_KEYMAPPER_REMAP);
- act = new Action(globalMap, "REMP", _("Remap keys"), kKeyRemapActionType);
- act->addKeyEvent(KeyState(KEYCODE_F8, ASCII_F8, 0));
+ act = new Action(primaryGlobalKeymap, "FULS", _("Toggle FullScreen"));
+ act->addKeyEvent(KeyState(KEYCODE_RETURN, ASCII_RETURN, KBD_ALT));
- mapper->addGlobalKeymap(globalMap);
+ mapper->addGlobalKeymap(primaryGlobalKeymap);
+ mapper->pushKeymap(kGlobalKeymapName, true);
- mapper->pushKeymap("global", true);
+ // Get the platform-specific global keymap (if it exists)
+ Keymap *platformGlobalKeymap = system.getGlobalKeymap();
+ if (platformGlobalKeymap) {
+ String platformGlobalKeymapName = platformGlobalKeymap->getName();
+ mapper->addGlobalKeymap(platformGlobalKeymap);
+ mapper->pushKeymap(platformGlobalKeymapName, true);
+ }
#endif
}
diff --git a/base/plugins.cpp b/base/plugins.cpp
index df12d0d3ba..db8a5d8817 100644
--- a/base/plugins.cpp
+++ b/base/plugins.cpp
@@ -355,8 +355,6 @@ void PluginManagerUncached::init() {
unloadAllPlugins();
_allEnginePlugins.clear();
- // Resize our pluginsInMem list to prevent fragmentation
- _pluginsInMem[PLUGIN_TYPE_ENGINE].resize(2);
unloadPluginsExcept(PLUGIN_TYPE_ENGINE, NULL, false); // empty the engine plugins
for (ProviderList::iterator pp = _providers.begin();
diff --git a/base/version.cpp b/base/version.cpp
index a068f2b141..7943552418 100644
--- a/base/version.cpp
+++ b/base/version.cpp
@@ -121,4 +121,8 @@ const char *gScummVMFeatures = ""
#ifdef USE_FAAD
"AAC "
#endif
+
+#ifdef USE_FREETYPE2
+ "FreeType2 "
+#endif
;
diff --git a/common/EventDispatcher.cpp b/common/EventDispatcher.cpp
index 4e3f671cfd..4c7286bbb5 100644
--- a/common/EventDispatcher.cpp
+++ b/common/EventDispatcher.cpp
@@ -48,24 +48,16 @@ void EventDispatcher::dispatch() {
dispatchPoll();
for (List<SourceEntry>::iterator i = _sources.begin(); i != _sources.end(); ++i) {
- const bool allowMapping = i->source->allowMapping();
-
while (i->source->pollEvent(event)) {
// We only try to process the events via the setup event mapper, when
// we have a setup mapper and when the event source allows mapping.
- if (_mapper && allowMapping) {
- if (_mapper->notifyEvent(event)) {
- // We allow the event mapper to create multiple events, when
- // eating an event.
- while (_mapper->pollEvent(event))
- dispatchEvent(event);
-
- // Try getting another event from the current EventSource.
- continue;
- }
- }
+ assert(_mapper);
+ List<Event> mappedEvents = _mapper->mapEvent(event, i->source);
- dispatchEvent(event);
+ for (List<Event>::iterator j = mappedEvents.begin(); j != mappedEvents.end(); ++j) {
+ const Event mappedEvent = *j;
+ dispatchEvent(mappedEvent);
+ }
}
}
}
diff --git a/common/EventMapper.cpp b/common/EventMapper.cpp
new file mode 100644
index 0000000000..2808a7b5fd
--- /dev/null
+++ b/common/EventMapper.cpp
@@ -0,0 +1,54 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * 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.
+ *
+ */
+
+#include "common/events.h"
+
+namespace Common {
+
+List<Event> DefaultEventMapper::mapEvent(const Event &ev, EventSource *source) {
+ List<Event> events;
+ Event mappedEvent;
+ if (ev.type == EVENT_KEYDOWN) {
+ if (ev.kbd.hasFlags(KBD_CTRL) && ev.kbd.keycode == KEYCODE_F5) {
+ mappedEvent.type = EVENT_MAINMENU;
+ }
+#ifdef ENABLE_VKEYBD
+ else if (ev.kbd.keycode == KEYCODE_F7 && ev.kbd.hasFlags(0)) {
+ mappedEvent.type = EVENT_VIRTUAL_KEYBOARD;
+ }
+#endif
+#ifdef ENABLE_KEYMAPPER
+ else if (ev.kbd.keycode == KEYCODE_F8 && ev.kbd.hasFlags(0)) {
+ mappedEvent.type = EVENT_KEYMAPPER_REMAP;
+ }
+#endif
+ }
+
+ // if it didn't get mapped, just pass it through
+ if (mappedEvent.type == EVENT_INVALID)
+ mappedEvent = ev;
+ events.push_back(mappedEvent);
+ return events;
+}
+
+
+} // namespace Common
diff --git a/common/array.h b/common/array.h
index ef0ee27f24..a2c3023362 100644
--- a/common/array.h
+++ b/common/array.h
@@ -24,7 +24,7 @@
#include "common/scummsys.h"
#include "common/algorithm.h"
-#include "common/textconsole.h" // For error()
+#include "common/textconsole.h" // For error()
#include "common/memory.h"
namespace Common {
@@ -42,17 +42,19 @@ namespace Common {
*/
template<class T>
class Array {
-protected:
- uint _capacity;
- uint _size;
- T *_storage;
-
public:
typedef T *iterator;
typedef const T *const_iterator;
typedef T value_type;
+ typedef uint size_type;
+
+protected:
+ size_type _capacity;
+ size_type _size;
+ T *_storage;
+
public:
Array() : _capacity(0), _size(0), _storage(0) {}
@@ -67,7 +69,7 @@ public:
* Construct an array by copying data from a regular array.
*/
template<class T2>
- Array(const T2 *data, int n) {
+ Array(const T2 *data, size_type n) {
_size = n;
allocCapacity(n);
uninitialized_copy(data, data + _size, _storage);
@@ -128,19 +130,19 @@ public:
}
- void insert_at(int idx, const T &element) {
- assert(idx >= 0 && (uint)idx <= _size);
+ void insert_at(size_type idx, const T &element) {
+ assert(idx <= _size);
insert_aux(_storage + idx, &element, &element + 1);
}
- void insert_at(int idx, const Array<T> &array) {
- assert(idx >= 0 && (uint)idx <= _size);
+ void insert_at(size_type idx, const Array<T> &array) {
+ assert(idx <= _size);
insert_aux(_storage + idx, array.begin(), array.end());
}
- T remove_at(int idx) {
- assert(idx >= 0 && (uint)idx < _size);
+ T remove_at(size_type idx) {
+ assert(idx < _size);
T tmp = _storage[idx];
copy(_storage + idx + 1, _storage + _size, _storage + idx);
_size--;
@@ -151,17 +153,17 @@ public:
// TODO: insert, remove, ...
- T& operator[](int idx) {
- assert(idx >= 0 && (uint)idx < _size);
+ T &operator[](size_type idx) {
+ assert(idx < _size);
return _storage[idx];
}
- const T& operator[](int idx) const {
- assert(idx >= 0 && (uint)idx < _size);
+ const T &operator[](size_type idx) const {
+ assert(idx < _size);
return _storage[idx];
}
- Array<T>& operator=(const Array<T> &array) {
+ Array<T> &operator=(const Array<T> &array) {
if (this == &array)
return *this;
@@ -173,7 +175,7 @@ public:
return *this;
}
- uint size() const {
+ size_type size() const {
return _size;
}
@@ -193,34 +195,34 @@ public:
return true;
if (_size != other._size)
return false;
- for (uint i = 0; i < _size; ++i) {
+ for (size_type i = 0; i < _size; ++i) {
if (_storage[i] != other._storage[i])
return false;
}
return true;
}
+
bool operator!=(const Array<T> &other) const {
return !(*this == other);
}
-
- iterator begin() {
+ iterator begin() {
return _storage;
}
- iterator end() {
+ iterator end() {
return _storage + _size;
}
- const_iterator begin() const {
+ const_iterator begin() const {
return _storage;
}
- const_iterator end() const {
+ const_iterator end() const {
return _storage + _size;
}
- void reserve(uint newCapacity) {
+ void reserve(size_type newCapacity) {
if (newCapacity <= _capacity)
return;
@@ -234,9 +236,9 @@ public:
}
}
- void resize(uint newSize) {
+ void resize(size_type newSize) {
reserve(newSize);
- for (uint i = _size; i < newSize; ++i)
+ for (size_type i = _size; i < newSize; ++i)
new ((void *)&_storage[i]) T();
_size = newSize;
}
@@ -249,28 +251,28 @@ public:
}
protected:
- static uint roundUpCapacity(uint capacity) {
+ static size_type roundUpCapacity(size_type capacity) {
// Round up capacity to the next power of 2;
// we use a minimal capacity of 8.
- uint capa = 8;
+ size_type capa = 8;
while (capa < capacity)
capa <<= 1;
return capa;
}
- void allocCapacity(uint capacity) {
+ void allocCapacity(size_type capacity) {
_capacity = capacity;
if (capacity) {
_storage = (T *)malloc(sizeof(T) * capacity);
if (!_storage)
- ::error("Common::Array: failure to allocate %u bytes", capacity * (uint)sizeof(T));
+ ::error("Common::Array: failure to allocate %u bytes", capacity * (size_type)sizeof(T));
} else {
_storage = 0;
}
}
- void freeStorage(T *storage, const uint elements) {
- for (uint i = 0; i < elements; ++i)
+ void freeStorage(T *storage, const size_type elements) {
+ for (size_type i = 0; i < elements; ++i)
storage[i].~T();
free(storage);
}
@@ -291,9 +293,9 @@ protected:
iterator insert_aux(iterator pos, const_iterator first, const_iterator last) {
assert(_storage <= pos && pos <= _storage + _size);
assert(first <= last);
- const uint n = last - first;
+ const size_type n = last - first;
if (n) {
- const uint idx = pos - _storage;
+ const size_type idx = pos - _storage;
if (_size + n > _capacity || (_storage <= first && first <= _storage + _size)) {
T *const oldStorage = _storage;
diff --git a/common/config-file.cpp b/common/config-file.cpp
index 81e0ae6b45..4224d7491d 100644
--- a/common/config-file.cpp
+++ b/common/config-file.cpp
@@ -30,7 +30,7 @@ namespace Common {
bool ConfigFile::isValidName(const String &name) {
const char *p = name.c_str();
- while (*p && (isalnum(static_cast<unsigned char>(*p)) || *p == '-' || *p == '_' || *p == '.'))
+ while (*p && (isAlnum(*p) || *p == '-' || *p == '_' || *p == '.'))
p++;
return *p == 0;
}
@@ -108,7 +108,7 @@ bool ConfigFile::loadFromStream(SeekableReadStream &stream) {
// is, verify that it only consists of alphanumerics,
// periods, dashes and underscores). Mohawk Living Books games
// can have periods in their section names.
- while (*p && (isalnum(static_cast<unsigned char>(*p)) || *p == '-' || *p == '_' || *p == '.'))
+ while (*p && (isAlnum(*p) || *p == '-' || *p == '_' || *p == '.'))
p++;
if (*p == '\0')
@@ -131,7 +131,7 @@ bool ConfigFile::loadFromStream(SeekableReadStream &stream) {
// Skip leading whitespaces
const char *t = line.c_str();
- while (isspace(static_cast<unsigned char>(*t)))
+ while (isSpace(*t))
t++;
// Skip empty lines / lines with only whitespace
diff --git a/common/config-manager.cpp b/common/config-manager.cpp
index c62dee8bea..aaa812bc94 100644
--- a/common/config-manager.cpp
+++ b/common/config-manager.cpp
@@ -29,7 +29,7 @@
static bool isValidDomainName(const Common::String &domName) {
const char *p = domName.c_str();
- while (*p && (isalnum(static_cast<unsigned char>(*p)) || *p == '-' || *p == '_'))
+ while (*p && (Common::isAlnum(*p) || *p == '-' || *p == '_'))
p++;
return *p == 0;
}
@@ -187,7 +187,7 @@ void ConfigManager::loadFromStream(SeekableReadStream &stream) {
// Get the domain name, and check whether it's valid (that
// is, verify that it only consists of alphanumerics,
// dashes and underscores).
- while (*p && (isalnum(static_cast<unsigned char>(*p)) || *p == '-' || *p == '_'))
+ while (*p && (isAlnum(*p) || *p == '-' || *p == '_'))
p++;
if (*p == '\0')
@@ -205,7 +205,7 @@ void ConfigManager::loadFromStream(SeekableReadStream &stream) {
// Skip leading whitespaces
const char *t = line.c_str();
- while (isspace(static_cast<unsigned char>(*t)))
+ while (isSpace(*t))
t++;
// Skip empty lines / lines with only whitespace
diff --git a/common/events.h b/common/events.h
index f5ace7481b..5f6a7798dd 100644
--- a/common/events.h
+++ b/common/events.h
@@ -73,8 +73,21 @@ enum EventType {
* An associated enumerated type can accomplish this.
**/
EVENT_PREDICTIVE_DIALOG = 12
+
+#ifdef ENABLE_KEYMAPPER
+ ,
+ // IMPORTANT NOTE: This is part of the WIP Keymapper. If you plan to use
+ // this, please talk to tsoliman and/or LordHoto.
+ EVENT_CUSTOM_BACKEND = 18,
+ EVENT_KEYMAPPER_REMAP = 19
+#endif
+#ifdef ENABLE_VKEYBD
+ ,
+ EVENT_VIRTUAL_KEYBOARD = 20
+#endif
};
+typedef uint32 CustomEventType;
/**
* Data structure for an event. A pointer to an instance of Event
* can be passed to pollEvent.
@@ -99,7 +112,17 @@ struct Event {
*/
Point mouse;
- Event() : type(EVENT_INVALID), synthetic(false) {}
+#ifdef ENABLE_KEYMAPPER
+ // IMPORTANT NOTE: This is part of the WIP Keymapper. If you plan to use
+ // this, please talk to tsoliman and/or LordHoto.
+ CustomEventType customType;
+#endif
+
+ Event() : type(EVENT_INVALID), synthetic(false) {
+#ifdef ENABLE_KEYMAPPER
+ customType = 0;
+#endif
+ }
};
/**
@@ -175,7 +198,7 @@ public:
*
* An observer is supposed to eat the event, with returning true, when
* it wants to prevent other observers from receiving the event.
- * An usage example here is the keymapper:
+ * A usage example here is the keymapper:
* If it processes an Event, it should 'eat' it and create a new
* event, which the EventDispatcher will then catch.
*
@@ -199,10 +222,20 @@ public:
*
* An example for this is the Keymapper.
*/
-class EventMapper : public EventSource, public EventObserver {
+class EventMapper {
+public:
+ virtual ~EventMapper() {}
+
+ /**
+ * Map an incoming event to one or more action events
+ */
+ virtual List<Event> mapEvent(const Event &ev, EventSource *source) = 0;
+};
+
+class DefaultEventMapper : public EventMapper {
public:
- /** For event mappers resulting events should never be mapped */
- bool allowMapping() const { return false; }
+ // EventMapper interface
+ virtual List<Event> mapEvent(const Event &ev, EventSource *source);
};
/**
diff --git a/common/fft.cpp b/common/fft.cpp
index 5852698b61..034570964f 100644
--- a/common/fft.cpp
+++ b/common/fft.cpp
@@ -231,7 +231,7 @@ DECL_FFT(14, 16384, 8192, 4096)
DECL_FFT(15, 32768, 16384, 8192)
DECL_FFT(16, 65536, 32768, 16384)
-static void (* const fft_dispatch[])(Complex*) = {
+static void (* const fft_dispatch[])(Complex *) = {
fft4, fft8, fft16, fft32, fft64, fft128, fft256, fft512, fft1024,
fft2048, fft4096, fft8192, fft16384, fft32768, fft65536,
};
diff --git a/common/forbidden.h b/common/forbidden.h
index 95c1a47d65..eec80bba59 100644
--- a/common/forbidden.h
+++ b/common/forbidden.h
@@ -182,7 +182,8 @@
#define putchar(a) FORBIDDEN_SYMBOL_REPLACEMENT
#endif
-
+// mingw-w64 uses [set|long]jmp in system headers
+#ifndef __MINGW64__
#ifndef FORBIDDEN_SYMBOL_EXCEPTION_setjmp
#undef setjmp
#define setjmp(a) FORBIDDEN_SYMBOL_REPLACEMENT
@@ -192,6 +193,7 @@
#undef longjmp
#define longjmp(a,b) FORBIDDEN_SYMBOL_REPLACEMENT
#endif
+#endif // __MINGW64__
#ifndef FORBIDDEN_SYMBOL_EXCEPTION_system
#undef system
@@ -315,6 +317,49 @@
#endif // FORBIDDEN_SYMBOL_EXCEPTION_unistd_h
+
+//
+// Disable various symbols from ctype.h
+//
+#ifndef FORBIDDEN_SYMBOL_EXCEPTION_ctype_h
+
+ #ifndef FORBIDDEN_SYMBOL_EXCEPTION_isalnum
+ #undef isalnum
+ #define isalnum(a) FORBIDDEN_SYMBOL_REPLACEMENT
+ #endif
+
+ #ifndef FORBIDDEN_SYMBOL_EXCEPTION_isalpha
+ #undef isalpha
+ #define isalpha(a) FORBIDDEN_SYMBOL_REPLACEMENT
+ #endif
+
+ #ifndef FORBIDDEN_SYMBOL_EXCEPTION_isdigit
+ #undef isdigit
+ #define isdigit(a) FORBIDDEN_SYMBOL_REPLACEMENT
+ #endif
+
+ #ifndef FORBIDDEN_SYMBOL_EXCEPTION_isnumber
+ #undef isnumber
+ #define isnumber(a) FORBIDDEN_SYMBOL_REPLACEMENT
+ #endif
+
+ #ifndef FORBIDDEN_SYMBOL_EXCEPTION_islower
+ #undef islower
+ #define islower(a) FORBIDDEN_SYMBOL_REPLACEMENT
+ #endif
+
+ #ifndef FORBIDDEN_SYMBOL_EXCEPTION_isspace
+ #undef isspace
+ #define isspace(a) FORBIDDEN_SYMBOL_REPLACEMENT
+ #endif
+
+ #ifndef FORBIDDEN_SYMBOL_EXCEPTION_isupper
+ #undef isupper
+ #define isupper(a) FORBIDDEN_SYMBOL_REPLACEMENT
+ #endif
+
+#endif // FORBIDDEN_SYMBOL_EXCEPTION_ctype_h
+
#ifndef FORBIDDEN_SYMBOL_EXCEPTION_mkdir
#undef mkdir
#define mkdir(a,b) FORBIDDEN_SYMBOL_REPLACEMENT
diff --git a/common/fs.cpp b/common/fs.cpp
index 8ea96e458a..0143c936d4 100644
--- a/common/fs.cpp
+++ b/common/fs.cpp
@@ -130,10 +130,10 @@ SeekableReadStream *FSNode::createReadStream() const {
if (!_realNode->exists()) {
warning("FSNode::createReadStream: '%s' does not exist", getName().c_str());
- return false;
+ return 0;
} else if (_realNode->isDirectory()) {
warning("FSNode::createReadStream: '%s' is a directory", getName().c_str());
- return false;
+ return 0;
}
return _realNode->createReadStream();
diff --git a/common/hash-str.h b/common/hash-str.h
index 1b8a57827a..08f0558bfd 100644
--- a/common/hash-str.h
+++ b/common/hash-str.h
@@ -60,14 +60,14 @@ struct IgnoreCase_Hash {
// case insensitve hashing, then only because one wants to use
// IgnoreCase_EqualTo, and then one has to specify a custom
// hash anyway.
-template <>
+template<>
struct Hash<String> {
uint operator()(const String& s) const {
return hashit(s.c_str());
}
};
-template <>
+template<>
struct Hash<const char *> {
uint operator()(const char *s) const {
return hashit(s);
diff --git a/common/hashmap.h b/common/hashmap.h
index 347ac1fd25..7cf54997e8 100644
--- a/common/hashmap.h
+++ b/common/hashmap.h
@@ -67,7 +67,7 @@ template<class T> class IteratorImpl;
/**
* HashMap<Key,Val> maps objects of type Key to objects of type Val.
- * For each used Key type, we need an "uint hashit(Key,uint)" function
+ * For each used Key type, we need an "size_type hashit(Key,size_type)" function
* that computes a hash for the given Key object and returns it as an
* an integer from 0 to hashsize-1, and also an "equality functor".
* that returns true if if its two arguments are to be considered
@@ -80,6 +80,9 @@ template<class T> class IteratorImpl;
*/
template<class Key, class Val, class HashFunc = Hash<Key>, class EqualFunc = EqualTo<Key> >
class HashMap {
+public:
+ typedef uint size_type;
+
private:
typedef HashMap<Key, Val, HashFunc, EqualFunc> HM_t;
@@ -111,9 +114,9 @@ private:
#endif
Node **_storage; ///< hashtable of size arrsize.
- uint _mask; ///< Capacity of the HashMap minus one; must be a power of two of minus one
- uint _size;
- uint _deleted; ///< Number of deleted elements (_dummyNodes)
+ size_type _mask; ///< Capacity of the HashMap minus one; must be a power of two of minus one
+ size_type _size;
+ size_type _deleted; ///< Number of deleted elements (_dummyNodes)
HashFunc _hash;
EqualFunc _equal;
@@ -146,9 +149,9 @@ private:
}
void assign(const HM_t &map);
- uint lookup(const Key &key) const;
- uint lookupAndCreateIfMissing(const Key &key);
- void expandStorage(uint newCapacity);
+ size_type lookup(const Key &key) const;
+ size_type lookupAndCreateIfMissing(const Key &key);
+ void expandStorage(size_type newCapacity);
#if !defined(__sgi) || defined(__GNUC__)
template<class T> friend class IteratorImpl;
@@ -168,11 +171,11 @@ private:
protected:
typedef const HashMap hashmap_t;
- uint _idx;
+ size_type _idx;
hashmap_t *_hashmap;
protected:
- IteratorImpl(uint idx, hashmap_t *hashmap) : _idx(idx), _hashmap(hashmap) {}
+ IteratorImpl(size_type idx, hashmap_t *hashmap) : _idx(idx), _hashmap(hashmap) {}
NodeType *deref() const {
assert(_hashmap != 0);
@@ -200,7 +203,7 @@ private:
_idx++;
} while (_idx <= _hashmap->_mask && (_hashmap->_storage[_idx] == 0 || _hashmap->_storage[_idx] == HASHMAP_DUMMY_NODE));
if (_idx > _hashmap->_mask)
- _idx = (uint)-1;
+ _idx = (size_type)-1;
return *this;
}
@@ -247,41 +250,41 @@ public:
void erase(iterator entry);
void erase(const Key &key);
- uint size() const { return _size; }
+ size_type size() const { return _size; }
iterator begin() {
// Find and return the first non-empty entry
- for (uint ctr = 0; ctr <= _mask; ++ctr) {
+ for (size_type ctr = 0; ctr <= _mask; ++ctr) {
if (_storage[ctr] && _storage[ctr] != HASHMAP_DUMMY_NODE)
return iterator(ctr, this);
}
return end();
}
iterator end() {
- return iterator((uint)-1, this);
+ return iterator((size_type)-1, this);
}
const_iterator begin() const {
// Find and return the first non-empty entry
- for (uint ctr = 0; ctr <= _mask; ++ctr) {
+ for (size_type ctr = 0; ctr <= _mask; ++ctr) {
if (_storage[ctr] && _storage[ctr] != HASHMAP_DUMMY_NODE)
return const_iterator(ctr, this);
}
return end();
}
const_iterator end() const {
- return const_iterator((uint)-1, this);
+ return const_iterator((size_type)-1, this);
}
iterator find(const Key &key) {
- uint ctr = lookup(key);
+ size_type ctr = lookup(key);
if (_storage[ctr])
return iterator(ctr, this);
return end();
}
const_iterator find(const Key &key) const {
- uint ctr = lookup(key);
+ size_type ctr = lookup(key);
if (_storage[ctr])
return const_iterator(ctr, this);
return end();
@@ -346,7 +349,7 @@ HashMap<Key, Val, HashFunc, EqualFunc>::HashMap(const HM_t &map) :
*/
template<class Key, class Val, class HashFunc, class EqualFunc>
HashMap<Key, Val, HashFunc, EqualFunc>::~HashMap() {
- for (uint ctr = 0; ctr <= _mask; ++ctr)
+ for (size_type ctr = 0; ctr <= _mask; ++ctr)
freeNode(_storage[ctr]);
delete[] _storage;
@@ -373,7 +376,7 @@ void HashMap<Key, Val, HashFunc, EqualFunc>::assign(const HM_t &map) {
// Simply clone the map given to us, one by one.
_size = 0;
_deleted = 0;
- for (uint ctr = 0; ctr <= _mask; ++ctr) {
+ for (size_type ctr = 0; ctr <= _mask; ++ctr) {
if (map._storage[ctr] == HASHMAP_DUMMY_NODE) {
_storage[ctr] = HASHMAP_DUMMY_NODE;
_deleted++;
@@ -391,7 +394,7 @@ void HashMap<Key, Val, HashFunc, EqualFunc>::assign(const HM_t &map) {
template<class Key, class Val, class HashFunc, class EqualFunc>
void HashMap<Key, Val, HashFunc, EqualFunc>::clear(bool shrinkArray) {
- for (uint ctr = 0; ctr <= _mask; ++ctr) {
+ for (size_type ctr = 0; ctr <= _mask; ++ctr) {
freeNode(_storage[ctr]);
_storage[ctr] = NULL;
}
@@ -414,13 +417,13 @@ void HashMap<Key, Val, HashFunc, EqualFunc>::clear(bool shrinkArray) {
}
template<class Key, class Val, class HashFunc, class EqualFunc>
-void HashMap<Key, Val, HashFunc, EqualFunc>::expandStorage(uint newCapacity) {
+void HashMap<Key, Val, HashFunc, EqualFunc>::expandStorage(size_type newCapacity) {
assert(newCapacity > _mask+1);
#ifndef NDEBUG
- const uint old_size = _size;
+ const size_type old_size = _size;
#endif
- const uint old_mask = _mask;
+ const size_type old_mask = _mask;
Node **old_storage = _storage;
// allocate a new array
@@ -432,7 +435,7 @@ void HashMap<Key, Val, HashFunc, EqualFunc>::expandStorage(uint newCapacity) {
memset(_storage, 0, newCapacity * sizeof(Node *));
// rehash all the old elements
- for (uint ctr = 0; ctr <= old_mask; ++ctr) {
+ for (size_type ctr = 0; ctr <= old_mask; ++ctr) {
if (old_storage[ctr] == NULL || old_storage[ctr] == HASHMAP_DUMMY_NODE)
continue;
@@ -440,9 +443,9 @@ void HashMap<Key, Val, HashFunc, EqualFunc>::expandStorage(uint newCapacity) {
// Since we know that no key exists twice in the old table, we
// can do this slightly better than by calling lookup, since we
// don't have to call _equal().
- const uint hash = _hash(old_storage[ctr]->_key);
- uint idx = hash & _mask;
- for (uint perturb = hash; _storage[idx] != NULL && _storage[idx] != HASHMAP_DUMMY_NODE; perturb >>= HASHMAP_PERTURB_SHIFT) {
+ const size_type hash = _hash(old_storage[ctr]->_key);
+ size_type idx = hash & _mask;
+ for (size_type perturb = hash; _storage[idx] != NULL && _storage[idx] != HASHMAP_DUMMY_NODE; perturb >>= HASHMAP_PERTURB_SHIFT) {
idx = (5 * idx + perturb + 1) & _mask;
}
@@ -460,10 +463,10 @@ void HashMap<Key, Val, HashFunc, EqualFunc>::expandStorage(uint newCapacity) {
}
template<class Key, class Val, class HashFunc, class EqualFunc>
-uint HashMap<Key, Val, HashFunc, EqualFunc>::lookup(const Key &key) const {
- const uint hash = _hash(key);
- uint ctr = hash & _mask;
- for (uint perturb = hash; ; perturb >>= HASHMAP_PERTURB_SHIFT) {
+typename HashMap<Key, Val, HashFunc, EqualFunc>::size_type HashMap<Key, Val, HashFunc, EqualFunc>::lookup(const Key &key) const {
+ const size_type hash = _hash(key);
+ size_type ctr = hash & _mask;
+ for (size_type perturb = hash; ; perturb >>= HASHMAP_PERTURB_SHIFT) {
if (_storage[ctr] == NULL)
break;
if (_storage[ctr] == HASHMAP_DUMMY_NODE) {
@@ -491,13 +494,13 @@ uint HashMap<Key, Val, HashFunc, EqualFunc>::lookup(const Key &key) const {
}
template<class Key, class Val, class HashFunc, class EqualFunc>
-uint HashMap<Key, Val, HashFunc, EqualFunc>::lookupAndCreateIfMissing(const Key &key) {
- const uint hash = _hash(key);
- uint ctr = hash & _mask;
- const uint NONE_FOUND = _mask + 1;
- uint first_free = NONE_FOUND;
+typename HashMap<Key, Val, HashFunc, EqualFunc>::size_type HashMap<Key, Val, HashFunc, EqualFunc>::lookupAndCreateIfMissing(const Key &key) {
+ const size_type hash = _hash(key);
+ size_type ctr = hash & _mask;
+ const size_type NONE_FOUND = _mask + 1;
+ size_type first_free = NONE_FOUND;
bool found = false;
- for (uint perturb = hash; ; perturb >>= HASHMAP_PERTURB_SHIFT) {
+ for (size_type perturb = hash; ; perturb >>= HASHMAP_PERTURB_SHIFT) {
if (_storage[ctr] == NULL)
break;
if (_storage[ctr] == HASHMAP_DUMMY_NODE) {
@@ -537,7 +540,7 @@ uint HashMap<Key, Val, HashFunc, EqualFunc>::lookupAndCreateIfMissing(const Key
// Keep the load factor below a certain threshold.
// Deleted nodes are also counted
- uint capacity = _mask + 1;
+ size_type capacity = _mask + 1;
if ((_size + _deleted) * HASHMAP_LOADFACTOR_DENOMINATOR >
capacity * HASHMAP_LOADFACTOR_NUMERATOR) {
capacity = capacity < 500 ? (capacity * 4) : (capacity * 2);
@@ -553,7 +556,7 @@ uint HashMap<Key, Val, HashFunc, EqualFunc>::lookupAndCreateIfMissing(const Key
template<class Key, class Val, class HashFunc, class EqualFunc>
bool HashMap<Key, Val, HashFunc, EqualFunc>::contains(const Key &key) const {
- uint ctr = lookup(key);
+ size_type ctr = lookup(key);
return (_storage[ctr] != NULL);
}
@@ -569,7 +572,7 @@ const Val &HashMap<Key, Val, HashFunc, EqualFunc>::operator[](const Key &key) co
template<class Key, class Val, class HashFunc, class EqualFunc>
Val &HashMap<Key, Val, HashFunc, EqualFunc>::getVal(const Key &key) {
- uint ctr = lookupAndCreateIfMissing(key);
+ size_type ctr = lookupAndCreateIfMissing(key);
assert(_storage[ctr] != NULL);
return _storage[ctr]->_value;
}
@@ -581,7 +584,7 @@ const Val &HashMap<Key, Val, HashFunc, EqualFunc>::getVal(const Key &key) const
template<class Key, class Val, class HashFunc, class EqualFunc>
const Val &HashMap<Key, Val, HashFunc, EqualFunc>::getVal(const Key &key, const Val &defaultVal) const {
- uint ctr = lookup(key);
+ size_type ctr = lookup(key);
if (_storage[ctr] != NULL)
return _storage[ctr]->_value;
else
@@ -590,7 +593,7 @@ const Val &HashMap<Key, Val, HashFunc, EqualFunc>::getVal(const Key &key, const
template<class Key, class Val, class HashFunc, class EqualFunc>
void HashMap<Key, Val, HashFunc, EqualFunc>::setVal(const Key &key, const Val &val) {
- uint ctr = lookupAndCreateIfMissing(key);
+ size_type ctr = lookupAndCreateIfMissing(key);
assert(_storage[ctr] != NULL);
_storage[ctr]->_value = val;
}
@@ -599,7 +602,7 @@ template<class Key, class Val, class HashFunc, class EqualFunc>
void HashMap<Key, Val, HashFunc, EqualFunc>::erase(iterator entry) {
// Check whether we have a valid iterator
assert(entry._hashmap == this);
- const uint ctr = entry._idx;
+ const size_type ctr = entry._idx;
assert(ctr <= _mask);
Node * const node = _storage[ctr];
assert(node != NULL);
@@ -615,7 +618,7 @@ void HashMap<Key, Val, HashFunc, EqualFunc>::erase(iterator entry) {
template<class Key, class Val, class HashFunc, class EqualFunc>
void HashMap<Key, Val, HashFunc, EqualFunc>::erase(const Key &key) {
- uint ctr = lookup(key);
+ size_type ctr = lookup(key);
if (_storage[ctr] == NULL)
return;
diff --git a/common/huffman.h b/common/huffman.h
index 4175d0d309..3b23340b2e 100644
--- a/common/huffman.h
+++ b/common/huffman.h
@@ -68,7 +68,7 @@ private:
typedef List<Symbol> CodeList;
typedef Array<CodeList> CodeLists;
- typedef Array<Symbol*> SymbolList;
+ typedef Array<Symbol *> SymbolList;
/** Lists of codes and their symbols, sorted by code length. */
CodeLists _codes;
diff --git a/common/list.h b/common/list.h
index a1e761f55d..9792042239 100644
--- a/common/list.h
+++ b/common/list.h
@@ -43,6 +43,7 @@ public:
typedef ListInternal::ConstIterator<t_T> const_iterator;
typedef t_T value_type;
+ typedef uint size_type;
public:
List() {
@@ -181,8 +182,8 @@ public:
return *this;
}
- uint size() const {
- uint n = 0;
+ size_type size() const {
+ size_type n = 0;
for (const NodeBase *cur = _anchor._next; cur != &_anchor; cur = cur->_next)
++n;
return n;
@@ -226,7 +227,7 @@ public:
}
const_iterator end() const {
- return const_iterator(const_cast<NodeBase*>(&_anchor));
+ return const_iterator(const_cast<NodeBase *>(&_anchor));
}
protected:
diff --git a/common/list_intern.h b/common/list_intern.h
index daa7446781..fef32fbe1e 100644
--- a/common/list_intern.h
+++ b/common/list_intern.h
@@ -35,7 +35,7 @@ namespace ListInternal {
NodeBase *_next;
};
- template <typename T>
+ template<typename T>
struct Node : public NodeBase {
T _data;
diff --git a/common/memorypool.cpp b/common/memorypool.cpp
index 19adc54d00..e3742eeae0 100644
--- a/common/memorypool.cpp
+++ b/common/memorypool.cpp
@@ -33,7 +33,7 @@ static size_t adjustChunkSize(size_t chunkSize) {
// You must at least fit the pointer in the node (technically unneeded considering the next rounding statement)
chunkSize = MAX(chunkSize, sizeof(void *));
// There might be an alignment problem on some platforms when trying to load a void* on a non natural boundary
- // so we round to the next sizeof(void*)
+ // so we round to the next sizeof(void *)
chunkSize = (chunkSize + sizeof(void *) - 1) & (~(sizeof(void *) - 1));
return chunkSize;
diff --git a/common/memorypool.h b/common/memorypool.h
index 5ba09cebed..9a4e523d53 100644
--- a/common/memorypool.h
+++ b/common/memorypool.h
@@ -105,7 +105,7 @@ template<size_t CHUNK_SIZE, size_t NUM_INTERNAL_CHUNKS = 32>
class FixedSizeMemoryPool : public MemoryPool {
private:
enum {
- REAL_CHUNK_SIZE = (CHUNK_SIZE + sizeof(void*) - 1) & (~(sizeof(void*) - 1))
+ REAL_CHUNK_SIZE = (CHUNK_SIZE + sizeof(void *) - 1) & (~(sizeof(void *) - 1))
};
byte _storage[NUM_INTERNAL_CHUNKS * REAL_CHUNK_SIZE];
diff --git a/common/module.mk b/common/module.mk
index 7434df7052..ae5e41cb8c 100644
--- a/common/module.mk
+++ b/common/module.mk
@@ -8,6 +8,7 @@ MODULE_OBJS := \
debug.o \
error.o \
EventDispatcher.o \
+ EventMapper.o \
EventRecorder.o \
file.o \
fs.o \
diff --git a/common/quicktime.h b/common/quicktime.h
index d7e2691c2b..efd2adbd21 100644
--- a/common/quicktime.h
+++ b/common/quicktime.h
@@ -155,7 +155,7 @@ protected:
uint16 height;
CodecType codecType;
- Array<SampleDesc*> sampleDescs;
+ Array<SampleDesc *> sampleDescs;
uint32 editCount;
EditListEntry *editList;
@@ -180,7 +180,7 @@ protected:
uint32 _duration;
Rational _scaleFactorX;
Rational _scaleFactorY;
- Array<Track*> _tracks;
+ Array<Track *> _tracks;
uint32 _beginOffset;
MacResManager *_resFork;
diff --git a/common/serializer.h b/common/serializer.h
index 5b08a9a9fa..4d97c9e930 100644
--- a/common/serializer.h
+++ b/common/serializer.h
@@ -30,7 +30,7 @@ namespace Common {
#define SYNC_AS(SUFFIX,TYPE,SIZE) \
- template <typename T> \
+ template<typename T> \
void syncAs ## SUFFIX(T &val, Version minVersion = 0, Version maxVersion = kLastVersion) { \
if (_version < minVersion || _version > maxVersion) \
return; \
diff --git a/common/singleton.h b/common/singleton.h
index 43f1c0c4d0..a4f106c9d3 100644
--- a/common/singleton.h
+++ b/common/singleton.h
@@ -43,7 +43,7 @@ private:
* singleton class might be pure virtual (or "abstract" in Java terminology),
* and you specialise makeInstance to return an instance of a subclass.
*/
- //template <class T>
+ //template<class T>
#if defined (_WIN32_WCE) || defined (_MSC_VER) || defined (__WINS__)
//FIXME evc4 and msvc7 doesn't like it as private member
public:
diff --git a/common/stack.h b/common/stack.h
index 0d13049f2e..bc5de9ac7f 100644
--- a/common/stack.h
+++ b/common/stack.h
@@ -30,48 +30,59 @@ namespace Common {
/**
* Extremly simple fixed size stack class.
*/
-template<class T, int MAX_SIZE = 10>
+template<class T, uint MAX_SIZE = 10>
class FixedStack {
-protected:
- T _stack[MAX_SIZE];
- int _size;
public:
+ typedef uint size_type;
+
FixedStack<T, MAX_SIZE>() : _size(0) {}
bool empty() const {
return _size <= 0;
}
+
void clear() {
_size = 0;
}
+
void push(const T &x) {
assert(_size < MAX_SIZE);
_stack[_size++] = x;
}
+
const T &top() const {
assert(_size > 0);
return _stack[_size - 1];
}
+
T &top() {
assert(_size > 0);
return _stack[_size - 1];
}
+
T pop() {
T tmp = top();
--_size;
return tmp;
}
- int size() const {
+
+ size_type size() const {
return _size;
}
- T &operator[](int i) {
- assert(0 <= i && i < MAX_SIZE);
+
+ T &operator[](size_type i) {
+ assert(i < MAX_SIZE);
return _stack[i];
}
- const T &operator[](int i) const {
- assert(0 <= i && i < MAX_SIZE);
+
+ const T &operator[](size_type i) const {
+ assert(i < MAX_SIZE);
return _stack[i];
}
+
+protected:
+ T _stack[MAX_SIZE];
+ size_type _size;
};
@@ -81,39 +92,49 @@ public:
template<class T>
class Stack {
private:
- Array<T> _stack;
+ Array<T> _stack;
public:
+ typedef typename Array<T>::size_type size_type;
+
Stack<T>() {}
Stack<T>(const Array<T> &stackContent) : _stack(stackContent) {}
bool empty() const {
return _stack.empty();
}
+
void clear() {
_stack.clear();
}
+
void push(const T &x) {
_stack.push_back(x);
}
+
T &top() {
return _stack.back();
}
+
const T &top() const {
return _stack.back();
}
+
T pop() {
T tmp = _stack.back();
_stack.pop_back();
return tmp;
}
- int size() const {
+
+ size_type size() const {
return _stack.size();
}
- T &operator[](int i) {
+
+ T &operator[](size_type i) {
return _stack[i];
}
- const T &operator[](int i) const {
+
+ const T &operator[](size_type i) const {
return _stack[i];
}
};
diff --git a/common/str.cpp b/common/str.cpp
index 32f4b44e79..84805082ac 100644
--- a/common/str.cpp
+++ b/common/str.cpp
@@ -405,13 +405,13 @@ void String::trim() {
makeUnique();
// Trim trailing whitespace
- while (_size >= 1 && isspace(static_cast<unsigned char>(_str[_size - 1])))
+ while (_size >= 1 && isSpace(_str[_size - 1]))
--_size;
_str[_size] = 0;
// Trim leading whitespace
char *t = _str;
- while (isspace((unsigned char)*t))
+ while (isSpace(*t))
t++;
if (t != _str) {
@@ -606,14 +606,14 @@ String operator+(const String &x, char y) {
}
char *ltrim(char *t) {
- while (isspace(static_cast<unsigned char>(*t)))
+ while (isSpace(*t))
t++;
return t;
}
char *rtrim(char *t) {
int l = strlen(t) - 1;
- while (l >= 0 && isspace(static_cast<unsigned char>(t[l])))
+ while (l >= 0 && isSpace(t[l]))
t[l--] = 0;
return t;
}
@@ -793,7 +793,7 @@ size_t strlcpy(char *dst, const char *src, size_t size) {
}
// Move to the terminating zero of the source
- // string, we need this to determin the length
+ // string, we need this to determine the length
// of the source string.
while (*src)
++src;
@@ -841,7 +841,7 @@ size_t strlcat(char *dst, const char *src, size_t size) {
*dst = 0;
// Move to the terminating zero of the source
- // string, we need this to determin the length
+ // string, we need this to determine the length
// of the source string.
while (*src)
++src;
diff --git a/common/system.h b/common/system.h
index 413fe326a7..85a9f6a77e 100644
--- a/common/system.h
+++ b/common/system.h
@@ -51,7 +51,11 @@ class UpdateManager;
class TimerManager;
class SeekableReadStream;
class WriteStream;
+#ifdef ENABLE_KEYMAPPER
class HardwareKeySet;
+class Keymap;
+class KeymapperDefaultBindings;
+#endif
}
class AudioCDManager;
@@ -932,8 +936,11 @@ public:
return _eventManager;
}
+#ifdef ENABLE_KEYMAPPER
/**
* Register hardware keys with keymapper
+ * IMPORTANT NOTE: This is part of the WIP Keymapper. If you plan to use
+ * this, please talk to tsoliman and/or LordHoto.
*
* @return HardwareKeySet with all keys and recommended mappings
*
@@ -941,6 +948,30 @@ public:
*/
virtual Common::HardwareKeySet *getHardwareKeySet() { return 0; }
+ /**
+ * Return a platform-specific global keymap
+ * IMPORTANT NOTE: This is part of the WIP Keymapper. If you plan to use
+ * this, please talk to tsoliman and/or LordHoto.
+ *
+ * @return Keymap with actions appropriate for the platform
+ *
+ * The caller will use and delete the return object.
+ *
+ * See keymapper documentation for further reference.
+ */
+ virtual Common::Keymap *getGlobalKeymap() { return 0; }
+
+ /**
+ * Return platform-specific default keybindings
+ * IMPORTANT NOTE: This is part of the WIP Keymapper. If you plan to use
+ * this, please talk to tsoliman and/or LordHoto.
+ *
+ * @return KeymapperDefaultBindings populated with keybindings
+ *
+ * See keymapper documentation for further reference.
+ */
+ virtual Common::KeymapperDefaultBindings *getKeymapperDefaultBindings() { return 0; }
+#endif
//@}
diff --git a/common/translation.cpp b/common/translation.cpp
index 081bde987d..219fce8794 100644
--- a/common/translation.cpp
+++ b/common/translation.cpp
@@ -26,7 +26,7 @@
#undef ARRAYSIZE
#endif
-#define TRANSLATIONS_DAT_VER 2
+#define TRANSLATIONS_DAT_VER 3
#include "common/translation.h"
#include "common/config-manager.h"
@@ -45,7 +45,7 @@ bool operator<(const TLanguage &l, const TLanguage &r) {
return strcmp(l.name, r.name) < 0;
}
-TranslationManager::TranslationManager() : _currentLang(-1) {
+TranslationManager::TranslationManager() : _currentLang(-1), _charmap(0) {
loadTranslationsInfoDat();
// Set the default language
@@ -53,6 +53,7 @@ TranslationManager::TranslationManager() : _currentLang(-1) {
}
TranslationManager::~TranslationManager() {
+ delete[] _charmap;
}
int32 TranslationManager::findMatchingLanguage(const String &lang) {
@@ -289,9 +290,14 @@ void TranslationManager::loadTranslationsInfoDat() {
// Get number of translations
int nbTranslations = in.readUint16BE();
- // Skip all the block sizes
- for (int i = 0; i < nbTranslations + 2; ++i)
- in.readUint16BE();
+ // Get number of codepages
+ int nbCodepages = in.readUint16BE();
+
+ // Determine where the codepages start
+ _charmapStart = 0;
+ for (int i = 0; i < nbTranslations + 3; ++i)
+ _charmapStart += in.readUint16BE();
+ _charmapStart += in.pos();
// Read list of languages
_langs.resize(nbTranslations);
@@ -305,6 +311,14 @@ void TranslationManager::loadTranslationsInfoDat() {
_langNames[i] = String(buf, len - 1);
}
+ // Read list of codepages
+ _charmaps.resize(nbCodepages);
+ for (int i = 0; i < nbCodepages; ++i) {
+ len = in.readUint16BE();
+ in.read(buf, len);
+ _charmaps[i] = String(buf, len - 1);
+ }
+
// Read messages
int numMessages = in.readUint16BE();
_messageIds.resize(numMessages);
@@ -344,9 +358,16 @@ void TranslationManager::loadLanguageDat(int index) {
return;
}
+ // Get the number of codepages
+ int nbCodepages = in.readUint16BE();
+ if (nbCodepages != (int)_charmaps.size()) {
+ warning("The 'translations.dat' file has changed since starting ScummVM. GUI translation will not be available");
+ return;
+ }
+
// Get size of blocks to skip.
int skipSize = 0;
- for (int i = 0; i < index + 2; ++i)
+ for (int i = 0; i < index + 3; ++i)
skipSize += in.readUint16BE();
// We also need to skip the remaining block sizes
skipSize += 2 * (nbTranslations - index);
@@ -380,6 +401,29 @@ void TranslationManager::loadLanguageDat(int index) {
_currentTranslationMessages[i].msgctxt = String(buf, len - 1);
}
}
+
+ // Find the charset
+ int charmapNum = -1;
+ for (uint i = 0; i < _charmaps.size(); ++i) {
+ if (_charmaps[i].equalsIgnoreCase(_currentCharset)) {
+ charmapNum = i;
+ break;
+ }
+ }
+
+ // Setup the new charset mapping
+ if (charmapNum == -1) {
+ delete[] _charmap;
+ _charmap = 0;
+ } else {
+ if (!_charmap)
+ _charmap = new uint32[256];
+
+ in.seek(_charmapStart + charmapNum * 256 * 4, SEEK_SET);
+ for (int i = 0; i < 256; ++i)
+ _charmap[i] = in.readUint32BE();
+ }
+
}
bool TranslationManager::checkHeader(File &in) {
diff --git a/common/translation.h b/common/translation.h
index 71cf2b0981..77e2fdfc07 100644
--- a/common/translation.h
+++ b/common/translation.h
@@ -154,6 +154,21 @@ public:
String getCurrentCharset() const;
/**
+ * Returns a pointer to the current charset mapping. This mapping is a
+ * codepage encoding -> unicode mapping and always 256 entries long.
+ *
+ * The MSB of the individual mapped (i.e. unicode) character states
+ * whether the character is required for this charset. If it is set, the
+ * character needs to be present in order to have the text displayed.
+ * This is used in the font loading code to detect whether the font is
+ * able of supporting this language.
+ *
+ * The return value might be 0 in case it's a default ASCII/ISO-8859-1
+ * map.
+ */
+ const uint32 *getCharsetMapping() const { return _charmap; }
+
+ /**
* Returns currently selected translation language
*/
String getCurrentLanguage() const;
@@ -200,11 +215,15 @@ private:
StringArray _langs;
StringArray _langNames;
+ StringArray _charmaps;
StringArray _messageIds;
Array<PoMessageEntry> _currentTranslationMessages;
String _currentCharset;
int _currentLang;
+
+ uint32 _charmapStart;
+ uint32 *_charmap;
};
} // End of namespace Common
diff --git a/common/unzip.cpp b/common/unzip.cpp
index 8061f712d4..8cfcd605fa 100644
--- a/common/unzip.cpp
+++ b/common/unzip.cpp
@@ -111,7 +111,7 @@ typedef struct {
#if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP)
/* like the STRICT of WIN32, we define a pointer that cannot be converted
- from (void*) without cast */
+ from (void *) without cast */
typedef struct TagunzFile__ { int unused; } unzFile__;
typedef unzFile__ *unzFile;
#else
@@ -1062,7 +1062,7 @@ int unzOpenCurrentFile (unzFile file) {
if (pfile_in_zip_read_info==NULL)
return UNZ_INTERNALERROR;
- pfile_in_zip_read_info->read_buffer=(char*)malloc(UNZ_BUFSIZE);
+ pfile_in_zip_read_info->read_buffer=(char *)malloc(UNZ_BUFSIZE);
pfile_in_zip_read_info->offset_local_extrafield = offset_local_extrafield;
pfile_in_zip_read_info->size_local_extrafield = size_local_extrafield;
pfile_in_zip_read_info->pos_local_extrafield=0;
@@ -1151,7 +1151,7 @@ int unzReadCurrentFile(unzFile file, voidp buf, unsigned len) {
if (len==0)
return 0;
- pfile_in_zip_read_info->stream.next_out = (Bytef*)buf;
+ pfile_in_zip_read_info->stream.next_out = (Bytef *)buf;
pfile_in_zip_read_info->stream.avail_out = (uInt)len;
@@ -1177,7 +1177,7 @@ int unzReadCurrentFile(unzFile file, voidp buf, unsigned len) {
pfile_in_zip_read_info->rest_read_compressed-=uReadThis;
- pfile_in_zip_read_info->stream.next_in = (Bytef*)pfile_in_zip_read_info->read_buffer;
+ pfile_in_zip_read_info->stream.next_in = (Bytef *)pfile_in_zip_read_info->read_buffer;
pfile_in_zip_read_info->stream.avail_in = (uInt)uReadThis;
}
diff --git a/common/util.cpp b/common/util.cpp
index 1c4df8b6cd..05d29fac94 100644
--- a/common/util.cpp
+++ b/common/util.cpp
@@ -19,6 +19,15 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+#define FORBIDDEN_SYMBOL_EXCEPTION_isalnum
+#define FORBIDDEN_SYMBOL_EXCEPTION_isalpha
+#define FORBIDDEN_SYMBOL_EXCEPTION_isdigit
+#define FORBIDDEN_SYMBOL_EXCEPTION_isnumber
+#define FORBIDDEN_SYMBOL_EXCEPTION_islower
+#define FORBIDDEN_SYMBOL_EXCEPTION_isspace
+#define FORBIDDEN_SYMBOL_EXCEPTION_isupper
+
+
#include "common/util.h"
#include "common/translation.h"
#include "common/config-manager.h"
@@ -277,7 +286,10 @@ const RenderModeDescription g_renderModes[] = {
{ "hercAmber", _s("Hercules Amber"), kRenderHercA },
{ "cga", "CGA", kRenderCGA },
{ "ega", "EGA", kRenderEGA },
+ { "vga", "VGA", kRenderVGA },
{ "amiga", "Amiga", kRenderAmiga },
+ { "fmtowns", "FM-Towns", kRenderFMTowns },
+ { "pc98", "PC-98", kRenderPC98 },
{0, 0, kRenderDefault}
};
@@ -342,6 +354,15 @@ const struct GameOpt {
{ GUIO_NOASPECT, "noAspect" },
{ GUIO_EGAUNDITHER, "egaUndither" },
+ { GUIO_RENDERHERCGREEN, "hercGreen" },
+ { GUIO_RENDERHERCAMBER, "hercAmber" },
+ { GUIO_RENDERCGA, "cga" },
+ { GUIO_RENDEREGA, "ega" },
+ { GUIO_RENDERVGA, "vga" },
+ { GUIO_RENDERAMIGA, "amiga" },
+ { GUIO_RENDERFMTOWNS, "fmtowns" },
+ { GUIO_RENDERPC98, "pc98" },
+
{ GUIO_NONE, 0 }
};
@@ -406,4 +427,38 @@ void updateGameGUIOptions(const String &options, const String &langOption) {
}
}
+#define ENSURE_ASCII_CHAR(c) \
+ if (c < 0 || c > 127) \
+ return false
+
+bool isAlnum(int c) {
+ ENSURE_ASCII_CHAR(c);
+ return isalnum((byte)c);
+}
+
+bool isAlpha(int c) {
+ ENSURE_ASCII_CHAR(c);
+ return isalpha((byte)c);
+}
+
+bool isDigit(int c) {
+ ENSURE_ASCII_CHAR(c);
+ return isdigit((byte)c);
+}
+
+bool isLower(int c) {
+ ENSURE_ASCII_CHAR(c);
+ return islower((byte)c);
+}
+
+bool isSpace(int c) {
+ ENSURE_ASCII_CHAR(c);
+ return isspace((byte)c);
+}
+
+bool isUpper(int c) {
+ ENSURE_ASCII_CHAR(c);
+ return isupper((byte)c);
+}
+
} // End of namespace Common
diff --git a/common/util.h b/common/util.h
index dfa57d7259..b6f63702d4 100644
--- a/common/util.h
+++ b/common/util.h
@@ -101,12 +101,22 @@ template<typename T> inline void SWAP(T &a, T &b) { T tmp = a; a = b; b = tmp; }
#define GUIO_NOASPECT "\022"
#define GUIO_EGAUNDITHER "\023"
+#define GUIO_RENDERHERCGREEN "\030"
+#define GUIO_RENDERHERCAMBER "\031"
+#define GUIO_RENDERCGA "\032"
+#define GUIO_RENDEREGA "\033"
+#define GUIO_RENDERVGA "\034"
+#define GUIO_RENDERAMIGA "\035"
+#define GUIO_RENDERFMTOWNS "\036"
+#define GUIO_RENDERPC98 "\037"
+
#define GUIO0() (GUIO_NONE)
#define GUIO1(a) (a)
#define GUIO2(a,b) (a b)
#define GUIO3(a,b,c) (a b c)
#define GUIO4(a,b,c,d) (a b c d)
#define GUIO5(a,b,c,d,e) (a b c d e)
+#define GUIO6(a,b,c,d,e,f) (a b c d e f)
namespace Common {
@@ -133,6 +143,70 @@ extern void hexdump(const byte * data, int len, int bytesPerLine = 16, int start
*/
bool parseBool(const String &val, bool &valAsBool);
+
+/**
+ * Test whether the given character is alphanumeric (a-z, A-Z, 0-9).
+ * If the parameter is outside the range of a signed or unsigned char, then
+ * false is returned.
+ *
+ * @param c the character to test
+ * @return true if the character is alphanumeric, false otherwise.
+ */
+bool isAlnum(int c);
+
+/**
+ * Test whether the given character is an alphabetic letter (a-z, A-Z).
+ * If the parameter is outside the range of a signed or unsigned char, then
+ * false is returned.
+ *
+ * @param c the character to test
+ * @return true if the character is TODO, false otherwise.
+ */
+bool isAlpha(int c);
+
+/**
+ * Test whether the given character is a decimal-digit (0-9).
+ * If the parameter is outside the range of a signed or unsigned char, then
+ * false is returned.
+ *
+ * @param c the character to test
+ * @return true if the character is a decimal-digit, false otherwise.
+ */
+bool isDigit(int c);
+
+/**
+ * Test whether the given character is a lower-case letter (a-z).
+ * If the parameter is outside the range of a signed or unsigned char, then
+ * false is returned.
+ *
+ * @param c the character to test
+ * @return true if the character is a lower-case letter, false otherwise.
+ */
+bool isLower(int c);
+
+/**
+ * Test whether the given character is a white-space.
+ * White-space characters are ' ', '\t', '\r', '\n', '\v', '\f'.
+ *
+ * If the parameter is outside the range of a signed or unsigned char, then
+ * false is returned.
+ *
+ * @param c the character to test
+ * @return true if the character is a white-space, false otherwise.
+ */
+bool isSpace(int c);
+
+/**
+ * Test whether the given character is an upper-case letter (A-Z).
+ * If the parameter is outside the range of a signed or unsigned char, then
+ * false is returned.
+ *
+ * @param c the character to test
+ * @return true if the character is an upper-case letter, false otherwise.
+ */
+bool isUpper(int c);
+
+
/**
* List of game language.
*/
@@ -235,11 +309,14 @@ extern const char *getPlatformDescription(Platform id);
*/
enum RenderMode {
kRenderDefault = 0,
- kRenderEGA = 1,
- kRenderCGA = 2,
- kRenderHercG = 3,
- kRenderHercA = 4,
- kRenderAmiga = 5
+ kRenderVGA = 1,
+ kRenderEGA = 2,
+ kRenderCGA = 3,
+ kRenderHercG = 4,
+ kRenderHercA = 5,
+ kRenderAmiga = 6,
+ kRenderFMTowns = 7,
+ kRenderPC98 = 8
};
struct RenderModeDescription {
diff --git a/common/xmlparser.cpp b/common/xmlparser.cpp
index f768e44382..ea3d44cf87 100644
--- a/common/xmlparser.cpp
+++ b/common/xmlparser.cpp
@@ -39,7 +39,7 @@ XMLParser::~XMLParser() {
delete _XMLkeys;
delete _stream;
- for (List<XMLKeyLayout*>::iterator i = _layoutList.begin();
+ for (List<XMLKeyLayout *>::iterator i = _layoutList.begin();
i != _layoutList.end(); ++i)
delete *i;
@@ -263,7 +263,7 @@ bool XMLParser::vparseIntegerKey(const char *key, int count, va_list args) {
int *num_ptr;
while (count--) {
- while (isspace(static_cast<unsigned char>(*key)))
+ while (isSpace(*key))
key++;
num_ptr = va_arg(args, int*);
@@ -271,7 +271,7 @@ bool XMLParser::vparseIntegerKey(const char *key, int count, va_list args) {
key = parseEnd;
- while (isspace(static_cast<unsigned char>(*key)))
+ while (isSpace(*key))
key++;
if (count && *key++ != ',')
@@ -463,10 +463,10 @@ bool XMLParser::parse() {
}
bool XMLParser::skipSpaces() {
- if (!isspace(static_cast<unsigned char>(_char)))
+ if (!isSpace(_char))
return false;
- while (_char && isspace(static_cast<unsigned char>(_char)))
+ while (_char && isSpace(_char))
_char = _stream->readByte();
return true;
@@ -516,7 +516,7 @@ bool XMLParser::parseToken() {
_char = _stream->readByte();
}
- return isspace(static_cast<unsigned char>(_char)) != 0 || _char == '>' || _char == '=' || _char == '/';
+ return isSpace(_char) != 0 || _char == '>' || _char == '=' || _char == '/';
}
} // End of namespace Common
diff --git a/common/xmlparser.h b/common/xmlparser.h
index 93433b7132..1e474b596c 100644
--- a/common/xmlparser.h
+++ b/common/xmlparser.h
@@ -68,9 +68,9 @@ class SeekableReadStream;
struct CustomXMLKeyLayout : public XMLKeyLayout {\
typedef bool (parserName::*ParserCallback)(ParserNode *node);\
ParserCallback callback;\
- bool doCallback(XMLParser *parent, ParserNode *node) {return ((kLocalParserName*)parent->*callback)(node);} };\
+ bool doCallback(XMLParser *parent, ParserNode *node) {return ((kLocalParserName *)parent->*callback)(node);} };\
virtual void buildLayout() { \
- Common::Stack<XMLKeyLayout*> layout; \
+ Common::Stack<XMLKeyLayout *> layout; \
CustomXMLKeyLayout *lay = 0; \
XMLKeyLayout::XMLKeyProperty prop; \
_XMLkeys = new CustomXMLKeyLayout; \
@@ -295,7 +295,7 @@ protected:
* in their name.
*/
virtual inline bool isValidNameChar(char c) {
- return isalnum(static_cast<unsigned char>(c)) || c == '_';
+ return isAlnum(c) || c == '_';
}
/**
@@ -334,7 +334,7 @@ protected:
*/
virtual void cleanup() {}
- List<XMLKeyLayout*> _layoutList;
+ List<XMLKeyLayout *> _layoutList;
private:
char _char;
@@ -346,7 +346,7 @@ private:
String _error; /** Current error message */
String _token; /** Current text token */
- Stack<ParserNode*> _activeKey; /** Node stack of the parsed keys */
+ Stack<ParserNode *> _activeKey; /** Node stack of the parsed keys */
};
} // End of namespace Common
diff --git a/common/zlib.cpp b/common/zlib.cpp
index 70133fea30..7d765fc539 100644
--- a/common/zlib.cpp
+++ b/common/zlib.cpp
@@ -49,7 +49,7 @@ bool uncompress(byte *dst, unsigned long *dstLen, const byte *src, unsigned long
return Z_OK == ::uncompress(dst, dstLen, src, srcLen);
}
-bool inflateZlibHeaderless(byte *dst, uint dstLen, const byte *src, uint srcLen) {
+bool inflateZlibHeaderless(byte *dst, uint dstLen, const byte *src, uint srcLen, const byte *dict, uint dictLen) {
if (!dst || !dstLen || !src || !srcLen)
return false;
@@ -68,6 +68,13 @@ bool inflateZlibHeaderless(byte *dst, uint dstLen, const byte *src, uint srcLen)
if (err != Z_OK)
return false;
+ // Set the dictionary, if provided
+ if (dict != 0) {
+ err = inflateSetDictionary(&stream, const_cast<byte *>(dict), dictLen);
+ if (err != Z_OK)
+ return false;
+ }
+
err = inflate(&stream, Z_SYNC_FLUSH);
if (err != Z_OK && err != Z_STREAM_END) {
inflateEnd(&stream);
diff --git a/common/zlib.h b/common/zlib.h
index 7af7df0da8..61322c286a 100644
--- a/common/zlib.h
+++ b/common/zlib.h
@@ -37,7 +37,19 @@ class WriteStream;
* it possible to uncompress data in engines without being forced to link
* them against zlib, thus simplifying the build system.
*
- * @return true on success (i.e. Z_OK), false otherwise
+ * Taken from the zlib manual:
+ * Decompresses the src buffer into the dst buffer.
+ * srcLen is the byte length of the source buffer. Upon entry, dstLen is the
+ * total size of the destination buffer, which must be large enough to hold
+ * the entire uncompressed data. Upon exit, dstLen is the actual size of the
+ * compressed buffer.
+ *
+ * @param dst the buffer to store into.
+ * @param dstLen a pointer to the size of the destination buffer.
+ * @param src the data to be decompressed.
+ * @param srcLen the size of the compressed data.
+ *
+ * @return true on success (i.e. Z_OK), false otherwise.
*/
bool uncompress(byte *dst, unsigned long *dstLen, const byte *src, unsigned long srcLen);
@@ -46,9 +58,24 @@ bool uncompress(byte *dst, unsigned long *dstLen, const byte *src, unsigned long
* necessary inflate functions to uncompress data compressed with deflate
* but *not* with the standard zlib header.
*
- * @return true on success (Z_OK or Z_STREAM_END), false otherwise
+ * Decompresses the src buffer into the dst buffer.
+ * srcLen is the byte length of the source buffer, dstLen is the byte
+ * length of the output buffer.
+ * It decompress as much data as possible, up to dstLen bytes.
+ * If a dictionary is provided through the dict buffer, uses it to initializes
+ * the internal decompression dictionary, before the decompression takes place.
+ *
+ * @param dst the buffer to store into.
+ * @param dstLen the size of the destination buffer.
+ * @param src the data to be decompressed.
+ * @param dstLen the size of the compressed data.
+ * @param dict (optional) a decompress dictionary.
+ * @param dictLen (optional) the size of the dictionary.
+ * Mandatory if dict is not 0.
+ *
+ * @return true on success (Z_OK or Z_STREAM_END), false otherwise.
*/
-bool inflateZlibHeaderless(byte *dst, uint dstLen, const byte *src, uint srcLen);
+bool inflateZlibHeaderless(byte *dst, uint dstLen, const byte *src, uint srcLen, const byte *dict = 0, uint dictLen = 0);
#endif
diff --git a/configure b/configure
index f01c009999..27f56da6da 100755
--- a/configure
+++ b/configure
@@ -145,6 +145,7 @@ _fluidsynth=auto
_opengl=auto
_opengles=auto
_readline=auto
+_freetype2=auto
_taskbar=yes
_updates=no
_libunity=auto
@@ -188,7 +189,9 @@ _win32path="c:/scummvm"
_aos4path="Games:ScummVM"
_staticlibpath=/sw
_sdlconfig=sdl-config
+_freetypeconfig=freetype-config
_sdlpath="$PATH"
+_freetypepath="$PATH"
_nasmpath="$PATH"
NASMFLAGS=""
NASM=""
@@ -384,6 +387,40 @@ find_sdlconfig() {
}
#
+# Determine freetype-config
+#
+find_freetypeconfig() {
+ echo_n "Looking for freetype-config... "
+ freetypeconfigs="$_freetypeconfig"
+ _freetypeconfig=
+
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="$SEPARATOR"
+ for path_dir in $_freetypepath; do
+ #reset separator to parse freetypeconfigs
+ IFS=":"
+ for freetypeconfig in $freetypeconfigs; do
+ if test -f "$path_dir/$freetypeconfig" ; then
+ _freetypeconfig="$path_dir/$freetypeconfig"
+ echo $_freetypeconfig
+ # Save the prefix
+ _freetypepath=$path_dir
+ if test `basename $path_dir` = bin ; then
+ _freetypepath=`dirname $path_dir`
+ fi
+ # break at first freetype-config found in path
+ break 2
+ fi
+ done
+ done
+
+ IFS="$ac_save_ifs"
+
+ if test -z "$_freetypeconfig"; then
+ echo "none found!"
+ fi
+}
+
+#
# Determine extension used for executables
#
get_system_exe_extension() {
@@ -846,6 +883,9 @@ Optional Libraries:
--with-sdl-prefix=DIR Prefix where the sdl-config script is
installed (optional)
+ --with-freetype-prefix=DIR Prefix where the freetype-config script is
+ installed (optional)
+
--with-nasm-prefix=DIR Prefix where nasm executable is installed (optional)
--disable-nasm disable assembly language optimizations [autodetect]
@@ -905,6 +945,8 @@ for ac_option in $@; do
--disable-fluidsynth) _fluidsynth=no ;;
--enable-readline) _readline=yes ;;
--disable-readline) _readline=no ;;
+ --enable-freetype2) _freetype2=yes ;;
+ --disable-freetype2) _freetype2=no ;;
--enable-taskbar) _taskbar=yes ;;
--disable-taskbar) _taskbar=no ;;
--enable-updates) _updates=yes ;;
@@ -1042,6 +1084,10 @@ for ac_option in $@; do
arg=`echo $ac_option | cut -d '=' -f 2`
_sdlpath="$arg:$arg/bin"
;;
+ --with-freetype2-prefix=*)
+ arg=`echo $ac_option | cut -d '=' -f 2`
+ _freetypepath="$arg:$arg/bin"
+ ;;
--with-nasm-prefix=*)
arg=`echo $ac_option | cut -d '=' -f 2`
_nasmpath="$arg:$arg/bin"
@@ -1619,7 +1665,7 @@ fi;
# However, some platforms use GNU extensions in system header files, so
# for these we must not use -pedantic.
case $_host_os in
-android | gamecube | psp | wii)
+android | gamecube | psp | wii | webos)
;;
*)
# ICC does not support pedantic, while GCC and clang do.
@@ -1682,7 +1728,7 @@ esac
# Determine a data type with the given length
#
find_type_with_size() {
- for datatype in int short char long unknown; do
+ for datatype in int short char long "long long" unknown; do
cat > tmp_find_type_with_size.cpp << EOF
typedef $datatype ac__type_sizeof_;
int main() {
@@ -1706,6 +1752,35 @@ EOF
}
#
+# Check whether the system is 32-bit
+#
+pointer_is_32bit() {
+ cat > tmp_pointer_is_32bit.cpp << EOF
+int main() {
+ static int test_array[1 - 2 * !(sizeof(void *) == 4)];
+ test_array[0] = 0;
+ return 0;
+}
+EOF
+ $CXX $CXXFLAGS -c -o $TMPO.o tmp_pointer_is_32bit.cpp 2>/dev/null
+ status=$?
+ cc_check_clean tmp_pointer_is_32bit.cpp
+ return $status
+}
+
+echo_n "Checking 64-bitness... "
+pointer_is_32bit
+if test $? -eq 0; then
+ type_ptr=int32
+ echo "no"
+ add_line_to_config_h "/* #define SCUMM_64BITS */"
+else
+ type_ptr=int64
+ echo "yes"
+ add_line_to_config_h "#define SCUMM_64BITS"
+fi
+
+#
# Determine data type sizes
#
echo_n "Type with 1 byte... "
@@ -1726,6 +1801,17 @@ TMPR="$?"
echo "$type_4_byte"
test $TMPR -eq 0 || exit 1 # check exit code of subshell
+echo_n "Type with 8 bytes... "
+type_8_byte=`find_type_with_size 8`
+TMPR="$?"
+echo "$type_8_byte"
+if test $TMPR -eq 0; then
+ _def_64bit_type_signed="typedef signed $type_8_byte int64;"
+ _def_64bit_type_unsigned="typedef unsigned $type_8_byte uint64;"
+fi
+# force cleanup after check for 8 bytes type
+cc_check_clean tmp_find_type_with_size.cpp
+
#
# Check whether memory alignment is required
#
@@ -1892,7 +1978,7 @@ case $_host_os in
# Now we may have MacPorts or Fink installed
# Which put libraries and headers in non-standard places
# Checking them here
-
+
# MacPorts
# There is no way to get the prefix, so implementing a hack here
macport_version=`port version 2>/dev/null`
@@ -2048,6 +2134,7 @@ case $_host_os in
LIBS="$LIBS -lnsl -lsocket"
;;
webos)
+ CXXFLAGS="$CXXFLAGS --sysroot=$WEBOS_PDK/arm-gcc/sysroot"
CXXFLAGS="$CXXFLAGS -I$WEBOS_PDK/include"
CXXFLAGS="$CXXFLAGS -I$WEBOS_PDK/include/SDL"
CXXFLAGS="$CXXFLAGS -I$WEBOS_PDK/device/usr/include"
@@ -3372,6 +3459,50 @@ fi
echo "$_libunity"
#
+# Check for FreeType2 to be present
+#
+if test "$_freetype2" != "no"; then
+
+ # Look for the freetype-config script
+ find_freetypeconfig
+
+ if test -z "$_freetypeconfig"; then
+ _freetype2=no
+ else
+ FREETYPE2_LIBS=`$_freetypeconfig --prefix="$_freetypepath" --libs`
+ FREETYPE2_CFLAGS=`$_freetypeconfig --prefix="$_freetypepath" --cflags`
+
+ if test "$_freetype2" = "auto"; then
+ _freetype2=no
+
+ cat > $TMPC << EOF
+#include <ft2build.h>
+#include FT_FREETYPE_H
+
+int main(int argc, char *argv[]) {
+ FT_Library library;
+ FT_Error error = FT_Init_FreeType(&library);
+ FT_Done_FreeType(library);
+}
+EOF
+
+ cc_check $FREETYPE2_CFLAGS $FREETYPE2_LIBS && _freetype2=yes
+ fi
+
+ if test "$_freetype2" = "yes"; then
+ LIBS="$LIBS $FREETYPE2_LIBS"
+ INCLUDES="$INCLUDES $FREETYPE2_CFLAGS"
+ fi
+ fi
+
+fi
+
+echocheck "FreeType2"
+echo "$_freetype2"
+
+define_in_config_h_if_yes "$_freetype2" "USE_FREETYPE2"
+
+#
# Check for OpenGL (ES)
#
echocheck "OpenGL"
@@ -3852,6 +3983,25 @@ typedef unsigned $type_4_byte uint32;
typedef signed $type_1_byte int8;
typedef signed $type_2_byte int16;
typedef signed $type_4_byte int32;
+EOF
+
+if test -n "$_def_64bit_type_unsigned" ; then
+cat >> config.h << EOF
+
+/* 64-bit stuff */
+$_def_64bit_type_signed
+#if defined(__APPLE__) && !defined(__ppc__)
+#ifndef _UINT64
+#define _UINT64
+$_def_64bit_type_unsigned
+#endif
+#else
+$_def_64bit_type_unsigned
+#endif
+EOF
+fi
+
+cat >> config.h << EOF
#endif /* CONFIG_H */
EOF
diff --git a/devtools/create_kyradat/create_kyradat.cpp b/devtools/create_kyradat/create_kyradat.cpp
index 0b7d4af783..489be3e04d 100644
--- a/devtools/create_kyradat/create_kyradat.cpp
+++ b/devtools/create_kyradat/create_kyradat.cpp
@@ -45,7 +45,7 @@
#include <map>
enum {
- kKyraDatVersion = 80
+ kKyraDatVersion = 82
};
const ExtractFilename extractFilenames[] = {
@@ -445,6 +445,21 @@ const ExtractFilename extractFilenames[] = {
{ kEoB1BeholderSfx, kTypeRawData, false },
{ kEoB1TurnUndeadString, kTypeStringList, true },
+ { kEoB1CgaMappingDefault, kTypeRawData, false },
+ { kEoB1CgaMappingAlt, kTypeRawData, false },
+ { kEoB1CgaMappingInv, kTypeRawData, false },
+ { kEoB1CgaMappingItemsL, kTypeRawData, false },
+ { kEoB1CgaMappingItemsS, kTypeRawData, false },
+ { kEoB1CgaMappingThrown, kTypeRawData, false },
+ { kEoB1CgaMappingIcons, kTypeRawData, false },
+ { kEoB1CgaMappingDeco, kTypeRawData, false },
+ { kEoB1CgaLevelMappingIndex, kTypeRawData, false },
+ { kEoB1CgaMappingLevel0, kTypeRawData, false },
+ { kEoB1CgaMappingLevel1, kTypeRawData, false },
+ { kEoB1CgaMappingLevel2, kTypeRawData, false },
+ { kEoB1CgaMappingLevel3, kTypeRawData, false },
+ { kEoB1CgaMappingLevel4, kTypeRawData, false },
+
{ kEoB1NpcShpData, kTypeRawData, false },
{ kEoB1NpcSubShpIndex1, kTypeRawData, false },
{ kEoB1NpcSubShpIndex2, kTypeRawData, false },
@@ -474,50 +489,50 @@ const ExtractFilename extractFilenames[] = {
{ kEoB2IntroStrings, k2TypeSfxList, true },
{ kEoB2IntroCPSFiles, kTypeStringList, true },
- { kEoB2IntroSeqData00, kEoB2TypeSeqData, false },
- { kEoB2IntroSeqData01, kEoB2TypeSeqData, false },
- { kEoB2IntroSeqData02, kEoB2TypeSeqData, false },
- { kEoB2IntroSeqData03, kEoB2TypeSeqData, false },
- { kEoB2IntroSeqData04, kEoB2TypeSeqData, false },
- { kEoB2IntroSeqData05, kEoB2TypeSeqData, false },
- { kEoB2IntroSeqData06, kEoB2TypeSeqData, false },
- { kEoB2IntroSeqData07, kEoB2TypeSeqData, false },
- { kEoB2IntroSeqData08, kEoB2TypeSeqData, false },
- { kEoB2IntroSeqData09, kEoB2TypeSeqData, false },
- { kEoB2IntroSeqData10, kEoB2TypeSeqData, false },
- { kEoB2IntroSeqData11, kEoB2TypeSeqData, false },
- { kEoB2IntroSeqData12, kEoB2TypeSeqData, false },
- { kEoB2IntroSeqData13, kEoB2TypeSeqData, false },
- { kEoB2IntroSeqData14, kEoB2TypeSeqData, false },
- { kEoB2IntroSeqData15, kEoB2TypeSeqData, false },
- { kEoB2IntroSeqData16, kEoB2TypeSeqData, false },
- { kEoB2IntroSeqData17, kEoB2TypeSeqData, false },
- { kEoB2IntroSeqData18, kEoB2TypeSeqData, false },
- { kEoB2IntroSeqData19, kEoB2TypeSeqData, false },
- { kEoB2IntroSeqData20, kEoB2TypeSeqData, false },
- { kEoB2IntroSeqData21, kEoB2TypeSeqData, false },
- { kEoB2IntroSeqData22, kEoB2TypeSeqData, false },
- { kEoB2IntroSeqData23, kEoB2TypeSeqData, false },
- { kEoB2IntroSeqData24, kEoB2TypeSeqData, false },
- { kEoB2IntroSeqData25, kEoB2TypeSeqData, false },
- { kEoB2IntroSeqData26, kEoB2TypeSeqData, false },
- { kEoB2IntroSeqData27, kEoB2TypeSeqData, false },
- { kEoB2IntroSeqData28, kEoB2TypeSeqData, false },
- { kEoB2IntroSeqData29, kEoB2TypeSeqData, false },
- { kEoB2IntroSeqData30, kEoB2TypeSeqData, false },
- { kEoB2IntroSeqData31, kEoB2TypeSeqData, false },
- { kEoB2IntroSeqData32, kEoB2TypeSeqData, false },
- { kEoB2IntroSeqData33, kEoB2TypeSeqData, false },
- { kEoB2IntroSeqData34, kEoB2TypeSeqData, false },
- { kEoB2IntroSeqData35, kEoB2TypeSeqData, false },
- { kEoB2IntroSeqData36, kEoB2TypeSeqData, false },
- { kEoB2IntroSeqData37, kEoB2TypeSeqData, false },
- { kEoB2IntroSeqData38, kEoB2TypeSeqData, false },
- { kEoB2IntroSeqData39, kEoB2TypeSeqData, false },
- { kEoB2IntroSeqData40, kEoB2TypeSeqData, false },
- { kEoB2IntroSeqData41, kEoB2TypeSeqData, false },
- { kEoB2IntroSeqData42, kEoB2TypeSeqData, false },
- { kEoB2IntroSeqData43, kEoB2TypeSeqData, false },
+ { kEob2IntroAnimData00, kEoB2TypeSeqData, false },
+ { kEob2IntroAnimData01, kEoB2TypeSeqData, false },
+ { kEob2IntroAnimData02, kEoB2TypeSeqData, false },
+ { kEob2IntroAnimData03, kEoB2TypeSeqData, false },
+ { kEob2IntroAnimData04, kEoB2TypeSeqData, false },
+ { kEob2IntroAnimData05, kEoB2TypeSeqData, false },
+ { kEob2IntroAnimData06, kEoB2TypeSeqData, false },
+ { kEob2IntroAnimData07, kEoB2TypeSeqData, false },
+ { kEob2IntroAnimData08, kEoB2TypeSeqData, false },
+ { kEob2IntroAnimData09, kEoB2TypeSeqData, false },
+ { kEob2IntroAnimData10, kEoB2TypeSeqData, false },
+ { kEob2IntroAnimData11, kEoB2TypeSeqData, false },
+ { kEob2IntroAnimData12, kEoB2TypeSeqData, false },
+ { kEob2IntroAnimData13, kEoB2TypeSeqData, false },
+ { kEob2IntroAnimData14, kEoB2TypeSeqData, false },
+ { kEob2IntroAnimData15, kEoB2TypeSeqData, false },
+ { kEob2IntroAnimData16, kEoB2TypeSeqData, false },
+ { kEob2IntroAnimData17, kEoB2TypeSeqData, false },
+ { kEob2IntroAnimData18, kEoB2TypeSeqData, false },
+ { kEob2IntroAnimData19, kEoB2TypeSeqData, false },
+ { kEob2IntroAnimData20, kEoB2TypeSeqData, false },
+ { kEob2IntroAnimData21, kEoB2TypeSeqData, false },
+ { kEob2IntroAnimData22, kEoB2TypeSeqData, false },
+ { kEob2IntroAnimData23, kEoB2TypeSeqData, false },
+ { kEob2IntroAnimData24, kEoB2TypeSeqData, false },
+ { kEob2IntroAnimData25, kEoB2TypeSeqData, false },
+ { kEob2IntroAnimData26, kEoB2TypeSeqData, false },
+ { kEob2IntroAnimData27, kEoB2TypeSeqData, false },
+ { kEob2IntroAnimData28, kEoB2TypeSeqData, false },
+ { kEob2IntroAnimData29, kEoB2TypeSeqData, false },
+ { kEob2IntroAnimData30, kEoB2TypeSeqData, false },
+ { kEob2IntroAnimData31, kEoB2TypeSeqData, false },
+ { kEob2IntroAnimData32, kEoB2TypeSeqData, false },
+ { kEob2IntroAnimData33, kEoB2TypeSeqData, false },
+ { kEob2IntroAnimData34, kEoB2TypeSeqData, false },
+ { kEob2IntroAnimData35, kEoB2TypeSeqData, false },
+ { kEob2IntroAnimData36, kEoB2TypeSeqData, false },
+ { kEob2IntroAnimData37, kEoB2TypeSeqData, false },
+ { kEob2IntroAnimData38, kEoB2TypeSeqData, false },
+ { kEob2IntroAnimData39, kEoB2TypeSeqData, false },
+ { kEob2IntroAnimData40, kEoB2TypeSeqData, false },
+ { kEob2IntroAnimData41, kEoB2TypeSeqData, false },
+ { kEob2IntroAnimData42, kEoB2TypeSeqData, false },
+ { kEob2IntroAnimData43, kEoB2TypeSeqData, false },
{ kEoB2IntroShapes00, kEoB2TypeShapeData, false },
{ kEoB2IntroShapes01, kEoB2TypeShapeData, false },
{ kEoB2IntroShapes04, kEoB2TypeShapeData, false },
@@ -526,27 +541,27 @@ const ExtractFilename extractFilenames[] = {
{ kEoB2FinaleStrings, k2TypeSfxList, true },
{ kEoB2CreditsData, kTypeRawData, true },
{ kEoB2FinaleCPSFiles, kTypeStringList, true },
- { kEoB2FinaleSeqData00, kEoB2TypeSeqData, false },
- { kEoB2FinaleSeqData01, kEoB2TypeSeqData, false },
- { kEoB2FinaleSeqData02, kEoB2TypeSeqData, false },
- { kEoB2FinaleSeqData03, kEoB2TypeSeqData, false },
- { kEoB2FinaleSeqData04, kEoB2TypeSeqData, false },
- { kEoB2FinaleSeqData05, kEoB2TypeSeqData, false },
- { kEoB2FinaleSeqData06, kEoB2TypeSeqData, false },
- { kEoB2FinaleSeqData07, kEoB2TypeSeqData, false },
- { kEoB2FinaleSeqData08, kEoB2TypeSeqData, false },
- { kEoB2FinaleSeqData09, kEoB2TypeSeqData, false },
- { kEoB2FinaleSeqData10, kEoB2TypeSeqData, false },
- { kEoB2FinaleSeqData11, kEoB2TypeSeqData, false },
- { kEoB2FinaleSeqData12, kEoB2TypeSeqData, false },
- { kEoB2FinaleSeqData13, kEoB2TypeSeqData, false },
- { kEoB2FinaleSeqData14, kEoB2TypeSeqData, false },
- { kEoB2FinaleSeqData15, kEoB2TypeSeqData, false },
- { kEoB2FinaleSeqData16, kEoB2TypeSeqData, false },
- { kEoB2FinaleSeqData17, kEoB2TypeSeqData, false },
- { kEoB2FinaleSeqData18, kEoB2TypeSeqData, false },
- { kEoB2FinaleSeqData19, kEoB2TypeSeqData, false },
- { kEoB2FinaleSeqData20, kEoB2TypeSeqData, false },
+ { kEob2FinaleAnimData00, kEoB2TypeSeqData, false },
+ { kEob2FinaleAnimData01, kEoB2TypeSeqData, false },
+ { kEob2FinaleAnimData02, kEoB2TypeSeqData, false },
+ { kEob2FinaleAnimData03, kEoB2TypeSeqData, false },
+ { kEob2FinaleAnimData04, kEoB2TypeSeqData, false },
+ { kEob2FinaleAnimData05, kEoB2TypeSeqData, false },
+ { kEob2FinaleAnimData06, kEoB2TypeSeqData, false },
+ { kEob2FinaleAnimData07, kEoB2TypeSeqData, false },
+ { kEob2FinaleAnimData08, kEoB2TypeSeqData, false },
+ { kEob2FinaleAnimData09, kEoB2TypeSeqData, false },
+ { kEob2FinaleAnimData10, kEoB2TypeSeqData, false },
+ { kEob2FinaleAnimData11, kEoB2TypeSeqData, false },
+ { kEob2FinaleAnimData12, kEoB2TypeSeqData, false },
+ { kEob2FinaleAnimData13, kEoB2TypeSeqData, false },
+ { kEob2FinaleAnimData14, kEoB2TypeSeqData, false },
+ { kEob2FinaleAnimData15, kEoB2TypeSeqData, false },
+ { kEob2FinaleAnimData16, kEoB2TypeSeqData, false },
+ { kEob2FinaleAnimData17, kEoB2TypeSeqData, false },
+ { kEob2FinaleAnimData18, kEoB2TypeSeqData, false },
+ { kEob2FinaleAnimData19, kEoB2TypeSeqData, false },
+ { kEob2FinaleAnimData20, kEoB2TypeSeqData, false },
{ kEoB2FinaleShapes00, kEoB2TypeShapeData, false },
{ kEoB2FinaleShapes03, kEoB2TypeShapeData, false },
{ kEoB2FinaleShapes07, kEoB2TypeShapeData, false },
@@ -641,6 +656,10 @@ const ExtractFilename extractFilenames[] = {
{ kRpgCommonDscBlockIndex, kTypeRawData, false },
{ kLoLDscDoor4, kLoLTypeRaw16, false },
{ kRpgCommonDscDoorY2, kTypeRawData, false },
+ { kRpgCommonDscDoorFrameY1, kTypeRawData, false },
+ { kRpgCommonDscDoorFrameY2, kTypeRawData, false },
+ { kRpgCommonDscDoorFrameIndex1, kTypeRawData, false },
+ { kRpgCommonDscDoorFrameIndex2, kTypeRawData, false },
{ kLoLDscDoorX, kLoLTypeRaw16, false },
{ kLoLDscDoorY, kLoLTypeRaw16, false },
@@ -1756,6 +1775,34 @@ const char *getIdString(const int id) {
return "kEoB1BeholderSfx";
case kEoB1TurnUndeadString:
return "kEoB1TurnUndeadString";
+ case kEoB1CgaMappingDefault:
+ return "kEoB1CgaMappingDefault";
+ case kEoB1CgaMappingAlt:
+ return "kEoB1CgaMappingAlt";
+ case kEoB1CgaMappingInv:
+ return "kEoB1CgaMappingInv";
+ case kEoB1CgaMappingItemsL:
+ return "kEoB1CgaMappingItemsL";
+ case kEoB1CgaMappingItemsS:
+ return "kEoB1CgaMappingItemsS";
+ case kEoB1CgaMappingThrown:
+ return "kEoB1CgaMappingThrown";
+ case kEoB1CgaMappingIcons:
+ return "kEoB1CgaMappingIcons";
+ case kEoB1CgaMappingDeco:
+ return "kEoB1CgaMappingDeco";
+ case kEoB1CgaLevelMappingIndex:
+ return "kEoB1CgaLevelMappingIndex";
+ case kEoB1CgaMappingLevel0:
+ return "kEoB1CgaMappingLevel0";
+ case kEoB1CgaMappingLevel1:
+ return "kEoB1CgaMappingLevel1";
+ case kEoB1CgaMappingLevel2:
+ return "kEoB1CgaMappingLevel2";
+ case kEoB1CgaMappingLevel3:
+ return "kEoB1CgaMappingLevel3";
+ case kEoB1CgaMappingLevel4:
+ return "kEoB1CgaMappingLevel4";
case kEoB1NpcShpData:
return "kEoB1NpcShpData";
case kEoB1NpcSubShpIndex1:
@@ -1806,94 +1853,94 @@ const char *getIdString(const int id) {
return "kEoB2IntroStrings";
case kEoB2IntroCPSFiles:
return "kEoB2IntroCPSFiles";
- case kEoB2IntroSeqData00:
- return "kEoB2IntroSeqData00";
- case kEoB2IntroSeqData01:
- return "kEoB2IntroSeqData01";
- case kEoB2IntroSeqData02:
- return "kEoB2IntroSeqData02";
- case kEoB2IntroSeqData03:
- return "kEoB2IntroSeqData03";
- case kEoB2IntroSeqData04:
- return "kEoB2IntroSeqData04";
- case kEoB2IntroSeqData05:
- return "kEoB2IntroSeqData05";
- case kEoB2IntroSeqData06:
- return "kEoB2IntroSeqData06";
- case kEoB2IntroSeqData07:
- return "kEoB2IntroSeqData07";
- case kEoB2IntroSeqData08:
- return "kEoB2IntroSeqData08";
- case kEoB2IntroSeqData09:
- return "kEoB2IntroSeqData09";
- case kEoB2IntroSeqData10:
- return "kEoB2IntroSeqData10";
- case kEoB2IntroSeqData11:
- return "kEoB2IntroSeqData11";
- case kEoB2IntroSeqData12:
- return "kEoB2IntroSeqData12";
- case kEoB2IntroSeqData13:
- return "kEoB2IntroSeqData13";
- case kEoB2IntroSeqData14:
- return "kEoB2IntroSeqData14";
- case kEoB2IntroSeqData15:
- return "kEoB2IntroSeqData15";
- case kEoB2IntroSeqData16:
- return "kEoB2IntroSeqData16";
- case kEoB2IntroSeqData17:
- return "kEoB2IntroSeqData17";
- case kEoB2IntroSeqData18:
- return "kEoB2IntroSeqData18";
- case kEoB2IntroSeqData19:
- return "kEoB2IntroSeqData19";
- case kEoB2IntroSeqData20:
- return "kEoB2IntroSeqData20";
- case kEoB2IntroSeqData21:
- return "kEoB2IntroSeqData21";
- case kEoB2IntroSeqData22:
- return "kEoB2IntroSeqData22";
- case kEoB2IntroSeqData23:
- return "kEoB2IntroSeqData23";
- case kEoB2IntroSeqData24:
- return "kEoB2IntroSeqData24";
- case kEoB2IntroSeqData25:
- return "kEoB2IntroSeqData25";
- case kEoB2IntroSeqData26:
- return "kEoB2IntroSeqData26";
- case kEoB2IntroSeqData27:
- return "kEoB2IntroSeqData27";
- case kEoB2IntroSeqData28:
- return "kEoB2IntroSeqData28";
- case kEoB2IntroSeqData29:
- return "kEoB2IntroSeqData29";
- case kEoB2IntroSeqData30:
- return "kEoB2IntroSeqData30";
- case kEoB2IntroSeqData31:
- return "kEoB2IntroSeqData31";
- case kEoB2IntroSeqData32:
- return "kEoB2IntroSeqData32";
- case kEoB2IntroSeqData33:
- return "kEoB2IntroSeqData33";
- case kEoB2IntroSeqData34:
- return "kEoB2IntroSeqData34";
- case kEoB2IntroSeqData35:
- return "kEoB2IntroSeqData35";
- case kEoB2IntroSeqData36:
- return "kEoB2IntroSeqData36";
- case kEoB2IntroSeqData37:
- return "kEoB2IntroSeqData37";
- case kEoB2IntroSeqData38:
- return "kEoB2IntroSeqData38";
- case kEoB2IntroSeqData39:
- return "kEoB2IntroSeqData39";
- case kEoB2IntroSeqData40:
- return "kEoB2IntroSeqData40";
- case kEoB2IntroSeqData41:
- return "kEoB2IntroSeqData41";
- case kEoB2IntroSeqData42:
- return "kEoB2IntroSeqData42";
- case kEoB2IntroSeqData43:
- return "kEoB2IntroSeqData43";
+ case kEob2IntroAnimData00:
+ return "kEob2IntroAnimData00";
+ case kEob2IntroAnimData01:
+ return "kEob2IntroAnimData01";
+ case kEob2IntroAnimData02:
+ return "kEob2IntroAnimData02";
+ case kEob2IntroAnimData03:
+ return "kEob2IntroAnimData03";
+ case kEob2IntroAnimData04:
+ return "kEob2IntroAnimData04";
+ case kEob2IntroAnimData05:
+ return "kEob2IntroAnimData05";
+ case kEob2IntroAnimData06:
+ return "kEob2IntroAnimData06";
+ case kEob2IntroAnimData07:
+ return "kEob2IntroAnimData07";
+ case kEob2IntroAnimData08:
+ return "kEob2IntroAnimData08";
+ case kEob2IntroAnimData09:
+ return "kEob2IntroAnimData09";
+ case kEob2IntroAnimData10:
+ return "kEob2IntroAnimData10";
+ case kEob2IntroAnimData11:
+ return "kEob2IntroAnimData11";
+ case kEob2IntroAnimData12:
+ return "kEob2IntroAnimData12";
+ case kEob2IntroAnimData13:
+ return "kEob2IntroAnimData13";
+ case kEob2IntroAnimData14:
+ return "kEob2IntroAnimData14";
+ case kEob2IntroAnimData15:
+ return "kEob2IntroAnimData15";
+ case kEob2IntroAnimData16:
+ return "kEob2IntroAnimData16";
+ case kEob2IntroAnimData17:
+ return "kEob2IntroAnimData17";
+ case kEob2IntroAnimData18:
+ return "kEob2IntroAnimData18";
+ case kEob2IntroAnimData19:
+ return "kEob2IntroAnimData19";
+ case kEob2IntroAnimData20:
+ return "kEob2IntroAnimData20";
+ case kEob2IntroAnimData21:
+ return "kEob2IntroAnimData21";
+ case kEob2IntroAnimData22:
+ return "kEob2IntroAnimData22";
+ case kEob2IntroAnimData23:
+ return "kEob2IntroAnimData23";
+ case kEob2IntroAnimData24:
+ return "kEob2IntroAnimData24";
+ case kEob2IntroAnimData25:
+ return "kEob2IntroAnimData25";
+ case kEob2IntroAnimData26:
+ return "kEob2IntroAnimData26";
+ case kEob2IntroAnimData27:
+ return "kEob2IntroAnimData27";
+ case kEob2IntroAnimData28:
+ return "kEob2IntroAnimData28";
+ case kEob2IntroAnimData29:
+ return "kEob2IntroAnimData29";
+ case kEob2IntroAnimData30:
+ return "kEob2IntroAnimData30";
+ case kEob2IntroAnimData31:
+ return "kEob2IntroAnimData31";
+ case kEob2IntroAnimData32:
+ return "kEob2IntroAnimData32";
+ case kEob2IntroAnimData33:
+ return "kEob2IntroAnimData33";
+ case kEob2IntroAnimData34:
+ return "kEob2IntroAnimData34";
+ case kEob2IntroAnimData35:
+ return "kEob2IntroAnimData35";
+ case kEob2IntroAnimData36:
+ return "kEob2IntroAnimData36";
+ case kEob2IntroAnimData37:
+ return "kEob2IntroAnimData37";
+ case kEob2IntroAnimData38:
+ return "kEob2IntroAnimData38";
+ case kEob2IntroAnimData39:
+ return "kEob2IntroAnimData39";
+ case kEob2IntroAnimData40:
+ return "kEob2IntroAnimData40";
+ case kEob2IntroAnimData41:
+ return "kEob2IntroAnimData41";
+ case kEob2IntroAnimData42:
+ return "kEob2IntroAnimData42";
+ case kEob2IntroAnimData43:
+ return "kEob2IntroAnimData43";
case kEoB2IntroShapes00:
return "kEoB2IntroShapes00";
case kEoB2IntroShapes01:
@@ -1908,48 +1955,48 @@ const char *getIdString(const int id) {
return "kEoB2CreditsData";
case kEoB2FinaleCPSFiles:
return "kEoB2FinaleCPSFiles";
- case kEoB2FinaleSeqData00:
- return "kEoB2FinaleSeqData00";
- case kEoB2FinaleSeqData01:
- return "kEoB2FinaleSeqData01";
- case kEoB2FinaleSeqData02:
- return "kEoB2FinaleSeqData02";
- case kEoB2FinaleSeqData03:
- return "kEoB2FinaleSeqData03";
- case kEoB2FinaleSeqData04:
- return "kEoB2FinaleSeqData04";
- case kEoB2FinaleSeqData05:
- return "kEoB2FinaleSeqData05";
- case kEoB2FinaleSeqData06:
- return "kEoB2FinaleSeqData06";
- case kEoB2FinaleSeqData07:
- return "kEoB2FinaleSeqData07";
- case kEoB2FinaleSeqData08:
- return "kEoB2FinaleSeqData08";
- case kEoB2FinaleSeqData09:
- return "kEoB2FinaleSeqData09";
- case kEoB2FinaleSeqData10:
- return "kEoB2FinaleSeqData10";
- case kEoB2FinaleSeqData11:
- return "kEoB2FinaleSeqData11";
- case kEoB2FinaleSeqData12:
- return "kEoB2FinaleSeqData12";
- case kEoB2FinaleSeqData13:
- return "kEoB2FinaleSeqData13";
- case kEoB2FinaleSeqData14:
- return "kEoB2FinaleSeqData14";
- case kEoB2FinaleSeqData15:
- return "kEoB2FinaleSeqData15";
- case kEoB2FinaleSeqData16:
- return "kEoB2FinaleSeqData16";
- case kEoB2FinaleSeqData17:
- return "kEoB2FinaleSeqData17";
- case kEoB2FinaleSeqData18:
- return "kEoB2FinaleSeqData18";
- case kEoB2FinaleSeqData19:
- return "kEoB2FinaleSeqData19";
- case kEoB2FinaleSeqData20:
- return "kEoB2FinaleSeqData20";
+ case kEob2FinaleAnimData00:
+ return "kEob2FinaleAnimData00";
+ case kEob2FinaleAnimData01:
+ return "kEob2FinaleAnimData01";
+ case kEob2FinaleAnimData02:
+ return "kEob2FinaleAnimData02";
+ case kEob2FinaleAnimData03:
+ return "kEob2FinaleAnimData03";
+ case kEob2FinaleAnimData04:
+ return "kEob2FinaleAnimData04";
+ case kEob2FinaleAnimData05:
+ return "kEob2FinaleAnimData05";
+ case kEob2FinaleAnimData06:
+ return "kEob2FinaleAnimData06";
+ case kEob2FinaleAnimData07:
+ return "kEob2FinaleAnimData07";
+ case kEob2FinaleAnimData08:
+ return "kEob2FinaleAnimData08";
+ case kEob2FinaleAnimData09:
+ return "kEob2FinaleAnimData09";
+ case kEob2FinaleAnimData10:
+ return "kEob2FinaleAnimData10";
+ case kEob2FinaleAnimData11:
+ return "kEob2FinaleAnimData11";
+ case kEob2FinaleAnimData12:
+ return "kEob2FinaleAnimData12";
+ case kEob2FinaleAnimData13:
+ return "kEob2FinaleAnimData13";
+ case kEob2FinaleAnimData14:
+ return "kEob2FinaleAnimData14";
+ case kEob2FinaleAnimData15:
+ return "kEob2FinaleAnimData15";
+ case kEob2FinaleAnimData16:
+ return "kEob2FinaleAnimData16";
+ case kEob2FinaleAnimData17:
+ return "kEob2FinaleAnimData17";
+ case kEob2FinaleAnimData18:
+ return "kEob2FinaleAnimData18";
+ case kEob2FinaleAnimData19:
+ return "kEob2FinaleAnimData19";
+ case kEob2FinaleAnimData20:
+ return "kEob2FinaleAnimData20";
case kEoB2FinaleShapes00:
return "kEoB2FinaleShapes00";
case kEoB2FinaleShapes03:
@@ -2122,6 +2169,14 @@ const char *getIdString(const int id) {
return "kRpgCommonDscBlockIndex";
case kRpgCommonDscDoorY2:
return "kRpgCommonDscDoorY2";
+ case kRpgCommonDscDoorFrameY1:
+ return "kRpgCommonDscDoorFrameY1";
+ case kRpgCommonDscDoorFrameY2:
+ return "kRpgCommonDscDoorFrameY2";
+ case kRpgCommonDscDoorFrameIndex1:
+ return "kRpgCommonDscDoorFrameIndex1";
+ case kRpgCommonDscDoorFrameIndex2:
+ return "kRpgCommonDscDoorFrameIndex2";
case kLoLDscDoorScale:
return "kLoLDscDoorScale";
case kLoLDscDoor4:
diff --git a/devtools/create_kyradat/create_kyradat.h b/devtools/create_kyradat/create_kyradat.h
index 3de785d603..c2a69cfd79 100644
--- a/devtools/create_kyradat/create_kyradat.h
+++ b/devtools/create_kyradat/create_kyradat.h
@@ -190,6 +190,10 @@ enum kExtractID {
kRpgCommonDscBlockMap,
kRpgCommonDscDimMap,
kRpgCommonDscDoorY2,
+ kRpgCommonDscDoorFrameY1,
+ kRpgCommonDscDoorFrameY2,
+ kRpgCommonDscDoorFrameIndex1,
+ kRpgCommonDscDoorFrameIndex2,
kRpgCommonDscBlockIndex,
kEoBBaseChargenStrings1,
@@ -446,6 +450,21 @@ enum kExtractID {
kEoB1BeholderSfx,
kEoB1TurnUndeadString,
+ kEoB1CgaMappingDefault,
+ kEoB1CgaMappingAlt,
+ kEoB1CgaMappingInv,
+ kEoB1CgaMappingItemsL,
+ kEoB1CgaMappingItemsS,
+ kEoB1CgaMappingThrown,
+ kEoB1CgaMappingIcons,
+ kEoB1CgaMappingDeco,
+ kEoB1CgaLevelMappingIndex,
+ kEoB1CgaMappingLevel0,
+ kEoB1CgaMappingLevel1,
+ kEoB1CgaMappingLevel2,
+ kEoB1CgaMappingLevel3,
+ kEoB1CgaMappingLevel4,
+
kEoB1NpcShpData,
kEoB1NpcSubShpIndex1,
kEoB1NpcSubShpIndex2,
@@ -474,50 +493,50 @@ enum kExtractID {
kEoB2IntroStrings,
kEoB2IntroCPSFiles,
- kEoB2IntroSeqData00,
- kEoB2IntroSeqData01,
- kEoB2IntroSeqData02,
- kEoB2IntroSeqData03,
- kEoB2IntroSeqData04,
- kEoB2IntroSeqData05,
- kEoB2IntroSeqData06,
- kEoB2IntroSeqData07,
- kEoB2IntroSeqData08,
- kEoB2IntroSeqData09,
- kEoB2IntroSeqData10,
- kEoB2IntroSeqData11,
- kEoB2IntroSeqData12,
- kEoB2IntroSeqData13,
- kEoB2IntroSeqData14,
- kEoB2IntroSeqData15,
- kEoB2IntroSeqData16,
- kEoB2IntroSeqData17,
- kEoB2IntroSeqData18,
- kEoB2IntroSeqData19,
- kEoB2IntroSeqData20,
- kEoB2IntroSeqData21,
- kEoB2IntroSeqData22,
- kEoB2IntroSeqData23,
- kEoB2IntroSeqData24,
- kEoB2IntroSeqData25,
- kEoB2IntroSeqData26,
- kEoB2IntroSeqData27,
- kEoB2IntroSeqData28,
- kEoB2IntroSeqData29,
- kEoB2IntroSeqData30,
- kEoB2IntroSeqData31,
- kEoB2IntroSeqData32,
- kEoB2IntroSeqData33,
- kEoB2IntroSeqData34,
- kEoB2IntroSeqData35,
- kEoB2IntroSeqData36,
- kEoB2IntroSeqData37,
- kEoB2IntroSeqData38,
- kEoB2IntroSeqData39,
- kEoB2IntroSeqData40,
- kEoB2IntroSeqData41,
- kEoB2IntroSeqData42,
- kEoB2IntroSeqData43,
+ kEob2IntroAnimData00,
+ kEob2IntroAnimData01,
+ kEob2IntroAnimData02,
+ kEob2IntroAnimData03,
+ kEob2IntroAnimData04,
+ kEob2IntroAnimData05,
+ kEob2IntroAnimData06,
+ kEob2IntroAnimData07,
+ kEob2IntroAnimData08,
+ kEob2IntroAnimData09,
+ kEob2IntroAnimData10,
+ kEob2IntroAnimData11,
+ kEob2IntroAnimData12,
+ kEob2IntroAnimData13,
+ kEob2IntroAnimData14,
+ kEob2IntroAnimData15,
+ kEob2IntroAnimData16,
+ kEob2IntroAnimData17,
+ kEob2IntroAnimData18,
+ kEob2IntroAnimData19,
+ kEob2IntroAnimData20,
+ kEob2IntroAnimData21,
+ kEob2IntroAnimData22,
+ kEob2IntroAnimData23,
+ kEob2IntroAnimData24,
+ kEob2IntroAnimData25,
+ kEob2IntroAnimData26,
+ kEob2IntroAnimData27,
+ kEob2IntroAnimData28,
+ kEob2IntroAnimData29,
+ kEob2IntroAnimData30,
+ kEob2IntroAnimData31,
+ kEob2IntroAnimData32,
+ kEob2IntroAnimData33,
+ kEob2IntroAnimData34,
+ kEob2IntroAnimData35,
+ kEob2IntroAnimData36,
+ kEob2IntroAnimData37,
+ kEob2IntroAnimData38,
+ kEob2IntroAnimData39,
+ kEob2IntroAnimData40,
+ kEob2IntroAnimData41,
+ kEob2IntroAnimData42,
+ kEob2IntroAnimData43,
kEoB2IntroShapes00,
kEoB2IntroShapes01,
kEoB2IntroShapes04,
@@ -526,27 +545,27 @@ enum kExtractID {
kEoB2FinaleStrings,
kEoB2CreditsData,
kEoB2FinaleCPSFiles,
- kEoB2FinaleSeqData00,
- kEoB2FinaleSeqData01,
- kEoB2FinaleSeqData02,
- kEoB2FinaleSeqData03,
- kEoB2FinaleSeqData04,
- kEoB2FinaleSeqData05,
- kEoB2FinaleSeqData06,
- kEoB2FinaleSeqData07,
- kEoB2FinaleSeqData08,
- kEoB2FinaleSeqData09,
- kEoB2FinaleSeqData10,
- kEoB2FinaleSeqData11,
- kEoB2FinaleSeqData12,
- kEoB2FinaleSeqData13,
- kEoB2FinaleSeqData14,
- kEoB2FinaleSeqData15,
- kEoB2FinaleSeqData16,
- kEoB2FinaleSeqData17,
- kEoB2FinaleSeqData18,
- kEoB2FinaleSeqData19,
- kEoB2FinaleSeqData20,
+ kEob2FinaleAnimData00,
+ kEob2FinaleAnimData01,
+ kEob2FinaleAnimData02,
+ kEob2FinaleAnimData03,
+ kEob2FinaleAnimData04,
+ kEob2FinaleAnimData05,
+ kEob2FinaleAnimData06,
+ kEob2FinaleAnimData07,
+ kEob2FinaleAnimData08,
+ kEob2FinaleAnimData09,
+ kEob2FinaleAnimData10,
+ kEob2FinaleAnimData11,
+ kEob2FinaleAnimData12,
+ kEob2FinaleAnimData13,
+ kEob2FinaleAnimData14,
+ kEob2FinaleAnimData15,
+ kEob2FinaleAnimData16,
+ kEob2FinaleAnimData17,
+ kEob2FinaleAnimData18,
+ kEob2FinaleAnimData19,
+ kEob2FinaleAnimData20,
kEoB2FinaleShapes00,
kEoB2FinaleShapes03,
kEoB2FinaleShapes07,
@@ -666,7 +685,7 @@ enum kGame {
kKyra3,
kLoL,
kEoB1,
- kEoB2,
+ kEoB2
};
struct Game {
diff --git a/devtools/create_kyradat/extract.cpp b/devtools/create_kyradat/extract.cpp
index 3c19cf0d62..34308f1b5b 100644
--- a/devtools/create_kyradat/extract.cpp
+++ b/devtools/create_kyradat/extract.cpp
@@ -161,7 +161,7 @@ bool extractStrings(PAKFile &out, const ExtractInformation *info, const byte *da
static const uint8 rusFanSkip_k1GUIStrings[] = { 1, 3, 6, 8, 11, 13, 18 };
uint32 rusFanSkipIdLen = 0;
const uint8 *rusFanSkipId = 0;
- int rusFanEmptyId = 10000;
+ uint rusFanEmptyId = 10000;
uint32 skipCount = 0;
int patch = 0;
@@ -314,7 +314,7 @@ bool extractStrings(PAKFile &out, const ExtractInformation *info, const byte *da
input += 0x11; output += 0x0F;
}
- strcpy((char*) output, (const char*) input);
+ strcpy((char *) output, (const char*) input);
uint32 stringsize = strlen((const char*)output) + 1;
input += stringsize; output += stringsize;
// skip empty entries
@@ -370,7 +370,7 @@ bool extractStrings(PAKFile &out, const ExtractInformation *info, const byte *da
} else if (patch == 5) {
const byte *c = data + size;
do {
- strcpy((char*) output, (const char*) input);
+ strcpy((char *) output, (const char*) input);
uint32 stringsize = strlen((const char*)output) + 1;
input += stringsize; output += stringsize;
@@ -403,7 +403,7 @@ bool extractStrings(PAKFile &out, const ExtractInformation *info, const byte *da
output += 44;
data += 44;
for (int t = 1; t != 10; t++) {
- sprintf((char*) output, "COST%d_SH.PAK", t);
+ sprintf((char *) output, "COST%d_SH.PAK", t);
output += 13;
}
data += 126;
@@ -576,7 +576,7 @@ bool extractHofSeqData(PAKFile &out, const ExtractInformation *info, const byte
byte *buffer = new byte[bufferSize];
assert(buffer);
memset(buffer, 0, bufferSize );
- uint16 *header = (uint16*) buffer;
+ uint16 *header = (uint16 *) buffer;
byte *output = buffer + headerSize;
uint16 *hdout = header;
@@ -751,7 +751,7 @@ bool extractHofSeqData(PAKFile &out, const ExtractInformation *info, const byte
byte *finBuffer = new byte[finBufferSize];
assert(finBuffer);
uint16 diff = headerSize - finHeaderSize;
- uint16 *finHeader = (uint16*) finBuffer;
+ uint16 *finHeader = (uint16 *) finBuffer;
for (int i = 1; i < finHeaderSize; i++)
WRITE_BE_UINT16(&finHeader[i], (READ_BE_UINT16(&header[i]) - diff));
@@ -760,7 +760,7 @@ bool extractHofSeqData(PAKFile &out, const ExtractInformation *info, const byte
memcpy (finBuffer + finHeaderSize, buffer + headerSize, finBufferSize - finHeaderSize);
delete[] buffer;
- finHeader = (uint16*) (finBuffer + ((numSequences + 2) * sizeof(uint16)));
+ finHeader = (uint16 *) (finBuffer + ((numSequences + 2) * sizeof(uint16)));
for (int i = 0; i < numNestedSequences; i++) {
uint8 * offs = finBuffer + READ_BE_UINT16(finHeader++) + 26;
uint16 ctrl = READ_BE_UINT16(offs);
diff --git a/devtools/create_kyradat/games.cpp b/devtools/create_kyradat/games.cpp
index e0e6f011fa..258d2dd50d 100644
--- a/devtools/create_kyradat/games.cpp
+++ b/devtools/create_kyradat/games.cpp
@@ -827,6 +827,8 @@ const int lolFloppyNeed[] = {
kLoLDscOvlIndex,
kRpgCommonDscBlockIndex,
kRpgCommonDscDoorY2,
+ kRpgCommonDscDoorFrameY1,
+ kRpgCommonDscDoorFrameY2,
kLoLDscDoorScale,
kLoLDscDoor4,
kLoLDscDoorX,
@@ -907,6 +909,8 @@ const int lolPC98Need[] = {
kLoLDscOvlIndex,
kRpgCommonDscBlockIndex,
kRpgCommonDscDoorY2,
+ kRpgCommonDscDoorFrameY1,
+ kRpgCommonDscDoorFrameY2,
kLoLDscDoorScale,
kLoLDscDoor4,
kLoLDscDoorX,
@@ -992,6 +996,8 @@ const int lolCDNeed[] = {
kLoLDscOvlIndex,
kRpgCommonDscBlockIndex,
kRpgCommonDscDoorY2,
+ kRpgCommonDscDoorFrameY1,
+ kRpgCommonDscDoorFrameY2,
kLoLDscDoorScale,
kLoLDscDoor4,
kLoLDscDoorX,
@@ -1089,6 +1095,21 @@ const int eob1FloppyNeed[] = {
kEoB1BeholderSfx,
kEoB1TurnUndeadString,
+ kEoB1CgaMappingDefault,
+ kEoB1CgaMappingAlt,
+ kEoB1CgaMappingInv,
+ kEoB1CgaMappingItemsL,
+ kEoB1CgaMappingItemsS,
+ kEoB1CgaMappingThrown,
+ kEoB1CgaMappingIcons,
+ kEoB1CgaMappingDeco,
+ kEoB1CgaLevelMappingIndex,
+ kEoB1CgaMappingLevel0,
+ kEoB1CgaMappingLevel1,
+ kEoB1CgaMappingLevel2,
+ kEoB1CgaMappingLevel3,
+ kEoB1CgaMappingLevel4,
+
kEoB1NpcShpData,
kEoB1NpcSubShpIndex1,
kEoB1NpcSubShpIndex2,
@@ -1238,6 +1259,10 @@ const int eob1FloppyNeed[] = {
kEoBBaseDscDoorY6,
kEoBBaseDscDoorY7,
kEoBBaseDscDoorCoordsExt,
+ kRpgCommonDscDoorFrameY1,
+ kRpgCommonDscDoorFrameY2,
+ kRpgCommonDscDoorFrameIndex1,
+ kRpgCommonDscDoorFrameIndex2,
kEoBBaseDscItemPosIndex,
kEoBBaseDscItemShpX,
@@ -1457,6 +1482,8 @@ const int eob2FloppyNeed[] = {
kEoBBaseDscDoorType5Offs,
kEoBBaseDscDoorY1,
kRpgCommonDscDoorY2,
+ kRpgCommonDscDoorFrameY1,
+ kRpgCommonDscDoorFrameY2,
kEoBBaseDscItemPosIndex,
kEoBBaseDscItemShpX,
@@ -1497,50 +1524,50 @@ const int eob2FloppyNeed[] = {
kEoB2IntroStrings,
kEoB2IntroCPSFiles,
- kEoB2IntroSeqData00,
- kEoB2IntroSeqData01,
- kEoB2IntroSeqData02,
- kEoB2IntroSeqData03,
- kEoB2IntroSeqData04,
- kEoB2IntroSeqData05,
- kEoB2IntroSeqData06,
- kEoB2IntroSeqData07,
- kEoB2IntroSeqData08,
- kEoB2IntroSeqData09,
- kEoB2IntroSeqData10,
- kEoB2IntroSeqData11,
- kEoB2IntroSeqData12,
- kEoB2IntroSeqData13,
- kEoB2IntroSeqData14,
- kEoB2IntroSeqData15,
- kEoB2IntroSeqData16,
- kEoB2IntroSeqData17,
- kEoB2IntroSeqData18,
- kEoB2IntroSeqData19,
- kEoB2IntroSeqData20,
- kEoB2IntroSeqData21,
- kEoB2IntroSeqData22,
- kEoB2IntroSeqData23,
- kEoB2IntroSeqData24,
- kEoB2IntroSeqData25,
- kEoB2IntroSeqData26,
- kEoB2IntroSeqData27,
- kEoB2IntroSeqData28,
- kEoB2IntroSeqData29,
- kEoB2IntroSeqData30,
- kEoB2IntroSeqData31,
- kEoB2IntroSeqData32,
- kEoB2IntroSeqData33,
- kEoB2IntroSeqData34,
- kEoB2IntroSeqData35,
- kEoB2IntroSeqData36,
- kEoB2IntroSeqData37,
- kEoB2IntroSeqData38,
- kEoB2IntroSeqData39,
- kEoB2IntroSeqData40,
- kEoB2IntroSeqData41,
- kEoB2IntroSeqData42,
- kEoB2IntroSeqData43,
+ kEob2IntroAnimData00,
+ kEob2IntroAnimData01,
+ kEob2IntroAnimData02,
+ kEob2IntroAnimData03,
+ kEob2IntroAnimData04,
+ kEob2IntroAnimData05,
+ kEob2IntroAnimData06,
+ kEob2IntroAnimData07,
+ kEob2IntroAnimData08,
+ kEob2IntroAnimData09,
+ kEob2IntroAnimData10,
+ kEob2IntroAnimData11,
+ kEob2IntroAnimData12,
+ kEob2IntroAnimData13,
+ kEob2IntroAnimData14,
+ kEob2IntroAnimData15,
+ kEob2IntroAnimData16,
+ kEob2IntroAnimData17,
+ kEob2IntroAnimData18,
+ kEob2IntroAnimData19,
+ kEob2IntroAnimData20,
+ kEob2IntroAnimData21,
+ kEob2IntroAnimData22,
+ kEob2IntroAnimData23,
+ kEob2IntroAnimData24,
+ kEob2IntroAnimData25,
+ kEob2IntroAnimData26,
+ kEob2IntroAnimData27,
+ kEob2IntroAnimData28,
+ kEob2IntroAnimData29,
+ kEob2IntroAnimData30,
+ kEob2IntroAnimData31,
+ kEob2IntroAnimData32,
+ kEob2IntroAnimData33,
+ kEob2IntroAnimData34,
+ kEob2IntroAnimData35,
+ kEob2IntroAnimData36,
+ kEob2IntroAnimData37,
+ kEob2IntroAnimData38,
+ kEob2IntroAnimData39,
+ kEob2IntroAnimData40,
+ kEob2IntroAnimData41,
+ kEob2IntroAnimData42,
+ kEob2IntroAnimData43,
kEoB2IntroShapes00,
kEoB2IntroShapes01,
@@ -1550,27 +1577,27 @@ const int eob2FloppyNeed[] = {
kEoB2FinaleStrings,
kEoB2CreditsData,
kEoB2FinaleCPSFiles,
- kEoB2FinaleSeqData00,
- kEoB2FinaleSeqData01,
- kEoB2FinaleSeqData02,
- kEoB2FinaleSeqData03,
- kEoB2FinaleSeqData04,
- kEoB2FinaleSeqData05,
- kEoB2FinaleSeqData06,
- kEoB2FinaleSeqData07,
- kEoB2FinaleSeqData08,
- kEoB2FinaleSeqData09,
- kEoB2FinaleSeqData10,
- kEoB2FinaleSeqData11,
- kEoB2FinaleSeqData12,
- kEoB2FinaleSeqData13,
- kEoB2FinaleSeqData14,
- kEoB2FinaleSeqData15,
- kEoB2FinaleSeqData16,
- kEoB2FinaleSeqData17,
- kEoB2FinaleSeqData18,
- kEoB2FinaleSeqData19,
- kEoB2FinaleSeqData20,
+ kEob2FinaleAnimData00,
+ kEob2FinaleAnimData01,
+ kEob2FinaleAnimData02,
+ kEob2FinaleAnimData03,
+ kEob2FinaleAnimData04,
+ kEob2FinaleAnimData05,
+ kEob2FinaleAnimData06,
+ kEob2FinaleAnimData07,
+ kEob2FinaleAnimData08,
+ kEob2FinaleAnimData09,
+ kEob2FinaleAnimData10,
+ kEob2FinaleAnimData11,
+ kEob2FinaleAnimData12,
+ kEob2FinaleAnimData13,
+ kEob2FinaleAnimData14,
+ kEob2FinaleAnimData15,
+ kEob2FinaleAnimData16,
+ kEob2FinaleAnimData17,
+ kEob2FinaleAnimData18,
+ kEob2FinaleAnimData19,
+ kEob2FinaleAnimData20,
kEoB2FinaleShapes00,
kEoB2FinaleShapes03,
kEoB2FinaleShapes07,
diff --git a/devtools/create_kyradat/module.mk b/devtools/create_kyradat/module.mk
index 4241f82e34..fb458b43ff 100644
--- a/devtools/create_kyradat/module.mk
+++ b/devtools/create_kyradat/module.mk
@@ -14,8 +14,5 @@ MODULE_OBJS := \
# Set the name of the executable
TOOL_EXECUTABLE := create_kyradat
-# Link against common code (for scumm_stricmp)
-TOOL_DEPS := common/libcommon.a
-
# Include common rules
include $(srcdir)/rules.mk
diff --git a/devtools/create_kyradat/tables.cpp b/devtools/create_kyradat/tables.cpp
index e3f658a893..1b9ca45259 100644
--- a/devtools/create_kyradat/tables.cpp
+++ b/devtools/create_kyradat/tables.cpp
@@ -2548,6 +2548,76 @@ const ExtractEntrySearchData kEoB1TurnUndeadStringProvider[] = {
EXTRACT_END_ENTRY
};
+const ExtractEntrySearchData kEoB1CgaMappingDefaultProvider[] = {
+ { UNK_LANG, kPlatformPC, { 0x00000020, 0x0000002C, { { 0x7E, 0x1C, 0x75, 0xC3, 0x8E, 0xF7, 0x56, 0x62, 0x9B, 0xB6, 0xF4, 0x3A, 0x21, 0x03, 0xFA, 0xF5 } } } },
+ EXTRACT_END_ENTRY
+};
+
+const ExtractEntrySearchData kEoB1CgaMappingAltProvider[] = {
+ { UNK_LANG, kPlatformPC, { 0x00000020, 0x00000030, { { 0x2A, 0x8C, 0xF6, 0xD7, 0x87, 0xFA, 0x7B, 0x22, 0x28, 0x2A, 0x50, 0xE2, 0x26, 0x7B, 0xC7, 0x44 } } } },
+ EXTRACT_END_ENTRY
+};
+
+const ExtractEntrySearchData kEoB1CgaMappingInvProvider[] = {
+ { UNK_LANG, kPlatformPC, { 0x00000020, 0x0000002E, { { 0x3A, 0x06, 0xBF, 0x0C, 0xD4, 0xD0, 0x15, 0x1F, 0xB5, 0xC5, 0x49, 0xFD, 0x21, 0xE1, 0xE1, 0x66 } } } },
+ EXTRACT_END_ENTRY
+};
+
+const ExtractEntrySearchData kEoB1CgaMappingItemsLProvider[] = {
+ { UNK_LANG, kPlatformPC, { 0x00000020, 0x0000002A, { { 0xE0, 0x85, 0xA1, 0x3A, 0x3D, 0xC9, 0xF8, 0x56, 0x17, 0x0A, 0xD8, 0x44, 0x56, 0xDF, 0x3C, 0x57 } } } },
+ EXTRACT_END_ENTRY
+};
+
+const ExtractEntrySearchData kEoB1CgaMappingItemsSProvider[] = {
+ { UNK_LANG, kPlatformPC, { 0x00000020, 0x00000036, { { 0x2E, 0x6F, 0xD4, 0x2E, 0xB2, 0x84, 0xB2, 0xC3, 0x36, 0x88, 0x80, 0xC1, 0x67, 0x5A, 0xEB, 0x60 } } } },
+ EXTRACT_END_ENTRY
+};
+
+const ExtractEntrySearchData kEoB1CgaMappingThrownProvider[] = {
+ { UNK_LANG, kPlatformPC, { 0x00000020, 0x00000030, { { 0x0C, 0x3D, 0x1E, 0xAB, 0x0B, 0x25, 0x9F, 0x78, 0xE6, 0xB1, 0x52, 0x79, 0x0F, 0x96, 0x33, 0x97 } } } },
+ EXTRACT_END_ENTRY
+};
+
+const ExtractEntrySearchData kEoB1CgaMappingIconsProvider[] = {
+ { UNK_LANG, kPlatformPC, { 0x00000020, 0x00000039, { { 0x99, 0x50, 0x1A, 0xE1, 0xF3, 0x52, 0xC3, 0x5A, 0x4E, 0xBD, 0x03, 0x74, 0x2C, 0x39, 0xCA, 0x71 } } } },
+ EXTRACT_END_ENTRY
+};
+
+const ExtractEntrySearchData kEoB1CgaMappingDecoProvider[] = {
+ { UNK_LANG, kPlatformPC, { 0x00000020, 0x00000035, { { 0xA5, 0x17, 0xED, 0xEE, 0x02, 0x87, 0x8C, 0x9D, 0xAC, 0x96, 0xC6, 0x07, 0xB0, 0x8E, 0x5D, 0xE3 } } } },
+ EXTRACT_END_ENTRY
+};
+
+const ExtractEntrySearchData kEoB1CgaLevelMappingIndexProvider[] = {
+ { UNK_LANG, kPlatformPC, { 0x0000000C, 0x00000013, { { 0x48, 0x5D, 0xDF, 0x8F, 0xFD, 0x5D, 0xA0, 0xB0, 0x00, 0xD8, 0xB3, 0x09, 0x90, 0x5D, 0x13, 0x3F } } } },
+ EXTRACT_END_ENTRY
+};
+
+const ExtractEntrySearchData kEoB1CgaMappingLevel0Provider[] = {
+ { UNK_LANG, kPlatformPC, { 0x00000020, 0x00000035, { { 0xC2, 0x4D, 0x2F, 0x0A, 0xB0, 0x3E, 0x46, 0x80, 0xD1, 0xEE, 0x32, 0x5F, 0xBA, 0x5C, 0xCC, 0x7A } } } },
+ EXTRACT_END_ENTRY
+};
+
+const ExtractEntrySearchData kEoB1CgaMappingLevel1Provider[] = {
+ { UNK_LANG, kPlatformPC, { 0x00000020, 0x00000030, { { 0x94, 0x8E, 0xAE, 0x12, 0xB5, 0x68, 0xCD, 0x43, 0x95, 0xD2, 0x01, 0x21, 0x0C, 0xA1, 0x34, 0xF5 } } } },
+ EXTRACT_END_ENTRY
+};
+
+const ExtractEntrySearchData kEoB1CgaMappingLevel2Provider[] = {
+ { UNK_LANG, kPlatformPC, { 0x00000020, 0x00000030, { { 0x20, 0x6F, 0x9F, 0x57, 0x0C, 0xFD, 0xDA, 0x5C, 0xA0, 0x1D, 0x28, 0xB4, 0x88, 0x24, 0x68, 0x68 } } } },
+ EXTRACT_END_ENTRY
+};
+
+const ExtractEntrySearchData kEoB1CgaMappingLevel3Provider[] = {
+ { UNK_LANG, kPlatformPC, { 0x00000020, 0x00000030, { { 0x44, 0x95, 0x9A, 0x69, 0x70, 0xB2, 0x63, 0xB6, 0xFB, 0xD0, 0xFF, 0xD9, 0xF0, 0xCD, 0xD4, 0x75 } } } },
+ EXTRACT_END_ENTRY
+};
+
+const ExtractEntrySearchData kEoB1CgaMappingLevel4Provider[] = {
+ { UNK_LANG, kPlatformPC, { 0x00000020, 0x00000031, { { 0xEA, 0xC4, 0x01, 0xC0, 0x21, 0xFE, 0x66, 0xDD, 0xD4, 0x83, 0xC1, 0x2C, 0x09, 0xD3, 0xD0, 0x97 } } } },
+ EXTRACT_END_ENTRY
+};
+
const ExtractEntrySearchData kEoB1NpcShpDataProvider[] = {
{ UNK_LANG, kPlatformPC, { 0x0000004C, 0x00000A42, { { 0x70, 0x21, 0x85, 0x8C, 0xD4, 0x04, 0xAA, 0x20, 0x1D, 0x0E, 0x9D, 0xB7, 0x74, 0x58, 0xCC, 0x0C } } } },
EXTRACT_END_ENTRY
@@ -2701,222 +2771,222 @@ const ExtractEntrySearchData kEoB2IntroCPSFilesProvider[] = {
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEoB2IntroSeqData00Provider[] = {
+const ExtractEntrySearchData kEob2IntroAnimData00Provider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x00000037, 0x000003E1, { { 0x38, 0xC2, 0x0F, 0xE1, 0x43, 0x6A, 0xE8, 0x7C, 0x82, 0x65, 0x9B, 0x4A, 0x9F, 0x83, 0xCD, 0xC8 } } } },
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEoB2IntroSeqData01Provider[] = {
+const ExtractEntrySearchData kEob2IntroAnimData01Provider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x00000037, 0x000003A3, { { 0x84, 0x44, 0xF4, 0x46, 0x4E, 0x2B, 0xD7, 0xC6, 0xAD, 0x14, 0xF1, 0x9E, 0x8A, 0xBE, 0x7B, 0x42 } } } },
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEoB2IntroSeqData02Provider[] = {
+const ExtractEntrySearchData kEob2IntroAnimData02Provider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x00000037, 0x00000446, { { 0x0C, 0xCA, 0x41, 0x0C, 0x89, 0x59, 0xD5, 0x28, 0x9A, 0xDC, 0x51, 0x1C, 0x0B, 0x8C, 0xD2, 0xDB } } } },
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEoB2IntroSeqData03Provider[] = {
+const ExtractEntrySearchData kEob2IntroAnimData03Provider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x0000002C, 0x0000010E, { { 0xAB, 0x48, 0x64, 0x02, 0xB3, 0xF3, 0x6C, 0x82, 0x9D, 0x37, 0x5F, 0x52, 0x0F, 0x5B, 0xDF, 0x96 } } } },
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEoB2IntroSeqData04Provider[] = {
+const ExtractEntrySearchData kEob2IntroAnimData04Provider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x00000021, 0x00000149, { { 0x3B, 0xAC, 0x14, 0x51, 0xDF, 0x5D, 0x22, 0x15, 0x46, 0x4E, 0xCD, 0xF3, 0xD4, 0x61, 0x29, 0x4A } } } },
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEoB2IntroSeqData05Provider[] = {
+const ExtractEntrySearchData kEob2IntroAnimData05Provider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x0000002C, 0x0000010E, { { 0x28, 0x29, 0x5F, 0x31, 0x23, 0x53, 0xBA, 0xD7, 0x24, 0xB9, 0x21, 0x70, 0x84, 0x8A, 0x1C, 0x2E } } } },
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEoB2IntroSeqData06Provider[] = {
+const ExtractEntrySearchData kEob2IntroAnimData06Provider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x000000B0, 0x00001365, { { 0x91, 0x28, 0x2F, 0x10, 0x45, 0x4D, 0xCF, 0x3E, 0x70, 0x1E, 0xD4, 0xBA, 0x0E, 0x70, 0xDE, 0xD0 } } } },
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEoB2IntroSeqData07Provider[] = {
+const ExtractEntrySearchData kEob2IntroAnimData07Provider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x00000037, 0x000003C4, { { 0x8C, 0x72, 0xDE, 0x4F, 0x92, 0x52, 0x0A, 0xED, 0xF4, 0x79, 0xD6, 0x3D, 0x8F, 0x59, 0x9D, 0x69 } } } },
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEoB2IntroSeqData08Provider[] = {
+const ExtractEntrySearchData kEob2IntroAnimData08Provider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x00000042, 0x00000442, { { 0xD2, 0x91, 0x51, 0xEB, 0x91, 0x13, 0x43, 0xCE, 0x7E, 0x60, 0xB8, 0xFF, 0xA7, 0xE2, 0x4C, 0x11 } } } },
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEoB2IntroSeqData09Provider[] = {
+const ExtractEntrySearchData kEob2IntroAnimData09Provider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x0000002C, 0x000004BC, { { 0xD6, 0xC7, 0x44, 0x2E, 0xE7, 0x2A, 0x44, 0x09, 0x39, 0xC3, 0xD3, 0xA8, 0x02, 0xC8, 0xA0, 0x19 } } } },
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEoB2IntroSeqData10Provider[] = {
+const ExtractEntrySearchData kEob2IntroAnimData10Provider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x0000006E, 0x00000C12, { { 0x91, 0xDB, 0x41, 0x7A, 0x4F, 0x7C, 0x7B, 0x83, 0x32, 0x13, 0x68, 0xF6, 0x58, 0x79, 0xDA, 0x99 } } } },
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEoB2IntroSeqData11Provider[] = {
+const ExtractEntrySearchData kEob2IntroAnimData11Provider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x000000B0, 0x0000073C, { { 0x17, 0x1F, 0x4D, 0x05, 0x3F, 0x14, 0x2E, 0x77, 0xD3, 0xDB, 0x78, 0x67, 0xBB, 0x18, 0xDC, 0x85 } } } },
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEoB2IntroSeqData12Provider[] = {
+const ExtractEntrySearchData kEob2IntroAnimData12Provider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x00000021, 0x00000228, { { 0xC9, 0x50, 0x68, 0x51, 0xD0, 0xC1, 0x5D, 0xD4, 0xFF, 0x08, 0x28, 0xDE, 0xC4, 0x41, 0x8C, 0xDB } } } },
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEoB2IntroSeqData13Provider[] = {
+const ExtractEntrySearchData kEob2IntroAnimData13Provider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x0000002C, 0x00000340, { { 0x03, 0xCA, 0x5D, 0xD1, 0x15, 0xFA, 0x60, 0xD7, 0x70, 0x64, 0x3D, 0x44, 0x08, 0xB8, 0xDB, 0xAD } } } },
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEoB2IntroSeqData14Provider[] = {
+const ExtractEntrySearchData kEob2IntroAnimData14Provider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x00000042, 0x000007C0, { { 0x82, 0xA9, 0x0B, 0x90, 0x9D, 0x65, 0x1E, 0xC7, 0x03, 0x5E, 0xB7, 0xDF, 0x6E, 0x1F, 0xED, 0xD6 } } } },
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEoB2IntroSeqData15Provider[] = {
+const ExtractEntrySearchData kEob2IntroAnimData15Provider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x0000002C, 0x00000504, { { 0xA7, 0x91, 0x4F, 0xAD, 0xB1, 0x77, 0x80, 0x3A, 0xC7, 0xDE, 0x35, 0x7A, 0x96, 0x16, 0xD2, 0x13 } } } },
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEoB2IntroSeqData16Provider[] = {
+const ExtractEntrySearchData kEob2IntroAnimData16Provider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x00000079, 0x00000B3D, { { 0xCC, 0x63, 0x5A, 0x11, 0xEE, 0x8A, 0xAE, 0x3A, 0x14, 0xC3, 0xBC, 0xDA, 0xAF, 0x1D, 0xD4, 0x2C } } } },
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEoB2IntroSeqData17Provider[] = {
+const ExtractEntrySearchData kEob2IntroAnimData17Provider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x00000084, 0x00000911, { { 0x09, 0x1C, 0x4B, 0xD9, 0x0B, 0x2A, 0xD6, 0xC1, 0xE3, 0x8D, 0xFE, 0x43, 0x8F, 0x2E, 0x21, 0x51 } } } },
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEoB2IntroSeqData18Provider[] = {
+const ExtractEntrySearchData kEob2IntroAnimData18Provider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x00000058, 0x000008FA, { { 0xFE, 0x58, 0xD9, 0x67, 0x78, 0x97, 0xE2, 0xCD, 0x82, 0xB8, 0xC9, 0xC0, 0x1F, 0xCA, 0x7C, 0xF5 } } } },
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEoB2IntroSeqData19Provider[] = {
+const ExtractEntrySearchData kEob2IntroAnimData19Provider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x0000009A, 0x00000D6B, { { 0xA1, 0xDD, 0x7B, 0x8B, 0x25, 0xA5, 0x96, 0x5A, 0x33, 0x5E, 0x80, 0x5F, 0xA5, 0xBB, 0xAC, 0x11 } } } },
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEoB2IntroSeqData20Provider[] = {
+const ExtractEntrySearchData kEob2IntroAnimData20Provider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x0000009A, 0x00000D6C, { { 0x19, 0xF9, 0x93, 0x1D, 0x01, 0xEE, 0x7C, 0x8B, 0x6C, 0x3E, 0x35, 0x2C, 0x5C, 0x88, 0xCD, 0xB6 } } } },
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEoB2IntroSeqData21Provider[] = {
+const ExtractEntrySearchData kEob2IntroAnimData21Provider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x0000009A, 0x00000D83, { { 0xCB, 0x4F, 0x21, 0x29, 0x63, 0x5B, 0x8C, 0xF2, 0xBA, 0x03, 0x49, 0xD1, 0xAF, 0x22, 0xB0, 0xD5 } } } },
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEoB2IntroSeqData22Provider[] = {
+const ExtractEntrySearchData kEob2IntroAnimData22Provider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x00000016, 0x00000200, { { 0x66, 0xEE, 0x45, 0xB1, 0x87, 0x66, 0xC4, 0x55, 0xCE, 0x60, 0x0C, 0x5B, 0xBB, 0x3C, 0x7D, 0x33 } } } },
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEoB2IntroSeqData23Provider[] = {
+const ExtractEntrySearchData kEob2IntroAnimData23Provider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x00000016, 0x0000020D, { { 0xC4, 0x49, 0xE2, 0x5B, 0x2E, 0x17, 0x68, 0xC4, 0xBA, 0x20, 0xEC, 0xB1, 0xEB, 0x1A, 0xFB, 0xE0 } } } },
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEoB2IntroSeqData24Provider[] = {
+const ExtractEntrySearchData kEob2IntroAnimData24Provider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x00000016, 0x00000214, { { 0xF1, 0x46, 0x82, 0xEF, 0x6D, 0xCA, 0x68, 0xA2, 0xF3, 0x55, 0x63, 0xD2, 0x13, 0x25, 0x19, 0xF7 } } } },
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEoB2IntroSeqData25Provider[] = {
+const ExtractEntrySearchData kEob2IntroAnimData25Provider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x00000016, 0x00000256, { { 0x8F, 0xB9, 0xCD, 0xB8, 0x58, 0xCB, 0x90, 0x03, 0xFC, 0xB6, 0x95, 0x6F, 0x52, 0xF8, 0x7D, 0x19 } } } },
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEoB2IntroSeqData26Provider[] = {
+const ExtractEntrySearchData kEob2IntroAnimData26Provider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x00000016, 0x00000263, { { 0x7A, 0x37, 0x07, 0xC4, 0x67, 0x72, 0x1F, 0xCB, 0xAC, 0x98, 0x46, 0x9A, 0xF3, 0x5F, 0xBA, 0x78 } } } },
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEoB2IntroSeqData27Provider[] = {
+const ExtractEntrySearchData kEob2IntroAnimData27Provider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x00000016, 0x0000026A, { { 0x80, 0x11, 0xEE, 0x44, 0xDA, 0xE1, 0x26, 0x1F, 0x14, 0x7E, 0x93, 0x99, 0x44, 0x44, 0x9F, 0x85 } } } },
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEoB2IntroSeqData28Provider[] = {
+const ExtractEntrySearchData kEob2IntroAnimData28Provider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x00000016, 0x000001F6, { { 0x45, 0xA1, 0xA5, 0xEC, 0x85, 0x06, 0xE2, 0x91, 0x28, 0xE0, 0xBB, 0x53, 0x74, 0x44, 0xD9, 0xA6 } } } },
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEoB2IntroSeqData29Provider[] = {
+const ExtractEntrySearchData kEob2IntroAnimData29Provider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x00000016, 0x000001F9, { { 0x3F, 0x03, 0x2F, 0x8B, 0xFB, 0x6A, 0x97, 0x05, 0xED, 0xBB, 0xD6, 0xA0, 0xF5, 0x7A, 0x6D, 0x08 } } } },
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEoB2IntroSeqData30Provider[] = {
+const ExtractEntrySearchData kEob2IntroAnimData30Provider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x00000016, 0x00000204, { { 0xA1, 0x37, 0x57, 0xC3, 0x72, 0x08, 0x98, 0xA6, 0xF4, 0x5E, 0x58, 0x9E, 0xF3, 0x11, 0x88, 0x1E } } } },
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEoB2IntroSeqData31Provider[] = {
+const ExtractEntrySearchData kEob2IntroAnimData31Provider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x00000016, 0x00000212, { { 0x19, 0xCC, 0x6F, 0xA8, 0x29, 0xB5, 0x3B, 0x15, 0x2F, 0x2C, 0x43, 0xED, 0x7A, 0xF5, 0xC5, 0x69 } } } },
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEoB2IntroSeqData32Provider[] = {
+const ExtractEntrySearchData kEob2IntroAnimData32Provider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x00000037, 0x000006C9, { { 0xBF, 0x65, 0xBA, 0x3F, 0x44, 0xEE, 0xB0, 0x5C, 0x8B, 0xBD, 0x15, 0xAB, 0x03, 0xD1, 0x55, 0x21 } } } },
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEoB2IntroSeqData33Provider[] = {
+const ExtractEntrySearchData kEob2IntroAnimData33Provider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x0000009A, 0x00001585, { { 0xB5, 0x44, 0x06, 0xC9, 0xE8, 0x27, 0x75, 0x6E, 0x63, 0x77, 0xE9, 0xA9, 0x68, 0x73, 0xF5, 0x78 } } } },
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEoB2IntroSeqData34Provider[] = {
+const ExtractEntrySearchData kEob2IntroAnimData34Provider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x00000058, 0x00000B43, { { 0x52, 0xB4, 0x1E, 0x14, 0x88, 0xBD, 0x8A, 0xD7, 0x38, 0xDF, 0x25, 0xB0, 0xAF, 0xAE, 0x76, 0xE1 } } } },
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEoB2IntroSeqData35Provider[] = {
+const ExtractEntrySearchData kEob2IntroAnimData35Provider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x00000037, 0x000005A4, { { 0xFB, 0x82, 0xE7, 0xB2, 0x54, 0xDB, 0xB5, 0xE1, 0xCE, 0xFB, 0xD1, 0x23, 0x39, 0x8F, 0xA1, 0x0D } } } },
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEoB2IntroSeqData36Provider[] = {
+const ExtractEntrySearchData kEob2IntroAnimData36Provider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x00000042, 0x00000572, { { 0x2C, 0x16, 0xD9, 0xBE, 0xDB, 0xBA, 0x04, 0xCA, 0x97, 0xB5, 0x88, 0x43, 0xA8, 0x62, 0xE2, 0x04 } } } },
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEoB2IntroSeqData37Provider[] = {
+const ExtractEntrySearchData kEob2IntroAnimData37Provider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x00000016, 0x0000024E, { { 0xFF, 0x28, 0xD8, 0x62, 0xC6, 0xAD, 0x48, 0xC7, 0x31, 0x84, 0x6C, 0xBA, 0x9F, 0x4D, 0x15, 0xDA } } } },
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEoB2IntroSeqData38Provider[] = {
+const ExtractEntrySearchData kEob2IntroAnimData38Provider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x000001D9, 0x00001FB1, { { 0x16, 0xB0, 0xDF, 0x86, 0x8C, 0xB3, 0x52, 0xEF, 0x21, 0x04, 0x22, 0x6D, 0xC0, 0x03, 0xB8, 0xC6 } } } },
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEoB2IntroSeqData39Provider[] = {
+const ExtractEntrySearchData kEob2IntroAnimData39Provider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x0000004D, 0x00000582, { { 0x11, 0x6C, 0xBB, 0xF6, 0x1B, 0x3C, 0xAE, 0xAA, 0x40, 0x27, 0x3F, 0x86, 0x33, 0x92, 0xCB, 0xA9 } } } },
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEoB2IntroSeqData40Provider[] = {
+const ExtractEntrySearchData kEob2IntroAnimData40Provider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x00000160, 0x000010A2, { { 0xD9, 0x9D, 0xF1, 0x7D, 0xE1, 0x7C, 0x61, 0xC0, 0xD4, 0xD3, 0x05, 0x0C, 0x79, 0xDD, 0xDB, 0xD1 } } } },
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEoB2IntroSeqData41Provider[] = {
+const ExtractEntrySearchData kEob2IntroAnimData41Provider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x00000037, 0x00000355, { { 0x92, 0x85, 0xBE, 0x5A, 0x38, 0x08, 0xF3, 0xDF, 0xC6, 0x56, 0x74, 0xC3, 0x0B, 0x3F, 0x72, 0x4D } } } },
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEoB2IntroSeqData42Provider[] = {
+const ExtractEntrySearchData kEob2IntroAnimData42Provider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x00000021, 0x0000010B, { { 0x68, 0xF8, 0x1D, 0x74, 0x6D, 0x32, 0x1E, 0x3A, 0x1C, 0xD1, 0x1D, 0x4B, 0x89, 0x3D, 0x5F, 0x2B } } } },
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEoB2IntroSeqData43Provider[] = {
+const ExtractEntrySearchData kEob2IntroAnimData43Provider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x00000037, 0x00000116, { { 0xD5, 0x46, 0xCB, 0x3F, 0x27, 0xBD, 0x2B, 0xD6, 0x35, 0x69, 0x9E, 0x0A, 0x28, 0xDA, 0xC9, 0x84 } } } },
EXTRACT_END_ENTRY
};
@@ -2959,107 +3029,107 @@ const ExtractEntrySearchData kEoB2FinaleCPSFilesProvider[] = {
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEoB2FinaleSeqData00Provider[] = {
+const ExtractEntrySearchData kEob2FinaleAnimData00Provider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x00000079, 0x00000B66, { { 0x9B, 0x8C, 0x17, 0xFA, 0xD2, 0x4F, 0x4B, 0x0E, 0x3A, 0x43, 0xB1, 0x86, 0x0C, 0xDC, 0x73, 0xAB } } } },
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEoB2FinaleSeqData01Provider[] = {
+const ExtractEntrySearchData kEob2FinaleAnimData01Provider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x00000063, 0x00000A03, { { 0xBB, 0x31, 0xEA, 0x35, 0xFB, 0x99, 0x4C, 0x3E, 0x72, 0xBD, 0x36, 0x6B, 0x5C, 0x03, 0x19, 0x7F } } } },
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEoB2FinaleSeqData02Provider[] = {
+const ExtractEntrySearchData kEob2FinaleAnimData02Provider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x0000002C, 0x000007C2, { { 0xF6, 0x83, 0x37, 0x58, 0x3C, 0x59, 0x84, 0x8F, 0x97, 0x80, 0xE2, 0xD8, 0xFD, 0x77, 0xA9, 0x54 } } } },
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEoB2FinaleSeqData03Provider[] = {
+const ExtractEntrySearchData kEob2FinaleAnimData03Provider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x00000042, 0x0000092B, { { 0x47, 0xE4, 0x34, 0xE8, 0x72, 0xCC, 0xA4, 0x4A, 0xA4, 0x8F, 0xBA, 0xBC, 0x0C, 0x04, 0x18, 0xAF } } } },
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEoB2FinaleSeqData04Provider[] = {
+const ExtractEntrySearchData kEob2FinaleAnimData04Provider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x00000058, 0x0000080B, { { 0x16, 0xDB, 0x77, 0x4C, 0x8E, 0xFD, 0x44, 0xF6, 0x5E, 0x28, 0x0B, 0x74, 0x93, 0x45, 0x8F, 0xD9 } } } },
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEoB2FinaleSeqData05Provider[] = {
+const ExtractEntrySearchData kEob2FinaleAnimData05Provider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x0000004D, 0x00000C72, { { 0x6C, 0x57, 0x56, 0x7E, 0x87, 0x10, 0x9C, 0xE7, 0x69, 0xAC, 0x3B, 0x3F, 0xF6, 0x43, 0x5C, 0xD4 } } } },
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEoB2FinaleSeqData06Provider[] = {
+const ExtractEntrySearchData kEob2FinaleAnimData06Provider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x00000016, 0x00000264, { { 0x48, 0x49, 0x5D, 0x78, 0xE2, 0xF1, 0x0D, 0x87, 0xEE, 0xEE, 0xD1, 0xA1, 0xC6, 0x64, 0xCA, 0x13 } } } },
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEoB2FinaleSeqData07Provider[] = {
+const ExtractEntrySearchData kEob2FinaleAnimData07Provider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x00000042, 0x00000ABE, { { 0xFE, 0xA9, 0x5D, 0x87, 0xAF, 0x55, 0x04, 0x92, 0x41, 0xD3, 0xAD, 0x1D, 0xFF, 0x03, 0x81, 0x3C } } } },
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEoB2FinaleSeqData08Provider[] = {
+const ExtractEntrySearchData kEob2FinaleAnimData08Provider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x00000021, 0x000004D8, { { 0x4E, 0xA7, 0xCC, 0x0B, 0x1B, 0x48, 0x22, 0x09, 0x33, 0xF7, 0x23, 0xF1, 0xF5, 0x9F, 0xA5, 0x7B } } } },
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEoB2FinaleSeqData09Provider[] = {
+const ExtractEntrySearchData kEob2FinaleAnimData09Provider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x00000058, 0x000004BE, { { 0xF6, 0xEA, 0xA0, 0x7F, 0x54, 0x61, 0x79, 0x4C, 0x71, 0xD7, 0x9B, 0xA6, 0xC3, 0x45, 0xEE, 0x3E } } } },
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEoB2FinaleSeqData10Provider[] = {
+const ExtractEntrySearchData kEob2FinaleAnimData10Provider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x0000009A, 0x00000FC4, { { 0xA9, 0xFB, 0x31, 0x55, 0xB8, 0x28, 0x63, 0xC3, 0x4B, 0x9E, 0x7D, 0x41, 0xC7, 0x1F, 0x2F, 0xBD } } } },
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEoB2FinaleSeqData11Provider[] = {
+const ExtractEntrySearchData kEob2FinaleAnimData11Provider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x000000C6, 0x0000166B, { { 0xCC, 0x16, 0x50, 0xFF, 0xFF, 0xD5, 0xAE, 0x03, 0x40, 0xA3, 0x9A, 0x1F, 0xF8, 0x8E, 0x23, 0x7A } } } },
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEoB2FinaleSeqData12Provider[] = {
+const ExtractEntrySearchData kEob2FinaleAnimData12Provider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x000000FD, 0x00001A69, { { 0x6A, 0x80, 0x89, 0x7E, 0xFC, 0xE4, 0x01, 0xF5, 0xA2, 0x11, 0xE7, 0x26, 0x20, 0x96, 0x62, 0x7B } } } },
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEoB2FinaleSeqData13Provider[] = {
+const ExtractEntrySearchData kEob2FinaleAnimData13Provider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x000000FD, 0x00001886, { { 0xF9, 0x5B, 0x62, 0xDD, 0xAB, 0x14, 0x35, 0x77, 0x53, 0x05, 0xDB, 0xC5, 0xFD, 0x4D, 0x4F, 0x12 } } } },
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEoB2FinaleSeqData14Provider[] = {
+const ExtractEntrySearchData kEob2FinaleAnimData14Provider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x00000108, 0x00001895, { { 0x22, 0xA1, 0x88, 0x69, 0xF9, 0x1C, 0xA2, 0x64, 0x44, 0xCD, 0x00, 0xFA, 0xB1, 0x94, 0xEB, 0x3A } } } },
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEoB2FinaleSeqData15Provider[] = {
+const ExtractEntrySearchData kEob2FinaleAnimData15Provider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x000000D1, 0x000016E5, { { 0xD8, 0xE9, 0xA5, 0xEE, 0x54, 0x1B, 0x3E, 0x32, 0xDA, 0x78, 0x90, 0xC2, 0x54, 0xFC, 0xD5, 0x39 } } } },
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEoB2FinaleSeqData16Provider[] = {
+const ExtractEntrySearchData kEob2FinaleAnimData16Provider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x0000008F, 0x00000C69, { { 0xBC, 0x41, 0xE5, 0xAF, 0x89, 0xE2, 0x54, 0x12, 0x9E, 0xB0, 0x5F, 0x28, 0xFF, 0x92, 0x9D, 0x89 } } } },
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEoB2FinaleSeqData17Provider[] = {
+const ExtractEntrySearchData kEob2FinaleAnimData17Provider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x000000DC, 0x0000170D, { { 0x7A, 0x7B, 0x74, 0xCB, 0x68, 0xC2, 0xFF, 0xC7, 0xBE, 0x47, 0xE9, 0x43, 0xF7, 0x15, 0x8D, 0x59 } } } },
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEoB2FinaleSeqData18Provider[] = {
+const ExtractEntrySearchData kEob2FinaleAnimData18Provider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x00000134, 0x00002651, { { 0x71, 0x26, 0x47, 0x0D, 0x7C, 0x96, 0x45, 0x0B, 0x82, 0xD0, 0x37, 0xB9, 0xD4, 0xD0, 0x84, 0xFC } } } },
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEoB2FinaleSeqData19Provider[] = {
+const ExtractEntrySearchData kEob2FinaleAnimData19Provider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x0000004D, 0x000009C3, { { 0xDA, 0x96, 0xDF, 0x16, 0xEB, 0x5D, 0x49, 0xA4, 0x3F, 0xD3, 0x31, 0xBE, 0x49, 0x72, 0xF2, 0x71 } } } },
EXTRACT_END_ENTRY
};
-const ExtractEntrySearchData kEoB2FinaleSeqData20Provider[] = {
+const ExtractEntrySearchData kEob2FinaleAnimData20Provider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x00000021, 0x000003D8, { { 0xD9, 0xC8, 0x58, 0x4B, 0x7D, 0x79, 0x86, 0xCB, 0xEB, 0x77, 0xC2, 0xD4, 0xB7, 0xB4, 0xE9, 0x6A } } } },
EXTRACT_END_ENTRY
};
@@ -3577,6 +3647,28 @@ const ExtractEntrySearchData kRpgCommonDscDoorY2Provider[] = {
EXTRACT_END_ENTRY
};
+const ExtractEntrySearchData kRpgCommonDscDoorFrameY1Provider[] = {
+ { UNK_LANG, kPlatformUnknown, { 0x00000020, 0x0000053B, { { 0xF0, 0x9E, 0xC5, 0xB1, 0xEA, 0x5A, 0x58, 0xBD, 0xAC, 0x7B, 0xB2, 0xD4, 0xFE, 0x3F, 0x4F, 0x51 } } } }, // EOB I
+ { UNK_LANG, kPlatformUnknown, { 0x00000004, 0x00000046, { { 0xD4, 0xA4, 0xEC, 0xA2, 0x99, 0xB6, 0x5E, 0x12, 0x98, 0xFF, 0xF2, 0x55, 0xC8, 0xBD, 0xC5, 0x8F } } } }, // EOB II
+ EXTRACT_END_ENTRY
+};
+
+const ExtractEntrySearchData kRpgCommonDscDoorFrameY2Provider[] = {
+ { UNK_LANG, kPlatformUnknown, { 0x00000020, 0x0000053B, { { 0xF0, 0x9E, 0xC5, 0xB1, 0xEA, 0x5A, 0x58, 0xBD, 0xAC, 0x7B, 0xB2, 0xD4, 0xFE, 0x3F, 0x4F, 0x51 } } } }, // EOB I
+ { UNK_LANG, kPlatformUnknown, { 0x00000004, 0x00000150, { { 0x49, 0x7E, 0xF4, 0xDF, 0x8D, 0x04, 0x0A, 0xCE, 0x49, 0xBB, 0xA2, 0x1D, 0x8D, 0xC2, 0x14, 0x9E } } } }, // EOB II
+ EXTRACT_END_ENTRY
+};
+
+const ExtractEntrySearchData kRpgCommonDscDoorFrameIndex1Provider[] = {
+ { UNK_LANG, kPlatformUnknown, { 0x0000000C, 0x00000058, { { 0xC9, 0xAF, 0x1F, 0x68, 0xF1, 0xDE, 0x96, 0x9B, 0x3B, 0xCB, 0x56, 0xEC, 0x2E, 0x62, 0x9A, 0x0A } } } },
+ EXTRACT_END_ENTRY
+};
+
+const ExtractEntrySearchData kRpgCommonDscDoorFrameIndex2Provider[] = {
+ { UNK_LANG, kPlatformUnknown, { 0x0000000C, 0x000000E8, { { 0x8C, 0x10, 0x56, 0xEA, 0x4D, 0x1A, 0x9C, 0xB2, 0x55, 0x54, 0xA5, 0x61, 0x1D, 0x19, 0x4E, 0x50 } } } },
+ EXTRACT_END_ENTRY
+};
+
const ExtractEntrySearchData kLoLDscDoorScaleProvider[] = {
{ UNK_LANG, kPlatformUnknown, { 0x00000010, 0x0000024C, { { 0x8D, 0x83, 0x26, 0xEE, 0xDC, 0xF7, 0x13, 0xC0, 0xAA, 0x88, 0xC2, 0xAA, 0x66, 0xA7, 0x59, 0x41 } } } },
@@ -4106,6 +4198,21 @@ const ExtractEntry extractProviders[] = {
{ kEoB1BeholderSfx, kEoB1BeholderSfxProvider },
{ kEoB1TurnUndeadString, kEoB1TurnUndeadStringProvider },
+ { kEoB1CgaMappingDefault, kEoB1CgaMappingDefaultProvider },
+ { kEoB1CgaMappingAlt, kEoB1CgaMappingAltProvider },
+ { kEoB1CgaMappingInv, kEoB1CgaMappingInvProvider },
+ { kEoB1CgaMappingItemsL, kEoB1CgaMappingItemsLProvider },
+ { kEoB1CgaMappingItemsS, kEoB1CgaMappingItemsSProvider },
+ { kEoB1CgaMappingThrown, kEoB1CgaMappingThrownProvider },
+ { kEoB1CgaMappingIcons, kEoB1CgaMappingIconsProvider },
+ { kEoB1CgaMappingDeco, kEoB1CgaMappingDecoProvider },
+ { kEoB1CgaLevelMappingIndex, kEoB1CgaLevelMappingIndexProvider },
+ { kEoB1CgaMappingLevel0, kEoB1CgaMappingLevel0Provider },
+ { kEoB1CgaMappingLevel1, kEoB1CgaMappingLevel1Provider },
+ { kEoB1CgaMappingLevel2, kEoB1CgaMappingLevel2Provider },
+ { kEoB1CgaMappingLevel3, kEoB1CgaMappingLevel3Provider },
+ { kEoB1CgaMappingLevel4, kEoB1CgaMappingLevel4Provider },
+
{ kEoB1NpcShpData, kEoB1NpcShpDataProvider },
{ kEoB1NpcSubShpIndex1, kEoB1NpcSubShpIndex1Provider },
{ kEoB1NpcSubShpIndex2, kEoB1NpcSubShpIndex2Provider },
@@ -4134,50 +4241,50 @@ const ExtractEntry extractProviders[] = {
{ kEoB2IntroStrings, kEoB2IntroStringsProvider },
{ kEoB2IntroCPSFiles, kEoB2IntroCPSFilesProvider },
- { kEoB2IntroSeqData00, kEoB2IntroSeqData00Provider },
- { kEoB2IntroSeqData01, kEoB2IntroSeqData01Provider },
- { kEoB2IntroSeqData02, kEoB2IntroSeqData02Provider },
- { kEoB2IntroSeqData03, kEoB2IntroSeqData03Provider },
- { kEoB2IntroSeqData04, kEoB2IntroSeqData04Provider },
- { kEoB2IntroSeqData05, kEoB2IntroSeqData05Provider },
- { kEoB2IntroSeqData06, kEoB2IntroSeqData06Provider },
- { kEoB2IntroSeqData07, kEoB2IntroSeqData07Provider },
- { kEoB2IntroSeqData08, kEoB2IntroSeqData08Provider },
- { kEoB2IntroSeqData09, kEoB2IntroSeqData09Provider },
- { kEoB2IntroSeqData10, kEoB2IntroSeqData10Provider },
- { kEoB2IntroSeqData11, kEoB2IntroSeqData11Provider },
- { kEoB2IntroSeqData12, kEoB2IntroSeqData12Provider },
- { kEoB2IntroSeqData13, kEoB2IntroSeqData13Provider },
- { kEoB2IntroSeqData14, kEoB2IntroSeqData14Provider },
- { kEoB2IntroSeqData15, kEoB2IntroSeqData15Provider },
- { kEoB2IntroSeqData16, kEoB2IntroSeqData16Provider },
- { kEoB2IntroSeqData17, kEoB2IntroSeqData17Provider },
- { kEoB2IntroSeqData18, kEoB2IntroSeqData18Provider },
- { kEoB2IntroSeqData19, kEoB2IntroSeqData19Provider },
- { kEoB2IntroSeqData20, kEoB2IntroSeqData20Provider },
- { kEoB2IntroSeqData21, kEoB2IntroSeqData21Provider },
- { kEoB2IntroSeqData22, kEoB2IntroSeqData22Provider },
- { kEoB2IntroSeqData23, kEoB2IntroSeqData23Provider },
- { kEoB2IntroSeqData24, kEoB2IntroSeqData24Provider },
- { kEoB2IntroSeqData25, kEoB2IntroSeqData25Provider },
- { kEoB2IntroSeqData26, kEoB2IntroSeqData26Provider },
- { kEoB2IntroSeqData27, kEoB2IntroSeqData27Provider },
- { kEoB2IntroSeqData28, kEoB2IntroSeqData28Provider },
- { kEoB2IntroSeqData29, kEoB2IntroSeqData29Provider },
- { kEoB2IntroSeqData30, kEoB2IntroSeqData30Provider },
- { kEoB2IntroSeqData31, kEoB2IntroSeqData31Provider },
- { kEoB2IntroSeqData32, kEoB2IntroSeqData32Provider },
- { kEoB2IntroSeqData33, kEoB2IntroSeqData33Provider },
- { kEoB2IntroSeqData34, kEoB2IntroSeqData34Provider },
- { kEoB2IntroSeqData35, kEoB2IntroSeqData35Provider },
- { kEoB2IntroSeqData36, kEoB2IntroSeqData36Provider },
- { kEoB2IntroSeqData37, kEoB2IntroSeqData37Provider },
- { kEoB2IntroSeqData38, kEoB2IntroSeqData38Provider },
- { kEoB2IntroSeqData39, kEoB2IntroSeqData39Provider },
- { kEoB2IntroSeqData40, kEoB2IntroSeqData40Provider },
- { kEoB2IntroSeqData41, kEoB2IntroSeqData41Provider },
- { kEoB2IntroSeqData42, kEoB2IntroSeqData42Provider },
- { kEoB2IntroSeqData43, kEoB2IntroSeqData43Provider },
+ { kEob2IntroAnimData00, kEob2IntroAnimData00Provider },
+ { kEob2IntroAnimData01, kEob2IntroAnimData01Provider },
+ { kEob2IntroAnimData02, kEob2IntroAnimData02Provider },
+ { kEob2IntroAnimData03, kEob2IntroAnimData03Provider },
+ { kEob2IntroAnimData04, kEob2IntroAnimData04Provider },
+ { kEob2IntroAnimData05, kEob2IntroAnimData05Provider },
+ { kEob2IntroAnimData06, kEob2IntroAnimData06Provider },
+ { kEob2IntroAnimData07, kEob2IntroAnimData07Provider },
+ { kEob2IntroAnimData08, kEob2IntroAnimData08Provider },
+ { kEob2IntroAnimData09, kEob2IntroAnimData09Provider },
+ { kEob2IntroAnimData10, kEob2IntroAnimData10Provider },
+ { kEob2IntroAnimData11, kEob2IntroAnimData11Provider },
+ { kEob2IntroAnimData12, kEob2IntroAnimData12Provider },
+ { kEob2IntroAnimData13, kEob2IntroAnimData13Provider },
+ { kEob2IntroAnimData14, kEob2IntroAnimData14Provider },
+ { kEob2IntroAnimData15, kEob2IntroAnimData15Provider },
+ { kEob2IntroAnimData16, kEob2IntroAnimData16Provider },
+ { kEob2IntroAnimData17, kEob2IntroAnimData17Provider },
+ { kEob2IntroAnimData18, kEob2IntroAnimData18Provider },
+ { kEob2IntroAnimData19, kEob2IntroAnimData19Provider },
+ { kEob2IntroAnimData20, kEob2IntroAnimData20Provider },
+ { kEob2IntroAnimData21, kEob2IntroAnimData21Provider },
+ { kEob2IntroAnimData22, kEob2IntroAnimData22Provider },
+ { kEob2IntroAnimData23, kEob2IntroAnimData23Provider },
+ { kEob2IntroAnimData24, kEob2IntroAnimData24Provider },
+ { kEob2IntroAnimData25, kEob2IntroAnimData25Provider },
+ { kEob2IntroAnimData26, kEob2IntroAnimData26Provider },
+ { kEob2IntroAnimData27, kEob2IntroAnimData27Provider },
+ { kEob2IntroAnimData28, kEob2IntroAnimData28Provider },
+ { kEob2IntroAnimData29, kEob2IntroAnimData29Provider },
+ { kEob2IntroAnimData30, kEob2IntroAnimData30Provider },
+ { kEob2IntroAnimData31, kEob2IntroAnimData31Provider },
+ { kEob2IntroAnimData32, kEob2IntroAnimData32Provider },
+ { kEob2IntroAnimData33, kEob2IntroAnimData33Provider },
+ { kEob2IntroAnimData34, kEob2IntroAnimData34Provider },
+ { kEob2IntroAnimData35, kEob2IntroAnimData35Provider },
+ { kEob2IntroAnimData36, kEob2IntroAnimData36Provider },
+ { kEob2IntroAnimData37, kEob2IntroAnimData37Provider },
+ { kEob2IntroAnimData38, kEob2IntroAnimData38Provider },
+ { kEob2IntroAnimData39, kEob2IntroAnimData39Provider },
+ { kEob2IntroAnimData40, kEob2IntroAnimData40Provider },
+ { kEob2IntroAnimData41, kEob2IntroAnimData41Provider },
+ { kEob2IntroAnimData42, kEob2IntroAnimData42Provider },
+ { kEob2IntroAnimData43, kEob2IntroAnimData43Provider },
{ kEoB2IntroShapes00, kEoB2IntroShapes00Provider },
{ kEoB2IntroShapes01, kEoB2IntroShapes01Provider },
{ kEoB2IntroShapes04, kEoB2IntroShapes04Provider },
@@ -4186,27 +4293,27 @@ const ExtractEntry extractProviders[] = {
{ kEoB2FinaleStrings, kEoB2FinaleStringsProvider },
{ kEoB2CreditsData, kEoB2CreditsDataProvider },
{ kEoB2FinaleCPSFiles, kEoB2FinaleCPSFilesProvider },
- { kEoB2FinaleSeqData00, kEoB2FinaleSeqData00Provider },
- { kEoB2FinaleSeqData01, kEoB2FinaleSeqData01Provider },
- { kEoB2FinaleSeqData02, kEoB2FinaleSeqData02Provider },
- { kEoB2FinaleSeqData03, kEoB2FinaleSeqData03Provider },
- { kEoB2FinaleSeqData04, kEoB2FinaleSeqData04Provider },
- { kEoB2FinaleSeqData05, kEoB2FinaleSeqData05Provider },
- { kEoB2FinaleSeqData06, kEoB2FinaleSeqData06Provider },
- { kEoB2FinaleSeqData07, kEoB2FinaleSeqData07Provider },
- { kEoB2FinaleSeqData08, kEoB2FinaleSeqData08Provider },
- { kEoB2FinaleSeqData09, kEoB2FinaleSeqData09Provider },
- { kEoB2FinaleSeqData10, kEoB2FinaleSeqData10Provider },
- { kEoB2FinaleSeqData11, kEoB2FinaleSeqData11Provider },
- { kEoB2FinaleSeqData12, kEoB2FinaleSeqData12Provider },
- { kEoB2FinaleSeqData13, kEoB2FinaleSeqData13Provider },
- { kEoB2FinaleSeqData14, kEoB2FinaleSeqData14Provider },
- { kEoB2FinaleSeqData15, kEoB2FinaleSeqData15Provider },
- { kEoB2FinaleSeqData16, kEoB2FinaleSeqData16Provider },
- { kEoB2FinaleSeqData17, kEoB2FinaleSeqData17Provider },
- { kEoB2FinaleSeqData18, kEoB2FinaleSeqData18Provider },
- { kEoB2FinaleSeqData19, kEoB2FinaleSeqData19Provider },
- { kEoB2FinaleSeqData20, kEoB2FinaleSeqData20Provider },
+ { kEob2FinaleAnimData00, kEob2FinaleAnimData00Provider },
+ { kEob2FinaleAnimData01, kEob2FinaleAnimData01Provider },
+ { kEob2FinaleAnimData02, kEob2FinaleAnimData02Provider },
+ { kEob2FinaleAnimData03, kEob2FinaleAnimData03Provider },
+ { kEob2FinaleAnimData04, kEob2FinaleAnimData04Provider },
+ { kEob2FinaleAnimData05, kEob2FinaleAnimData05Provider },
+ { kEob2FinaleAnimData06, kEob2FinaleAnimData06Provider },
+ { kEob2FinaleAnimData07, kEob2FinaleAnimData07Provider },
+ { kEob2FinaleAnimData08, kEob2FinaleAnimData08Provider },
+ { kEob2FinaleAnimData09, kEob2FinaleAnimData09Provider },
+ { kEob2FinaleAnimData10, kEob2FinaleAnimData10Provider },
+ { kEob2FinaleAnimData11, kEob2FinaleAnimData11Provider },
+ { kEob2FinaleAnimData12, kEob2FinaleAnimData12Provider },
+ { kEob2FinaleAnimData13, kEob2FinaleAnimData13Provider },
+ { kEob2FinaleAnimData14, kEob2FinaleAnimData14Provider },
+ { kEob2FinaleAnimData15, kEob2FinaleAnimData15Provider },
+ { kEob2FinaleAnimData16, kEob2FinaleAnimData16Provider },
+ { kEob2FinaleAnimData17, kEob2FinaleAnimData17Provider },
+ { kEob2FinaleAnimData18, kEob2FinaleAnimData18Provider },
+ { kEob2FinaleAnimData19, kEob2FinaleAnimData19Provider },
+ { kEob2FinaleAnimData20, kEob2FinaleAnimData20Provider },
{ kEoB2FinaleShapes00, kEoB2FinaleShapes00Provider },
{ kEoB2FinaleShapes03, kEoB2FinaleShapes03Provider },
{ kEoB2FinaleShapes07, kEoB2FinaleShapes07Provider },
@@ -4297,6 +4404,10 @@ const ExtractEntry extractProviders[] = {
{ kLoLDscOvlIndex, kLoLDscOvlIndexProvider },
{ kRpgCommonDscBlockIndex, kRpgCommonDscBlockIndexProvider },
{ kRpgCommonDscDoorY2, kRpgCommonDscDoorY2Provider },
+ { kRpgCommonDscDoorFrameY1, kRpgCommonDscDoorFrameY1Provider },
+ { kRpgCommonDscDoorFrameY2, kRpgCommonDscDoorFrameY2Provider },
+ { kRpgCommonDscDoorFrameIndex1, kRpgCommonDscDoorFrameIndex1Provider },
+ { kRpgCommonDscDoorFrameIndex2, kRpgCommonDscDoorFrameIndex2Provider },
{ kLoLDscDoorScale, kLoLDscDoorScaleProvider },
{ kLoLDscDoor4, kLoLDscDoor4Provider },
{ kLoLDscDoorX, kLoLDscDoorXProvider },
diff --git a/devtools/create_kyradat/util.cpp b/devtools/create_kyradat/util.cpp
index 2420f44168..5ce8237b85 100644
--- a/devtools/create_kyradat/util.cpp
+++ b/devtools/create_kyradat/util.cpp
@@ -54,6 +54,19 @@ void warning(const char *s, ...) {
fprintf(stderr, "WARNING: %s!\n", buf);
}
+int scumm_stricmp(const char *s1, const char *s2) {
+ byte l1, l2;
+ do {
+ // Don't use ++ inside tolower, in case the macro uses its
+ // arguments more than once.
+ l1 = (byte)*s1++;
+ l1 = tolower(l1);
+ l2 = (byte)*s2++;
+ l2 = tolower(l2);
+ } while (l1 == l2 && l1 != 0);
+ return l1 - l2;
+}
+
void debug(int level, const char *s, ...) {
char buf[1024];
va_list va;
diff --git a/devtools/create_kyradat/util.h b/devtools/create_kyradat/util.h
index 0d8e15cc37..a2783cca71 100644
--- a/devtools/create_kyradat/util.h
+++ b/devtools/create_kyradat/util.h
@@ -50,6 +50,7 @@ uint32 fileSize(FILE *fp);
void NORETURN_PRE error(const char *s, ...) NORETURN_POST;
void warning(const char *s, ...);
void debug(int level, const char *s, ...);
+int scumm_stricmp(const char *s1, const char *s2);
using namespace Common;
diff --git a/devtools/create_translations/cp_parser.cpp b/devtools/create_translations/cp_parser.cpp
new file mode 100644
index 0000000000..a4202bf153
--- /dev/null
+++ b/devtools/create_translations/cp_parser.cpp
@@ -0,0 +1,104 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * 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.
+ *
+ * This is a utility for create the translations.dat file from all the po files.
+ * The generated files is used by ScummVM to propose translation of its GUI.
+ */
+
+#include "cp_parser.h"
+
+#include <fstream>
+#include <stdio.h>
+
+Codepage::Codepage(const std::string &name, const uint32 *mapping) : _name(name) {
+ if (!mapping) {
+ // Default to a ISO-8859-1 mapping
+ for (unsigned int i = 0; i < 256; ++i)
+ _mapping[i] = i;
+ } else {
+ for (unsigned int i = 0; i < 256; ++i)
+ _mapping[i] = *mapping++;
+ }
+}
+
+Codepage *parseCodepageMapping(const std::string &filename) {
+ size_t start = filename.find_last_of("/\\");
+ if (start == std::string::npos)
+ start = 0;
+ // Strip off the filename extension
+ const size_t pos = filename.find_last_of('.');
+ const std::string charset(filename.substr(start + 1, pos != std::string::npos ? (pos - start - 1) : std::string::npos));
+
+ std::ifstream in(filename.c_str());
+ if (!in) {
+ fprintf(stderr, "ERROR: Could not open file \"%s\"!", filename.c_str());
+ return 0;
+ }
+
+ uint32 mapping[256];
+
+ int processedMappings = 0;
+ std::string line;
+ while (processedMappings < 256) {
+ std::getline(in, line);
+ if (in.eof())
+ break;
+ if (in.fail()) {
+ fprintf(stderr, "ERROR: Reading from file \"%s\" failed!", filename.c_str());
+ return 0;
+ }
+
+ // In case the line starts with a "#" it is a comment. We also ignore
+ // empty lines.
+ if (line.empty() || line[0] == '#')
+ continue;
+
+ // Read the unicode number, we thereby ignore everything else on the line
+ int unicode, required;
+ const int parsed = sscanf(line.c_str(), "%d %d", &unicode, &required);
+ if (parsed < 1 || parsed > 2) {
+ fprintf(stderr, "ERROR: Line \"%s\" is malformed!", filename.c_str());
+ return 0;
+ }
+ // In case no required integer was given, we assume the character is
+ // required
+ if (parsed == 1)
+ required = 1;
+
+ // -1 means default mapping
+ if (unicode == -1)
+ unicode = processedMappings;
+
+ uint32 unicodeValue = unicode;
+ if (required)
+ unicodeValue |= 0x80000000;
+
+ mapping[processedMappings++] = (uint32)unicodeValue;
+ }
+
+ // Check whether all character encodings are mapped, if not error out
+ if (processedMappings != 256) {
+ fprintf(stderr, "ERROR: File \"%s\" does not contain mappings for exactly 256 characters!", filename.c_str());
+ return 0;
+ }
+
+ // Return the codepage
+ return new Codepage(charset, mapping);
+}
diff --git a/devtools/create_translations/cp_parser.h b/devtools/create_translations/cp_parser.h
new file mode 100644
index 0000000000..b748430ca0
--- /dev/null
+++ b/devtools/create_translations/cp_parser.h
@@ -0,0 +1,54 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * 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.
+ *
+ * This is a utility for create the translations.dat file from all the po files.
+ * The generated files is used by ScummVM to propose translation of its GUI.
+ */
+
+#ifndef CP_PARSER_H
+#define CP_PARSER_H
+
+#include "create_translations.h"
+
+#include <string>
+
+/**
+ * Codepage description.
+ *
+ * This includes a name, and the codepage -> unicode mapping.
+ */
+class Codepage {
+public:
+ Codepage(const std::string &name, const uint32 *mapping);
+
+ const std::string &getName() const { return _name; }
+
+ uint32 getMapping(unsigned char src) const { return _mapping[src]; }
+private:
+ std::string _name;
+ uint32 _mapping[256];
+};
+
+/**
+ * Parse the codepage file and create a codepage.
+ */
+Codepage *parseCodepageMapping(const std::string &filename);
+
+#endif
diff --git a/devtools/create_translations/create_translations.cpp b/devtools/create_translations/create_translations.cpp
index 9fcf3b4a31..a153632c47 100644
--- a/devtools/create_translations/create_translations.cpp
+++ b/devtools/create_translations/create_translations.cpp
@@ -25,6 +25,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <ctype.h>
+#include <vector>
// HACK to allow building with the SDL backend on MinGW
// see bug #1800764 "TOOLS: MinGW tools building broken"
@@ -34,8 +36,23 @@
#include "create_translations.h"
#include "po_parser.h"
+#include "cp_parser.h"
-#define TRANSLATIONS_DAT_VER 2 // 1 byte
+#define TRANSLATIONS_DAT_VER 3 // 1 byte
+
+// Portable implementation of stricmp / strcasecmp / strcmpi.
+int scumm_stricmp(const char *s1, const char *s2) {
+ uint8 l1, l2;
+ do {
+ // Don't use ++ inside tolower, in case the macro uses its
+ // arguments more than once.
+ l1 = (uint8)*s1++;
+ l1 = tolower(l1);
+ l2 = (uint8)*s2++;
+ l2 = tolower(l2);
+ } while (l1 == l2 && l1 != 0);
+ return l1 - l2;
+}
// Padding buffer (filled with 0) used if we want to aligned writes
// static uint8 padBuf[DATAALIGNMENT];
@@ -52,6 +69,13 @@ void writeUint16BE(FILE *fp, uint16 value) {
writeByte(fp, (uint8)(value & 0xFF));
}
+void writeUint32BE(FILE *fp, uint32 value) {
+ writeByte(fp, (uint8)(value >> 24));
+ writeByte(fp, (uint8)(value >> 16));
+ writeByte(fp, (uint8)(value >> 8));
+ writeByte(fp, (uint8)(value & 0xFF));
+}
+
int stringSize(const char *string) {
// Each string is preceded by its size coded on 2 bytes
if (string == NULL)
@@ -82,14 +106,51 @@ void writeString(FILE *fp, const char *string) {
// Main
int main(int argc, char *argv[]) {
- // Build the translation list
+ std::vector<Codepage *> codepages;
+ // Add default codepages, we won't store them in the output later on
+ codepages.push_back(new Codepage("ascii", 0));
+ codepages.push_back(new Codepage("iso-8859-1", 0));
+
+ // Build the translation and codepage list
PoMessageList messageIds;
- PoMessageEntryList **translations = new PoMessageEntryList*[argc - 1];
+ std::vector<PoMessageEntryList *> translations;
int numLangs = 0;
for (int i = 1; i < argc; ++i) {
- translations[numLangs] = parsePoFile(argv[i], messageIds);
- if (translations[numLangs] != NULL)
- ++numLangs;
+ // Check file extension
+ int len = strlen(argv[i]);
+ if (scumm_stricmp(argv[i] + len - 2, "po") == 0) {
+ PoMessageEntryList *po = parsePoFile(argv[i], messageIds);
+ if (po != NULL) {
+ translations.push_back(po);
+ ++numLangs;
+ }
+ } else if (scumm_stricmp(argv[i] + len - 2, "cp") == 0) {
+ // Else try to parse an codepage
+ Codepage *co = parseCodepageMapping(argv[i]);
+ if (co)
+ codepages.push_back(co);
+ }
+ }
+
+ // Parse all charset mappings
+ for (int i = 0; i < numLangs; ++i) {
+ bool found = false;
+ for (size_t j = 0; j < codepages.size(); ++j) {
+ if (scumm_stricmp(codepages[j]->getName().c_str(), translations[i]->charset()) == 0) {
+ found = true;
+ break;
+ }
+ }
+
+ // In case the codepage was not found error out
+ if (!found) {
+ fprintf(stderr, "ERROR: No codepage mapping for codepage \"%s\" present!\n", translations[i]->charset());
+ for (size_t j = 0; j < translations.size(); ++j)
+ delete translations[j];
+ for (size_t j = 0; j < codepages.size(); ++j)
+ delete codepages[j];
+ return -1;
+ }
}
FILE *outFile;
@@ -110,6 +171,8 @@ int main(int argc, char *argv[]) {
// Write number of translations
writeUint16BE(outFile, numLangs);
+ // Write number of codepages, we don't save ascii and iso-8859-1
+ writeUint16BE(outFile, codepages.size() - 2);
// Write the length of each data block here.
// We could write it at the start of each block but that would mean that
@@ -119,9 +182,14 @@ int main(int argc, char *argv[]) {
// file and can then skip to the block we want.
// Blocks are:
// 1. List of languages with the language name
- // 2. Original messages (i.e. english)
- // 3. First translation
- // 4. Second translation
+ // 2. List of codepages
+ // 3. Original messages (i.e. english)
+ // 4. First translation
+ // 5. Second translation
+ // ...
+ // n. First codepage (These don't have any data size, since they are all
+ // 256 * 4 bytes long)
+ // n+1. Second codepage
// ...
// Write length for translation description
@@ -132,6 +200,12 @@ int main(int argc, char *argv[]) {
}
writeUint16BE(outFile, len);
+ // Write length for the codepage names
+ len = 0;
+ for (size_t j = 2; j < codepages.size(); ++j)
+ len += stringSize(codepages[j]->getName().c_str());
+ writeUint16BE(outFile, len);
+
// Write size for the original language (english) block
// It starts with the number of strings coded on 2 bytes followed by each
// string (two bytes for the number of chars and the string itself).
@@ -159,6 +233,11 @@ int main(int argc, char *argv[]) {
writeString(outFile, translations[lang]->languageName());
}
+ // Write list of codepages
+ for (size_t j = 2; j < codepages.size(); ++j) {
+ writeString(outFile, codepages[j]->getName().c_str());
+ }
+
// Write original messages
writeUint16BE(outFile, messageIds.size());
for (i = 0; i < messageIds.size(); ++i) {
@@ -176,12 +255,18 @@ int main(int argc, char *argv[]) {
}
}
+ // Write codepages
+ for (size_t j = 2; j < codepages.size(); ++j) {
+ const Codepage *cp = codepages[j];
+ for (i = 0; i < 256; ++i)
+ writeUint32BE(outFile, cp->getMapping(i));
+ }
+
fclose(outFile);
// Clean the memory
for (i = 0; i < numLangs; ++i)
delete translations[i];
- delete[] translations;
return 0;
}
diff --git a/devtools/create_translations/create_translations.h b/devtools/create_translations/create_translations.h
index 0ece8102f0..9ccbd39b2b 100644
--- a/devtools/create_translations/create_translations.h
+++ b/devtools/create_translations/create_translations.h
@@ -25,6 +25,7 @@
typedef unsigned char uint8;
typedef unsigned short uint16;
+typedef unsigned int uint32;
typedef signed short int16;
#endif /* CREATE_TRANSLATIONS_H */
diff --git a/devtools/create_translations/module.mk b/devtools/create_translations/module.mk
index 430cf91976..9a2b302aef 100644
--- a/devtools/create_translations/module.mk
+++ b/devtools/create_translations/module.mk
@@ -1,6 +1,7 @@
MODULE := devtools/create_translations
MODULE_OBJS := \
+ cp_parser.o \
po_parser.o \
create_translations.o
diff --git a/devtools/credits.pl b/devtools/credits.pl
index 86ba7412fa..8330450984 100755
--- a/devtools/credits.pl
+++ b/devtools/credits.pl
@@ -616,6 +616,7 @@ begin_credits("Credits");
begin_section("SAGA");
add_person("Torbj&ouml;rn Andersson", "eriktorbjorn", "");
+ add_person("Daniel Balsom", "DanielFox", "Original engine reimplementation author (retired)");
add_person("Filippos Karapetis", "[md5]", "");
add_person("Andrew Kurushin", "ajax16384", "");
add_person("Eugene Sandulenko", "sev", "");
@@ -1000,6 +1001,7 @@ begin_credits("Credits");
add_person("Edward Rudd", "urkle", "Fixes for playing MP3 versions of MI1/Loom audio");
add_person("Daniel Schepler", "dschepler", "Final MI1 CD music support, initial Ogg Vorbis support");
add_person("Andr&eacute; Souza", "luke_br", "SDL-based OpenGL renderer");
+ add_person("Tom Frost", "TomFrost", "WebOS port contributions");
end_persons();
end_section();
@@ -1058,6 +1060,7 @@ begin_credits("Credits");
begin_section("Special thanks to");
begin_persons();
+ add_person("Daniel Balsom", "DanielFox", "For the original Reinherit (SAGA) code");
add_person("Sander Buskens", "", "For his work on the initial reversing of Monkey2");
add_person("", "Canadacow", "For the original MT-32 emulator");
add_person("Kevin Carnes", "", "For Scumm16, the basis of ScummVM's older gfx codecs");
diff --git a/devtools/scumm-md5.txt b/devtools/scumm-md5.txt
index 4837b315b7..5bbf6726a5 100644
--- a/devtools/scumm-md5.txt
+++ b/devtools/scumm-md5.txt
@@ -235,11 +235,15 @@ monkey The Secret of Monkey Island
pass Passport to Adventure
e6cd81b25ab1453a8a6d3482118c391e 7857 en DOS - - v1.0 9/14/90 Fingolfin
-zak Misc FM-TOWNS demos
+indyloom Indiana Jones and the Last Crusade & Loom non-interactive demo
2d388339d6050d8ccaa757b64633954e 7520 en FM-TOWNS FM-TOWNS Demo indy/loom (non-interactive) khalek
- 77f5c9cc0986eb729c1a6b4c8823bbae 7520 en FM-TOWNS FM-TOWNS Demo zak/loom (non-interactive) khalek, Fingolfin
+
+indyzak Indiana Jones and the Last Crusade & Zak McKracken non-interactive demo
3938ee1aa4433fca9d9308c9891172b1 7520 en FM-TOWNS FM-TOWNS Demo indy/zak (non-interactive) khalek
+zakloom Zak McKracken & Loom non-interactive demo
+ 77f5c9cc0986eb729c1a6b4c8823bbae 7520 en FM-TOWNS FM-TOWNS Demo zak/loom (non-interactive) khalek, Fingolfin
+
monkey2 Monkey Island 2: LeChuck's Revenge
132bff65e6367c09cc69318ce1b59333 11155 en Amiga - - v1.0 4/8/92 Fingolfin
c30ef068add4277104243c31ce46c12b -1 fr Amiga - - - Andreas Bylund
@@ -513,7 +517,7 @@ freddi2 Freddi Fish 2: The Case of the Haunted Schoolhouse
8ee63cafb1fe9d62aa0d5a23117e70e7 -1 us All HE 100 Updated - Kirben
e41de1c2a15abbcdbf9977e2d7e8a340 -1 ru Windows HE 100 Updated - sev
- c20848f53c2d48bfacdc840993843765 -1 nl Windows HE 80 Demo - DarthBo
+ c20848f53c2d48bfacdc840993843765 -1 nl All HE 80 Demo - DarthBo
fc8d197a22146e74766e9cb0cfcaf1da 27298 en All HE 80 Demo - khalek, sev
d37c55388294b66e53e7ced3af88fa68 -1 en All HE 100 Updated Demo - khalek
@@ -526,10 +530,11 @@ freddi3 Freddi Fish 3: The Case of the Stolen Conch Shell
78c07ca088526d8d4446a4c2cb501203 -1 fr All HE 99 - - alamaz, gist974
83cedbe26aa8b58988e984e3d34cac8e -1 de All HE 99 - - Joachim Eberhard
75bff95816b84672b877d22a911ab811 -1 ru Windows HE 99 Updated - sev
+ 0ddf1174d0d097956ba10dd452ea65e6 -1 he Windows HE 99 - - Matan Bareket
cb1559e8405d17a5a278a6b5ad9338d1 22718 en All - Demo - khalek, sev
bbadf7309c4a2c2763e4bbba3c3be634 -1 fr All - Demo - Kirben
- 754feb59d3bf86b8a00840df74fd7b26 -1 nl Windows - Demo - adutchguy
+ 754feb59d3bf86b8a00840df74fd7b26 -1 nl All - Demo - adutchguy
ed2b074bc3166087a747acb2a3c6abb0 -1 de All HE 98.5 Demo - Joachim Eberhard
d73c851b942af44deb9b6d5f416a0972 -1 he Windows HE 99 Demo - Ori Avtalion
@@ -645,6 +650,7 @@ pajama2 Pajama Sam 2: Thunder and Lightning Aren't so Frightening
c6907d44f1166941d982864cd42cdc89 -1 de All HE 99 - - nachbarnebenan
f8be685007a8b425ba2a455da732f59f -1 fr Mac HE 99 - - alamaz
32709cbeeb3044b34129950860a83f14 -1 ru Windows HE 99 - - sev
+ 1af4eb581a33d808707d66d50e084dca -1 he Windows HE 99 - - Matan Bareket
36a6750e03fb505fc19fc2bf3e4dbe91 58749 en All - Demo - sev
30ba1e825d4ad2b448143ae8df18482a -1 nl All HE 98.5 Demo - Kirben
@@ -729,6 +735,7 @@ puttcircus Putt-Putt Joins the Circus
db74136c20557eca6ed3411bff39f7a1 -1 gb Windows - - - Reckless
d0ad929def3e9cfe39dea55bd12098d4 -1 fr Windows - - - gist974
febf4a983ea5faea1c9dd6c710ebb09c -1 de Windows - - - andy482
+ c8253da0f4626d2236b5291b99e33408 -1 he Windows HE 99 - - Matan Bareket
a7cacad9c40c4dc9e1812abf6c8af9d5 -1 en All - Demo - Kirben, sev
1387d16aa620dc1c2d1fd87f8a9e7a09 -1 fr Windows - Demo - Mevi
@@ -784,7 +791,7 @@ PuttTime Putt-Putt Travels Through Time
4e5867848ee61bc30d157e2c94eee9b4 18394 us All HE 90 Demo - khalek, sev
59d5cfcc5e672a6e07baae01328b918b -1 fr All HE 90 Demo - Kirben
fbb697d89d2beca87360a145f467bdae -1 de All HE 90 Demo - Joachim Eberhard
- 6b19d0e25cbf720d05822379b8b90ed9 -1 nl Windows HE 90 Demo - adutchguy
+ 6b19d0e25cbf720d05822379b8b90ed9 -1 nl All HE 90 Demo - adutchguy
0a6d7b81b850ed4a77811c60c9b5c555 -1 us Windows HE 99 Mini Game - eriktorbjorn
0ab19be9e2a3f6938226638b2a3744fe -1 us All HE 100 Demo - khalek
diff --git a/devtools/skycpt/AsciiCptCompile.cpp b/devtools/skycpt/AsciiCptCompile.cpp
index 154c13b8cd..f339f6816c 100644
--- a/devtools/skycpt/AsciiCptCompile.cpp
+++ b/devtools/skycpt/AsciiCptCompile.cpp
@@ -49,7 +49,7 @@ void doCompile(FILE *inf, FILE *debOutf, FILE *resOutf, TextFile *cptDef, FILE *
int main(int argc, char* argv[])
{
uint8 testBuf[4] = { 0x11, 0x22, 0x33, 0x44 };
- if (*(uint32*)testBuf != 0x44332211) {
+ if (*(uint32 *)testBuf != 0x44332211) {
printf("Sorry, this program only works on little endian systems.\nGoodbye.\n");
return 0;
}
diff --git a/devtools/skycpt/TextFile.cpp b/devtools/skycpt/TextFile.cpp
index e9887dc87b..038b1b9329 100644
--- a/devtools/skycpt/TextFile.cpp
+++ b/devtools/skycpt/TextFile.cpp
@@ -60,7 +60,7 @@ char *TextFile::giveLine(uint32 num) {
}
void TextFile::read(FILE *inf) {
- char *line = (char*)malloc(4096);
+ char *line = (char *)malloc(4096);
_lines = (char**)malloc(4096 * sizeof(char *));
_numLines = 0;
uint32 linesMax = 4096;
@@ -78,7 +78,7 @@ void TextFile::read(FILE *inf) {
start++;
}
uint32 length = crop(start);
- _lines[_numLines] = (char*)malloc(length + 1);
+ _lines[_numLines] = (char *)malloc(length + 1);
memcpy(_lines[_numLines], start, length + 1);
_numLines++;
}
diff --git a/devtools/skycpt/cptcompiler.cpp b/devtools/skycpt/cptcompiler.cpp
index f6ee926075..2c7d33c73b 100644
--- a/devtools/skycpt/cptcompiler.cpp
+++ b/devtools/skycpt/cptcompiler.cpp
@@ -50,7 +50,7 @@ void processMainLists(FILE *inf, CptObj *destArr, uint16 *idList) {
char line[1024];
dofgets(line, 1024, inf);
assert(lineMatchSection(line, "MAINLISTS"));
- uint16 *resBuf = (uint16*)malloc(MAX_OBJ_SIZE);
+ uint16 *resBuf = (uint16 *)malloc(MAX_OBJ_SIZE);
uint32 idNum = 0;
do {
dofgets(line, 1024, inf);
@@ -60,7 +60,7 @@ void processMainLists(FILE *inf, CptObj *destArr, uint16 *idList) {
CptObj *dest = destArr + id;
assertEmpty(dest);
dest->type = MAINLIST;
- dest->dbgName = (char*)malloc(strlen(cptName) + 1);
+ dest->dbgName = (char *)malloc(strlen(cptName) + 1);
strcpy(dest->dbgName, cptName);
memset(resBuf, 0, MAX_OBJ_SIZE);
uint32 resPos = 0;
@@ -82,7 +82,7 @@ void processMainLists(FILE *inf, CptObj *destArr, uint16 *idList) {
} while (1);
assert(resPos < (MAX_OBJ_SIZE / 2));
dest->len = resPos;
- dest->data = (uint16*)malloc(resPos * 2);
+ dest->data = (uint16 *)malloc(resPos * 2);
memcpy(dest->data, resBuf, resPos * 2);
} else
break;
@@ -95,7 +95,7 @@ void processCpts(FILE *inf, CptObj *destArr) {
char line[1024];
dofgets(line, 1024, inf);
assert(lineMatchSection(line, "COMPACTS"));
- uint16 *resBuf = (uint16*)malloc(MAX_OBJ_SIZE);
+ uint16 *resBuf = (uint16 *)malloc(MAX_OBJ_SIZE);
do {
dofgets(line, 1024, inf);
if (!isEndOfSection(line)) {
@@ -103,7 +103,7 @@ void processCpts(FILE *inf, CptObj *destArr) {
uint16 id = getInfo(line, "COMPACT", cptName);
CptObj *dest = destArr + id;
assertEmpty(dest);
- dest->dbgName = (char*)malloc(strlen(cptName) + 1);
+ dest->dbgName = (char *)malloc(strlen(cptName) + 1);
dest->type = COMPACT;
strcpy(dest->dbgName, cptName);
memset(resBuf, 0, MAX_OBJ_SIZE);
@@ -134,7 +134,7 @@ void processCpts(FILE *inf, CptObj *destArr) {
} while (1);
assert(resPos < (MAX_OBJ_SIZE / 2));
dest->len = resPos;
- dest->data = (uint16*)malloc(resPos * 2);
+ dest->data = (uint16 *)malloc(resPos * 2);
memcpy(dest->data, resBuf, resPos * 2);
} else
break;
@@ -147,7 +147,7 @@ void processTurntabs(FILE *inf, CptObj *destArr) {
char line[1024];
dofgets(line, 1024, inf);
assert(lineMatchSection(line, "TURNTABS"));
- uint16 *resBuf = (uint16*)malloc(MAX_OBJ_SIZE);
+ uint16 *resBuf = (uint16 *)malloc(MAX_OBJ_SIZE);
do {
dofgets(line, 1024, inf);
if (!isEndOfSection(line)) {
@@ -155,7 +155,7 @@ void processTurntabs(FILE *inf, CptObj *destArr) {
uint16 id = getInfo(line, "TURNTAB", cptName);
CptObj *dest = destArr + id;
assertEmpty(dest);
- dest->dbgName = (char*)malloc(strlen(cptName) + 1);
+ dest->dbgName = (char *)malloc(strlen(cptName) + 1);
dest->type = TURNTAB;
strcpy(dest->dbgName, cptName);
memset(resBuf, 0, MAX_OBJ_SIZE);
@@ -176,7 +176,7 @@ void processTurntabs(FILE *inf, CptObj *destArr) {
} while (1);
assert(resPos < (MAX_OBJ_SIZE / 2));
dest->len = resPos;
- dest->data = (uint16*)malloc(resPos * 2);
+ dest->data = (uint16 *)malloc(resPos * 2);
memcpy(dest->data, resBuf, resPos * 2);
} else
break;
@@ -189,7 +189,7 @@ void processBins(FILE *inf, CptObj *destArr, const char *typeName, const char *o
char line[1024];
dofgets(line, 1024, inf);
assert(lineMatchSection(line, typeName));
- uint16 *resBuf = (uint16*)malloc(MAX_OBJ_SIZE);
+ uint16 *resBuf = (uint16 *)malloc(MAX_OBJ_SIZE);
do {
dofgets(line, 1024, inf);
if (!isEndOfSection(line)) {
@@ -197,7 +197,7 @@ void processBins(FILE *inf, CptObj *destArr, const char *typeName, const char *o
uint16 id = getInfo(line, objName, cptName);
CptObj *dest = destArr + id;
assertEmpty(dest);
- dest->dbgName = (char*)malloc(strlen(cptName) + 1);
+ dest->dbgName = (char *)malloc(strlen(cptName) + 1);
dest->type = cTypeId;
strcpy(dest->dbgName, cptName);
memset(resBuf, 0, MAX_OBJ_SIZE);
@@ -218,7 +218,7 @@ void processBins(FILE *inf, CptObj *destArr, const char *typeName, const char *o
} while (1);
assert(resPos < (MAX_OBJ_SIZE / 2));
dest->len = resPos;
- dest->data = (uint16*)malloc(resPos * 2);
+ dest->data = (uint16 *)malloc(resPos * 2);
memcpy(dest->data, resBuf, resPos * 2);
} else
break;
@@ -242,7 +242,7 @@ void processSymlinks(FILE *inf, CptObj *destArr, uint16 *baseLists) {
uint16 fromId = getInfo(line, "SYMLINK", cptName);
CptObj *from = destArr + fromId;
assertEmpty(from);
- dlinkNames[dlinkCount] = (char*)malloc(strlen(cptName) + 1);
+ dlinkNames[dlinkCount] = (char *)malloc(strlen(cptName) + 1);
strcpy(dlinkNames[dlinkCount], cptName);
dofgets(line, 1024, inf);
@@ -272,7 +272,7 @@ void doCompile(FILE *inf, FILE *debOutf, FILE *resOutf, TextFile *cptDef, FILE *
CptObj *resCpts;
uint16 baseLists[NUM_DATA_LISTS];
memset(baseLists, 0, NUM_DATA_LISTS * 2);
- resCpts = (CptObj*)malloc(MAX_CPTS * sizeof(CptObj));
+ resCpts = (CptObj *)malloc(MAX_CPTS * sizeof(CptObj));
memset(resCpts, 0, MAX_CPTS * sizeof(CptObj));
printf(" MainLists...\n");
processMainLists(inf, resCpts, baseLists);
@@ -323,7 +323,7 @@ void doCompile(FILE *inf, FILE *debOutf, FILE *resOutf, TextFile *cptDef, FILE *
fwrite(&binSize, 1, 4, debOutf);
fwrite(&binSize, 1, 4, resOutf);
- char *asciiBuf = (char*)malloc(ASCII_SIZE);
+ char *asciiBuf = (char *)malloc(ASCII_SIZE);
char *asciiPos = asciiBuf;
// now process all the compacts
@@ -491,7 +491,7 @@ void doCompile(FILE *inf, FILE *debOutf, FILE *resOutf, TextFile *cptDef, FILE *
assert((ftell(res288) / 2) < 65536);
uint16 resSize = (uint16)(ftell(res288) / 2);
fseek(res288, 0, SEEK_SET);
- uint16 *buf288 = (uint16*)malloc(resSize * 2);
+ uint16 *buf288 = (uint16 *)malloc(resSize * 2);
fread(buf288, 2, resSize, res288);
fclose(res288);
fwrite(&resSize, 1, 2, debOutf);
@@ -514,7 +514,7 @@ void doCompile(FILE *inf, FILE *debOutf, FILE *resOutf, TextFile *cptDef, FILE *
fseek(resDiff, 0, SEEK_END);
assert(ftell(resDiff) == (resSize * 2));
fseek(resDiff, 0, SEEK_SET);
- uint16 *bufDif = (uint16*)malloc(resSize *2);
+ uint16 *bufDif = (uint16 *)malloc(resSize *2);
fread(bufDif, 2, resSize, resDiff);
fclose(resDiff);
for (uint16 eCnt = 0; eCnt < resSize; eCnt++)
diff --git a/devtools/update-version.pl b/devtools/update-version.pl
index 169fba7788..b313846ab3 100755
--- a/devtools/update-version.pl
+++ b/devtools/update-version.pl
@@ -43,6 +43,12 @@ my @subs_files = qw(
dists/wii/meta.xml
dists/android/AndroidManifest.xml
dists/android/plugin-manifest.xml
+ dists/openpandora/PXML.xml
+ dists/openpandora/README-OPENPANDORA
+ dists/openpandora/README-PND.txt
+ dists/openpandora/index.html
+ dists/gph/README-GPH
+ dists/gph/scummvm.ini
backends/platform/psp/README.PSP
);
diff --git a/dists/debian/copyright b/dists/debian/copyright
index e0885ae9e6..318c06f62b 100644
--- a/dists/debian/copyright
+++ b/dists/debian/copyright
@@ -7,7 +7,7 @@ It was downloaded from <http://www.scummvm.org/>.
Upstream Authors: see `/usr/share/doc/scummvm/AUTHORS'.
-Scummvm is Copyright ТЉ 2002-2010 The ScummVM Project
+Scummvm is Copyright ТЉ 2002-2012 The ScummVM Project
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
diff --git a/dists/engine-data/kyra.dat b/dists/engine-data/kyra.dat
index 7fd8be0641..c89b21cbca 100644
--- a/dists/engine-data/kyra.dat
+++ b/dists/engine-data/kyra.dat
Binary files differ
diff --git a/backends/platform/gph/devices/common/README-GPH b/dists/gph/README-GPH
index ea196f6649..29f0175306 100644
--- a/backends/platform/gph/devices/common/README-GPH
+++ b/dists/gph/README-GPH
@@ -1,4 +1,5 @@
-ScummVM - GPH DEVICE SPECIFIC README
+ScummVM 1.5.0git - GPH DEVICE SPECIFIC README
+
------------------------------------------------------------------------
Contents:
diff --git a/dists/gph/README-GPH.in b/dists/gph/README-GPH.in
new file mode 100644
index 0000000000..31ec3e4041
--- /dev/null
+++ b/dists/gph/README-GPH.in
@@ -0,0 +1,61 @@
+ScummVM @VERSION@ - GPH DEVICE SPECIFIC README
+
+------------------------------------------------------------------------
+
+Contents:
+
+ * About the backend/port <#About_the_backendport>
+ * Supported audio options <#Supported_audio_options>
+ * Credits <#Credits>
+
+------------------------------------------------------------------------
+
+Please refer to the:
+
+GPH ScummVM Forum: <http://forums.scummvm.org/viewforum.php?f=14>
+
+WiKi: (Select your device)
+
+<http://wiki.scummvm.org/index.php/GP2X>
+<http://wiki.scummvm.org/index.php/GP2XWiz>
+<http://wiki.scummvm.org/index.php/Caanoo>
+
+for the most current information on the port and any updates to this
+documentation.
+
+The wiki includes detailed instructions on how to use the port and
+control information.
+
+------------------------------------------------------------------------
+About the backend/port
+
+This is the readme for the official GPH ScummVM backend (also known as
+the GP2X port/GP2XWiz port or Caanoo port).
+
+This is an SVN test release of ScummVM for GPH devices, it would be
+appreciated if this SVN test distribution was not mirrored and that
+people be directed to http://scummvm.distant-earth.com/ instead for
+updated SVN builds.
+
+Fully supported official releases of the GPH ScummVM backend are made in
+line with main official releases and are avalalble from the ScummVM
+downloads page <http://www.scummvm.org/downloads.php> for the GP2X,
+GP2XWiz and Caanoo.
+
+------------------------------------------------------------------------
+Supported audio options
+
+Raw audio.
+MP3 audio.
+OGG Vorbis audio.
+
+FLAC audio is currently unsupported.
+
+For best results use uncompressed audio in games.
+
+------------------------------------------------------------------------
+Credits
+
+Core ScummVM code (c) The ScummVM Team
+Portions of the GPH backend (c) John Willis
+Detailed (c) information can be found within the source code
diff --git a/backends/platform/gph/devices/caanoo/scummvm-gdb.gpe b/dists/gph/caanoo/scummvm-gdb.gpe
index 63ce193ca8..63ce193ca8 100644
--- a/backends/platform/gph/devices/caanoo/scummvm-gdb.gpe
+++ b/dists/gph/caanoo/scummvm-gdb.gpe
diff --git a/backends/platform/gph/devices/caanoo/scummvm.gpe b/dists/gph/caanoo/scummvm.gpe
index 37d0f65d18..37d0f65d18 100644
--- a/backends/platform/gph/devices/caanoo/scummvm.gpe
+++ b/dists/gph/caanoo/scummvm.gpe
diff --git a/backends/platform/gph/devices/gp2x/mmuhack/Makefile b/dists/gph/gp2x/mmuhack/Makefile
index a35d5c2a98..a35d5c2a98 100644
--- a/backends/platform/gph/devices/gp2x/mmuhack/Makefile
+++ b/dists/gph/gp2x/mmuhack/Makefile
diff --git a/backends/platform/gph/devices/gp2x/mmuhack/README b/dists/gph/gp2x/mmuhack/README
index 6db7d81845..6db7d81845 100644
--- a/backends/platform/gph/devices/gp2x/mmuhack/README
+++ b/dists/gph/gp2x/mmuhack/README
diff --git a/backends/platform/gph/devices/gp2x/mmuhack/flush_uppermem_cache.h b/dists/gph/gp2x/mmuhack/flush_uppermem_cache.h
index d01548e474..d01548e474 100644
--- a/backends/platform/gph/devices/gp2x/mmuhack/flush_uppermem_cache.h
+++ b/dists/gph/gp2x/mmuhack/flush_uppermem_cache.h
diff --git a/backends/platform/gph/devices/gp2x/mmuhack/flush_uppermem_cache.s b/dists/gph/gp2x/mmuhack/flush_uppermem_cache.s
index 265908e1fd..265908e1fd 100644
--- a/backends/platform/gph/devices/gp2x/mmuhack/flush_uppermem_cache.s
+++ b/dists/gph/gp2x/mmuhack/flush_uppermem_cache.s
diff --git a/backends/platform/gph/devices/gp2x/mmuhack/mmuhack.c b/dists/gph/gp2x/mmuhack/mmuhack.c
index 2e38bdb284..2e38bdb284 100644
--- a/backends/platform/gph/devices/gp2x/mmuhack/mmuhack.c
+++ b/dists/gph/gp2x/mmuhack/mmuhack.c
diff --git a/backends/platform/gph/devices/gp2x/mmuhack/mmuhack.o b/dists/gph/gp2x/mmuhack/mmuhack.o
index 475f4a54ae..475f4a54ae 100644
--- a/backends/platform/gph/devices/gp2x/mmuhack/mmuhack.o
+++ b/dists/gph/gp2x/mmuhack/mmuhack.o
Binary files differ
diff --git a/backends/platform/gph/devices/gp2x/scummvm.gpe b/dists/gph/gp2x/scummvm.gpe
index 51a49f7560..51a49f7560 100644
--- a/backends/platform/gph/devices/gp2x/scummvm.gpe
+++ b/dists/gph/gp2x/scummvm.gpe
diff --git a/backends/platform/gph/devices/gp2xwiz/scummvm-gdb.gpe b/dists/gph/gp2xwiz/scummvm-gdb.gpe
index 63ce193ca8..63ce193ca8 100644
--- a/backends/platform/gph/devices/gp2xwiz/scummvm-gdb.gpe
+++ b/dists/gph/gp2xwiz/scummvm-gdb.gpe
diff --git a/backends/platform/gph/devices/gp2xwiz/scummvm.gpe b/dists/gph/gp2xwiz/scummvm.gpe
index 59ff562aeb..59ff562aeb 100644
--- a/backends/platform/gph/devices/gp2xwiz/scummvm.gpe
+++ b/dists/gph/gp2xwiz/scummvm.gpe
diff --git a/backends/platform/gph/devices/common/scummvm.ini b/dists/gph/scummvm.ini
index c9cce92379..952cd0de24 100644
--- a/backends/platform/gph/devices/common/scummvm.ini
+++ b/dists/gph/scummvm.ini
@@ -1,5 +1,5 @@
[info]
-name="ScummVM"
+name="ScummVM 1.5.0git"
path="/scummvm/scummvm.gpe"
icon="/scummvm/scummvm.png"
title="/scummvm/scummvmb.png"
diff --git a/dists/gph/scummvm.ini.in b/dists/gph/scummvm.ini.in
new file mode 100644
index 0000000000..1c80d97d8b
--- /dev/null
+++ b/dists/gph/scummvm.ini.in
@@ -0,0 +1,5 @@
+[info]
+name="ScummVM @VERSION@"
+path="/scummvm/scummvm.gpe"
+icon="/scummvm/scummvm.png"
+title="/scummvm/scummvmb.png"
diff --git a/backends/platform/gph/devices/common/scummvm.png b/dists/gph/scummvm.png
index 128e59efc4..128e59efc4 100644
--- a/backends/platform/gph/devices/common/scummvm.png
+++ b/dists/gph/scummvm.png
Binary files differ
diff --git a/backends/platform/gph/devices/common/scummvmb.png b/dists/gph/scummvmb.png
index 24a27bc0e1..24a27bc0e1 100644
--- a/backends/platform/gph/devices/common/scummvmb.png
+++ b/dists/gph/scummvmb.png
Binary files differ
diff --git a/dists/macosx/DS_Store b/dists/macosx/DS_Store
index 2d4193a6af..7ad5a19d61 100644
--- a/dists/macosx/DS_Store
+++ b/dists/macosx/DS_Store
Binary files differ
diff --git a/backends/platform/openpandora/build/PXML.xml b/dists/openpandora/PXML.xml
index a87c49e2b8..896210bf01 100755..100644
--- a/backends/platform/openpandora/build/PXML.xml
+++ b/dists/openpandora/PXML.xml
@@ -4,11 +4,11 @@
<package id="scummvm.djwillis.0001">
<author name="DJWillis" website="http://www.scummvm.org/"/>
<!-- version type can be alpha, beta or release, set to release in branch -->
- <version major="1" minor="4" release="0" build="1" type="alpha"/>
+ <version major="1" minor="5" release="0" build="1" type="release"/>
<!-- Both title and titles are needed -->
- <title lang="en_US">ScummVM</title>
+ <title lang="en_US">ScummVM 1.5.0git</title>
<titles>
- <title lang="en_US">ScummVM</title>
+ <title lang="en_US">ScummVM 1.5.0git</title>
</titles>
<descriptions>
<description lang="en_US">
@@ -25,7 +25,7 @@
<exec command="./runscummvm.sh"/>
<author name="DJWillis" website="http://www.scummvm.org/"/>
<!-- version type can be alpha, beta or release, set to release in branch -->
- <version major="1" minor="4" release="0" build="1" type="alpha"/>
+ <version major="1" minor="5" release="0" build="1" type="release"/>
<!-- Both title and titles are needed -->
<title lang="en_US">ScummVM</title>
<titles>
diff --git a/dists/openpandora/PXML.xml.in b/dists/openpandora/PXML.xml.in
new file mode 100644
index 0000000000..938e9cb24a
--- /dev/null
+++ b/dists/openpandora/PXML.xml.in
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<PXML xmlns="http://openpandora.org/namespaces/PXML" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="PXML_schema.xsd">
+ <!-- This is the package, in our case ScummVM -->
+ <package id="scummvm.djwillis.0001">
+ <author name="DJWillis" website="http://www.scummvm.org/"/>
+ <!-- version type can be alpha, beta or release, set to release in branch -->
+ <version major="@VER_MAJOR@" minor="@VER_MINOR@" release="@VER_PATCH@" build="1" type="release"/>
+ <!-- Both title and titles are needed -->
+ <title lang="en_US">ScummVM @VERSION@</title>
+ <titles>
+ <title lang="en_US">ScummVM @VERSION@</title>
+ </titles>
+ <descriptions>
+ <description lang="en_US">
+ ScummVM is a program which allows you to run certain classic graphical point-and-click adventure games, provided you already have their data files. The clever part about this: ScummVM just replaces the executables shipped with the games, allowing you to play them on systems for which they were never designed!
+
+ ScummVM supports many adventure games, including LucasArts SCUMM games (such as Monkey Island 1-3, Day of the Tentacle, Sam &amp; Max, ...), many of Sierra's AGI and SCI games (such as King's Quest 1-6, Space Quest 1-5, ...), Discworld 1 and 2, Simon the Sorcerer 1 and 2, Beneath A Steel Sky, Lure of the Temptress, Broken Sword 1 and 2, Flight of the Amazon Queen, Gobliiins 1-3, The Legend of Kyrandia 1-3, many of Humongous Entertainment's children's SCUMM games (including Freddi Fish and Putt Putt games) and many more.
+ </description>
+ </descriptions>
+ <icon src="icon/scummvm.png"/>
+ </package>
+
+ <!-- This is the application, the ScummVM binary -->
+ <application id="scummvm.djwillis.0001" appdata="scummvm">
+ <exec command="./runscummvm.sh"/>
+ <author name="DJWillis" website="http://www.scummvm.org/"/>
+ <!-- version type can be alpha, beta or release, set to release in branch -->
+ <version major="@VER_MAJOR@" minor="@VER_MINOR@" release="@VER_PATCH@" build="1" type="release"/>
+ <!-- Both title and titles are needed -->
+ <title lang="en_US">ScummVM</title>
+ <titles>
+ <title lang="en_US">ScummVM</title>
+ </titles>
+ <descriptions>
+ <description lang="en_US">
+ ScummVM is a program which allows you to run certain classic graphical point-and-click adventure games, provided you already have their data files. The clever part about this: ScummVM just replaces the executables shipped with the games, allowing you to play them on systems for which they were never designed!
+
+ ScummVM supports many adventure games, including LucasArts SCUMM games (such as Monkey Island 1-3, Day of the Tentacle, Sam &amp; Max, ...), many of Sierra's AGI and SCI games (such as King's Quest 1-6, Space Quest 1-5, ...), Discworld 1 and 2, Simon the Sorcerer 1 and 2, Beneath A Steel Sky, Lure of the Temptress, Broken Sword 1 and 2, Flight of the Amazon Queen, Gobliiins 1-3, The Legend of Kyrandia 1-3, many of Humongous Entertainment's children's SCUMM games (including Freddi Fish and Putt Putt games) and many more.
+ </description>
+ </descriptions>
+ <licenses>
+ <license name="GPLv2" url="http://www.gnu.org/licenses/gpl-2.0.html" sourcecodeurl="http://www.scummvm.org"/>
+ </licenses>
+ <icon src="icon/scummvm.png"/>
+ <previewpics>
+ <pic src="icon/preview-pic.png"/>
+ </previewpics>
+ <info name="ScummVM Documentation" type="text/html" src="docs/index.html"/>
+ <categories>
+ <category name="Game">
+ <subcategory name="AdventureGame"/>
+ </category>
+ </categories>
+ </application>
+</PXML>
diff --git a/backends/platform/openpandora/build/PXML_schema.xsd b/dists/openpandora/PXML_schema.xsd
index 7c0d635016..7c0d635016 100644
--- a/backends/platform/openpandora/build/PXML_schema.xsd
+++ b/dists/openpandora/PXML_schema.xsd
diff --git a/backends/platform/openpandora/build/README-OPENPANDORA b/dists/openpandora/README-OPENPANDORA
index c8aabcbb7a..b3947975c0 100755..100644
--- a/backends/platform/openpandora/build/README-OPENPANDORA
+++ b/dists/openpandora/README-OPENPANDORA
@@ -1,4 +1,4 @@
-ScummVM - OPENPANDORA SPECIFIC README
+ScummVM 1.5.0git - OPENPANDORA SPECIFIC README
------------------------------------------------------------------------
Please refer to the:
diff --git a/dists/openpandora/README-OPENPANDORA.in b/dists/openpandora/README-OPENPANDORA.in
new file mode 100644
index 0000000000..0a63a5938d
--- /dev/null
+++ b/dists/openpandora/README-OPENPANDORA.in
@@ -0,0 +1,19 @@
+ScummVM @VERSION@ - OPENPANDORA SPECIFIC README
+------------------------------------------------------------------------
+Please refer to the:
+
+ScummVM Forum: <http://forums.scummvm.org/>
+WiKi: <http://wiki.scummvm.org/index.php/OpenPandora>
+
+for the most current information on the port and any updates to this
+documentation.
+
+The wiki includes detailed instructions on how to use the port and
+control information.
+
+------------------------------------------------------------------------
+Credits
+
+Core ScummVM code (c) The ScummVM Team
+OpenPandora backend (c) John Willis
+Detailed (c) information can be found within the source code
diff --git a/backends/platform/openpandora/build/README-PND.txt b/dists/openpandora/README-PND.txt
index 942c3a43e2..240936f755 100755..100644
--- a/backends/platform/openpandora/build/README-PND.txt
+++ b/dists/openpandora/README-PND.txt
@@ -1,4 +1,4 @@
-ScummVM - OPENPANDORA README - HOW TO INSTALL
+ScummVM 1.5.0git - OPENPANDORA README - HOW TO INSTALL
------------------------------------------------------------------------
Please refer to the:
diff --git a/dists/openpandora/README-PND.txt.in b/dists/openpandora/README-PND.txt.in
new file mode 100644
index 0000000000..076c0e0a5c
--- /dev/null
+++ b/dists/openpandora/README-PND.txt.in
@@ -0,0 +1,38 @@
+ScummVM @VERSION@ - OPENPANDORA README - HOW TO INSTALL
+------------------------------------------------------------------------
+
+Please refer to the:
+
+ScummVM Forum: <http://forums.scummvm.org/>
+WiKi: <http://wiki.scummvm.org/index.php/OpenPandora>
+
+for the most current information on the port and any updates to this
+documentation.
+
+------------------------------------------------------------------------
+Installing:
+
+This archive contains ScummVM in a PND format ready to be copied to the
+OpenPandora and used.
+
+To install just copy the .pnd file from this archive to your device.
+
+You will need to place the .pnd file in a suitable location on your SD
+card.
+
+/pandora/desktop <- place here if you wish the icon to show on the
+ desktop. Documentation will show in the menu.
+
+/pandora/menu <- place here if you wish the icon to show on the
+ Xfce menu. Documentation will show in the menu.
+
+/pandora/apps <- place here if you wish the icon to show on the
+ desktop and in the menu. Documentation will show
+ in the menu.
+
+------------------------------------------------------------------------
+Credits
+
+Core ScummVM code (c) The ScummVM Team
+OpenPandora backend (c) John Willis
+Detailed (c) information can be found within the source code
diff --git a/backends/platform/openpandora/build/icon/preview-pic.png b/dists/openpandora/icon/preview-pic.png
index 2f4a536d30..2f4a536d30 100755..100644
--- a/backends/platform/openpandora/build/icon/preview-pic.png
+++ b/dists/openpandora/icon/preview-pic.png
Binary files differ
diff --git a/backends/platform/openpandora/build/icon/scummvm.png b/dists/openpandora/icon/scummvm.png
index 128e59efc4..128e59efc4 100755..100644
--- a/backends/platform/openpandora/build/icon/scummvm.png
+++ b/dists/openpandora/icon/scummvm.png
Binary files differ
diff --git a/backends/platform/openpandora/build/index.html b/dists/openpandora/index.html
index 34d381d0f8..d7238c1889 100755..100644
--- a/backends/platform/openpandora/build/index.html
+++ b/dists/openpandora/index.html
@@ -5,7 +5,7 @@
</h3>
<h4>
- <p>ScummVM: OpenPandora Specific Documentation</p>
+ <p>ScummVM 1.5.0git: OpenPandora Specific Documentation</p>
</h4>
<A href="docs/README-OPENPANDORA">ScummVM OpenPandora README</a><br/>
@@ -13,7 +13,7 @@
<A href="http://wiki.scummvm.org/index.php/OpenPandora">ScummVM OpenPandora WiKi</a><br/>
<h4>
- <p>ScummVM: General Documentation</p>
+ <p>ScummVM 1.5.0git: General Documentation</p>
</h4>
<A href="http://www.scummvm.org/">ScummVM website</a><br/>
diff --git a/dists/openpandora/index.html.in b/dists/openpandora/index.html.in
new file mode 100644
index 0000000000..42c8e8c147
--- /dev/null
+++ b/dists/openpandora/index.html.in
@@ -0,0 +1,26 @@
+<html>
+
+<h3>
+ <p>Welcome to the ScummVM!</p>
+</h3>
+
+<h4>
+ <p>ScummVM @VERSION@: OpenPandora Specific Documentation</p>
+</h4>
+
+<A href="docs/README-OPENPANDORA">ScummVM OpenPandora README</a><br/>
+<A href="http://scummvm.distant-earth.com/">ScummVM OpenPandora Website</a><br/>
+<A href="http://wiki.scummvm.org/index.php/OpenPandora">ScummVM OpenPandora WiKi</a><br/>
+
+<h4>
+ <p>ScummVM @VERSION@: General Documentation</p>
+</h4>
+
+<A href="http://www.scummvm.org/">ScummVM website</a><br/>
+<A href="docs/README">ScummVM README</a><br/>
+<A href="docs/NEWS">ScummVM NEWS</a><br/>
+<A href="docs/AUTHORS">ScummVM Authors</a><br/>
+<A href="docs/COPYRIGHT">ScummVM Copyright</a><br/>
+<A href="docs/COPYING">GPL Licence</a><br/>
+
+</html>
diff --git a/backends/platform/openpandora/build/pnd_make.sh b/dists/openpandora/pnd_make.sh
index 0c03e8154d..0c03e8154d 100755
--- a/backends/platform/openpandora/build/pnd_make.sh
+++ b/dists/openpandora/pnd_make.sh
diff --git a/backends/platform/openpandora/build/runscummvm.sh b/dists/openpandora/runscummvm.sh
index 9c9d8362cb..9c9d8362cb 100755
--- a/backends/platform/openpandora/build/runscummvm.sh
+++ b/dists/openpandora/runscummvm.sh
diff --git a/dists/win32/ScummVM.iss b/dists/win32/ScummVM.iss
index 7f3359f530..36088911d4 100644
--- a/dists/win32/ScummVM.iss
+++ b/dists/win32/ScummVM.iss
@@ -1,5 +1,5 @@
[Setup]
-AppCopyright=2011
+AppCopyright=2012
AppName=ScummVM
AppVerName=ScummVM Git
AppPublisher=The ScummVM Team
@@ -64,12 +64,22 @@ Name: {group}\PrectiMe; Filename: {app}\PrectiMe.txt; WorkingDir: {app}; Comment
Name: {group}\Liesmich; Filename: {app}\Liesmich.txt; WorkingDir: {app}; Comment: Liesmich; Flags: createonlyiffileexists; Languages: de
Name: {group}\LasMig; Filename: {app}\LasMig.txt; WorkingDir: {app}; Comment: LasMig; Flags: createonlyiffileexists; Languages: se
+Name: {group}\Saved Games\Migrate Saved Games; Filename: {app}\migration.bat; WorkingDir: {app}; Comment: Migrate Saved Games; IconIndex: 0; MinVersion: 0, 1
+Name: {group}\Saved Games\Saved Games (old default); Filename: {app}; WorkingDir: {app}; Comment: Saved Games (old default); IconIndex: 0; MinVersion: 0, 1
+Name: {group}\Saved Games\Saved Games (new default); Filename: {userappdata}\ScummVM\Saved Games; WorkingDir: {userappdata}\ScummVM\Saved Games; Comment: Saved Games (new default); IconIndex: 0; MinVersion: 0, 1
+
[Run]
Filename: {app}\ScummVM.exe; Flags: nowait skipifdoesntexist postinstall skipifsilent
+;Creates a symbolic link for standard save games area, under Windows Vista/7
+Filename: {cmd}; Parameters: "/c ""mklink /d ""%userprofile%\Saved Games\ScummVM"" ""%appdata%\ScummVM\Saved games"" "" "; MinVersion: 0, 6.1
[UninstallDelete]
Type: files; Name: {app}\ISTool.url
+[Dirs]
+Name: "{userappdata}\ScummVM"; MinVersion: 0, 1
+Name: "{userappdata}\ScummVM\Saved Games"; MinVersion: 0, 1
+
[Files]
Source: AUTHORS.txt; DestDir: {app}; Flags: ignoreversion
Source: COPYING.txt; DestDir: {app}; Flags: ignoreversion
@@ -106,3 +116,8 @@ Source: sky.cpt; DestDir: {app}; Flags: ignoreversion
Source: teenagent.dat; DestDir: {app}; Flags: ignoreversion
Source: toon.dat; DestDir: {app}; Flags: ignoreversion
Source: translations.dat; DestDir: {app}; Flags: ignoreversion
+;Mirgration script for saved games in Windows NT4 onwards
+Source: migration.bat; DestDir: {app}; Flags: ignoreversion; MinVersion: 0, 1
+Source: migration.txt; DestDir: {app}; Flags: ignoreversion; MinVersion: 0, 1
+
+
diff --git a/dists/win32/migration.bat b/dists/win32/migration.bat
new file mode 100644
index 0000000000..2bba7baef4
--- /dev/null
+++ b/dists/win32/migration.bat
@@ -0,0 +1,51 @@
+:: Script for migrating saved games in Windows 2000/XP/Vista/7
+::
+:: Put this batch file into the ScummVM directory
+:: This script will copy any saved games located in the
+:: old default location, to the new default location.
+::
+:: (c) 2012 ScummVM Team
+::
+
+@echo off
+echo ScummVM Saved Games Migration Script
+echo The default location for saved games changed
+echo in Windows NT4/2000/XP/Vista/7 for ScummVM 1.5.0
+echo This script will copy any saved games stored in
+echo the old default location, to the new default location
+pause
+
+if defined APPDATA goto :test2
+echo.
+echo Unable to access the Application Data variable!
+pause
+goto :eof
+
+:test2
+if exist "%APPDATA%" goto :test3
+echo.
+echo Application Data directory doesn't exist!
+pause
+goto :eof
+
+:test3
+if exist "%APPDATA%\ScummVM\" goto :test4
+echo.
+echo ScummVM Application Data directory doesn't exist!
+pause
+goto :eof
+
+:test4
+if exist "%APPDATA%\ScummVM\Saved Games\" goto :copyfiles
+echo.
+echo ScummVM Saved Games directory doesn't exist!
+pause
+goto :eof
+
+:copyfiles
+echo Copying ScummVM Saved Games...
+xcopy /EXCLUDE:migration.txt /F /-Y * "%APPDATA%\ScummVM\Saved Games"
+
+echo.
+echo All saved games have been copied to the new location of "%APPDATA%\ScummVM\Saved Games"
+pause
diff --git a/dists/win32/migration.txt b/dists/win32/migration.txt
new file mode 100644
index 0000000000..eedd773b32
--- /dev/null
+++ b/dists/win32/migration.txt
@@ -0,0 +1,27 @@
+AUTHORS.txt
+COPYING.LGPL.txt
+COPYING.txt
+COPYRIGHT.txt
+drascula.dat
+hugo.dat
+kyra.dat
+lure.dat
+m4.dat
+NEWS.txt
+pred.dic
+queen.tbl
+QUICKSTART.txt
+README-SDL.txt
+README.txt
+scummclassic.zip
+scummmodern.zip
+scummvm.exe
+SDL.dll
+sky.cpt
+teenagent.dat
+migration.bat
+migration.txt
+toon.dat
+translations.dat
+unins000.dat
+unins000.exe
diff --git a/doc/cz/PrectiMe b/doc/cz/PrectiMe
index 57b0f4c5aa..da54d473e1 100644
--- a/doc/cz/PrectiMe
+++ b/doc/cz/PrectiMe
@@ -1,5 +1,4 @@
P՘EФŒTIMФš ScummVM
-PoslednУ­ aktualizace: $Date$
------------------------------------------------------------------------
Pro vУ­ce informacУ­, seznamy kompatibility, podrobnosti o dotacУ­ch, nejnovФ›jХЁУ­ verze, novinky o vУНvoji a dalХЁУ­, prosУ­m navХЁtivte domovskou strУЁnku ScummVM na: http://www.scummvm.org/
@@ -449,8 +448,7 @@ TakУЉ mХЏХОete pouХОУ­t nУЁstroj 'compress_queen' zТ balУ­Фku nУЁstrojХЏ pro 'z
CD verze sУЉrie Gobliiins obsahuje jednu velkou zvukovou stopu, kterou potХ™ebujete vyjmout (viz oddУ­l o pouХОitУ­ komprimovanУНch zvukovУНch souborХЏ) a zkopУ­rovat ji do hernУ­ sloХОky, pokud chcete ve hХ™e hudbu, aniХО byste museli CD mУ­t stУЁle v jednotce. VТ tУЉto stopФ› jsou takУЉ Х™eФ a jejУ­ hlasitost se tedy takУЉ mФ›nУ­ podle hlasitosti hudby.
-3.11) PoznУЁmky k Inherit the Earth: Quest for the Orb
-:
+3.11) PoznУЁmky k Inherit the Earth: Quest for the Orb:
----- ------------------------------------------------
Abyste mohli spustit verzi pro Mac OS X od Wyrmkeep musУ­te data zkopУ­rovat zТ CD na VУЁХЁ pevnУН disk. Pokud pouХОУ­vУЁte PC, pak se podУ­vejte na:
@@ -482,8 +480,11 @@ PХ™ejmenovat voices.wav na CD4 na voices4.wav
3.14) PoznУЁmky k The Legend of Kyrandia:
----- ----------------------------------
-Abyste mohli spustit The Legend of Kyrandia ve ScummVM potХ™ebujete soubor 'kyra.dat', kterУН mХЏХОete najУ­t na strУЁnce 'Downloads' domovskУЉ strУЁnky ScummVM.
-
+Abyste mohli spustit The Legend of Kyrandia ve ScummVM potХ™ebujete soubor 'kyra.dat'.
+Soubor by mФ›l bУНt vХОdykcy souФУЁstУ­ oficiУЁlnУ­ch balУ­ФkХЏ ScummVM. V pХ™У­padФ›, ХОe ScummVM
+hlУЁsУ­, ХОe soubor chybУЁ, mХЏХОete ho najУ­t na strУЁnce ScummVM v sekci 'Downloads'.
+NezapomeХˆte, ХОe souФasnУЁ verze ScummVM pro Windows by mФ›la soubor obsahovat ve spouХЁtФ›Фi a tudУ­ХО ho
+musУ­te mУ­t pouze, kdyХО ScummVM soubor nemХЏХОe nalУЉzt.
3.15) PoznУЁmky kТ PХ™edvУ­davУЉmu VstupnУ­mu Dialogu her Sierra AGI:
----- ---------------------------------------------------------
@@ -491,7 +492,7 @@ PХ™edvУ­davУН VstupnУ­ Dialog je pomХЏcka ScummVM pro spouХЁtФ›nУ­ her pouХОУ­va
Abyste zapnuli pХ™edvУ­davУН vstup v hrУЁch AGI, potХ™ebujete zkopУ­rovat soubor pred.dic do dodateФnУЉ sloХОky ScummVM nebo do sloХОky hry, kterou chcete hrУЁt. Tento slovnУ­k byl vytvoХ™en analУНzou vХЁech znУЁmУНch her AGI a obsahuje maximУЁlnУ­ sadu bФ›ХОnУНch slov.
-Pokud je slovnУ­k zjiХЁtФ›n je PХ™edvУ­davУН VstupnУ­ Dialog zobrazen buФ pХ™i klinutУ­ na oblast pХ™У­kazovУЉho Х™УЁdku (kdykoliv je poХОadovУЁn vstup klУЁvesnice, i vТ rУЁmeФcУ­ch dialogovУНch oken), nebo v nФ›kterУНch verzУ­ch pro jinУЉ systУЉmy stisknutУ­m urФenУЉ klУЁvesovУЉ zkratky.
+Pokud je slovnУ­k zjiХЁtФ›n, je PХ™edvУ­davУН VstupnУ­ Dialog zobrazen buФ pХ™i klinutУ­ na oblast pХ™У­kazovУЉho Х™УЁdku (kdykoliv je poХОadovУЁn vstup klУЁvesnice, i vТ rУЁmeФcУ­ch dialogovУНch oken), nebo v nФ›kterУНch verzУ­ch pro jinУЉ systУЉmy stisknutУ­m urФenУЉ klУЁvesovУЉ zkratky.
PХ™edvУ­davУН VstupnУ­ Dialog pracuje ve tХ™ech reХОimech, kterУЉ jsou pХ™epУ­nУЁny tlaФУ­tkem (*)Pre/123/Abc. HlavnУ­ vstupnУ­ metodou je pХ™edvУ­davУН reХОim
(Pre), kterУН pХ™ipomУ­nУЁ "rychlУЉ zadУЁvУЁnУ­" vТ mobilnУ­ch telefonech.
@@ -507,7 +508,7 @@ DialogovУЉ okno je plnФ› pouХОitelnУЉ pomocУ­ myХЁi, ale vТ nФ›kterУНch verzУ­ch
3.16) PoznУЁmky k Mickey's Space Adventure:
----- ------------------------------------
-Abyste mohli Mickey's Space Adventure hrУЁt ve ScummVM, potХ™ebujete spolu sТ datovУНmi soubory hry takУЉ pХЏvodnУ­ spouХЁtФ›Ф executable (mickey.exe).
+Abyste mohli Mickey's Space Adventure hrУЁt ve ScummVM, potХ™ebujete spolu sТ datovУНmi soubory hry takУЉ pХЏvodnУ­ spouХЁtФ›Ф (mickey.exe).
Pro tuto hru ve ScummVM, existuje rozХЁУ­Х™enУЁ podpora myХЁi, i kdyХО vТ pХЏvodnУ­ hХ™e takovУЁto podpora nebyla. PoloХОky menu mohou bУНt vybrУЁny pomocУ­ myХЁi a je takУЉ moХОnУЉ se myХЁУ­ pХ™esunout do jinУНch mУ­st. KdyХО se kurzor myХЁi nachУЁzУ­ na okraji obrazovky, zФervenУЁ, pokud je moХОnУЉ jУ­t vТ tomto smФ›ru. HrУЁФ pak mХЏХОe jednoduХЁe kliknout na okraje hernУ­ obrazovky pro zmФ›nu mУ­sta, podobnФ› jako mnoho adventur, coХО je jednoduХЁХЁУ­ a pХ™У­moФaХ™ejХЁУ­ neХО pohyb pomocУ­ menu.
@@ -543,10 +544,7 @@ Toto vydУЁnУ­ mУЁ nУЁsledujУ­cУ­ znУЁmУЉ problУЉmy. NenУ­ tХ™eba je ohlaХЁovat,
- PХ™i hranУ­ her, kterУЉ pouХОУ­vajУ­ CD Audio (hry FM-TOWNS, Loom CD, atd) mХЏХОe u uХОivatelХЏ Microsoft Windows 2000/XP dochУЁzet kТ nУЁhodnУНm pУЁdХЏm. To je dУ­ky dlouhotrvajУ­cУ­ chybФ› Windows, kterУЁ mУЁ za nУЁsledek poХЁkozenУЉ soubory pХ™i ФtenУ­ z CD. Abyste se tomuto vyhnuli, zkopУ­rujte, prosУ­m, soubory na pevnУН disk
Verze FM-TOWNS:
-- Verze KandХОi vyХОaduje ROM pУ­sma FM-TOWNS Font
-- ScummVM bude nУЁhodnФ› padat vТ nУЁsledujУ­cУ­ch hrУЁch pХ™i pouХОitУ­ ROM pУ­sma FM-TOWNS pro KandХОi:
-The Secret of Monkey Island, Monkey Island 2: LeChuck's Revenge
-a Indiana Jones and the Fate of Atlantis
+- Verze KandХОi vyХОaduje ROM pУ­sma FM-TOWNS
Loom:
- VypnutУ­ titulkХЏ pomocУ­ souboru nastavenУ­ je nevypne spolehlivФ›, protoХОe skripty Loom je znovu automaticky zapnou
@@ -590,7 +588,6 @@ a Indiana Jones and the Fate of Atlantis
The Legend of Kyrandia:
- Ve verzУ­ch na disketФ› pro Mac nenУ­ ХОУЁdnУЁ hudba ani zvukovУЉ efekty.
- CD Macintosh pouХОУ­vУЁ zahrnutou hudbu a zvukovУЉ efekty z DOS.
-- Verze pro PC-9821 nemУЁ podporu zvukovУНch efektХЏ.
Hry Humongous Entertainment:
- Pouze pХЏvodnУ­ rozhranУ­ pro uloХОenУ­ a naФtenУ­ mohou bУНt pouХОity.
@@ -817,19 +814,28 @@ JУЁdra, kterУЁ vТ souФasnosti podporujУ­ nУЁvrat do spouХЁtФ›Фe, jsou:
AGI
AGOS
CINE
+ COMPOSER
+ CRUISE
DRACI
+ DRASCULA
GOB
GROOVIE
+ HUGO
KYRA
LURE
+ MADE
+ MOHAWK
PARALLACTION
QUEEN
SAGA
+ SCI
SCUMM
SKY
SWORD1
SWORD2
+ TEENAGENT
TOUCHE
+ TSAGE
TUCKER
@@ -978,16 +984,36 @@ PoznУЁmka pro uХОivatele WinCE: KvХЏli omezenУЉmu vstupu zТ klУЁvesnice ve vФ›tХ
6.0) UloХОenУЉ hry:
---- ------------
-UloХОenУЉ hry jsou na nФ›kterУНch platformУЁch standardnФ› umУ­stФ›ny do souФasnУЉ sloХОky a vТ jinУНch do pХ™ednastavenУЉ sloХОky. To mХЏХОete urФit vТ souboru sТ nastavenУ­ nastavenУ­m parametru savepath. PodУ­vejte se na vzorovУН soubor sТ nastavenУ­m dУЁle vТ tomto souboru.
+UloХОenУЉ hry jsou na nФ›kterУНch platformУЁch standardnФ› umУ­stФ›ny do souФasnУЉ sloХОky a vТ jinУНch do pХ™ednastavenУЉ sloХОky. To mХЏХОete urФit vТ souboru sТ nastavenУ­m pomocУ­ parametru savepath. PodУ­vejte se na vzorovУН soubor sТ nastavenУ­m dУЁle vТ tomto souboru.
Platformy, kterУЉ vТ souФasnosti majУ­ jinУЉ vУНchozУ­ sloХОky jsou:
- Mac OS X: $HOME/Documents/ScummVM Savegames/
- JinУЉ unixy: $HOME/.scummvm/
+ Mac OS X:
+ $HOME/Documents/ScummVM Savegames/
+
+ JinУЉ unixy:
+ $HOME/.scummvm/
+
+ Windows Vista/7:
+ \Users\uХОjmУЉno\AppData\Roaming\ScummVM\Saved games\
+
+ Windows 2000/XP:
+ \Documents and Settings\uХОjmУЉno\Application Data\ScummVM\Saved games\
+
+ Windows NT4:
+ <windir>\Profiles\uХОjmУЉno\Application Data\ScummVM\Saved games\
+
+UloХОenУЉ hry jsou ve Windows NT4/2000/XP/Vista/7 uklУЁdУЁny ve skrytУЉ sloХОce,
+do kterУЉ mХЏХОete vstoupit spuХЁtФ›nУ­m "%APPDATA%\ScummVM\Saved Games\" nebo
+povolenУ­m zobrazenУ­ skrytУНch sloХОek v PrХЏzkumnУ­ku Windows.
+
+PoznУЁmka pro uХОivatele Windows NT4/2000/XP/Vista/7: VУНchozУ­ umУ­stФ›nУ­ uloХОenУНch her
+bylo ve ScummVM 1.5.0 zmФ›nФ›no. DУЁvkovУН soubor pХ™esunu mХЏХОe bУНt pouХОit pro zkopУ­rovУЁnУ­
+uloХОenУНch her ze starУЉho vУНchozУ­ho umУ­stФ›nУ­ do novУЉho.
6.1) 6.1 AutomatickУЉ uklУЁdУЁnУ­:
---- -------------------------
VТ nФ›kterУНch hrУЁch, (a to "Beneath a Steel Sky", "Flight of the Amazon
-Queen", vХЁechny hry AGI, and vХЁechny hry SCUMM), bude ScummVM standardnФ› automaticky uklУЁdat souФasnУН stav kaХОdУНch pХЁt minut (upravitelnУЉ pomocУ­ nastavenУ­ "autouklУЁdУЁnУ­"). Pro jУЁdra AGI a SCUMM, je bude uklУЁdat do pozice 0. V jУЁdru SCUMM mХЏХОe bУНt tento uloХОenУН stav znovu naФten pomocУ­ Ctrl-0 nebo menu F5.
+Queen", vХЁechny hry AGI, a vХЁechny hry SCUMM), bude ScummVM standardnФ› automaticky uklУЁdat souФasnУН stav kaХОdУНch pФ›t minut (upravitelnУЉ pomocУ­ nastavenУ­ "autouklУЁdУЁnУ­"). Pro jУЁdra AGI a SCUMM, je bude uklУЁdat do pozice 0. V jУЁdru SCUMM mХЏХОe bУНt tento uloХОenУН stav znovu naФten pomocУ­ Ctrl-0 nebo menu F5.
6.2) PХ™evod uloХОenУНch her:
@@ -1031,20 +1057,28 @@ Kde 'xxx' je ФУ­slo pozice uloХОenУЉ hry (tj. 001) ve ScummVM
AGI
AGOS
+ CGE
CINE
+ CRUISE
DRACI
GROOVIE
+ HUGO
KYRA
LURE
+ MOHAWK
PARALLACTION
QUEEN
SAGA
+ SCI
SCUMM
SKY
SWORD1
SWORD2
+ TEENAGENT
TINSEL
+ TOON
TOUCHE
+ TSAGE
TUCKER
--save-slot/-x:
@@ -1056,20 +1090,28 @@ Kde 'xxx' je ФУ­slo pozice uloХОenУЉ hry (tj. 001) ve ScummVM
JУЁdra, kterУЁ vТ souФasnosti podporujУ­--save-slot/-x jsou:
AGI
+ CGE
CINE
+ CRUISE
DRACI
GROOVIE
+ HUGO
KYRA
LURE
- PARALLACTION
+ MOHAWK
QUEEN
SAGA
+ SCI
SCUMM
SKY
SWORD1
SWORD2
+ TEENAGENT
TINSEL
+ TOON
TOUCHE
+ TSAGE
+ TUCKER
7.0) Hudba a Zvuk:
@@ -1494,10 +1536,13 @@ Simon the Sorcerer 1 a 2 pХ™idУЁvУЁ nУЁsledujУ­cУ­ nestandardnУ­ klУ­ФovУЁ slov
music_mute boolean Pokud true, hudba je ztlumena
sfx_mute boolean Pokud true, zvukovУЉ efekty jsou ztlumeny
-The Legend of Kyrandia pХ™idУЁvУЁ nУЁsledujУ­cУ­ nestandardnУ­ klУ­ФovУЁ slova:
+The Legend of Kyrandia pХ™idУЁvУЁ nУЁsledujУ­cУ­ nestandardnУ­ klУ­ФovУЉ slovo:
walkspeed celУЉ ФУ­slo Rychlost chХЏze (0-4)
+
+The 7th Guest pХ™idУЁvУЁ nУЁsledujУ­cУ­ nestandardnУ­ klУ­ФovУЉ slovo:
+ t7g_speed Х™etФ›zec Rychlost pХ™ehrУЁvУЁnУ­ videa (normal - normУЁlnУ­, tweaked - upravenУЁ, im_an_ios - jsem na ios)
9.0) SestavenУ­:
---- ----------
@@ -1534,12 +1579,6 @@ Na Win9x/NT/XP mХЏХОete urФit USE_WINDBG a pХ™ipojit WinDbg pro prochУЁzenУ­ la
* PХ™eФtФ›te si prosУ­m:
http://wiki.scummvm.org/index.php/Compiling_ScummVM/Windows_CE
- Debian GNU/Linux:
- * VeVaХЁem systУЉmu nainstalujte balУ­Фky 'build-essential', 'fakeroot', 'debhelper' a 'libsdl1.2-dev'.
- * Instalujte jakУНkoli zТ tФ›chto balУ­ФkХЏ (nepovinnУЉ): 'libvorbis-dev' (pro podporu Ogg Vorbis), 'libasound2-dev' (pro podporu sekvencУЉru ALSA), 'libmad0-dev' (pro podporu MAD MP3), 'zlib1g-dev' (pro podporu komprimovanУНch uloХОenУНch pozic).
- * SpusХЅte 'make deb'.
- * Nakonec spusХЅte 'dpkg -i ../scummvm-cvs*deb', a mУЁte hotovo.
-
Mac OS X:
* UjistФ›te se, ХОe mУЁte nainstalovУЁny nУЁstroje pro vУНvojУЁХ™e.
* BalУ­Фek SDL pro vУНvojУЁХ™e na OS X, kterУН je dostupnУН na strУЁnce SDL _nenУ­_ vhodnУН. SpУ­ХЁe potХ™ebujete sestavenУ­ vТ unixovУЉm stylu. Jeden takovУН zpХЏsob, jak ho nainstalovat je pomocУ­ Fink
diff --git a/doc/de/Liesmich b/doc/de/Liesmich
index b446250189..5d24ec050b 100644
--- a/doc/de/Liesmich
+++ b/doc/de/Liesmich
@@ -726,8 +726,12 @@ voices.wav von CD4 in voices4.wav
3.14) Hinweise zu The Legend of Kyrandia:
----- -----------------------------------
Um The Legend of Kyrandia unter ScummVM laufen zu lassen, benУЖtigen Sie die
-Datei т€žkyra.datт€œ, welche auf der Seite т€žDownloadsт€œ der ScummVM-Website gefunden
-werden kann.
+Datei т€žkyra.datт€œ. Die Datei sollte immer in offiziellen ScummVM-Paketen
+enthalten sein. Wenn ScummVM beanstandet, dass die Datei fehlt, kУЖnnen Sie sie
+auf der Seite т€žDownloadsт€œ der ScummVM-Website finden. Beachten Sie, dass in der
+momentanen Windows-Version von ScummVM diese Datei in der ausfУМhrbaren Datei
+eingebettet sein sollte. Also mУМssen Sie sich nur diese besorgen, wenn sich
+ScummVM darУМber beschwert, dass diese Datei fehlt.
3.15) Hinweise zum vorhersagenden Eingabedialog bei Sierras AGI-Spielen:
@@ -862,10 +866,6 @@ KompatibilitУЄtsseite der Website aufgefУМhrt ist, sehen Sie bitte im Abschnitt
FM-TOWNS-Versionen:
- Die Kanji-Versionen erfordern die Schriftart-ROM-Datei von FM-TOWNS.
- - ScummVM stУМrzt bei Kanji-Versionen der folgenden Spielen zufУЄllig ab, wenn
- die Schriftart-ROM-Datei von FM-TOWNS verwendet wird:
- The Secret of Monkey Island, Monkey Island 2: LeChuck's Revenge
- und Indiana Jones and the Fate of Atlantis
Loom:
- Das Abschalten der Untertitel УМber die Spieleinstellungen funktioniert
@@ -920,7 +920,6 @@ KompatibilitУЄtsseite der Website aufgefУМhrt ist, sehen Sie bitte im Abschnitt
- Keine Musik oder Sound-Effekte in der Macintosh-Diskettenversion
- Die Macintosh-CD-Version verwendet eingebundene DOS-Musik und
DOS-Sound-Effekte.
- - PC-9821-Versionen fehlt UnterstУМtzung fУМr Sound-Effekte.
Spiele von Humongous Entertainment:
- Nur die OriginaloberflУЄche kann zum Laden und Speichern verwendet werden.
@@ -1030,6 +1029,7 @@ gestartet werden -- siehe nУЄchster Abschnitt.
--list-themes Zeigt Liste aller verwendbaren OberflУЄchenthemen.
-e, --music-driver=MODUS
WУЄhlt Musiktreiber (siehe auch Abschnitt 7.0).
+ --list-audio-devices Listet alle verfУМgbaren AudiogerУЄte auf.
-q, --language=SPRACHE WУЄhlt Spielsprache (siehe auch Abschnitt 5.2).
-m, --music-volume=ZAHL WУЄhlt MusiklautstУЄrke, 0-255 (Standard: 192).
-s, --sfx-volume=ZAHL WУЄhlt EffektlautstУЄrke, 0-255 (Standard: 192).
@@ -1233,19 +1233,28 @@ Die Engines, die momentan das ZurУМckkehren zur Spieleliste unterstУМtzen, sind:
AGI
AGOS
CINE
+ COMPOSER
+ CRUISE
DRACI
+ DRASCULA
GOB
GROOVIE
+ HUGO
KYRA
LURE
+ MADE
+ MOHAWK
PARALLACTION
QUEEN
SAGA
+ SCI
SCUMM
SKY
SWORD1
SWORD2
+ TEENAGENT
TOUCHE
+ TSAGE
TUCKER
@@ -1428,8 +1437,22 @@ Verzeichnis gespeichert und bei anderen in voreingestellten Verzeichnissen.
Sehen Sie sich das Beispiel weiter unten in dieser Liesmich-Datei an.
Die folgenden Plattformen haben ein anderes Standardverzeichnis:
- Mac OS X: $HOME/Documents/ScummVM Savegames/
- Andere UNIX-Systeme: $HOME/.scummvm/
+ Mac OS X:
+ $HOME/Documents/ScummVM Savegames/
+
+ Andere UNIX-Systeme:
+ $HOME/.scummvm/
+
+ Windows Vista/7:
+ \Users\Benutzername\AppData\Roaming\ScummVM\Saved games\
+
+ Windows 2000/XP:
+ \Dokumente und Einstellungen\Benutzername\Anwendungsdaten\
+ ScummVM\Saved games\
+
+ Windows NT4:
+ <Windows-Verzeichnis>\Profiles\Benutzername\
+ Application Data\ScummVM\Saved games\
6.1) Automatische SpielstУЄnde:
@@ -1443,6 +1466,11 @@ automatischen SpielstУЄnde auf Platz 0 abgelegt. Bei der SCUMM-Engine kann diese
Speicherstand УМber die Tastenkombination Strg+0 oder УМber das F5-MenУМ geladen
werden.
+SpielstУЄnde werden unter Windows NT4/2000/XP/Vista/7 in einem versteckten
+Bereich gespeichert, auf den durch Aufruf von т€ž%APPDATA%\ScummVM\Saved Games\т€œ
+zugegriffen werden kann oder indem das Anzeigen versteckter Dateien im Windows
+Explorer aktiviert wird.
+
6.2) SpielstУЄnde umwandeln:
---- ----------------------
@@ -1495,20 +1523,28 @@ der Spielstand unter ScummVM befinden soll.
AGI
AGOS
+ CGE
CINE
+ CRUISE
DRACI
GROOVIE
+ HUGO
KYRA
LURE
+ MOHAWK
PARALLACTION
QUEEN
SAGA
+ SCI
SCUMM
SKY
SWORD1
SWORD2
+ TEENAGENT
TINSEL
+ TOON
TOUCHE
+ TSAGE
TUCKER
--save-slot/-x:
@@ -1522,20 +1558,28 @@ der Spielstand unter ScummVM befinden soll.
Die Engines, die momentan --save-slot/-x unterstУМtzen, sind:
AGI
+ CGE
CINE
+ CRUISE
DRACI
GROOVIE
+ HUGO
KYRA
LURE
- PARALLACTION
+ MOHAWK
QUEEN
SAGA
+ SCI
SCUMM
SKY
SWORD1
SWORD2
+ TEENAGENT
TINSEL
+ TOON
TOUCHE
+ TSAGE
+ TUCKER
7.0) Musik und Sound:
@@ -2009,7 +2053,7 @@ Ausgabefrequenz ein Vielfaches der Originalfrequenz ist.
---- --------------------
StandardmУЄУŸig wird die Konfigurationsdatei hier gespeichert und geladen:
- Windows Vista:
+ Windows Vista/7:
\Users\Benutzername\AppData\Roaming\ScummVM\scummvm.ini
Windows 2000/XP:
@@ -2190,6 +2234,13 @@ SchlУМsselwort:
walkspeed Zahl Bewegungsgeschwindigkeit (0-4)
+The 7th Guest verfУМgt zusУЄtzlich УМber folgendes nicht standardmУЄУŸiges
+SchlУМsselwort:
+
+ t7g_speed Text Videowiedergabe-Geschwindigkeit
+ (normal, tweaked [optimiert],
+ im_an_ios [ich bin ein iOS])
+
9.0) Kompilierung:
---- -------------
@@ -2243,17 +2294,6 @@ Debug-Nachrichten zu durchsuchen
* Bitte lesen Sie:
http://wiki.scummvm.org/index.php/Compiling_ScummVM/Windows_CE
- Debian GNU/Linux:
- * Installieren Sie die Pakete т€žbuild-essentialт€œ, т€žfakerootт€œ, т€ždebhelperт€œ,
- und т€žlibsdl1.2-devт€œ auf Ihrem Betriebssystem.
- * Installieren Sie beliebig viele der folgenden Pakete (optional):
- т€žlibvorbis-devт€œ (fУМr Ogg-Vorbis-UnterstУМtzung), т€žlibasound2-devт€œ (fУМr
- ALSA-Sequenzer-UnterstУМtzung), т€žlibmad0-devт€œ (fУМr MAD-MP3-UnterstУМtzung),
- т€žzlib1g-devт€œ (fУМr UnterstУМtzung von komprimierten SpielstУЄnden)
- * Rufen Sie т€žmake debт€œ auf.
- * Rufen Sie zum Schluss т€ždpkg -i ../scummvm-cvs*debт€œ auf und
- Sie sind fertig.
-
Mac OS X:
* Stellen Sie sicher, dass Sie die т€žDeveloperт€œ-Tools installiert haben.
* Das т€žDeveloperт€œ-Paket von SDL fУМr OS X, das auf der SDL-Website
@@ -2304,4 +2344,4 @@ http://www.scummvm.org/
(Deutscher Text basiert auf README mit SHA1-ID:
-264240eb5da43b8b1fbe309bbafb00aff7e1b51b)
+d1de75a6ca828ab2fcdbce6352a12337f93fc21c)
diff --git a/doc/de/Neues b/doc/de/Neues
index efd79b87e0..23fe6751c1 100644
--- a/doc/de/Neues
+++ b/doc/de/Neues
@@ -1,8 +1,61 @@
-Umfangreichere У„nderungsaufzeichnungen des neusten experimentellen Codes finden
+яЛПUmfangreichere У„nderungsaufzeichnungen des neusten experimentellen Codes finden
Sie auf Englisch unter:
https://github.com/scummvm/scummvm/commits/
-1.4.0 (??.??.????)
+1.5.0 (??.??.????)
+ Neue Spiele:
+ - UnterstУМtzung fУМr Soltys hinzugefУМgt.
+
+ SDL-Portierungen:
+ - UnterstУМtzung fУМr OpenGL hinzugefУМgt. (GSoC-Aufgabe)
+
+ Cine:
+ - Roland-MT-32-Ausgabetreiber integriert.
+
+ SCUMM:
+ - UnterstУМtzung fУМr die Macintosh-Version von SPY Fox in Hold the Mustard
+ hinzugefУМgt.
+ - Dialog zur Auswahl des Schwierigkeitsgrads fУМr Loom FM-TOWNS hinzugefУМgt.
+
+ Sword1:
+ - Falsche Soundeffekte in der DOS-/Windows-Demo korrigiert.
+
+ Windows-Portierung:
+ - StandardmУЄУŸiger Speicherort fУМr SpielstУЄnde bei
+ Windows NT4/2000/XP/Vista/7 geУЄndert.
+
+1.4.1 (27.01.2012)
+ AGOS:
+ - Das Laden von Videos direkt aus InstallShield-Archiven in der
+ Windows-Version von Floyd - Es gibt noch Helden korrigiert.
+
+ BASS:
+ - UnterstУМtzung fУМr verbesserte Musik von James Woodcock hinzugefУМgt
+ (http://www.jameswoodcock.co.uk/?p=7695).
+
+ KYRA:
+ - Fehler in der originalen BenutzeroberflУЄche von Lands of Lore beseitigt,
+ der dazu fУМhrte, dass ScummVM abstУМrzte, wenn der Anwender keine
+ durchgehend fortlaufenden SpeicherplУЄtze verwendete.
+ - UnterstУМtzung fУМr originale DOS-SpeicherstУЄnde von Lands of Lore
+ hinzugefУМgt (trifft auch auf SpeicherstУЄnde zu, die mit der GOG-Version
+ gemacht wurden).
+
+ SCI:
+ - Abfolgebedingung bei SCI1.1-PalettenУЄnderungen korrigiert. Dies behebt
+ einen Fehler in QFG1VGA, wenn man in Erana's Peace schlУЄft.
+ - Die Option, um zwischen digitalisierten und synthetisierten
+ Soundeffekten auszuwУЄhlen, wurde bis auf Weiteres deaktiviert, bis eine
+ anwenderfreundlichere BenutzeroberflУЄchen-Option mУЖglich ist.
+ Digitale Soundeffekte werden vorerst immer bevorzugt.
+ - Fehler in einem Fall beseitigt, bei welchem bei Beginn eines neuen Liedes
+ nicht alle KanУЄle zurУМckgesetzt wurden und somit einige Noten falsch
+ klangen.
+
+ Sword2:
+ - Leichte Grafikverbesserung fУМr PSX-Version.
+
+1.4.0 (11.11.2011)
Neue Spiele:
- UnterstУМtzung fУМr Lands of Lore: The Throne of Chaos hinzugefУМgt.
- UnterstУМtzung fУМr Blue's Birthday Adventure hinzugefУМgt.
@@ -13,6 +66,11 @@ Sie auf Englisch unter:
Neue Portierungen:
- Portierung fУМr PlayStation 3 hinzugefУМgt.
+ Allgemein:
+ - ARM-Assembler-Routinen fУМr Stereo-Umkehr bei Audio repariert.
+ - UnterstУМtzung fУМr unkomplizierte Zusammenstellung mit MacPorts
+ hinzugefУМgt.
+
AGI:
- Sound-UnterstУМtzung fУМr die DOS-Version von Winnie the Pooh in the
Hundred Acre Wood integriert.
@@ -47,9 +105,10 @@ Sie auf Englisch unter:
- Palettenhandhabung in der Amiga-Version von Indiana Jones and the
Fate of Atlantis verbessert.
-
- SDL-Portierungen:
- - UnterstУМtzung fУМr OpenGL hinzugefУМgt. (GSoC-Aufgabe)
+ Sword1:
+ - AufhУЄngen in Windows-Demo beseitigt.
+ - Absturz beseitigt, wenn Untertitelpaket fУМr Zwischensequenzen in
+ Macintosh-Version verwendet wird.
Tinsel:
- LУЖschen von SpielstУЄnden aus der Liste der SpeicherstУЄnde korrigiert (im
@@ -57,6 +116,10 @@ Sie auf Englisch unter:
- Die US-Version von Discworld II zeigt nun den korrekten Titelbildschirm und
die richtige Sprachenflagge.
+ Android-Portierung:
+ - Plugins bei Android 3.x repariert.
+ - StandardmУЄУŸigen Speicherort fУМr SpielstУЄnde auf SD-Karte verschoben.
+
1.3.1 (12.07.2011)
Allgemein:
- AudiogerУЄte-Erkennung und ZurУМckgreifen auf Alternativen verbessert.
@@ -1607,4 +1670,4 @@ Sie auf Englisch unter:
(Deutscher Text basiert auf NEWS mit SHA1-ID:
-744f8507d714da5710c020bf56aa49dd0662acf6)
+ab2b020ff10b2e5d25cc93757029838c7eac6b41)
diff --git a/engines/agi/agi.cpp b/engines/agi/agi.cpp
index 4ed606c3ba..e9c9645768 100644
--- a/engines/agi/agi.cpp
+++ b/engines/agi/agi.cpp
@@ -250,19 +250,7 @@ void AgiEngine::processEvents() {
// Not a special key, so get the ASCII code for it
key = event.kbd.ascii;
- // Function isalpha is defined in <ctype.h> so the following applies to it:
- //
- // The C Programming Language Standard states:
- // The header <ctype.h> declares several functions useful for classifying
- // and mapping characters. In all cases the argument is an int, the value
- // of which shall be representable as an unsigned char or shall equal the
- // value of the macro EOF. If the argument has any other value, the
- // behavior is undefined.
- //
- // For a concrete example (e.g. in Microsoft Visual Studio 2003):
- // When used with a debug CRT library, isalpha will display a CRT assert
- // if passed a parameter that isn't EOF or in the range of 0 through 0xFF.
- if (key >= 0 && key <= 0xFF && isalpha(key)) {
+ if (Common::isAlpha(key)) {
// Key is A-Z.
// Map Ctrl-A to 1, Ctrl-B to 2, etc.
if (event.kbd.flags & Common::KBD_CTRL) {
diff --git a/engines/agi/agi.h b/engines/agi/agi.h
index e9923aba2e..ea3afa5ca3 100644
--- a/engines/agi/agi.h
+++ b/engines/agi/agi.h
@@ -631,7 +631,7 @@ struct AgiGame {
AgiLogic *_curLogic;
// words
- Common::Array<AgiWord*> words[26];
+ Common::Array<AgiWord *> words[26];
// view table
VtEntry viewTable[MAX_VIEWTABLE];
diff --git a/engines/agi/checks.cpp b/engines/agi/checks.cpp
index c3b31f6ba9..624476509e 100644
--- a/engines/agi/checks.cpp
+++ b/engines/agi/checks.cpp
@@ -113,6 +113,22 @@ int AgiEngine::checkPriority(VtEntry *v) {
water = 1;
+ // Check if any picture is loaded before checking for priority below.
+ // If no picture has been loaded, the priority buffer won't be initialized,
+ // thus the check below will always fail. This case causes an infinite loop
+ // in the fanmade game Nick's Quest (bug #3451122), as the game attempts to
+ // draw a sprite (view 4, floating Nick) before it loads any picture. This
+ // causes the checks below to always fail, and the engine keeps readjusting
+ // the sprite's position in fixPosition() forever, as there is no valid
+ // position to place it (the default visual and priority screen is set to
+ // zero, i.e. unconditional black). To remedy this situation, we always
+ // return true here if no picture has been loaded and no priority screen
+ // has been set up.
+ if (!_game._vm->_picture->isPictureLoaded()) {
+ warning("checkPriority: no picture loaded");
+ return pass;
+ }
+
p0 = &_game.sbuf16c[v->xPos + v->yPos * _WIDTH];
for (i = 0; i < v->xSize; i++, p0++) {
diff --git a/engines/agi/menu.h b/engines/agi/menu.h
index e659c71fab..1d5828d78a 100644
--- a/engines/agi/menu.h
+++ b/engines/agi/menu.h
@@ -33,8 +33,8 @@ namespace Agi {
struct AgiMenu;
struct AgiMenuOption;
-typedef Common::List<AgiMenu*> MenuList;
-typedef Common::List<AgiMenuOption*> MenuOptionList;
+typedef Common::List<AgiMenu *> MenuList;
+typedef Common::List<AgiMenuOption *> MenuOptionList;
class GfxMgr;
class PictureMgr;
diff --git a/engines/agi/picture.h b/engines/agi/picture.h
index f2a6586b93..45a95202e5 100644
--- a/engines/agi/picture.h
+++ b/engines/agi/picture.h
@@ -115,6 +115,8 @@ public:
putVirtPixel(x, y);
}
+ bool isPictureLoaded() { return _data != NULL; }
+
private:
uint8 *_data;
uint32 _flen;
diff --git a/engines/agi/preagi_mickey.h b/engines/agi/preagi_mickey.h
index 673839a592..18b0593d78 100644
--- a/engines/agi/preagi_mickey.h
+++ b/engines/agi/preagi_mickey.h
@@ -704,7 +704,7 @@ protected:
void readOfsData(int, int, uint8*, long);
bool chooseY_N(int, bool);
int choose1to9(int);
- void printStr(char*);
+ void printStr(char *);
void printLine(const char*);
void printExeStr(int);
void printExeMsg(int);
diff --git a/engines/agi/preagi_troll.cpp b/engines/agi/preagi_troll.cpp
index 50b2945383..b7d2801076 100644
--- a/engines/agi/preagi_troll.cpp
+++ b/engines/agi/preagi_troll.cpp
@@ -455,7 +455,7 @@ int TrollEngine::drawRoom(char *menu) {
_gfx->doUpdate();
char tmp[10];
- strncat(menu, (char*)_gameData + _locMessagesIdx[_currentRoom], 39);
+ strncat(menu, (char *)_gameData + _locMessagesIdx[_currentRoom], 39);
for (int i = 0; i < 3; i++) {
if (_roomDescs[_roomPicture - 1].options[i]) {
@@ -725,7 +725,7 @@ void TrollEngine::fillOffsets() {
void TrollEngine::init() {
_picture->setPictureVersion(AGIPIC_V15);
- //SetScreenPar(320, 200, (char*)ibm_fontdata);
+ //SetScreenPar(320, 200, (char *)ibm_fontdata);
const int gaps[] = { 0x3A40, 0x4600, 0x4800, 0x5800, 0x5a00, 0x6a00,
0x6c00, 0x7400, 0x7600, 0x7c00, 0x7e00, 0x8e00,
diff --git a/engines/agi/saveload.cpp b/engines/agi/saveload.cpp
index 00d6a1c8dd..0ef6230374 100644
--- a/engines/agi/saveload.cpp
+++ b/engines/agi/saveload.cpp
@@ -221,8 +221,8 @@ int AgiEngine::saveGame(const Common::String &fileName, const Common::String &de
// Save image stack
- for (i = 0; i < _imageStack.size(); i++) {
- ImageStackElement ise = _imageStack[i];
+ for (Common::Stack<ImageStackElement>::size_type j = 0; j < _imageStack.size(); ++j) {
+ const ImageStackElement &ise = _imageStack[j];
out->writeByte(ise.type);
out->writeSint16BE(ise.parm1);
out->writeSint16BE(ise.parm2);
diff --git a/engines/agi/sound_2gs.cpp b/engines/agi/sound_2gs.cpp
index b15950f31d..bfc8d4d8f3 100644
--- a/engines/agi/sound_2gs.cpp
+++ b/engines/agi/sound_2gs.cpp
@@ -68,10 +68,10 @@ int SoundGen2GS::readBuffer(int16 *buffer, const int numSamples) {
static uint data_available = 0;
static uint data_offset = 0;
uint n = numSamples << 1;
- uint8 *p = (uint8*)buffer;
+ uint8 *p = (uint8 *)buffer;
while (n > data_available) {
- memcpy(p, (uint8*)_out + data_offset, data_available);
+ memcpy(p, (uint8 *)_out + data_offset, data_available);
p += data_available;
n -= data_available;
@@ -81,7 +81,7 @@ int SoundGen2GS::readBuffer(int16 *buffer, const int numSamples) {
data_offset = 0;
}
- memcpy(p, (uint8*)_out + data_offset, n);
+ memcpy(p, (uint8 *)_out + data_offset, n);
data_offset += n;
data_available -= n;
diff --git a/engines/agi/sound_sarien.cpp b/engines/agi/sound_sarien.cpp
index a2baf89d12..576801bc56 100644
--- a/engines/agi/sound_sarien.cpp
+++ b/engines/agi/sound_sarien.cpp
@@ -330,7 +330,7 @@ void SoundGenSarien::fillAudio(int16 *stream, uint len) {
debugC(5, kDebugLevelSound, "(%p, %d)", (void *)stream, len);
while (len > data_available) {
- memcpy((uint8 *)stream + p, (uint8*)_sndBuffer + data_offset, data_available);
+ memcpy((uint8 *)stream + p, (uint8 *)_sndBuffer + data_offset, data_available);
p += data_available;
len -= data_available;
@@ -339,7 +339,7 @@ void SoundGenSarien::fillAudio(int16 *stream, uint len) {
data_offset = 0;
}
- memcpy((uint8 *)stream + p, (uint8*)_sndBuffer + data_offset, len);
+ memcpy((uint8 *)stream + p, (uint8 *)_sndBuffer + data_offset, len);
data_offset += len;
data_available -= len;
}
diff --git a/engines/agi/sprite.cpp b/engines/agi/sprite.cpp
index 8d13be3f68..ea2d329fb0 100644
--- a/engines/agi/sprite.cpp
+++ b/engines/agi/sprite.cpp
@@ -55,7 +55,7 @@ void *SpritesMgr::poolAlloc(int size) {
// Adjust size to sizeof(void *) boundary to prevent data misalignment
// errors.
- const int alignPadding = sizeof(void*) - 1;
+ const int alignPadding = sizeof(void *) - 1;
size = (size + alignPadding) & ~alignPadding;
x = _poolTop;
diff --git a/engines/agi/sprite.h b/engines/agi/sprite.h
index 68f0e32b86..851c2438fb 100644
--- a/engines/agi/sprite.h
+++ b/engines/agi/sprite.h
@@ -27,7 +27,7 @@ namespace Agi {
struct Sprite;
-typedef Common::List<Sprite*> SpriteList;
+typedef Common::List<Sprite *> SpriteList;
class AgiEngine;
class GfxMgr;
diff --git a/engines/agi/wagparser.cpp b/engines/agi/wagparser.cpp
index 39f9e0dd92..61feac5d17 100644
--- a/engines/agi/wagparser.cpp
+++ b/engines/agi/wagparser.cpp
@@ -112,11 +112,11 @@ WagFileParser::~WagFileParser() {
bool WagFileParser::checkAgiVersionProperty(const WagProperty &version) const {
if (version.getCode() == WagProperty::PC_INTVERSION && // Must be AGI interpreter version property
version.getSize() >= 3 && // Need at least three characters for a version number like "X.Y"
- isdigit(static_cast<unsigned char>(version.getData()[0])) && // And the first character must be a digit
+ Common::isDigit(version.getData()[0]) && // And the first character must be a digit
(version.getData()[1] == ',' || version.getData()[1] == '.')) { // And the second a comma or a period
for (int i = 2; i < version.getSize(); i++) // And the rest must all be digits
- if (!isdigit(static_cast<unsigned char>(version.getData()[i])))
+ if (!Common::isDigit(version.getData()[i]))
return false; // Bail out if found a non-digit after the decimal point
return true;
diff --git a/engines/agi/words.cpp b/engines/agi/words.cpp
index 1001c66b20..4400112247 100644
--- a/engines/agi/words.cpp
+++ b/engines/agi/words.cpp
@@ -130,7 +130,7 @@ int AgiEngine::findWord(const char *word, int *flen) {
return -1;
*flen = 0;
- Common::Array<AgiWord*> &a = _game.words[c];
+ Common::Array<AgiWord *> &a = _game.words[c];
for (int i = 0; i < (int)a.size(); i++) {
int wlen = strlen(a[i]->word);
diff --git a/engines/agos/agos.h b/engines/agos/agos.h
index 03feafa70f..d9f982a0fa 100644
--- a/engines/agos/agos.h
+++ b/engines/agos/agos.h
@@ -197,8 +197,12 @@ public:
void registerArchive(const Common::String &filename, int priority);
#endif
- bool hasFile(const Common::String &name);
- Common::SeekableReadStream *open(const Common::String &filename);
+ virtual bool hasFile(const Common::String &name) const;
+ virtual int listMatchingMembers(Common::ArchiveMemberList &list, const Common::String &pattern) const;
+ virtual int listMembers(Common::ArchiveMemberList &list) const;
+
+ virtual const Common::ArchiveMemberPtr getMember(const Common::String &name) const;
+ virtual Common::SeekableReadStream *createReadStreamForMember(const Common::String &filename) const;
private:
bool _fallBack;
diff --git a/engines/agos/animation.cpp b/engines/agos/animation.cpp
index db2cff328c..29d1b36e19 100644
--- a/engines/agos/animation.cpp
+++ b/engines/agos/animation.cpp
@@ -251,7 +251,7 @@ bool MoviePlayerDXA::load() {
}
Common::String videoName = Common::String::format("%s.dxa", baseName);
- Common::SeekableReadStream *videoStream = _vm->_archives.open(videoName);
+ Common::SeekableReadStream *videoStream = _vm->_archives.createReadStreamForMember(videoName);
if (!videoStream)
error("Failed to load video file %s", videoName.c_str());
if (!loadStream(videoStream))
@@ -312,7 +312,7 @@ void MoviePlayerDXA::startSound() {
_fileStream->seek(size, SEEK_CUR);
- in.open((const char *)"audio.wav");
+ in.open("audio.wav");
if (!in.isOpen()) {
error("Can't read offset file 'audio.wav'");
}
@@ -415,7 +415,7 @@ MoviePlayerSMK::MoviePlayerSMK(AGOSEngine_Feeble *vm, const char *name)
bool MoviePlayerSMK::load() {
Common::String videoName = Common::String::format("%s.smk", baseName);
- Common::SeekableReadStream *videoStream = _vm->_archives.open(videoName);
+ Common::SeekableReadStream *videoStream = _vm->_archives.createReadStreamForMember(videoName);
if (!videoStream)
error("Failed to load video file %s", videoName.c_str());
if (!loadStream(videoStream))
diff --git a/engines/agos/res.cpp b/engines/agos/res.cpp
index 62197340d2..0305879390 100644
--- a/engines/agos/res.cpp
+++ b/engines/agos/res.cpp
@@ -47,19 +47,37 @@ void ArchiveMan::registerArchive(const Common::String &filename, int priority) {
}
#endif
-bool ArchiveMan::hasFile(const Common::String &name) {
+bool ArchiveMan::hasFile(const Common::String &name) const {
if (_fallBack && SearchMan.hasFile(name))
return true;
return Common::SearchSet::hasFile(name);
}
-Common::SeekableReadStream *ArchiveMan::open(const Common::String &filename) {
+int ArchiveMan::listMatchingMembers(Common::ArchiveMemberList &list, const Common::String &pattern) const {
+ const int matches = _fallBack ? SearchMan.listMatchingMembers(list, pattern) : 0;
+ return matches + Common::SearchSet::listMatchingMembers(list, pattern);
+}
+
+int ArchiveMan::listMembers(Common::ArchiveMemberList &list) const {
+ const int matches = _fallBack ? SearchMan.listMembers(list) : 0;
+ return matches + Common::SearchSet::listMembers(list);
+}
+
+const Common::ArchiveMemberPtr ArchiveMan::getMember(const Common::String &name) const {
+ Common::ArchiveMemberPtr ptr = _fallBack ? SearchMan.getMember(name) : Common::ArchiveMemberPtr();
+ if (ptr)
+ return ptr;
+
+ return Common::SearchSet::getMember(name);
+}
+
+Common::SeekableReadStream *ArchiveMan::createReadStreamForMember(const Common::String &filename) const {
if (_fallBack && SearchMan.hasFile(filename)) {
return SearchMan.createReadStreamForMember(filename);
}
- return createReadStreamForMember(filename);
+ return Common::SearchSet::createReadStreamForMember(filename);
}
#ifdef ENABLE_AGOS2
@@ -180,7 +198,7 @@ void AGOSEngine_PN::loadGamePcFile() {
if (getFileName(GAME_BASEFILE) != NULL) {
// Read dataBase
- in = _archives.open(getFileName(GAME_BASEFILE));
+ in = _archives.createReadStreamForMember(getFileName(GAME_BASEFILE));
if (!in) {
error("loadGamePcFile: Can't load database file '%s'", getFileName(GAME_BASEFILE));
}
@@ -198,7 +216,7 @@ void AGOSEngine_PN::loadGamePcFile() {
if (getFileName(GAME_TEXTFILE) != NULL) {
// Read textBase
- in = _archives.open(getFileName(GAME_TEXTFILE));
+ in = _archives.createReadStreamForMember(getFileName(GAME_TEXTFILE));
if (!in) {
error("loadGamePcFile: Can't load textbase file '%s'", getFileName(GAME_TEXTFILE));
}
@@ -221,7 +239,7 @@ void AGOSEngine::loadGamePcFile() {
if (getFileName(GAME_BASEFILE) != NULL) {
/* Read main gamexx file */
- in = _archives.open(getFileName(GAME_BASEFILE));
+ in = _archives.createReadStreamForMember(getFileName(GAME_BASEFILE));
if (!in) {
error("loadGamePcFile: Can't load gamexx file '%s'", getFileName(GAME_BASEFILE));
}
@@ -247,7 +265,7 @@ void AGOSEngine::loadGamePcFile() {
if (getFileName(GAME_TBLFILE) != NULL) {
/* Read list of TABLE resources */
- in = _archives.open(getFileName(GAME_TBLFILE));
+ in = _archives.createReadStreamForMember(getFileName(GAME_TBLFILE));
if (!in) {
error("loadGamePcFile: Can't load table resources file '%s'", getFileName(GAME_TBLFILE));
}
@@ -268,7 +286,7 @@ void AGOSEngine::loadGamePcFile() {
if (getFileName(GAME_STRFILE) != NULL) {
/* Read list of TEXT resources */
- in = _archives.open(getFileName(GAME_STRFILE));
+ in = _archives.createReadStreamForMember(getFileName(GAME_STRFILE));
if (!in)
error("loadGamePcFile: Can't load text resources file '%s'", getFileName(GAME_STRFILE));
@@ -282,7 +300,7 @@ void AGOSEngine::loadGamePcFile() {
if (getFileName(GAME_STATFILE) != NULL) {
/* Read list of ROOM STATE resources */
- in = _archives.open(getFileName(GAME_STATFILE));
+ in = _archives.createReadStreamForMember(getFileName(GAME_STATFILE));
if (!in) {
error("loadGamePcFile: Can't load state resources file '%s'", getFileName(GAME_STATFILE));
}
@@ -305,7 +323,7 @@ void AGOSEngine::loadGamePcFile() {
if (getFileName(GAME_RMSLFILE) != NULL) {
/* Read list of ROOM ITEMS resources */
- in = _archives.open(getFileName(GAME_RMSLFILE));
+ in = _archives.createReadStreamForMember(getFileName(GAME_RMSLFILE));
if (!in) {
error("loadGamePcFile: Can't load room resources file '%s'", getFileName(GAME_RMSLFILE));
}
@@ -321,7 +339,7 @@ void AGOSEngine::loadGamePcFile() {
if (getFileName(GAME_XTBLFILE) != NULL) {
/* Read list of XTABLE resources */
- in = _archives.open(getFileName(GAME_XTBLFILE));
+ in = _archives.createReadStreamForMember(getFileName(GAME_XTBLFILE));
if (!in) {
error("loadGamePcFile: Can't load xtable resources file '%s'", getFileName(GAME_XTBLFILE));
}
@@ -822,7 +840,7 @@ void AGOSEngine::loadVGABeardFile(uint16 id) {
sprintf(filename, "0%d.VGA", id);
}
- in = _archives.open(filename);
+ in = _archives.createReadStreamForMember(filename);
if (!in)
error("loadSimonVGAFile: Can't load %s", filename);
@@ -900,7 +918,7 @@ void AGOSEngine::loadVGAVideoFile(uint16 id, uint8 type, bool useError) {
}
}
- in = _archives.open(filename);
+ in = _archives.createReadStreamForMember(filename);
if (!in) {
if (useError)
error("loadVGAVideoFile: Can't load %s", filename);
diff --git a/engines/agos/res_snd.cpp b/engines/agos/res_snd.cpp
index e9a7ea4de9..2777d4f269 100644
--- a/engines/agos/res_snd.cpp
+++ b/engines/agos/res_snd.cpp
@@ -452,7 +452,7 @@ static const char *const dimpSoundList[32] = {
void AGOSEngine::loadSoundFile(const char* filename) {
Common::SeekableReadStream *in;
- in = _archives.open(filename);
+ in = _archives.createReadStreamForMember(filename);
if (!in)
error("loadSound: Can't load %s", filename);
@@ -475,7 +475,7 @@ void AGOSEngine::loadSound(uint16 sound, int16 pan, int16 vol, uint16 type) {
assert(sound >= 1 && sound <= 32);
sprintf(filename, "%s.wav", dimpSoundList[sound - 1]);
- in = _archives.open(filename);
+ in = _archives.createReadStreamForMember(filename);
if (!in)
error("loadSound: Can't load %s", filename);
diff --git a/engines/agos/saveload.cpp b/engines/agos/saveload.cpp
index 920dbb0a0d..4fbde09ff8 100644
--- a/engines/agos/saveload.cpp
+++ b/engines/agos/saveload.cpp
@@ -1019,7 +1019,7 @@ bool AGOSEngine::loadGame(const char *filename, bool restartMode) {
if (restartMode) {
// Load restart state
- f = _archives.open(filename);
+ f = _archives.createReadStreamForMember(filename);
} else {
f = _saveFileMan->openForLoading(filename);
}
@@ -1193,7 +1193,7 @@ bool AGOSEngine_Elvira2::loadGame(const char *filename, bool restartMode) {
if (restartMode) {
// Load restart state
- f = _archives.open(filename);
+ f = _archives.createReadStreamForMember(filename);
} else {
f = _saveFileMan->openForLoading(filename);
}
diff --git a/engines/agos/script_pn.cpp b/engines/agos/script_pn.cpp
index 196350b9bf..60a1376f25 100644
--- a/engines/agos/script_pn.cpp
+++ b/engines/agos/script_pn.cpp
@@ -466,8 +466,8 @@ void AGOSEngine_PN::opn_opcode35() {
void AGOSEngine_PN::opn_opcode36() {
for (int i = 0; i < _dataBase[57] + 1; ++i)
_wordcp[i] = 0;
- if (isspace(static_cast<unsigned char>(*_inpp)))
- while ((*_inpp) && (isspace(static_cast<unsigned char>(*_inpp))))
+ if (Common::isSpace(*_inpp))
+ while ((*_inpp) && (Common::isSpace(*_inpp)))
_inpp++;
if (*_inpp == 0) {
setScriptReturn(false);
@@ -481,7 +481,7 @@ void AGOSEngine_PN::opn_opcode36() {
}
int ct = 1;
- while ((*_inpp != '.') && (*_inpp != ',') && (!isspace(static_cast<unsigned char>(*_inpp))) && (*_inpp != '\0') &&
+ while ((*_inpp != '.') && (*_inpp != ',') && (!Common::isSpace(*_inpp)) && (*_inpp != '\0') &&
(*_inpp!='"')) {
if (ct < _dataBase[57])
_wordcp[ct++] = *_inpp;
@@ -581,7 +581,7 @@ void AGOSEngine_PN::opn_opcode46() {
return;
}
x++;
- while ((*x != '.') && (*x != ',') && (*x != '"') && (!isspace(static_cast<unsigned char>(*x))) && (*x != '\0'))
+ while ((*x != '.') && (*x != ',') && (*x != '"') && (!Common::isSpace(*x)) && (*x != '\0'))
pcf(*x++);
setScriptReturn(true);
}
diff --git a/engines/agos/sound.cpp b/engines/agos/sound.cpp
index 4917aefa4d..85c449eafc 100644
--- a/engines/agos/sound.cpp
+++ b/engines/agos/sound.cpp
@@ -22,9 +22,9 @@
#include "common/file.h"
#include "common/memstream.h"
-#include "common/ptr.h"
#include "common/textconsole.h"
#include "common/util.h"
+#include "common/substream.h"
#include "agos/agos.h"
#include "agos/sound.h"
@@ -44,34 +44,39 @@ namespace AGOS {
class BaseSound : Common::NonCopyable {
protected:
- Common::DisposablePtr<Common::File> _file;
+ const Common::String _filename;
uint32 *_offsets;
Audio::Mixer *_mixer;
bool _freeOffsets;
+ Common::SeekableReadStream *getSoundStream(uint sound) const;
public:
- BaseSound(Audio::Mixer *mixer, Common::File *file, uint32 base, bool bigEndian, DisposeAfterUse::Flag disposeFileAfterUse = DisposeAfterUse::YES);
- BaseSound(Audio::Mixer *mixer, Common::File *file, uint32 *offsets, DisposeAfterUse::Flag disposeFileAfterUse = DisposeAfterUse::YES);
+ BaseSound(Audio::Mixer *mixer, const Common::String &filename, uint32 base, bool bigEndian);
+ BaseSound(Audio::Mixer *mixer, const Common::String &filename, uint32 *offsets);
virtual ~BaseSound();
void playSound(uint sound, Audio::Mixer::SoundType type, Audio::SoundHandle *handle, bool loop, int vol = 0) {
playSound(sound, sound, type, handle, loop, vol);
}
- virtual void playSound(uint sound, uint loopSound, Audio::Mixer::SoundType type, Audio::SoundHandle *handle, bool loop, int vol = 0) = 0;
+ virtual void playSound(uint sound, uint loopSound, Audio::Mixer::SoundType type, Audio::SoundHandle *handle, bool loop, int vol = 0);
virtual Audio::AudioStream *makeAudioStream(uint sound) = 0;
};
-BaseSound::BaseSound(Audio::Mixer *mixer, Common::File *file, uint32 base, bool bigEndian, DisposeAfterUse::Flag disposeFileAfterUse)
- : _mixer(mixer), _file(file, disposeFileAfterUse) {
+BaseSound::BaseSound(Audio::Mixer *mixer, const Common::String &filename, uint32 base, bool bigEndian)
+ : _mixer(mixer), _filename(filename), _offsets(NULL) {
uint res = 0;
uint32 size;
- _file->seek(base + sizeof(uint32), SEEK_SET);
+ Common::File file;
+ if (!file.open(_filename))
+ error("BaseSound: Could not open file \"%s\"", filename.c_str());
+
+ file.seek(base + sizeof(uint32), SEEK_SET);
if (bigEndian)
- size = _file->readUint32BE();
+ size = file.readUint32BE();
else
- size = _file->readUint32LE();
+ size = file.readUint32LE();
// The Feeble Files uses set amount of voice offsets
if (size == 0)
@@ -82,24 +87,20 @@ BaseSound::BaseSound(Audio::Mixer *mixer, Common::File *file, uint32 base, bool
_offsets = (uint32 *)malloc(size + sizeof(uint32));
_freeOffsets = true;
- _file->seek(base, SEEK_SET);
+ file.seek(base, SEEK_SET);
for (uint i = 0; i < res; i++) {
if (bigEndian)
- _offsets[i] = base + _file->readUint32BE();
+ _offsets[i] = base + file.readUint32BE();
else
- _offsets[i] = base + _file->readUint32LE();
+ _offsets[i] = base + file.readUint32LE();
}
- // only needed for mp3
- _offsets[res] = _file->size();
+ _offsets[res] = file.size();
}
-BaseSound::BaseSound(Audio::Mixer *mixer, Common::File *file, uint32 *offsets, DisposeAfterUse::Flag disposeFileAfterUse)
- : _mixer(mixer), _file(file, disposeFileAfterUse) {
-
- _offsets = offsets;
- _freeOffsets = false;
+BaseSound::BaseSound(Audio::Mixer *mixer, const Common::String &filename, uint32 *offsets)
+ : _mixer(mixer), _filename(filename), _offsets(offsets), _freeOffsets(false) {
}
BaseSound::~BaseSound() {
@@ -107,6 +108,23 @@ BaseSound::~BaseSound() {
free(_offsets);
}
+Common::SeekableReadStream *BaseSound::getSoundStream(uint sound) const {
+ if (_offsets == NULL)
+ return NULL;
+
+ Common::File *file = new Common::File();
+ if (!file->open(_filename)) {
+ warning("BaseSound::getSoundStream: Could not open file \"%s\"", _filename.c_str());
+ return NULL;
+ }
+
+ int i = 1;
+ while (_offsets[sound + i] == _offsets[sound])
+ i++;
+
+ return new Common::SeekableSubReadStream(file, _offsets[sound], _offsets[sound + i], DisposeAfterUse::YES);
+}
+
///////////////////////////////////////////////////////////////////////////////
#pragma mark -
@@ -218,26 +236,25 @@ static void convertPan(int &pan) {
///////////////////////////////////////////////////////////////////////////////
#pragma mark -
+// TODO: Move to a better place?
+void BaseSound::playSound(uint sound, uint loopSound, Audio::Mixer::SoundType type, Audio::SoundHandle *handle, bool loop, int vol) {
+ convertVolume(vol);
+ _mixer->playStream(type, handle, new LoopingAudioStream(this, sound, loopSound, loop), -1, vol);
+}
+
class WavSound : public BaseSound {
public:
- WavSound(Audio::Mixer *mixer, Common::File *file, uint32 base = 0, DisposeAfterUse::Flag disposeFileAfterUse = DisposeAfterUse::YES)
- : BaseSound(mixer, file, base, false, disposeFileAfterUse) {}
- WavSound(Audio::Mixer *mixer, Common::File *file, uint32 *offsets) : BaseSound(mixer, file, offsets) {}
+ WavSound(Audio::Mixer *mixer, const Common::String &filename, uint32 base = 0)
+ : BaseSound(mixer, filename, base, false) {}
+ WavSound(Audio::Mixer *mixer, const Common::String &filename, uint32 *offsets) : BaseSound(mixer, filename, offsets) {}
Audio::AudioStream *makeAudioStream(uint sound);
- void playSound(uint sound, uint loopSound, Audio::Mixer::SoundType type, Audio::SoundHandle *handle, bool loop, int vol = 0);
};
Audio::AudioStream *WavSound::makeAudioStream(uint sound) {
- if (_offsets == NULL)
+ Common::SeekableReadStream *tmp = getSoundStream(sound);
+ if (!tmp)
return NULL;
-
- _file->seek(_offsets[sound], SEEK_SET);
- return Audio::makeWAVStream(_file.get(), DisposeAfterUse::NO);
-}
-
-void WavSound::playSound(uint sound, uint loopSound, Audio::Mixer::SoundType type, Audio::SoundHandle *handle, bool loop, int vol) {
- convertVolume(vol);
- _mixer->playStream(type, handle, new LoopingAudioStream(this, sound, loopSound, loop), -1, vol);
+ return Audio::makeWAVStream(tmp, DisposeAfterUse::YES);
}
///////////////////////////////////////////////////////////////////////////////
@@ -246,21 +263,16 @@ void WavSound::playSound(uint sound, uint loopSound, Audio::Mixer::SoundType typ
class VocSound : public BaseSound {
const byte _flags;
public:
- VocSound(Audio::Mixer *mixer, Common::File *file, bool isUnsigned, uint32 base = 0, bool bigEndian = false, DisposeAfterUse::Flag disposeFileAfterUse = DisposeAfterUse::YES)
- : BaseSound(mixer, file, base, bigEndian, disposeFileAfterUse), _flags(isUnsigned ? Audio::FLAG_UNSIGNED : 0) {}
+ VocSound(Audio::Mixer *mixer, const Common::String &filename, bool isUnsigned, uint32 base = 0, bool bigEndian = false)
+ : BaseSound(mixer, filename, base, bigEndian), _flags(isUnsigned ? Audio::FLAG_UNSIGNED : 0) {}
Audio::AudioStream *makeAudioStream(uint sound);
- void playSound(uint sound, uint loopSound, Audio::Mixer::SoundType type, Audio::SoundHandle *handle, bool loop, int vol = 0);
};
Audio::AudioStream *VocSound::makeAudioStream(uint sound) {
- assert(_offsets);
- _file->seek(_offsets[sound], SEEK_SET);
- return Audio::makeVOCStream(_file.get(), _flags);
-}
-
-void VocSound::playSound(uint sound, uint loopSound, Audio::Mixer::SoundType type, Audio::SoundHandle *handle, bool loop, int vol) {
- convertVolume(vol);
- _mixer->playStream(type, handle, new LoopingAudioStream(this, sound, loopSound, loop), -1, vol);
+ Common::SeekableReadStream *tmp = getSoundStream(sound);
+ if (!tmp)
+ return NULL;
+ return Audio::makeVOCStream(tmp, _flags, DisposeAfterUse::YES);
}
///////////////////////////////////////////////////////////////////////////////
@@ -270,8 +282,8 @@ void VocSound::playSound(uint sound, uint loopSound, Audio::Mixer::SoundType typ
class RawSound : public BaseSound {
const byte _flags;
public:
- RawSound(Audio::Mixer *mixer, Common::File *file, bool isUnsigned)
- : BaseSound(mixer, file, 0, SOUND_BIG_ENDIAN), _flags(isUnsigned ? Audio::FLAG_UNSIGNED : 0) {}
+ RawSound(Audio::Mixer *mixer, const Common::String &filename, bool isUnsigned)
+ : BaseSound(mixer, filename, 0, SOUND_BIG_ENDIAN), _flags(isUnsigned ? Audio::FLAG_UNSIGNED : 0) {}
Audio::AudioStream *makeAudioStream(uint sound);
void playSound(uint sound, uint loopSound, Audio::Mixer::SoundType type, Audio::SoundHandle *handle, bool loop, int vol = 0);
};
@@ -280,14 +292,15 @@ Audio::AudioStream *RawSound::makeAudioStream(uint sound) {
if (_offsets == NULL)
return NULL;
- _file->seek(_offsets[sound], SEEK_SET);
-
- uint size = _file->readUint32BE();
- byte *buffer = (byte *)malloc(size);
- assert(buffer);
- _file->read(buffer, size);
-
- return Audio::makeRawStream(buffer, size, 22050, _flags);
+ Common::File *file = new Common::File();
+ if (!file->open(_filename)) {
+ warning("RawSound::makeAudioStream: Could not open file \"%s\"", _filename.c_str());
+ return NULL;
+ }
+
+ file->seek(_offsets[sound], SEEK_SET);
+ uint size = file->readUint32BE();
+ return Audio::makeRawStream(new Common::SeekableSubReadStream(file, _offsets[sound] + 4, _offsets[sound] + 4 + size, DisposeAfterUse::YES), 22050, _flags, DisposeAfterUse::YES);
}
void RawSound::playSound(uint sound, uint loopSound, Audio::Mixer::SoundType type, Audio::SoundHandle *handle, bool loop, int vol) {
@@ -298,40 +311,15 @@ void RawSound::playSound(uint sound, uint loopSound, Audio::Mixer::SoundType typ
///////////////////////////////////////////////////////////////////////////////
#pragma mark -
-class CompressedSound : public BaseSound {
-public:
- CompressedSound(Audio::Mixer *mixer, Common::File *file, uint32 base) : BaseSound(mixer, file, base, false) {}
-
- Common::SeekableReadStream *loadStream(uint sound) const {
- if (_offsets == NULL)
- return NULL;
-
- _file->seek(_offsets[sound], SEEK_SET);
-
- int i = 1;
- while (_offsets[sound + i] == _offsets[sound])
- i++;
-
- uint32 size = _offsets[sound + i] - _offsets[sound];
-
- return _file->readStream(size);
- }
-
- void playSound(uint sound, uint loopSound, Audio::Mixer::SoundType type, Audio::SoundHandle *handle, bool loop, int vol = 0) {
- convertVolume(vol);
- _mixer->playStream(type, handle, new LoopingAudioStream(this, sound, loopSound, loop), -1, vol);
- }
-};
-
///////////////////////////////////////////////////////////////////////////////
#pragma mark -
#ifdef USE_MAD
-class MP3Sound : public CompressedSound {
+class MP3Sound : public BaseSound {
public:
- MP3Sound(Audio::Mixer *mixer, Common::File *file, uint32 base = 0) : CompressedSound(mixer, file, base) {}
+ MP3Sound(Audio::Mixer *mixer, const Common::String &filename, uint32 base = 0) : BaseSound(mixer, filename, base, false) {}
Audio::AudioStream *makeAudioStream(uint sound) {
- Common::SeekableReadStream *tmp = loadStream(sound);
+ Common::SeekableReadStream *tmp = getSoundStream(sound);
if (!tmp)
return NULL;
return Audio::makeMP3Stream(tmp, DisposeAfterUse::YES);
@@ -343,11 +331,11 @@ public:
#pragma mark -
#ifdef USE_VORBIS
-class VorbisSound : public CompressedSound {
+class VorbisSound : public BaseSound {
public:
- VorbisSound(Audio::Mixer *mixer, Common::File *file, uint32 base = 0) : CompressedSound(mixer, file, base) {}
+ VorbisSound(Audio::Mixer *mixer, const Common::String &filename, uint32 base = 0) : BaseSound(mixer, filename, base, false) {}
Audio::AudioStream *makeAudioStream(uint sound) {
- Common::SeekableReadStream *tmp = loadStream(sound);
+ Common::SeekableReadStream *tmp = getSoundStream(sound);
if (!tmp)
return NULL;
return Audio::makeVorbisStream(tmp, DisposeAfterUse::YES);
@@ -359,11 +347,11 @@ public:
#pragma mark -
#ifdef USE_FLAC
-class FLACSound : public CompressedSound {
+class FLACSound : public BaseSound {
public:
- FLACSound(Audio::Mixer *mixer, Common::File *file, uint32 base = 0) : CompressedSound(mixer, file, base) {}
+ FLACSound(Audio::Mixer *mixer, const Common::String &filename, uint32 base = 0) : BaseSound(mixer, filename, base, false) {}
Audio::AudioStream *makeAudioStream(uint sound) {
- Common::SeekableReadStream *tmp = loadStream(sound);
+ Common::SeekableReadStream *tmp = getSoundStream(sound);
if (!tmp)
return NULL;
return Audio::makeFLACStream(tmp, DisposeAfterUse::YES);
@@ -374,25 +362,23 @@ public:
///////////////////////////////////////////////////////////////////////////////
#pragma mark -
-static CompressedSound *makeCompressedSound(Audio::Mixer *mixer, Common::File *file, const Common::String &basename) {
+static BaseSound *makeSound(Audio::Mixer *mixer, const Common::String &basename) {
#ifdef USE_FLAC
- file->open(basename + ".fla");
- if (file->isOpen()) {
- return new FLACSound(mixer, file);
- }
+ if (Common::File::exists(basename + ".fla"))
+ return new FLACSound(mixer, basename + ".fla");
#endif
#ifdef USE_VORBIS
- file->open(basename + ".ogg");
- if (file->isOpen()) {
- return new VorbisSound(mixer, file);
- }
+ if (Common::File::exists(basename + ".ogg"))
+ return new VorbisSound(mixer, basename + ".ogg");
#endif
#ifdef USE_MAD
- file->open(basename + ".mp3");
- if (file->isOpen()) {
- return new MP3Sound(mixer, file);
- }
+ if (Common::File::exists(basename + ".mp3"))
+ return new MP3Sound(mixer, basename + ".mp3");
#endif
+ if (Common::File::exists(basename + ".wav"))
+ return new WavSound(mixer, basename + ".wav");
+ if (Common::File::exists(basename + ".voc"))
+ return new VocSound(mixer, basename + ".voc", true);
return 0;
}
@@ -441,90 +427,59 @@ Sound::~Sound() {
void Sound::loadVoiceFile(const GameSpecificSettings *gss) {
// Game versions which use separate voice files
- if (_vm->getGameType() == GType_FF || _vm->getGameId() == GID_SIMON1CD32)
+ if (_hasVoiceFile || _vm->getGameType() == GType_FF || _vm->getGameId() == GID_SIMON1CD32)
return;
+ _voice = makeSound(_mixer, gss->speech_filename);
+ _hasVoiceFile = (_voice != 0);
- char filename[16];
- Common::File *file = new Common::File();
+ if (_hasVoiceFile)
+ return;
- if (!_hasVoiceFile) {
- _voice = makeCompressedSound(_mixer, file, gss->speech_filename);
- _hasVoiceFile = (_voice != 0);
- }
- if (!_hasVoiceFile && _vm->getGameType() == GType_SIMON2) {
+ if (_vm->getGameType() == GType_SIMON2) {
// for simon2 mac/amiga, only read index file
- file->open("voices.idx");
- if (file->isOpen() == true) {
- int end = file->size();
+ Common::File file;
+ if (file.open("voices.idx")) {
+ int end = file.size();
_filenums = (uint16 *)malloc((end / 6 + 1) * 2);
_offsets = (uint32 *)malloc((end / 6 + 1) * 4);
for (int i = 1; i <= end / 6; i++) {
- _filenums[i] = file->readUint16BE();
- _offsets[i] = file->readUint32BE();
+ _filenums[i] = file.readUint16BE();
+ _offsets[i] = file.readUint32BE();
}
+
_hasVoiceFile = true;
- }
- }
- if (!_hasVoiceFile) {
- sprintf(filename, "%s.wav", gss->speech_filename);
- file->open(filename);
- if (file->isOpen()) {
- _hasVoiceFile = true;
- _voice = new WavSound(_mixer, file);
+ return;
}
}
const bool dataIsUnsigned = true;
- if (!_hasVoiceFile) {
- sprintf(filename, "%s.voc", gss->speech_filename);
- file->open(filename);
- if (file->isOpen()) {
- _hasVoiceFile = true;
- _voice = new VocSound(_mixer, file, dataIsUnsigned);
- }
- }
- if (!_hasVoiceFile) {
- sprintf(filename, "%s", gss->speech_filename);
- file->open(filename);
- if (file->isOpen()) {
- _hasVoiceFile = true;
- if (_vm->getGameType() == GType_PP)
- _voice = new WavSound(_mixer, file);
- else
- _voice = new VocSound(_mixer, file, dataIsUnsigned);
- }
+ if (Common::File::exists(gss->speech_filename)) {
+ _hasVoiceFile = true;
+ if (_vm->getGameType() == GType_PP)
+ _voice = new WavSound(_mixer, gss->speech_filename);
+ else
+ _voice = new VocSound(_mixer, gss->speech_filename, dataIsUnsigned);
}
}
void Sound::loadSfxFile(const GameSpecificSettings *gss) {
- char filename[16];
- Common::File *file = new Common::File();
+ if (_hasEffectsFile)
+ return;
- if (!_hasEffectsFile) {
- _effects = makeCompressedSound(_mixer, file, gss->effects_filename);
- _hasEffectsFile = (_effects != 0);
- }
+ _effects = makeSound(_mixer, gss->effects_filename);
+ _hasEffectsFile = (_effects != 0);
+
+ if (_hasEffectsFile)
+ return;
const bool dataIsUnsigned = true;
- if (!_hasEffectsFile) {
- sprintf(filename, "%s.voc", gss->effects_filename);
- file->open(filename);
- if (file->isOpen()) {
- _hasEffectsFile = true;
- _effects = new VocSound(_mixer, file, dataIsUnsigned);
- }
- }
- if (!_hasEffectsFile) {
- sprintf(filename, "%s", gss->effects_filename);
- file->open(filename);
- if (file->isOpen()) {
- _hasEffectsFile = true;
- _effects = new VocSound(_mixer, file, dataIsUnsigned);
- }
+ if (Common::File::exists(gss->effects_filename)) {
+ _hasEffectsFile = true;
+ _effects = new VocSound(_mixer, gss->effects_filename, dataIsUnsigned);
}
}
@@ -535,10 +490,7 @@ void Sound::readSfxFile(const Common::String &filename) {
_mixer->stopHandle(_effectsHandle);
- Common::File *file = new Common::File();
- file->open(filename);
-
- if (file->isOpen() == false) {
+ if (!Common::File::exists(filename)) {
error("readSfxFile: Can't load sfx file %s", filename.c_str());
}
@@ -546,37 +498,34 @@ void Sound::readSfxFile(const Common::String &filename) {
delete _effects;
if (_vm->getGameId() == GID_SIMON1CD32) {
- _effects = new VocSound(_mixer, file, dataIsUnsigned, 0, SOUND_BIG_ENDIAN);
+ _effects = new VocSound(_mixer, filename, dataIsUnsigned, 0, SOUND_BIG_ENDIAN);
} else
- _effects = new WavSound(_mixer, file);
+ _effects = new WavSound(_mixer, filename);
}
// This method is only used by Simon2
-void Sound::loadSfxTable(Common::File *gameFile, uint32 base) {
+void Sound::loadSfxTable(const char *gameFilename, uint32 base) {
stopAll();
delete _effects;
const bool dataIsUnsigned = true;
if (_vm->getPlatform() == Common::kPlatformWindows)
- _effects = new WavSound(_mixer, gameFile, base, DisposeAfterUse::NO);
+ _effects = new WavSound(_mixer, gameFilename, base);
else
- _effects = new VocSound(_mixer, gameFile, dataIsUnsigned, base, false, DisposeAfterUse::NO);
+ _effects = new VocSound(_mixer, gameFilename, dataIsUnsigned, base, false);
}
// This method is only used by Simon1 Amiga CD32
void Sound::readVoiceFile(const Common::String &filename) {
_mixer->stopHandle(_voiceHandle);
- Common::File *file = new Common::File();
- file->open(filename);
-
- if (file->isOpen() == false)
+ if (!Common::File::exists(filename))
error("readVoiceFile: Can't load voice file %s", filename.c_str());
const bool dataIsUnsigned = false;
delete _voice;
- _voice = new RawSound(_mixer, file, dataIsUnsigned);
+ _voice = new RawSound(_mixer, filename, dataIsUnsigned);
}
void Sound::playVoice(uint sound) {
@@ -587,13 +536,11 @@ void Sound::playVoice(uint sound) {
char filename[16];
_lastVoiceFile = _filenums[sound];
sprintf(filename, "voices%d.dat", _filenums[sound]);
- Common::File *file = new Common::File();
- file->open(filename);
- if (file->isOpen() == false)
+ if (!Common::File::exists(filename))
error("playVoice: Can't load voice file %s", filename);
delete _voice;
- _voice = new WavSound(_mixer, file, _offsets);
+ _voice = new WavSound(_mixer, filename, _offsets);
}
}
@@ -794,22 +741,13 @@ void Sound::switchVoiceFile(const GameSpecificSettings *gss, uint disc) {
_lastVoiceFile = disc;
char filename[16];
- Common::File *file = new Common::File();
- if (!_hasVoiceFile) {
- sprintf(filename, "%s%u", gss->speech_filename, disc);
- _voice = makeCompressedSound(_mixer, file, filename);
- _hasVoiceFile = (_voice != 0);
- }
- if (!_hasVoiceFile) {
- sprintf(filename, "%s%u.wav", gss->speech_filename, disc);
- file->open(filename);
- if (file->isOpen() == false) {
- error("switchVoiceFile: Can't load voice file %s", filename);
- }
- _hasVoiceFile = true;
- _voice = new WavSound(_mixer, file);
- }
+ sprintf(filename, "%s%u", gss->speech_filename, disc);
+ _voice = makeSound(_mixer, filename);
+ _hasVoiceFile = (_voice != 0);
+
+ if (!_hasVoiceFile)
+ error("switchVoiceFile: Can't load voice file %s", filename);
}
} // End of namespace AGOS
diff --git a/engines/agos/sound.h b/engines/agos/sound.h
index ab4a3a963d..8633fe2f70 100644
--- a/engines/agos/sound.h
+++ b/engines/agos/sound.h
@@ -85,7 +85,7 @@ protected:
public:
void readSfxFile(const Common::String &filename);
- void loadSfxTable(Common::File *gameFile, uint32 base);
+ void loadSfxTable(const char *gameFilename, uint32 base);
void readVoiceFile(const Common::String &filename);
void playVoice(uint sound);
diff --git a/engines/agos/string.cpp b/engines/agos/string.cpp
index 410fd5a1ce..ee1b9df246 100644
--- a/engines/agos/string.cpp
+++ b/engines/agos/string.cpp
@@ -152,7 +152,7 @@ const byte *AGOSEngine::getStringPtrByID(uint16 stringId, bool upperCase) {
}
if (upperCase && *dst) {
- if (islower(*dst))
+ if (Common::isLower(*dst))
*dst = toupper(*dst);
}
diff --git a/engines/agos/string_pn.cpp b/engines/agos/string_pn.cpp
index ac8c263da3..4d4e2be16a 100644
--- a/engines/agos/string_pn.cpp
+++ b/engines/agos/string_pn.cpp
@@ -137,7 +137,7 @@ void AGOSEngine_PN::pcf(uint8 ch) {
if ((ch != 32) || (_bp + _xofs != 50))
_buffer[_bp++] = ch;
}
- if ((ch != 254) && (!isspace(ch)) && (_bp < 60))
+ if ((ch != 254) && (!Common::isSpace(ch)) && (_bp < 60))
return;
/* We know have a case of needing to print the text */
if (_bp + _xofs > 50) {
diff --git a/engines/agos/subroutine.cpp b/engines/agos/subroutine.cpp
index 45cb370057..f5aad2dcc8 100644
--- a/engines/agos/subroutine.cpp
+++ b/engines/agos/subroutine.cpp
@@ -266,7 +266,7 @@ Common::SeekableReadStream *AGOSEngine::openTablesFile(const char *filename) {
}
Common::SeekableReadStream *AGOSEngine::openTablesFile_simon1(const char *filename) {
- Common::SeekableReadStream *in = _archives.open(filename);
+ Common::SeekableReadStream *in = _archives.createReadStreamForMember(filename);
if (!in)
error("openTablesFile: Can't open '%s'", filename);
return in;
@@ -369,7 +369,7 @@ bool AGOSEngine_Waxworks::loadTablesIntoMem(uint16 subrId) {
readSubroutineBlock(in);
closeTablesFile(in);
if (getGameType() == GType_SIMON2) {
- _sound->loadSfxTable(_gameFile, _gameOffsetsPtr[atoi(filename.c_str() + 6) - 1 + _soundIndexBase]);
+ _sound->loadSfxTable(getFileName(GAME_GMEFILE), _gameOffsetsPtr[atoi(filename.c_str() + 6) - 1 + _soundIndexBase]);
} else if (getGameType() == GType_SIMON1 && getPlatform() == Common::kPlatformWindows) {
filename.setChar('S', 0);
filename.setChar('F', 1);
diff --git a/engines/cge/detection.cpp b/engines/cge/detection.cpp
index 3fa3dbd7ff..b3ef31f30f 100644
--- a/engines/cge/detection.cpp
+++ b/engines/cge/detection.cpp
@@ -104,7 +104,7 @@ static const ADFileBasedFallback fileBasedFallback[] = {
class CGEMetaEngine : public AdvancedMetaEngine {
public:
CGEMetaEngine() : AdvancedMetaEngine(CGE::gameDescriptions, sizeof(ADGameDescription), CGEGames) {
- _singleid = "Soltys";
+ _singleid = "soltys";
}
virtual const ADGameDescription *fallbackDetect(const FileMap &allFiles, const Common::FSList &fslist) const {
diff --git a/engines/cge/text.cpp b/engines/cge/text.cpp
index 331dc8ac2d..fd4120d49d 100644
--- a/engines/cge/text.cpp
+++ b/engines/cge/text.cpp
@@ -72,7 +72,7 @@ int16 Text::count() {
strcpy(tmpStr, line.c_str());
if ((s = strtok(tmpStr, " =,;/\t\n")) == NULL)
continue;
- if (!isdigit(*s))
+ if (!Common::isDigit(*s))
continue;
counter++;
@@ -105,7 +105,7 @@ void Text::load() {
strcpy(tmpStr, line.c_str());
if ((s = strtok(tmpStr, " =,;/\t\n")) == NULL)
continue;
- if (!isdigit(*s))
+ if (!Common::isDigit(*s))
continue;
int r = atoi(s);
diff --git a/engines/cine/detection.cpp b/engines/cine/detection.cpp
index ed656682ee..823b8e38b5 100644
--- a/engines/cine/detection.cpp
+++ b/engines/cine/detection.cpp
@@ -141,7 +141,7 @@ SaveStateList CineMetaEngine::listSaves(const char *target) const {
for (file = filenames.begin(); file != filenames.end(); ++file) {
// Jump over savegame files that don't end with a digit (e.g. "fw.3" is ok, "fw.a" is not).
- if (!isdigit(static_cast<unsigned char>(file->lastChar())))
+ if (!Common::isDigit(file->lastChar()))
continue;
// Obtain the last digit of the filename, since they correspond to the save slot
diff --git a/engines/cine/gfx.cpp b/engines/cine/gfx.cpp
index 01e05bed6d..918d522606 100644
--- a/engines/cine/gfx.cpp
+++ b/engines/cine/gfx.cpp
@@ -1801,7 +1801,7 @@ void maskBgOverlay(const byte *bgPtr, const byte *maskPtr, int16 width, int16 he
for (it = g_cine->_bgIncrustList.begin(); it != g_cine->_bgIncrustList.end(); ++it) {
tmpWidth = g_cine->_animDataTable[it->frame]._realWidth;
tmpHeight = g_cine->_animDataTable[it->frame]._height;
- mask = (byte*)malloc(tmpWidth * tmpHeight);
+ mask = (byte *)malloc(tmpWidth * tmpHeight);
if (it->param == 0) {
generateMask(g_cine->_animDataTable[it->frame].data(), mask, tmpWidth * tmpHeight, it->part);
diff --git a/engines/composer/detection.cpp b/engines/composer/detection.cpp
index af355402c2..835f3c5683 100644
--- a/engines/composer/detection.cpp
+++ b/engines/composer/detection.cpp
@@ -53,9 +53,12 @@ Common::Language ComposerEngine::getLanguage() const {
static const PlainGameDescriptor composerGames[] = {
{"composer", "Composer Game"},
+ {"babayaga", "Magic Tales: Baba Yaga and the Magic Geese"},
{"darby", "Darby the Dragon"},
{"gregory", "Gregory and the Hot Air Balloon"},
+ {"imoking", "Magic Tales: Imo and the King"},
{"liam", "Magic Tales: Liam Finds a Story"},
+ {"littlesamurai", "Magic Tales: The Little Samurai"},
{"princess", "The Princess and the Crab"},
{"sleepingcub", "Sleeping Cub's Test of Courage"},
{0, 0}
@@ -64,6 +67,90 @@ static const PlainGameDescriptor composerGames[] = {
namespace Composer {
static const ComposerGameDescription gameDescriptions[] = {
+ // Magic Tales: Baba Yaga and the Magic Geese - from bug #3485018
+ {
+ {
+ "babayaga",
+ "",
+ AD_ENTRY1s("book.ini", "412b7f4b0ef07f442009d28e3a819974", 3852),
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NOASPECT)
+ },
+ GType_ComposerV1
+ },
+
+ // Magic Tales: Baba Yaga and the Magic Geese Mac - from bug #3466402
+ {
+ {
+ "babayaga",
+ "",
+ AD_ENTRY1("Baba Yaga", "ae3a4445f42fe10253da7ee4ea0d37"),
+ Common::EN_ANY,
+ Common::kPlatformMacintosh,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NOASPECT)
+ },
+ GType_ComposerV1
+ },
+
+ // Magic Tales: Imo and the King - from bug #3485018
+ {
+ {
+ "imoking",
+ "",
+ AD_ENTRY1s("book.ini", "62b52a1763cce7d7d6ccde9f9d32fd4b", 3299),
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NOASPECT)
+ },
+ GType_ComposerV1
+ },
+
+ // Magic Tales: Imo and the King Mac - from bug #3466402
+ {
+ {
+ "imoking",
+ "",
+ AD_ENTRY1("imo and the king", "b0277885fec943b5f19409f35b33964c"),
+ Common::EN_ANY,
+ Common::kPlatformMacintosh,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NOASPECT)
+ },
+ GType_ComposerV1
+ },
+
+ // Magic Tales: The Little Samurai - from bug #3485018
+ {
+ {
+ "littlesamurai",
+ "",
+ AD_ENTRY1s("book.ini", "7a851869d022a9041e0dd11e5bace09b", 3747),
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NOASPECT)
+ },
+ GType_ComposerV1
+ },
+
+ // Magic Tales: The Little Samurai Mac - from bug #3466402
+ {
+ {
+ "littlesamurai",
+ "",
+ AD_ENTRY1("The Little Samurai", "38121dd649c24e8676aa108cf35d44b5"),
+ Common::EN_ANY,
+ Common::kPlatformMacintosh,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NOASPECT)
+ },
+ GType_ComposerV1
+ },
+
// from Liam Finds a Story CD
{
{
@@ -91,6 +178,24 @@ static const ComposerGameDescription gameDescriptions[] = {
GType_ComposerV2
},
+ // Liam Finds a Story Mac - from bug #3463201
+ {
+ {
+ "liam",
+ 0,
+ {
+ {"liam finds a story.ini", 0, "85a1ca6002ded8572920bbdb73d35b0a", -1},
+ {"page99.rsc", 0, "11b0a19c6b6d73c39e2bd289a457c1dc", -1},
+ AD_LISTEND
+ },
+ Common::EN_ANY,
+ Common::kPlatformMacintosh,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NOASPECT)
+ },
+ GType_ComposerV2
+ },
+
// from Liam Finds a Story CD
{
{
@@ -208,6 +313,24 @@ static const ComposerGameDescription gameDescriptions[] = {
GType_ComposerV2
},
+ // The Princess and the Crab Mac - From Bug #3461984
+ {
+ {
+ "princess",
+ 0,
+ {
+ {"the princess and the crab.ini", 0, "f6b551a7304643004bd5e4df7ac1e76e", -1},
+ {"page99.rsc", 0, "fd5ebd3b5e36c4651c50241619525355", -1},
+ AD_LISTEND
+ },
+ Common::EN_ANY,
+ Common::kPlatformMacintosh,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NOASPECT)
+ },
+ GType_ComposerV2
+ },
+
{ // Provided by sev
{
"sleepingcub",
@@ -225,6 +348,24 @@ static const ComposerGameDescription gameDescriptions[] = {
GType_ComposerV2
},
+ // Sleeping Cub Mac - From Bug #3461369
+ {
+ {
+ "sleepingcub",
+ 0,
+ {
+ {"sleeping cub.ini", 0, "39642a4036cb51443f5e90052c3ad0b2", -1},
+ {"page99.rsc", 0, "219fbd9bd2ff87c7023814405d753145", -1},
+ AD_LISTEND
+ },
+ Common::EN_ANY,
+ Common::kPlatformMacintosh,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NOASPECT)
+ },
+ GType_ComposerV2
+ },
+
{ AD_TABLE_END_MARKER, 0 }
};
@@ -235,6 +376,7 @@ using namespace Composer;
// we match from data too, to stop detection from a non-top-level directory
const static char *directoryGlobs[] = {
"data",
+ "liam",
"programs",
"princess",
"sleepcub",
diff --git a/engines/cruise/background.cpp b/engines/cruise/background.cpp
index 4d1284a802..9da5413013 100644
--- a/engines/cruise/background.cpp
+++ b/engines/cruise/background.cpp
@@ -129,7 +129,7 @@ int loadBackground(const char *name, int idx) {
flagSpeed = 0;
}
- if (!strcmp((char*)ptr, "PAL")) {
+ if (!strcmp((char *)ptr, "PAL")) {
memcpy(palScreen[idx], ptr + 4, 256*3);
gfxModuleData_setPal256(palScreen[idx]);
} else {
diff --git a/engines/cruise/backgroundIncrust.cpp b/engines/cruise/backgroundIncrust.cpp
index 39286670ed..ddda8dee45 100644
--- a/engines/cruise/backgroundIncrust.cpp
+++ b/engines/cruise/backgroundIncrust.cpp
@@ -46,7 +46,7 @@ void backupBackground(backgroundIncrustStruct *pIncrust, int X, int Y, int width
pIncrust->savedX = X;
pIncrust->savedY = Y;
- pIncrust->ptr = (uint8*)MemAlloc(width * height);
+ pIncrust->ptr = (uint8 *)MemAlloc(width * height);
for (int i = 0; i < height; i++) {
for (int j = 0; j < width; j++) {
int xp = j + X;
@@ -169,7 +169,7 @@ backgroundIncrustStruct *addBackgroundIncrust(int16 overlayIdx, int16 objectIdx,
int sizeTable[4]; // 0 = left, 1 = right, 2 = bottom, 3 = top
// this function checks if the dataPtr is not 0, else it retrives the data for X, Y, scale and DataPtr again (OLD: mainDrawSub1Sub1)
- flipPoly(params.fileIdx, (int16*)filesDatabase[params.fileIdx].subData.ptr, params.scale, &newFrame, newElement->X, newElement->Y, &newX, &newY, &newScale);
+ flipPoly(params.fileIdx, (int16 *)filesDatabase[params.fileIdx].subData.ptr, params.scale, &newFrame, newElement->X, newElement->Y, &newX, &newY, &newScale);
// this function fills the sizeTable for the poly (OLD: mainDrawSub1Sub2)
getPolySize(newX, newY, newScale, sizeTable, (unsigned char*)newFrame);
@@ -213,7 +213,7 @@ void regenerateBackgroundIncrust(backgroundIncrustStruct *pHead) {
drawSprite(width, height, NULL, filesDatabase[frame].subData.ptr, pl->Y, pl->X, backgroundScreens[pl->backgroundIdx], filesDatabase[frame].subData.ptrMask);
} else {
// Poly
- addBackgroundIncrustSub1(frame, pl->X, pl->Y, NULL, pl->scale, (char*)backgroundScreens[pl->backgroundIdx], (char *)filesDatabase[frame].subData.ptr);
+ addBackgroundIncrustSub1(frame, pl->X, pl->Y, NULL, pl->scale, (char *)backgroundScreens[pl->backgroundIdx], (char *)filesDatabase[frame].subData.ptr);
}
backgroundChanged[pl->backgroundIdx] = true;
diff --git a/engines/cruise/cruise.h b/engines/cruise/cruise.h
index 94f8759d01..9782df8f09 100644
--- a/engines/cruise/cruise.h
+++ b/engines/cruise/cruise.h
@@ -116,7 +116,7 @@ public:
static uint32 const cookie = 0x41424344;
};
- Common::List<MemInfo*> _memList;
+ Common::List<MemInfo *> _memList;
typedef Common::List<Common::Rect> RectList;
diff --git a/engines/cruise/cruise_main.cpp b/engines/cruise/cruise_main.cpp
index a1337aefa7..6e2847d6d7 100644
--- a/engines/cruise/cruise_main.cpp
+++ b/engines/cruise/cruise_main.cpp
@@ -45,7 +45,7 @@ typedef CruiseEngine::MemInfo MemInfo;
void MemoryList() {
if (!_vm->_memList.empty()) {
debug("Current list of un-freed memory blocks:");
- Common::List<MemInfo*>::iterator i;
+ Common::List<MemInfo *>::iterator i;
for (i = _vm->_memList.begin(); i != _vm->_memList.end(); ++i) {
MemInfo const *const v = *i;
debug("%s - %d", v->fname, v->lineNum);
@@ -691,7 +691,7 @@ int findObject(int mouseX, int mouseY, int *outObjOvl, int *outObjIdx) {
if ((filesDatabase[j].subData.resourceType == OBJ_TYPE_POLY) && (filesDatabase[j].subData.ptr)) {
int zoom = params.scale;
- int16* dataPtr = (int16*)filesDatabase[j].subData.ptr;
+ int16* dataPtr = (int16 *)filesDatabase[j].subData.ptr;
if (*dataPtr == 0) {
int16 offset;
@@ -723,7 +723,7 @@ int findObject(int mouseX, int mouseY, int *outObjOvl, int *outObjIdx) {
y -= newY;
}
- if (dataPtr && findPoly((char*)dataPtr, x, y, zoom, mouseX, mouseY)) {
+ if (dataPtr && findPoly((char *)dataPtr, x, y, zoom, mouseX, mouseY)) {
*outObjOvl = linkedObjOvl;
*outObjIdx = linkedObjIdx;
diff --git a/engines/cruise/dataLoader.cpp b/engines/cruise/dataLoader.cpp
index 76479d7a10..94d075ecc3 100644
--- a/engines/cruise/dataLoader.cpp
+++ b/engines/cruise/dataLoader.cpp
@@ -420,7 +420,7 @@ int loadSetEntry(const char *name, uint8 *ptr, int currentEntryIdx, int currentD
int sec = 0;
uint16 numIdx;
- if (!strcmp((char*)ptr, "SEC")) {
+ if (!strcmp((char *)ptr, "SEC")) {
sec = 1;
}
diff --git a/engines/cruise/font.cpp b/engines/cruise/font.cpp
index a6680f7a02..2fd86a11b7 100644
--- a/engines/cruise/font.cpp
+++ b/engines/cruise/font.cpp
@@ -106,7 +106,7 @@ void loadFNT(const char *fileName) {
fontFileHandle.read(header, 4);
- if (strcmp((char*)header, "FNT") == 0) {
+ if (strcmp((char *)header, "FNT") == 0) {
uint32 fontSize = fontFileHandle.readUint32BE();
_systemFNT = (uint8 *)mallocAndZero(fontSize);
diff --git a/engines/cruise/function.cpp b/engines/cruise/function.cpp
index 27b9be7e79..610465e962 100644
--- a/engines/cruise/function.cpp
+++ b/engines/cruise/function.cpp
@@ -142,7 +142,7 @@ int16 Op_AddProc() {
if (procBss) {
for (long int i = 0; i < pop1; i++) {
- int16* ptr = (int16*)(procBss + i * 2);
+ int16* ptr = (int16 *)(procBss + i * 2);
*ptr = param[i];
bigEndianShortToNative(ptr);
}
@@ -1046,7 +1046,7 @@ int16 Op_ComputeLine() {
int y1 = popVar();
int x1 = popVar();
- point* pDest = (point*)popPtr();
+ point* pDest = (point *)popPtr();
int maxValue = cor_droite(x1, y1, x2, y2, pDest);
@@ -1334,7 +1334,7 @@ int16 Op_TrackAnim() { // setup actor position
}
int16 Op_BgName() {
- char* bgName = (char*)popPtr();
+ char* bgName = (char *)popPtr();
int bgIdx = popVar();
if ((bgIdx >= 0) && (bgIdx < NBSCREENS) && bgName) {
@@ -1524,7 +1524,7 @@ int16 Op_Itoa() {
param[i] = popVar();
int val = popVar();
- char* pDest = (char*)popPtr();
+ char* pDest = (char *)popPtr();
if (!nbp)
sprintf(txt, "%d", val);
@@ -1645,7 +1645,7 @@ int16 Op_SetVolume() {
}
int16 Op_SongExist() {
- const char *songName = (char*)popPtr();
+ const char *songName = (char *)popPtr();
if (songName) {
char name[33];
diff --git a/engines/cruise/mainDraw.cpp b/engines/cruise/mainDraw.cpp
index 9a5df69cae..24f65500db 100644
--- a/engines/cruise/mainDraw.cpp
+++ b/engines/cruise/mainDraw.cpp
@@ -185,7 +185,7 @@ void flipPoly(int fileId, int16 *dataPtr, int scale, char** newFrame, int X, int
Y -= newY;
}
- *newFrame = (char*)dataPtr;
+ *newFrame = (char *)dataPtr;
*outX = X;
*outY = Y;
*outScale = scale;
@@ -1077,7 +1077,7 @@ void mainDrawPolygons(int fileIndex, cellStruct *plWork, int X, int scale, int Y
int sizeTable[4]; // 0 = left, 1 = right, 2 = bottom, 3 = top
// this function checks if the dataPtr is not 0, else it retrives the data for X, Y, scale and DataPtr again (OLD: mainDrawSub1Sub1)
- flipPoly(fileIndex, (int16*)dataPtr, scale, &newFrame, X, Y, &newX, &newY, &newScale);
+ flipPoly(fileIndex, (int16 *)dataPtr, scale, &newFrame, X, Y, &newX, &newY, &newScale);
// this function fills the sizeTable for the poly (OLD: mainDrawSub1Sub2)
getPolySize(newX, newY, newScale, sizeTable, (unsigned char*)newFrame);
@@ -1143,7 +1143,7 @@ void mainDrawPolygons(int fileIndex, cellStruct *plWork, int X, int scale, int Y
}
// this function builds the poly model and then calls the draw functions (OLD: mainDrawSub1Sub5)
- buildPolyModel(newX, newY, newScale, (char*)polygonMask, destBuffer, newFrame);
+ buildPolyModel(newX, newY, newScale, (char *)polygonMask, destBuffer, newFrame);
}
void drawMessage(const gfxEntryStruct *pGfxPtr, int globalX, int globalY, int width, int newColor, uint8 *ouputPtr) {
@@ -1419,7 +1419,7 @@ void mainDraw(int16 param) {
currentObjPtr = cellHead.next;
#ifdef _DEBUG
- /* polyOutputBuffer = (char*)bgPtr;
+ /* polyOutputBuffer = (char *)bgPtr;
drawCtp(); */
#endif
diff --git a/engines/cruise/saveload.cpp b/engines/cruise/saveload.cpp
index e2bd1ebc34..26bea0441c 100644
--- a/engines/cruise/saveload.cpp
+++ b/engines/cruise/saveload.cpp
@@ -924,10 +924,10 @@ Common::Error loadSavegameData(int saveGameIdx) {
if (ptr) {
ASSERT(0);
- //*(int16*)(currentcellHead->datas+0x2E) = getSprite(ptr,*(int16*)(currentcellHead->datas+0xE));
+ //*(int16 *)(currentcellHead->datas+0x2E) = getSprite(ptr,*(int16 *)(currentcellHead->datas+0xE));
} else {
ASSERT(0);
- //*(int16*)(currentcellHead->datas+0x2E) = 0;
+ //*(int16 *)(currentcellHead->datas+0x2E) = 0;
}
}
diff --git a/engines/cruise/script.cpp b/engines/cruise/script.cpp
index cf28548e7d..d753d938bd 100644
--- a/engines/cruise/script.cpp
+++ b/engines/cruise/script.cpp
@@ -33,7 +33,7 @@ scriptInstanceStruct procHead;
scriptInstanceStruct *currentScriptPtr;
int8 getByteFromScript() {
- int8 var = *(int8*)(currentData3DataPtr + currentScriptPtr->scriptOffset);
+ int8 var = *(int8 *)(currentData3DataPtr + currentScriptPtr->scriptOffset);
++currentScriptPtr->scriptOffset;
return (var);
@@ -202,7 +202,7 @@ int32 opcodeType1() {
di = currentScriptPtr->overlayNumber;
}
- if ((var == 0x85) && !strcmp((char*)currentCtpName, "S26.CTP") && !di && mode == 1) { // patch in bar
+ if ((var == 0x85) && !strcmp((char *)currentCtpName, "S26.CTP") && !di && mode == 1) { // patch in bar
var = 0x87;
}
diff --git a/engines/dialogs.cpp b/engines/dialogs.cpp
index 435576e9e4..1b54c7e26a 100644
--- a/engines/dialogs.cpp
+++ b/engines/dialogs.cpp
@@ -227,19 +227,24 @@ void MainMenuDialog::save() {
Common::String result(_saveDialog->getResultString());
if (result.empty()) {
// If the user was lazy and entered no save name, come up with a default name.
- Common::String buf;
#if defined(USE_SAVEGAME_TIMESTAMP)
TimeDate curTime;
g_system->getTimeAndDate(curTime);
curTime.tm_year += 1900; // fixup year
curTime.tm_mon++; // fixup month
- buf = Common::String::format("%04d.%02d.%02d / %02d:%02d:%02d", curTime.tm_year, curTime.tm_mon, curTime.tm_mday, curTime.tm_hour, curTime.tm_min, curTime.tm_sec);
+ result = Common::String::format("%04d.%02d.%02d / %02d:%02d:%02d", curTime.tm_year, curTime.tm_mon, curTime.tm_mday, curTime.tm_hour, curTime.tm_min, curTime.tm_sec);
#else
- buf = Common::String::format("Save %d", slot + 1);
+ result = Common::String::format("Save %d", slot + 1);
#endif
- _engine->saveGameState(slot, buf);
- } else {
- _engine->saveGameState(slot, result);
+ }
+
+ Common::Error status = _engine->saveGameState(slot, result);
+ if (status.getCode() != Common::kNoError) {
+ Common::String failMessage = Common::String::format(_("Gamestate save failed (%s)! "
+ "Please consult the README for basic information, and for "
+ "instructions on how to obtain further assistance."), status.getDesc().c_str());
+ GUI::MessageDialog dialog(failMessage);
+ dialog.runModal();
}
close();
@@ -256,7 +261,7 @@ void MainMenuDialog::load() {
_engine->setGameToLoadSlot(slot);
- if (slot >= 0)
+ if (slot >= 0)
close();
}
diff --git a/engines/draci/barchive.cpp b/engines/draci/barchive.cpp
index 154073250c..31dfe62dee 100644
--- a/engines/draci/barchive.cpp
+++ b/engines/draci/barchive.cpp
@@ -212,7 +212,8 @@ void BArchive::openArchive(const Common::String &path) {
_files[i]._offset = fileOffset; // Offset of file from start
- assert(_f.readByte() == 0 &&
+ byte compressionType = _f.readByte();
+ assert(compressionType == 0 &&
"Compression type flag is non-zero (file is compressed)");
_files[i]._crc = _f.readByte(); // CRC checksum of the file
@@ -221,7 +222,8 @@ void BArchive::openArchive(const Common::String &path) {
}
// Last footer item should be equal to footerOffset
- assert(reader.readUint32LE() == footerOffset && "Footer offset mismatch");
+ uint32 footerOffset2 = reader.readUint32LE();
+ assert(footerOffset2 == footerOffset && "Footer offset mismatch");
// Indicate that the archive has been successfully opened
_opened = true;
diff --git a/engines/draci/sprite.cpp b/engines/draci/sprite.cpp
index 92ce7d31d9..965cdabf3e 100644
--- a/engines/draci/sprite.cpp
+++ b/engines/draci/sprite.cpp
@@ -318,7 +318,7 @@ void Text::repeatedlySplitLongLines(uint maxWidth) {
}
void Text::splitLinesLongerThan(uint maxWidth) {
- char *start = const_cast<char*> (_text.c_str()); // hacky
+ char *start = const_cast<char *> (_text.c_str()); // hacky
while (1) {
char *end = strchr(start, '|');
if (end) {
diff --git a/engines/drascula/interface.cpp b/engines/drascula/interface.cpp
index 5e4f7a1541..c08bcea01f 100644
--- a/engines/drascula/interface.cpp
+++ b/engines/drascula/interface.cpp
@@ -168,7 +168,7 @@ void DrasculaEngine::enterName() {
key = getScan();
if (key != 0) {
- if (key >= 0 && key <= 0xFF && isalpha(static_cast<unsigned char>(key)))
+ if (key >= 0 && key <= 0xFF && isAlpha(key))
select2[v] = tolower(key);
else if ((key >= Common::KEYCODE_0 && key <= Common::KEYCODE_9) || key == Common::KEYCODE_SPACE)
select2[v] = key;
diff --git a/engines/dreamweb/dreamweb.cpp b/engines/dreamweb/dreamweb.cpp
index 91aabc89d9..0a5deb4657 100644
--- a/engines/dreamweb/dreamweb.cpp
+++ b/engines/dreamweb/dreamweb.cpp
@@ -190,11 +190,9 @@ DreamWebEngine::DreamWebEngine(OSystem *syst, const DreamWebGameDescription *gam
_monAdX = 0;
_monAdY = 0;
_timeCount = 0;
- _countToTimed = 0;
- _timedY = 0;
- _timedX = 0;
_needToDumpTimed = 0;
_loadingOrSave = 0;
+ _saveLoadPage = 0;
_currentSlot = 0;
_cursorPos = 0;
_colourPos = 0;
diff --git a/engines/dreamweb/dreamweb.h b/engines/dreamweb/dreamweb.h
index e261010902..f49c38371d 100644
--- a/engines/dreamweb/dreamweb.h
+++ b/engines/dreamweb/dreamweb.h
@@ -76,6 +76,7 @@ const unsigned int kSymbolx = 64;
const unsigned int kSymboly = 56;
const unsigned int kLengthofvars = 68;
const unsigned int kFrameBlocksize = 2080;
+const unsigned int kGraphicsFileFrameSize = 347; // ceil(2080 / sizeof(Frame))
const unsigned int kNumexobjects = 114;
const unsigned int kNumExTexts = kNumexobjects + 2;
const uint16 kExtextlen = 18000;
@@ -186,7 +187,6 @@ private:
uint8 _channel0, _channel1;
protected:
- const char *_timedString;
GameVars _vars; // saved variables
// from backdrop.cpp
@@ -227,8 +227,8 @@ protected:
Common::Point _lineData[200]; // Output of Bresenham
// from saveload.cpp
- char _saveNames[17*7];
- char _saveNamesOld[17*7];
+ char _saveNames[17*21];
+ char _saveNamesOld[17*21];
// from vgagrafx.cpp
uint8 _workspace[(0x1000 + 2) * 16];
@@ -266,13 +266,28 @@ protected:
TextFile _puzzleText;
TextFile _commandText;
- // graphics files
- GraphicsFile _tempGraphics;
- GraphicsFile _tempGraphics2;
- GraphicsFile _tempGraphics3;
+ // local graphics files
+ GraphicsFile _keypadGraphics;
+ GraphicsFile _menuGraphics;
+ GraphicsFile _menuGraphics2;
+ GraphicsFile _folderGraphics;
+ GraphicsFile _folderGraphics2;
+ GraphicsFile _folderGraphics3;
+ GraphicsFile _folderCharset;
+ GraphicsFile _symbolGraphics;
+ GraphicsFile _diaryGraphics;
+ GraphicsFile _diaryCharset;
+ GraphicsFile _monitorGraphics;
+ GraphicsFile _monitorCharset;
+ GraphicsFile _newplaceGraphics;
+ GraphicsFile _newplaceGraphics2;
+ GraphicsFile _newplaceGraphics3;
+ GraphicsFile _cityGraphics;
+ GraphicsFile _saveGraphics;
+
+ // global graphics files
GraphicsFile _icons1;
GraphicsFile _icons2;
- GraphicsFile _tempCharset;
GraphicsFile _charset1;
GraphicsFile _mainSprites;
const GraphicsFile *_currentCharset;
@@ -416,11 +431,11 @@ public:
uint16 _monAdX;
uint16 _monAdY;
uint16 _timeCount;
- uint16 _countToTimed;
- uint8 _timedY;
- uint8 _timedX;
uint8 _needToDumpTimed;
+ TimedTemp _previousTimedTemp;
+ TimedTemp _timedTemp;
uint8 _loadingOrSave;
+ uint8 _saveLoadPage;
uint8 _currentSlot;
uint8 _cursorPos;
uint8 _colourPos;
@@ -692,6 +707,7 @@ public:
void loadSaveBox();
void showNames();
void checkInput();
+ void selectSaveLoadPage();
void selectSlot();
void showSlots();
void showOpBox();
@@ -797,15 +813,11 @@ public:
void loadGraphicsFile(GraphicsFile &file, const char *fileName);
void loadGraphicsSegment(GraphicsFile &file, Common::File &inFile, unsigned int len);
void loadTextSegment(TextFile &file, Common::File &inFile, unsigned int len);
- void loadIntoTemp(const char *fileName);
- void loadIntoTemp2(const char *fileName);
- void loadIntoTemp3(const char *fileName);
- void loadTempCharset(const char *fileName);
void loadTravelText();
void loadTempText(const char *fileName);
void sortOutMap();
void loadRoomData(const Room &room, bool skipDat);
- void useTempCharset();
+ void useTempCharset(GraphicsFile *charset);
void useCharset1();
void printMessage(uint16 x, uint16 y, uint8 index, uint8 maxWidth, bool centered);
void printMessage2(uint16 x, uint16 y, uint8 index, uint8 maxWidth, bool centered, uint8 count);
@@ -848,11 +860,7 @@ public:
bool isItWorn(const DynObject *object);
bool compare(uint8 index, uint8 flag, const char id[4]);
void hangOnW(uint16 frameCount);
- void getRidOfTemp();
void getRidOfTempText();
- void getRidOfTemp2();
- void getRidOfTemp3();
- void getRidOfTempCharset();
void getRidOfAll();
void placeSetObject(uint8 index);
void removeSetObject(uint8 index);
@@ -1122,7 +1130,6 @@ public:
void multiPut(const uint8 *src, uint16 x, uint16 y, uint8 width, uint8 height);
void multiDump(uint16 x, uint16 y, uint8 width, uint8 height);
void workToScreen();
- void printUnderMon();
void frameOutV(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, int16 x, int16 y);
void frameOutNm(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, uint16 x, uint16 y);
void frameOutBh(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, uint16 x, uint16 y);
diff --git a/engines/dreamweb/keypad.cpp b/engines/dreamweb/keypad.cpp
index 2a31652ace..172e85104f 100644
--- a/engines/dreamweb/keypad.cpp
+++ b/engines/dreamweb/keypad.cpp
@@ -93,7 +93,7 @@ void DreamWebEngine::enterCode(uint8 digit0, uint8 digit1, uint8 digit2, uint8 d
}
}
_manIsOffScreen = 0;
- getRidOfTemp();
+ _keypadGraphics.clear();
restoreReels();
redrawMainScrn();
workToScreenM();
@@ -108,7 +108,7 @@ bool DreamWebEngine::isItRight(uint8 digit0, uint8 digit1, uint8 digit2, uint8 d
}
void DreamWebEngine::loadKeypad() {
- loadIntoTemp("DREAMWEB.G02");
+ loadGraphicsFile(_keypadGraphics, "DREAMWEB.G02");
}
void DreamWebEngine::quitKey() {
@@ -185,8 +185,8 @@ void DreamWebEngine::buttonPress(uint8 buttonId) {
}
void DreamWebEngine::showOuterPad() {
- showFrame(_tempGraphics, kKeypadx-3, kKeypady-4, 1, 0);
- showFrame(_tempGraphics, kKeypadx+74, kKeypady+76, 37, 0);
+ showFrame(_keypadGraphics, kKeypadx-3, kKeypady-4, 1, 0);
+ showFrame(_keypadGraphics, kKeypadx+74, kKeypady+76, 37, 0);
}
void DreamWebEngine::showKeypad() {
@@ -214,7 +214,7 @@ void DreamWebEngine::showKeypad() {
}
if ((_lightCount >= 60) && (_lightCount < 100))
--frameIndex;
- showFrame(_tempGraphics, kKeypadx+60, y, frameIndex, 0);
+ showFrame(_keypadGraphics, kKeypadx+60, y, frameIndex, 0);
}
}
@@ -225,7 +225,7 @@ void DreamWebEngine::singleKey(uint8 key, uint16 x, uint16 y) {
key -= 11;
}
key -= 20;
- showFrame(_tempGraphics, x, y, key, 0);
+ showFrame(_keypadGraphics, x, y, key, 0);
}
void DreamWebEngine::dumpKeypad() {
@@ -241,9 +241,9 @@ void DreamWebEngine::useMenu() {
_vars._newObs = 0;
drawFloor();
printSprites();
- showFrame(_tempGraphics2, kMenux-48, kMenuy-4, 4, 0);
+ showFrame(_menuGraphics2, kMenux-48, kMenuy-4, 4, 0);
getUnderMenu();
- showFrame(_tempGraphics2, kMenux+54, kMenuy+72, 5, 0);
+ showFrame(_menuGraphics2, kMenux+54, kMenuy+72, 5, 0);
workToScreenM();
_getBack = 0;
do {
@@ -265,8 +265,8 @@ void DreamWebEngine::useMenu() {
} while ((_getBack != 1) && !_quitRequested);
_manIsOffScreen = 0;
redrawMainScrn();
- getRidOfTemp();
- getRidOfTemp2();
+ _menuGraphics.clear();
+ _menuGraphics2.clear();
restoreReels();
workToScreenM();
}
@@ -289,12 +289,12 @@ void DreamWebEngine::showMenu() {
++_menuCount;
if (_menuCount == 37*2)
_menuCount = 0;
- showFrame(_tempGraphics, kMenux, kMenuy, _menuCount / 2, 0);
+ showFrame(_menuGraphics, kMenux, kMenuy, _menuCount / 2, 0);
}
void DreamWebEngine::loadMenu() {
- loadIntoTemp("DREAMWEB.S02"); // sprite name 3
- loadIntoTemp2("DREAMWEB.G07"); // mon. graphics 2
+ loadGraphicsFile(_menuGraphics, "DREAMWEB.S02"); // sprite name 3
+ loadGraphicsFile(_menuGraphics2, "DREAMWEB.G07"); // mon. graphics 2
}
void DreamWebEngine::viewFolder() {
@@ -317,10 +317,10 @@ void DreamWebEngine::viewFolder() {
checkFolderCoords();
} while (_getBack == 0);
_manIsOffScreen = 0;
- getRidOfTemp();
- getRidOfTemp2();
- getRidOfTemp3();
- getRidOfTempCharset();
+ _folderGraphics.clear();
+ _folderGraphics2.clear();
+ _folderGraphics3.clear();
+ _folderCharset.clear();
restoreAll();
redrawMainScrn();
workToScreenM();
@@ -394,22 +394,22 @@ void DreamWebEngine::checkFolderCoords() {
}
void DreamWebEngine::loadFolder() {
- loadIntoTemp("DREAMWEB.G09"); // folder graphics 1
- loadIntoTemp2("DREAMWEB.G10"); // folder graphics 2
- loadIntoTemp3("DREAMWEB.G11"); // folder graphics 3
- loadTempCharset("DREAMWEB.C02"); // character set 3
+ loadGraphicsFile(_folderGraphics, "DREAMWEB.G09"); // folder graphics 1
+ loadGraphicsFile(_folderGraphics2, "DREAMWEB.G10"); // folder graphics 2
+ loadGraphicsFile(_folderGraphics3, "DREAMWEB.G11"); // folder graphics 3
+ loadGraphicsFile(_folderCharset, "DREAMWEB.C02"); // character set 3
loadTempText("DREAMWEB.T50"); // folder text
}
void DreamWebEngine::showFolder() {
_commandType = 255;
if (_folderPage) {
- useTempCharset();
+ useTempCharset(&_folderCharset);
createPanel2();
- showFrame(_tempGraphics, 0, 0, 0, 0);
- showFrame(_tempGraphics, 143, 0, 1, 0);
- showFrame(_tempGraphics, 0, 92, 2, 0);
- showFrame(_tempGraphics, 143, 92, 3, 0);
+ showFrame(_folderGraphics, 0, 0, 0, 0);
+ showFrame(_folderGraphics, 143, 0, 1, 0);
+ showFrame(_folderGraphics, 0, 92, 2, 0);
+ showFrame(_folderGraphics, 143, 92, 3, 0);
folderExit();
if (_folderPage != 1)
showLeftPage();
@@ -419,25 +419,25 @@ void DreamWebEngine::showFolder() {
underTextLine();
} else {
createPanel2();
- showFrame(_tempGraphics3, 143-28, 0, 0, 0);
- showFrame(_tempGraphics3, 143-28, 92, 1, 0);
+ showFrame(_folderGraphics3, 143-28, 0, 0, 0);
+ showFrame(_folderGraphics3, 143-28, 92, 1, 0);
folderExit();
underTextLine();
}
}
void DreamWebEngine::folderExit() {
- showFrame(_tempGraphics2, 296, 178, 6, 0);
+ showFrame(_folderGraphics2, 296, 178, 6, 0);
}
void DreamWebEngine::showLeftPage() {
- showFrame(_tempGraphics2, 0, 12, 3, 0);
+ showFrame(_folderGraphics2, 0, 12, 3, 0);
uint16 y = 12+5;
for (size_t i = 0; i < 9; ++i) {
- showFrame(_tempGraphics2, 0, y, 4, 0);
+ showFrame(_folderGraphics2, 0, y, 4, 0);
y += 16;
}
- showFrame(_tempGraphics2, 0, y, 5, 0);
+ showFrame(_folderGraphics2, 0, y, 5, 0);
_lineSpacing = 8;
_charShift = 91;
_kerning = 1;
@@ -464,14 +464,14 @@ void DreamWebEngine::showLeftPage() {
}
void DreamWebEngine::showRightPage() {
- showFrame(_tempGraphics2, 143, 12, 0, 0);
+ showFrame(_folderGraphics2, 143, 12, 0, 0);
uint16 y = 12+37;
for (size_t i = 0; i < 7; ++i) {
- showFrame(_tempGraphics2, 143, y, 1, 0);
+ showFrame(_folderGraphics2, 143, y, 1, 0);
y += 16;
}
- showFrame(_tempGraphics2, 143, y, 2, 0);
+ showFrame(_folderGraphics2, 143, y, 2, 0);
_lineSpacing = 8;
_kerning = 1;
uint8 pageIndex = _folderPage - 1;
@@ -491,7 +491,7 @@ void DreamWebEngine::showRightPage() {
void DreamWebEngine::enterSymbol() {
_manIsOffScreen = 1;
getRidOfReels();
- loadIntoTemp("DREAMWEB.G12"); // symbol graphics
+ loadGraphicsFile(_symbolGraphics, "DREAMWEB.G12"); // symbol graphics
_symbolTopX = 24;
_symbolTopDir = 0;
_symbolBotX = 24;
@@ -529,7 +529,7 @@ void DreamWebEngine::enterSymbol() {
turnAnyPathOn(0, _roomNum + 12);
_manIsOffScreen = 0;
redrawMainScrn();
- getRidOfTemp();
+ _symbolGraphics.clear();
restoreReels();
workToScreenM();
playChannel1(13);
@@ -539,7 +539,7 @@ void DreamWebEngine::enterSymbol() {
turnAnyPathOff(0, _roomNum + 12);
_manIsOffScreen = 0;
redrawMainScrn();
- getRidOfTemp();
+ _symbolGraphics.clear();
restoreReels();
workToScreenM();
}
@@ -616,19 +616,19 @@ void DreamWebEngine::dumpSymbol() {
}
void DreamWebEngine::showSymbol() {
- showFrame(_tempGraphics, kSymbolx, kSymboly, 12, 0);
+ showFrame(_symbolGraphics, kSymbolx, kSymboly, 12, 0);
- showFrame(_tempGraphics, _symbolTopX + kSymbolx-44, kSymboly+20, _symbolTopNum, 32);
+ showFrame(_symbolGraphics, _symbolTopX + kSymbolx-44, kSymboly+20, _symbolTopNum, 32);
uint8 nextTopSymbol = nextSymbol(_symbolTopNum);
- showFrame(_tempGraphics, _symbolTopX + kSymbolx+5, kSymboly+20, nextTopSymbol, 32);
+ showFrame(_symbolGraphics, _symbolTopX + kSymbolx+5, kSymboly+20, nextTopSymbol, 32);
uint8 nextNextTopSymbol = nextSymbol(nextTopSymbol);
- showFrame(_tempGraphics, _symbolTopX + kSymbolx+54, kSymboly+20, nextNextTopSymbol, 32);
+ showFrame(_symbolGraphics, _symbolTopX + kSymbolx+54, kSymboly+20, nextNextTopSymbol, 32);
- showFrame(_tempGraphics, _symbolBotX + kSymbolx-44, kSymboly+49, 6 + _symbolBotNum, 32);
+ showFrame(_symbolGraphics, _symbolBotX + kSymbolx-44, kSymboly+49, 6 + _symbolBotNum, 32);
uint8 nextBotSymbol = nextSymbol(_symbolBotNum);
- showFrame(_tempGraphics, _symbolBotX + kSymbolx+5, kSymboly+49, 6 + nextBotSymbol, 32);
+ showFrame(_symbolGraphics, _symbolBotX + kSymbolx+5, kSymboly+49, 6 + nextBotSymbol, 32);
uint8 nextNextBotSymbol = nextSymbol(nextBotSymbol);
- showFrame(_tempGraphics, _symbolBotX + kSymbolx+54, kSymboly+49, 6 + nextNextBotSymbol, 32);
+ showFrame(_symbolGraphics, _symbolBotX + kSymbolx+54, kSymboly+49, 6 + nextNextBotSymbol, 32);
}
uint8 DreamWebEngine::nextSymbol(uint8 symbol) {
@@ -716,9 +716,9 @@ void DreamWebEngine::updateSymbolBot() {
void DreamWebEngine::useDiary() {
getRidOfReels();
- loadIntoTemp("DREAMWEB.G14");
+ loadGraphicsFile(_diaryGraphics, "DREAMWEB.G14");
loadTempText("DREAMWEB.T51");
- loadTempCharset("DREAMWEB.C02");
+ loadGraphicsFile(_diaryCharset, "DREAMWEB.C02");
createPanel();
showIcon();
showDiary();
@@ -751,9 +751,9 @@ void DreamWebEngine::useDiary() {
} while (!_getBack && !_quitRequested);
- getRidOfTemp();
+ _diaryGraphics.clear();
getRidOfTempText();
- getRidOfTempCharset();
+ _diaryCharset.clear();
restoreReels();
_manIsOffScreen = 0;
redrawMainScrn();
@@ -761,8 +761,8 @@ void DreamWebEngine::useDiary() {
}
void DreamWebEngine::showDiary() {
- showFrame(_tempGraphics, kDiaryx, kDiaryy + 37, 1, 0);
- showFrame(_tempGraphics, kDiaryx + 176, kDiaryy + 108, 2, 0);
+ showFrame(_diaryGraphics, kDiaryx, kDiaryy + 37, 1, 0);
+ showFrame(_diaryGraphics, kDiaryx + 176, kDiaryy + 108, 2, 0);
}
void DreamWebEngine::showDiaryKeys() {
@@ -776,10 +776,10 @@ void DreamWebEngine::showDiaryKeys() {
if (_pressed == 'N') {
byte frame = (_pressCount == 1) ? 3 : 4;
- showFrame(_tempGraphics, kDiaryx + 94, kDiaryy + 97, frame, 0);
+ showFrame(_diaryGraphics, kDiaryx + 94, kDiaryy + 97, frame, 0);
} else {
byte frame = (_pressCount == 1) ? 5 : 6;
- showFrame(_tempGraphics, kDiaryx + 151, kDiaryy + 71, frame, 0);
+ showFrame(_diaryGraphics, kDiaryx + 151, kDiaryy + 71, frame, 0);
}
if (_pressCount == 1)
@@ -847,9 +847,9 @@ void DreamWebEngine::diaryKeyN() {
}
void DreamWebEngine::showDiaryPage() {
- showFrame(_tempGraphics, kDiaryx, kDiaryy, 0, 0);
+ showFrame(_diaryGraphics, kDiaryx, kDiaryy, 0, 0);
_kerning = 1;
- useTempCharset();
+ useTempCharset(&_diaryCharset);
_charShift = 91+91;
const uint8 *string = getTextInFile1(_diaryPage);
uint16 y = kDiaryy + 16;
diff --git a/engines/dreamweb/monitor.cpp b/engines/dreamweb/monitor.cpp
index ab6dd9efcb..f5f064f855 100644
--- a/engines/dreamweb/monitor.cpp
+++ b/engines/dreamweb/monitor.cpp
@@ -54,11 +54,11 @@ void DreamWebEngine::useMon() {
showIcon();
drawFloor();
getRidOfAll();
- loadIntoTemp("DREAMWEB.G03"); // mon. graphic name
+ loadGraphicsFile(_monitorGraphics, "DREAMWEB.G03"); // mon. graphic name
loadPersonal();
loadNews();
loadCart();
- loadTempCharset("DREAMWEB.C01"); // character set 2
+ loadGraphicsFile(_monitorCharset, "DREAMWEB.C01"); // character set 2
printOuterMon();
initialMonCols();
printLogo();
@@ -89,8 +89,8 @@ void DreamWebEngine::useMon() {
if (_quitRequested) //TODO : Check why it crashes when put before the execcommand
break;
} while (!stop);
- getRidOfTemp();
- getRidOfTempCharset();
+ _monitorGraphics.clear();
+ _monitorCharset.clear();
_textFile1.clear();
_textFile2.clear();
@@ -175,7 +175,7 @@ void DreamWebEngine::monitorLogo() {
_oldLogoNum = _logoNum;
//fadeDownMon(); // FIXME: Commented out in ASM
printLogo();
- printUnderMon();
+ printUnderMonitor();
workToScreen();
printLogo();
//fadeUpMon(); // FIXME: Commented out in ASM
@@ -188,14 +188,14 @@ void DreamWebEngine::monitorLogo() {
}
void DreamWebEngine::printLogo() {
- showFrame(_tempGraphics, 56, 32, 0, 0);
+ showFrame(_monitorGraphics, 56, 32, 0, 0);
showCurrentFile();
}
void DreamWebEngine::input() {
memset(_inputLine, 0, 64);
_curPos = 0;
- printChar(_tempCharset, _monAdX, _monAdY, '>', 0, NULL, NULL);
+ printChar(_monitorCharset, _monAdX, _monAdY, '>', 0, NULL, NULL);
multiDump(_monAdX, _monAdY, 6, 8);
_monAdX += 6;
_cursLocX = _monAdX;
@@ -227,7 +227,7 @@ void DreamWebEngine::input() {
continue;
multiGet(_mapStore + _curPos * 256, _monAdX, _monAdY, 8, 8);
uint8 charWidth;
- printChar(_tempCharset, _monAdX, _monAdY, currentKey, 0, &charWidth, NULL);
+ printChar(_monitorCharset, _monAdX, _monAdY, currentKey, 0, &charWidth, NULL);
_inputLine[_curPos * 2 + 1] = charWidth;
_monAdX += charWidth;
++_curPos;
@@ -266,7 +266,7 @@ void DreamWebEngine::printCurs() {
multiGet(_textUnder, x, y, 6, height);
++_mainTimer;
if ((_mainTimer & 16) == 0)
- showFrame(_tempCharset, x, y, '/' - 32, 0);
+ showFrame(_monitorCharset, x, y, '/' - 32, 0);
multiDump(x - 6, y, 12, height);
}
@@ -286,7 +286,7 @@ void DreamWebEngine::delCurs() {
void DreamWebEngine::scrollMonitor() {
printLogo();
- printUnderMon();
+ printUnderMonitor();
workToScreen();
playChannel1(25);
}
@@ -302,17 +302,17 @@ void DreamWebEngine::showCurrentFile() {
while (*currentFile) {
char c = *currentFile++;
c = modifyChar(c);
- printChar(_tempCharset, &x, 37, c, 0, NULL, NULL);
+ printChar(_monitorCharset, &x, 37, c, 0, NULL, NULL);
}
}
void DreamWebEngine::accessLightOn() {
- showFrame(_tempGraphics, 74, 182, 8, 0);
+ showFrame(_monitorGraphics, 74, 182, 8, 0);
multiDump(74, 182, 12, 8);
}
void DreamWebEngine::accessLightOff() {
- showFrame(_tempGraphics, 74, 182, 7, 0);
+ showFrame(_monitorGraphics, 74, 182, 7, 0);
multiDump(74, 182, 12, 8);
}
@@ -345,22 +345,22 @@ void DreamWebEngine::netError() {
}
void DreamWebEngine::powerLightOn() {
- showFrame(_tempGraphics, 257+4, 182, 6, 0);
+ showFrame(_monitorGraphics, 257+4, 182, 6, 0);
multiDump(257+4, 182, 12, 8);
}
void DreamWebEngine::powerLightOff() {
- showFrame(_tempGraphics, 257+4, 182, 5, 0);
+ showFrame(_monitorGraphics, 257+4, 182, 5, 0);
multiDump(257+4, 182, 12, 8);
}
void DreamWebEngine::lockLightOn() {
- showFrame(_tempGraphics, 56, 182, 10, 0);
+ showFrame(_monitorGraphics, 56, 182, 10, 0);
multiDump(58, 182, 12, 8);
}
void DreamWebEngine::lockLightOff() {
- showFrame(_tempGraphics, 56, 182, 9, 0);
+ showFrame(_monitorGraphics, 56, 182, 9, 0);
multiDump(58, 182, 12, 8);
}
@@ -375,10 +375,10 @@ void DreamWebEngine::turnOnPower() {
}
void DreamWebEngine::printOuterMon() {
- showFrame(_tempGraphics, 40, 32, 1, 0);
- showFrame(_tempGraphics, 264, 32, 2, 0);
- showFrame(_tempGraphics, 40, 12, 3, 0);
- showFrame(_tempGraphics, 40, 164, 4, 0);
+ showFrame(_monitorGraphics, 40, 32, 1, 0);
+ showFrame(_monitorGraphics, 264, 32, 2, 0);
+ showFrame(_monitorGraphics, 40, 12, 3, 0);
+ showFrame(_monitorGraphics, 40, 164, 4, 0);
}
void DreamWebEngine::loadPersonal() {
diff --git a/engines/dreamweb/newplace.cpp b/engines/dreamweb/newplace.cpp
index 8083055da6..c484855da4 100644
--- a/engines/dreamweb/newplace.cpp
+++ b/engines/dreamweb/newplace.cpp
@@ -41,7 +41,7 @@ void DreamWebEngine::selectLocation() {
_pointerFrame = 22;
readCityPic();
showCity();
- getRidOfTemp();
+ _cityGraphics.clear();
readDestIcon();
loadTravelText();
showPanel();
@@ -89,17 +89,17 @@ void DreamWebEngine::selectLocation() {
_getBack = 0;
}
- getRidOfTemp();
- getRidOfTemp2();
- getRidOfTemp3();
+ _newplaceGraphics.clear();
+ _newplaceGraphics2.clear();
+ _newplaceGraphics3.clear();
_travelText.clear();
}
void DreamWebEngine::showCity() {
clearWork();
- showFrame(_tempGraphics, 57, 32, 0, 0);
- showFrame(_tempGraphics, 120+57, 32, 1, 0);
+ showFrame(_cityGraphics, 57, 32, 0, 0);
+ showFrame(_cityGraphics, 120+57, 32, 1, 0);
}
void DreamWebEngine::lookAtPlace() {
@@ -113,10 +113,10 @@ void DreamWebEngine::lookAtPlace() {
delPointer();
delTextLine();
getUnderCentre();
- showFrame(_tempGraphics3, 60, 72, 0, 0);
- showFrame(_tempGraphics3, 60, 72 + 55, 4, 0);
+ showFrame(_newplaceGraphics3, 60, 72, 0, 0);
+ showFrame(_newplaceGraphics3, 60, 72 + 55, 4, 0);
if (_foreignRelease)
- showFrame(_tempGraphics3, 60, 72+55+21, 4, 0);
+ showFrame(_newplaceGraphics3, 60, 72+55+21, 4, 0);
const uint8 *string = (const uint8 *)_travelText.getString(_destPos);
findNextColon(&string);
@@ -143,21 +143,21 @@ void DreamWebEngine::locationPic() {
byte picture = roomPics[_destPos];
if (picture >= 6)
- showFrame(_tempGraphics2, 104, 138 + 14, picture - 6, 0); // Second slot
+ showFrame(_newplaceGraphics2, 104, 138 + 14, picture - 6, 0); // Second slot
else
- showFrame(_tempGraphics, 104, 138 + 14, picture + 4, 0);
+ showFrame(_newplaceGraphics, 104, 138 + 14, picture + 4, 0);
if (_destPos == _realLocation)
- showFrame(_tempGraphics, 104, 140 + 14, 3, 0); // Currently in this location
+ showFrame(_newplaceGraphics, 104, 140 + 14, 3, 0); // Currently in this location
const uint8 *string = (const uint8 *)_travelText.getString(_destPos);
printDirect(string, 50, 20, 241, 241 & 1);
}
void DreamWebEngine::showArrows() {
- showFrame(_tempGraphics, 116 - 12, 16, 0, 0);
- showFrame(_tempGraphics, 226 + 12, 16, 1, 0);
- showFrame(_tempGraphics, 280, 14, 2, 0);
+ showFrame(_newplaceGraphics, 116 - 12, 16, 0, 0);
+ showFrame(_newplaceGraphics, 226 + 12, 16, 1, 0);
+ showFrame(_newplaceGraphics, 280, 14, 2, 0);
}
void DreamWebEngine::nextDest() {
@@ -259,13 +259,13 @@ void DreamWebEngine::resetLocation(uint8 index) {
}
void DreamWebEngine::readDestIcon() {
- loadIntoTemp("DREAMWEB.G05");
- loadIntoTemp2("DREAMWEB.G06");
- loadIntoTemp3("DREAMWEB.G08");
+ loadGraphicsFile(_newplaceGraphics, "DREAMWEB.G05");
+ loadGraphicsFile(_newplaceGraphics2, "DREAMWEB.G06");
+ loadGraphicsFile(_newplaceGraphics3, "DREAMWEB.G08");
}
void DreamWebEngine::readCityPic() {
- loadIntoTemp("DREAMWEB.G04");
+ loadGraphicsFile(_cityGraphics, "DREAMWEB.G04");
}
} // End of namespace DreamWeb
diff --git a/engines/dreamweb/people.cpp b/engines/dreamweb/people.cpp
index 0f51adde17..1b8ee1b4de 100644
--- a/engines/dreamweb/people.cpp
+++ b/engines/dreamweb/people.cpp
@@ -145,13 +145,19 @@ void DreamWebEngine::updatePeople() {
void DreamWebEngine::madmanText() {
byte origCount;
+ uint16 length = 90;
if (hasSpeech()) {
- if (_speechCount >= 63)
+ if (_speechCount > 15)
return;
if (_channel1Playing != 255)
return;
origCount = _speechCount;
++_speechCount;
+
+ if (origCount != 15)
+ length = 32000; // Set subtitle time very high to make it
+ // always wait for the next line, except for the
+ // last one, when there is no next line.
} else {
if (_vars._combatCount >= 61)
return;
@@ -159,7 +165,7 @@ void DreamWebEngine::madmanText() {
return;
origCount = _vars._combatCount / 4;
}
- setupTimedTemp(47 + origCount, 82, 72, 80, 90, 1);
+ setupTimedTemp(47 + origCount, 82, 72, 80, length, 1);
}
void DreamWebEngine::madman(ReelRoutine &routine) {
diff --git a/engines/dreamweb/print.cpp b/engines/dreamweb/print.cpp
index 24e0183a07..a6b93a5590 100644
--- a/engines/dreamweb/print.cpp
+++ b/engines/dreamweb/print.cpp
@@ -210,7 +210,7 @@ const char *DreamWebEngine::monPrint(const char *string) {
bool done = false;
while (!done) {
- uint16 count = getNumber(_tempCharset, (const uint8 *)iterator, 166, false, &x);
+ uint16 count = getNumber(_monitorCharset, (const uint8 *)iterator, 166, false, &x);
do {
char c = *iterator++;
if (c == ':')
@@ -226,7 +226,7 @@ const char *DreamWebEngine::monPrint(const char *string) {
break;
}
c = modifyChar(c);
- printChar(_tempCharset, &x, _monAdY, c, 0, NULL, NULL);
+ printChar(_monitorCharset, &x, _monAdY, c, 0, NULL, NULL);
_cursLocX = x;
_cursLocY = _monAdY;
_mainTimer = 1;
diff --git a/engines/dreamweb/saveload.cpp b/engines/dreamweb/saveload.cpp
index 386319db34..acc76572ef 100644
--- a/engines/dreamweb/saveload.cpp
+++ b/engines/dreamweb/saveload.cpp
@@ -143,6 +143,7 @@ void DreamWebEngine::doLoad(int savegameId) {
{ kOpsx+176,kOpsx+192,kOpsy+60,kOpsy+76,&DreamWebEngine::getBackToOps },
{ kOpsx+128,kOpsx+190,kOpsy+12,kOpsy+100,&DreamWebEngine::actualLoad },
{ kOpsx+2,kOpsx+92,kOpsy+4,kOpsy+81,&DreamWebEngine::selectSlot },
+ { kOpsx+158,kOpsx+158+(18*3),kOpsy-17,kOpsy-1,&DreamWebEngine::selectSaveLoadPage },
{ 0,320,0,200,&DreamWebEngine::blank },
{ 0xFFFF,0,0,0,0 }
};
@@ -177,7 +178,7 @@ void DreamWebEngine::doLoad(int savegameId) {
// If we reach this point, loadPosition() has just been called.
// Among other things, it will have filled g_MadeUpRoomDat.
- getRidOfTemp();
+ _saveGraphics.clear();
startLoading(g_madeUpRoomDat);
loadRoomsSample();
@@ -234,6 +235,7 @@ void DreamWebEngine::saveGame() {
{ kOpsx+176,kOpsx+192,kOpsy+60,kOpsy+76,&DreamWebEngine::getBackToOps },
{ kOpsx+128,kOpsx+190,kOpsy+12,kOpsy+100,&DreamWebEngine::actualSave },
{ kOpsx+2,kOpsx+92,kOpsy+4,kOpsy+81,&DreamWebEngine::selectSlot },
+ { kOpsx+158,kOpsx+158+(18*3),kOpsy-17,kOpsy-1,&DreamWebEngine::selectSaveLoadPage },
{ 0,320,0,200,&DreamWebEngine::blank },
{ 0xFFFF,0,0,0,0 }
};
@@ -258,7 +260,7 @@ void DreamWebEngine::saveGame() {
}
char descbuf[17] = { 2, 0 };
- Common::strlcpy((char*)descbuf + 1, game_description.c_str(), 16);
+ Common::strlcpy((char *)descbuf + 1, game_description.c_str(), 16);
unsigned int desclen = game_description.size();
if (desclen > 15)
desclen = 15;
@@ -268,7 +270,7 @@ void DreamWebEngine::saveGame() {
descbuf[++desclen] = 1;
// TODO: The below is copied from actualsave
- getRidOfTemp();
+ _saveGraphics.clear();
restoreAll(); // reels
_textAddressX = 13;
_textAddressY = 182;
@@ -286,11 +288,11 @@ void DreamWebEngine::saveGame() {
}
void DreamWebEngine::namesToOld() {
- memcpy(_saveNamesOld, _saveNames, 17*7);
+ memcpy(_saveNamesOld, _saveNames, 17*21);
}
void DreamWebEngine::oldToNames() {
- memcpy(_saveNames, _saveNamesOld, 17*7);
+ memcpy(_saveNames, _saveNamesOld, 17*21);
}
void DreamWebEngine::saveLoad() {
@@ -358,7 +360,7 @@ void DreamWebEngine::doSaveLoad() {
_textAddressY = 182;
_textLen = 240;
if (_getBack != 4) {
- getRidOfTemp();
+ _saveGraphics.clear();
restoreAll();
redrawMainScrn();
workToScreenM();
@@ -386,16 +388,16 @@ void DreamWebEngine::getBackToOps() {
}
void DreamWebEngine::showMainOps() {
- showFrame(_tempGraphics, kOpsx+10, kOpsy+10, 8, 0);
- showFrame(_tempGraphics, kOpsx+59, kOpsy+30, 7, 0);
- showFrame(_tempGraphics, kOpsx+128+4, kOpsy+12, 1, 0);
+ showFrame(_saveGraphics, kOpsx+10, kOpsy+10, 8, 0);
+ showFrame(_saveGraphics, kOpsx+59, kOpsy+30, 7, 0);
+ showFrame(_saveGraphics, kOpsx+128+4, kOpsy+12, 1, 0);
}
void DreamWebEngine::showDiscOps() {
- showFrame(_tempGraphics, kOpsx+128+4, kOpsy+12, 1, 0);
- showFrame(_tempGraphics, kOpsx+10, kOpsy+10, 9, 0);
- showFrame(_tempGraphics, kOpsx+59, kOpsy+30, 10, 0);
- showFrame(_tempGraphics, kOpsx+176+2, kOpsy+60-4, 5, 0);
+ showFrame(_saveGraphics, kOpsx+128+4, kOpsy+12, 1, 0);
+ showFrame(_saveGraphics, kOpsx+10, kOpsy+10, 9, 0);
+ showFrame(_saveGraphics, kOpsx+59, kOpsy+30, 10, 0);
+ showFrame(_saveGraphics, kOpsx+176+2, kOpsy+60-4, 5, 0);
}
void DreamWebEngine::discOps() {
@@ -440,7 +442,7 @@ void DreamWebEngine::actualSave() {
if (!(_mouseButton & 1))
return;
- unsigned int slot = _currentSlot;
+ unsigned int slot = _currentSlot + 7 * _saveLoadPage;
const char *desc = &_saveNames[17*slot];
if (desc[1] == 0) // The actual description string starts at desc[1]
@@ -448,7 +450,7 @@ void DreamWebEngine::actualSave() {
savePosition(slot, desc);
- getRidOfTemp();
+ _saveGraphics.clear();
restoreAll(); // reels
_textAddressX = 13;
_textAddressY = 182;
@@ -464,13 +466,13 @@ void DreamWebEngine::actualLoad() {
if (_mouseButton == _oldButton || _mouseButton != 1)
return;
- unsigned int slot = _currentSlot;
+ unsigned int slot = _currentSlot + 7 * _saveLoadPage;
const char *desc = &_saveNames[17*slot];
if (desc[1] == 0) // The actual description string starts at desc[1]
return;
- loadPosition(_currentSlot);
+ loadPosition(slot);
_getBack = 1;
}
@@ -582,10 +584,10 @@ void DreamWebEngine::loadPosition(unsigned int slot) {
if (len[0] != 17)
::error("Error loading save: description buffer isn't 17 bytes");
- if (slot < 7) {
+ if (slot < 21) {
inSaveFile->read(&_saveNames[17*slot], len[0]);
} else {
- // The savenames buffer only has room for 7 descriptions
+ // The savenames buffer only has room for 21 descriptions
uint8 namebuf[17];
inSaveFile->read(namebuf, 17);
}
@@ -644,8 +646,10 @@ void DreamWebEngine::loadPosition(unsigned int slot) {
// Count number of save files, and load their descriptions into _saveNames
uint DreamWebEngine::scanForNames() {
- // Initialize the first 7 slots (like the original code expects)
- for (unsigned int slot = 0; slot < 7; ++slot) {
+ // There are 21 save slots, each of which are 17 bytes. The first byte
+ // doesn't seem to be used. The name starts at the second byte. All the
+ // slots are initialized to be empty.
+ for (unsigned int slot = 0; slot < 21; ++slot) {
_saveNames[17 * slot + 0] = 2;
_saveNames[17 * slot + 1] = 0;
for (int i = 2; i < 17; ++i)
@@ -670,7 +674,7 @@ uint DreamWebEngine::scanForNames() {
int slotNum = atoi(file.c_str() + file.size() - 2);
SaveStateDescriptor sd(slotNum, name);
saveList.push_back(sd);
- if (slotNum < 7)
+ if (slotNum < 21)
Common::strlcpy(&_saveNames[17 * slotNum + 1], name, 16); // the first character is unused
}
@@ -699,19 +703,20 @@ void DreamWebEngine::loadOld() {
void DreamWebEngine::showDecisions() {
createPanel2();
showOpBox();
- showFrame(_tempGraphics, kOpsx + 17, kOpsy + 13, 6, 0);
+ showFrame(_saveGraphics, kOpsx + 17, kOpsy + 13, 6, 0);
underTextLine();
}
void DreamWebEngine::loadSaveBox() {
- loadIntoTemp("DREAMWEB.G08");
+ loadGraphicsFile(_saveGraphics, "DREAMWEB.G08");
}
// show savegame names (original interface), and set kCursorpos
void DreamWebEngine::showNames() {
+ unsigned int offset = 7 * _saveLoadPage;
for (int slot = 0; slot < 7; ++slot) {
// The first character of the savegame name is unused
- Common::String name(&_saveNames[17*slot + 1]);
+ Common::String name(&_saveNames[17 * (slot + offset) + 1]);
if (slot != _currentSlot) {
printDirect((const uint8 *)name.c_str(), kOpsx + 21, kOpsy + 10*slot + 10, 200, false);
@@ -737,8 +742,10 @@ void DreamWebEngine::checkInput() {
readKey();
+ unsigned int slot = _currentSlot + 7 * _saveLoadPage;
+
// The first character of the savegame name is unused
- char *name = &_saveNames[17*_currentSlot + 1];
+ char *name = &_saveNames[17*slot + 1];
if (_currentKey == 0) {
return;
@@ -768,6 +775,21 @@ void DreamWebEngine::checkInput() {
workToScreenM();
}
+void DreamWebEngine::selectSaveLoadPage() {
+ commandOnlyCond(31, 254);
+
+ if (_mouseButton != 1 || _mouseButton == _oldButton)
+ return;
+ uint saveLoadPage = (_mouseX - (kOpsx + 158)) / 18;
+ if (saveLoadPage != _saveLoadPage) {
+ _saveLoadPage = saveLoadPage;
+ // This will also make the first slot the selected one, based
+ // on the mouse Y position. I can't decide if this is a feature
+ // or not.
+ selectSlot();
+ }
+}
+
void DreamWebEngine::selectSlot() {
commandOnlyCond(45, 244);
@@ -798,37 +820,39 @@ void DreamWebEngine::selectSlot() {
}
void DreamWebEngine::showSlots() {
- showFrame(_tempGraphics, kOpsx + 7, kOpsy + 8, 2, 0);
+ showFrame(_icons1, kOpsx + 158, kOpsy - 11, 12, 0);
+ showFrame(_icons1, kOpsx + 158 + 18 * _saveLoadPage, kOpsy - 11, 13 + _saveLoadPage, 0);
+ showFrame(_saveGraphics, kOpsx + 7, kOpsy + 8, 2, 0);
uint16 y = kOpsy + 11;
for (int slot = 0; slot < 7; slot++) {
if (slot == _currentSlot)
- showFrame(_tempGraphics, kOpsx + 10, y, 3, 0);
+ showFrame(_saveGraphics, kOpsx + 10, y, 3, 0);
y += 10;
}
}
void DreamWebEngine::showOpBox() {
- showFrame(_tempGraphics, kOpsx, kOpsy, 0, 0);
+ showFrame(_saveGraphics, kOpsx, kOpsy, 0, 0);
// This call displays half of the ops dialog in the CD version. It's not
// in the floppy version, and if it's called, a stray red dot is shown in
// the game dialogs.
if (isCD())
- showFrame(_tempGraphics, kOpsx, kOpsy + 55, 4, 0);
+ showFrame(_saveGraphics, kOpsx, kOpsy + 55, 4, 0);
}
void DreamWebEngine::showLoadOps() {
- showFrame(_tempGraphics, kOpsx + 128 + 4, kOpsy + 12, 1, 0);
- showFrame(_tempGraphics, kOpsx + 176 + 2, kOpsy + 60 - 4, 5, 0);
+ showFrame(_saveGraphics, kOpsx + 128 + 4, kOpsy + 12, 1, 0);
+ showFrame(_saveGraphics, kOpsx + 176 + 2, kOpsy + 60 - 4, 5, 0);
printMessage(kOpsx + 104, kOpsy + 14, 55, 101, (101 & 1));
}
void DreamWebEngine::showSaveOps() {
- showFrame(_tempGraphics, kOpsx + 128 + 4, kOpsy + 12, 1, 0);
- showFrame(_tempGraphics, kOpsx + 176 + 2, kOpsy + 60 - 4, 5, 0);
+ showFrame(_saveGraphics, kOpsx + 128 + 4, kOpsy + 12, 1, 0);
+ showFrame(_saveGraphics, kOpsx + 176 + 2, kOpsy + 60 - 4, 5, 0);
printMessage(kOpsx + 104, kOpsy + 14, 54, 101, (101 & 1));
}
diff --git a/engines/dreamweb/structs.h b/engines/dreamweb/structs.h
index ddc027120d..24b67e317a 100644
--- a/engines/dreamweb/structs.h
+++ b/engines/dreamweb/structs.h
@@ -339,9 +339,9 @@ struct TextFile {
};
struct GraphicsFile {
- GraphicsFile() : _data(0) { }
+ GraphicsFile() : _data(0), _frames(0) { }
- Frame _frames[347];
+ Frame *_frames;
uint8 *_data;
const uint8 *getFrameData(unsigned int i) const {
@@ -351,6 +351,8 @@ struct GraphicsFile {
return _data + _frames[i].ptr();
}
void clear() {
+ delete[] _frames;
+ _frames = 0;
delete[] _data;
_data = 0;
}
@@ -418,6 +420,18 @@ struct GameVars {
uint8 _shakeCounter;
};
+struct TimedTemp {
+ TimedTemp() : _timeCount(0), _string(0) { }
+
+ uint8 _x;
+ uint8 _y;
+
+ uint16 _timeCount;
+ uint16 _countToTimed;
+
+ const char *_string;
+};
+
} // End of namespace DreamWeb
#endif
diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp
index 5f05f290ad..763bcb88fe 100644
--- a/engines/dreamweb/stubs.cpp
+++ b/engines/dreamweb/stubs.cpp
@@ -30,76 +30,91 @@ namespace DreamWeb {
uint8 g_keyBuffer[16];
const Room g_roomData[] = {
+ // location 0
{ "DREAMWEB.R00", // Ryan's apartment
5,255,33,10,
255,255,255,0,
1,6,2,255,3,255,255,255,255,255,0 },
+ // location 1
{ "DREAMWEB.R01",
1,255,44,10,
255,255,255,0,
7,2,255,255,255,255,6,255,255,255,1 },
+ // location 2: Louis' (?)
{ "DREAMWEB.R02",
2,255,33,0,
255,255,255,0,
1,0,255,255,1,255,3,255,255,255,2 },
+ // location 3
{ "DREAMWEB.R03",
5,255,33,10,
255,255,255,0,
2,2,0,2,4,255,0,255,255,255,3 },
+ // location 4
{ "DREAMWEB.R04",
23,255,11,30,
255,255,255,0,
1,4,0,5,255,255,3,255,255,255,4 },
+ // location 5: In hotel, lift noise audible (?)
{ "DREAMWEB.R05",
5,255,22,30, // if demo: 22,255,22,30,
255,255,255,0,
1,2,0,4,255,255,3,255,255,255,5 },
+ // location 6: sarters (?)
{ "DREAMWEB.R06",
5,255,11,30,
255,255,255,0,
1,0,0,1,2,255,0,255,255,255,6 },
+ // location 7
{ "DREAMWEB.R07",
255,255,0,20,
255,255,255,0,
2,2,255,255,255,255,0,255,255,255,7 },
+ // location 8: TV studio (?)
{ "DREAMWEB.R08",
8,255,0,10,
255,255,255,0,
1,2,255,255,255,255,0,11,40,0,8 },
+ // location 9
{ "DREAMWEB.R09",
9,255,22,10,
255,255,255,0,
4,6,255,255,255,255,0,255,255,255,9 },
+ // location 10
{ "DREAMWEB.R10",
10,255,33,30,
255,255,255,0,
2,0,255,255,2,2,4,22,30,255,10 }, // 22,30,0 switches
// off path 0 in skip
+ // location 11
{ "DREAMWEB.R11",
11,255,11,20,
255,255,255,0,
0,4,255,255,255,255,255,255,255,255,11 },
+ // location 12
{ "DREAMWEB.R12",
12,255,22,20,
255,255,255,0,
1,4,255,255,255,255,255,255,255,255,12 },
+ // location 13: boathouse (?)
{ "DREAMWEB.R13",
12,255,22,20,
255,255,255,0,
1,4,255,255,255,255,255,255,255,255,13 },
+ // location 14
{ "DREAMWEB.R14",
14,255,44,20,
255,255,255,0,
@@ -110,166 +125,196 @@ const Room g_roomData[] = {
{ "", 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 },
+ // location 19
{ "DREAMWEB.R19",
19,255,0,0,
255,255,255,0,
0,4,255,255,255,255,255,255,255,255,19 },
+ // location 20: Sart room (?)
{ "DREAMWEB.R20",
22,255,0,20,
255,255,255,0,
1,4,2,15,255,255,255,255,255,255,20 },
+ // location 21: lift noise audible (?)
{ "DREAMWEB.R21",
5,255,11,10, // if demo: 22,255,11,10,
255,255,255,0,
1,4,2,15,1,255,255,255,255,255,21 },
+ // location 22: pool room (?)
{ "DREAMWEB.R22",
22,255,22,10,
255,255,255,0,
0,4,255,255,1,255,255,255,255,255,22 },
+ // location 23
{ "DREAMWEB.R23",
23,255,22,30,
255,255,255,0,
1,4,2,15,3,255,255,255,255,255,23 },
+ // location 24: only room in which initialInv() is active, i.e. we get initial inventory here
{ "DREAMWEB.R24",
5,255,44,0,
255,255,255,0,
1,6,2,15,255,255,255,255,255,255,24 },
+ // location 25: helicopter (?)
{ "DREAMWEB.R25",
22,255,11,40,
255,255,255,0,
1,0,255,255,255,255,255,255,255,255,25 },
+ // location 26: reached via trap door (?)
{ "DREAMWEB.R26",
9,255,22,20,
255,255,255,0,
4,2,255,255,255,255,255,255,255,255,26 },
+ // location 27: rock room (?)
{ "DREAMWEB.R27",
22,255,11,20,
255,255,255,0,
0,6,255,255,255,255,255,255,255,255,27 },
+ // location 28: related to TV studiou (?), see resetLocation()
{ "DREAMWEB.R28",
5,255,11,30,
255,255,255,0,
0,0,255,255,2,255,255,255,255,255,28 },
+ // location 29: aide (?)
{ "DREAMWEB.R29",
22,255,11,10,
255,255,255,0,
0,2,255,255,255,255,255,255,255,255,29 },
-
+ // location 30
{ "DREAMWEB.R05", // Duplicate of hotel lobby, but emerging from the lift.
5,255,22,10, // if demo: 22,255,22,10
255,255,255,0,
1,4,1,15,255,255,255,255,255,255,5 },
+ // location 31
{ "DREAMWEB.R04", // Duplicate of pool hall lobby,
23,255,22,20, // but emerging from the lift.
255,255,255,0,
1,4,2,15,255,255,255,255,255,255,4 },
+ // location 32
{ "DREAMWEB.R10", // entering alley via skip
10,255,22,30,
255,255,255,0,
3,6,255,255,255,255,255,255,255,255,10 },
+ // location 33
{ "DREAMWEB.R12", // on the beach, getting up.
12,255,22,20,
255,255,255,0,
0,2,255,255,255,255,255,255,255,255,12 },
+ // location 34
{ "DREAMWEB.R03", // Duplicate of Eden's lobby
5,255,44,0, // but emerging from the lift
255,255,255,0,
1,6,2,255,4,255,255,255,255,255,3 },
+ // location 35: Location when starting the game, after dream (?)
{ "DREAMWEB.R24", // Duplicate of Eden's flat
5,255,22,0, // but starting on the bed
255,255,255,0,
3,6,0,255,255,255,255,33,0,3,24 }, // 33,0,3 turns off path for lift
+ // location 36
{ "DREAMWEB.R22", // Duplicate
22,255,22,20, // of hotel but in pool room
255,255,255,0,
1,4,255,255,255,255,255,255,255,255,22 },
+ // location 37
{ "DREAMWEB.R22", // Duplicate
22,255,22,20, // of hotel but in pool room
255,255,255,0, // coming out of bedroom
0,2,255,255,255,255,255,255,255,255,22 },
+ // location 38
{ "DREAMWEB.R11", // Duplicate
11,255,22,30, // of carpark but getting
255,255,255,0, // up off the floor
0,0,255,255,255,255,255,255,255,255,11 },
+ // location 39
{ "DREAMWEB.R28",
5,255,11,20,
255,255,255,0,
0,6,255,255,2,255,255,255,255,255,28 },
+ // location 40
{ "DREAMWEB.R21",
5,255,11,10, // if demo: 22,255,11,10
255,255,255,0,
1,4,2,15,1,255,255,255,255,255,21 },
+ // location 41
{ "DREAMWEB.R26",
9,255,0,40,
255,255,255,0,
0,0,255,255,255,255,255,255,255,255,26 },
+ // location 42
{ "DREAMWEB.R19",
19,255,0,0,
255,255,255,0,
2,2,255,255,255,255,255,255,255,255,19 },
+ // location 43
{ "DREAMWEB.R08", // leaving tvstudio into street
8,255,11,40,
255,255,255,0,
0,4,255,255,255,255,255,255,255,255,8 },
+ // location 44
{ "DREAMWEB.R01",
1,255,44,10,
255,255,255,0,
3,6,255,255,255,255,255,255,255,255,1 },
+ // location 45
{ "DREAMWEB.R45", // Dream room
35,255,22,30,
255,255,255,0,
0,6,255,255,255,255,255,255,255,255,45 },
+ // location 46
{ "DREAMWEB.R46", // Dream room
35,255,22,40,
255,255,255,0,
0,4,255,255,255,255,255,255,255,255,46 },
+ // location 47
{ "DREAMWEB.R47", // Dream room
35,255,0,0,
255,255,255,0,
0,0,255,255,255,255,255,255,255,255,47 },
+ // location 48
{ "DREAMWEB.R45", // Dream room
35,255,22,30,
255,255,255,0,
4,0,255,255,255,255,255,255,255,255,45 },
+ // location 49
{ "DREAMWEB.R46", // Dream room
35,255,22,50,
255,255,255,0,
0,4,255,255,255,255,255,255,255,255,46 },
-
+ // location 50
{ "DREAMWEB.R50", // Intro sequence one
35,255,22,30,
255,255,255,0,
@@ -465,12 +510,27 @@ void DreamWebEngine::dreamwebFinalize() {
_icons1.clear();
_icons2.clear();
_charset1.clear();
- _tempGraphics.clear();
- _tempGraphics2.clear();
- _tempGraphics3.clear();
- _tempCharset.clear();
_mainSprites.clear();
+ // clear local graphics, just in case
+ _keypadGraphics.clear();
+ _menuGraphics.clear();
+ _menuGraphics2.clear();
+ _folderGraphics.clear();
+ _folderGraphics2.clear();
+ _folderGraphics3.clear();
+ _folderCharset.clear();
+ _symbolGraphics.clear();
+ _diaryGraphics.clear();
+ _diaryCharset.clear();
+ _monitorGraphics.clear();
+ _monitorCharset.clear();
+ _newplaceGraphics.clear();
+ _newplaceGraphics2.clear();
+ _newplaceGraphics3.clear();
+ _cityGraphics.clear();
+ _saveGraphics.clear();
+
_exFrames.clear();
_exText.clear();
@@ -783,17 +843,18 @@ void DreamWebEngine::loadGraphicsFile(GraphicsFile &file, const char *fileName)
uint16 sizeInBytes = header.len(0);
assert(sizeInBytes >= kFrameBlocksize);
- delete[] file._data;
+ file.clear();
file._data = new uint8[sizeInBytes - kFrameBlocksize];
-
+ file._frames = new Frame[kGraphicsFileFrameSize];
f.read((uint8 *)file._frames, kFrameBlocksize);
f.read(file._data, sizeInBytes - kFrameBlocksize);
}
void DreamWebEngine::loadGraphicsSegment(GraphicsFile &file, Common::File &inFile, unsigned int len) {
assert(len >= kFrameBlocksize);
- delete[] file._data;
+ file.clear();
file._data = new uint8[len - kFrameBlocksize];
+ file._frames = new Frame[kGraphicsFileFrameSize];
inFile.read((uint8 *)file._frames, kFrameBlocksize);
inFile.read(file._data, len - kFrameBlocksize);
}
@@ -807,22 +868,6 @@ void DreamWebEngine::loadTextSegment(TextFile &file, Common::File &inFile, unsig
inFile.read((uint8 *)file._text, len - headerSize);
}
-void DreamWebEngine::loadIntoTemp(const char *fileName) {
- loadGraphicsFile(_tempGraphics, fileName);
-}
-
-void DreamWebEngine::loadIntoTemp2(const char *fileName) {
- loadGraphicsFile(_tempGraphics2, fileName);
-}
-
-void DreamWebEngine::loadIntoTemp3(const char *fileName) {
- loadGraphicsFile(_tempGraphics3, fileName);
-}
-
-void DreamWebEngine::loadTempCharset(const char *fileName) {
- loadGraphicsFile(_tempCharset, fileName);
-}
-
void DreamWebEngine::hangOnCurs(uint16 frameCount) {
for (uint16 i = 0; i < frameCount; ++i) {
printCurs();
@@ -864,16 +909,16 @@ void DreamWebEngine::dumpTextLine() {
void DreamWebEngine::getUnderTimed() {
if (_foreignRelease)
- multiGet(_underTimedText, _timedX, _timedY - 3, 240, kUnderTimedTextSizeY_f);
+ multiGet(_underTimedText, _timedTemp._x, _timedTemp._y - 3, 240, kUnderTimedTextSizeY_f);
else
- multiGet(_underTimedText, _timedX, _timedY, 240, kUnderTimedTextSizeY);
+ multiGet(_underTimedText, _timedTemp._x, _timedTemp._y, 240, kUnderTimedTextSizeY);
}
void DreamWebEngine::putUnderTimed() {
if (_foreignRelease)
- multiPut(_underTimedText, _timedX, _timedY - 3, 240, kUnderTimedTextSizeY_f);
+ multiPut(_underTimedText, _timedTemp._x, _timedTemp._y - 3, 240, kUnderTimedTextSizeY_f);
else
- multiPut(_underTimedText, _timedX, _timedY, 240, kUnderTimedTextSizeY);
+ multiPut(_underTimedText, _timedTemp._x, _timedTemp._y, 240, kUnderTimedTextSizeY);
}
void DreamWebEngine::triggerMessage(uint16 index) {
@@ -903,6 +948,23 @@ void DreamWebEngine::processTrigger() {
}
void DreamWebEngine::useTimedText() {
+ if (_previousTimedTemp._string) {
+ // TODO: It might be nice to make subtitles wait for the speech
+ // to finish (_channel1Playing) when we're in speech+subtitles mode,
+ // instead of waiting the pre-specified amount of time.
+
+
+ // Ugly... (Maybe make this an argument to putUnderTimed()?)
+ TimedTemp t = _timedTemp;
+ _timedTemp = _previousTimedTemp;
+
+ // Force-reset the previous string to make room for the next one
+ putUnderTimed();
+
+ _timedTemp = t;
+ return;
+ }
+
if (_timeCount == 0)
return;
--_timeCount;
@@ -912,49 +974,65 @@ void DreamWebEngine::useTimedText() {
return;
}
- if (_timeCount == _countToTimed)
+ if (_timeCount == _timedTemp._countToTimed)
getUnderTimed();
- else if (_timeCount > _countToTimed)
+ else if (_timeCount > _timedTemp._countToTimed)
return;
- const uint8 *string = (const uint8 *)_timedString;
- printDirect(string, _timedX, _timedY, 237, true);
+ const uint8 *string = (const uint8 *)_timedTemp._string;
+ printDirect(string, _timedTemp._x, _timedTemp._y, 237, true);
_needToDumpTimed = 1;
}
void DreamWebEngine::setupTimedTemp(uint8 textIndex, uint8 voiceIndex, uint8 x, uint8 y, uint16 countToTimed, uint16 timeCount) {
+
if (hasSpeech() && voiceIndex != 0) {
if (loadSpeech('T', voiceIndex, 'T', textIndex)) {
playChannel1(50+12);
}
- // FIXME: This fallthrough does not properly support subtitles+speech
- // mode. The parameters to setuptimedtemp() are sometimes different
- // for speech and for subtitles. See e.g., madmantext()
if (_speechLoaded && !_subtitles)
return;
+
+ if (_timeCount != 0) {
+ // store previous TimedTemp for deletion
+ _previousTimedTemp = _timedTemp;
+ _timeCount = 0;
+ }
}
if (_timeCount != 0)
return;
- _timedY = y;
- _timedX = x;
- _countToTimed = countToTimed;
- _timeCount = timeCount + countToTimed;
- _timedString = _textFile1.getString(textIndex);
- debug(1, "setupTimedTemp: (%d, %d) => '%s'", textIndex, voiceIndex, _timedString);
+
+ _timedTemp._y = y;
+ _timedTemp._x = x;
+ _timedTemp._countToTimed = countToTimed;
+ _timeCount = _timedTemp._timeCount = timeCount + countToTimed;
+ _timedTemp._string = _textFile1.getString(textIndex);
+ debug(1, "setupTimedTemp: (%d, %d) => '%s'", textIndex, voiceIndex, _timedTemp._string);
}
void DreamWebEngine::dumpTimedText() {
- const uint16 kUndertimedysize = 30;
- if (_needToDumpTimed != 1)
+ const TimedTemp *tt;
+ if (_previousTimedTemp._string) {
+ assert(!_needToDumpTimed);
+
+ tt = &_previousTimedTemp;
+ _previousTimedTemp._string = 0;
+ _previousTimedTemp._timeCount = 0;
+ } else if (_needToDumpTimed != 1) {
return;
- uint8 y = _timedY;
+ } else {
+ tt = &_timedTemp;
+ _needToDumpTimed = 0;
+ }
+
+ const uint16 kUndertimedysize = 30;
+ uint8 y = tt->_y;
if (_foreignRelease)
y -= 3;
- multiDump(_timedX, y, 240, kUndertimedysize);
- _needToDumpTimed = 0;
+ multiDump(tt->_x, y, 240, kUndertimedysize);
}
void DreamWebEngine::getTime() {
@@ -1987,30 +2065,14 @@ void DreamWebEngine::useCharset1() {
_currentCharset = &_charset1;
}
-void DreamWebEngine::useTempCharset() {
- _currentCharset = &_tempCharset;
-}
-
-void DreamWebEngine::getRidOfTemp() {
- _tempGraphics.clear();
+void DreamWebEngine::useTempCharset(GraphicsFile *charset) {
+ _currentCharset = charset;
}
void DreamWebEngine::getRidOfTempText() {
_textFile1.clear();
}
-void DreamWebEngine::getRidOfTemp2() {
- _tempGraphics2.clear();
-}
-
-void DreamWebEngine::getRidOfTemp3() {
- _tempGraphics3.clear();
-}
-
-void DreamWebEngine::getRidOfTempCharset() {
- _tempCharset.clear();
-}
-
void DreamWebEngine::getRidOfAll() {
delete[] _backdropBlocks;
_backdropBlocks = 0;
@@ -2196,6 +2258,7 @@ void DreamWebEngine::drawFloor() {
void DreamWebEngine::allocateBuffers() {
_exFrames.clear();
_exFrames._data = new uint8[kExframeslen];
+ _exFrames._frames = new Frame[kGraphicsFileFrameSize];
_exText.clear();
_exText._text = new char[kExtextlen];
}
@@ -2687,7 +2750,7 @@ void DreamWebEngine::decide() {
} while (!_getBack);
if (_getBack != 4)
- getRidOfTemp(); // room not loaded
+ _saveGraphics.clear(); // room not loaded
_textAddressX = 13;
_textAddressY = 182;
@@ -2716,12 +2779,13 @@ void DreamWebEngine::showGun() {
_roomsSample = 34;
loadRoomsSample();
_volume = 0;
- loadIntoTemp("DREAMWEB.G13");
+ GraphicsFile graphics;
+ loadGraphicsFile(graphics, "DREAMWEB.G13");
createPanel2();
- showFrame(_tempGraphics, 100, 4, 0, 0);
- showFrame(_tempGraphics, 158, 106, 1, 0);
+ showFrame(graphics, 100, 4, 0, 0);
+ showFrame(graphics, 158, 106, 1, 0);
workToScreen();
- getRidOfTemp();
+ graphics.clear();
fadeScreenUp();
hangOn(160);
playChannel0(12, 0);
@@ -2822,12 +2886,12 @@ void DreamWebEngine::setupTimedUse(uint16 textIndex, uint16 countToTimed, uint16
if (_timeCount != 0)
return; // can't setup
- _timedY = y;
- _timedX = x;
- _countToTimed = countToTimed;
- _timeCount = timeCount + countToTimed;
- _timedString = _puzzleText.getString(textIndex);
- debug(1, "setupTimedUse: %d => '%s'", textIndex, _timedString);
+ _timedTemp._y = y;
+ _timedTemp._x = x;
+ _timedTemp._countToTimed = countToTimed;
+ _timeCount = _timedTemp._timeCount = timeCount + countToTimed;
+ _timedTemp._string = _puzzleText.getString(textIndex);
+ debug(1, "setupTimedUse: %d => '%s'", textIndex, _timedTemp._string);
}
void DreamWebEngine::entryTexts() {
@@ -2940,7 +3004,7 @@ void DreamWebEngine::lookAtCard() {
getRidOfReels();
loadKeypad();
createPanel2();
- showFrame(_tempGraphics, 160, 80, 42, 128);
+ showFrame(_keypadGraphics, 160, 80, 42, 128);
const uint8 *obText = getObTextStart();
findNextColon(&obText);
findNextColon(&obText);
@@ -2950,12 +3014,12 @@ void DreamWebEngine::lookAtCard() {
workToScreenM();
hangOnW(280);
createPanel2();
- showFrame(_tempGraphics, 160, 80, 42, 128);
+ showFrame(_keypadGraphics, 160, 80, 42, 128);
printDirect(obText, 36, 130, 241, 241 & 1);
workToScreenM();
hangOnW(200);
_manIsOffScreen = 0;
- getRidOfTemp();
+ _keypadGraphics.clear();
restoreReels();
putBackObStuff();
}
diff --git a/engines/dreamweb/titles.cpp b/engines/dreamweb/titles.cpp
index aa0f3bd799..f4112f71f6 100644
--- a/engines/dreamweb/titles.cpp
+++ b/engines/dreamweb/titles.cpp
@@ -40,9 +40,10 @@ void DreamWebEngine::endGame() {
void DreamWebEngine::monkSpeaking() {
_roomsSample = 35;
loadRoomsSample();
- loadIntoTemp("DREAMWEB.G15");
+ GraphicsFile graphics;
+ loadGraphicsFile(graphics, "DREAMWEB.G15");
clearWork();
- showFrame(_tempGraphics, 160, 72, 0, 128); // show monk
+ showFrame(graphics, 160, 72, 0, 128); // show monk
workToScreen();
_volume = 7;
_volumeDirection = -1;
@@ -51,8 +52,9 @@ void DreamWebEngine::monkSpeaking() {
fadeScreenUps();
hangOn(300);
+ // TODO: Subtitles+speech mode
if (hasSpeech()) {
- for (int i = 40; i <= 48; i++) {
+ for (int i = 40; i < 48; i++) {
loadSpeech('T', 83, 'T', i);
playChannel1(50 + 12);
@@ -73,7 +75,7 @@ void DreamWebEngine::monkSpeaking() {
printResult = printDirect(&string, 36, &y, 239, 239 & 1);
workToScreen();
clearWork();
- showFrame(_tempGraphics, 160, 72, 0, 128); // show monk
+ showFrame(graphics, 160, 72, 0, 128); // show monk
hangOnP(240);
if (_quitRequested)
return;
@@ -85,7 +87,7 @@ void DreamWebEngine::monkSpeaking() {
_volumeTo = 7;
fadeScreenDowns();
hangOn(300);
- getRidOfTemp();
+ graphics.clear();
}
void DreamWebEngine::gettingShot() {
diff --git a/engines/dreamweb/use.cpp b/engines/dreamweb/use.cpp
index fc0398c7b9..e59843539f 100644
--- a/engines/dreamweb/use.cpp
+++ b/engines/dreamweb/use.cpp
@@ -1501,7 +1501,7 @@ void DreamWebEngine::useCashCard() {
showExit();
showMan();
uint16 y = (!_foreignRelease) ? 120 : 120 - 3;
- showFrame(_tempGraphics, 114, y, 39, 0);
+ showFrame(_keypadGraphics, 114, y, 39, 0);
const uint8 *obText = getObTextStart();
findNextColon(&obText);
findNextColon(&obText);
@@ -1517,7 +1517,7 @@ void DreamWebEngine::useCashCard() {
_charShift = 0;
workToScreenM();
hangOnP(400);
- getRidOfTemp();
+ _keypadGraphics.clear();
restoreReels();
putBackObStuff();
}
diff --git a/engines/dreamweb/vgagrafx.cpp b/engines/dreamweb/vgagrafx.cpp
index 1e93c0f2fe..26b5e60b9d 100644
--- a/engines/dreamweb/vgagrafx.cpp
+++ b/engines/dreamweb/vgagrafx.cpp
@@ -71,10 +71,6 @@ void DreamWebEngine::workToScreen() {
blit(workspace(), 320, 0, 0, 320, 200);
}
-void DreamWebEngine::printUnderMon() {
- printUnderMonitor();
-}
-
void DreamWebEngine::frameOutNm(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, uint16 x, uint16 y) {
dst += pitch * y + x;
diff --git a/engines/engine.cpp b/engines/engine.cpp
index 4811ba6917..2ef4ecab60 100644
--- a/engines/engine.cpp
+++ b/engines/engine.cpp
@@ -420,12 +420,16 @@ void Engine::openMainMenuDialog() {
// (not from inside the menu loop to avoid
// mouse cursor glitches and simliar bugs,
// e.g. #2822778).
- // FIXME: For now we just ignore the return
- // value, which is quite bad since it could
- // be a fatal loading error, which renders
- // the engine unusable.
- if (_saveSlotToLoad >= 0)
- loadGameState(_saveSlotToLoad);
+ if (_saveSlotToLoad >= 0) {
+ Common::Error status = loadGameState(_saveSlotToLoad);
+ if (status.getCode() != Common::kNoError) {
+ Common::String failMessage = Common::String::format(_("Gamestate load failed (%s)! "
+ "Please consult the README for basic information, and for "
+ "instructions on how to obtain further assistance."), status.getDesc().c_str());
+ GUI::MessageDialog dialog(failMessage);
+ dialog.runModal();
+ }
+ }
syncSoundSettings();
}
diff --git a/engines/gob/aniobject.cpp b/engines/gob/aniobject.cpp
index a01fe43672..0ca850d1fb 100644
--- a/engines/gob/aniobject.cpp
+++ b/engines/gob/aniobject.cpp
@@ -111,6 +111,36 @@ void ANIObject::getFrameSize(int16 &width, int16 &height) const {
height = animation.frameAreas[_frame].bottom - animation.frameAreas[_frame].top + 1;
}
+bool ANIObject::isIn(int16 x, int16 y) const {
+ if (!isVisible())
+ return false;
+
+ int16 frameX, frameY, frameWidth, frameHeight;
+ getFramePosition(frameX, frameY);
+ getFrameSize(frameWidth, frameHeight);
+
+ if ((x < frameX) || (y < frameY))
+ return false;
+ if ((x > (frameX + frameWidth)) || (y > (frameY + frameHeight)))
+ return false;
+
+ return true;
+}
+
+bool ANIObject::isIn(const ANIObject &obj) const {
+ if (!isVisible() || !obj.isVisible())
+ return false;
+
+ int16 frameX, frameY, frameWidth, frameHeight;
+ getFramePosition(frameX, frameY);
+ getFrameSize(frameWidth, frameHeight);
+
+ return obj.isIn(frameX , frameY ) ||
+ obj.isIn(frameX + frameWidth - 1, frameY ) ||
+ obj.isIn(frameX , frameY + frameHeight - 1) ||
+ obj.isIn(frameX + frameWidth - 1, frameY + frameHeight - 1);
+}
+
void ANIObject::draw(Surface &dest, int16 &left, int16 &top,
int16 &right, int16 &bottom) {
diff --git a/engines/gob/aniobject.h b/engines/gob/aniobject.h
index 28103007a6..e3fe301400 100644
--- a/engines/gob/aniobject.h
+++ b/engines/gob/aniobject.h
@@ -69,6 +69,11 @@ public:
/** Return the current frame size. */
void getFrameSize(int16 &width, int16 &height) const;
+ /** Are there coordinates within the animation sprite? */
+ bool isIn(int16 x, int16 y) const;
+ /** Is this object within the animation sprite? */
+ bool isIn(const ANIObject &obj) const;
+
/** Set the animation number. */
void setAnimation(uint16 animation);
diff --git a/engines/gob/cheater.cpp b/engines/gob/cheater.cpp
new file mode 100644
index 0000000000..5c1f555389
--- /dev/null
+++ b/engines/gob/cheater.cpp
@@ -0,0 +1,34 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * 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.
+ *
+ */
+
+#include "gob/gob.h"
+#include "gob/cheater.h"
+
+namespace Gob {
+
+Cheater::Cheater(GobEngine *vm) : _vm(vm) {
+}
+
+Cheater::~Cheater() {
+}
+
+} // End of namespace Gob
diff --git a/engines/gob/cheater.h b/engines/gob/cheater.h
new file mode 100644
index 0000000000..334a5e88eb
--- /dev/null
+++ b/engines/gob/cheater.h
@@ -0,0 +1,62 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * 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.
+ *
+ */
+
+#ifndef GOB_CHEATER_H
+#define GOB_CHEATER_H
+
+namespace GUI {
+ class Debugger;
+}
+
+namespace Gob {
+
+namespace Geisha {
+ class Diving;
+}
+
+class GobEngine;
+
+class Cheater {
+public:
+ Cheater(GobEngine *vm);
+ virtual ~Cheater();
+
+ virtual bool cheat(GUI::Debugger &console) = 0;
+
+protected:
+ GobEngine *_vm;
+};
+
+class Cheater_Geisha : public Cheater {
+public:
+ Cheater_Geisha(GobEngine *vm, Geisha::Diving *diving);
+ ~Cheater_Geisha();
+
+ bool cheat(GUI::Debugger &console);
+
+private:
+ Geisha::Diving *_diving;
+};
+
+} // End of namespace Gob
+
+#endif // GOB_CHEATER_H
diff --git a/engines/gob/cheater_geisha.cpp b/engines/gob/cheater_geisha.cpp
new file mode 100644
index 0000000000..3d8c56707d
--- /dev/null
+++ b/engines/gob/cheater_geisha.cpp
@@ -0,0 +1,66 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * 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.
+ *
+ */
+
+#include "gui/debugger.h"
+
+#include "gob/gob.h"
+#include "gob/cheater.h"
+#include "gob/inter.h"
+
+#include "gob/minigames/geisha/diving.h"
+
+namespace Gob {
+
+Cheater_Geisha::Cheater_Geisha(GobEngine *vm, Geisha::Diving *diving) :
+ Cheater(vm), _diving(diving) {
+
+}
+
+Cheater_Geisha::~Cheater_Geisha() {
+}
+
+bool Cheater_Geisha::cheat(GUI::Debugger &console) {
+ // A cheat to get around the Diving minigame
+ if (_diving->isPlaying()) {
+ _diving->cheatWin();
+ return false;
+ }
+
+ // A cheat to get around the mastermind puzzle
+ if (_vm->isCurrentTot("hard.tot") && _vm->_inter->_variables) {
+ uint32 digit1 = READ_VARO_UINT32(0x768);
+ uint32 digit2 = READ_VARO_UINT32(0x76C);
+ uint32 digit3 = READ_VARO_UINT32(0x770);
+ uint32 digit4 = READ_VARO_UINT32(0x774);
+ uint32 digit5 = READ_VARO_UINT32(0x778);
+
+ if (digit1 && digit2 && digit3 && digit4 && digit5)
+ console.DebugPrintf("Mastermind solution: %d %d %d %d %d\n",
+ digit1, digit2, digit3, digit4, digit5);
+
+ return true;
+ }
+
+ return true;
+}
+
+} // End of namespace Gob
diff --git a/engines/gob/console.cpp b/engines/gob/console.cpp
index e7296fb81b..76ccb70dca 100644
--- a/engines/gob/console.cpp
+++ b/engines/gob/console.cpp
@@ -24,22 +24,32 @@
#include "gob/gob.h"
#include "gob/inter.h"
#include "gob/dataio.h"
+#include "gob/cheater.h"
namespace Gob {
-GobConsole::GobConsole(GobEngine *vm) : GUI::Debugger(), _vm(vm) {
+GobConsole::GobConsole(GobEngine *vm) : GUI::Debugger(), _vm(vm), _cheater(0) {
DCmd_Register("varSize", WRAP_METHOD(GobConsole, cmd_varSize));
DCmd_Register("dumpVars", WRAP_METHOD(GobConsole, cmd_dumpVars));
DCmd_Register("var8", WRAP_METHOD(GobConsole, cmd_var8));
DCmd_Register("var16", WRAP_METHOD(GobConsole, cmd_var16));
DCmd_Register("var32", WRAP_METHOD(GobConsole, cmd_var32));
DCmd_Register("varString", WRAP_METHOD(GobConsole, cmd_varString));
+ DCmd_Register("cheat", WRAP_METHOD(GobConsole, cmd_cheat));
DCmd_Register("listArchives", WRAP_METHOD(GobConsole, cmd_listArchives));
}
GobConsole::~GobConsole() {
}
+void GobConsole::registerCheater(Cheater *cheater) {
+ _cheater = cheater;
+}
+
+void GobConsole::unregisterCheater() {
+ _cheater = 0;
+}
+
bool GobConsole::cmd_varSize(int argc, const char **argv) {
DebugPrintf("Size of the variable space: %d bytes\n", _vm->_inter->_variables->getSize());
return true;
@@ -155,6 +165,13 @@ bool GobConsole::cmd_varString(int argc, const char **argv) {
return true;
}
+bool GobConsole::cmd_cheat(int argc, const char **argv) {
+ if (_cheater)
+ return _cheater->cheat(*this);
+
+ return true;
+}
+
bool GobConsole::cmd_listArchives(int argc, const char **argv) {
Common::Array<ArchiveInfo> info;
diff --git a/engines/gob/console.h b/engines/gob/console.h
index b9c3f5ed70..5b6f0255dd 100644
--- a/engines/gob/console.h
+++ b/engines/gob/console.h
@@ -28,15 +28,21 @@
namespace Gob {
class GobEngine;
+class Cheater;
class GobConsole : public GUI::Debugger {
public:
GobConsole(GobEngine *vm);
virtual ~GobConsole(void);
+ void registerCheater(Cheater *cheater);
+ void unregisterCheater();
+
private:
GobEngine *_vm;
+ Cheater *_cheater;
+
bool cmd_varSize(int argc, const char **argv);
bool cmd_dumpVars(int argc, const char **argv);
bool cmd_var8(int argc, const char **argv);
@@ -44,6 +50,8 @@ private:
bool cmd_var32(int argc, const char **argv);
bool cmd_varString(int argc, const char **argv);
+ bool cmd_cheat(int argc, const char **argv);
+
bool cmd_listArchives(int argc, const char **argv);
};
diff --git a/engines/gob/gob.cpp b/engines/gob/gob.cpp
index 51a117b7ec..4e7aa467b5 100644
--- a/engines/gob/gob.cpp
+++ b/engines/gob/gob.cpp
@@ -147,9 +147,9 @@ GobEngine::GobEngine(OSystem *syst) : Engine(syst), _rnd("gob") {
}
GobEngine::~GobEngine() {
- delete _console;
-
deinitGameParts();
+
+ delete _console;
}
const char *GobEngine::getLangDesc(int16 language) const {
diff --git a/engines/gob/gob.h b/engines/gob/gob.h
index 74c882e021..ea2323807a 100644
--- a/engines/gob/gob.h
+++ b/engines/gob/gob.h
@@ -160,7 +160,6 @@ private:
GameType _gameType;
int32 _features;
Common::Platform _platform;
- GobConsole *_console;
uint32 _pauseStart;
@@ -194,6 +193,8 @@ public:
bool _copyProtection;
bool _noMusic;
+ GobConsole *_console;
+
Global *_global;
Util *_util;
DataIO *_dataIO;
diff --git a/engines/gob/hotspots.cpp b/engines/gob/hotspots.cpp
index 5e0af847de..9a89f11923 100644
--- a/engines/gob/hotspots.cpp
+++ b/engines/gob/hotspots.cpp
@@ -477,7 +477,7 @@ void Hotspots::call(uint16 offset) {
_shouldPush = true;
- int16 stackSize = _stack.size();
+ Common::Stack<StackEntry>::size_type stackSize = _stack.size();
_vm->_inter->funcBlock(0);
diff --git a/engines/gob/inter.h b/engines/gob/inter.h
index 6fd4dc2187..c79b6e2260 100644
--- a/engines/gob/inter.h
+++ b/engines/gob/inter.h
@@ -33,6 +33,8 @@
namespace Gob {
+class Cheater_Geisha;
+
namespace Geisha {
class Diving;
class Penetration;
@@ -371,6 +373,8 @@ protected:
private:
Geisha::Diving *_diving;
Geisha::Penetration *_penetration;
+
+ Cheater_Geisha *_cheater;
};
class Inter_v2 : public Inter_v1 {
diff --git a/engines/gob/inter_geisha.cpp b/engines/gob/inter_geisha.cpp
index c5b91a484b..7f21ceb91d 100644
--- a/engines/gob/inter_geisha.cpp
+++ b/engines/gob/inter_geisha.cpp
@@ -34,6 +34,7 @@
#include "gob/game.h"
#include "gob/draw.h"
#include "gob/video.h"
+#include "gob/cheater.h"
#include "gob/save/saveload.h"
#include "gob/sound/sound.h"
#include "gob/sound/sounddesc.h"
@@ -53,9 +54,17 @@ Inter_Geisha::Inter_Geisha(GobEngine *vm) : Inter_v1(vm),
_diving = new Geisha::Diving(vm);
_penetration = new Geisha::Penetration(vm);
+
+ _cheater = new Cheater_Geisha(vm, _diving);
+
+ _vm->_console->registerCheater(_cheater);
}
Inter_Geisha::~Inter_Geisha() {
+ _vm->_console->unregisterCheater();
+
+ delete _cheater;
+
delete _penetration;
delete _diving;
}
@@ -280,7 +289,7 @@ void Inter_Geisha::oGeisha_gameDiving(OpGobParams &params) {
bool result = _diving->play(playerCount, hasPearlLocation);
- WRITE_VAR_UINT32(resultVar, result ? 1 : 0);
+ WRITE_VAR_UINT32(resultVar, result ? 0 : 1);
}
void Inter_Geisha::oGeisha_loadTitleMusic(OpGobParams &params) {
diff --git a/engines/gob/inter_v1.cpp b/engines/gob/inter_v1.cpp
index 2d3f2ad731..9aa190a456 100644
--- a/engines/gob/inter_v1.cpp
+++ b/engines/gob/inter_v1.cpp
@@ -658,20 +658,6 @@ void Inter_v1::o1_callSub(OpFuncParams &params) {
return;
}
- // A cheat to get around the stupid mastermind puzzle in Geisha,
- // while we're still testing it
- if ((_vm->getGameType() == kGameTypeGeisha) && (offset == 12934) &&
- _vm->isCurrentTot("hard.tot") && _vm->_inter->_variables) {
-
- uint32 digit1 = READ_VARO_UINT32(0x768);
- uint32 digit2 = READ_VARO_UINT32(0x76C);
- uint32 digit3 = READ_VARO_UINT32(0x770);
- uint32 digit4 = READ_VARO_UINT32(0x774);
- uint32 digit5 = READ_VARO_UINT32(0x778);
-
- warning("Mastermind solution: %d %d %d %d %d", digit1, digit2, digit3, digit4, digit5);
- }
-
// Skipping the copy protection screen in Gobliiins
if (!_vm->_copyProtection && (_vm->getGameType() == kGameTypeGob1) && (offset == 3905) &&
_vm->isCurrentTot(_vm->_startTot)) {
diff --git a/engines/gob/minigames/geisha/diving.cpp b/engines/gob/minigames/geisha/diving.cpp
index e3bc69a503..6f4c6e168a 100644
--- a/engines/gob/minigames/geisha/diving.cpp
+++ b/engines/gob/minigames/geisha/diving.cpp
@@ -23,6 +23,7 @@
#include "common/list.h"
#include "gob/global.h"
+#include "gob/palanim.h"
#include "gob/draw.h"
#include "gob/video.h"
#include "gob/decfile.h"
@@ -31,93 +32,210 @@
#include "gob/sound/sound.h"
#include "gob/minigames/geisha/evilfish.h"
+#include "gob/minigames/geisha/oko.h"
+#include "gob/minigames/geisha/meter.h"
#include "gob/minigames/geisha/diving.h"
namespace Gob {
namespace Geisha {
-static const int kEvilFishTypeCount = 3;
+static const uint8 kAirDecreaseRate = 15;
+
+static const byte kPalette[48] = {
+ 0x00, 0x02, 0x12,
+ 0x01, 0x04, 0x1D,
+ 0x05, 0x08, 0x28,
+ 0x0C, 0x0D, 0x33,
+ 0x15, 0x14, 0x3F,
+ 0x00, 0x3F, 0x00,
+ 0x3F, 0x00, 0x00,
+ 0x00, 0x00, 0x00,
+ 0x21, 0x0D, 0x00,
+ 0x2F, 0x1A, 0x04,
+ 0x3D, 0x2B, 0x0D,
+ 0x10, 0x10, 0x10,
+ 0x1A, 0x1A, 0x1A,
+ 0x24, 0x24, 0x24,
+ 0x00, 0x01, 0x0F,
+ 0x3F, 0x3F, 0x3F
+};
+
+enum Animation {
+ kAnimationLungs = 0,
+ kAnimationHeart = 1,
+ kAnimationPearl = 4,
+ kAnimationJellyfish = 6,
+ kAnimationWater = 7,
+ kAnimationShot = 17,
+ kAnimationSwarmRedGreen = 32,
+ kAnimationSwarmOrange = 33
+};
-static const int kEvilFishTypes[kEvilFishTypeCount][5] = {
+
+const uint16 Diving::kEvilFishTypes[kEvilFishTypeCount][5] = {
{ 0, 14, 8, 9, 3}, // Shark
{15, 1, 12, 13, 3}, // Moray
{16, 2, 10, 11, 3} // Ray
};
+const uint16 Diving::kPlantLevel1[] = { 18, 19, 20, 21 };
+const uint16 Diving::kPlantLevel2[] = { 22, 23, 24, 25 };
+const uint16 Diving::kPlantLevel3[] = { 26, 27, 28, 29, 30 };
+
+const Diving::PlantLevel Diving::kPlantLevels[] = {
+ { 150, ARRAYSIZE(kPlantLevel1), kPlantLevel1 },
+ { 120, ARRAYSIZE(kPlantLevel2), kPlantLevel2 },
+ { 108, ARRAYSIZE(kPlantLevel3), kPlantLevel3 },
+};
+
Diving::Diving(GobEngine *vm) : _vm(vm), _background(0),
- _objects(0), _gui(0), _oko(0), _lungs(0), _heart(0),
- _blackPearl(0), _whitePearlCount(0), _blackPearlCount(0) {
+ _objects(0), _gui(0), _okoAnim(0), _water(0), _lungs(0), _heart(0),
+ _blackPearl(0), _airMeter(0), _healthMeter(0), _isPlaying(false) {
_blackPearl = new Surface(11, 8, 1);
+
+ _airMeter = new Meter(3 , 195, 40, 2, 5, 7, 40, Meter::kFillToLeft);
+ _healthMeter = new Meter(275, 195, 40, 2, 6, 7, 4, Meter::kFillToLeft);
+
+ for (uint i = 0; i < kEvilFishCount; i++)
+ _evilFish[i].evilFish = 0;
+
+ for (uint i = 0; i < kDecorFishCount; i++)
+ _decorFish[i].decorFish = 0;
+
+ for (uint i = 0; i < kPlantCount; i++)
+ _plant[i].plant = 0;
+
+ for (uint i = 0; i < kMaxShotCount; i++)
+ _shot[i] = 0;
+
+ _pearl.pearl = 0;
+
+ _oko = 0;
}
Diving::~Diving() {
+ delete _airMeter;
+ delete _healthMeter;
+
delete _blackPearl;
deinit();
}
bool Diving::play(uint16 playerCount, bool hasPearlLocation) {
+ _hasPearlLocation = hasPearlLocation;
+ _isPlaying = true;
+
+ // Fade to black
+ _vm->_palAnim->fade(0, 0, 0);
+
+ // Initialize our playing field
init();
initScreen();
initCursor();
+ initPlants();
+
+ updateAirMeter();
+ updateAnims();
_vm->_draw->blitInvalidated();
_vm->_video->retrace();
+ // Fade in
+ _vm->_palAnim->fade(_vm->_global->_pPaletteDesc, 0, 0);
+
while (!_vm->shouldQuit()) {
- checkShots();
+ checkShots(); // Check if a shot hit something
+ checkOkoHurt(); // Check if Oko was hurt
+
+ // Is Oko dead?
+ if (_oko->isPaused())
+ break;
+
+ // Update all objects and animations
+ updateAirMeter();
updateEvilFish();
updateDecorFish();
+ updatePlants();
+ updatePearl();
updateAnims();
_vm->_draw->animateCursor(1);
+ // Draw and wait for the end of the frame
_vm->_draw->blitInvalidated();
-
_vm->_util->waitEndFrame();
+
+ // Handle input
_vm->_util->processInput();
int16 mouseX, mouseY;
MouseButtons mouseButtons;
int16 key = checkInput(mouseX, mouseY, mouseButtons);
+
+ // Aborting the game
if (key == kKeyEscape)
break;
+ // Shoot the gun
if (mouseButtons == kMouseButtonsLeft)
shoot(mouseX, mouseY);
+ // Oko
+ handleOko(key);
+
+ // Game end check
if ((_whitePearlCount >= 20) || (_blackPearlCount >= 2))
break;
}
deinit();
+
+ _isPlaying = false;
+
+ // The game succeeded when we got 2 black pearls
return _blackPearlCount >= 2;
}
+bool Diving::isPlaying() const {
+ return _isPlaying;
+}
+
+void Diving::cheatWin() {
+ _blackPearlCount = 2;
+}
+
void Diving::init() {
+ // Load sounds
+ _vm->_sound->sampleLoad(&_soundShoot , SOUND_SND, "tirgim.snd");
+ _vm->_sound->sampleLoad(&_soundBreathe , SOUND_SND, "respir.snd");
+ _vm->_sound->sampleLoad(&_soundWhitePearl, SOUND_SND, "virtou.snd");
+ _vm->_sound->sampleLoad(&_soundBlackPearl, SOUND_SND, "trouve.snd");
+
+ // Load and initialize sprites and animations
_background = new DECFile(_vm, "tperle.dec" , 320, 200);
_objects = new ANIFile(_vm, "tperle.ani" , 320);
_gui = new ANIFile(_vm, "tperlcpt.ani", 320);
- _oko = new ANIFile(_vm, "tplonge.ani" , 320);
+ _okoAnim = new ANIFile(_vm, "tplonge.ani" , 320);
_water = new ANIObject(*_objects);
_lungs = new ANIObject(*_gui);
_heart = new ANIObject(*_gui);
- _water->setAnimation(7);
+ _water->setAnimation(kAnimationWater);
_water->setPosition();
_water->setVisible(true);
- _lungs->setAnimation(0);
+ _lungs->setAnimation(kAnimationLungs);
_lungs->setPosition();
_lungs->setVisible(true);
_lungs->setPause(true);
- _heart->setAnimation(1);
+ _heart->setAnimation(kAnimationHeart);
_heart->setPosition();
_heart->setVisible(true);
_heart->setPause(true);
@@ -135,22 +253,39 @@ void Diving::init() {
_decorFish[i].decorFish = new ANIObject(*_objects);
}
- _decorFish[0].decorFish->setAnimation( 6); // Jellyfish
+ for (uint i = 0; i < kPlantCount; i++) {
+ _plant[i].level = i / kPlantPerLevelCount;
+ _plant[i].deltaX = (kPlantLevelCount - _plant[i].level) * -2;
+
+ _plant[i].x = -1;
+ _plant[i].y = -1;
+
+ _plant[i].plant = new ANIObject(*_objects);
+ }
+
+ _pearl.pearl = new ANIObject(*_objects);
+ _pearl.black = false;
+
+ _pearl.pearl->setAnimation(kAnimationPearl);
+
+ _decorFish[0].decorFish->setAnimation(kAnimationJellyfish);
_decorFish[0].deltaX = 0;
- _decorFish[1].decorFish->setAnimation(32); // Swarm of red/green fish
- _decorFish[1].deltaX = -6;
+ _decorFish[1].decorFish->setAnimation(kAnimationSwarmRedGreen);
+ _decorFish[1].deltaX = -5;
- _decorFish[2].decorFish->setAnimation(33); // Swarm of orange fish
- _decorFish[2].deltaX = -6;
+ _decorFish[2].decorFish->setAnimation(kAnimationSwarmOrange);
+ _decorFish[2].deltaX = -5;
for (uint i = 0; i < kMaxShotCount; i++) {
_shot[i] = new ANIObject(*_objects);
- _shot[i]->setAnimation(17);
+ _shot[i]->setAnimation(kAnimationShot);
_shot[i]->setMode(ANIObject::kModeOnce);
}
+ _oko = new Oko(*_okoAnim, *_vm->_sound, _soundBreathe);
+
Surface tmp(320, 103, 1);
_vm->_video->drawPackedSprite("tperlobj.cmp", tmp);
@@ -161,20 +296,30 @@ void Diving::init() {
_currentShot = 0;
+ // Add the animations to our animation list
_anims.push_back(_water);
for (uint i = 0; i < kMaxShotCount; i++)
_anims.push_back(_shot[i]);
+ _anims.push_back(_pearl.pearl);
for (uint i = 0; i < kDecorFishCount; i++)
_anims.push_back(_decorFish[i].decorFish);
for (uint i = 0; i < kEvilFishCount; i++)
_anims.push_back(_evilFish[i].evilFish);
+ for (int i = kPlantCount - 1; i >= 0; i--)
+ _anims.push_back(_plant[i].plant);
+ _anims.push_back(_oko);
_anims.push_back(_lungs);
_anims.push_back(_heart);
- _vm->_sound->sampleLoad(&_soundShoot , SOUND_SND, "tirgim.snd");
- _vm->_sound->sampleLoad(&_soundBreathe , SOUND_SND, "respir.snd");
- _vm->_sound->sampleLoad(&_soundWhitePearl, SOUND_SND, "virtou.snd");
- _vm->_sound->sampleLoad(&_soundBlackPearl, SOUND_SND, "trouve.snd");
+ // Air and health meter
+ _airMeter->setMaxValue();
+ _healthMeter->setMaxValue();
+
+ _airCycle = 0;
+ _hurtGracePeriod = 0;
+
+ _whitePearlCount = 0;
+ _blackPearlCount = 0;
}
void Diving::deinit() {
@@ -208,11 +353,23 @@ void Diving::deinit() {
_decorFish[i].decorFish = 0;
}
+ for (uint i = 0; i < kPlantCount; i++) {
+ delete _plant[i].plant;
+
+ _plant[i].plant = 0;
+ }
+
+ delete _pearl.pearl;
+ _pearl.pearl = 0;
+
+ delete _oko;
+ _oko = 0;
+
delete _heart;
delete _lungs;
delete _water;
- delete _oko;
+ delete _okoAnim;
delete _gui;
delete _objects;
delete _background;
@@ -221,24 +378,30 @@ void Diving::deinit() {
_heart = 0;
_lungs = 0;
- _oko = 0;
+ _okoAnim = 0;
_gui = 0;
_objects = 0;
_background = 0;
}
void Diving::initScreen() {
+ // Set framerate
_vm->_util->setFrameRate(15);
- _vm->_video->setFullPalette(_vm->_global->_pPaletteDesc);
+ // Set palette
+ memcpy(_vm->_draw->_vgaPalette , kPalette, sizeof(kPalette));
+ memcpy(_vm->_draw->_vgaSmallPalette, kPalette, sizeof(kPalette));
+ // Draw background decal
_vm->_draw->_backSurface->clear();
_background->draw(*_vm->_draw->_backSurface);
+ // Draw heart and lung boxes
int16 left, top, right, bottom;
_lungs->draw(*_vm->_draw->_backSurface, left, top, right, bottom);
_heart->draw(*_vm->_draw->_backSurface, left, top, right, bottom);
+ // Mark everything as dirty
_vm->_draw->dirtiedRect(_vm->_draw->_backSurface, 0, 0, 319, 199);
}
@@ -259,6 +422,89 @@ void Diving::initCursor() {
_vm->_draw->_cursorHotspotY = 8;
}
+
+void Diving::initPlants() {
+ // Create initial plantlife
+ for (uint i = 0; i < kPlantLevelCount; i++) {
+ for (uint j = 0; j < kPlantPerLevelCount; j++) {
+ int16 prevPlantX = -100;
+ if (j > 0)
+ prevPlantX = _plant[i * kPlantPerLevelCount + j - 1].x;
+
+ enterPlant(_plant[i * kPlantPerLevelCount + j], prevPlantX);
+ }
+ }
+}
+
+void Diving::enterPlant(ManagedPlant &plant, int16 prevPlantX) {
+ // Create a new plant outside the borders of the screen to scroll in
+
+ const PlantLevel &level = kPlantLevels[plant.level];
+ const uint anim = level.plants[_vm->_util->getRandom(kPlantLevels[plant.level].plantCount)];
+
+ plant.plant->setAnimation(anim);
+ plant.plant->rewind();
+
+ int16 width, height;
+ plant.plant->getFrameSize(width, height);
+
+ // The new plant is created 140 - 160 pixels to the right of the right-most plant
+ plant.x = prevPlantX + 150 - 10 + _vm->_util->getRandom(21);
+ plant.y = kPlantLevels[plant.level].y - height;
+
+ plant.plant->setPosition(plant.x, plant.y);
+ plant.plant->setVisible(true);
+ plant.plant->setPause(false);
+
+ // If the plant is outside of the screen, create a pearl too if necessary
+ if (plant.x > 320)
+ enterPearl(plant.x);
+}
+
+void Diving::enterPearl(int16 x) {
+ // Create a pearl outside the borders of the screen to scroll in
+
+ // Only one pearl is ever visible
+ if (_pearl.pearl->isVisible())
+ return;
+
+ // Only every 4th potential pearl position has a pearl
+ if (_vm->_util->getRandom(4) != 0)
+ return;
+
+ // Every 5th pearl is a black one, but only if the location is correct
+ _pearl.black = _hasPearlLocation && (_vm->_util->getRandom(5) == 0);
+
+ // Set the pearl about in the middle of two bottom-level plants
+ _pearl.pearl->setPosition(x + 80, 130);
+
+ _pearl.pearl->setVisible(true);
+ _pearl.pearl->setPause(false);
+ _pearl.picked = false;
+}
+
+void Diving::updateAirMeter() {
+ if (_oko->isBreathing()) {
+ // If Oko is breathing, increase the air meter and play the lungs animation
+ _airCycle = 0;
+ _airMeter->increase();
+ _lungs->setPause(false);
+ return;
+ } else
+ // Otherwise, don't play the lungs animation
+ _lungs->setPause(true);
+
+ // Update the air cycle and decrease the air meter when the cycle ended
+ _airCycle = (_airCycle + 1) % kAirDecreaseRate;
+
+ if (_airCycle == 0)
+ _airMeter->decrease();
+
+ // Without any air, Oko dies
+ if (_airMeter->getValue() == 0)
+ _oko->die();
+}
+
void Diving::updateEvilFish() {
for (uint i = 0; i < kEvilFishCount; i++) {
ManagedEvilFish &fish = _evilFish[i];
@@ -283,6 +529,7 @@ void Diving::updateEvilFish() {
fish.enterAt = _vm->_util->getTimeKey() + 2000 + _vm->_util->getRandom(8000);
if (_vm->_util->getTimeKey() >= fish.enterAt) {
+ // The new fish has a random type
int fishType = _vm->_util->getRandom(kEvilFishTypeCount);
fish.evilFish->mutate(kEvilFishTypes[fishType][0], kEvilFishTypes[fishType][1],
kEvilFishTypes[fishType][2], kEvilFishTypes[fishType][3],
@@ -333,9 +580,100 @@ void Diving::updateDecorFish() {
}
}
+void Diving::updatePlants() {
+ // When Oko isn't moving, the plants don't continue to scroll by
+ if (!_oko->isMoving())
+ return;
+
+ for (uint i = 0; i < kPlantCount; i++) {
+ ManagedPlant &plant = _plant[i];
+
+ if (plant.plant->isVisible()) {
+ // Move the plant
+ plant.plant->setPosition(plant.x += plant.deltaX, plant.y);
+
+ // Check if the plant has left the screen
+ int16 x, y, width, height;
+ plant.plant->getFramePosition(x, y);
+ plant.plant->getFrameSize(width, height);
+
+ if ((x + width) <= 0) {
+ plant.plant->setVisible(false);
+ plant.plant->setPause(true);
+
+ plant.x = 0;
+ }
+
+ } else {
+ // Find the right-most plant in this level and enter the plant to the right of it
+
+ int16 rightX = 320;
+ for (uint j = 0; j < kPlantPerLevelCount; j++)
+ rightX = MAX(rightX, _plant[plant.level * kPlantPerLevelCount + j].x);
+
+ enterPlant(plant, rightX);
+ }
+ }
+}
+
+void Diving::updatePearl() {
+ if (!_pearl.pearl->isVisible())
+ return;
+
+ // When Oko isn't moving, the pearl doesn't continue to scroll by
+ if (!_oko->isMoving())
+ return;
+
+ // Picking the pearl
+ if (_pearl.picked && (_oko->getState() == Oko::kStatePick) && (_oko->getFrame() == 8)) {
+ // Remove the pearl
+ _pearl.pearl->setVisible(false);
+ _pearl.pearl->setPause(true);
+
+ // Add the pearl to our found pearls repository
+ if (_pearl.black)
+ foundBlackPearl();
+ else
+ foundWhitePearl();
+
+ return;
+ }
+
+ // Move the pearl
+ int16 x, y, width, height;
+ _pearl.pearl->getPosition(x, y);
+ _pearl.pearl->setPosition(x - 5, y);
+
+ // Check if the pearl has left the screen
+ _pearl.pearl->getFramePosition(x, y);
+ _pearl.pearl->getFrameSize(width, height);
+
+ if ((x + width) <= 0) {
+ _pearl.pearl->setVisible(false);
+ _pearl.pearl->setPause(true);
+ }
+}
+
+void Diving::getPearl() {
+ if (!_pearl.pearl->isVisible())
+ return;
+
+ // Make sure the pearl is within Oko's grasp
+
+ int16 x, y, width, height;
+ _pearl.pearl->getFramePosition(x, y);
+ _pearl.pearl->getFrameSize(width, height);
+
+ if ((x > 190) || ((x + width) < 140))
+ return;
+
+ _pearl.picked = true;
+}
+
void Diving::foundBlackPearl() {
_blackPearlCount++;
+ // Put the black pearl drawing into the black pearl box
if (_blackPearlCount == 1) {
_vm->_draw->_backSurface->blit(*_blackPearl, 0, 0, 10, 7, 147, 179, 0);
_vm->_draw->dirtiedRect(_vm->_draw->_backSurface, 147, 179, 157, 186);
@@ -343,17 +681,22 @@ void Diving::foundBlackPearl() {
_vm->_draw->_backSurface->blit(*_blackPearl, 0, 0, 10, 7, 160, 179, 0);
_vm->_draw->dirtiedRect(_vm->_draw->_backSurface, 147, 179, 160, 186);
}
+
+ _vm->_sound->blasterPlay(&_soundBlackPearl, 1, 0);
}
void Diving::foundWhitePearl() {
_whitePearlCount++;
+ // Put the white pearl drawing into the white pearl box
int16 x = 54 + (_whitePearlCount - 1) * 8;
if (_whitePearlCount > 10)
x += 48;
_background->drawLayer(*_vm->_draw->_backSurface, 0, 2, x, 177, 0);
_vm->_draw->dirtiedRect(_vm->_draw->_backSurface, x, 177, x + 3, 180);
+
+ _vm->_sound->blasterPlay(&_soundWhitePearl, 1, 0);
}
void Diving::updateAnims() {
@@ -376,6 +719,13 @@ void Diving::updateAnims() {
(*a)->advance();
}
+
+ // Draw the meters
+ _airMeter->draw(*_vm->_draw->_backSurface, left, top, right, bottom);
+ _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, left, top, right, bottom);
+
+ _healthMeter->draw(*_vm->_draw->_backSurface, left, top, right, bottom);
+ _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, left, top, right, bottom);
}
int16 Diving::checkInput(int16 &mouseX, int16 &mouseY, MouseButtons &mouseButtons) {
@@ -410,6 +760,7 @@ void Diving::shoot(int16 mouseX, int16 mouseY) {
void Diving::checkShots() {
Common::List<int>::iterator activeShot = _activeShots.begin();
+ // Check if we hit something with our shots
while (activeShot != _activeShots.end()) {
ANIObject &shot = *_shot[*activeShot];
@@ -418,6 +769,7 @@ void Diving::checkShots() {
shot.getPosition(x, y);
+ // When we hit an evil fish, it dies
for (uint i = 0; i < kEvilFishCount; i++) {
EvilFish &evilFish = *_evilFish[i].evilFish;
@@ -434,6 +786,48 @@ void Diving::checkShots() {
}
}
+void Diving::handleOko(int16 key) {
+ if (key == kKeyDown) {
+ // Oko sinks down a level or picks up a pearl if already at the bottom
+ _oko->sink();
+
+ if ((_oko->getState() == Oko::kStatePick) && (_oko->getFrame() == 0))
+ getPearl();
+
+ } else if (key == kKeyUp)
+ // Oko raises up a level or surfaces to breathe if already at the top
+ _oko->raise();
+}
+
+void Diving::checkOkoHurt() {
+ if (_oko->getState() != Oko::kStateSwim)
+ return;
+
+ // Give Oko a grace period after being hurt
+ if (_hurtGracePeriod > 0) {
+ _hurtGracePeriod--;
+ return;
+ }
+
+ // Check for a fish/Oko-collision
+ for (uint i = 0; i < kEvilFishCount; i++) {
+ EvilFish &evilFish = *_evilFish[i].evilFish;
+
+ if (!evilFish.isDead() && evilFish.isIn(*_oko)) {
+ _healthMeter->decrease();
+
+ // If the health reached 0, Oko dies. Otherwise, she gets hurt
+ if (_healthMeter->getValue() == 0)
+ _oko->die();
+ else
+ _oko->hurt();
+
+ _hurtGracePeriod = 10;
+ break;
+ }
+ }
+}
+
} // End of namespace Geisha
} // End of namespace Gob
diff --git a/engines/gob/minigames/geisha/diving.h b/engines/gob/minigames/geisha/diving.h
index e386d783d7..089d60b260 100644
--- a/engines/gob/minigames/geisha/diving.h
+++ b/engines/gob/minigames/geisha/diving.h
@@ -40,6 +40,8 @@ class ANIObject;
namespace Geisha {
class EvilFish;
+class Oko;
+class Meter;
/** Geisha's "Diving" minigame. */
class Diving {
@@ -49,11 +51,34 @@ public:
bool play(uint16 playerCount, bool hasPearlLocation);
+ bool isPlaying() const;
+ void cheatWin();
+
private:
static const uint kEvilFishCount = 3;
static const uint kDecorFishCount = 3;
static const uint kMaxShotCount = 10;
+ static const uint kEvilFishTypeCount = 3;
+ static const uint16 kEvilFishTypes[kEvilFishTypeCount][5];
+
+ struct PlantLevel {
+ int16 y;
+ uint plantCount;
+ const uint16 *plants;
+ };
+
+ static const uint kPlantLevelCount = 3;
+ static const uint kPlantPerLevelCount = 5;
+
+ static const uint16 kPlantLevel1[];
+ static const uint16 kPlantLevel2[];
+ static const uint16 kPlantLevel3[];
+
+ static const PlantLevel kPlantLevels[kPlantLevelCount];
+
+ static const uint kPlantCount = kPlantLevelCount * kPlantPerLevelCount;
+
struct ManagedEvilFish {
EvilFish *evilFish;
@@ -68,12 +93,27 @@ private:
int8 deltaX;
};
+ struct ManagedPlant {
+ ANIObject *plant;
+
+ uint level;
+ int8 deltaX;
+ int16 x, y;
+ };
+
+ struct ManagedPearl {
+ ANIObject *pearl;
+
+ bool picked;
+ bool black;
+ };
+
GobEngine *_vm;
DECFile *_background;
ANIFile *_objects;
ANIFile *_gui;
- ANIFile *_oko;
+ ANIFile *_okoAnim;
ANIObject *_water;
ANIObject *_lungs;
@@ -81,6 +121,10 @@ private:
ManagedEvilFish _evilFish[kEvilFishCount];
ManagedDecorFish _decorFish[kDecorFishCount];
+ ManagedPlant _plant[kPlantCount];
+ ManagedPearl _pearl;
+
+ Oko *_oko;
ANIObject *_shot[kMaxShotCount];
@@ -93,6 +137,12 @@ private:
uint8 _whitePearlCount;
uint8 _blackPearlCount;
+ Meter *_airMeter;
+ Meter *_healthMeter;
+
+ uint8 _airCycle;
+ uint8 _hurtGracePeriod;
+
uint8 _currentShot;
SoundDesc _soundShoot;
@@ -100,24 +150,40 @@ private:
SoundDesc _soundWhitePearl;
SoundDesc _soundBlackPearl;
+ bool _hasPearlLocation;
+ bool _isPlaying;
+
void init();
void deinit();
void initScreen();
void initCursor();
+ void initPlants();
+
+ void enterPlant(ManagedPlant &plant, int16 prevPlantX);
+ void enterPearl(int16 x);
+
+ void getPearl();
void foundBlackPearl();
void foundWhitePearl();
+ void updateAirMeter();
void updateEvilFish();
void updateDecorFish();
+ void updatePlants();
+ void updatePearl();
void updateAnims();
int16 checkInput(int16 &mouseX, int16 &mouseY, MouseButtons &mouseButtons);
void shoot(int16 mouseX, int16 mouseY);
void checkShots();
+
+ void handleOko(int16 key);
+
+ void checkOkoHurt();
};
} // End of namespace Geisha
diff --git a/engines/gob/minigames/geisha/evilfish.cpp b/engines/gob/minigames/geisha/evilfish.cpp
index e9503f4aed..c7ef9d5622 100644
--- a/engines/gob/minigames/geisha/evilfish.cpp
+++ b/engines/gob/minigames/geisha/evilfish.cpp
@@ -39,19 +39,6 @@ EvilFish::EvilFish(const ANIFile &ani, uint16 screenWidth,
EvilFish::~EvilFish() {
}
-bool EvilFish::isIn(int16 x, int16 y) const {
- int16 frameX, frameY, frameWidth, frameHeight;
- getFramePosition(frameX, frameY);
- getFrameSize(frameWidth, frameHeight);
-
- if ((x < frameX) || (y < frameY))
- return false;
- if ((x > (frameX + frameWidth)) || (y > (frameY + frameHeight)))
- return false;
-
- return true;
-}
-
void EvilFish::enter(Direction from, int16 y) {
_shouldLeave = false;
@@ -184,6 +171,10 @@ void EvilFish::mutate(uint16 animSwimLeft, uint16 animSwimRight,
}
}
+bool EvilFish::isDead() {
+ return !isVisible() || (_state == kStateNone) || (_state == kStateDie);
+}
+
} // End of namespace Geisha
} // End of namespace Gob
diff --git a/engines/gob/minigames/geisha/evilfish.h b/engines/gob/minigames/geisha/evilfish.h
index 223645f47f..81efb676e2 100644
--- a/engines/gob/minigames/geisha/evilfish.h
+++ b/engines/gob/minigames/geisha/evilfish.h
@@ -42,9 +42,6 @@ public:
uint16 animTurnLeft, uint16 animTurnRight, uint16 animDie);
~EvilFish();
- /** Are there coordinates within the fish's sprite? */
- bool isIn(int16 x, int16 y) const;
-
/** Enter from this direction / screen edge. */
void enter(Direction from, int16 y);
/** Leave the screen in the current direction. */
@@ -60,6 +57,9 @@ public:
void mutate(uint16 animSwimLeft, uint16 animSwimRight,
uint16 animTurnLeft, uint16 animTurnRight, uint16 animDie);
+ /** Is the fish dead? */
+ bool isDead();
+
private:
enum State {
kStateNone,
diff --git a/engines/gob/minigames/geisha/meter.cpp b/engines/gob/minigames/geisha/meter.cpp
new file mode 100644
index 0000000000..335622c5df
--- /dev/null
+++ b/engines/gob/minigames/geisha/meter.cpp
@@ -0,0 +1,116 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * 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.
+ *
+ */
+
+#include "common/util.h"
+
+#include "gob/surface.h"
+
+#include "gob/minigames/geisha/meter.h"
+
+namespace Gob {
+
+namespace Geisha {
+
+Meter::Meter(int16 x, int16 y, int16 width, int16 height, uint8 frontColor,
+ uint8 backColor, int32 maxValue, Direction direction) :
+ _x(x), _y(y), _width(width), _height(height), _frontColor(frontColor),
+ _backColor(backColor), _value(0), _maxValue(maxValue), _direction(direction),
+ _needUpdate(true), _surface(0) {
+
+}
+
+Meter::~Meter() {
+ delete _surface;
+}
+
+int32 Meter::getValue() const {
+ return _value;
+}
+
+void Meter::setValue(int32 value) {
+ value = CLIP<int32>(value, 0, _maxValue);
+ if (_value == value)
+ return;
+
+ _value = value;
+ _needUpdate = true;
+}
+
+void Meter::setMaxValue() {
+ setValue(_maxValue);
+}
+
+void Meter::increase(int32 n) {
+ int32 value = CLIP<int32>(_value + n, 0, _maxValue);
+ if (_value == value)
+ return;
+
+ _value = value;
+ _needUpdate = true;
+}
+
+void Meter::decrease(int32 n) {
+ int32 value = CLIP<int32>(_value - n, 0, _maxValue);
+ if (_value == value)
+ return;
+
+ _value = value;
+ _needUpdate = true;
+}
+
+void Meter::draw(Surface &dest, int16 &left, int16 &top, int16 &right, int16 &bottom) {
+ if (!_surface) {
+ _surface = new Surface(_width, _height, dest.getBPP());
+ _needUpdate = true;
+ }
+
+ update();
+
+ left = CLIP<int16>(_x , 0, dest.getWidth () - 1);
+ top = CLIP<int16>(_y , 0, dest.getHeight() - 1);
+ right = CLIP<int16>(_x + _width - 1, 0, dest.getWidth () - 1);
+ bottom = CLIP<int16>(_y + _height - 1, 0, dest.getHeight() - 1);
+
+ dest.blit(*_surface, left - _x, top - _y, _width, _height, left, top);
+}
+
+void Meter::update() {
+ if (!_needUpdate)
+ return;
+
+ _needUpdate = false;
+
+ _surface->fill(_backColor);
+
+ int32 n = floor((((float) _width) / _maxValue * _value) + 0.5);
+ if (n <= 0)
+ return;
+
+ if (_direction == kFillToLeft)
+ _surface->fillRect(_width - n, 0, _width - 1, _height - 1, _frontColor);
+ else
+ _surface->fillRect(0 , 0, n - 1, _height - 1, _frontColor);
+}
+
+} // End of namespace Geisha
+
+} // End of namespace Gob
diff --git a/engines/gob/minigames/geisha/meter.h b/engines/gob/minigames/geisha/meter.h
new file mode 100644
index 0000000000..a9bdb14d0f
--- /dev/null
+++ b/engines/gob/minigames/geisha/meter.h
@@ -0,0 +1,89 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * 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.
+ *
+ */
+
+#ifndef GOB_MINIGAMES_GEISHA_METER_H
+#define GOB_MINIGAMES_GEISHA_METER_H
+
+#include "gob/aniobject.h"
+
+namespace Gob {
+
+class Surface;
+
+namespace Geisha {
+
+/** A meter measuring a value. */
+class Meter {
+public:
+ enum Direction {
+ kFillToLeft,
+ kFillToRight
+ };
+
+ Meter(int16 x, int16 y, int16 width, int16 height,
+ uint8 frontColor, uint8 backColor, int32 maxValue,
+ Direction direction);
+ ~Meter();
+
+ /** Return the current value the meter is measuring. */
+ int32 getValue() const;
+
+ /** Set the current value the meter is measuring. */
+ void setValue(int32 value);
+
+ /** Set the current value the meter is measuring to the max value. */
+ void setMaxValue();
+
+ /** Increase the current value the meter is measuring. */
+ void increase(int32 n = 1);
+ /** Decrease the current value the meter is measuring. */
+ void decrease(int32 n = 1);
+
+ /** Draw the meter onto the surface and return the affected rectangle. */
+ void draw(Surface &dest, int16 &left, int16 &top, int16 &right, int16 &bottom);
+
+private:
+ int16 _x;
+ int16 _y;
+ int16 _width;
+ int16 _height;
+
+ uint8 _frontColor;
+ uint8 _backColor;
+
+ int32 _value;
+ int32 _maxValue;
+
+ Direction _direction;
+
+ bool _needUpdate;
+
+ Surface *_surface;
+
+ void update();
+};
+
+} // End of namespace Geisha
+
+} // End of namespace Gob
+
+#endif // GOB_MINIGAMES_GEISHA_METER_H
diff --git a/engines/gob/minigames/geisha/oko.cpp b/engines/gob/minigames/geisha/oko.cpp
new file mode 100644
index 0000000000..7ad8be6fa2
--- /dev/null
+++ b/engines/gob/minigames/geisha/oko.cpp
@@ -0,0 +1,170 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * 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.
+ *
+ */
+
+#include "gob/sound/sound.h"
+
+#include "gob/minigames/geisha/oko.h"
+
+namespace Gob {
+
+namespace Geisha {
+
+enum kOkoAnimation {
+ kOkoAnimationEnter = 0,
+ kOkoAnimationSwim = 1,
+ kOkoAnimationSink = 8,
+ kOkoAnimationRaise = 7,
+ kOkoAnimationBreathe = 2,
+ kOkoAnimationPick = 3,
+ kOkoAnimationHurt = 4,
+ kOkoAnimationDie0 = 17,
+ kOkoAnimationDie1 = 18,
+ kOkoAnimationDie2 = 19
+};
+
+static const int16 kOkoPositionX = 110;
+
+static const uint kLevelCount = 3;
+static const int16 kLevelPositionX[kLevelCount] = { 44, 84, 124 };
+
+
+Oko::Oko(const ANIFile &ani, Sound &sound, SoundDesc &breathe) :
+ ANIObject(ani), _sound(&sound), _breathe(&breathe), _state(kStateEnter), _level(0) {
+
+ setAnimation(kOkoAnimationEnter);
+ setVisible(true);
+}
+
+Oko::~Oko() {
+}
+
+void Oko::advance() {
+ bool wasLastFrame = lastFrame();
+
+ if ((_state == kStateDead) && wasLastFrame) {
+ setPause(true);
+ return;
+ }
+
+ ANIObject::advance();
+
+ switch (_state) {
+ case kStateEnter:
+ if (wasLastFrame) {
+ setAnimation(kOkoAnimationSwim);
+ setPosition(kOkoPositionX, kLevelPositionX[_level]);
+ _state = kStateSwim;
+ }
+ break;
+
+ case kStateBreathe:
+ if ((getFrame() == 6) || (getFrame() == 23))
+ _sound->blasterPlay(_breathe, 1, 0);
+ case kStateSink:
+ case kStateRaise:
+ case kStateHurt:
+ if (wasLastFrame) {
+ setAnimation(kOkoAnimationSwim);
+ setPosition(kOkoPositionX, kLevelPositionX[_level]);
+ _state = kStateSwim;
+ }
+ break;
+
+ case kStatePick:
+ if (wasLastFrame) {
+ _level = 1;
+ setAnimation(kOkoAnimationSwim);
+ setPosition(kOkoPositionX, kLevelPositionX[_level]);
+ _state = kStateSwim;
+ }
+ break;
+
+ default:
+ break;
+ }
+}
+
+void Oko::sink() {
+ if (_state != kStateSwim)
+ return;
+
+ if (_level >= (kLevelCount - 1)) {
+ setAnimation(kOkoAnimationPick);
+ _state = kStatePick;
+ return;
+ }
+
+ setAnimation(kOkoAnimationSink);
+ setPosition(kOkoPositionX, kLevelPositionX[_level]);
+ _state = kStateSink;
+
+ _level++;
+}
+
+void Oko::raise() {
+ if (_state != kStateSwim)
+ return;
+
+ if (_level == 0) {
+ setAnimation(kOkoAnimationBreathe);
+ _state = kStateBreathe;
+ return;
+ }
+
+ setAnimation(kOkoAnimationRaise);
+ setPosition(kOkoPositionX, kLevelPositionX[_level]);
+ _state = kStateSink;
+
+ _level--;
+}
+
+void Oko::hurt() {
+ if (_state != kStateSwim)
+ return;
+
+ setAnimation(kOkoAnimationHurt);
+ _state = kStateHurt;
+}
+
+void Oko::die() {
+ if (_state != kStateSwim)
+ return;
+
+ setAnimation(kOkoAnimationDie0 + _level);
+ _state = kStateDead;
+}
+
+Oko::State Oko::getState() const {
+ return _state;
+}
+
+bool Oko::isBreathing() const {
+ return (_state == kStateBreathe) && ((getFrame() >= 9) && (getFrame() <= 30));
+}
+
+bool Oko::isMoving() const {
+ return (_state != kStateBreathe) && (_state != kStateHurt) && (_state != kStateDead);
+}
+
+} // End of namespace Geisha
+
+} // End of namespace Gob
diff --git a/engines/gob/minigames/geisha/oko.h b/engines/gob/minigames/geisha/oko.h
new file mode 100644
index 0000000000..82c6f59be4
--- /dev/null
+++ b/engines/gob/minigames/geisha/oko.h
@@ -0,0 +1,84 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * 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.
+ *
+ */
+
+#ifndef GOB_MINIGAMES_GEISHA_OKO_H
+#define GOB_MINIGAMES_GEISHA_OKO_H
+
+#include "gob/aniobject.h"
+
+namespace Gob {
+
+class Sound;
+class SoundDesc;
+
+namespace Geisha {
+
+/** Oko, the person you control, in Geisha's "Diving" minigame. */
+class Oko : public ANIObject {
+public:
+ enum State {
+ kStateEnter,
+ kStateSwim,
+ kStateSink,
+ kStateRaise,
+ kStateBreathe,
+ kStatePick,
+ kStateHurt,
+ kStateDead
+ };
+
+ Oko(const ANIFile &ani, Sound &sound, SoundDesc &breathe);
+ ~Oko();
+
+ /** Advance the animation to the next frame. */
+ void advance();
+
+ /** Oko should sink a level. */
+ void sink();
+ /** Oko should raise a level. */
+ void raise();
+
+ /** Oko should get hurt. */
+ void hurt();
+
+ /** Oko should die. */
+ void die();
+
+ State getState() const;
+
+ bool isBreathing() const;
+ bool isMoving() const;
+
+private:
+ Sound *_sound;
+ SoundDesc *_breathe;
+
+ State _state;
+
+ uint8 _level;
+};
+
+} // End of namespace Geisha
+
+} // End of namespace Gob
+
+#endif // GOB_MINIGAMES_GEISHA_OKO_H
diff --git a/engines/gob/module.mk b/engines/gob/module.mk
index bf040c5428..1c83b4ae40 100644
--- a/engines/gob/module.mk
+++ b/engines/gob/module.mk
@@ -3,6 +3,8 @@ MODULE := engines/gob
MODULE_OBJS := \
anifile.o \
aniobject.o \
+ cheater.o \
+ cheater_geisha.o \
console.o \
dataio.o \
databases.o \
@@ -74,6 +76,8 @@ MODULE_OBJS := \
demos/scnplayer.o \
demos/batplayer.o \
minigames/geisha/evilfish.o \
+ minigames/geisha/oko.o \
+ minigames/geisha/meter.o \
minigames/geisha/diving.o \
minigames/geisha/penetration.o \
save/savefile.o \
diff --git a/engines/gob/sound/bgatmosphere.h b/engines/gob/sound/bgatmosphere.h
index e88b91d540..23fcc8a71a 100644
--- a/engines/gob/sound/bgatmosphere.h
+++ b/engines/gob/sound/bgatmosphere.h
@@ -24,6 +24,7 @@
#define GOB_SOUND_BGATMOSPHERE_H
#include "audio/mixer.h"
+#include "common/array.h"
#include "common/mutex.h"
#include "common/random.h"
diff --git a/engines/groovie/script.cpp b/engines/groovie/script.cpp
index a8b4417459..68415233f4 100644
--- a/engines/groovie/script.cpp
+++ b/engines/groovie/script.cpp
@@ -373,7 +373,7 @@ bool Script::hotspot(Common::Rect rect, uint16 address, uint8 cursor) {
DebugMan.isDebugChannelEnabled(kGroovieDebugAll)) {
rect.translate(0, -80);
_vm->_graphicsMan->_foreground.frameRect(rect, 250);
- _vm->_system->copyRectToScreen((byte*)_vm->_graphicsMan->_foreground.getBasePtr(0, 0), _vm->_graphicsMan->_foreground.pitch, 0, 80, 640, 320);
+ _vm->_system->copyRectToScreen((byte *)_vm->_graphicsMan->_foreground.getBasePtr(0, 0), _vm->_graphicsMan->_foreground.pitch, 0, 80, 640, 320);
_vm->_system->updateScreen();
}
diff --git a/engines/hugo/object.h b/engines/hugo/object.h
index c0933729eb..84c20db041 100644
--- a/engines/hugo/object.h
+++ b/engines/hugo/object.h
@@ -117,7 +117,7 @@ protected:
void restoreSeq(object_t *obj);
inline bool checkBoundary(int16 x, int16 y);
- template <typename T>
+ template<typename T>
inline int sign(T a) { if ( a < 0) return -1; else return 1; }
};
diff --git a/engines/hugo/parser.cpp b/engines/hugo/parser.cpp
index a0ad4c0986..4eaed6fecf 100644
--- a/engines/hugo/parser.cpp
+++ b/engines/hugo/parser.cpp
@@ -271,7 +271,7 @@ void Parser::keyHandler(Common::Event event) {
status_t &gameStatus = _vm->getGameStatus();
uint16 nChar = event.kbd.keycode;
- if ((event.kbd.hasFlags(Common::KBD_ALT)) || (event.kbd.hasFlags(Common::KBD_SCRL)))
+ if (event.kbd.flags & (Common::KBD_ALT | Common::KBD_SCRL))
return;
if (event.kbd.hasFlags(Common::KBD_CTRL)) {
diff --git a/engines/hugo/schedule.cpp b/engines/hugo/schedule.cpp
index 892c144393..896e8fa2ce 100644
--- a/engines/hugo/schedule.cpp
+++ b/engines/hugo/schedule.cpp
@@ -1104,7 +1104,7 @@ void Scheduler::restoreEvents(Common::ReadStream *f) {
if ((index == -1) && (subElem == -1))
_events[i].action = 0;
else
- _events[i].action = (act*)&_actListArr[index][subElem];
+ _events[i].action = (act *)&_actListArr[index][subElem];
_events[i].localActionFl = (f->readByte() == 1) ? true : false;
_events[i].time = f->readUint32BE();
diff --git a/engines/hugo/sound.cpp b/engines/hugo/sound.cpp
index 9dcd7d346a..d0b4e3dfe8 100644
--- a/engines/hugo/sound.cpp
+++ b/engines/hugo/sound.cpp
@@ -256,7 +256,7 @@ void SoundHandler::checkMusic() {
}
void SoundHandler::loopPlayer(void *refCon) {
- ((SoundHandler*)refCon)->pcspkr_player();
+ ((SoundHandler *)refCon)->pcspkr_player();
}
/**
diff --git a/engines/hugo/util.cpp b/engines/hugo/util.cpp
index 6dc9890c3a..fdc676e6a7 100644
--- a/engines/hugo/util.cpp
+++ b/engines/hugo/util.cpp
@@ -119,7 +119,7 @@ char *strlwr(char *buffer) {
char *result = buffer;
while (*buffer != '\0') {
- if (isupper(static_cast<unsigned char>(*buffer)))
+ if (Common::isUpper(*buffer))
*buffer = tolower(*buffer);
buffer++;
}
diff --git a/engines/kyra/animator_hof.cpp b/engines/kyra/animator_hof.cpp
index 741e358143..5a2378f4d0 100644
--- a/engines/kyra/animator_hof.cpp
+++ b/engines/kyra/animator_hof.cpp
@@ -115,15 +115,14 @@ void KyraEngine_HoF::refreshAnimObjects(int force) {
void KyraEngine_HoF::updateItemAnimations() {
bool nextFrame = false;
- if (_itemAnimData[0].itemIndex == -1 || _inventorySaved)
+ if (_itemAnimDefinition[0].itemIndex == -1 || _inventorySaved)
return;
- const ItemAnimData_v2 *s = &_itemAnimData[_nextAnimItem];
+ const ItemAnimDefinition *s = &_itemAnimDefinition[_nextAnimItem];
ActiveItemAnim *a = &_activeItemAnim[_nextAnimItem];
- _nextAnimItem = (_nextAnimItem + 1) % _itemAnimDataSize;
+ _nextAnimItem = (_nextAnimItem + 1) % _itemAnimDefinitionSize;
- uint32 ctime = _system->getMillis();
- if (ctime < a->nextFrame)
+ if (_system->getMillis() < a->nextFrameTime)
return;
uint16 shpIdx = s->frames[a->currentFrame].index + 64;
@@ -164,7 +163,7 @@ void KyraEngine_HoF::updateItemAnimations() {
}
if (nextFrame) {
- a->nextFrame = _system->getMillis() + (s->frames[a->currentFrame].delay * _tickLength);
+ a->nextFrameTime = _system->getMillis() + (s->frames[a->currentFrame].delay * _tickLength);
a->currentFrame = (a->currentFrame + 1) % s->numFrames;
}
}
diff --git a/engines/kyra/animator_mr.cpp b/engines/kyra/animator_mr.cpp
index 31c5cd1a53..29fa3aba80 100644
--- a/engines/kyra/animator_mr.cpp
+++ b/engines/kyra/animator_mr.cpp
@@ -187,15 +187,14 @@ void KyraEngine_MR::refreshAnimObjects(int force) {
void KyraEngine_MR::updateItemAnimations() {
bool nextFrame = false;
- if (_itemAnimData[0].itemIndex == -1)
+ if (_itemAnimDefinition[0].itemIndex == -1)
return;
- const ItemAnimData_v2 *s = &_itemAnimData[_nextAnimItem];
+ const ItemAnimDefinition *s = &_itemAnimDefinition[_nextAnimItem];
ActiveItemAnim *a = &_activeItemAnim[_nextAnimItem];
_nextAnimItem = (_nextAnimItem + 1) % 10;
- uint32 ctime = _system->getMillis();
- if (ctime < a->nextFrame)
+ if (_system->getMillis() < a->nextFrameTime)
return;
uint16 shpIdx = s->frames[a->currentFrame].index + 248;
@@ -230,7 +229,7 @@ void KyraEngine_MR::updateItemAnimations() {
}
if (nextFrame) {
- a->nextFrame = _system->getMillis() + (s->frames[a->currentFrame].delay * _tickLength);
+ a->nextFrameTime = _system->getMillis() + (s->frames[a->currentFrame].delay * _tickLength);
a->currentFrame = (a->currentFrame + 1) % s->numFrames;
}
}
diff --git a/engines/kyra/chargen.cpp b/engines/kyra/chargen.cpp
index ed761e53c6..73f5fccb92 100644
--- a/engines/kyra/chargen.cpp
+++ b/engines/kyra/chargen.cpp
@@ -248,10 +248,10 @@ void CharacterGenerator::init() {
_faceShapes = new uint8*[44];
for (int i = 0; i < 44; i++)
- _faceShapes[i] = _screen->encodeShape((i % 10) << 2, (i / 10) << 5, 4, 32, true);
+ _faceShapes[i] = _screen->encodeShape((i % 10) << 2, (i / 10) << 5, 4, 32, true, _vm->_cgaMappingDefault);
_screen->_curPage = 0;
- _screen->loadEoBBitmap("CHARGEN", 0, 3, 3, 0);
+ _screen->loadEoBBitmap("CHARGEN", _vm->_cgaMappingDefault, 3, 3, 0);
_screen->loadShapeSetBitmap("CHARGENB", 3, 3);
if (_chargenMagicShapes) {
for (int i = 0; i < 10; i++)
@@ -261,14 +261,14 @@ void CharacterGenerator::init() {
_chargenMagicShapes = new uint8*[10];
for (int i = 0; i < 10; i++)
- _chargenMagicShapes[i] = _screen->encodeShape(i << 2, 0, 4, 32, true);
+ _chargenMagicShapes[i] = _screen->encodeShape(i << 2, 0, 4, 32, true, _vm->_cgaMappingDefault);
for (int i = 0; i < 17; i++) {
const CreatePartyModButton *c = &_chargenModButtons[i];
- _chargenButtonLabels[i] = c->labelW ? _screen->encodeShape(c->encodeLabelX, c->encodeLabelY, c->labelW, c->labelH, true) : 0;
+ _chargenButtonLabels[i] = c->labelW ? _screen->encodeShape(c->encodeLabelX, c->encodeLabelY, c->labelW, c->labelH, true, _vm->_cgaMappingDefault) : 0;
}
- _screen->copyPage(3, 2);
+ _screen->convertPage(3, 2, _vm->_cgaMappingDefault);
_screen->_curPage = 0;
_screen->copyRegion(144, 64, 0, 0, 180, 128, 0, 2, Screen::CR_NO_P_CHECK);
_screen->updateScreen();
@@ -1496,7 +1496,7 @@ TransferPartyWiz::~TransferPartyWiz() {
}
bool TransferPartyWiz::start() {
- _screen->copyPage(0, 12);
+ _screen->copyPage(0, (_screen->getPageScaleFactor(0) == 2) ? 1 : 12);
if (!selectAndLoadTransferFile())
return false;
@@ -1536,7 +1536,7 @@ bool TransferPartyWiz::start() {
bool TransferPartyWiz::selectAndLoadTransferFile() {
do {
- _screen->copyPage(12, 0);
+ _screen->copyPage((_screen->getPageScaleFactor(0) == 2) ? 1 : 12, 0);
if (transferFileDialogue(_vm->_savegameFilename))
break;
} while (_vm->_gui->confirmDialogue2(15, 68, 1));
@@ -1566,7 +1566,7 @@ bool TransferPartyWiz::selectAndLoadTransferFile() {
return false;
Common::String target = _vm->_gui->transferTargetMenu(eobTargets);
- _screen->copyPage(12, 0);
+ _screen->copyPage((_screen->getPageScaleFactor(0) == 2) ? 1 : 12, 0);
if (target.empty())
return true;
@@ -1579,10 +1579,10 @@ bool TransferPartyWiz::selectAndLoadTransferFile() {
return true;
}
- _screen->copyPage(12, 0);
+ _screen->copyPage((_screen->getPageScaleFactor(0) == 2) ? 1 : 12, 0);
bool result = _vm->_gui->transferFileMenu(target, dest);
- _screen->copyPage(12, 0);
+ _screen->copyPage((_screen->getPageScaleFactor(0) == 2) ? 1 : 12, 0);
return result;
}
diff --git a/engines/kyra/darkmoon.cpp b/engines/kyra/darkmoon.cpp
index f63d49933b..16bd3dad58 100644
--- a/engines/kyra/darkmoon.cpp
+++ b/engines/kyra/darkmoon.cpp
@@ -29,22 +29,21 @@
namespace Kyra {
DarkMoonEngine::DarkMoonEngine(OSystem *system, const GameFlags &flags) : EoBCoreEngine(system, flags) {
- _seqIntro = _seqFinale = 0;
+ _animIntro = _animFinale = 0;
_shapesIntro = _shapesFinale = 0;
_dscDoorType5Offs = 0;
_numSpells = 70;
_menuChoiceInit = 4;
_introStrings = _cpsFilesIntro = _cpsFilesFinale = _finaleStrings = _kheldranStrings = _npcStrings[0] = _npcStrings[1] = _hornStrings = 0;
- _seqIntro = _seqFinale = 0;
_shapesIntro = _shapesFinale = 0;
_creditsData = _npcShpData = _dscDoorType5Offs = _hornSounds = 0;
_dreamSteps = 0;
}
DarkMoonEngine::~DarkMoonEngine() {
- delete[] _seqIntro;
- delete[] _seqFinale;
+ delete[] _animIntro;
+ delete[] _animFinale;
delete[] _shapesIntro;
delete[] _shapesFinale;
}
@@ -58,6 +57,15 @@ Common::Error DarkMoonEngine::init() {
_monsterProps = new EoBMonsterProperty[10];
+ if (_configRenderMode == Common::kRenderEGA) {
+ Palette pal(16);
+ _screen->loadPalette(_egaDefaultPalette, pal, 16);
+ _screen->setScreenPalette(pal);
+ }
+
+ _screen->loadPalette("PALETTE.COL", _screen->getPalette(0));
+ _screen->setScreenPalette(_screen->getPalette(0));
+
return Common::kNoError;
}
@@ -150,7 +158,9 @@ void DarkMoonEngine::generateMonsterPalettes(const char *file, int16 monsterInde
int colx = 302 + 3 * i;
for (int ii = 0; ii < 16; ii++) {
- uint8 col = _screen->getPagePixel(_screen->_curPage, colx, 184 + ii);
+ // Don't use getPagePixel() here, since in EGA mode it will try to
+ // undither the pixel (although the shape bitmap is undithered already)
+ uint8 col = _screen->getCPagePtr(_screen->_curPage | 1)[(184 + ii) * Screen::SCREEN_W + colx];
int iii = 0;
for (; iii < 16; iii++) {
@@ -168,7 +178,9 @@ void DarkMoonEngine::generateMonsterPalettes(const char *file, int16 monsterInde
memcpy(tmpPal, _monsterShapes[dci] + 4, 16);
for (int iii = 0; iii < 16; iii++) {
- uint8 col = _screen->getPagePixel(_screen->_curPage, colx + ii, 184 + iii);
+ // Don't use getPagePixel() here, since in EGA mode it will try to
+ // undither the pixel (although the shape bitmap is undithered already)
+ uint8 col = _screen->getCPagePtr(_screen->_curPage | 1)[(184 + iii) * Screen::SCREEN_W + colx + ii];
if (newPal[iii])
tmpPal[newPal[iii]] = col;
}
diff --git a/engines/kyra/darkmoon.h b/engines/kyra/darkmoon.h
index 78413d2c38..f6e7b3ed2c 100644
--- a/engines/kyra/darkmoon.h
+++ b/engines/kyra/darkmoon.h
@@ -31,7 +31,7 @@ namespace Kyra {
class DarkmoonSequenceHelper;
-struct EoBSequenceStep {
+struct DarkMoonAnimCommand {
uint8 command;
uint8 obj;
int16 x1;
@@ -74,17 +74,19 @@ private:
const char * const *_introStrings;
const char * const *_cpsFilesIntro;
- const EoBSequenceStep **_seqIntro;
- const EoBShapeDef **_shapesIntro;
+ const DarkMoonAnimCommand **_animIntro;
+ const DarkMoonShapeDef **_shapesIntro;
const char * const *_finaleStrings;
const uint8 *_creditsData;
const char * const *_cpsFilesFinale;
- const EoBSequenceStep **_seqFinale;
- const EoBShapeDef **_shapesFinale;
+ const DarkMoonAnimCommand **_animFinale;
+ const DarkMoonShapeDef **_shapesFinale;
- static const char *_palFilesIntro[];
- static const char *_palFilesFinale[];
+ static const char *_palFilesIntroVGA[];
+ static const char *_palFilesIntroEGA[];
+ static const char *_palFilesFinaleVGA[];
+ static const char *_palFilesFinaleEGA[];
// Ingame sequence
void seq_nightmare();
@@ -135,6 +137,7 @@ private:
const uint8 *_hornSounds;
static const KyraRpgGUISettings _guiSettings;
+ static const uint8 _egaDefaultPalette[];
};
} // End of namespace Kyra
diff --git a/engines/kyra/debugger.cpp b/engines/kyra/debugger.cpp
index 95c6162c36..c0a91ac098 100644
--- a/engines/kyra/debugger.cpp
+++ b/engines/kyra/debugger.cpp
@@ -29,6 +29,9 @@
#include "kyra/eobcommon.h"
#include "common/system.h"
+#include "common/config-manager.h"
+
+#include "gui/message.h"
namespace Kyra {
@@ -205,6 +208,7 @@ void Debugger_LoK::initialize() {
DCmd_Register("scenes", WRAP_METHOD(Debugger_LoK, cmd_listScenes));
DCmd_Register("give", WRAP_METHOD(Debugger_LoK, cmd_giveItem));
DCmd_Register("birthstones", WRAP_METHOD(Debugger_LoK, cmd_listBirthstones));
+ Debugger::initialize();
}
bool Debugger_LoK::cmd_enterRoom(int argc, const char **argv) {
@@ -295,6 +299,7 @@ void Debugger_v2::initialize() {
DCmd_Register("scene_info", WRAP_METHOD(Debugger_v2, cmd_sceneInfo));
DCmd_Register("scene_to_facing", WRAP_METHOD(Debugger_v2, cmd_sceneToFacing));
DCmd_Register("give", WRAP_METHOD(Debugger_v2, cmd_giveItem));
+ Debugger::initialize();
}
bool Debugger_v2::cmd_enterScene(int argc, const char **argv) {
@@ -445,6 +450,7 @@ Debugger_HoF::Debugger_HoF(KyraEngine_HoF *vm) : Debugger_v2(vm), _vm(vm) {
void Debugger_HoF::initialize() {
DCmd_Register("pass_codes", WRAP_METHOD(Debugger_HoF, cmd_passcodes));
+ Debugger_v2::initialize();
}
bool Debugger_HoF::cmd_passcodes(int argc, const char **argv) {
@@ -474,6 +480,33 @@ Debugger_LoL::Debugger_LoL(LoLEngine *vm) : Debugger(vm), _vm(vm) {
#ifdef ENABLE_EOB
Debugger_EoB::Debugger_EoB(EoBCoreEngine *vm) : Debugger(vm), _vm(vm) {
}
+
+void Debugger_EoB::initialize() {
+ DCmd_Register("import_savefile", WRAP_METHOD(Debugger_EoB, cmd_importSaveFile));
+}
+
+bool Debugger_EoB::cmd_importSaveFile(int argc, const char **argv) {
+ if (!_vm->_allowImport) {
+ DebugPrintf("This command may only be used from the main menu.\n");
+ return true;
+ }
+
+ if (argc == 3) {
+ int slot = atoi(argv[1]);
+ if (slot < -1 || slot > 989) {
+ DebugPrintf("slot must be between (including) -1 and 989 \n");
+ return true;
+ }
+
+ DebugPrintf(_vm->importOriginalSaveFile(slot, argv[2]) ? "Success.\n" : "Failure.\n");
+ _vm->loadItemDefs();
+ } else {
+ DebugPrintf("Syntax: import_savefile <dest slot> <source file>\n (Imports source save game file to dest slot.)\n import_savefile -1\n (Imports all original save game files found and puts them into the first available slots.)\n\n");
+ }
+
+ return true;
+}
+
#endif // ENABLE_EOB
} // End of namespace Kyra
diff --git a/engines/kyra/debugger.h b/engines/kyra/debugger.h
index 77f1a9a550..2b1dcbe505 100644
--- a/engines/kyra/debugger.h
+++ b/engines/kyra/debugger.h
@@ -115,8 +115,11 @@ class Debugger_EoB : public Debugger {
public:
Debugger_EoB(EoBCoreEngine *vm);
+ virtual void initialize();
protected:
EoBCoreEngine *_vm;
+
+ bool cmd_importSaveFile(int argc, const char **argv);
};
#endif // ENABLE_EOB
diff --git a/engines/kyra/detection_tables.h b/engines/kyra/detection_tables.h
index 2b3708528c..44e604c44d 100644
--- a/engines/kyra/detection_tables.h
+++ b/engines/kyra/detection_tables.h
@@ -97,7 +97,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO4(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIPCSPK)
+ GUIO5(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
},
KYRA1_FLOPPY_FLAGS
},
@@ -110,7 +110,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO4(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIPCSPK)
+ GUIO5(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
},
KYRA1_FLOPPY_FLAGS
},
@@ -122,7 +122,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::FR_FRA,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO4(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIPCSPK)
+ GUIO5(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
},
KYRA1_FLOPPY_FLAGS
},
@@ -134,7 +134,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO4(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIPCSPK)
+ GUIO5(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
},
KYRA1_FLOPPY_FLAGS
},
@@ -146,7 +146,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO4(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIPCSPK)
+ GUIO5(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
},
KYRA1_FLOPPY_FLAGS
},
@@ -158,7 +158,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::RU_RUS,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO4(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIPCSPK)
+ GUIO5(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
},
KYRA1_OLDFLOPPY_FLAGS
},
@@ -170,7 +170,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::ES_ESP,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO4(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIPCSPK)
+ GUIO5(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
},
KYRA1_FLOPPY_FLAGS
},
@@ -182,7 +182,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::ES_ESP,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO4(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIPCSPK)
+ GUIO5(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
},
KYRA1_FLOPPY_FLAGS
},
@@ -194,7 +194,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::IT_ITA,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO4(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIPCSPK)
+ GUIO5(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
},
KYRA1_FLOPPY_FLAGS
},
@@ -211,7 +211,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformAmiga,
ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSPEECH, GUIO_MIDIAMIGA)
+ GUIO3(GUIO_NOSPEECH, GUIO_MIDIAMIGA, GUIO_RENDERAMIGA)
},
KYRA1_AMIGA_FLAGS
},
@@ -228,7 +228,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::DE_DEU,
Common::kPlatformAmiga,
ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSPEECH, GUIO_MIDIAMIGA)
+ GUIO3(GUIO_NOSPEECH, GUIO_MIDIAMIGA, GUIO_RENDERAMIGA)
},
KYRA1_AMIGA_FLAGS
},
@@ -245,7 +245,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformMacintosh,
ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSPEECH, GUIO_MIDIGM)
+ GUIO3(GUIO_NOSPEECH, GUIO_MIDIGM, GUIO_RENDERVGA)
},
KYRA1_FLOPPY_FLAGS
},
@@ -262,7 +262,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformFMTowns,
ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSPEECH, GUIO_MIDITOWNS)
+ GUIO3(GUIO_NOSPEECH, GUIO_MIDITOWNS, GUIO_RENDERFMTOWNS)
},
KYRA1_TOWNS_FLAGS
},
@@ -278,7 +278,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::JA_JPN,
Common::kPlatformFMTowns,
ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSPEECH, GUIO_MIDITOWNS)
+ GUIO3(GUIO_NOSPEECH, GUIO_MIDITOWNS, GUIO_RENDERFMTOWNS)
},
KYRA1_TOWNS_SJIS_FLAGS
},
@@ -297,7 +297,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::JA_JPN,
Common::kPlatformPC98,
ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSPEECH, GUIO_MIDIPC98)
+ GUIO3(GUIO_NOSPEECH, GUIO_MIDIPC98, GUIO_RENDERPC98)
},
KYRA1_TOWNS_SJIS_FLAGS
},
@@ -310,7 +310,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_CD,
- GUIO3(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIPCSPK)
+ GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
},
KYRA1_CD_FLAGS
},
@@ -322,7 +322,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_CD,
- GUIO3(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIPCSPK)
+ GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
},
KYRA1_CD_FLAGS
},
@@ -334,7 +334,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::FR_FRA,
Common::kPlatformPC,
ADGF_CD,
- GUIO3(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIPCSPK)
+ GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
},
KYRA1_CD_FLAGS
},
@@ -347,7 +347,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::IT_ITA,
Common::kPlatformPC,
ADGF_CD,
- GUIO3(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIPCSPK)
+ GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
},
KYRA1_CD_FLAGS
},
@@ -409,7 +409,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_DEMO,
- GUIO4(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIPCSPK)
+ GUIO5(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
},
KYRA1_DEMO_FLAGS
},
@@ -422,7 +422,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_DEMO | ADGF_CD,
- GUIO3(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIPCSPK)
+ GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
},
KYRA1_DEMO_CD_FLAGS
},
@@ -435,7 +435,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO5(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
+ GUIO6(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
},
KYRA2_FLOPPY_CMP_FLAGS
},
@@ -448,7 +448,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO5(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
+ GUIO6(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
},
KYRA2_FLOPPY_CMP_FLAGS
},
@@ -461,7 +461,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO5(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
+ GUIO6(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
},
KYRA2_FLOPPY_FLAGS
},
@@ -474,7 +474,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO5(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
+ GUIO6(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
},
KYRA2_FLOPPY_FLAGS
},
@@ -487,7 +487,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::FR_FRA,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO5(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
+ GUIO6(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
},
KYRA2_FLOPPY_FLAGS
},
@@ -500,7 +500,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::IT_ITA,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO5(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
+ GUIO6(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
},
KYRA2_FLOPPY_FLAGS
},
@@ -513,7 +513,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::RU_RUS,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO5(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
+ GUIO6(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
},
KYRA2_FLOPPY_FAN_FLAGS(Common::RU_RUS, Common::EN_ANY)
},
@@ -526,7 +526,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::RU_RUS,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO5(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
+ GUIO6(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
},
KYRA2_FLOPPY_FAN_FLAGS(Common::RU_RUS, Common::EN_ANY)
},
@@ -539,7 +539,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD,
- GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
+ GUIO5(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
},
KYRA2_CD_FLAGS
},
@@ -551,7 +551,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD,
- GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
+ GUIO5(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
},
KYRA2_CD_FLAGS
},
@@ -563,7 +563,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::FR_FRA,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD,
- GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
+ GUIO5(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
},
KYRA2_CD_FLAGS
},
@@ -577,7 +577,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::IT_ITA,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD,
- GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
+ GUIO5(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
},
KYRA2_CD_FAN_FLAGS(Common::IT_ITA, Common::EN_ANY)
},
@@ -589,7 +589,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD,
- GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
+ GUIO5(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
},
KYRA2_CD_FAN_FLAGS(Common::IT_ITA, Common::EN_ANY)
},
@@ -601,7 +601,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::FR_FRA,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD,
- GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
+ GUIO5(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
},
KYRA2_CD_FAN_FLAGS(Common::IT_ITA, Common::EN_ANY)
},
@@ -614,7 +614,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::IT_ITA,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD,
- GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
+ GUIO5(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
},
KYRA2_CD_FAN_FLAGS(Common::IT_ITA, Common::EN_ANY)
},
@@ -627,7 +627,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD,
- GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
+ GUIO5(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
},
KYRA2_CD_FAN_FLAGS(Common::IT_ITA, Common::EN_ANY)
},
@@ -640,7 +640,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::FR_FRA,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD,
- GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
+ GUIO5(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
},
KYRA2_CD_FAN_FLAGS(Common::IT_ITA, Common::EN_ANY)
},
@@ -654,7 +654,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::RU_RUS,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD,
- GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
+ GUIO5(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
},
KYRA2_CD_FAN_FLAGS(Common::RU_RUS, Common::EN_ANY)
},
@@ -667,7 +667,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD | ADGF_DEMO,
- GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
+ GUIO5(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
},
KYRA2_CD_DEMO_FLAGS
},
@@ -680,7 +680,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD | ADGF_DEMO,
- GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
+ GUIO5(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
},
KYRA2_CD_DEMO_FLAGS
},
@@ -693,7 +693,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::FR_FRA,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD | ADGF_DEMO,
- GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
+ GUIO5(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
},
KYRA2_CD_DEMO_FLAGS
},
@@ -706,7 +706,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_DEMO,
- GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
+ GUIO5(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
},
KYRA2_DEMO_FLAGS
},
@@ -719,7 +719,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformFMTowns,
ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSPEECH, GUIO_MIDITOWNS)
+ GUIO3(GUIO_NOSPEECH, GUIO_MIDITOWNS, GUIO_RENDERFMTOWNS)
},
KYRA2_TOWNS_FLAGS
},
@@ -731,7 +731,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::JA_JPN,
Common::kPlatformFMTowns,
ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSPEECH, GUIO_MIDITOWNS)
+ GUIO3(GUIO_NOSPEECH, GUIO_MIDITOWNS, GUIO_RENDERFMTOWNS)
},
KYRA2_TOWNS_SJIS_FLAGS
},
@@ -743,7 +743,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformPC98,
ADGF_CD,
- GUIO2(GUIO_NOSPEECH, GUIO_MIDIPC98)
+ GUIO3(GUIO_NOSPEECH, GUIO_MIDIPC98, GUIO_RENDERPC98)
},
KYRA2_TOWNS_FLAGS
},
@@ -755,7 +755,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::JA_JPN,
Common::kPlatformPC98,
ADGF_CD,
- GUIO2(GUIO_NOSPEECH, GUIO_MIDIPC98)
+ GUIO3(GUIO_NOSPEECH, GUIO_MIDIPC98, GUIO_RENDERPC98)
},
KYRA2_TOWNS_SJIS_FLAGS
},
@@ -775,7 +775,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_DROPLANGUAGE,
- GUIO1(GUIO_NOMIDI)
+ GUIO2(GUIO_NOMIDI, GUIO_RENDERVGA)
},
KYRA3_CD_FLAGS
},
@@ -791,7 +791,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_DROPLANGUAGE,
- GUIO1(GUIO_NOMIDI)
+ GUIO2(GUIO_NOMIDI, GUIO_RENDERVGA)
},
KYRA3_CD_FLAGS
},
@@ -807,7 +807,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::FR_FRA,
Common::kPlatformPC,
ADGF_DROPLANGUAGE,
- GUIO1(GUIO_NOMIDI)
+ GUIO2(GUIO_NOMIDI, GUIO_RENDERVGA)
},
KYRA3_CD_FLAGS
},
@@ -825,7 +825,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_DROPLANGUAGE,
- GUIO1(GUIO_NOMIDI)
+ GUIO2(GUIO_NOMIDI, GUIO_RENDERVGA)
},
KYRA3_CD_INS_FLAGS
},
@@ -841,7 +841,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_DROPLANGUAGE,
- GUIO1(GUIO_NOMIDI)
+ GUIO2(GUIO_NOMIDI, GUIO_RENDERVGA)
},
KYRA3_CD_INS_FLAGS
},
@@ -857,7 +857,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::FR_FRA,
Common::kPlatformPC,
ADGF_DROPLANGUAGE,
- GUIO1(GUIO_NOMIDI)
+ GUIO2(GUIO_NOMIDI, GUIO_RENDERVGA)
},
KYRA3_CD_INS_FLAGS
},
@@ -875,7 +875,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformMacintosh,
ADGF_DROPLANGUAGE,
- GUIO1(GUIO_NOMIDI)
+ GUIO2(GUIO_NOMIDI, GUIO_RENDERVGA)
},
KYRA3_CD_INS_FLAGS
},
@@ -891,7 +891,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::DE_DEU,
Common::kPlatformMacintosh,
ADGF_DROPLANGUAGE,
- GUIO1(GUIO_NOMIDI)
+ GUIO2(GUIO_NOMIDI, GUIO_RENDERVGA)
},
KYRA3_CD_INS_FLAGS
},
@@ -907,7 +907,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::FR_FRA,
Common::kPlatformMacintosh,
ADGF_DROPLANGUAGE,
- GUIO1(GUIO_NOMIDI)
+ GUIO2(GUIO_NOMIDI, GUIO_RENDERVGA)
},
KYRA3_CD_INS_FLAGS
},
@@ -925,7 +925,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::ES_ESP,
Common::kPlatformPC,
ADGF_DROPLANGUAGE,
- GUIO1(GUIO_NOMIDI)
+ GUIO2(GUIO_NOMIDI, GUIO_RENDERVGA)
},
KYRA3_CD_FAN_FLAGS(Common::ES_ESP, Common::EN_ANY)
},
@@ -941,7 +941,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_DROPLANGUAGE,
- GUIO1(GUIO_NOMIDI)
+ GUIO2(GUIO_NOMIDI, GUIO_RENDERVGA)
},
KYRA3_CD_FAN_FLAGS(Common::ES_ESP, Common::EN_ANY)
},
@@ -957,7 +957,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::FR_FRA,
Common::kPlatformPC,
ADGF_DROPLANGUAGE,
- GUIO1(GUIO_NOMIDI)
+ GUIO2(GUIO_NOMIDI, GUIO_RENDERVGA)
},
KYRA3_CD_FAN_FLAGS(Common::ES_ESP, Common::EN_ANY)
},
@@ -975,7 +975,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_DROPLANGUAGE,
- GUIO1(GUIO_NOMIDI)
+ GUIO2(GUIO_NOMIDI, GUIO_RENDERVGA)
},
KYRA3_CD_FAN_FLAGS(Common::IT_ITA, Common::FR_FRA)
},
@@ -991,7 +991,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_DROPLANGUAGE,
- GUIO1(GUIO_NOMIDI)
+ GUIO2(GUIO_NOMIDI, GUIO_RENDERVGA)
},
KYRA3_CD_FAN_FLAGS(Common::IT_ITA, Common::FR_FRA)
},
@@ -1007,7 +1007,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::IT_ITA,
Common::kPlatformPC,
ADGF_DROPLANGUAGE,
- GUIO1(GUIO_NOMIDI)
+ GUIO2(GUIO_NOMIDI, GUIO_RENDERVGA)
},
KYRA3_CD_FAN_FLAGS(Common::IT_ITA, Common::FR_FRA)
},
@@ -1026,7 +1026,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD,
- GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
+ GUIO5(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
},
LOL_CD_FLAGS
},
@@ -1043,7 +1043,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD,
- GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
+ GUIO5(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
},
LOL_CD_FLAGS
},
@@ -1060,7 +1060,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::FR_FRA,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD,
- GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
+ GUIO5(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
},
LOL_CD_FLAGS
},
@@ -1077,7 +1077,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD,
- GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
+ GUIO5(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
},
LOL_CD_FLAGS
},
@@ -1094,7 +1094,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD,
- GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
+ GUIO5(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
},
LOL_CD_FLAGS
},
@@ -1111,7 +1111,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::FR_FRA,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD,
- GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
+ GUIO5(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
},
LOL_CD_FLAGS
},
@@ -1129,7 +1129,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD,
- GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
+ GUIO5(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
},
LOL_CD_FAN_FLAGS(Common::RU_RUS, Common::DE_DEU)
},
@@ -1147,7 +1147,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::FR_FRA,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD,
- GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
+ GUIO5(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
},
LOL_CD_FAN_FLAGS(Common::RU_RUS, Common::DE_DEU)
},
@@ -1164,7 +1164,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::RU_RUS,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD,
- GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
+ GUIO5(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
},
LOL_CD_FAN_FLAGS(Common::RU_RUS, Common::DE_DEU)
},
@@ -1182,7 +1182,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::IT_ITA,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD,
- GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
+ GUIO5(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
},
LOL_CD_FAN_FLAGS(Common::IT_ITA, Common::EN_ANY)
},
@@ -1199,7 +1199,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD,
- GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
+ GUIO5(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
},
LOL_CD_FAN_FLAGS(Common::IT_ITA, Common::EN_ANY)
},
@@ -1216,7 +1216,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::FR_FRA,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD,
- GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
+ GUIO5(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
},
LOL_CD_FAN_FLAGS(Common::IT_ITA, Common::EN_ANY)
},
@@ -1233,7 +1233,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::IT_ITA,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD,
- GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
+ GUIO5(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
},
LOL_CD_FAN_FLAGS(Common::IT_ITA, Common::EN_ANY)
},
@@ -1250,7 +1250,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD,
- GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
+ GUIO5(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
},
LOL_CD_FAN_FLAGS(Common::IT_ITA, Common::EN_ANY)
},
@@ -1267,7 +1267,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::FR_FRA,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD,
- GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
+ GUIO5(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
},
LOL_CD_FAN_FLAGS(Common::IT_ITA, Common::EN_ANY)
},
@@ -1283,7 +1283,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO5(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
+ GUIO6(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
},
LOL_FLOPPY_CMP_FLAGS
},
@@ -1299,7 +1299,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO5(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
+ GUIO6(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
},
LOL_FLOPPY_CMP_FLAGS
},
@@ -1315,7 +1315,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO5(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
+ GUIO6(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
},
LOL_FLOPPY_CMP_FLAGS
},
@@ -1332,7 +1332,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO5(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
+ GUIO6(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
},
LOL_FLOPPY_FLAGS
},
@@ -1349,7 +1349,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO5(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
+ GUIO6(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
},
LOL_FLOPPY_FLAGS
},
@@ -1366,7 +1366,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO5(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
+ GUIO6(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
},
LOL_FLOPPY_FLAGS
},
@@ -1383,7 +1383,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO5(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
+ GUIO6(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
},
LOL_FLOPPY_FLAGS
},
@@ -1401,7 +1401,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::RU_RUS,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO5(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
+ GUIO6(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
},
LOL_FLOPPY_FAN_FLAGS(Common::RU_RUS, Common::EN_ANY)
},
@@ -1418,7 +1418,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::JA_JPN,
Common::kPlatformPC98,
ADGF_NO_FLAGS,
- GUIO2(GUIO_NOSPEECH, GUIO_MIDIPC98)
+ GUIO3(GUIO_NOSPEECH, GUIO_MIDIPC98, GUIO_RENDERPC98)
},
LOL_PC98_SJIS_FLAGS
},
@@ -1435,7 +1435,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_DEMO,
- GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
+ GUIO5(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
},
LOL_DEMO_FLAGS
},
@@ -1451,7 +1451,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_DEMO,
- GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
+ GUIO5(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK, GUIO_RENDERVGA)
},
LOL_KYRA2_DEMO_FLAGS
},
@@ -1463,13 +1463,13 @@ const KYRAGameDescription adGameDescs[] = {
"eob",
0,
{
- { "EOBDATA2.PAK", 0, "feaf0345086b3a1d931352f4b0ad8feb", -1 },
+ { "EOBDATA3.PAK", 0, "61aff543131bd61a8b7d7dc901a8278b", -1 },
{ 0, 0, 0, 0 }
},
Common::EN_ANY,
Common::kPlatformPC,
ADGF_TESTING,
- GUIO3(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIPCSPK)
+ GUIO6(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIPCSPK, GUIO_RENDERVGA, GUIO_RENDEREGA, GUIO_RENDERCGA)
},
EOB_FLAGS
},
@@ -1479,13 +1479,13 @@ const KYRAGameDescription adGameDescs[] = {
"eob",
0,
{
- { "SHINDIA.CPS", 0, "383b0c7ba0903eae5d04cad28ce90aaf", -1 },
+ { "TEXT.DAT", 0, "fb59b50f97fd1806756911d986b9b2b5", -1 },
{ 0, 0, 0, 0 }
},
Common::DE_DEU,
Common::kPlatformPC,
ADGF_TESTING,
- GUIO3(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIPCSPK)
+ GUIO6(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIPCSPK, GUIO_RENDERVGA, GUIO_RENDEREGA, GUIO_RENDERCGA)
},
EOB_FLAGS
},
@@ -1501,7 +1501,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_TESTING,
- GUIO3(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIPCSPK)
+ GUIO5(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIPCSPK, GUIO_RENDERVGA, GUIO_RENDEREGA)
},
EOB2_FLAGS
},
@@ -1517,7 +1517,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_TESTING,
- GUIO3(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIPCSPK)
+ GUIO5(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIPCSPK, GUIO_RENDERVGA, GUIO_RENDEREGA)
},
EOB2_FLAGS
},
diff --git a/engines/kyra/eob.cpp b/engines/kyra/eob.cpp
index 7524b077ff..a7bde9f1ee 100644
--- a/engines/kyra/eob.cpp
+++ b/engines/kyra/eob.cpp
@@ -33,18 +33,14 @@ EoBEngine::EoBEngine(OSystem *system, const GameFlags &flags)
_numSpells = 53;
_menuChoiceInit = 4;
- _turnUndeadString = _introFilesOpening = _introFilesTower = _introFilesOrb = 0;
- _introFilesWdEntry = _introFilesKing = _introFilesHands = _introFilesWdExit = 0;
- _introFilesTunnel = _finBonusStrings = _npcStrings[1] = _npcStrings[2] = 0;
+ _turnUndeadString = 0;
+ _finBonusStrings = _npcStrings[1] = _npcStrings[2] = 0;
_npcStrings[3] = _npcStrings[4] = _npcStrings[5] = _npcStrings[6] = 0;
_npcStrings[7] = _npcStrings[8] = _npcStrings[9] = _npcStrings[10] = 0;
- _introOpeningFrmDelay = _introWdEncodeX = _introWdEncodeY = _introWdEncodeWH = 0;
- _npcShpData = _npcSubShpIndex1 = _npcSubShpIndex2 = _npcSubShpY = _introWdDsY = 0;
- _introTvlX1 = _introTvlY1 = _introTvlX2 = _introTvlY2 = _introTvlW = _introTvlH = 0;
+ _npcShpData = _npcSubShpIndex1 = _npcSubShpIndex2 = _npcSubShpY = 0;
_dscDoorScaleMult4 = _dscDoorScaleMult5 = _dscDoorScaleMult6 = _dscDoorY3 = 0;
_dscDoorY4 = _dscDoorY5 = _dscDoorY6 = _dscDoorY7 = _doorShapeEncodeDefs = 0;
_doorSwitchShapeEncodeDefs = _doorSwitchCoords = 0;
- _introWdDsX = 0;
_dscDoorCoordsExt = 0;
}
@@ -59,7 +55,8 @@ Common::Error EoBEngine::init() {
initStaticResource();
- _itemsOverlay = _res->fileData("ITEMRMP.VGA", 0);
+ if (_configRenderMode != Common::kRenderCGA)
+ _itemsOverlay = _res->fileData((_configRenderMode == Common::kRenderEGA) ? "ITEMRMP.EGA" : "ITEMRMP.VGA", 0);
_screen->modifyScreenDim(7, 0x01, 0xB3, 0x22, 0x12);
_screen->modifyScreenDim(9, 0x01, 0x7D, 0x26, 0x3F);
@@ -67,6 +64,14 @@ Common::Error EoBEngine::init() {
_scriptTimersCount = 1;
+ if (_configRenderMode == Common::kRenderEGA) {
+ Palette pal(16);
+ _screen->loadPalette(_egaDefaultPalette, pal, 16);
+ _screen->setScreenPalette(pal);
+ } else {
+ _screen->loadPalette("PALETTE.COL", _screen->getPalette(0));
+ }
+
return Common::kNoError;
}
@@ -77,6 +82,7 @@ void EoBEngine::startupNew() {
_currentBlock = 490;
_currentDirection = 0;
setHandItem(0);
+
EoBCoreEngine::startupNew();
}
@@ -138,7 +144,7 @@ void EoBEngine::drawNpcScene(int npcIndex) {
void EoBEngine::encodeDrawNpcSeqShape(int npcIndex, int drawX, int drawY) {
const uint8 *shpDef = &_npcShpData[npcIndex << 2];
_screen->_curPage = 2;
- const uint8 *shp = _screen->encodeShape(shpDef[0], shpDef[1], shpDef[2], shpDef[3]);
+ const uint8 *shp = _screen->encodeShape(shpDef[0], shpDef[1], shpDef[2], shpDef[3], false, _cgaMappingDefault);
_screen->_curPage = 0;
_screen->drawShape(0, shp, drawX - (shp[2] << 2), drawY - shp[1], 5);
delete[] shp;
@@ -326,7 +332,7 @@ void EoBEngine::replaceMonster(int unit, uint16 block, int pos, int dir, int typ
for (int i = 0; i < 30; i++) {
if (_monsters[i].hitPointsCur <= 0) {
- initMonster(i, unit, block, pos, dir, type, shpIndex, mode, h2, randItem, fixedItem);;
+ initMonster(i, unit, block, pos, dir, type, shpIndex, mode, h2, randItem, fixedItem);
break;
}
}
@@ -356,9 +362,9 @@ void EoBEngine::loadDoorShapes(int doorType1, int shapeId1, int doorType2, int s
if (doorType1 != 0xff) {
for (int i = 0; i < 3; i++) {
const uint8 *enc = &_doorShapeEncodeDefs[(doorType1 * 3 + i) << 2];
- _doorShapes[shapeId1 + i] = _screen->encodeShape(enc[0], enc[1], enc[2], enc[3]);
+ _doorShapes[shapeId1 + i] = _screen->encodeShape(enc[0], enc[1], enc[2], enc[3], false, (_flags.gameID == GI_EOB1) ? _cgaMappingLevel[_cgaLevelMappingIndex[_currentLevel - 1]] : 0);
enc = &_doorSwitchShapeEncodeDefs[(doorType1 * 3 + i) << 2];
- _doorSwitches[shapeId1 + i].shp = _screen->encodeShape(enc[0], enc[1], enc[2], enc[3]);
+ _doorSwitches[shapeId1 + i].shp = _screen->encodeShape(enc[0], enc[1], enc[2], enc[3], false, (_flags.gameID == GI_EOB1) ? _cgaMappingLevel[_cgaLevelMappingIndex[_currentLevel - 1]] : 0);
_doorSwitches[shapeId1 + i].x = _doorSwitchCoords[doorType1 * 6 + i * 2];
_doorSwitches[shapeId1 + i].y = _doorSwitchCoords[doorType1 * 6 + i * 2 + 1];
}
@@ -367,9 +373,9 @@ void EoBEngine::loadDoorShapes(int doorType1, int shapeId1, int doorType2, int s
if (doorType2 != 0xff) {
for (int i = 0; i < 3; i++) {
const uint8 *enc = &_doorShapeEncodeDefs[(doorType2 * 3 + i) << 2];
- _doorShapes[shapeId2 + i] = _screen->encodeShape(enc[0], enc[1], enc[2], enc[3]);
+ _doorShapes[shapeId2 + i] = _screen->encodeShape(enc[0], enc[1], enc[2], enc[3], false, (_flags.gameID == GI_EOB1) ? _cgaMappingLevel[_cgaLevelMappingIndex[_currentLevel - 1]] : 0);
enc = &_doorSwitchShapeEncodeDefs[(doorType2 * 3 + i) << 2];
- _doorSwitches[shapeId2 + i].shp = _screen->encodeShape(enc[0], enc[1], enc[2], enc[3]);
+ _doorSwitches[shapeId2 + i].shp = _screen->encodeShape(enc[0], enc[1], enc[2], enc[3], false, (_flags.gameID == GI_EOB1) ? _cgaMappingLevel[_cgaLevelMappingIndex[_currentLevel - 1]] : 0);
_doorSwitches[shapeId2 + i].x = _doorSwitchCoords[doorType2 * 6 + i * 2];
_doorSwitches[shapeId2 + i].y = _doorSwitchCoords[doorType2 * 6 + i * 2 + 1];
}
@@ -415,7 +421,7 @@ void EoBEngine::drawDoorIntern(int type, int index, int x, int y, int w, int wal
d1 = x - (_doorShapes[shapeIndex + 3][2] << 2);
x -= (shp[2] << 2);
drawBlockObject(0, 2, _doorShapes[shapeIndex + 3], d1, y, 5);
- scaleLevelShapesDim(index, y1, y2, 5);
+ setDoorShapeDim(index, y1, y2, 5);
y = _dscDoorY3[mDim] - ((wall < 30) ? (wall - _dscDoorScaleOffs[wall]) * _dscDoorScaleMult1[mDim] : _dscDoorScaleMult2[mDim]);
drawBlockObject(0, 2, shp, x, y, 5);
if (_wllShapeMap[wall] == -1)
@@ -548,7 +554,7 @@ void EoBEngine::healParty() {
}
const KyraRpgGUISettings *EoBEngine::guiSettings() {
- return &_guiSettings;
+ return (_configRenderMode == Common::kRenderCGA || _configRenderMode == Common::kRenderEGA) ? &_guiSettingsEGA : &_guiSettingsVGA;
}
} // End of namespace Kyra
diff --git a/engines/kyra/eob.h b/engines/kyra/eob.h
index ce71c76af4..37ce483702 100644
--- a/engines/kyra/eob.h
+++ b/engines/kyra/eob.h
@@ -31,6 +31,7 @@ namespace Kyra {
class EoBEngine : public EoBCoreEngine {
friend class GUI_EoB;
+friend class EoBIntroPlayer;
public:
EoBEngine(OSystem *system, const GameFlags &flags);
~EoBEngine();
@@ -51,46 +52,10 @@ private:
void startupLoad();
// Intro/Outro
- void seq_playOpeningCredits();
void seq_playIntro();
void seq_playFinale();
-
- void seq_tower();
- void seq_orb();
- void seq_waterdeepEntry();
- void seq_king();
- void seq_hands();
- void seq_waterdeepExit();
- void seq_tunnel();
-
void seq_xdeath();
- void loadSetIntroPalette(const char *filename);
- void copyBlurRegion(int x1, int y1, int x2, int y2, int w, int h, int step);
- void boxMorphTransition(int targetDestX, int targetDestY, int targetFinalX, int targetFinalY, int targetSrcX, int targetSrcY, int targetFinalW, int targetFinalH, int originX1, int originY1, int originW, int originH);
- void whirlTransition();
-
- const char *const *_introFilesOpening;
- const char *const *_introFilesTower;
- const char *const *_introFilesOrb;
- const char *const *_introFilesWdEntry;
- const char *const *_introFilesKing;
- const char *const *_introFilesHands;
- const char *const *_introFilesWdExit;
- const char *const *_introFilesTunnel;
- const uint8 *_introOpeningFrmDelay;
- const uint8 *_introWdEncodeX;
- const uint8 *_introWdEncodeY;
- const uint8 *_introWdEncodeWH;
- const uint16 *_introWdDsX;
- const uint8 *_introWdDsY;
- const uint8 *_introTvlX1;
- const uint8 *_introTvlY1;
- const uint8 *_introTvlX2;
- const uint8 *_introTvlY2;
- const uint8 *_introTvlW;
- const uint8 *_introTvlH;
-
const char *const *_finBonusStrings;
// characters
@@ -143,7 +108,9 @@ private:
const KyraRpgGUISettings *guiSettings();
- static const KyraRpgGUISettings _guiSettings;
+ static const KyraRpgGUISettings _guiSettingsVGA;
+ static const KyraRpgGUISettings _guiSettingsEGA;
+ static const uint8 _egaDefaultPalette[];
};
diff --git a/engines/kyra/eobcommon.cpp b/engines/kyra/eobcommon.cpp
index e45bad6d72..ff53ba8b0a 100644
--- a/engines/kyra/eobcommon.cpp
+++ b/engines/kyra/eobcommon.cpp
@@ -47,6 +47,7 @@ EoBCoreEngine::EoBCoreEngine(OSystem *system, const GameFlags &flags)
_numThrownItemShapes(flags.gameID == GI_EOB1 ? 12 : 9),
_numItemIconShapes(flags.gameID == GI_EOB1 ? 89 : 112),
_teleporterWallId(flags.gameID == GI_EOB1 ? 52 : 44) {
+
_screen = 0;
_gui = 0;
_debugger = 0;
@@ -64,7 +65,6 @@ EoBCoreEngine::EoBCoreEngine(OSystem *system, const GameFlags &flags)
_itemIconShapes = _wallOfForceShapes = _teleporterShapes = _sparkShapes = _compassShapes = 0;
_redSplatShape = _greenSplatShape = _deadCharShape = _disabledCharGrid = 0;
_blackBoxSmallGrid = _weaponSlotGrid = _blackBoxWideGrid = _lightningColumnShape = 0;
- _tempIconShape = 0;
_monsterDustStrings = 0;
_enemyMageSpellList = 0;
@@ -92,7 +92,7 @@ EoBCoreEngine::EoBCoreEngine(OSystem *system, const GameFlags &flags)
_doorSwitches = 0;
_monsterProps = 0;
_monsterDecorations = 0;
- _monsterOvl1 = _monsterOvl2 = 0;
+ _monsterFlashOverlay = _monsterStoneOverlay = 0;
_monsters = 0;
_dstMonsterIndex = 0;
_preventMonsterFlash = false;
@@ -148,6 +148,7 @@ EoBCoreEngine::EoBCoreEngine(OSystem *system, const GameFlags &flags)
_clericSpellOffset = 0;
_restPartyElapsedTime = 0;
_allowSkip = false;
+ _allowImport = false;
_wallsOfForce = 0;
@@ -200,6 +201,7 @@ EoBCoreEngine::EoBCoreEngine(OSystem *system, const GameFlags &flags)
_coneOfColdDest1 = _coneOfColdDest2 = _coneOfColdDest3 = _coneOfColdDest4 = 0;
_coneOfColdGfxTblSize = 0;
_menuButtonDefs = 0;
+ _updateCharNum = 0;
_menuStringsMain = _menuStringsSaveLoad = _menuStringsOnOff = _menuStringsSpells = 0;
_menuStringsRest = _menuStringsDrop = _menuStringsExit = _menuStringsStarve = 0;
_menuStringsScribe = _menuStringsDrop2 = _menuStringsHead = _menuStringsPoison = 0;
@@ -210,6 +212,8 @@ EoBCoreEngine::EoBCoreEngine(OSystem *system, const GameFlags &flags)
_spellLevelsMage = _spellLevelsCleric = _numSpellsCleric = _numSpellsWisAdj = _numSpellsPal = _numSpellsMage = 0;
_mnNumWord = _numSpells = _mageSpellListSize = _spellLevelsMageSize = _spellLevelsClericSize = 0;
_inventorySlotsX = _slotValidationFlags = _encodeMonsterShpTable = 0;
+ _cgaMappingDefault = _cgaMappingAlt = _cgaMappingInv = _cgaLevelMappingIndex = _cgaMappingItemsL = _cgaMappingItemsS = _cgaMappingThrown = _cgaMappingIcons = _cgaMappingDeco = 0;
+ memset(_cgaMappingLevel, 0, sizeof(_cgaMappingLevel));
memset(_expRequirementTables, 0, sizeof(_expRequirementTables));
memset(_saveThrowTables, 0, sizeof(_saveThrowTables));
memset(_doorType, 0, sizeof(_doorType));
@@ -266,8 +270,8 @@ EoBCoreEngine::~EoBCoreEngine() {
delete[] _itemNames;
delete[] _flyingObjects;
- delete[] _monsterOvl1;
- delete[] _monsterOvl2;
+ delete[] _monsterFlashOverlay;
+ delete[] _monsterStoneOverlay;
delete[] _monsters;
if (_monsterDecorations) {
@@ -344,12 +348,12 @@ void EoBCoreEngine::initKeymap() {
};
for (uint i = 0; i < ARRAYSIZE(keyActionEntries); ++i) {
- Common::Action *const act = new Common::Action(engineKeyMap, keyActionEntries[i].id, keyActionEntries[i].description, Common::kGenericActionType, Common::kActionKeyType);
+ Common::Action *const act = new Common::Action(engineKeyMap, keyActionEntries[i].id, keyActionEntries[i].description);
act->addKeyEvent(keyActionEntries[i].ks);
}
if (_flags.gameID == GI_EOB2) {
- Common::Action *const act = new Common::Action(engineKeyMap, "SL6", _("Spell Level 6"), Common::kGenericActionType, Common::kActionKeyType);
+ Common::Action *const act = new Common::Action(engineKeyMap, "SL6", _("Spell Level 6"));
act->addKeyEvent(Common::KeyState(Common::KEYCODE_6));
}
@@ -362,16 +366,19 @@ Common::Error EoBCoreEngine::init() {
// This makes a tick length of 54.94.
_tickLength = 55;
+ if (ConfMan.hasKey("render_mode"))
+ _configRenderMode = Common::parseRenderMode(ConfMan.get("render_mode"));
+
_screen = new Screen_EoB(this, _system);
assert(_screen);
- _screen->setResolution();
+ _screen->setResolution(_flags.useHiResOverlay || (_flags.gameID == GI_EOB2 && _configRenderMode == Common::kRenderEGA));
//MidiDriverType midiDriver = MidiDriver::detectDevice(MDT_PCSPK | MDT_ADLIB);
_sound = new SoundAdLibPC(this, _mixer);
assert(_sound);
_sound->init();
- // Setup volume settings
+ // Setup volume settings (and read in all ConfigManager settings)
syncSoundSettings();
_res = new Resource(this);
@@ -383,7 +390,7 @@ Common::Error EoBCoreEngine::init() {
if (!_staticres->init())
error("_staticres->init() failed");
- if (!screen()->init())
+ if (!_screen->init(_flags.gameID == GI_EOB2 && _configRenderMode == Common::kRenderEGA))
error("screen()->init() failed");
if (ConfMan.hasKey("save_slot")) {
@@ -475,11 +482,11 @@ Common::Error EoBCoreEngine::init() {
_doorSwitches = new SpriteDecoration[6];
memset(_doorSwitches, 0, 6 * sizeof(SpriteDecoration));
- _monsterOvl1 = new uint8[16];
- _monsterOvl2 = new uint8[16];
- memset(_monsterOvl1, 15, 16 * sizeof(uint8));
- memset(_monsterOvl2, 13, 16 * sizeof(uint8));
- _monsterOvl1[0] = _monsterOvl2[0] = 0;
+ _monsterFlashOverlay = new uint8[16];
+ _monsterStoneOverlay = new uint8[16];
+ memset(_monsterFlashOverlay, (_configRenderMode == Common::kRenderCGA) ? 0xff : 0x0f, 16 * sizeof(uint8));
+ memset(_monsterStoneOverlay, 0x0d, 16 * sizeof(uint8));
+ _monsterFlashOverlay[0] = _monsterStoneOverlay[0] = 0;
// Prevent autosave on game startup
_lastAutosave = _system->getMillis();
@@ -492,14 +499,22 @@ Common::Error EoBCoreEngine::init() {
}
Common::Error EoBCoreEngine::go() {
+ _debugger->initialize();
+
_txt->removePageBreakFlag();
- _screen->loadPalette("palette.col", _screen->getPalette(0));
- _screen->setScreenPalette(_screen->getPalette(0));
+
_screen->setFont(Screen::FID_8_FNT);
loadItemsAndDecorationsShapes();
_screen->setMouseCursor(0, 0, _itemIconShapes[0]);
+ // Import original save game files (especially the "Quick Start Party")
+ if (ConfMan.getBool("importOrigSaves")) {
+ importOriginalSaveFile(-1);
+ ConfMan.setBool("importOrigSaves", false);
+ ConfMan.flushToDisk();
+ }
+
loadItemDefs();
int action = 0;
@@ -550,6 +565,7 @@ Common::Error EoBCoreEngine::go() {
void EoBCoreEngine::registerDefaultSettings() {
KyraEngine_v1::registerDefaultSettings();
ConfMan.registerDefault("hpbargraphs", true);
+ ConfMan.registerDefault("importOrigSaves", true);
}
void EoBCoreEngine::readSettings() {
@@ -649,44 +665,42 @@ bool EoBCoreEngine::checkPartyStatus(bool handleDeath) {
void EoBCoreEngine::loadItemsAndDecorationsShapes() {
releaseItemsAndDecorationsShapes();
- _screen->setCurPage(2);
- _screen->loadBitmap("ITEML1.CPS", 5, 3, 0);
+ _screen->loadShapeSetBitmap("ITEML1", 5, 3);
_largeItemShapes = new const uint8*[_numLargeItemShapes];
int div = (_flags.gameID == GI_EOB1) ? 3 : 8;
int mul = (_flags.gameID == GI_EOB1) ? 64 : 24;
for (int i = 0; i < _numLargeItemShapes; i++)
- _largeItemShapes[i] = _screen->encodeShape((i / div) << 3, (i % div) * mul, 8, 24);
+ _largeItemShapes[i] = _screen->encodeShape((i / div) << 3, (i % div) * mul, 8, 24, false, _cgaMappingItemsL);
- _screen->loadBitmap("ITEMS1.CPS", 5, 3, 0);
+ _screen->loadShapeSetBitmap("ITEMS1", 5, 3);
_smallItemShapes = new const uint8*[_numSmallItemShapes];
for (int i = 0; i < _numSmallItemShapes; i++)
- _smallItemShapes[i] = _screen->encodeShape((i / div) << 2, (i % div) * mul, 4, 24);
+ _smallItemShapes[i] = _screen->encodeShape((i / div) << 2, (i % div) * mul, 4, 24, false, _cgaMappingItemsS);
- _screen->loadBitmap("THROWN.CPS", 5, 3, 0);
+ _screen->loadShapeSetBitmap("THROWN", 5, 3);
_thrownItemShapes = new const uint8*[_numThrownItemShapes];
for (int i = 0; i < _numThrownItemShapes; i++)
- _thrownItemShapes[i] = _screen->encodeShape((i / div) << 2, (i % div) * mul, 4, 24);
+ _thrownItemShapes[i] = _screen->encodeShape((i / div) << 2, (i % div) * mul, 4, 24, false, _cgaMappingThrown);
_spellShapes = new const uint8*[4];
for (int i = 0; i < 4; i++)
- _spellShapes[i] = _screen->encodeShape(8, i << 5, 6, 32);
+ _spellShapes[i] = _screen->encodeShape(8, i << 5, 6, 32, false, _cgaMappingThrown);
_firebeamShapes = new const uint8*[3];
- _firebeamShapes[0] = _screen->encodeShape(16, 0, 4, 24);
- _firebeamShapes[1] = _screen->encodeShape(16, 24, 4, 24);
- _firebeamShapes[2] = _screen->encodeShape(16, 48, 3, 24);
- _redSplatShape = _screen->encodeShape(16, _flags.gameID == GI_EOB1 ? 144 : 72, 5, 24);
- _greenSplatShape = _screen->encodeShape(16, _flags.gameID == GI_EOB1 ? 168 : 96, 5, 16);
+ _firebeamShapes[0] = _screen->encodeShape(16, 0, 4, 24, false, _cgaMappingThrown);
+ _firebeamShapes[1] = _screen->encodeShape(16, 24, 4, 24, false, _cgaMappingThrown);
+ _firebeamShapes[2] = _screen->encodeShape(16, 48, 3, 24, false, _cgaMappingThrown);
+ _redSplatShape = _screen->encodeShape(16, _flags.gameID == GI_EOB1 ? 144 : 72, 5, 24, false, _cgaMappingThrown);
+ _greenSplatShape = _screen->encodeShape(16, _flags.gameID == GI_EOB1 ? 168 : 96, 5, 16, false, _cgaMappingThrown);
- _screen->loadBitmap("ITEMICN.CPS", 5, 3, 0);
+ _screen->loadShapeSetBitmap("ITEMICN", 5, 3);
_itemIconShapes = new const uint8*[_numItemIconShapes];
for (int i = 0; i < _numItemIconShapes; i++)
- _itemIconShapes[i] = _screen->encodeShape((i % 0x14) << 1, (i / 0x14) << 4, 2, 0x10);
- _tempIconShape = new uint8[300];
+ _itemIconShapes[i] = _screen->encodeShape((i % 0x14) << 1, (i / 0x14) << 4, 2, 0x10, false, _cgaMappingIcons);
- _screen->loadBitmap("DECORATE.CPS", 5, 3, 0);
+ _screen->loadShapeSetBitmap("DECORATE", 5, 3);
if (_flags.gameID == GI_EOB2) {
_lightningColumnShape = _screen->encodeShape(18, 88, 4, 64);
@@ -697,16 +711,16 @@ void EoBCoreEngine::loadItemsAndDecorationsShapes() {
_teleporterShapes = new const uint8*[6];
for (int i = 0; i < 6; i++)
- _teleporterShapes[i] = _screen->encodeShape(_teleporterShapeDefs[(i << 2)], _teleporterShapeDefs[(i << 2) + 1], _teleporterShapeDefs[(i << 2) + 2], _teleporterShapeDefs[(i << 2) + 3]);
+ _teleporterShapes[i] = _screen->encodeShape(_teleporterShapeDefs[(i << 2)], _teleporterShapeDefs[(i << 2) + 1], _teleporterShapeDefs[(i << 2) + 2], _teleporterShapeDefs[(i << 2) + 3], false, _cgaMappingDefault);
_sparkShapes = new const uint8*[3];
- _sparkShapes[0] = _screen->encodeShape(29, 0, 2, 16);
- _sparkShapes[1] = _screen->encodeShape(31, 0, 2, 16);
- _sparkShapes[2] = _screen->encodeShape(33, 0, 2, 16);
- _deadCharShape = _screen->encodeShape(0, 88, 4, 32);
- _disabledCharGrid = _screen->encodeShape(4, 88, 4, 32);
- _blackBoxSmallGrid = _screen->encodeShape(9, 88, 2, 8);
- _weaponSlotGrid = _screen->encodeShape(8, 88, 4, 16);
- _blackBoxWideGrid = _screen->encodeShape(8, 104, 4, 8);
+ _sparkShapes[0] = _screen->encodeShape(29, 0, 2, 16, false, _cgaMappingDeco);
+ _sparkShapes[1] = _screen->encodeShape(31, 0, 2, 16, false, _cgaMappingDeco);
+ _sparkShapes[2] = _screen->encodeShape(33, 0, 2, 16, false, _cgaMappingDeco);
+ _deadCharShape = _screen->encodeShape(0, 88, 4, 32, false, _cgaMappingDeco);
+ _disabledCharGrid = _screen->encodeShape(4, 88, 4, 32, false, _cgaMappingDeco);
+ _blackBoxSmallGrid = _screen->encodeShape(9, 88, 2, 8, false, _cgaMappingDeco);
+ _weaponSlotGrid = _screen->encodeShape(8, 88, 4, 16, false, _cgaMappingDeco);
+ _blackBoxWideGrid = _screen->encodeShape(8, 104, 4, 8, false, _cgaMappingDeco);
static const uint8 dHeight[] = { 17, 10, 10 };
static const uint8 dY[] = { 120, 137, 147 };
@@ -714,7 +728,7 @@ void EoBCoreEngine::loadItemsAndDecorationsShapes() {
_compassShapes = new const uint8*[12];
for (int y = 0; y < 3; y++) {
for (int x = 0; x < 4; x++)
- _compassShapes[(y << 2) + x] = _screen->encodeShape(x * 3, dY[y], 3, dHeight[y]);
+ _compassShapes[(y << 2) + x] = _screen->encodeShape(x * 3, dY[y], 3, dHeight[y], false, _cgaMappingDeco);
}
}
@@ -758,7 +772,6 @@ void EoBCoreEngine::releaseItemsAndDecorationsShapes() {
}
delete[] _itemIconShapes;
}
- delete[] _tempIconShape;
if (_sparkShapes) {
for (int i = 0; i < 3; i++) {
@@ -822,18 +835,13 @@ void EoBCoreEngine::setHandItem(Item itemIndex) {
_itemInHand = itemIndex;
int icon = _items[_itemInHand].icon;
const uint8 *shp = _itemIconShapes[icon];
+ const uint8 *ovl = 0;
- if (icon && (_items[_itemInHand].flags & 0x80) && (_partyEffectFlags & 2)) {
- memcpy(_tempIconShape, shp, shp[1] * shp[2] * 4 + 20);
- if (_flags.gameID == GI_EOB1)
- _screen->replaceShapePalette(_tempIconShape, &_itemsOverlay[icon << 4]);
- else
- _screen->applyShapeOverlay(_tempIconShape, 3);
- shp = _tempIconShape;
- }
+ if (icon && (_items[_itemInHand].flags & 0x80) && (_partyEffectFlags & 2))
+ ovl = _flags.gameID == GI_EOB1 ? ((_configRenderMode == Common::kRenderCGA) ? _itemsOverlayCGA : &_itemsOverlay[icon << 4]) : _screen->generateShapeOverlay(shp, 3);
int mouseOffs = itemIndex ? 8 : 0;
- _screen->setMouseCursor(mouseOffs, mouseOffs, shp);
+ _screen->setMouseCursor(mouseOffs, mouseOffs, shp, ovl);
}
int EoBCoreEngine::getDexterityArmorClassModifier(int dexterity) {
@@ -912,7 +920,7 @@ Common::String EoBCoreEngine::getCharStrength(int str, int strExt) {
return _strenghtStr;
}
-int EoBCoreEngine::testCharacter(int index, int flags) {
+int EoBCoreEngine::testCharacter(int16 index, int flags) {
if (index == -1)
return 0;
@@ -1185,7 +1193,7 @@ void EoBCoreEngine::initNpc(int npcIndex) {
_screen->loadShapeSetBitmap(_flags.gameID == GI_EOB2 ? "OUTPORTS" : "OUTTAKE", 3, 3);
_screen->_curPage = 2;
- c->faceShape = _screen->encodeShape(npcIndex << 2, _flags.gameID == GI_EOB2 ? 0 : 160, 4, 32, true);
+ c->faceShape = _screen->encodeShape(npcIndex << 2, _flags.gameID == GI_EOB2 ? 0 : 160, 4, 32, true, _cgaMappingDefault);
_screen->_curPage = 0;
}
@@ -1667,13 +1675,13 @@ void EoBCoreEngine::seq_portal() {
_screen->loadShapeSetBitmap("PORTALA", 5, 3);
for (int i = 0; i < 5; i++) {
- shapes1[i] = _screen->encodeShape(i * 3, 0, 3, 75);
- shapes2[i] = _screen->encodeShape(i * 3, 80, 3, 75);
- shapes3[i] = _screen->encodeShape(15, i * 18, 15, 18);
+ shapes1[i] = _screen->encodeShape(i * 3, 0, 3, 75, false, _cgaMappingDefault);
+ shapes2[i] = _screen->encodeShape(i * 3, 80, 3, 75, false, _cgaMappingDefault);
+ shapes3[i] = _screen->encodeShape(15, i * 18, 15, 18, false, _cgaMappingDefault);
}
- shape0 = _screen->encodeShape(30, 0, 8, 77);
- _screen->loadEoBBitmap("PORTALB", 0, 5, 3, 2);
+ shape0 = _screen->encodeShape(30, 0, 8, 77, false, _cgaMappingDefault);
+ _screen->loadEoBBitmap("PORTALB", _cgaMappingDefault, 5, 3, 2);
snd_playSoundEffect(33);
snd_playSoundEffect(19);
@@ -1730,7 +1738,7 @@ void EoBCoreEngine::seq_portal() {
bool EoBCoreEngine::checkPassword() {
char answ[20];
Screen::FontId of = _screen->setFont(Screen::FID_8_FNT);
- _screen->copyPage(0, 10);
+ _screen->copyPage(0, (_screen->getPageScaleFactor(0) == 2) ? 4 : 10);
_screen->setScreenDim(13);
gui_drawBox(_screen->_curDim->sx << 3, _screen->_curDim->sy, _screen->_curDim->w << 3, _screen->_curDim->h, guiSettings()->colors.frame1, guiSettings()->colors.frame2, -1);
@@ -1757,7 +1765,7 @@ bool EoBCoreEngine::checkPassword() {
_screen->modifyScreenDim(13, _screen->_curDim->sx - 1, _screen->_curDim->sy - 2, _screen->_curDim->w + 2, _screen->_curDim->h + 16);
_screen->setFont(of);
- _screen->copyPage(10, 0);
+ _screen->copyPage((_screen->getPageScaleFactor(0) == 2) ? 4 : 10, 0);
return true;
}
diff --git a/engines/kyra/eobcommon.h b/engines/kyra/eobcommon.h
index 851c52076b..38be2a64e8 100644
--- a/engines/kyra/eobcommon.h
+++ b/engines/kyra/eobcommon.h
@@ -31,7 +31,7 @@
namespace Kyra {
-struct EoBShapeDef {
+struct DarkMoonShapeDef {
int16 index;
uint8 x, y, w, h;
};
@@ -242,6 +242,7 @@ class EoBInfProcessor;
class EoBCoreEngine : public KyraRpgEngine {
friend class TextDisplayer_rpg;
friend class GUI_EoB;
+friend class Debugger_EoB;
friend class EoBInfProcessor;
friend class DarkmoonSequenceHelper;
friend class CharacterGenerator;
@@ -301,8 +302,8 @@ protected:
const uint8 *_blackBoxWideGrid;
const uint8 *_lightningColumnShape;
- uint8 *_tempIconShape;
uint8 *_itemsOverlay;
+ static const uint8 _itemsOverlayCGA[];
static const uint8 _teleporterShapeDefs[];
static const uint8 _wallOfForceShapeDefs[];
@@ -365,7 +366,7 @@ protected:
int getCharacterClassType(int cclass, int levelIndex);
int getModifiedHpLimits(int hpModifier, int constModifier, int level, bool mode);
Common::String getCharStrength(int str, int strExt);
- int testCharacter(int index, int flags);
+ int testCharacter(int16 index, int flags);
int getNextValidCharIndex(int curCharIndex, int searchStep);
void recalcArmorClass(int index);
@@ -527,8 +528,8 @@ protected:
void updateMonstersSpellStatus(EoBMonsterInPlay *m);
void setBlockMonsterDirection(int block, int dir);
- uint8 *_monsterOvl1;
- uint8 *_monsterOvl2;
+ uint8 *_monsterFlashOverlay;
+ uint8 *_monsterStoneOverlay;
SpriteDecoration *_monsterDecorations;
EoBMonsterProperty *_monsterProps;
@@ -573,11 +574,13 @@ protected:
// Level
void loadLevel(int level, int sub);
+ void readLevelFileData(int level);
Common::String initLevelData(int sub);
void addLevelItems();
- void loadVcnData(const char *file, const char * /*nextFile*/);
+ void loadVcnData(const char *file, const uint8 *cgaMapping);
void loadBlockProperties(const char *mazFile);
- const uint8 *getBlockFileData(int levelIndex);
+ const uint8 *getBlockFileData(int levelIndex = 0);
+ Common::String getBlockFileName(int levelIndex, int sub);
const uint8 *getBlockFileData(const char *mazFile);
void loadDecorations(const char *cpsFile, const char *decFile);
void assignWallsAndDecorations(int wallIndex, int vmpIndex, int decDataIndex, int specialType, int flags);
@@ -620,7 +623,7 @@ protected:
uint32 _envAudioTimer;
uint16 _teleporterPulse;
- Common::Array<const int16*> _dscWallMapping;
+ Common::Array<const int16 *> _dscWallMapping;
const int16 *_dscShapeCoords;
const uint8 *_dscItemPosIndex;
@@ -831,6 +834,21 @@ protected:
Common::Error loadGameState(int slot);
Common::Error saveGameStateIntern(int slot, const char *saveName, const Graphics::Surface *thumbnail);
+ const uint8 *_cgaMappingDefault;
+ const uint8 *_cgaMappingAlt;
+ const uint8 *_cgaMappingInv;
+ const uint8 *_cgaMappingItemsL;
+ const uint8 *_cgaMappingItemsS;
+ const uint8 *_cgaMappingThrown;
+ const uint8 *_cgaMappingIcons;
+ const uint8 *_cgaMappingDeco;
+ const uint8 *_cgaMappingLevel[5];
+ const uint8 *_cgaLevelMappingIndex;
+
+ // Default parameters will import all present original save files and push them to the top of the save dialog.
+ bool importOriginalSaveFile(int destSlot, const char *sourceFile = 0);
+ Common::String readOriginalSaveFile(Common::String &file);
+
void *generateMonsterTempData(LevelTempData *tmp);
void restoreMonsterTempData(LevelTempData *tmp);
void releaseMonsterTempData(LevelTempData *tmp);
@@ -850,6 +868,7 @@ protected:
int8 _rrId[10];
bool _allowSkip;
+ bool _allowImport;
Screen_EoB *_screen;
GUI_EoB *_gui;
@@ -937,11 +956,11 @@ protected:
void printNoEffectWarning();
void spellCallback_start_empty() {}
- bool spellCallback_end_empty(void*) { return true; }
+ bool spellCallback_end_empty(void *) { return true; }
void spellCallback_start_armor();
void spellCallback_start_burningHands();
void spellCallback_start_detectMagic();
- bool spellCallback_end_detectMagic(void*);
+ bool spellCallback_end_detectMagic(void *);
void spellCallback_start_magicMissile();
bool spellCallback_end_magicMissile(void *obj);
void spellCallback_start_shockingGrasp();
@@ -973,7 +992,7 @@ protected:
void spellCallback_start_fleshToStone();
void spellCallback_start_stoneToFlesh();
void spellCallback_start_trueSeeing();
- bool spellCallback_end_trueSeeing(void*);
+ bool spellCallback_end_trueSeeing(void *);
void spellCallback_start_slayLiving();
void spellCallback_start_powerWordStun();
void spellCallback_start_causeLightWounds();
diff --git a/engines/kyra/gui.cpp b/engines/kyra/gui.cpp
index 9e08ae0fb9..1156b17957 100644
--- a/engines/kyra/gui.cpp
+++ b/engines/kyra/gui.cpp
@@ -56,7 +56,7 @@ void GUI::updateSaveFileList(Common::String targetName, bool excludeQuickSaves)
s1 = (*i)[i->size() - 3];
s2 = (*i)[i->size() - 2];
s3 = (*i)[i->size() - 1];
- if (!isdigit(static_cast<unsigned char>(s1)) || !isdigit(static_cast<unsigned char>(s2)) || !isdigit(static_cast<unsigned char>(s3)))
+ if (!Common::isDigit(s1) || !Common::isDigit(s2) || !Common::isDigit(s3))
continue;
s1 -= '0';
s2 -= '0';
diff --git a/engines/kyra/gui_eob.cpp b/engines/kyra/gui_eob.cpp
index d60fa47571..eadfd10d1e 100644
--- a/engines/kyra/gui_eob.cpp
+++ b/engines/kyra/gui_eob.cpp
@@ -29,6 +29,7 @@
#include "kyra/timer.h"
#include "kyra/util.h"
+#include "backends/keymapper/keymapper.h"
#include "common/system.h"
#include "common/savefile.h"
#include "graphics/scaler.h"
@@ -46,7 +47,7 @@ Button *EoBCoreEngine::gui_getButton(Button *buttonList, int index) {
}
void EoBCoreEngine::gui_drawPlayField(bool refresh) {
- _screen->loadEoBBitmap("PLAYFLD", 0, 5, 3, 2);
+ _screen->loadEoBBitmap("PLAYFLD", _cgaMappingDeco, 5, 3, 2);
int cp = _screen->setCurPage(2);
gui_drawCompass(true);
@@ -59,11 +60,11 @@ void EoBCoreEngine::gui_drawPlayField(bool refresh) {
if (!_loading)
_screen->updateScreen();
- _screen->loadEoBBitmap("INVENT", 0, 5, 3, 2);
+ _screen->loadEoBBitmap("INVENT", _cgaMappingInv, 5, 3, 2);
}
void EoBCoreEngine::gui_restorePlayField() {
- loadVcnData(0, 0);
+ loadVcnData(0, (_flags.gameID == GI_EOB1) ? _cgaMappingLevel[_cgaLevelMappingIndex[_currentLevel - 1]] : 0);
_screen->_curPage = 0;
gui_drawPlayField(true);
gui_drawAllCharPortraitsWithStats();
@@ -115,7 +116,7 @@ void EoBCoreEngine::gui_drawCharPortraitWithStats(int index) {
if (c->damageTaken > 0) {
_screen->drawShape(2, _redSplatShape, x2 + 13, y2 + 30, 0);
Common::String tmpStr = Common::String::format("%d", c->damageTaken);
- _screen->printText(tmpStr.c_str(), x2 + 34 - tmpStr.size() * 3, y2 + 42, 15, 0);
+ _screen->printText(tmpStr.c_str(), x2 + 34 - tmpStr.size() * 3, y2 + 42, (_configRenderMode == Common::kRenderCGA) ? 12 : 15, 0);
}
_screen->setCurPage(cp);
@@ -255,10 +256,8 @@ void EoBCoreEngine::gui_drawFaceShape(int index) {
if (c->hitPointsCur < 1)
_screen->drawShape(_screen->_curPage, _disabledCharGrid, x, y, 0);
- //if ((c->flags & 2) || (c->flags & 8) || (c->effectFlags & 0x140)) {
- _screen->setFadeTableIndex(4);
- _screen->setShapeFadeMode(1, false);
- //}
+ _screen->setFadeTableIndex(4);
+ _screen->setShapeFadeMode(1, false);
}
void EoBCoreEngine::gui_drawWeaponSlot(int charIndex, int slot) {
@@ -284,7 +283,7 @@ void EoBCoreEngine::gui_drawWeaponSlot(int charIndex, int slot) {
else if (!slot && _flags.gameID == GI_EOB2 && checkScriptFlags(0x80000000))
_screen->drawShape(_screen->_curPage, _itemIconShapes[103], x + 8, y, 0);
else
- _screen->drawShape(_screen->_curPage, _itemIconShapes[85], x + 8, y, 0);
+ _screen->drawShape(_screen->_curPage, _itemIconShapes[85 + slot], x + 8, y, 0);
if ((_characters[charIndex].disabledSlots & (1 << slot)) || !validateWeaponSlotItem(charIndex, slot) || (_characters[charIndex].hitPointsCur <= 0) || (_characters[charIndex].flags & 0x0c))
_screen->drawShape(_screen->_curPage, _weaponSlotGrid, x, y, 0);
@@ -322,11 +321,13 @@ void EoBCoreEngine::gui_drawWeaponSlotStatus(int x, int y, int status) {
break;
}
+ int textColor= (_configRenderMode == Common::kRenderCGA) ? 2 : 15;
+
if (!tmpStr2.empty()) {
- _screen->printText(tmpStr.c_str(), x + (16 - tmpStr.size() * 3), y + 2, 15, 0);
- _screen->printText(tmpStr2.c_str(), x + (16 - tmpStr.size() * 3), y + 9, 15, 0);
+ _screen->printText(tmpStr.c_str(), x + (16 - tmpStr.size() * 3), y + 2, textColor, 0);
+ _screen->printText(tmpStr2.c_str(), x + (16 - tmpStr.size() * 3), y + 9, textColor, 0);
} else {
- _screen->printText(tmpStr.c_str(), x + (16 - tmpStr.size() * 3), y + 5, 15, 0);
+ _screen->printText(tmpStr.c_str(), x + (16 - tmpStr.size() * 3), y + 5, textColor, 0);
}
}
@@ -407,12 +408,13 @@ void EoBCoreEngine::gui_drawHorizontalBarGraph(int x, int y, int w, int h, int32
}
void EoBCoreEngine::gui_drawCharPortraitStatusFrame(int index) {
- uint8 redGreenColor = (_partyEffectFlags & 0x20000) ? 4 : 6;
+ uint8 redGreenColor = (_partyEffectFlags & 0x20000) ? 4 : ((_configRenderMode == Common::kRenderCGA) ? 3 : 6);
static const uint8 xCoords[] = { 8, 80 };
static const uint8 yCoords[] = { 2, 54, 106 };
int x = xCoords[index & 1];
int y = yCoords[index >> 1];
+ int xOffset = (_configRenderMode == Common::kRenderCGA) ? 0 : 1;
if (!_screen->_curPage)
x += 176;
@@ -466,7 +468,7 @@ void EoBCoreEngine::gui_drawCharPortraitStatusFrame(int index) {
} else {
_screen->drawClippedLine(x, y, x + 62, y, guiSettings()->colors.frame2);
_screen->drawClippedLine(x, y + 49, x + 62, y + 49, guiSettings()->colors.frame1);
- _screen->drawClippedLine(x - 1, y, x - 1, y + 50, 12);
+ _screen->drawClippedLine(x - xOffset, y, x - xOffset, y + 50, 12);
_screen->drawClippedLine(x + 63, y, x + 63, y + 50, 12);
}
}
@@ -480,7 +482,15 @@ void EoBCoreEngine::gui_drawInventoryItem(int slot, int special, int pageNum) {
if (special) {
int wh = (slot == 25 || slot == 26) ? 10 : 18;
- gui_drawBox(x - 1, y - 1, wh, wh, guiSettings()->colors.frame1, guiSettings()->colors.frame2, slot == 16 ? -1 : guiSettings()->colors.fill);
+
+ uint8 col1 = guiSettings()->colors.frame1;
+ uint8 col2 = guiSettings()->colors.frame2;
+ if (_configRenderMode == Common::kRenderCGA ) {
+ col1 = 1;
+ col2 = 3;
+ }
+
+ gui_drawBox(x - 1, y - 1, wh, wh, col1, col2, slot == 16 ? -1 : guiSettings()->colors.fill);
if (slot == 16) {
_screen->fillRect(227, 65, 238, 69, 12);
@@ -527,14 +537,26 @@ void EoBCoreEngine::gui_drawSpellbook() {
_screen->copyRegion(64, 121, 64, 121, 112, 56, 0, 2, Screen::CR_NO_P_CHECK);
for (int i = 0; i < numTab; i++) {
- int col1 = guiSettings()->colors.inactiveTabFrame1;
- int col2 = guiSettings()->colors.inactiveTabFrame2;
- int col3 = guiSettings()->colors.inactiveTabFill;
-
- if (i == _openBookSpellLevel) {
- col1 = guiSettings()->colors.frame1;
- col2 = guiSettings()->colors.frame2;
- col3 = guiSettings()->colors.fill;
+ int col1 = 0;
+ int col2 = 1;
+ int col3 = 2;
+
+ if (_configRenderMode == Common::kRenderCGA) {
+ if (i == _openBookSpellLevel) {
+ col1 = 1;
+ col2 = 2;
+ col3 = 3;
+ }
+ } else {
+ col1 = guiSettings()->colors.inactiveTabFrame1;
+ col2 = guiSettings()->colors.inactiveTabFrame2;
+ col3 = guiSettings()->colors.inactiveTabFill;
+
+ if (i == _openBookSpellLevel) {
+ col1 = guiSettings()->colors.frame1;
+ col2 = guiSettings()->colors.frame2;
+ col3 = guiSettings()->colors.fill;
+ }
}
if (_flags.gameID == GI_EOB1) {
@@ -557,19 +579,21 @@ void EoBCoreEngine::gui_drawSpellbook() {
gui_drawSpellbookScrollArrow(165, 169, 1);
}
- int textCol1 = 15;
+ int textCol1 = (_configRenderMode == Common::kRenderCGA) ? 3 : 15;
int textCol2 = 8;
int textXa = 74;
int textXs = 71;
int textY = 170;
- int col3 = guiSettings()->colors.fill;
+ int col3 = (_configRenderMode == Common::kRenderCGA) ? 2 : guiSettings()->colors.fill;
int col4 = guiSettings()->colors.extraFill;
+ int col5 = 12;
if (_flags.gameID == GI_EOB1) {
- textCol2 = 11;
+ textCol2 = (_configRenderMode == Common::kRenderCGA) ? 12 : 11;
textXa = textXs = 73;
textY = 168;
- col4 = guiSettings()->colors.fill;
+ col4 = col3;
+ col5 = textCol1;
}
for (int i = 0; i < 7; i++) {
@@ -586,7 +610,7 @@ void EoBCoreEngine::gui_drawSpellbook() {
if (d >= 0 && i < 6 && (i + _openBookSpellListOffset) < 9)
_screen->printText(_openBookSpellList[d], textXs, 132 + 6 * i, textCol1, col3);
else
- _screen->printText(_magicStrings1[0], textXa, textY, 12, col4);
+ _screen->printText(_magicStrings1[0], textXa, textY, col5, col4);
}
}
@@ -753,11 +777,11 @@ int EoBCoreEngine::clickedCamp(Button *button) {
}
_screen->copyPage(0, 7);
- _screen->copyRegion(0, 120, 0, 0, 176, 24, 0, 12, Screen::CR_NO_P_CHECK);
+ _screen->copyRegion(0, 120, 0, 0, 176, 24, 0, (_screen->getPageScaleFactor(0) == 2) ? 1 : 12, Screen::CR_NO_P_CHECK);
_gui->runCampMenu();
- _screen->copyRegion(0, 0, 0, 120, 176, 24, 12, 2, Screen::CR_NO_P_CHECK);
+ _screen->copyRegion(0, 0, 0, 120, 176, 24, (_screen->getPageScaleFactor(0) == 2) ? 1 : 12, 2, Screen::CR_NO_P_CHECK);
_screen->setScreenDim(cd);
drawScene(0);
@@ -1146,7 +1170,7 @@ int EoBCoreEngine::clickedSceneSpecial(Button *button) {
int EoBCoreEngine::clickedSpellbookAbort(Button *button) {
_updateFlags = 0;
- _screen->copyRegion(0, 0, 64, 121, 112, 56, 10, 0, Screen::CR_NO_P_CHECK);
+ _screen->copyRegion(0, 0, 64, 121, 112, 56, (_screen->getPageScaleFactor(0) == 2) ? 4 : 10, 0, Screen::CR_NO_P_CHECK);
_screen->updateScreen();
gui_drawCompass(true);
gui_toggleButtons();
@@ -1368,9 +1392,11 @@ GUI_EoB::GUI_EoB(EoBCoreEngine *vm) : GUI(vm), _vm(vm), _screen(vm->_screen) {
_charSelectRedraw = false;
+ _highLightColorTable = (_vm->game() == GI_EOB1 && (_vm->_configRenderMode == Common::kRenderCGA || _vm->_configRenderMode == Common::kRenderEGA)) ? _highlightColorTableEGA : _highlightColorTableVGA;
_updateBoxIndex = -1;
_highLightBoxTimer = 0;
_updateBoxColorIndex = 0;
+
_needRest = false;
}
@@ -1890,7 +1916,7 @@ void GUI_EoB::simpleMenu_setup(int sd, int maxItem, const char *const *strings,
for (int i = 0; i < _menuNumItems; i++) {
int item = simpleMenu_getMenuItem(i, menuItemsMask, itemOffset);
int ty = y + i * (lineSpacing + _screen->getFontHeight());
- _screen->printShadedText(strings[item], x, ty, dm->unkA, 0);
+ _screen->printShadedText(strings[item], x, ty, (_vm->_configRenderMode == Common::kRenderCGA) ? 1 : dm->unkA, 0);
if (item == v)
_screen->printText(strings[item], x, ty, dm->unkC, 0);
}
@@ -1943,7 +1969,7 @@ int GUI_EoB::simpleMenu_process(int sd, const char *const *strings, void *b, int
}
if (newItem != currentItem) {
- _screen->printText(strings[simpleMenu_getMenuItem(currentItem, menuItemsMask, itemOffset)], x, y + currentItem * lineH , dm->unkA, 0);
+ _screen->printText(strings[simpleMenu_getMenuItem(currentItem, menuItemsMask, itemOffset)], x, y + currentItem * lineH, (_vm->_configRenderMode == Common::kRenderCGA) ? 1 : dm->unkA, 0);
_screen->printText(strings[simpleMenu_getMenuItem(newItem, menuItemsMask, itemOffset)], x, y + newItem * lineH , dm->unkC, 0);
_screen->updateScreen();
}
@@ -2146,7 +2172,7 @@ void GUI_EoB::runCampMenu() {
if (cnt > 4) {
_vm->dropCharacter(selectCharacterDialogue(53));
_vm->gui_drawPlayField(false);
- _screen->copyRegion(0, 120, 0, 0, 176, 24, 0, 12, Screen::CR_NO_P_CHECK);
+ _screen->copyRegion(0, 120, 0, 0, 176, 24, 0, (_screen->getPageScaleFactor(0) == 2) ? 1 : 12, Screen::CR_NO_P_CHECK);
_screen->setFont(Screen::FID_6_FNT);
_vm->gui_drawAllCharPortraitsWithStats();
_screen->setFont(Screen::FID_8_FNT);
@@ -2387,8 +2413,6 @@ void GUI_EoB::messageDialogue2(int dim, int id, int buttonTextCol) {
}
void GUI_EoB::updateBoxFrameHighLight(int box) {
- static const uint8 colorTable[] = { 0x0F, 0xB0, 0xB2, 0xB4, 0xB6, 0xB8, 0xBA, 0xBC, 0x0C, 0xBC, 0xBA, 0xB8, 0xB6, 0xB4, 0xB2, 0xB0, 0x00 };
-
if (_updateBoxIndex == box) {
if (_updateBoxIndex == -1)
return;
@@ -2396,18 +2420,18 @@ void GUI_EoB::updateBoxFrameHighLight(int box) {
if (_vm->_system->getMillis() <= _highLightBoxTimer)
return;
- if (!colorTable[_updateBoxColorIndex])
+ if (!_highLightColorTable[_updateBoxColorIndex])
_updateBoxColorIndex = 0;
- const EoBRect16 *r = &_updateBoxFrameHighLights[_updateBoxIndex];
- _screen->drawBox(r->x1, r->y1, r->x2, r->y2, colorTable[_updateBoxColorIndex++]);
+ const EoBRect16 *r = &_highlightFrames[_updateBoxIndex];
+ _screen->drawBox(r->x1, r->y1, r->x2, r->y2, _highLightColorTable[_updateBoxColorIndex++]);
_screen->updateScreen();
_highLightBoxTimer = _vm->_system->getMillis() + _vm->_tickLength;
} else {
if (_updateBoxIndex != -1) {
- const EoBRect16 *r = &_updateBoxFrameHighLights[_updateBoxIndex];
+ const EoBRect16 *r = &_highlightFrames[_updateBoxIndex];
_screen->drawBox(r->x1, r->y1, r->x2, r->y2, 12);
_screen->updateScreen();
}
@@ -2419,6 +2443,11 @@ void GUI_EoB::updateBoxFrameHighLight(int box) {
}
int GUI_EoB::getTextInput(char *dest, int x, int y, int destMaxLen, int textColor1, int textColor2, int cursorColor) {
+#ifdef ENABLE_KEYMAPPER
+ Common::Keymapper *const keymapper = _vm->getEventManager()->getKeymapper();
+ keymapper->pushKeymap(Common::kGlobalKeymapName);
+#endif
+
uint8 cursorState = 1;
char sufx[] = " ";
@@ -2533,6 +2562,10 @@ int GUI_EoB::getTextInput(char *dest, int x, int y, int destMaxLen, int textColo
} while (_keyPressed.keycode != Common::KEYCODE_RETURN && _keyPressed.keycode != Common::KEYCODE_ESCAPE && !_vm->shouldQuit());
+#ifdef ENABLE_KEYMAPPER
+ keymapper->popKeymap(Common::kGlobalKeymapName);
+#endif
+
return _keyPressed.keycode == Common::KEYCODE_ESCAPE ? -1 : len;
}
@@ -2574,7 +2607,7 @@ Common::String GUI_EoB::transferTargetMenu(Common::Array<Common::String> &target
break;
} while (_saveSlotIdTemp[slot] == -1);
- _screen->copyRegion(72, 14, 72, 14, 176, 144, 12, 0, Screen::CR_NO_P_CHECK);
+ _screen->copyRegion(72, 14, 72, 14, 176, 144, (_screen->getPageScaleFactor(0) == 2) ? 7 : 12, 0, Screen::CR_NO_P_CHECK);
_screen->modifyScreenDim(11, xo, yo, dm->w, dm->h);
return (slot < 6) ? _savegameList[_savegameOffset + slot] : Common::String();
@@ -2694,13 +2727,14 @@ bool GUI_EoB::runSaveMenu(int x, int y) {
int GUI_EoB::selectSaveSlotDialogue(int x, int y, int id) {
_saveSlotX = _saveSlotY = 0;
+ int col1 = (_vm->_configRenderMode == Common::kRenderCGA) ? 1 : 15;
_screen->setCurPage(2);
_savegameOffset = 0;
drawMenuButtonBox(0, 0, 176, 144, false, false);
const char *title = (id < 2) ? _vm->_saveLoadStrings[2 + id] : _vm->_transferStringsScummVM[id - 1];
- _screen->printShadedText(title, 52, 5, 15, 0);
+ _screen->printShadedText(title, 52, 5, col1, 0);
_screen->copyRegion(0, 0, x, y, 176, 144, 2, 0, Screen::CR_NO_P_CHECK);
_screen->setCurPage(0);
@@ -2773,12 +2807,12 @@ int GUI_EoB::selectSaveSlotDialogue(int x, int y, int id) {
lastHighlight = -1;
setupSaveMenuSlots();
for (int i = 0; i < 7; i++)
- drawSaveSlotButton(i, 1, 15);
+ drawSaveSlotButton(i, 1, col1);
lastOffset = _savegameOffset;
}
if (lastHighlight != newHighlight) {
- drawSaveSlotButton(lastHighlight, 0, 15);
+ drawSaveSlotButton(lastHighlight, 0, col1);
drawSaveSlotButton(newHighlight, 0, 6);
// Display highlighted slot index in the bottom left corner to avoid people getting lost with the 990 save slots
@@ -3646,7 +3680,7 @@ int GUI_EoB::selectCharacterDialogue(int id) {
}
} else if (inputFlag == _vm->_keyMap[Common::KEYCODE_KP5] || inputFlag == _vm->_keyMap[Common::KEYCODE_RETURN]) {
- if (found >= 0)
+ if (hlCur >= 0)
result = hlCur;
} else if (inputFlag == _vm->_keyMap[Common::KEYCODE_ESCAPE] || inputFlag == 0x8010) {
@@ -3771,7 +3805,7 @@ void GUI_EoB::drawMenuButton(Button *b, bool clicked, bool highlight, bool noFil
if (!b)
return;
- EoBMenuButtonDef *d = (EoBMenuButtonDef *)b->extButtonDef;
+ const EoBMenuButtonDef *d = (const EoBMenuButtonDef *)b->extButtonDef;
if (d->flags & 1)
drawMenuButtonBox(b->x, b->y, b->width, b->height, clicked, noFill);
@@ -3787,10 +3821,12 @@ void GUI_EoB::drawMenuButton(Button *b, bool clicked, bool highlight, bool noFil
yOffs = (b->height - 7) >> 1;
}
+ int col1 = (_vm->_configRenderMode == Common::kRenderCGA) ? 1 : 15;
+
if (noFill || clicked)
- _screen->printText(s, b->x + xOffs, b->y + yOffs, highlight ? 6 : 15, 0);
+ _screen->printText(s, b->x + xOffs, b->y + yOffs, highlight ? 6 : col1, 0);
else
- _screen->printShadedText(s, b->x + xOffs, b->y + yOffs, highlight ? 6 : 15, 0);
+ _screen->printShadedText(s, b->x + xOffs, b->y + yOffs, highlight ? 6 : col1, 0);
}
}
@@ -3852,13 +3888,14 @@ void GUI_EoB::memorizePrayMenuPrintString(int spellId, int bookPageIndex, int sp
return;
int y = bookPageIndex * 9 + 50;
+ int col1 = (_vm->_configRenderMode == Common::kRenderCGA) ? 1 : 15;
if (spellId) {
Common::String s(Common::String::format(_vm->_menuStringsMgc[0], spellType ? _vm->_clericSpellList[spellId] : _vm->_mageSpellList[spellId], _numAssignedSpellsOfType[spellId * 2 - 2]));
if (noFill)
- _screen->printText(s.c_str(), 8, y, highLight ? 6 : 15, 0);
+ _screen->printText(s.c_str(), 8, y, highLight ? 6 : col1, 0);
else
- _screen->printShadedText(s.c_str(), 8, y, highLight ? 6 : 15, _vm->guiSettings()->colors.fill);
+ _screen->printShadedText(s.c_str(), 8, y, highLight ? 6 : col1, _vm->guiSettings()->colors.fill);
} else {
_screen->fillRect(6, y, 168, y + 8, _vm->guiSettings()->colors.fill);
@@ -4017,7 +4054,7 @@ void GUI_EoB::restParty_updateRestTime(int hours, bool init) {
_screen->setFont(of);
}
-const EoBRect16 GUI_EoB::_updateBoxFrameHighLights[] = {
+const EoBRect16 GUI_EoB::_highlightFrames[] = {
{ 0x00B7, 0x0001, 0x00F7, 0x0034 },
{ 0x00FF, 0x0001, 0x013F, 0x0034 },
{ 0x00B7, 0x0035, 0x00F7, 0x0068 },
@@ -4040,6 +4077,10 @@ const EoBRect16 GUI_EoB::_updateBoxFrameHighLights[] = {
{ 0x00A3, 0x0068, 0x00C3, 0x0089 }
};
+const uint8 GUI_EoB::_highlightColorTableVGA[] = { 0x0F, 0xB0, 0xB2, 0xB4, 0xB6, 0xB8, 0xBA, 0xBC, 0x0C, 0xBC, 0xBA, 0xB8, 0xB6, 0xB4, 0xB2, 0xB0, 0x00 };
+
+const uint8 GUI_EoB::_highlightColorTableEGA[] = { 0x0C, 0x0D, 0x0E, 0x0F, 0x0E, 0x0D, 0x00 };
+
} // End of namespace Kyra
#endif // ENABLE_EOB
diff --git a/engines/kyra/gui_eob.h b/engines/kyra/gui_eob.h
index 759ed641ce..f6be18ffbb 100644
--- a/engines/kyra/gui_eob.h
+++ b/engines/kyra/gui_eob.h
@@ -148,9 +148,12 @@ private:
int _updateBoxIndex;
int _updateBoxColorIndex;
+ const uint8 *_highLightColorTable;
uint32 _highLightBoxTimer;
- static const EoBRect16 _updateBoxFrameHighLights[];
+ static const EoBRect16 _highlightFrames[];
+ static const uint8 _highlightColorTableVGA[];
+ static const uint8 _highlightColorTableEGA[];
};
} // End of namespace Kyra
diff --git a/engines/kyra/gui_lol.cpp b/engines/kyra/gui_lol.cpp
index 80052c70f2..b025aefbd0 100644
--- a/engines/kyra/gui_lol.cpp
+++ b/engines/kyra/gui_lol.cpp
@@ -35,6 +35,8 @@
#include "graphics/scaler.h"
+#include "backends/keymapper/keymapper.h"
+
#include "base/version.h"
namespace Kyra {
@@ -2549,6 +2551,11 @@ int GUI_LoL::getInput() {
if (!_displayMenu)
return 0;
+#ifdef ENABLE_KEYMAPPER
+ Common::Keymapper *const keymapper = _vm->getEventManager()->getKeymapper();
+ keymapper->pushKeymap(Common::kGlobalKeymapName);
+#endif
+
Common::Point p = _vm->getMousePos();
_vm->_mouseX = p.x;
_vm->_mouseY = p.y;
@@ -2585,6 +2592,11 @@ int GUI_LoL::getInput() {
_displayMenu = false;
_vm->delay(8);
+
+#ifdef ENABLE_KEYMAPPER
+ keymapper->popKeymap(Common::kGlobalKeymapName);
+#endif
+
return inputFlag & 0x8000 ? 1 : 0;
}
diff --git a/engines/kyra/gui_rpg.cpp b/engines/kyra/gui_rpg.cpp
index 718722f58d..a8b94032d0 100644
--- a/engines/kyra/gui_rpg.cpp
+++ b/engines/kyra/gui_rpg.cpp
@@ -72,7 +72,7 @@ void KyraRpgEngine::gui_drawHorizontalBarGraph(int x, int y, int w, int h, int32
screen()->fillRect(x, y, x + t - 1, y + h, col1);
if (t < w && col2)
- screen()->fillRect(x + t, y, x + w, y + h, col2);
+ screen()->fillRect(x + t, y, x + w - 1, y + h, col2);
}
void KyraRpgEngine::gui_initButtonsFromList(const int16 *list) {
diff --git a/engines/kyra/items_eob.cpp b/engines/kyra/items_eob.cpp
index 33b47c12e7..0994e12e4f 100644
--- a/engines/kyra/items_eob.cpp
+++ b/engines/kyra/items_eob.cpp
@@ -462,19 +462,18 @@ void EoBCoreEngine::identifyQueuedItems(Item itemQueue) {
void EoBCoreEngine::drawItemIconShape(int pageNum, Item itemId, int x, int y) {
int icn = _items[itemId].icon;
bool applyBluePal = ((_partyEffectFlags & 2) && (_items[itemId].flags & 0x80)) ? true : false;
-
- memcpy(_tempIconShape, _itemIconShapes[icn], _itemIconShapes[icn][1] * _itemIconShapes[icn][2] * 4 + 20);
+ const uint8 *ovl = 0;
if (applyBluePal) {
if (_flags.gameID == GI_EOB1) {
- _screen->replaceShapePalette(_tempIconShape, &_itemsOverlay[icn << 4]);
+ ovl = (_configRenderMode == Common::kRenderCGA) ? _itemsOverlayCGA : &_itemsOverlay[icn << 4];
} else {
_screen->setFadeTableIndex(3);
_screen->setShapeFadeMode(1, true);
}
}
- _screen->drawShape(pageNum, _tempIconShape, x, y, 0);
+ _screen->drawShape(pageNum, _itemIconShapes[icn], x, y, 0, ovl ? 2 : 0, ovl);
if (applyBluePal) {
_screen->setFadeTableIndex(4);
@@ -531,7 +530,7 @@ bool EoBCoreEngine::launchObject(int charIndex, Item item, uint16 startBlock, in
setItemPosition((Item *)&_levelBlockProperties[startBlock].drawObjects, startBlock, item, startPos | 4);
t->enable = 1;
- t->u2 = 1;
+ t->starting = 1;
t->flags = 0;
t->direction = dir;
t->distance = 12;
@@ -559,7 +558,7 @@ void EoBCoreEngine::launchMagicObject(int charIndex, int type, uint16 startBlock
return;
t->enable = 2;
- t->u2 = 1;
+ t->starting = 1;
t->flags = _magicFlightObjectProperties[(type << 2) + 2];
t->direction = dir;
t->distance = _magicFlightObjectProperties[(type << 2) + 1];
@@ -568,7 +567,6 @@ void EoBCoreEngine::launchMagicObject(int charIndex, int type, uint16 startBlock
t->item = type;
t->objectType = _magicFlightObjectProperties[(type << 2) + 3];
t->attackerId = charIndex;
- t->u2 = 1;
t->callBackIndex = _magicFlightObjectProperties[type << 2];
_sceneUpdateRequired = true;
}
@@ -576,7 +574,7 @@ void EoBCoreEngine::launchMagicObject(int charIndex, int type, uint16 startBlock
bool EoBCoreEngine::updateObjectFlight(EoBFlyingObject *fo, int block, int pos) {
uint8 wallFlags = _wllWallFlags[_levelBlockProperties[block].walls[fo->direction ^ 2]];
if (fo->enable == 1) {
- if ((wallFlags & 1) || (fo->u2) || ((wallFlags & 2) && (_dscItemShapeMap[_items[fo->item].icon] >= 15))) {
+ if ((wallFlags & 1) || (fo->starting) || ((wallFlags & 2) && (_dscItemShapeMap[_items[fo->item].icon] >= 15))) {
getQueuedItem((Item *)&_levelBlockProperties[fo->curBlock].drawObjects, 0, fo->item);
setItemPosition((Item *)&_levelBlockProperties[block].drawObjects, block, fo->item, pos | 4);
fo->curBlock = block;
@@ -602,7 +600,7 @@ bool EoBCoreEngine::updateObjectFlight(EoBFlyingObject *fo, int block, int pos)
}
bool EoBCoreEngine::updateFlyingObjectHitTest(EoBFlyingObject *fo, int block, int pos) {
- if (fo->u2 && (fo->curBlock != _currentBlock || fo->attackerId >= 0) && (!blockHasMonsters(block) || fo->attackerId < 0))
+ if (fo->starting && (fo->curBlock != _currentBlock || fo->attackerId >= 0) && (!blockHasMonsters(fo->curBlock) || fo->attackerId < 0))
return false;
if (fo->enable == 2) {
diff --git a/engines/kyra/kyra_hof.cpp b/engines/kyra/kyra_hof.cpp
index c3c4e6083c..b07e3a4965 100644
--- a/engines/kyra/kyra_hof.cpp
+++ b/engines/kyra/kyra_hof.cpp
@@ -88,7 +88,7 @@ KyraEngine_HoF::KyraEngine_HoF(OSystem *system, const GameFlags &flags) : KyraEn
_currentTalkSections.ENDTim = 0;
memset(&_invWsa, 0, sizeof(_invWsa));
- _itemAnimData = 0;
+ _itemAnimDefinition = 0;
_demoAnimData = 0;
_nextAnimItem = 0;
@@ -171,7 +171,7 @@ KyraEngine_HoF::~KyraEngine_HoF() {
delete[] _conversationState[i];
delete[] _conversationState;
- for (Common::Array<const TIMOpcode*>::iterator i = _timOpcodes.begin(); i != _timOpcodes.end(); ++i)
+ for (Common::Array<const TIMOpcode *>::iterator i = _timOpcodes.begin(); i != _timOpcodes.end(); ++i)
delete *i;
_timOpcodes.clear();
}
@@ -211,8 +211,8 @@ void KyraEngine_HoF::pauseEngineIntern(bool pause) {
_nextIdleAnim += pausedTime;
- for (int x = 0; x < _itemAnimDataSize; x++)
- _activeItemAnim[x].nextFrame += pausedTime;
+ for (int x = 0; x < _itemAnimDefinitionSize; x++)
+ _activeItemAnim[x].nextFrameTime += pausedTime;
_tim->refreshTimersAfterPause(pausedTime);
}
@@ -221,7 +221,7 @@ void KyraEngine_HoF::pauseEngineIntern(bool pause) {
Common::Error KyraEngine_HoF::init() {
_screen = new Screen_HoF(this, _system);
assert(_screen);
- _screen->setResolution();
+ _screen->setResolution(_flags.useHiResOverlay);
_debugger = new Debugger_HoF(this);
assert(_debugger);
diff --git a/engines/kyra/kyra_hof.h b/engines/kyra/kyra_hof.h
index 4b8303b2e4..182854cdf1 100644
--- a/engines/kyra/kyra_hof.h
+++ b/engines/kyra/kyra_hof.h
@@ -656,7 +656,7 @@ protected:
int t2_resetChat(const TIM *tim, const uint16 *param);
int t2_playSoundEffect(const TIM *tim, const uint16 *param);
- Common::Array<const TIMOpcode*> _timOpcodes;
+ Common::Array<const TIMOpcode *> _timOpcodes;
// sound
int _oldTalkFile;
@@ -874,8 +874,8 @@ protected:
const char * const *_ingameTimJpStr;
int _ingameTimJpStrSize;
const HofSeqData *_sequences;
- const ItemAnimData_v2 *_itemAnimData;
- int _itemAnimDataSize;
+ const ItemAnimDefinition *_itemAnimDefinition;
+ int _itemAnimDefinitionSize;
const ItemAnimData_v1 *_demoAnimData;
int _demoAnimSize;
diff --git a/engines/kyra/kyra_lok.cpp b/engines/kyra/kyra_lok.cpp
index c195f0275a..e8a2c02e6e 100644
--- a/engines/kyra/kyra_lok.cpp
+++ b/engines/kyra/kyra_lok.cpp
@@ -172,7 +172,7 @@ Common::Error KyraEngine_LoK::init() {
else
_screen = new Screen_LoK(this, _system);
assert(_screen);
- _screen->setResolution();
+ _screen->setResolution(_flags.useHiResOverlay);
_debugger = new Debugger_LoK(this);
assert(_debugger);
@@ -510,6 +510,9 @@ void KyraEngine_LoK::delay(uint32 amount, bool update, bool isMainLoop) {
updateTextFade();
updateMousePointer();
} else {
+ // We need to do Screen::updateScreen here, since client code
+ // relies on this method to copy screen changes to the actual
+ // screen since at least 0af418e7ea3a41f93fcc551a45ee5bae822d812a.
_screen->updateScreen();
}
diff --git a/engines/kyra/kyra_mr.cpp b/engines/kyra/kyra_mr.cpp
index 4e07c8f343..38f473a619 100644
--- a/engines/kyra/kyra_mr.cpp
+++ b/engines/kyra/kyra_mr.cpp
@@ -183,7 +183,7 @@ KyraEngine_MR::~KyraEngine_MR() {
delete[] _sceneStrings;
delete[] _talkObjectList;
- for (Common::Array<const Opcode*>::iterator i = _opcodesDialog.begin(); i != _opcodesDialog.end(); ++i)
+ for (Common::Array<const Opcode *>::iterator i = _opcodesDialog.begin(); i != _opcodesDialog.end(); ++i)
delete *i;
_opcodesDialog.clear();
@@ -203,7 +203,7 @@ KyraEngine_MR::~KyraEngine_MR() {
Common::Error KyraEngine_MR::init() {
_screen = new Screen_MR(this, _system);
assert(_screen);
- _screen->setResolution();
+ _screen->setResolution(_flags.useHiResOverlay);
_debugger = new Debugger_v2(this);
assert(_debugger);
diff --git a/engines/kyra/kyra_mr.h b/engines/kyra/kyra_mr.h
index 38ff271037..004236ca04 100644
--- a/engines/kyra/kyra_mr.h
+++ b/engines/kyra/kyra_mr.h
@@ -219,7 +219,7 @@ private:
bool _nextIdleType;
void showIdleAnim();
- const ItemAnimData_v2 *_itemAnimData;
+ const ItemAnimDefinition *_itemAnimDefinition;
ActiveItemAnim _activeItemAnim[10];
int _nextAnimItem;
@@ -463,7 +463,7 @@ private:
void npcChatSequence(const char *str, int object, int vocHigh, int vocLow);
- Common::Array<const Opcode*> _opcodesDialog;
+ Common::Array<const Opcode *> _opcodesDialog;
int o3d_updateAnim(EMCState *script);
int o3d_delay(EMCState *script);
diff --git a/engines/kyra/kyra_rpg.cpp b/engines/kyra/kyra_rpg.cpp
index b8d56b3ecb..121731e394 100644
--- a/engines/kyra/kyra_rpg.cpp
+++ b/engines/kyra/kyra_rpg.cpp
@@ -41,12 +41,17 @@ KyraRpgEngine::KyraRpgEngine(OSystem *system, const GameFlags &flags) : KyraEngi
_currentLevel = 0;
- _vmpPtr = 0;
_vcnBlocks = 0;
_vcfBlocks = 0;
+ _vcnTransitionMask = 0;
_vcnShift = 0;
- _vcnExpTable = 0;
+ _vcnColTable = 0;
+ _vcnBlockWidth = 4;
+ _vcnBlockHeight = 8;
+ _vcnFlip0 = 0;
+ _vcnFlip1 = 1;
_vmpPtr = 0;
+ _vmpSize = 0;
_blockBrightness = _wllVcnOffset = 0;
_blockDrawingBuffer = 0;
_sceneWindowBuffer = 0;
@@ -93,6 +98,10 @@ KyraRpgEngine::KyraRpgEngine(OSystem *system, const GameFlags &flags) : KyraEngi
_dscDimMap = 0;
_dscDoorShpIndex = 0;
_dscDoorY2 = 0;
+ _dscDoorFrameY1 = 0;
+ _dscDoorFrameY2 = 0;
+ _dscDoorFrameIndex1 = 0;
+ _dscDoorFrameIndex2 = 0;
_shpDmX1 = _shpDmX2 = 0;
@@ -123,9 +132,10 @@ KyraRpgEngine::~KyraRpgEngine() {
delete[] _wllWallFlags;
delete[] _vmpPtr;
- delete[] _vcnExpTable;
+ delete[] _vcnColTable;
delete[] _vcnBlocks;
delete[] _vcfBlocks;
+ delete[] _vcnTransitionMask;
delete[] _vcnShift;
delete[] _blockDrawingBuffer;
delete[] _sceneWindowBuffer;
@@ -148,7 +158,7 @@ Common::Error KyraRpgEngine::init() {
_levelDecorationProperties = new LevelDecorationProperty[100];
memset(_levelDecorationProperties, 0, 100 * sizeof(LevelDecorationProperty));
_levelDecorationShapes = new uint8*[400];
- memset(_levelDecorationShapes, 0, 400 * sizeof(uint8*));
+ memset(_levelDecorationShapes, 0, 400 * sizeof(uint8 *));
_levelBlockProperties = new LevelBlockProperty[1025];
memset(_levelBlockProperties, 0, 1025 * sizeof(LevelBlockProperty));
@@ -161,10 +171,17 @@ Common::Error KyraRpgEngine::init() {
_wllWallFlags = new uint8[256];
memset(_wllWallFlags, 0, 256);
+ if (_flags.gameID == GI_EOB2 && _configRenderMode == Common::kRenderEGA) {
+ _vcnBlockWidth <<= 1;
+ _vcnBlockHeight <<= 1;
+ SWAP(_vcnFlip0, _vcnFlip1);
+ }
+
_blockDrawingBuffer = new uint16[1320];
memset(_blockDrawingBuffer, 0, 1320 * sizeof(uint16));
- _sceneWindowBuffer = new uint8[21120];
- memset(_sceneWindowBuffer, 0, 21120);
+ uint32 swbSize = 22 * _vcnBlockWidth * 2 * 15 * _vcnBlockHeight;
+ _sceneWindowBuffer = new uint8[swbSize];
+ memset(_sceneWindowBuffer, 0, swbSize);
_lvlShapeTop = new int16[18];
memset(_lvlShapeTop, 0, 18 * sizeof(int16));
@@ -173,12 +190,12 @@ Common::Error KyraRpgEngine::init() {
_lvlShapeLeftRight = new int16[36];
memset(_lvlShapeLeftRight, 0, 36 * sizeof(int16));
- _vcnExpTable = new uint8[128];
+ _vcnColTable = new uint8[128];
for (int i = 0; i < 128; i++)
- _vcnExpTable[i] = i & 0x0f;
+ _vcnColTable[i] = i & 0x0f;
_doorShapes = new uint8*[6];
- memset(_doorShapes, 0, 6 * sizeof(uint8*));
+ memset(_doorShapes, 0, 6 * sizeof(uint8 *));
initStaticResource();
diff --git a/engines/kyra/kyra_rpg.h b/engines/kyra/kyra_rpg.h
index a1b9b4c332..50a4c9bdc1 100644
--- a/engines/kyra/kyra_rpg.h
+++ b/engines/kyra/kyra_rpg.h
@@ -70,7 +70,7 @@ struct EoBFlyingObject {
int16 attackerId;
Item item;
uint16 curBlock;
- uint16 u2;
+ uint16 starting;
uint8 u1;
uint8 direction;
uint8 distance;
@@ -87,9 +87,9 @@ struct KyraRpgGUISettings {
uint16 width;
uint16 height;
int waitReserve;
- const uint16 waitX[2];
- const uint8 waitY[2];
- const uint16 waitWidth[2];
+ uint16 waitX[2];
+ uint8 waitY[2];
+ uint16 waitWidth[2];
} buttons;
struct Colors {
@@ -183,7 +183,7 @@ protected:
virtual const uint8 *getBlockFileData(int levelIndex) = 0;
void setLevelShapesDim(int index, int16 &x1, int16 &x2, int dim);
- void scaleLevelShapesDim(int index, int16 &y1, int16 &y2, int dim);
+ void setDoorShapeDim(int index, int16 &y1, int16 &y2, int dim);
void drawLevelModifyScreenDim(int dim, int16 x1, int16 y1, int16 x2, int16 y2);
void generateBlockDrawingBuffer();
void generateVmpTileData(int16 startBlockX, uint8 startBlockY, uint8 wllVmpIndex, int16 vmpOffset, uint8 numBlocksX, uint8 numBlocksY);
@@ -222,14 +222,20 @@ protected:
uint16 _decorationCount;
int16 _mappedDecorationsCount;
uint16 *_vmpPtr;
+ uint16 _vmpSize;
uint8 *_vcnBlocks;
uint8 *_vcfBlocks;
+ uint8 *_vcnTransitionMask;
uint8 *_vcnShift;
- uint8 *_vcnExpTable;
+ uint8 *_vcnColTable;
uint16 *_blockDrawingBuffer;
uint8 *_sceneWindowBuffer;
uint8 _blockBrightness;
uint8 _wllVcnOffset;
+ uint8 _vcnBlockWidth;
+ uint8 _vcnBlockHeight;
+ uint8 _vcnFlip0;
+ uint8 _vcnFlip1;
uint8 **_doorShapes;
@@ -270,6 +276,10 @@ protected:
const uint8 *_dscDoorShpIndex;
int _dscDoorShpIndexSize;
const uint8 *_dscDoorY2;
+ const uint8 *_dscDoorFrameY1;
+ const uint8 *_dscDoorFrameY2;
+ const uint8 *_dscDoorFrameIndex1;
+ const uint8 *_dscDoorFrameIndex2;
// Script
virtual void runLevelScript(int block, int flags) = 0;
diff --git a/engines/kyra/kyra_v1.cpp b/engines/kyra/kyra_v1.cpp
index 7167d41550..7c67af2f13 100644
--- a/engines/kyra/kyra_v1.cpp
+++ b/engines/kyra/kyra_v1.cpp
@@ -42,6 +42,8 @@ KyraEngine_v1::KyraEngine_v1(OSystem *system, const GameFlags &flags)
_emc = 0;
_debugger = 0;
+ _configRenderMode = Common::kRenderDefault;
+
if (_flags.platform == Common::kPlatformAmiga)
_gameSpeed = 50;
else
@@ -163,6 +165,9 @@ Common::Error KyraEngine_v1::init() {
if (_sound)
_sound->updateVolumeSettings();
+ if (ConfMan.hasKey("render_mode"))
+ _configRenderMode = Common::parseRenderMode(ConfMan.get("render_mode"));
+
_res = new Resource(this);
assert(_res);
_res->reset();
@@ -225,7 +230,7 @@ KyraEngine_v1::~KyraEngine_v1() {
delete _debugger;
}
-Common::Point KyraEngine_v1::getMousePos() const {
+Common::Point KyraEngine_v1::getMousePos() {
Common::Point mouse = _eventMan->getMousePos();
if (_flags.useHiResOverlay) {
@@ -233,6 +238,9 @@ Common::Point KyraEngine_v1::getMousePos() const {
mouse.y >>= 1;
}
+ mouse.x /= screen()->getPageScaleFactor(0);
+ mouse.y /= screen()->getPageScaleFactor(0);
+
return mouse;
}
@@ -308,6 +316,8 @@ int KyraEngine_v1::checkInput(Button *buttonList, bool mainLoop, int eventFlag)
_mouseX >>= 1;
_mouseY >>= 1;
}
+ _mouseX /= screen()->getPageScaleFactor(0);
+ _mouseY /= screen()->getPageScaleFactor(0);
keys = (event.type == Common::EVENT_LBUTTONDOWN ? 199 : (200 | 0x800));
breakLoop = true;
} break;
@@ -320,6 +330,8 @@ int KyraEngine_v1::checkInput(Button *buttonList, bool mainLoop, int eventFlag)
_mouseX >>= 1;
_mouseY >>= 1;
}
+ _mouseX /= screen()->getPageScaleFactor(0);
+ _mouseY /= screen()->getPageScaleFactor(0);
keys = (event.type == Common::EVENT_RBUTTONDOWN ? 201 : (202 | 0x800));
breakLoop = true;
} break;
diff --git a/engines/kyra/kyra_v1.h b/engines/kyra/kyra_v1.h
index 67332eccdb..95d58d4ab2 100644
--- a/engines/kyra/kyra_v1.h
+++ b/engines/kyra/kyra_v1.h
@@ -210,7 +210,7 @@ public:
// input
void setMousePos(int x, int y);
- Common::Point getMousePos() const;
+ Common::Point getMousePos();
// config specific
bool speechEnabled();
@@ -306,6 +306,8 @@ protected:
bool _configSounds;
uint8 _configVoice;
+ Common::RenderMode _configRenderMode;
+
// game speed
virtual bool skipFlag() const;
virtual void resetSkipFlag(bool removeEvent = true);
@@ -326,7 +328,7 @@ protected:
// opcode
virtual void setupOpcodeTable() = 0;
- Common::Array<const Opcode*> _opcodes;
+ Common::Array<const Opcode *> _opcodes;
int o1_queryGameFlag(EMCState *script);
int o1_setGameFlag(EMCState *script);
diff --git a/engines/kyra/kyra_v2.h b/engines/kyra/kyra_v2.h
index 3d7b9c4997..563416bf1e 100644
--- a/engines/kyra/kyra_v2.h
+++ b/engines/kyra/kyra_v2.h
@@ -38,7 +38,7 @@ struct FrameControl {
uint16 delay;
};
-struct ItemAnimData_v2 {
+struct ItemAnimDefinition {
Item itemIndex;
uint8 numFrames;
const FrameControl *frames;
@@ -46,7 +46,7 @@ struct ItemAnimData_v2 {
struct ActiveItemAnim {
uint16 currentFrame;
- uint32 nextFrame;
+ uint32 nextFrameTime;
};
class Screen_v2;
@@ -224,7 +224,7 @@ protected:
// Sequences
EMCData _animationScriptData;
EMCState _animationScriptState;
- Common::Array<const Opcode*> _opcodesAnimation;
+ Common::Array<const Opcode *> _opcodesAnimation;
void runAnimationScript(const char *filename, int allowSkip, int resetChar, int newShapes, int shapeUnload);
@@ -252,7 +252,7 @@ protected:
virtual void uninitAnimationShapes(int count, uint8 *filedata) = 0;
// Shapes
- typedef Common::HashMap<int, uint8*> ShapeMap;
+ typedef Common::HashMap<int, uint8 *> ShapeMap;
ShapeMap _gameShapes;
uint8 *getShapePtr(int index) const;
diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp
index 258f53c602..022a878e0a 100644
--- a/engines/kyra/lol.cpp
+++ b/engines/kyra/lol.cpp
@@ -364,7 +364,7 @@ GUI *LoLEngine::gui() const {
Common::Error LoLEngine::init() {
_screen = new Screen_LoL(this, _system);
assert(_screen);
- _screen->setResolution();
+ _screen->setResolution(_flags.useHiResOverlay);
_debugger = new Debugger_LoL(this);
assert(_debugger);
@@ -491,7 +491,7 @@ void LoLEngine::initKeymap() {
};
for (const Common::KeyActionEntry *entry = keyActionEntries; entry->id; ++entry) {
- Common::Action *const act = new Common::Action(engineKeyMap, entry->id, entry->description, Common::kGenericActionType, Common::kActionKeyType);
+ Common::Action *const act = new Common::Action(engineKeyMap, entry->id, entry->description);
act->addKeyEvent(entry->ks);
}
diff --git a/engines/kyra/lol.h b/engines/kyra/lol.h
index bb8f24eb66..dbd461267f 100644
--- a/engines/kyra/lol.h
+++ b/engines/kyra/lol.h
@@ -447,7 +447,7 @@ private:
uint16 _envSfxQueuedBlocks[10];
int _nextSpeechId;
int _nextSpeaker;
- typedef Common::List<Audio::SeekableAudioStream*> SpeechList;
+ typedef Common::List<Audio::SeekableAudioStream *> SpeechList;
SpeechList _speechList;
int _curTlkFile;
@@ -762,14 +762,14 @@ private:
// tim opcode
void setupOpcodeTable();
- Common::Array<const TIMOpcode*> _timIntroOpcodes;
+ Common::Array<const TIMOpcode *> _timIntroOpcodes;
int tlol_setupPaletteFade(const TIM *tim, const uint16 *param);
int tlol_loadPalette(const TIM *tim, const uint16 *param);
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);
- Common::Array<const TIMOpcode*> _timOutroOpcodes;
+ Common::Array<const TIMOpcode *> _timOutroOpcodes;
int tlol_fadeInScene(const TIM *tim, const uint16 *param);
int tlol_unusedResourceFunc(const TIM *tim, const uint16 *param);
int tlol_fadeInPalette(const TIM *tim, const uint16 *param);
@@ -778,7 +778,7 @@ private:
int tlol_delayForChat(const TIM *tim, const uint16 *param);
int tlol_fadeOutSound(const TIM *tim, const uint16 *param);
- Common::Array<const TIMOpcode*> _timIngameOpcodes;
+ Common::Array<const TIMOpcode *> _timIngameOpcodes;
int tlol_initSceneWindowDialogue(const TIM *tim, const uint16 *param);
int tlol_restoreAfterSceneWindowDialogue(const TIM *tim, const uint16 *param);
int tlol_giveItem(const TIM *tim, const uint16 *param);
@@ -1156,7 +1156,7 @@ private:
// spells
typedef Common::Functor1Mem<ActiveSpell *, int, LoLEngine> SpellProc;
- Common::Array<const SpellProc*> _spellProcs;
+ Common::Array<const SpellProc *> _spellProcs;
typedef void (LoLEngine::*SpellProcCallback)(WSAMovie_v2 *, int, int);
int castSpell(int charNum, int spellType, int spellLevel);
diff --git a/engines/kyra/magic_eob.cpp b/engines/kyra/magic_eob.cpp
index fbddd620d1..b2949ce1d5 100644
--- a/engines/kyra/magic_eob.cpp
+++ b/engines/kyra/magic_eob.cpp
@@ -60,7 +60,7 @@ void EoBCoreEngine::useMagicBookOrSymbol(int charIndex, int type) {
}
if (!_updateFlags)
- _screen->copyRegion(64, 121, 0, 0, 112, 56, 0, 10, Screen::CR_NO_P_CHECK);
+ _screen->copyRegion(64, 121, 0, 0, 112, 56, 0, (_screen->getPageScaleFactor(0) == 2) ? 4 : 10, Screen::CR_NO_P_CHECK);
_updateFlags = 1;
gui_setPlayFieldButtons();
gui_drawSpellbook();
diff --git a/engines/kyra/resource.h b/engines/kyra/resource.h
index 5b0af9840d..f2bc4e8146 100644
--- a/engines/kyra/resource.h
+++ b/engines/kyra/resource.h
@@ -263,6 +263,10 @@ enum KyraResources {
kRpgCommonDscBlockMap,
kRpgCommonDscDimMap,
kRpgCommonDscDoorY2,
+ kRpgCommonDscDoorFrameY1,
+ kRpgCommonDscDoorFrameY2,
+ kRpgCommonDscDoorFrameIndex1,
+ kRpgCommonDscDoorFrameIndex2,
kRpgCommonDscBlockIndex,
kEoBBaseChargenStrings1,
@@ -517,9 +521,23 @@ enum KyraResources {
kEoB1EnemyMageSfx,
kEoB1BeholderSpellList,
kEoB1BeholderSfx,
-
kEoB1TurnUndeadString,
+ kEoB1CgaMappingDefault,
+ kEoB1CgaMappingAlt,
+ kEoB1CgaMappingInv,
+ kEoB1CgaMappingItemsL,
+ kEoB1CgaMappingItemsS,
+ kEoB1CgaMappingThrown,
+ kEoB1CgaMappingIcons,
+ kEoB1CgaMappingDeco,
+ kEoB1CgaLevelMappingIndex,
+ kEoB1CgaMappingLevel0,
+ kEoB1CgaMappingLevel1,
+ kEoB1CgaMappingLevel2,
+ kEoB1CgaMappingLevel3,
+ kEoB1CgaMappingLevel4,
+
kEoB1NpcShpData,
kEoB1NpcSubShpIndex1,
kEoB1NpcSubShpIndex2,
@@ -548,50 +566,50 @@ enum KyraResources {
kEoB2IntroStrings,
kEoB2IntroCPSFiles,
- kEoB2IntroSeqData00,
- kEoB2IntroSeqData01,
- kEoB2IntroSeqData02,
- kEoB2IntroSeqData03,
- kEoB2IntroSeqData04,
- kEoB2IntroSeqData05,
- kEoB2IntroSeqData06,
- kEoB2IntroSeqData07,
- kEoB2IntroSeqData08,
- kEoB2IntroSeqData09,
- kEoB2IntroSeqData10,
- kEoB2IntroSeqData11,
- kEoB2IntroSeqData12,
- kEoB2IntroSeqData13,
- kEoB2IntroSeqData14,
- kEoB2IntroSeqData15,
- kEoB2IntroSeqData16,
- kEoB2IntroSeqData17,
- kEoB2IntroSeqData18,
- kEoB2IntroSeqData19,
- kEoB2IntroSeqData20,
- kEoB2IntroSeqData21,
- kEoB2IntroSeqData22,
- kEoB2IntroSeqData23,
- kEoB2IntroSeqData24,
- kEoB2IntroSeqData25,
- kEoB2IntroSeqData26,
- kEoB2IntroSeqData27,
- kEoB2IntroSeqData28,
- kEoB2IntroSeqData29,
- kEoB2IntroSeqData30,
- kEoB2IntroSeqData31,
- kEoB2IntroSeqData32,
- kEoB2IntroSeqData33,
- kEoB2IntroSeqData34,
- kEoB2IntroSeqData35,
- kEoB2IntroSeqData36,
- kEoB2IntroSeqData37,
- kEoB2IntroSeqData38,
- kEoB2IntroSeqData39,
- kEoB2IntroSeqData40,
- kEoB2IntroSeqData41,
- kEoB2IntroSeqData42,
- kEoB2IntroSeqData43,
+ kEob2IntroAnimData00,
+ kEob2IntroAnimData01,
+ kEob2IntroAnimData02,
+ kEob2IntroAnimData03,
+ kEob2IntroAnimData04,
+ kEob2IntroAnimData05,
+ kEob2IntroAnimData06,
+ kEob2IntroAnimData07,
+ kEob2IntroAnimData08,
+ kEob2IntroAnimData09,
+ kEob2IntroAnimData10,
+ kEob2IntroAnimData11,
+ kEob2IntroAnimData12,
+ kEob2IntroAnimData13,
+ kEob2IntroAnimData14,
+ kEob2IntroAnimData15,
+ kEob2IntroAnimData16,
+ kEob2IntroAnimData17,
+ kEob2IntroAnimData18,
+ kEob2IntroAnimData19,
+ kEob2IntroAnimData20,
+ kEob2IntroAnimData21,
+ kEob2IntroAnimData22,
+ kEob2IntroAnimData23,
+ kEob2IntroAnimData24,
+ kEob2IntroAnimData25,
+ kEob2IntroAnimData26,
+ kEob2IntroAnimData27,
+ kEob2IntroAnimData28,
+ kEob2IntroAnimData29,
+ kEob2IntroAnimData30,
+ kEob2IntroAnimData31,
+ kEob2IntroAnimData32,
+ kEob2IntroAnimData33,
+ kEob2IntroAnimData34,
+ kEob2IntroAnimData35,
+ kEob2IntroAnimData36,
+ kEob2IntroAnimData37,
+ kEob2IntroAnimData38,
+ kEob2IntroAnimData39,
+ kEob2IntroAnimData40,
+ kEob2IntroAnimData41,
+ kEob2IntroAnimData42,
+ kEob2IntroAnimData43,
kEoB2IntroShapes00,
kEoB2IntroShapes01,
kEoB2IntroShapes04,
@@ -600,27 +618,27 @@ enum KyraResources {
kEoB2FinaleStrings,
kEoB2CreditsData,
kEoB2FinaleCPSFiles,
- kEoB2FinaleSeqData00,
- kEoB2FinaleSeqData01,
- kEoB2FinaleSeqData02,
- kEoB2FinaleSeqData03,
- kEoB2FinaleSeqData04,
- kEoB2FinaleSeqData05,
- kEoB2FinaleSeqData06,
- kEoB2FinaleSeqData07,
- kEoB2FinaleSeqData08,
- kEoB2FinaleSeqData09,
- kEoB2FinaleSeqData10,
- kEoB2FinaleSeqData11,
- kEoB2FinaleSeqData12,
- kEoB2FinaleSeqData13,
- kEoB2FinaleSeqData14,
- kEoB2FinaleSeqData15,
- kEoB2FinaleSeqData16,
- kEoB2FinaleSeqData17,
- kEoB2FinaleSeqData18,
- kEoB2FinaleSeqData19,
- kEoB2FinaleSeqData20,
+ kEob2FinaleAnimData00,
+ kEob2FinaleAnimData01,
+ kEob2FinaleAnimData02,
+ kEob2FinaleAnimData03,
+ kEob2FinaleAnimData04,
+ kEob2FinaleAnimData05,
+ kEob2FinaleAnimData06,
+ kEob2FinaleAnimData07,
+ kEob2FinaleAnimData08,
+ kEob2FinaleAnimData09,
+ kEob2FinaleAnimData10,
+ kEob2FinaleAnimData11,
+ kEob2FinaleAnimData12,
+ kEob2FinaleAnimData13,
+ kEob2FinaleAnimData14,
+ kEob2FinaleAnimData15,
+ kEob2FinaleAnimData16,
+ kEob2FinaleAnimData17,
+ kEob2FinaleAnimData18,
+ kEob2FinaleAnimData19,
+ kEob2FinaleAnimData20,
kEoB2FinaleShapes00,
kEoB2FinaleShapes03,
kEoB2FinaleShapes07,
@@ -744,7 +762,7 @@ public:
const Room *loadRoomTable(int id, int &entries);
const HofSeqData *loadHofSequenceData(int id, int &entries);
const ItemAnimData_v1 *loadShapeAnimData_v1(int id, int &entries);
- const ItemAnimData_v2 *loadShapeAnimData_v2(int id, int &entries);
+ const ItemAnimDefinition *loadItemAnimDefinition(int id, int &entries);
#if defined(ENABLE_EOB) || defined(ENABLE_LOL)
const uint16 *loadRawDataBe16(int id, int &entries);
const uint32 *loadRawDataBe32(int id, int &entries);
@@ -757,8 +775,8 @@ public:
const LoLButtonDef *loadButtonDefs(int id, int &entries);
#endif // ENABLE_LOL
#ifdef ENABLE_EOB
- const EoBSequenceStep *loadEoB2SeqData(int id, int &entries);
- const EoBShapeDef *loadEoB2ShapeData(int id, int &entries);
+ const DarkMoonAnimCommand *loadEoB2SeqData(int id, int &entries);
+ const DarkMoonShapeDef *loadEoB2ShapeData(int id, int &entries);
const EoBCharacter *loadEoBNpcData(int id, int &entries);
#endif // ENABLE_EOB
@@ -787,7 +805,7 @@ private:
bool loadRoomTable(Common::SeekableReadStream &stream, void *&ptr, int &size);
bool loadHofSequenceData(Common::SeekableReadStream &stream, void *&ptr, int &size);
bool loadShapeAnimData_v1(Common::SeekableReadStream &stream, void *&ptr, int &size);
- bool loadShapeAnimData_v2(Common::SeekableReadStream &stream, void *&ptr, int &size);
+ bool loadItemAnimDefinition(Common::SeekableReadStream &stream, void *&ptr, int &size);
#if defined(ENABLE_EOB) || defined(ENABLE_LOL)
bool loadRawDataBe16(Common::SeekableReadStream &stream, void *&ptr, int &size);
bool loadRawDataBe32(Common::SeekableReadStream &stream, void *&ptr, int &size);
@@ -813,7 +831,7 @@ private:
void freeRoomTable(void *&ptr, int &size);
void freeHofSequenceData(void *&ptr, int &size);
void freeHofShapeAnimDataV1(void *&ptr, int &size);
- void freeHofShapeAnimDataV2(void *&ptr, int &size);
+ void freeItemAnimDefinition(void *&ptr, int &size);
#if defined(ENABLE_EOB) || defined(ENABLE_LOL)
void freeRawDataBe16(void *&ptr, int &size);
void freeRawDataBe32(void *&ptr, int &size);
@@ -840,7 +858,7 @@ private:
k2SeqData = 5,
k2ShpAnimDataV1 = 6,
- k2ShpAnimDataV2 = 7,
+ k2ItemAnimDefinition = 7,
kLoLCharData = 8,
kLoLSpellData = 9,
diff --git a/engines/kyra/saveload_eob.cpp b/engines/kyra/saveload_eob.cpp
index ef5e8dc7a4..4a446aa3f3 100644
--- a/engines/kyra/saveload_eob.cpp
+++ b/engines/kyra/saveload_eob.cpp
@@ -28,6 +28,10 @@
#include "common/system.h"
#include "common/savefile.h"
#include "common/substream.h"
+#include "common/config-manager.h"
+#include "common/translation.h"
+
+#include "gui/message.h"
namespace Kyra {
@@ -106,7 +110,7 @@ Common::Error EoBCoreEngine::loadGameState(int slot) {
EoBCharacter *c = &_characters[i];
if (!c->flags || c->portrait < 0)
continue;
- c->faceShape = _screen->encodeShape((c->portrait % 10) << 2, (c->portrait / 10) << 5, 4, 32, true);
+ c->faceShape = _screen->encodeShape((c->portrait % 10) << 2, (c->portrait / 10) << 5, 4, 32, true, _cgaMappingDefault);
}
_screen->loadShapeSetBitmap(_flags.gameID == GI_EOB2 ? "OUTPORTS" : "OUTTAKE", 3, 3);
@@ -114,7 +118,7 @@ Common::Error EoBCoreEngine::loadGameState(int slot) {
EoBCharacter *c = &_characters[i];
if (!c->flags || c->portrait >= 0)
continue;
- c->faceShape = _screen->encodeShape((-(c->portrait + 1)) << 2, _flags.gameID == GI_EOB2 ? 0 : 160, 4, 32, true);
+ c->faceShape = _screen->encodeShape((-(c->portrait + 1)) << 2, _flags.gameID == GI_EOB2 ? 0 : 160, 4, 32, true, _cgaMappingDefault);
}
_screen->_curPage = 0;
@@ -134,7 +138,7 @@ Common::Error EoBCoreEngine::loadGameState(int slot) {
_updateFlags = in.readUint16BE();
_compassDirection = in.readUint16BE();
_currentControlMode = in.readUint16BE();
- _updateCharNum = in.readUint16BE();
+ _updateCharNum = in.readSint16BE();
_openBookSpellLevel = in.readSByte();
_openBookSpellSelectedItem = in.readSByte();
_openBookSpellListOffset = in.readSByte();
@@ -251,7 +255,7 @@ Common::Error EoBCoreEngine::loadGameState(int slot) {
m->attackerId = in.readSint16BE();
m->item = in.readSint16BE();
m->curBlock = in.readUint16BE();
- m->u2 = in.readUint16BE();
+ m->starting = in.readUint16BE();
m->u1 = in.readByte();
m->direction = in.readByte();
m->distance = in.readByte();
@@ -294,7 +298,7 @@ Common::Error EoBCoreEngine::loadGameState(int slot) {
useMagicBookOrSymbol(_openBookChar, _openBookType);
}
- _screen->copyRegion(0, 120, 0, 0, 176, 24, 0, 12, Screen::CR_NO_P_CHECK);
+ _screen->copyRegion(0, 120, 0, 0, 176, 24, 0, (_screen->getPageScaleFactor(0) == 2) ? 1 : 12, Screen::CR_NO_P_CHECK);
gui_toggleButtons();
setHandItem(_itemInHand);
@@ -395,7 +399,7 @@ Common::Error EoBCoreEngine::saveGameStateIntern(int slot, const char *saveName,
out->writeUint16BE(_updateFlags);
out->writeUint16BE(_compassDirection);
out->writeUint16BE(_currentControlMode);
- out->writeUint16BE(_updateCharNum);
+ out->writeSint16BE(_updateCharNum);
out->writeSByte(_openBookSpellLevel);
out->writeSByte(_openBookSpellSelectedItem);
out->writeSByte(_openBookSpellListOffset);
@@ -490,7 +494,7 @@ Common::Error EoBCoreEngine::saveGameStateIntern(int slot, const char *saveName,
out->writeSint16BE(m->attackerId);
out->writeSint16BE(m->item);
out->writeUint16BE(m->curBlock);
- out->writeUint16BE(m->u2);
+ out->writeUint16BE(m->starting);
out->writeByte(m->u1);
out->writeByte(m->direction);
out->writeByte(m->distance);
@@ -524,6 +528,346 @@ Common::Error EoBCoreEngine::saveGameStateIntern(int slot, const char *saveName,
return Common::kNoError;
}
+bool EoBCoreEngine::importOriginalSaveFile(int destSlot, const char *sourceFile) {
+ Common::Array<Common::String> origFiles;
+ Common::Array<int> newSlots;
+
+ if (sourceFile) {
+ // If a source file is specified via the console command we just check whether it exists.
+ if (Common::File::exists(sourceFile))
+ origFiles.push_back(sourceFile);
+ else
+ return false;
+ } else {
+ // Check for original save files in the game path (usually at least the "Quick Start Party" file will be present).
+ int numMax = (_flags.gameID == GI_EOB1) ? 1 : 6;
+ const char *pattern = (_flags.gameID == GI_EOB1) ? "EOBDATA.SAV" : "EOBDATA%d.SAV";
+ for (int i = 0; i < numMax; ++i) {
+ Common::String temp = Common::String::format(pattern, i);
+ Common::SeekableReadStream *fs = _res->createReadStream(temp);
+ if (fs) {
+ Common::String dsc;
+ if (_flags.gameID == GI_EOB2) {
+ char descStr[20];
+ fs->read(descStr, 20);
+ dsc = Common::String::format("(\"%s\")", descStr).c_str();
+ }
+
+ delete fs;
+ ::GUI::MessageDialog dialog(Common::String::format(_("The following original save game file has been found in your game path:\n\n%s %s\n\nDo you wish to use this save game file with ScummVM?\n\n"), temp.c_str(), dsc.c_str()), _("Yes"), _("No"));
+ if (dialog.runModal())
+ origFiles.push_back(temp);
+ }
+ }
+ }
+
+ int numFilesFound = origFiles.size();
+ if (!numFilesFound)
+ return false;
+
+ _gui->updateSaveSlotsList(_targetName, true);
+
+ // Find free save slots for the original save files
+ if (destSlot == -1) {
+ int assignedSlots = 0;
+ for (int testSlot = 0; testSlot < 990 && assignedSlots < numFilesFound; testSlot++) {
+ if (Common::find(_gui->_saveSlots.begin(), _gui->_saveSlots.end(), testSlot) == _gui->_saveSlots.end()) {
+ newSlots.push_back(testSlot);
+ assignedSlots++;
+ }
+ }
+
+ // This will probably never happen, since we do have 990 save slots
+ if (assignedSlots != numFilesFound)
+ warning("%d original save files could not be converted due to missing save game slots", numFilesFound - assignedSlots);
+
+ } else {
+ newSlots.push_back(destSlot);
+ }
+
+ if (destSlot != -1) {
+ if (Common::find(_gui->_saveSlots.begin(), _gui->_saveSlots.end(), destSlot) != _gui->_saveSlots.end()) {
+ ::GUI::MessageDialog dialog(Common::String::format(_("A save game file was found in the specified slot %d. Overwrite?\n\n"), destSlot), _("Yes"), _("No"));
+ if (!dialog.runModal())
+ return false;
+ }
+ }
+
+ int importedCount = 0;
+ for (int i = 0; i < numFilesFound; i++) {
+ Common::String desc = readOriginalSaveFile(origFiles[i]);
+ if (desc.empty()) {
+ warning("Unable to import original save file '%s'", origFiles[i].c_str());
+ } else {
+ // We can't make thumbnails here, since we do not want to load all the level data, monsters, etc. for each save we convert.
+ // Instead, we use an empty surface to avoid that createThumbnailFromScreen() makes a completely pointless thumbnail from
+ // whatever screen that is currently shown when this function is called.
+ Graphics::Surface dummy;
+ saveGameStateIntern(newSlots[i], desc.c_str(), &dummy);
+ warning("Imported original save file '%s' ('%s')", origFiles[i].c_str(), desc.c_str());
+ importedCount++;
+ }
+ }
+
+ _currentLevel = 0;
+ _currentSub = 0;
+ _currentBlock = 0;
+ _currentDirection = 0;
+ _itemInHand = 0;
+ _hasTempDataFlags = 0;
+ _partyEffectFlags = 0;
+ memset(_characters, 0, sizeof(EoBCharacter) * 6);
+ _inf->reset();
+
+ if (destSlot == -1 && importedCount) {
+ ::GUI::MessageDialog dialog(Common::String::format(_("%d original save game files have been successfully imported into\nScummVM. If you want to manually import original save game files later you will\nneed to open the ScummVM debug console and use the command 'import_savefile'.\n\n"), importedCount));
+ dialog.runModal();
+ }
+
+ return true;
+}
+
+Common::String EoBCoreEngine::readOriginalSaveFile(Common::String &file) {
+ Common::String desc;
+
+ Common::SeekableReadStream *fs = _res->createReadStream(file);
+ if (!fs)
+ return desc;
+
+ Common::SeekableSubReadStreamEndian in(fs, 0, fs->size(), _flags.platform == Common::kPlatformAmiga, DisposeAfterUse::YES);
+
+ if (_flags.gameID == GI_EOB1) {
+ // Nothing to read here for EOB 1. Original EOB 1 has
+ // only one save slot without save file description.
+ desc = "<IMPORTED GAME>";
+ } else {
+ char tempStr[20];
+ in.read(tempStr, 20);
+ desc = tempStr;
+ }
+
+ for (int i = 0; i < 6; i++) {
+ EoBCharacter *c = &_characters[i];
+ c->id = in.readByte();
+ c->flags = in.readByte();
+ in.read(c->name, 11);
+ c->strengthCur = in.readSByte();
+ c->strengthMax = in.readSByte();
+ c->strengthExtCur = in.readSByte();
+ c->strengthExtMax = in.readSByte();
+ c->intelligenceCur = in.readSByte();
+ c->intelligenceMax = in.readSByte();
+ c->wisdomCur = in.readSByte();
+ c->wisdomMax = in.readSByte();
+ c->dexterityCur = in.readSByte();
+ c->dexterityMax = in.readSByte();
+ c->constitutionCur = in.readSByte();
+ c->constitutionMax = in.readSByte();
+ c->charismaCur = in.readSByte();
+ c->charismaMax = in.readSByte();
+ c->hitPointsCur = (_flags.gameID == GI_EOB1) ? in.readSByte() : in.readSint16();
+ c->hitPointsMax = (_flags.gameID == GI_EOB1) ? in.readSByte() : in.readSint16();
+ c->armorClass = in.readSByte();
+ c->disabledSlots = in.readByte();
+ c->raceSex = in.readByte();
+ c->cClass = in.readByte();
+ c->alignment = in.readByte();
+ c->portrait = in.readSByte();
+ c->food = in.readByte();
+ in.read(c->level, 3);
+ for (int ii = 0; ii < 3; ii++)
+ c->experience[ii] = in.readUint32();
+ in.skip(4);
+ delete[] c->faceShape;
+ c->faceShape = 0;
+ in.read(c->mageSpells, (_flags.gameID == GI_EOB1) ? 30 :80);
+ in.read(c->clericSpells, (_flags.gameID == GI_EOB1) ? 30 : 80);
+ c->mageSpellsAvailableFlags = in.readUint32();
+ for (int ii = 0; ii < 27; ii++)
+ c->inventory[ii] = in.readSint16();
+ uint32 ct = _system->getMillis();
+ for (int ii = 0; ii < 10; ii++) {
+ c->timers[ii] = in.readUint32() * _tickLength;
+ if (c->timers[ii])
+ c->timers[ii] += ct;
+ }
+ in.read(c->events, 10);
+ in.read(c->effectsRemainder, 4);
+ c->effectFlags = in.readUint32();
+ if (c->effectFlags && _flags.gameID == GI_EOB1) {
+ warning("EoBCoreEngine::readOriginalSaveFile(): Unhandled character effect flags encountered in original EOB1 save file '%s' ('%s')", file.c_str(), desc.c_str());
+ c->effectFlags = 0;
+ }
+ c->damageTaken = in.readByte();
+ in.read(c->slotStatus, 5);
+ in.skip(6);
+ }
+
+ setupCharacterTimers();
+
+ _currentLevel = in.readUint16();
+ _currentSub = (_flags.gameID == GI_EOB1) ? 0 : in.readSint16();
+ _currentBlock = in.readUint16();
+ _currentDirection = in.readUint16();
+ _itemInHand = in.readSint16();
+ _hasTempDataFlags = (_flags.gameID == GI_EOB1) ? in.readUint16() : in.readUint32();
+ _partyEffectFlags = (_flags.gameID == GI_EOB1) ? in.readUint16() : in.readUint32();
+ if (_partyEffectFlags && _flags.gameID == GI_EOB1) {
+ warning("EoBCoreEngine::readOriginalSaveFile(): Unhandled party effect flags encountered in original EOB1 save file '%s' ('%s')", file.c_str(), desc.c_str());
+ _partyEffectFlags = 0;
+ }
+ if (_flags.gameID == GI_EOB2)
+ in.skip(1);
+
+ _inf->loadState(in, true);
+
+ int numItems = (_flags.gameID == GI_EOB1) ? 500 : 600;
+ for (int i = 0; i < numItems; i++) {
+ EoBItem *t = &_items[i];
+ t->nameUnid = in.readByte();
+ t->nameId = in.readByte();
+ t->flags = in.readByte();
+ t->icon = in.readSByte();
+ t->type = in.readSByte();
+ t->pos = in.readSByte();
+ t->block = in.readSint16();
+ t->next = in.readSint16();
+ t->prev = in.readSint16();
+ t->level = in.readByte();
+ t->value = in.readSByte();
+ }
+
+ int numParts = (_flags.gameID == GI_EOB1) ? 13 : 18;
+ int partSize = (_flags.gameID == GI_EOB1) ? 2040 : 2130;
+ uint32 nextPart = in.pos();
+ uint8 *cmpData = new uint8[1200];
+
+ for (int i = 0; i < numParts; i++) {
+ in.seek(nextPart);
+ nextPart += partSize;
+
+ if (!(_hasTempDataFlags & (1 << i)))
+ continue;
+
+ if (_lvlTempData[i]) {
+ delete[] _lvlTempData[i]->wallsXorData;
+ delete[] _lvlTempData[i]->flags;
+ releaseMonsterTempData(_lvlTempData[i]);
+ releaseFlyingObjectTempData(_lvlTempData[i]);
+ releaseWallOfForceTempData(_lvlTempData[i]);
+ delete _lvlTempData[i];
+ }
+
+ _lvlTempData[i] = new LevelTempData;
+ LevelTempData *l = _lvlTempData[i];
+ l->wallsXorData = new uint8[4096];
+ l->flags = new uint16[1024];
+ memset(l->flags, 0, 1024 * sizeof(uint16));
+ EoBMonsterInPlay *lm = new EoBMonsterInPlay[30];
+ l->monsters = lm;
+ EoBFlyingObject *lf = new EoBFlyingObject[_numFlyingObjects];
+ memset(lf, 0, _numFlyingObjects * sizeof(EoBFlyingObject));
+ l->flyingObjects = lf;
+ WallOfForce *lw = new WallOfForce[5];
+ memset(lw, 0, 5 * sizeof(WallOfForce));
+ l->wallsOfForce = lw;
+
+ in.read(cmpData, 1200);
+ _screen->decodeFrame4(cmpData, l->wallsXorData, 4096);
+ _curBlockFile = getBlockFileName(i + 1, 0);
+ const uint8 *p = getBlockFileData();
+ uint16 len = READ_LE_UINT16(p + 4);
+ p += 6;
+
+ uint8 *d = l->wallsXorData;
+ for (int ii = 0; ii < 1024; ii++) {
+ for (int iii = 0; iii < 4; iii++)
+ *d++ ^= p[ii * len + iii];
+ }
+
+ for (int ii = 0; ii < 30; ii++) {
+ EoBMonsterInPlay *m = &lm[ii];
+ m->type = in.readByte();
+ m->unit = in.readByte();
+ m->block = in.readUint16();
+ m->pos = in.readByte();
+ m->dir = in.readSByte();
+ m->animStep = in.readByte();
+ m->shpIndex = in.readByte();
+ m->mode = in.readSByte();
+ m->f_9 = in.readSByte();
+ m->curAttackFrame = in.readSByte();
+ m->spellStatusLeft = in.readSByte();
+ m->hitPointsMax = in.readSint16();
+ m->hitPointsCur = in.readSint16();
+ m->dest = in.readUint16();
+ m->randItem = in.readUint16();
+ m->fixedItem = in.readUint16();
+ m->flags = in.readByte();
+ m->idleAnimState = in.readByte();
+
+ if (_flags.gameID == GI_EOB1)
+ m->stepsTillRemoteAttack = in.readByte();
+ else
+ m->curRemoteWeapon = in.readByte();
+
+ m->numRemoteAttacks = in.readByte();
+ m->palette = in.readSByte();
+
+ if (_flags.gameID == GI_EOB1) {
+ in.skip(1);
+ } else {
+ m->directionChanged = in.readByte();
+ m->stepsTillRemoteAttack = in.readByte();
+ m->sub = in.readByte();
+ }
+
+ _levelBlockProperties[m->block].flags++;
+ }
+
+ if (_flags.gameID == GI_EOB1)
+ continue;
+
+ for (int ii = 0; ii < 5; ii++) {
+ WallOfForce *w = &lw[ii];
+ w->block = in.readUint16();
+ w->duration = in.readUint32();
+ }
+ }
+
+ delete[] cmpData;
+
+ restoreBlockTempData(_currentLevel);
+
+ in.skip(3);
+
+ delete[] _itemTypes;
+ _itemTypes = new EoBItemType[65];
+ memset(_itemTypes, 0, sizeof(EoBItemType) * 65);
+
+ if (_flags.gameID == GI_EOB1)
+ return desc;
+
+ for (int i = 51; i < 65; i++) {
+ EoBItemType *t = &_itemTypes[i];
+ t->invFlags = in.readUint16();
+ t->handFlags = in.readUint16();
+ t->armorClass = in.readSByte();
+ t->allowedClasses = in.readSByte();
+ t->requiredHands = in.readSByte();
+ t->dmgNumDiceS = in.readSByte();
+ t->dmgNumPipsS = in.readSByte();
+ t->dmgIncS = in.readSByte();
+ t->dmgNumDiceL = in.readSByte();
+ t->dmgNumPipsL = in.readSByte();
+ t->dmgIncL = in.readSByte();
+ t->unk1 = in.readByte();
+ t->extraProperties = in.readUint16();
+ }
+
+ return in.err() ? Common::String() : desc;
+}
+
void *EoBCoreEngine::generateMonsterTempData(LevelTempData *tmp) {
EoBMonsterInPlay *m = new EoBMonsterInPlay[30];
memcpy(m, _monsters, sizeof(EoBMonsterInPlay) * 30);
diff --git a/engines/kyra/saveload_rpg.cpp b/engines/kyra/saveload_rpg.cpp
index 2e9f0228cf..f3eef0d811 100644
--- a/engines/kyra/saveload_rpg.cpp
+++ b/engines/kyra/saveload_rpg.cpp
@@ -118,7 +118,7 @@ void KyraRpgEngine::restoreFlyingObjectTempData(LevelTempData *tmp) {
}
void KyraRpgEngine::releaseFlyingObjectTempData(LevelTempData *tmp) {
- EoBFlyingObject *p = (EoBFlyingObject*)tmp->flyingObjects;
+ EoBFlyingObject *p = (EoBFlyingObject *)tmp->flyingObjects;
delete[] p;
}
diff --git a/engines/kyra/scene_eob.cpp b/engines/kyra/scene_eob.cpp
index 982191b359..3db055db90 100644
--- a/engines/kyra/scene_eob.cpp
+++ b/engines/kyra/scene_eob.cpp
@@ -38,31 +38,7 @@ void EoBCoreEngine::loadLevel(int level, int sub) {
_currentSub = sub;
uint32 end = _system->getMillis() + 500;
- Common::String file;
- Common::SeekableReadStream *s = 0;
- static const char *suffix[] = { "INF", "DRO", "ELO", 0 };
-
- for (const char *const *sf = suffix; *sf && !s; sf++) {
- file = Common::String::format("LEVEL%d.%s", level, *sf);
- s = _res->createReadStream(file);
- }
-
- if (!s)
- error("Failed to load level file LEVEL%d.INF/DRO/ELO", level);
-
- if (s->readUint16LE() + 2 == s->size()) {
- if (s->readUint16LE() == 4) {
- delete s;
- s = 0;
- _screen->loadBitmap(file.c_str(), 5, 5, 0);
- }
- }
-
- if (s) {
- s->seek(0);
- _screen->loadFileDataToPage(s, 5, 15000);
- delete s;
- }
+ readLevelFileData(level);
Common::String gfxFile;
// Work around for issue with corrupt (incomplete) monster property data
@@ -110,8 +86,8 @@ void EoBCoreEngine::loadLevel(int level, int sub) {
pos += 2;
}
- loadVcnData(gfxFile.c_str(), 0);
- _screen->loadEoBBitmap("INVENT", 0, 5, 3, 2);
+ loadVcnData(gfxFile.c_str(), (_flags.gameID == GI_EOB1) ? _cgaMappingLevel[_cgaLevelMappingIndex[level - 1]] : 0);
+ _screen->loadEoBBitmap("INVENT", _cgaMappingInv, 5, 3, 2);
delayUntil(end);
snd_stopSound();
@@ -121,6 +97,34 @@ void EoBCoreEngine::loadLevel(int level, int sub) {
_screen->setCurPage(0);
}
+void EoBCoreEngine::readLevelFileData(int level) {
+ Common::String file;
+ Common::SeekableReadStream *s = 0;
+ static const char *suffix[] = { "INF", "DRO", "ELO", 0 };
+
+ for (const char *const *sf = suffix; *sf && !s; sf++) {
+ file = Common::String::format("LEVEL%d.%s", level, *sf);
+ s = _res->createReadStream(file);
+ }
+
+ if (!s)
+ error("Failed to load level file LEVEL%d.INF/DRO/ELO", level);
+
+ if (s->readUint16LE() + 2 == s->size()) {
+ if (s->readUint16LE() == 4) {
+ delete s;
+ s = 0;
+ _screen->loadBitmap(file.c_str(), 5, 5, 0);
+ }
+ }
+
+ if (s) {
+ s->seek(0);
+ _screen->loadFileDataToPage(s, 5, 15000);
+ delete s;
+ }
+}
+
Common::String EoBCoreEngine::initLevelData(int sub) {
const uint8 *data = _screen->getCPagePtr(5) + 2;
const uint8 *pos = data;
@@ -138,20 +142,23 @@ Common::String EoBCoreEngine::initLevelData(int sub) {
loadBlockProperties((const char *)pos);
pos += slen;
- Common::SeekableReadStream *s = _res->createReadStream(Common::String::format("%s.VMP", (const char *)pos));
- uint16 size = s->readUint16LE();
+ const char *vmpPattern = (_flags.gameID == GI_EOB1 && (_configRenderMode == Common::kRenderEGA || _configRenderMode == Common::kRenderCGA)) ? "%s.EMP" : "%s.VMP";
+ Common::SeekableReadStream *s = _res->createReadStream(Common::String::format(vmpPattern, (const char *)pos));
+ _vmpSize = s->readUint16LE();
delete[] _vmpPtr;
- _vmpPtr = new uint16[size];
- for (int i = 0; i < size; i++)
+ _vmpPtr = new uint16[_vmpSize];
+ for (int i = 0; i < _vmpSize; i++)
_vmpPtr[i] = s->readUint16LE();
delete s;
- Common::String tmpStr = Common::String::format("%s.PAL", (const char *)pos);
+ const char *paletteFilePattern = (_flags.gameID == GI_EOB2 && _configRenderMode == Common::kRenderEGA) ? "%s.EGA" : "%s.PAL";
+
+ Common::String tmpStr = Common::String::format(paletteFilePattern, (const char *)pos);
_curGfxFile = (const char *)pos;
pos += slen;
if (*pos++ != 0xff && _flags.gameID == GI_EOB2) {
- tmpStr = Common::String::format("%s.PAL", (const char *)pos);
+ tmpStr = Common::String::format(paletteFilePattern, (const char *)pos);
pos += 13;
}
@@ -161,21 +168,26 @@ Common::String EoBCoreEngine::initLevelData(int sub) {
_screen->setShapeFadeMode(1, false);
}
- _screen->loadPalette(tmpStr.c_str(), _screen->getPalette(0));
-
- Palette backupPal(256);
- backupPal.copy(_screen->getPalette(0), 224, 32, 224);
- _screen->getPalette(0).fill(224, 32, 0x3f);
- uint8 *src = _screen->getPalette(0).getData();
-
- _screen->createFadeTable(src, _screen->getFadeTable(0), 4, 75); // green
- _screen->createFadeTable(src, _screen->getFadeTable(1), 12, 200); // black
- _screen->createFadeTable(src, _screen->getFadeTable(2), 10, 85); // blue
- _screen->createFadeTable(src, _screen->getFadeTable(3), 11, 125); // light blue
-
- _screen->getPalette(0).copy(backupPal, 224, 32, 224);
- _screen->createFadeTable(src, _screen->getFadeTable(4), 12, 85); // grey (shadow)
- _screen->setFadeTableIndex(4);
+ if (_flags.gameID == GI_EOB2 || _configRenderMode != Common::kRenderEGA)
+ _screen->loadPalette(tmpStr.c_str(), _screen->getPalette(0));
+
+ if (_configRenderMode != Common::kRenderCGA) {
+ Palette backupPal(256);
+ backupPal.copy(_screen->getPalette(0), 224, 32, 224);
+ _screen->getPalette(0).fill(224, 32, 0x3f);
+ uint8 *src = _screen->getPalette(0).getData();
+
+ _screen->createFadeTable(src, _screen->getFadeTable(0), 4, 75); // green
+ _screen->createFadeTable(src, _screen->getFadeTable(1), 12, 200); // black
+ _screen->createFadeTable(src, _screen->getFadeTable(2), 10, 85); // blue
+ _screen->createFadeTable(src, _screen->getFadeTable(3), 11, 125); // light blue
+
+ _screen->getPalette(0).copy(backupPal, 224, 32, 224);
+ _screen->createFadeTable(src, _screen->getFadeTable(4), 12, 85); // grey (shadow)
+ _screen->setFadeTableIndex(4);
+ if (_flags.gameID == GI_EOB2 && _configRenderMode == Common::kRenderEGA)
+ _screen->setScreenPalette(_screen->getPalette(0));
+ }
}
if (_flags.gameID == GI_EOB2) {
@@ -263,19 +275,98 @@ void EoBCoreEngine::addLevelItems() {
}
}
-void EoBCoreEngine::loadVcnData(const char *file, const char * /*nextFile*/) {
+void EoBCoreEngine::loadVcnData(const char *file, const uint8 *cgaMapping) {
if (file)
strcpy(_lastBlockDataFile, file);
- _screen->loadBitmap(Common::String::format("%s.VCN", _lastBlockDataFile).c_str(), 3, 3, 0);
- const uint8 *v = _screen->getCPagePtr(2);
- uint32 tlen = READ_LE_UINT16(v) << 5;
- v += 2;
- memcpy(_vcnExpTable, v, 32);
- v += 32;
+ const char *filePattern = (_flags.gameID == GI_EOB1 && (_configRenderMode == Common::kRenderEGA || _configRenderMode == Common::kRenderCGA)) ? "%s.ECN" : "%s.VCN";
+ _screen->loadBitmap(Common::String::format(filePattern, _lastBlockDataFile).c_str(), 3, 3, 0);
+ const uint8 *pos = _screen->getCPagePtr(3);
+
+ uint32 vcnSize = READ_LE_UINT16(pos) * _vcnBlockWidth * _vcnBlockHeight;
+ pos += 2;
+
+ const uint8 *colMap = pos;
+ pos += 32;
+
delete[] _vcnBlocks;
- _vcnBlocks = new uint8[tlen];
- memcpy(_vcnBlocks, v, tlen);
+ _vcnBlocks = new uint8[vcnSize];
+
+ if (_flags.gameID == GI_EOB2 && _configRenderMode == Common::kRenderEGA) {
+ const uint8 *egaTable = _screen->getEGADitheringTable();
+ assert(_vmpPtr);
+ assert(egaTable);
+
+ delete[] _vcnTransitionMask;
+ _vcnTransitionMask = new uint8[vcnSize];
+
+ for (int i = 0; i < _vmpSize; i++) {
+ uint16 vcnOffs = _vmpPtr[i] & 0x3FFF;
+ const uint8 *src = &pos[vcnOffs << 5];
+ uint8 *dst1 = &_vcnBlocks[vcnOffs << 7];
+ uint8 *dst3 = &_vcnTransitionMask[vcnOffs << 7];
+ int palOffset = (i < 330) ? 0 : _wllVcnOffset;
+
+ for (int y = 0; y < 8; y++) {
+ uint8 *dst2 = dst1 + 8;
+ uint8 *dst4 = dst3 + 8;
+
+ for (int x = 0; x < 4; x++) {
+ uint8 in = *src++;
+
+ dst1[0] = dst2[0] = egaTable[colMap[(in >> 4) + palOffset]];
+ dst1[1] = dst2[1] = egaTable[colMap[(in & 0x0f) + palOffset]];
+ dst3[0] = dst4[0] = (in & 0xf0) ? 0 : 0xff;
+ dst3[1] = dst4[1] = (in & 0x0f) ? 0 : 0xff;
+
+ dst1 += 2;
+ dst2 += 2;
+ dst3 += 2;
+ dst4 += 2;
+ }
+
+ dst1 += 8;
+ dst3 += 8;
+ }
+ }
+ } else if (_configRenderMode == Common::kRenderCGA) {
+ uint8 *tmp = _screen->encodeShape(0, 0, 1, 8, false, cgaMapping);
+ delete[] tmp;
+
+ delete[] _vcnTransitionMask;
+ _vcnTransitionMask = new uint8[vcnSize];
+ uint8 tblSwitch = 0;
+ uint8 *dst = _vcnBlocks;
+ uint8 *dst2 = _vcnTransitionMask;
+
+ while (dst < _vcnBlocks + vcnSize) {
+ const uint16 *table = _screen->getCGADitheringTable((tblSwitch++) & 1);
+ for (int ii = 0; ii < 2; ii++) {
+ *dst++ = ((table[pos[0]] & 0x000f) << 4) | ((table[pos[0]] & 0x0f00) >> 8);
+ *dst++= ((table[pos[1]] & 0x000f) << 4) | ((table[pos[1]] & 0x0f00) >> 8);
+
+ uint8 msk = 0;
+ if (pos[0] & 0xf0)
+ msk |= 0x30;
+ if (pos[0] & 0x0f)
+ msk |= 0x03;
+ *dst2++ = msk ^ 0x33;
+
+ msk = 0;
+ if (pos[1] & 0xf0)
+ msk |= 0x30;
+ if (pos[1] & 0x0f)
+ msk |= 0x03;
+ *dst2++ = msk ^ 0x33;
+
+ pos += 2;
+ }
+ }
+ } else {
+ if (_configRenderMode != Common::kRenderEGA)
+ memcpy(_vcnColTable, colMap, 32);
+ memcpy(_vcnBlocks, pos, vcnSize);
+ }
}
void EoBCoreEngine::loadBlockProperties(const char *mazFile) {
@@ -297,16 +388,36 @@ const uint8 *EoBCoreEngine::getBlockFileData(int) {
Common::SeekableReadStream *s = _res->createReadStream(_curBlockFile);
_screen->loadFileDataToPage(s, 15, s->size());
delete s;
- return _screen->getCPagePtr(14);
+ return _screen->getCPagePtr(15);
+}
+
+Common::String EoBCoreEngine::getBlockFileName(int levelIndex, int sub) {
+ readLevelFileData(levelIndex);
+ const uint8 *data = _screen->getCPagePtr(5) + 2;
+ const uint8 *pos = data;
+
+ for (int i = 0; i < sub; i++)
+ pos = data + READ_LE_UINT16(pos);
+
+ pos += 2;
+
+ if (*pos++ == 0xEC || _flags.gameID == GI_EOB1) {
+ if (_flags.gameID == GI_EOB1)
+ pos -= 3;
+
+ return Common::String((const char *)pos);
+ }
+
+ return Common::String();
}
const uint8 *EoBCoreEngine::getBlockFileData(const char *mazFile) {
_curBlockFile = mazFile;
- return getBlockFileData(0);
+ return getBlockFileData();
}
void EoBCoreEngine::loadDecorations(const char *cpsFile, const char *decFile) {
- _screen->loadShapeSetBitmap(cpsFile, 3, 3);
+ _screen->loadShapeSetBitmap(cpsFile, 5, 3);
Common::SeekableReadStream *s = _res->createReadStream(decFile);
_levelDecorationDataSize = s->readUint16LE();
@@ -376,7 +487,7 @@ void EoBCoreEngine::assignWallsAndDecorations(int wallIndex, int vmpIndex, int d
if (r->w == 0 || r->h == 0)
error("Error trying to make decoration %d (x: %d, y: %d, w: %d, h: %d)", decIndex, r->x, r->y, r->w, r->h);
- _levelDecorationShapes[t] = _screen->encodeShape(r->x, r->y, r->w, r->h);
+ _levelDecorationShapes[t] = _screen->encodeShape(r->x, r->y, r->w, r->h, false, (_flags.gameID == GI_EOB1) ? _cgaMappingLevel[_cgaLevelMappingIndex[_currentLevel - 1]] : 0);
}
decIndex = _levelDecorationProperties[_mappedDecorationsCount++].next;
diff --git a/engines/kyra/scene_lol.cpp b/engines/kyra/scene_lol.cpp
index 796db9a340..628654f127 100644
--- a/engines/kyra/scene_lol.cpp
+++ b/engines/kyra/scene_lol.cpp
@@ -358,7 +358,7 @@ void LoLEngine::loadLevelGraphics(const char *file, int specialColor, int weight
memcpy(_vcnShift, v, tlen);
v += tlen;
- memcpy(_vcnExpTable, v, 128);
+ memcpy(_vcnColTable, v, 128);
v += 128;
if (_lastOverridePalFilePtr) {
@@ -451,7 +451,7 @@ void LoLEngine::loadLevelGraphics(const char *file, int specialColor, int weight
for (int i = 0; i < 8; i++) {
uint8 *pl = _screen->getLevelOverlay(7 - i);
for (int ii = 0; ii < 16; ii++)
- _vcnExpTable[(i << 4) + ii] = pl[(ii << 4) | ii];
+ _vcnColTable[(i << 4) + ii] = pl[(ii << 4) | ii];
}
}
@@ -1436,7 +1436,7 @@ void LoLEngine::drawSceneShapes(int) {
if (v > 80)
v = 80;
- scaleLevelShapesDim(t, dimY1, dimY2, _sceneShpDim);
+ setDoorShapeDim(t, dimY1, dimY2, _sceneShpDim);
drawDoor(_doorShapes[(s < 23 ? _dscDoorShpIndex[s] : 0)], 0, t, 10, 0, -v, 2);
setLevelShapesDim(t, dimY1, dimY2, _sceneShpDim);
}
diff --git a/engines/kyra/scene_rpg.cpp b/engines/kyra/scene_rpg.cpp
index 07a7a879b1..b015b10cd9 100644
--- a/engines/kyra/scene_rpg.cpp
+++ b/engines/kyra/scene_rpg.cpp
@@ -51,7 +51,7 @@ void KyraRpgEngine::setLevelShapesDim(int index, int16 &x1, int16 &x2, int dim)
if (t > x1) {
x1 = t;
if (!(a & 0x10))
- scaleLevelShapesDim(index, y1, y2, -1);
+ setDoorShapeDim(index, y1, y2, -1);
}
t = _dscDim2[((m + i) << 1) + 1];
@@ -59,7 +59,7 @@ void KyraRpgEngine::setLevelShapesDim(int index, int16 &x1, int16 &x2, int dim)
if (t < x2) {
x2 = t;
if (!(a & 0x10))
- scaleLevelShapesDim(index, y1, y2, -1);
+ setDoorShapeDim(index, y1, y2, -1);
}
} else {
int t = _dscDim1[m + i];
@@ -100,17 +100,20 @@ void KyraRpgEngine::setLevelShapesDim(int index, int16 &x1, int16 &x2, int dim)
drawLevelModifyScreenDim(dim, x1, 0, x2, 15);
}
-void KyraRpgEngine::scaleLevelShapesDim(int index, int16 &y1, int16 &y2, int dim) {
- static const int8 dscY1[] = { 0x1E, 0x18, 0x10, 0x00 };
- static const int8 dscY2[] = { 0x3B, 0x47, 0x56, 0x78 };
-
+void KyraRpgEngine::setDoorShapeDim(int index, int16 &y1, int16 &y2, int dim) {
uint8 a = _dscDimMap[index];
- if (dim == -1 && a != 3)
+ if (_flags.gameID != GI_EOB1 && dim == -1 && a != 3)
a++;
- y1 = dscY1[a];
- y2 = dscY2[a];
+ uint8 b = a;
+ if (_flags.gameID == GI_EOB1) {
+ a += _dscDoorFrameIndex1[_currentLevel - 1];
+ b += _dscDoorFrameIndex2[_currentLevel - 1];
+ }
+
+ y1 = _dscDoorFrameY1[a];
+ y2 = _dscDoorFrameY2[b];
if (dim == -1)
return;
@@ -345,19 +348,21 @@ bool KyraRpgEngine::checkSceneUpdateNeed(int block) {
void KyraRpgEngine::drawVcnBlocks() {
uint8 *d = _sceneWindowBuffer;
uint16 *bdb = _blockDrawingBuffer;
+ uint16 pitch = 22 * _vcnBlockWidth * 2;
+ uint8 pxl[2];
+ pxl[0] = pxl[1] = 0;
for (int y = 0; y < 15; y++) {
for (int x = 0; x < 22; x++) {
bool horizontalFlip = false;
- int remainder = 0;
-
uint16 vcnOffset = *bdb++;
+ uint16 vcnExtraOffsetWll = 0;
int wllVcnOffset = 0;
int wllVcnRmdOffset = 0;
if (vcnOffset & 0x8000) {
// this renders a wall block over the transparent pixels of a floor/ceiling block
- remainder = vcnOffset - 0x8000;
+ vcnExtraOffsetWll = vcnOffset - 0x8000;
vcnOffset = 0;
wllVcnRmdOffset = _wllVcnOffset;
}
@@ -369,7 +374,7 @@ void KyraRpgEngine::drawVcnBlocks() {
uint8 *src = 0;
if (vcnOffset) {
- src = &_vcnBlocks[vcnOffset << 5];
+ src = &_vcnBlocks[vcnOffset * _vcnBlockWidth * _vcnBlockHeight];
wllVcnOffset = _wllVcnOffset;
} else {
// floor/ceiling blocks
@@ -379,83 +384,101 @@ void KyraRpgEngine::drawVcnBlocks() {
vcnOffset &= 0x3fff;
}
- src = (_vcfBlocks ? _vcfBlocks : _vcnBlocks) + (vcnOffset << 5);
+ src = (_vcfBlocks ? _vcfBlocks : _vcnBlocks) + (vcnOffset * _vcnBlockWidth * _vcnBlockHeight);
}
uint8 shift = _vcnShift ? _vcnShift[vcnOffset] : _blockBrightness;
if (horizontalFlip) {
- for (int blockY = 0; blockY < 8; blockY++) {
- src += 3;
- for (int blockX = 0; blockX < 4; blockX++) {
- uint8 t = *src--;
- *d++ = _vcnExpTable[((t & 0x0f) + wllVcnOffset) | shift];
- *d++ = _vcnExpTable[((t >> 4) + wllVcnOffset) | shift];
+ for (int blockY = 0; blockY < _vcnBlockHeight; blockY++) {
+ src += (_vcnBlockWidth - 1);
+ for (int blockX = 0; blockX < _vcnBlockWidth; blockX++) {
+ uint8 bl = *src--;
+ d[_vcnFlip0] = _vcnColTable[((bl & 0x0f) + wllVcnOffset) | shift];
+ d[_vcnFlip1] = _vcnColTable[((bl >> 4) + wllVcnOffset) | shift];
+ d += 2;
}
- src += 5;
- d += 168;
+ src += (_vcnBlockWidth + 1);
+ d += (pitch - 2 * _vcnBlockWidth);
}
} else {
- for (int blockY = 0; blockY < 8; blockY++) {
- for (int blockX = 0; blockX < 4; blockX++) {
- uint8 t = *src++;
- *d++ = _vcnExpTable[((t >> 4) + wllVcnOffset) | shift];
- *d++ = _vcnExpTable[((t & 0x0f) + wllVcnOffset) | shift];
+ for (int blockY = 0; blockY < _vcnBlockHeight; blockY++) {
+ for (int blockX = 0; blockX < _vcnBlockWidth; blockX++) {
+ uint8 bl = *src++;
+ *d++ = _vcnColTable[((bl >> 4) + wllVcnOffset) | shift];
+ *d++ = _vcnColTable[((bl & 0x0f) + wllVcnOffset) | shift];
}
- d += 168;
+ d += (pitch - 2 * _vcnBlockWidth);
}
}
- d -= 1400;
+ d -= (pitch * _vcnBlockHeight - 2 * _vcnBlockWidth);
- if (remainder) {
- d -= 8;
+ if (vcnExtraOffsetWll) {
+ d -= (2 * _vcnBlockWidth);
horizontalFlip = false;
- if (remainder & 0x4000) {
- remainder &= 0x3fff;
+ if (vcnExtraOffsetWll & 0x4000) {
+ vcnExtraOffsetWll &= 0x3fff;
horizontalFlip = true;
}
- shift = _vcnShift ? _vcnShift[remainder] : _blockBrightness;
- src = &_vcnBlocks[remainder << 5];
+ shift = _vcnShift ? _vcnShift[vcnExtraOffsetWll] : _blockBrightness;
+ src = &_vcnBlocks[vcnExtraOffsetWll * _vcnBlockWidth * _vcnBlockHeight];
+ uint8 *maskTable = _vcnTransitionMask ? &_vcnTransitionMask[vcnExtraOffsetWll * _vcnBlockWidth * _vcnBlockHeight] : 0;
if (horizontalFlip) {
- for (int blockY = 0; blockY < 8; blockY++) {
- src += 3;
- for (int blockX = 0; blockX < 4; blockX++) {
- uint8 t = *src--;
- uint8 h = _vcnExpTable[((t & 0x0f) + wllVcnRmdOffset) | shift];
- uint8 l = _vcnExpTable[((t >> 4) + wllVcnRmdOffset) | shift];
- if (h)
- *d = h;
+ for (int blockY = 0; blockY < _vcnBlockHeight; blockY++) {
+ src += (_vcnBlockWidth - 1);
+ maskTable += (_vcnBlockWidth - 1);
+ for (int blockX = 0; blockX < _vcnBlockWidth; blockX++) {
+ uint8 bl = *src--;
+ uint8 mask = _vcnTransitionMask ? *maskTable-- : 0;
+ pxl[_vcnFlip0] = _vcnColTable[((bl & 0x0f) + wllVcnRmdOffset) | shift];
+ pxl[_vcnFlip1] = _vcnColTable[((bl >> 4) + wllVcnRmdOffset) | shift];
+
+ if (_vcnTransitionMask)
+ *d = (*d & (mask & 0x0f)) | pxl[0];
+ else if (pxl[0])
+ *d = pxl[0];
d++;
- if (l)
- *d = l;
+
+ if (_vcnTransitionMask)
+ *d = (*d & (mask >> 4)) | pxl[1];
+ else if (pxl[1])
+ *d = pxl[1];
d++;
}
- src += 5;
- d += 168;
+ src += (_vcnBlockWidth + 1);
+ maskTable += (_vcnBlockWidth + 1);
+ d += (pitch - 2 * _vcnBlockWidth);
}
} else {
- for (int blockY = 0; blockY < 8; blockY++) {
- for (int blockX = 0; blockX < 4; blockX++) {
- uint8 t = *src++;
- uint8 h = _vcnExpTable[((t >> 4) + wllVcnRmdOffset) | shift];
- uint8 l = _vcnExpTable[((t & 0x0f) + wllVcnRmdOffset) | shift];
- if (h)
+ for (int blockY = 0; blockY < _vcnBlockHeight; blockY++) {
+ for (int blockX = 0; blockX < _vcnBlockWidth; blockX++) {
+ uint8 bl = *src++;
+ uint8 mask = _vcnTransitionMask ? *maskTable++ : 0;
+ uint8 h = _vcnColTable[((bl >> 4) + wllVcnRmdOffset) | shift];
+ uint8 l = _vcnColTable[((bl & 0x0f) + wllVcnRmdOffset) | shift];
+
+ if (_vcnTransitionMask)
+ *d = (*d & (mask >> 4)) | h;
+ else if (h)
*d = h;
d++;
- if (l)
+
+ if (_vcnTransitionMask)
+ *d = (*d & (mask & 0x0f)) | l;
+ else if (l)
*d = l;
d++;
}
- d += 168;
+ d += (pitch - 2 * _vcnBlockWidth);
}
}
- d -= 1400;
+ d -= (pitch * _vcnBlockHeight - 2 * _vcnBlockWidth);
}
}
- d += 1232;
+ d += (pitch * (_vcnBlockHeight - 1));
}
screen()->copyBlockToPage(_sceneDrawPage1, _sceneXoffset, 0, 176, 120, _sceneWindowBuffer);
diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp
index 19314a5699..ef6333b350 100644
--- a/engines/kyra/screen.cpp
+++ b/engines/kyra/screen.cpp
@@ -27,6 +27,7 @@
#include "common/endian.h"
#include "common/memstream.h"
#include "common/system.h"
+#include "common/config-manager.h"
#include "engines/util.h"
@@ -38,7 +39,7 @@ namespace Kyra {
Screen::Screen(KyraEngine_v1 *vm, OSystem *system, const ScreenDim *dimTable, const int dimTableSize)
: _system(system), _vm(vm), _sjisInvisibleColor(0), _dimTable(dimTable), _dimTableCount(dimTableSize),
- _cursorColorKey((vm->game() == GI_KYRA1) ? 0xFF : 0x00) {
+ _cursorColorKey((vm->game() == GI_KYRA1 || vm->game() == GI_EOB1 || vm->game() == GI_EOB2) ? 0xFF : 0) {
_debugEnabled = false;
_maskMinY = _maskMaxY = -1;
@@ -49,6 +50,15 @@ Screen::Screen(KyraEngine_v1 *vm, OSystem *system, const ScreenDim *dimTable, co
memset(_fonts, 0, sizeof(_fonts));
+ memset(_pagePtrs, 0, sizeof(_pagePtrs));
+ // Set scale factor to 1 (no scaling) for all pages
+ memset(_pageScaleFactor, 1, sizeof(_pageScaleFactor));
+ // In VGA mode the odd and even page pointers point to the same buffers.
+ for (int i = 0; i < SCREEN_PAGE_NUM; i++)
+ _pageMapping[i] = i & ~1;
+
+ _renderMode = Common::kRenderDefault;
+
_currentFont = FID_8_FNT;
_paletteChanged = true;
_curDim = 0;
@@ -84,6 +94,16 @@ bool Screen::init() {
_useSJIS = false;
_use16ColorMode = _vm->gameFlags().use16ColorMode;
_isAmiga = (_vm->gameFlags().platform == Common::kPlatformAmiga);
+
+ if (ConfMan.hasKey("render_mode"))
+ _renderMode = Common::parseRenderMode(ConfMan.get("render_mode"));
+
+ // CGA and EGA modes use additional pages to do the CGA/EGA specific graphics conversions.
+ if (_renderMode == Common::kRenderCGA || _renderMode == Common::kRenderEGA) {
+ for (int i = 0; i < 8; i++)
+ _pageMapping[i] = i;
+ }
+
memset(_fonts, 0, sizeof(_fonts));
if (_vm->gameFlags().useHiResOverlay) {
@@ -110,15 +130,36 @@ bool Screen::init() {
}
_curPage = 0;
- uint8 *pagePtr = new uint8[SCREEN_PAGE_SIZE * 8];
- for (int pageNum = 0; pageNum < SCREEN_PAGE_NUM; pageNum += 2)
- _pagePtrs[pageNum] = _pagePtrs[pageNum + 1] = pagePtr + (pageNum >> 1) * SCREEN_PAGE_SIZE;
- memset(pagePtr, 0, SCREEN_PAGE_SIZE * 8);
+
+ Common::Array<uint8> realPages;
+ for (int i = 0; i < SCREEN_PAGE_NUM; i++) {
+ if (Common::find(realPages.begin(), realPages.end(), _pageMapping[i]) == realPages.end())
+ realPages.push_back(_pageMapping[i]);
+ }
+
+ int numPages = realPages.size();
+ uint32 bufferSize = 0;
+ for (int i = 0; i < numPages; i++)
+ bufferSize += (SCREEN_PAGE_SIZE * _pageScaleFactor[realPages[i]] * _pageScaleFactor[realPages[i]]);
+
+ uint8 *pagePtr = new uint8[bufferSize];
+ memset(pagePtr, 0, bufferSize);
+
+ memset(_pagePtrs, 0, sizeof(_pagePtrs));
+ for (int i = 0; i < SCREEN_PAGE_NUM; i++) {
+ if (_pagePtrs[_pageMapping[i]]) {
+ _pagePtrs[i] = _pagePtrs[_pageMapping[i]];
+ } else {
+ _pagePtrs[i] = pagePtr;
+ pagePtr += (SCREEN_PAGE_SIZE * _pageScaleFactor[i] * _pageScaleFactor[i]);
+ }
+ }
memset(_shapePages, 0, sizeof(_shapePages));
const int paletteCount = _isAmiga ? 13 : 4;
- const int numColors = _use16ColorMode ? 16 : (_isAmiga ? 32 : 256);
+ // We allow 256 color palettes in EGA mode, since original EOB II code does the same and requires it
+ const int numColors = _use16ColorMode ? 16 : (_isAmiga ? 32 : (_renderMode == Common::kRenderCGA ? 4 : 256));
_interfacePaletteEnabled = false;
@@ -131,6 +172,15 @@ bool Screen::init() {
assert(_palettes[i]);
}
+ // Setup CGA colors (if CGA mode is selected)
+ if (_renderMode == Common::kRenderCGA) {
+ Palette pal(5);
+ pal.setCGAPalette(1, Palette::kIntensityHigh);
+ // create additional black color 4 for use with the mouse cursor manager
+ pal.fill(4, 1, 0);
+ Screen::setScreenPalette(pal);
+ }
+
_internFadePalette = new Palette(numColors);
assert(_internFadePalette);
@@ -176,7 +226,7 @@ bool Screen::enableScreenDebug(bool enable) {
if (_debugEnabled != enable) {
_debugEnabled = enable;
- setResolution();
+ setResolution(_vm->gameFlags().useHiResOverlay);
_forceFullUpdate = true;
updateScreen();
}
@@ -184,14 +234,14 @@ bool Screen::enableScreenDebug(bool enable) {
return temp;
}
-void Screen::setResolution() {
+void Screen::setResolution(bool hiRes) {
byte palette[3*256];
_system->getPaletteManager()->grabPalette(palette, 0, 256);
int width = 320, height = 200;
bool defaultTo1xScaler = false;
- if (_vm->gameFlags().useHiResOverlay) {
+ if (hiRes) {
defaultTo1xScaler = true;
height = 400;
@@ -226,7 +276,7 @@ void Screen::updateScreen() {
needRealUpdate = true;
if (!_useOverlays)
- _system->copyRectToScreen(getPagePtr(2), SCREEN_W, 320, 0, SCREEN_W, SCREEN_H);
+ _system->copyRectToScreen(getPagePtr(2), SCREEN_W, 320, 0, SCREEN_W * _pageScaleFactor[2], SCREEN_H * _pageScaleFactor[2]);
else
_system->copyRectToScreen(getPagePtr(2), SCREEN_W, 640, 0, SCREEN_W, SCREEN_H);
}
@@ -237,12 +287,12 @@ void Screen::updateScreen() {
void Screen::updateDirtyRects() {
if (_forceFullUpdate) {
- _system->copyRectToScreen(getCPagePtr(0), SCREEN_W, 0, 0, SCREEN_W, SCREEN_H);
+ _system->copyRectToScreen(getCPagePtr(0), SCREEN_W * _pageScaleFactor[0], 0, 0, SCREEN_W * _pageScaleFactor[0], SCREEN_H * _pageScaleFactor[0]);
} else {
const byte *page0 = getCPagePtr(0);
Common::List<Common::Rect>::iterator it;
for (it = _dirtyRects.begin(); it != _dirtyRects.end(); ++it) {
- _system->copyRectToScreen(page0 + it->top * SCREEN_W + it->left, SCREEN_W, it->left, it->top, it->width(), it->height());
+ _system->copyRectToScreen(page0 + it->top * SCREEN_W * _pageScaleFactor[0] + it->left, SCREEN_W * _pageScaleFactor[0], it->left, it->top, it->width(), it->height());
}
}
_forceFullUpdate = false;
@@ -416,6 +466,11 @@ const uint8 *Screen::getCPagePtr(int pageNum) const {
return _pagePtrs[pageNum];
}
+int Screen::getPageScaleFactor(int pageNum) {
+ assert(pageNum < SCREEN_PAGE_NUM);
+ return _pageScaleFactor[pageNum];
+}
+
uint8 *Screen::getPageRect(int pageNum, int x, int y, int w, int h) {
assert(pageNum < SCREEN_PAGE_NUM);
if (pageNum == 0 || pageNum == 1)
@@ -427,7 +482,7 @@ void Screen::clearPage(int pageNum) {
assert(pageNum < SCREEN_PAGE_NUM);
if (pageNum == 0 || pageNum == 1)
_forceFullUpdate = true;
- memset(getPagePtr(pageNum), 0, SCREEN_PAGE_SIZE);
+ memset(getPagePtr(pageNum), 0, SCREEN_PAGE_SIZE * _pageScaleFactor[_curPage] * _pageScaleFactor[_curPage]);
clearOverlayPage(pageNum);
}
@@ -441,7 +496,7 @@ int Screen::setCurPage(int pageNum) {
void Screen::clearCurPage() {
if (_curPage == 0 || _curPage == 1)
_forceFullUpdate = true;
- memset(getPagePtr(_curPage), 0, SCREEN_PAGE_SIZE);
+ memset(getPagePtr(_curPage), 0, SCREEN_PAGE_SIZE * _pageScaleFactor[_curPage] * _pageScaleFactor[_curPage]);
clearOverlayPage(_curPage);
}
@@ -597,12 +652,17 @@ uint8 Screen::getPagePixel(int pageNum, int x, int y) {
void Screen::setPagePixel(int pageNum, int x, int y, uint8 color) {
assert(pageNum < SCREEN_PAGE_NUM);
assert(x >= 0 && x < SCREEN_W && y >= 0 && y < SCREEN_H);
+
if (pageNum == 0 || pageNum == 1)
addDirtyRect(x, y, 1, 1);
if (_use16ColorMode) {
color &= 0x0F;
color |= (color << 4);
+ } else if (_renderMode == Common::kRenderCGA) {
+ color &= 0x03;
+ } else if (_renderMode == Common::kRenderEGA) {
+ color &= 0x0F;
}
_pagePtrs[pageNum][y * SCREEN_W + x] = color;
@@ -613,13 +673,22 @@ void Screen::fadeFromBlack(int delay, const UpdateFunctor *upFunc) {
}
void Screen::fadeToBlack(int delay, const UpdateFunctor *upFunc) {
+ if (_renderMode == Common::kRenderEGA)
+ return;
+
Palette pal(getPalette(0).getNumColors());
fadePalette(pal, delay, upFunc);
}
void Screen::fadePalette(const Palette &pal, int delay, const UpdateFunctor *upFunc) {
+ if (_renderMode == Common::kRenderEGA)
+ setScreenPalette(pal);
+
updateScreen();
+ if (_renderMode == Common::kRenderCGA || _renderMode == Common::kRenderEGA)
+ return;
+
int diff = 0, delayInc = 0;
getFadeParams(pal, delay, delayInc, diff);
@@ -801,16 +870,26 @@ void Screen::copyToPage0(int y, int h, uint8 page, uint8 *seqBuf) {
}
void Screen::copyRegion(int x1, int y1, int x2, int y2, int w, int h, int srcPage, int dstPage, int flags) {
+ // Since we don't (need to) do any actual scaling, we check for compatible pages here
+ assert(_pageScaleFactor[srcPage] == _pageScaleFactor[dstPage]);
+
+ x1 *= _pageScaleFactor[srcPage];
+ y1 *= _pageScaleFactor[srcPage];
+ x2 *= _pageScaleFactor[dstPage];
+ y2 *= _pageScaleFactor[dstPage];
+ w *= _pageScaleFactor[srcPage];
+ h *= _pageScaleFactor[srcPage];
+
if (x2 < 0) {
if (x2 <= -w)
return;
w += x2;
x1 -= x2;
x2 = 0;
- } else if (x2 + w >= SCREEN_W) {
- if (x2 > SCREEN_W)
+ } else if (x2 + w >= SCREEN_W * _pageScaleFactor[dstPage]) {
+ if (x2 > SCREEN_W * _pageScaleFactor[dstPage])
return;
- w = SCREEN_W - x2;
+ w = SCREEN_W * _pageScaleFactor[srcPage] - x2;
}
if (y2 < 0) {
@@ -819,14 +898,14 @@ void Screen::copyRegion(int x1, int y1, int x2, int y2, int w, int h, int srcPag
h += y2;
y1 -= y2;
y2 = 0;
- } else if (y2 + h >= SCREEN_H) {
- if (y2 > SCREEN_H)
+ } else if (y2 + h >= SCREEN_H * _pageScaleFactor[dstPage]) {
+ if (y2 > SCREEN_H * _pageScaleFactor[dstPage])
return;
- h = SCREEN_H - y2;
+ h = SCREEN_H * _pageScaleFactor[srcPage] - y2;
}
- const uint8 *src = getPagePtr(srcPage) + y1 * SCREEN_W + x1;
- uint8 *dst = getPagePtr(dstPage) + y2 * SCREEN_W + x2;
+ const uint8 *src = getPagePtr(srcPage) + y1 * SCREEN_W * _pageScaleFactor[srcPage] + x1;
+ uint8 *dst = getPagePtr(dstPage) + y2 * SCREEN_W * _pageScaleFactor[dstPage] + x2;
if (src == dst)
return;
@@ -839,8 +918,8 @@ void Screen::copyRegion(int x1, int y1, int x2, int y2, int w, int h, int srcPag
if (flags & CR_NO_P_CHECK) {
while (h--) {
memmove(dst, src, w);
- src += SCREEN_W;
- dst += SCREEN_W;
+ src += SCREEN_W * _pageScaleFactor[srcPage];
+ dst += SCREEN_W * _pageScaleFactor[dstPage];
}
} else {
while (h--) {
@@ -848,19 +927,24 @@ void Screen::copyRegion(int x1, int y1, int x2, int y2, int w, int h, int srcPag
if (src[i])
dst[i] = src[i];
}
- src += SCREEN_W;
- dst += SCREEN_W;
+ src += SCREEN_W * _pageScaleFactor[srcPage];
+ dst += SCREEN_W * _pageScaleFactor[dstPage];
}
}
}
void Screen::copyRegionToBuffer(int pageNum, int x, int y, int w, int h, uint8 *dest) {
+ x *= _pageScaleFactor[pageNum];
+ y *= _pageScaleFactor[pageNum];
+ w *= _pageScaleFactor[pageNum];
+ h *= _pageScaleFactor[pageNum];
+
if (y < 0) {
dest += (-y) * w;
h += y;
y = 0;
} else if (y + h > SCREEN_H) {
- h = SCREEN_H - y;
+ h = SCREEN_H * _pageScaleFactor[pageNum] - y;
}
if (x < 0) {
@@ -868,7 +952,7 @@ void Screen::copyRegionToBuffer(int pageNum, int x, int y, int w, int h, uint8 *
w += x;
x = 0;
} else if (x + w > SCREEN_W) {
- w = SCREEN_W - x;
+ w = SCREEN_W * _pageScaleFactor[pageNum] - x;
}
if (w < 0 || h < 0)
@@ -877,14 +961,17 @@ void Screen::copyRegionToBuffer(int pageNum, int x, int y, int w, int h, uint8 *
uint8 *pagePtr = getPagePtr(pageNum);
for (int i = y; i < y + h; ++i)
- memcpy(dest + (i - y) * w, pagePtr + i * SCREEN_W + x, w);
+ memcpy(dest + (i - y) * w, pagePtr + i * SCREEN_W * _pageScaleFactor[pageNum] + x, w);
}
void Screen::copyPage(uint8 srcPage, uint8 dstPage) {
+ // Since we don't (need to) do any actual scaling, we check for compatible pages here
+ assert(_pageScaleFactor[srcPage] == _pageScaleFactor[dstPage]);
+
uint8 *src = getPagePtr(srcPage);
uint8 *dst = getPagePtr(dstPage);
if (src != dst)
- memcpy(dst, src, SCREEN_W * SCREEN_H);
+ memcpy(dst, src, SCREEN_W * _pageScaleFactor[srcPage] * SCREEN_H * _pageScaleFactor[srcPage]);
copyOverlayRegion(0, 0, 0, 0, SCREEN_W, SCREEN_H, srcPage, dstPage);
if (dstPage == 0 || dstPage == 1)
@@ -911,7 +998,12 @@ void Screen::copyBlockToPage(int pageNum, int x, int y, int w, int h, const uint
if (w < 0 || h < 0)
return;
- uint8 *dst = getPagePtr(pageNum) + y * SCREEN_W + x;
+ x *= _pageScaleFactor[pageNum];
+ y *= _pageScaleFactor[pageNum];
+ w *= _pageScaleFactor[pageNum];
+ h *= _pageScaleFactor[pageNum];
+
+ uint8 *dst = getPagePtr(pageNum) + y * SCREEN_W * _pageScaleFactor[pageNum] + x;
if (pageNum == 0 || pageNum == 1)
addDirtyRect(x, y, w, h);
@@ -920,7 +1012,7 @@ void Screen::copyBlockToPage(int pageNum, int x, int y, int w, int h, const uint
while (h--) {
memcpy(dst, src, w);
- dst += SCREEN_W;
+ dst += SCREEN_W * _pageScaleFactor[pageNum];
src += w;
}
}
@@ -996,6 +1088,10 @@ void Screen::fillRect(int x1, int y1, int x2, int y2, uint8 color, int pageNum,
if (_use16ColorMode) {
color &= 0x0F;
color |= (color << 4);
+ } else if (_renderMode == Common::kRenderCGA) {
+ color &= 0x03;
+ } else if (_renderMode == Common::kRenderEGA) {
+ color &= 0x0F;
}
if (xored) {
@@ -1073,6 +1169,10 @@ void Screen::drawLine(bool vertical, int x, int y, int length, int color) {
if (_use16ColorMode) {
color &= 0x0F;
color |= (color << 4);
+ } else if (_renderMode == Common::kRenderCGA) {
+ color &= 0x03;
+ } else if (_renderMode == Common::kRenderEGA) {
+ color &= 0x0F;
}
if (vertical) {
@@ -1080,7 +1180,7 @@ void Screen::drawLine(bool vertical, int x, int y, int length, int color) {
int currLine = 0;
while (currLine < length) {
*ptr = color;
- ptr += SCREEN_W;
+ ptr += SCREEN_W * _pageScaleFactor[_curPage];
currLine++;
}
} else {
@@ -1126,7 +1226,7 @@ bool Screen::loadFont(FontId fontId, const char *filename) {
fnt = new AMIGAFont();
#ifdef ENABLE_EOB
else if (_vm->game() == GI_EOB1 || _vm->game() == GI_EOB2)
- fnt = new OldDOSFont();
+ fnt = new OldDOSFont(_renderMode, (_vm->game() == GI_EOB2) && (_renderMode == Common::kRenderEGA));
#endif // ENABLE_EOB
else
fnt = new DOSFont();
@@ -1213,12 +1313,12 @@ void Screen::printText(const char *str, int x, int y, uint8 color1, uint8 color2
break;
} else if (c == '\r') {
x = x_start;
- y += charHeightFnt + _charOffset;
+ y += (charHeightFnt + _charOffset);
} else {
int charWidth = getCharWidth(c);
if (x + charWidth > SCREEN_W) {
x = x_start;
- y += charHeightFnt + _charOffset;
+ y += (charHeightFnt + _charOffset);
if (y >= SCREEN_H)
break;
}
@@ -1255,6 +1355,9 @@ void Screen::drawChar(uint16 c, int x, int y) {
if (x + charWidth > SCREEN_W || y + charHeight > SCREEN_H)
return;
+ x *= _pageScaleFactor[_curPage];
+ y *= _pageScaleFactor[_curPage];
+
if (useOverlay) {
uint8 *destPage = getOverlayPtr(_curPage);
if (!destPage) {
@@ -1266,11 +1369,11 @@ void Screen::drawChar(uint16 c, int x, int y) {
fnt->drawChar(c, destPage, 640);
} else {
- fnt->drawChar(c, getPagePtr(_curPage) + y * SCREEN_W + x, SCREEN_W);
+ fnt->drawChar(c, getPagePtr(_curPage) + y * SCREEN_W * _pageScaleFactor[_curPage] + x, SCREEN_W * _pageScaleFactor[_curPage]);
}
if (_curPage == 0 || _curPage == 1)
- addDirtyRect(x, y, charWidth, charHeight);
+ addDirtyRect(x, y, charWidth * _pageScaleFactor[_curPage], charHeight * _pageScaleFactor[_curPage]);
}
void Screen::drawShape(uint8 pageNum, const uint8 *shapeData, int x, int y, int sd, int flags, ...) {
@@ -2047,17 +2150,16 @@ void Screen::decodeFrame1(const uint8 *src, uint8 *dst, uint32 size) {
while (dst < dstEnd) {
code = decodeEGAGetCode(src, nib);
- last = code & 0xff;
uint8 cmd = code >> 8;
if (cmd--) {
- code = (cmd << 8) | last;
+ code = (cmd << 8) | (code & 0xff);
uint8 *tmpDst = dst;
- last = *dst;
if (code < numPatterns) {
const uint8 *tmpSrc = patterns[code].pos;
countPrev = patterns[code].len;
+ last = *tmpSrc;
for (int i = 0; i < countPrev; i++)
*dst++ = *tmpSrc++;
@@ -2079,7 +2181,7 @@ void Screen::decodeFrame1(const uint8 *src, uint8 *dst, uint32 size) {
count = countPrev;
} else {
- *dst++ = last;
+ *dst++ = last = (code & 0xff);
if (numPatterns < 3840) {
patterns[numPatterns].pos = dstPrev;
@@ -2181,7 +2283,7 @@ void Screen::decodeFrameDelta(uint8 *dst, const uint8 *src, bool noXor) {
wrapped_decodeFrameDelta<false>(dst, src);
}
-template <bool noXor>
+template<bool noXor>
void Screen::wrapped_decodeFrameDelta(uint8 *dst, const uint8 *src) {
while (1) {
uint8 code = *src++;
@@ -3013,6 +3115,9 @@ void Screen::loadBitmap(const char *filename, int tempPage, int dstPage, Palette
}
bool Screen::loadPalette(const char *filename, Palette &pal) {
+ if (_renderMode == Common::kRenderCGA)
+ return true;
+
Common::SeekableReadStream *stream = _vm->resource()->createReadStream(filename);
if (!stream)
@@ -3029,6 +3134,12 @@ bool Screen::loadPalette(const char *filename, Palette &pal) {
} else if (_vm->gameFlags().platform == Common::kPlatformPC98 && _use16ColorMode) {
numCols = stream->size() / Palette::kPC98BytesPerColor;
pal.loadPC98Palette(*stream, 0, MIN(maxCols, numCols));
+ } else if (_renderMode == Common::kRenderEGA) {
+ numCols = stream->size();
+ // There aren't any 16 color EGA palette files. So this shouldn't ever get triggered.
+ assert (numCols != 16);
+ numCols /= Palette::kVGABytesPerColor;
+ pal.loadVGAPalette(*stream, 0, numCols);
} else {
numCols = stream->size() / Palette::kVGABytesPerColor;
pal.loadVGAPalette(*stream, 0, MIN(maxCols, numCols));
@@ -3076,7 +3187,14 @@ void Screen::loadPalette(const byte *data, Palette &pal, int bytes) {
pal.loadAmigaPalette(stream, 0, stream.size() / Palette::kAmigaBytesPerColor);
else if (_vm->gameFlags().platform == Common::kPlatformPC98 && _use16ColorMode)
pal.loadPC98Palette(stream, 0, stream.size() / Palette::kPC98BytesPerColor);
- else
+ else if (_renderMode == Common::kRenderEGA) {
+ // EOB II checks the number of palette bytes to distinguish between real EGA palettes
+ // and normal palettes (which are used to generate a color map).
+ if (stream.size() == 16)
+ pal.loadEGAPalette(stream, 0, stream.size());
+ else
+ pal.loadVGAPalette(stream, 0, stream.size() / Palette::kVGABytesPerColor);
+ } else
pal.loadVGAPalette(stream, 0, stream.size() / Palette::kVGABytesPerColor);
}
@@ -3091,7 +3209,7 @@ void Screen::addDirtyRect(int x, int y, int w, int h) {
Common::Rect r(x, y, x + w, y + h);
// Clip rectangle
- r.clip(SCREEN_W, SCREEN_H);
+ r.clip(SCREEN_W * _pageScaleFactor[0], SCREEN_H * _pageScaleFactor[0]);
// If it is empty after clipping, we are done
if (r.isEmpty())
@@ -3198,9 +3316,11 @@ void Screen::crossFadeRegion(int x1, int y1, int x2, int y2, int w, int h, int s
if (srcPage > 13 || dstPage > 13)
error("Screen::crossFadeRegion(): attempting to use temp page as source or dest page.");
+ assert(_pageScaleFactor[srcPage] == _pageScaleFactor[dstPage]);
+
hideMouse();
- uint16 *wB = (uint16*)_pagePtrs[14];
+ uint16 *wB = (uint16 *)_pagePtrs[14];
uint8 *hB = _pagePtrs[14] + 640;
for (int i = 0; i < w; i++)
@@ -3215,23 +3335,19 @@ void Screen::crossFadeRegion(int x1, int y1, int x2, int y2, int w, int h, int s
for (int i = 0; i < h; i++)
SWAP(hB[_vm->_rnd.getRandomNumberRng(0, h - 1)], hB[i]);
- uint8 *s = _pagePtrs[srcPage];
- uint8 *d = _pagePtrs[dstPage];
-
for (int i = 0; i < h; i++) {
int iH = i;
uint32 end = _system->getMillis() + 3;
for (int ii = 0; ii < w; ii++) {
- int sX = x1 + wB[ii];
- int sY = y1 + hB[iH];
- int dX = x2 + wB[ii];
- int dY = y2 + hB[iH];
+ int sX = (x1 + wB[ii]);
+ int sY = (y1 + hB[iH]);
+ int dX = (x2 + wB[ii]);
+ int dY = (y2 + hB[iH]);
if (++iH >= h)
iH = 0;
- d[dY * 320 + dX] = s[sY * 320 + sX];
- addDirtyRect(dX, dY, 1, 1);
+ setPagePixel(dstPage, dX, dY, getPagePixel(srcPage, sX, sY));
}
// This tries to speed things up, to get similiar speeds as in DOSBox etc.
@@ -3553,6 +3669,24 @@ void Palette::loadVGAPalette(Common::ReadStream &stream, int startIndex, int col
*pos++ = stream.readByte() & 0x3f;
}
+void Palette::loadEGAPalette(Common::ReadStream &stream, int startIndex, int colors) {
+ assert(startIndex + colors <= 16);
+
+ uint8 *dst = _palData + startIndex * 3;
+ for (int i = 0; i < colors; i++) {
+ uint8 index = stream.readByte();
+ assert(index < _egaNumColors);
+ memcpy(dst, &_egaColors[index * 3], 3);
+ dst += 3;
+ }
+}
+
+void Palette::setCGAPalette(int palIndex, CGAIntensity intensity) {
+ assert(_numColors >= _cgaNumColors);
+ assert(!(palIndex & ~1));
+ memcpy(_palData, _cgaColors[palIndex * 2 + intensity], _numColors * 3);
+}
+
void Palette::loadAmigaPalette(Common::ReadStream &stream, int startIndex, int colors) {
assert(startIndex + colors <= _numColors);
@@ -3629,4 +3763,22 @@ uint8 *Palette::fetchRealPalette() const {
return buffer;
}
+const uint8 Palette::_egaColors[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xAA, 0x00, 0xAA, 0x00, 0x00, 0xAA, 0xAA,
+ 0xAA, 0x00, 0x00, 0xAA, 0x00, 0xAA, 0xAA, 0x55, 0x00, 0xAA, 0xAA, 0xAA,
+ 0x55, 0x55, 0x55, 0x55, 0x55, 0xFF, 0x55, 0xFF, 0x55, 0x55, 0xFF, 0xFF,
+ 0xFF, 0x55, 0x55, 0xFF, 0x55, 0xFF, 0xFF, 0xFF, 0x55, 0xFF, 0xFF, 0xFF
+};
+
+const int Palette::_egaNumColors = ARRAYSIZE(_egaColors) / 3;
+
+const uint8 Palette::_cgaColors[4][12] = {
+ { 0x00, 0x00, 0x00, 0x00, 0x2A, 0x00, 0x2A, 0x00, 0x00, 0x2A, 0x15, 0x00 },
+ { 0x00, 0x00, 0x00, 0x15, 0x3F, 0x15, 0x3F, 0x15, 0x15, 0x3F, 0x3F, 0x15 },
+ { 0x00, 0x00, 0x00, 0x00, 0x2A, 0x2A, 0x2A, 0x00, 0x2A, 0x2A, 0x2A, 0x2A },
+ { 0x00, 0x00, 0x00, 0x15, 0x3F, 0x3F, 0x3F, 0x15, 0x3F, 0x3F, 0x3F, 0x3F }
+};
+
+const int Palette::_cgaNumColors = ARRAYSIZE(_cgaColors[0]) / 3;
+
} // End of namespace Kyra
diff --git a/engines/kyra/screen.h b/engines/kyra/screen.h
index dd74692a5d..18c0aa90f7 100644
--- a/engines/kyra/screen.h
+++ b/engines/kyra/screen.h
@@ -145,8 +145,8 @@ private:
*/
class OldDOSFont : public Font {
public:
- OldDOSFont();
- ~OldDOSFont() { unload(); }
+ OldDOSFont(Common::RenderMode mode, bool useHiResEGADithering);
+ ~OldDOSFont();
bool load(Common::SeekableReadStream &file);
int getHeight() const { return _height; }
@@ -165,6 +165,12 @@ private:
const uint8 *_colorMap;
int _numGlyphs;
+
+ Common::RenderMode _renderMode;
+ bool _useHiResEGADithering;
+
+ static uint16 *_cgaDitheringTable;
+ static int _numRef;
};
#endif // ENABLE_EOB
@@ -252,6 +258,21 @@ public:
void loadVGAPalette(Common::ReadStream &stream, int startIndex, int colors);
/**
+ * Load a EGA palette from the given stream.
+ */
+ void loadEGAPalette(Common::ReadStream &stream, int startIndex, int colors);
+
+ /**
+ * Set default CGA palette. We only need the cyan/magenta/grey mode.
+ */
+ enum CGAIntensity {
+ kIntensityLow = 0,
+ kIntensityHigh = 1
+ };
+
+ void setCGAPalette(int palIndex, CGAIntensity intensity);
+
+ /**
* Load a AMIGA palette from the given stream.
*/
void loadAmigaPalette(Common::ReadStream &stream, int startIndex, int colors);
@@ -325,9 +346,15 @@ public:
*/
uint8 *getData() { return _palData; }
const uint8 *getData() const { return _palData; }
+
private:
uint8 *_palData;
const int _numColors;
+
+ static const uint8 _egaColors[];
+ static const int _egaNumColors;
+ static const uint8 _cgaColors[4][12];
+ static const int _cgaNumColors;
};
class Screen {
@@ -371,7 +398,7 @@ public:
// init
virtual bool init();
- virtual void setResolution();
+ virtual void setResolution(bool hiRes = false);
void updateScreen();
@@ -398,14 +425,16 @@ public:
void copyBlockToPage(int pageNum, int x, int y, int w, int h, const uint8 *src);
void shuffleScreen(int sx, int sy, int w, int h, int srcPage, int dstPage, int ticks, bool transparent);
- void fillRect(int x1, int y1, int x2, int y2, uint8 color, int pageNum = -1, bool xored = false);
+ virtual void fillRect(int x1, int y1, int x2, int y2, uint8 color, int pageNum = -1, bool xored = false);
void clearPage(int pageNum);
- uint8 getPagePixel(int pageNum, int x, int y);
- void setPagePixel(int pageNum, int x, int y, uint8 color);
+ virtual uint8 getPagePixel(int pageNum, int x, int y);
+ virtual void setPagePixel(int pageNum, int x, int y, uint8 color);
const uint8 *getCPagePtr(int pageNum) const;
+ int getPageScaleFactor(int pageNum);
+
uint8 *getPageRect(int pageNum, int x, int y, int w, int h);
// palette handling
@@ -429,7 +458,7 @@ public:
void copyPalette(const int dst, const int src);
// gui specific (processing on _curPage)
- void drawLine(bool vertical, int x, int y, int length, int color);
+ virtual void drawLine(bool vertical, int x, int y, int length, int color);
void drawClippedLine(int x1, int y1, int x2, int y2, int color);
virtual void drawShadedBox(int x1, int y1, int x2, int y2, int color1, int color2);
void drawBox(int x1, int y1, int x2, int y2, int color);
@@ -444,7 +473,7 @@ public:
int getCharWidth(uint16 c) const;
int getTextWidth(const char *str) const;
- void printText(const char *str, int x, int y, uint8 color1, uint8 color2);
+ virtual void printText(const char *str, int x, int y, uint8 color1, uint8 color2);
virtual void setTextColorMap(const uint8 *cmap) = 0;
void setTextColor(const uint8 *cmap, int a, int b);
@@ -480,9 +509,9 @@ public:
// misc
void loadBitmap(const char *filename, int tempPage, int dstPage, Palette *pal, bool skip=false);
- bool loadPalette(const char *filename, Palette &pal);
+ virtual bool loadPalette(const char *filename, Palette &pal);
bool loadPaletteTable(const char *filename, int firstPalette);
- void loadPalette(const byte *data, Palette &pal, int bytes);
+ virtual void loadPalette(const byte *data, Palette &pal, int bytes);
void setAnimBlockPtr(int size);
@@ -545,16 +574,19 @@ protected:
uint8 *_pagePtrs[16];
uint8 *_sjisOverlayPtrs[SCREEN_OVLS_NUM];
+ uint8 _pageScaleFactor[SCREEN_PAGE_NUM];
+ uint8 _pageMapping[SCREEN_PAGE_NUM];
bool _useOverlays;
bool _useSJIS;
bool _use16ColorMode;
bool _isAmiga;
+ Common::RenderMode _renderMode;
uint8 _sjisInvisibleColor;
Palette *_screenPalette;
- Common::Array<Palette*> _palettes;
+ Common::Array<Palette *> _palettes;
Palette *_internFadePalette;
Font *_fonts[FID_NUM];
diff --git a/engines/kyra/screen_eob.cpp b/engines/kyra/screen_eob.cpp
index 6b1128bdfd..38521d757c 100644
--- a/engines/kyra/screen_eob.cpp
+++ b/engines/kyra/screen_eob.cpp
@@ -33,6 +33,7 @@
#include "common/system.h"
#include "graphics/cursorman.h"
+#include "graphics/palette.h"
namespace Kyra {
@@ -47,31 +48,78 @@ Screen_EoB::Screen_EoB(EoBCoreEngine *vm, OSystem *system) : Screen(vm, system,
_dsTempPage = 0;
_dsDiv = 0;
_dsRem = 0;
- _dsScaleTmp = 0;
+ _dsScaleTrans = 0;
+ _cgaScaleTable = 0;
_gfxMaxY = 0;
+ _egaDitheringTable = 0;
+ _egaPixelValueTable = 0;
+ _cgaMappingDefault = 0;
+ _cgaDitheringTables[0] = _cgaDitheringTables[1] = 0;
+ _useHiResEGADithering = false;
}
Screen_EoB::~Screen_EoB() {
delete[] _fadeData;
delete[] _dsTempPage;
+ delete[] _cgaScaleTable;
+ delete[] _egaDitheringTable;
+ delete[] _egaPixelValueTable;
+ delete[] _cgaDitheringTables[0];
+ delete[] _cgaDitheringTables[1];
}
bool Screen_EoB::init() {
+ return init(false);
+}
+
+bool Screen_EoB::init(bool useHiResEGADithering) {
+ // Define hi-res pages for EGA mode in EOB II
+ if (useHiResEGADithering) {
+ for (int i = 0; i < 8; i++)
+ _pageScaleFactor[i] = 2;
+ }
+
if (Screen::init()) {
int temp;
_gfxMaxY = _vm->staticres()->loadRawData(kEoBBaseExpObjectY, temp);
- _fadeData = _vm->resource()->fileData("FADING.DAT", 0);
+
+ if (_renderMode != Common::kRenderCGA && _renderMode != Common::kRenderEGA)
+ _fadeData = _vm->resource()->fileData("FADING.DAT", 0);
if (!_fadeData) {
_fadeData = new uint8[0x700];
memset(_fadeData, 0, 0x700);
- uint8 *pal = _vm->resource()->fileData("palette1.pal", 0); // EGA: palette0.pal
- for (int i = 0; i < 7; i++)
- createFadeTable(pal, &_fadeData[i << 8], 18, (i + 1) * 36);
- delete[] pal;
+ if (_renderMode != Common::kRenderCGA && _renderMode != Common::kRenderEGA) {
+ uint8 *pal = _vm->resource()->fileData("PALETTE1.PAL", 0);
+ for (int i = 0; i < 7; i++)
+ createFadeTable(pal, &_fadeData[i << 8], 18, (i + 1) * 36);
+ delete[] pal;
+ }
}
- _dsTempPage = new uint8[6000];
+ _dsTempPage = new uint8[12000];
+
+ if (_renderMode == Common::kRenderEGA) {
+ _useHiResEGADithering = useHiResEGADithering;
+ _egaDitheringTable = new uint8[256];
+ _egaPixelValueTable = new uint8[256];
+ for (int i = 0; i < 256; i++) {
+ _egaDitheringTable[i] = i & 0x0f;
+ _egaPixelValueTable[i] = i & 0x0f;
+ }
+
+ } else if (_renderMode == Common::kRenderCGA) {
+ _cgaMappingDefault = _vm->staticres()->loadRawData(kEoB1CgaMappingDefault, temp);
+ _cgaDitheringTables[0] = new uint16[256];
+ memset(_cgaDitheringTables[0], 0, 256 * sizeof(uint16));
+ _cgaDitheringTables[1] = new uint16[256];
+ memset(_cgaDitheringTables[1], 0, 256 * sizeof(uint16));
+
+ _cgaScaleTable = new uint8[256];
+ memset(_cgaScaleTable, 0, 256 * sizeof(uint8));
+ for (int i = 0; i < 256; i++)
+ _cgaScaleTable[i] = ((i & 0xf0) >> 2) | (i & 0x03);
+ }
return true;
}
@@ -88,16 +136,50 @@ void Screen_EoB::clearCurDim() {
}
void Screen_EoB::setMouseCursor(int x, int y, const byte *shape) {
+ setMouseCursor(x, y, shape, 0);
+}
+
+void Screen_EoB::setMouseCursor(int x, int y, const byte *shape, const uint8 *ovl) {
if (!shape)
return;
- int mouseW = shape[2] << 3;
- int mouseH = shape[3];
- uint8 *cursor = new uint8[mouseW * mouseH];
- fillRect(0, 0, mouseW, mouseH, _cursorColorKey, 8);
- drawShape(8, shape, 0, 0, 0);
+
+ int mouseW = (shape[2] << 3);
+ int mouseH = (shape[3]);
+ int colorKey = (_renderMode == Common::kRenderCGA) ? 0 : _cursorColorKey;
+
+ uint8 *cursor = new uint8[mouseW * _pageScaleFactor[6] * mouseH * _pageScaleFactor[6]];
+ // We use memset and copyBlockToPage instead of fillRect to make sure that the
+ // color key 0xFF doesn't get converted into EGA color
+ memset (cursor, colorKey, mouseW * _pageScaleFactor[6] * mouseH * _pageScaleFactor[6]);
+ copyBlockToPage(6, 0, 0, mouseW, mouseH, cursor);
+ drawShape(6, shape, 0, 0, 0, 2, ovl);
CursorMan.showMouse(false);
- copyRegionToBuffer(8, 0, 0, mouseW, mouseH, cursor);
- CursorMan.replaceCursor(cursor, mouseW, mouseH, x, y, _cursorColorKey);
+ copyRegionToBuffer(6, 0, 0, mouseW, mouseH, cursor);
+
+ // Mouse cursor post processing for CGA mode. Unlike the original (which uses drawShape for the mouse cursor)
+ // the cursor manager cannot know whether a pixel value of 0 is supposed to be black or transparent. Thus, we
+ // go over the transparency mask again and turn the black pixels to color 4.
+ if (_renderMode == Common::kRenderCGA) {
+ const uint8 *maskTbl = shape + 4 + ((mouseW * mouseH) >> 2);
+ uint8 *dst = cursor;
+ uint8 trans = 0;
+ uint8 shift = 6;
+
+ uint16 mH = mouseH;
+ while (mH--) {
+ uint16 mW = mouseW;
+ while (mW--) {
+ if (shift == 6)
+ trans = *maskTbl++;
+ if (!*dst && !((trans >> shift) & 3))
+ *dst = 4;
+ dst++;
+ shift = (shift - 2) & 7;
+ }
+ }
+ }
+
+ CursorMan.replaceCursor(cursor, mouseW * _pageScaleFactor[6], mouseH * _pageScaleFactor[6], x, y, colorKey);
if (isMouseVisible())
CursorMan.showMouse(true);
delete[] cursor;
@@ -113,6 +195,19 @@ void Screen_EoB::loadFileDataToPage(Common::SeekableReadStream *s, int pageNum,
s->read(_pagePtrs[pageNum], size);
}
+void Screen_EoB::printText(const char *str, int x, int y, uint8 color1, uint8 color2) {
+ if (_useHiResEGADithering) {
+ // This is sort of an abuse of the text color map. But since EOB doesn't use it anyway
+ // and the font drawing code needs access to both the original color values and the
+ // EGA dithering colors we pass them on like this.
+ uint8 cmap[2];
+ cmap[0] = _egaDitheringTable[color2];
+ cmap[1] = _egaDitheringTable[color1];
+ setTextColor(cmap, 2, 3);
+ }
+ Screen::printText(str, x, y, color1, color2);
+}
+
void Screen_EoB::printShadedText(const char *string, int x, int y, int col1, int col2) {
printText(string, x - 1, y, 12, col2);
printText(string, x, y + 1, 12, 0);
@@ -121,12 +216,13 @@ void Screen_EoB::printShadedText(const char *string, int x, int y, int col1, int
}
void Screen_EoB::loadShapeSetBitmap(const char *file, int tempPage, int destPage) {
- loadEoBBitmap(file, 0, tempPage, destPage, -1);
+ loadEoBBitmap(file, _cgaMappingDefault, tempPage, destPage, -1);
_curPage = 2;
}
-void Screen_EoB::loadEoBBitmap(const char *file, const uint8 *ditheringData, int tempPage, int destPage, int copyToPage) {
- Common::String tmp = Common::String::format("%s.CPS", file);
+void Screen_EoB::loadEoBBitmap(const char *file, const uint8 *cgaMapping, int tempPage, int destPage, int convertToPage) {
+ const char *filePattern = (_vm->game() == GI_EOB1 && (_renderMode == Common::kRenderEGA || _renderMode == Common::kRenderCGA)) ? "%s.EGA" : "%s.CPS";
+ Common::String tmp = Common::String::format(filePattern, file);
Common::SeekableReadStream *s = _vm->resource()->createReadStream(tmp);
bool loadAlternative = false;
if (s) {
@@ -149,31 +245,236 @@ void Screen_EoB::loadEoBBitmap(const char *file, const uint8 *ditheringData, int
tmp.setChar('X', 0);
s = _vm->resource()->createReadStream(tmp);
if (!s)
- error("Screen_EoB::loadEoBBitmap(): CPS file loading failed.");
+ error("Screen_EoB::loadEoBBitmap(): Failed to load file '%s'", file);
s->seek(768);
loadFileDataToPage(s, destPage, 64000);
delete s;
}
}
- if (copyToPage == -1) {
+ if (convertToPage == -1) {
return;
- } else if (copyToPage == 0) {
- copyPage(destPage, 2);
+ } else if (convertToPage == 2 && _renderMode == Common::kRenderCGA) {
+ convertPage(destPage, 4, cgaMapping);
+ copyRegion(0, 0, 0, 0, 320, 200, 4, 2, Screen::CR_NO_P_CHECK);
+ } else if (convertToPage == 0) {
+ convertPage(destPage, 2, cgaMapping);
copyRegion(0, 0, 0, 0, 320, 200, 2, 0, Screen::CR_NO_P_CHECK);
} else {
- copyPage(destPage, copyToPage);
+ convertPage(destPage, convertToPage, cgaMapping);
+ }
+}
+
+void Screen_EoB::convertPage(int srcPage, int dstPage, const uint8 *cgaMapping) {
+ uint8 *src = getPagePtr(srcPage);
+ uint8 *dst = getPagePtr(dstPage);
+ if (src == dst)
+ return;
+
+ if (_renderMode == Common::kRenderCGA) {
+ if (cgaMapping)
+ generateCGADitheringTables(cgaMapping);
+
+ uint16 *d = (uint16*)dst;
+ uint8 tblSwitch = 0;
+ for (int height = SCREEN_H; height; height--) {
+ const uint16 *table = _cgaDitheringTables[(tblSwitch++) & 1];
+ for (int width = SCREEN_W / 2; width; width--) {
+ WRITE_LE_UINT16(d++, table[((src[1] & 0x0f) << 4) | (src[0] & 0x0f)]);
+ src += 2;
+ }
+ }
+
+ } else if (_useHiResEGADithering) {
+ for (int height = SCREEN_H; height; height--) {
+ uint8 *dst2 = dst + SCREEN_W * 2;
+ for (int width = SCREEN_W; width; width--) {
+ uint8 in = _egaDitheringTable[*src++];
+ *dst++ = *dst2++ = in >> 4;
+ *dst++ = *dst2++ = in & 0x0f;
+ }
+ dst += (SCREEN_W * 2);
+ }
+
+ } else if (_renderMode == Common::kRenderEGA) {
+ uint32 len = SCREEN_W * SCREEN_H;
+ while (len--)
+ *dst++ = *src++ & 0x0f;
+
+ } else {
+ copyPage(srcPage, dstPage);
+ }
+
+ if (dstPage == 0 || dstPage == 1)
+ _forceFullUpdate = true;
+}
+
+void Screen_EoB::fillRect(int x1, int y1, int x2, int y2, uint8 color, int pageNum, bool xored) {
+ if (!_useHiResEGADithering) {
+ Screen::fillRect(x1, y1, x2, y2, color, pageNum, xored);
+ return;
+ }
+
+ assert(x2 < SCREEN_W && y2 < SCREEN_H);
+ if (pageNum == -1)
+ pageNum = _curPage;
+
+ uint16 pitch = (SCREEN_W - (x2 - x1 + 1)) * _pageScaleFactor[pageNum];
+ uint8 col1 = (_egaDitheringTable[color] >> 4);
+ uint8 col2 = (_egaDitheringTable[color] & 0x0f);
+
+ x1 *= _pageScaleFactor[pageNum];
+ y1 *= _pageScaleFactor[pageNum];
+ x2 *= _pageScaleFactor[pageNum];
+ y2 *= _pageScaleFactor[pageNum];
+ uint16 w = x2 - x1 + _pageScaleFactor[pageNum];
+ uint16 h = y2 - y1 + _pageScaleFactor[pageNum];
+
+ uint8 *dst = getPagePtr(pageNum) + y1 * SCREEN_W * _pageScaleFactor[pageNum] + x1;
+ if (pageNum == 0 || pageNum == 1)
+ addDirtyRect(x1, y1, w, h);
+
+ while (h--) {
+ for (uint16 w1 = w; w1; w1 -= 2) {
+ *dst++ = col1;
+ *dst++ = col2;
+ }
+ dst += pitch;
+ }
+}
+
+void Screen_EoB::drawLine(bool vertical, int x, int y, int length, int color) {
+ if (!_useHiResEGADithering) {
+ Screen::drawLine(vertical, x, y, length, color);
+ return;
+ }
+
+ uint16 pitch = (SCREEN_W - 1) * _pageScaleFactor[_curPage];
+ uint8 col1 = (_egaDitheringTable[color] >> 4);
+ uint8 col2 = (_egaDitheringTable[color] & 0x0f);
+
+ x *= _pageScaleFactor[_curPage];
+ y *= _pageScaleFactor[_curPage];
+ length *= _pageScaleFactor[_curPage];
+ uint8 *ptr = getPagePtr(_curPage) + y * SCREEN_W * _pageScaleFactor[_curPage] + x;
+ uint8 *ptr2 = ptr + SCREEN_W * _pageScaleFactor[_curPage];
+
+ if (vertical) {
+ assert((y + length) <= SCREEN_H * _pageScaleFactor[_curPage]);
+ int currLine = 0;
+ while (currLine < length) {
+ *ptr++ = col1;
+ *ptr++ = col2;
+ ptr += pitch;
+ currLine++;
+ }
+ } else {
+ assert((x + length) <= SCREEN_W * _pageScaleFactor[_curPage]);
+ int currLine = 0;
+ while (currLine < length) {
+ *ptr++ = *ptr2++ = col1;
+ *ptr++ = *ptr2++ = col2;
+ currLine += 2;
+ }
}
+
+ if (_curPage == 0 || _curPage == 1)
+ addDirtyRect(x, y, (vertical) ? _pageScaleFactor[_curPage] : length, (vertical) ? length : _pageScaleFactor[_curPage]);
+}
+
+uint8 Screen_EoB::getPagePixel(int pageNum, int x, int y) {
+ if (!_useHiResEGADithering)
+ return Screen::getPagePixel(pageNum, x, y);
+
+ x *= _pageScaleFactor[_curPage];
+ y *= _pageScaleFactor[_curPage];
+ uint8 *pos = &_pagePtrs[pageNum][y * SCREEN_W * _pageScaleFactor[_curPage] + x];
+
+ return _egaPixelValueTable[(pos[0] << 4) | (pos[1] & 0x0f)];
}
-uint8 *Screen_EoB::encodeShape(uint16 x, uint16 y, uint16 w, uint16 h, bool no4bitEncoding) {
+void Screen_EoB::setPagePixel(int pageNum, int x, int y, uint8 color) {
+ if (!_useHiResEGADithering) {
+ Screen::setPagePixel(pageNum, x, y, color);
+ return;
+ }
+
+ assert(pageNum < SCREEN_PAGE_NUM);
+ assert(x >= 0 && x < SCREEN_W && y >= 0 && y < SCREEN_H);
+
+ x *= _pageScaleFactor[_curPage];
+ y *= _pageScaleFactor[_curPage];
+
+ if (pageNum == 0 || pageNum == 1)
+ addDirtyRect(x, y, _pageScaleFactor[pageNum], _pageScaleFactor[pageNum]);
+
+ uint8 *pos = &_pagePtrs[pageNum][y * SCREEN_W * _pageScaleFactor[_curPage] + x];
+ uint8 *pos2 = pos + SCREEN_W * _pageScaleFactor[_curPage];
+ pos[0] = pos2[0] = _egaDitheringTable[color] >> 4;
+ pos[1] = pos2[1] = _egaDitheringTable[color] & 0x0f;
+}
+
+void Screen_EoB::setScreenPalette(const Palette &pal) {
+ if (_useHiResEGADithering && pal.getNumColors() != 16) {
+ generateEGADitheringTable(pal);
+ } else if (_renderMode == Common::kRenderEGA && pal.getNumColors() == 16) {
+ _screenPalette->copy(pal);
+ _system->getPaletteManager()->setPalette(_screenPalette->getData(), 0, _screenPalette->getNumColors());
+ } else if (_renderMode != Common::kRenderCGA && _renderMode != Common::kRenderEGA) {
+ Screen::setScreenPalette(pal);
+ }
+}
+
+uint8 *Screen_EoB::encodeShape(uint16 x, uint16 y, uint16 w, uint16 h, bool encode8bit, const uint8 *cgaMapping) {
uint8 *shp = 0;
uint16 shapesize = 0;
- uint8 *srcPage = getPagePtr(_curPage) + y * 320 + (x << 3);
- uint8 *src = srcPage;
+ uint8 *srcLineStart = getPagePtr(_curPage | 1) + y * 320 + (x << 3);
+ uint8 *src = srcLineStart;
+
+ if (_renderMode == Common::kRenderEGA && !_useHiResEGADithering)
+ encode8bit = false;
+
+ if (_renderMode == Common::kRenderCGA) {
+ if (cgaMapping)
+ generateCGADitheringTables(cgaMapping);
+ shapesize = h * (w << 2) + 4;
+ shp = new uint8[shapesize];
+ memset(shp, 0, shapesize);
+ uint8 *dst = shp;
+
+ *dst++ = 4;
+ *dst++ = (h & 0xff);
+ *dst++ = (w & 0xff);
+ *dst++ = (h & 0xff);
+
+ uint8 *dst2 = dst + (h * (w << 1));
+
+ uint8 tblSwitch = 0;
+ uint16 h1 = h;
+ while (h1--) {
+ uint16 w1 = w << 1;
+ const uint16 *table = _cgaDitheringTables[(tblSwitch++) & 1];
+
+ while (w1--) {
+ uint16 p0 = table[((src[1] & 0x0f) << 4) | (src[0] & 0x0f)];
+ uint16 p1 = table[((src[3] & 0x0f) << 4) | (src[2] & 0x0f)];
+
+ *dst++ = ((p0 & 0x0003) << 6) | ((p0 & 0x0300) >> 4) | ((p1 & 0x0003) << 2) | ((p1 & 0x0300) >> 8);
- if (no4bitEncoding) {
+ uint8 msk = 0;
+ for (int i = 0; i < 4; i++) {
+ if (!src[3 - i])
+ msk |= (3 << (i << 1));
+ }
+ *dst2++ = msk;
+ src += 4;
+ }
+ srcLineStart += SCREEN_W;
+ src = srcLineStart;
+ }
+
+ } else if (encode8bit) {
uint16 h1 = h;
while (h1--) {
uint8 *lineEnd = src + (w << 3);
@@ -191,8 +492,8 @@ uint8 *Screen_EoB::encodeShape(uint16 x, uint16 y, uint16 w, uint16 h, bool no4b
shapesize++;
} while (src != lineEnd);
- srcPage += 320;
- src = srcPage;
+ srcLineStart += SCREEN_W;
+ src = srcLineStart;
}
shapesize += 4;
@@ -201,13 +502,13 @@ uint8 *Screen_EoB::encodeShape(uint16 x, uint16 y, uint16 w, uint16 h, bool no4b
memset(shp, 0, shapesize);
uint8 *dst = shp;
- *dst++ = 0;
+ *dst++ = 8;
*dst++ = (h & 0xff);
*dst++ = (w & 0xff);
*dst++ = (h & 0xff);
- srcPage = getPagePtr(_curPage) + y * 320 + (x << 3);
- src = srcPage;
+ srcLineStart = getPagePtr(_curPage | 1) + y * 320 + (x << 3);
+ src = srcLineStart;
h1 = h;
while (h1--) {
@@ -232,31 +533,38 @@ uint8 *Screen_EoB::encodeShape(uint16 x, uint16 y, uint16 w, uint16 h, bool no4b
*dst++ = val;
} while (src != lineEnd);
- srcPage += 320;
- src = srcPage;
+ srcLineStart += SCREEN_W;
+ src = srcLineStart;
}
} else {
uint8 nib = 0, col = 0;
- uint8 *colorMap = new uint8[0x100];
- memset(colorMap, 0xff, 0x100);
+ uint8 *colorMap = 0;
+
+ if (_renderMode != Common::kRenderEGA || _useHiResEGADithering) {
+ colorMap = new uint8[0x100];
+ memset(colorMap, 0xff, 0x100);
+ }
shapesize = h * (w << 2) + 20;
shp = new uint8[shapesize];
memset(shp, 0, shapesize);
uint8 *dst = shp;
- *dst++ = 1;
+ *dst++ = 2;
*dst++ = (h & 0xff);
*dst++ = (w & 0xff);
*dst++ = (h & 0xff);
- memset(dst, 0xff, 0x10);
- uint8 *pal = dst;
- dst += 0x10;
+ if (_renderMode == Common::kRenderEGA && !_useHiResEGADithering) {
+ for (int i = 0; i < 16; i++)
+ dst[i] = i;
+ } else {
+ memset(dst, 0xff, 0x10);
+ }
- srcPage = getPagePtr(_curPage) + y * 320 + (x << 3);
- src = srcPage;
+ uint8 *pal = dst;
+ dst += 16;
nib = col = 0;
uint16 h1 = h;
@@ -264,26 +572,28 @@ uint8 *Screen_EoB::encodeShape(uint16 x, uint16 y, uint16 w, uint16 h, bool no4b
uint16 w1 = w << 3;
while (w1--) {
uint8 s = *src++;
- uint8 c = colorMap[s];
- if (c == 0xff) {
- if (col < 0x10) {
- *pal++ = s;
- c = colorMap[s] = col++;
- if (!col)
+ uint8 c = s & 0x0f;
+ if (colorMap) {
+ c = colorMap[s];
+ if (c == 0xff) {
+ if (col < 0x10) {
+ *pal++ = s;
+ c = colorMap[s] = col++;
+ if (!col)
+ c = 0;
+ } else {
c = 0;
- } else {
- c = 0;
+ }
}
}
- if (++nib & 1) {
+ if (++nib & 1)
*dst = c << 4;
- } else {
+ else
*dst++ |= c;
- }
}
- srcPage += 320;
- src = srcPage;
+ srcLineStart += SCREEN_W;
+ src = srcLineStart;
}
delete [] colorMap;
}
@@ -310,14 +620,15 @@ void Screen_EoB::drawShape(uint8 pageNum, const uint8 *shapeData, int x, int y,
y += _dsY1;
}
- dst += (_dsX1 << 3);
+ dst += (_dsX1 << 3) * _pageScaleFactor[pageNum];
int16 dX = x - (_dsX1 << 3);
int16 dY = y;
int16 dW = _dsX2 - _dsX1;
- uint8 flag = *src++;
+ uint8 pixelsPerByte = *src++ ;
uint16 dH = *src++;
uint16 width = (*src++) << 3;
+ uint16 transOffset = (pixelsPerByte == 4) ? (dH * width) >> 2 : 0;
src++;
int rX = x;
@@ -330,148 +641,7 @@ void Screen_EoB::drawShape(uint8 pageNum, const uint8 *shapeData, int x, int y,
int pixelStep = (flags & 1) ? -1 : 1;
- if (flag) {
- const uint8 *pal = ovl ? ovl : src;
- src += 16;
-
- if (d < 0) {
- d = -d;
- if (d >= dH)
- return;
- src += (d * (width >> 1));
- d = dY + dH - _dsY1;
- if (d >= 0) {
- dH = d;
- dY = _dsY1;
- d = _dsY2 - dY;
- }
- } else {
- d = _dsY2 - dY;
- }
-
- if (d < 1)
- return;
-
- if (d < dH)
- dH = d;
-
- int16 cnt1 = 0;
- int16 cnt2 = 0;
- int16 dXbit1 = dX & 1;
-
- if (dX < 0) {
- width += dX;
- d = -dX;
- if (flags & 1)
- src -= (d >> 1);
- else
- src += (d >> 1);
-
- if (d >= w2)
- return;
-
- dX = 0;
- cnt1++;
- }
-
- d = (dW << 3) - dX;
-
- if (d < 1)
- return;
-
- if (d < width) {
- width = d;
- cnt2++;
- }
-
- dst += (dY * 320 + dX);
-
- if (pageNum == 0 || pageNum == 1)
- addDirtyRect(rX, rY, rW, rH);
-
- int w3 = w2;
- dY = 320 - width;
- width >>= 1;
- w2 >>= 1;
- if (flags & 1)
- src += (w2 - 1);
-
- int16 w1shr = width;
-
- if (cnt1 && (dXbit1 & 1)) {
- w1shr++;
- w2++;
- if (!cnt2)
- dY += 2;
- }
-
- if (cnt2 && (dXbit1 & 1))
- w1shr++;
-
- int lineSrcStep = (w2 - w1shr);
- if (flags & 1)
- lineSrcStep = w3 - lineSrcStep;
-
- while (dH--) {
- int16 hpos = width;
- uint8 col = 0;
- uint8 b = 0;
- uint8 nextloop = 0;
-
- if (cnt1 && dXbit1) {
- if (!hpos)
- return;
- b = *src;
- src += pixelStep;
- nextloop = 2;
- } else {
- nextloop = hpos ? 1 : 3;
- }
-
- while (nextloop) {
- switch (nextloop) {
- case 1:
- b = *src;
- src += pixelStep;
- col = pal[(flags & 1) ? (b & 0x0f) : (b >> 4)];
- if (col)
- drawShapeSetPixel(dst, col);
- dst++;
-
- case 2:
- col = pal[(flags & 1) ? (b >> 4) : (b & 0x0f)];
-
- if (!col) {
- nextloop = 4;
- break;
- }
-
- drawShapeSetPixel(dst++, col);
- nextloop = --hpos ? 1 : 3;
- break;
-
- case 3:
- if (cnt2 && dXbit1) {
- col = pal[(flags & 1) ? (*src & 0x0f) : (*src >> 4)];
- src += pixelStep;
- if (col)
- drawShapeSetPixel(dst, col);
- dst++;
- }
-
- src += lineSrcStep;
- dst += dY;
- nextloop = 0;
- break;
-
- case 4:
- dst++;
- nextloop = --hpos ? 1 : 3;
- break;
- }
- }
- }
- } else {
+ if (pixelsPerByte == 8) {
uint16 marginLeft = 0;
uint16 marginRight = 0;
@@ -522,11 +692,11 @@ void Screen_EoB::drawShape(uint8 pageNum, const uint8 *shapeData, int x, int y,
marginRight = w2 - marginLeft - width;
}
- dst += (dY * 320 + dX);
+ dst += (dY * SCREEN_W * _pageScaleFactor[pageNum] * _pageScaleFactor[pageNum] + dX * _pageScaleFactor[pageNum]);
uint8 *dstL = dst;
if (pageNum == 0 || pageNum == 1)
- addDirtyRect(rX, rY, rW, rH);
+ addDirtyRect(rX * _pageScaleFactor[pageNum], rY * _pageScaleFactor[pageNum], rW * _pageScaleFactor[pageNum], rH * _pageScaleFactor[pageNum]);
while (dH--) {
int16 xpos = (int16) marginLeft;
@@ -561,7 +731,7 @@ void Screen_EoB::drawShape(uint8 pageNum, const uint8 *shapeData, int x, int y,
} while (xpos > 0);
}
- dst -= xpos;
+ dst -= (xpos * _pageScaleFactor[pageNum]);
xpos += width;
while (xpos > 0) {
@@ -570,11 +740,12 @@ void Screen_EoB::drawShape(uint8 pageNum, const uint8 *shapeData, int x, int y,
src += pixelStep;
if (m) {
- drawShapeSetPixel(dst++, c);
+ drawShapeSetPixel(dst, c, SCREEN_W * _pageScaleFactor[pageNum]);
+ dst += _pageScaleFactor[pageNum];
xpos--;
} else {
uint8 len = (flags & 1) ? src[1] : src[0];
- dst += len;
+ dst += (len * _pageScaleFactor[pageNum]);
xpos -= len;
src += pixelStep;
}
@@ -600,11 +771,129 @@ void Screen_EoB::drawShape(uint8 pageNum, const uint8 *shapeData, int x, int y,
} while (xpos > 0);
}
- dstL += 320;
+ dstL += SCREEN_W * _pageScaleFactor[pageNum] * _pageScaleFactor[pageNum];
dst = dstL;
if (flags & 1)
src = src2 + 1;
}
+ } else {
+ const uint8 *pal = 0;
+ uint8 cgaPal[4];
+ memset(cgaPal, 0, 4);
+
+ if (pixelsPerByte == 2) {
+ pal = ovl ? ovl : src;
+ src += 16;
+ } else {
+ static const uint8 cgaDefOvl[] = { 0x00, 0x55, 0xaa, 0xff };
+ pal = ovl ? ovl : cgaDefOvl;
+ for (int i = 0; i < 4; i++)
+ cgaPal[i] = pal[i] & 3;
+ pal = cgaPal;
+ }
+
+ if (d < 0) {
+ d = -d;
+ if (d >= dH)
+ return;
+ src += (d * (width / pixelsPerByte));
+ d = dY + dH - _dsY1;
+ if (d >= 0) {
+ dH = d;
+ dY = _dsY1;
+ d = _dsY2 - dY;
+ }
+ } else {
+ d = _dsY2 - dY;
+ }
+
+ if (d < 1)
+ return;
+
+ if (d < dH)
+ dH = d;
+
+ bool trimL = false;
+ uint8 dXbitAlign = dX & (pixelsPerByte - 1);
+
+ if (dX < 0) {
+ width += dX;
+ d = -dX;
+ if (flags & 1)
+ src -= (d / pixelsPerByte);
+ else
+ src += (d / pixelsPerByte);
+
+ if (d >= w2)
+ return;
+
+ dX = 0;
+ trimL = true;
+ }
+
+ d = (dW << 3) - dX;
+
+ if (d < 1)
+ return;
+
+ if (d < width)
+ width = d;
+
+ dst += (dY * _pageScaleFactor[pageNum] * SCREEN_W * _pageScaleFactor[pageNum] + dX * _pageScaleFactor[pageNum]);
+
+ if (pageNum == 0 || pageNum == 1)
+ addDirtyRect(rX * _pageScaleFactor[pageNum], rY * _pageScaleFactor[pageNum], rW * _pageScaleFactor[pageNum], rH * _pageScaleFactor[pageNum]);
+
+ int pitch = SCREEN_W * _pageScaleFactor[pageNum] * _pageScaleFactor[pageNum] - width * _pageScaleFactor[pageNum];
+ int16 lineSrcStep = (w2 - width) / pixelsPerByte;
+ uint8 lineSrcStepRemainder = (w2 - width) % pixelsPerByte;
+
+ w2 /= pixelsPerByte;
+ if (flags & 1)
+ src += (w2 - 1);
+
+ uint8 pixelPacking = 8 / pixelsPerByte;
+ uint8 pixelPackingMask = 0;
+
+ for (int i = 0; i < pixelPacking; i++)
+ pixelPackingMask |= (1 << i);
+
+ if (trimL && (dXbitAlign > lineSrcStepRemainder))
+ lineSrcStep--;
+
+ uint8 bitShDef = 8 - pixelPacking;
+ if (flags & 1) {
+ lineSrcStep = (w2 << 1) - lineSrcStep;
+ bitShDef = 0;
+ }
+
+ uint8 bitShLineStart = bitShDef;
+ if (trimL)
+ bitShLineStart -= (dXbitAlign * pixelStep * pixelPacking);
+
+ while (dH--) {
+ int16 wd = width;
+ uint8 in = 0;
+ uint8 trans = 0;
+ uint8 shift = bitShLineStart;
+ uint8 shSwtch = bitShLineStart;
+
+ while (wd--) {
+ if (shift == shSwtch) {
+ in = *src;
+ trans = src[transOffset];
+ src += pixelStep;
+ shSwtch = bitShDef;
+ }
+ uint8 col = (pixelsPerByte == 2) ? pal[(in >> shift) & pixelPackingMask] : (*dst & ((trans >> shift) & (pixelPackingMask))) | pal[(in >> shift) & pixelPackingMask];
+ if (col || pixelsPerByte == 4)
+ drawShapeSetPixel(dst, col, SCREEN_W * _pageScaleFactor[pageNum]);
+ dst += _pageScaleFactor[pageNum];
+ shift = ((shift - (pixelStep * pixelPacking)) & 7);
+ }
+ src += lineSrcStep;
+ dst += pitch;
+ }
}
}
@@ -618,69 +907,75 @@ const uint8 *Screen_EoB::scaleShape(const uint8 *shapeData, int steps) {
}
const uint8 *Screen_EoB::scaleShapeStep(const uint8 *shp) {
- uint8 *d = _dsTempPage;
- *d++ = *shp++;
+ uint8 *dst = (shp != _dsTempPage) ? _dsTempPage : _dsTempPage + 6000;
+ uint8 *d = dst;
+ uint8 pixelsPerByte = *d++ = *shp++;
+ assert (pixelsPerByte > 1);
- uint16 h = (*shp++) + 1;
+ uint16 h = shp[0] + 1;
d[0] = d[2] = (h << 1) / 3;
- d++;
- uint16 w = *shp++;
- uint16 w2 = w << 2;
+ uint16 w = shp[1];
+ uint16 w2 = (w << 3) / pixelsPerByte;
uint16 t = ((w << 1) % 3) ? 1 : 0;
- *d++ = ((w << 1) / 3) + t;
-
- shp++;
- d++;
-
- int i = 0;
- while (i < 16) {
- if (!shp[i]) {
- i = -i;
- break;
+ d[1] = ((w << 1) / 3) + t;
+
+ uint32 transOffsetSrc = (pixelsPerByte == 4) ? (shp[0] * shp[1]) << 1 : 0;
+ uint32 transOffsetDst = (pixelsPerByte == 4) ? (d[0] * d[1]) << 1 : 0;
+ shp += 3;
+ d += 3;
+
+ if (pixelsPerByte == 2) {
+ int i = 0;
+ while (i < 16) {
+ if (!shp[i]) {
+ i = -i;
+ break;
+ }
+ i++;
}
- i++;
- }
- if (i >= 0)
- i = 0;
- else
- i = -i;
+ if (i >= 0)
+ i = 0;
+ else
+ i = -i;
- _dsScaleTmp = (i << 4) | (i & 0x0f);
- for (int ii = 0; ii < 16; ii++)
- *d++ = *shp++;
+ _dsScaleTrans = (i << 4) | (i & 0x0f);
+ for (int ii = 0; ii < 16; ii++)
+ *d++ = *shp++;
+ }
_dsDiv = w2 / 3;
_dsRem = w2 % 3;
while (--h) {
- scaleShapeProcessLine(d, shp);
+ if (pixelsPerByte == 2)
+ scaleShapeProcessLine4Bit(d, shp);
+ else
+ scaleShapeProcessLine2Bit(d, shp, transOffsetDst, transOffsetSrc);
if (!--h)
break;
- scaleShapeProcessLine(d, shp);
+ if (pixelsPerByte == 2)
+ scaleShapeProcessLine4Bit(d, shp);
+ else
+ scaleShapeProcessLine2Bit(d, shp, transOffsetDst, transOffsetSrc);
if (!--h)
break;
shp += w2;
}
- return (const uint8 *)_dsTempPage;
+ return (const uint8*)dst;
}
-void Screen_EoB::replaceShapePalette(uint8 *shp, const uint8 *pal) {
- if (*shp != 1)
- return;
- shp += 4;
- memcpy(shp, pal, 16);
-}
+const uint8 *Screen_EoB::generateShapeOverlay(const uint8 *shp, int paletteOverlayIndex) {
+ if (*shp != 2)
+ return 0;
-void Screen_EoB::applyShapeOverlay(uint8 *shp, int ovlIndex) {
- if (*shp != 1)
- return;
shp += 4;
- uint8 *ovl = getFadeTable(ovlIndex);
+ uint8 *ovl = getFadeTable(paletteOverlayIndex);
for (int i = 0; i < 16; i++)
- shp[i] = ovl[shp[i]];
+ _shapeOverlay[i] = ovl[shp[i]];
+ return _shapeOverlay;
}
void Screen_EoB::setShapeFrame(int x1, int y1, int x2, int y2) {
@@ -1052,26 +1347,71 @@ uint8 *Screen_EoB::getFadeTable(int index) {
return (index >= 0 && index < 5) ? &_fadeData[index << 8] : 0;
}
-void Screen_EoB::drawShapeSetPixel(uint8 *dst, uint8 c) {
- if (_shapeFadeMode[0]) {
+const uint16 *Screen_EoB::getCGADitheringTable(int index) {
+ return !(index & ~1) ? _cgaDitheringTables[index] : 0;
+}
+
+const uint8 *Screen_EoB::getEGADitheringTable() {
+ return _egaDitheringTable;
+}
+
+void Screen_EoB::drawShapeSetPixel(uint8 *dst, uint8 col, uint16 pitch) {
+ if ((_renderMode != Common::kRenderCGA && _renderMode != Common::kRenderEGA) || _useHiResEGADithering) {
+ if (_shapeFadeMode[0]) {
+ if (_shapeFadeMode[1]) {
+ col = _useHiResEGADithering ? _egaPixelValueTable[(dst[0] << 4) | (dst[1] & 0x0f)] : *dst;
+ } else {
+ _shapeFadeInternal &= 7;
+ col = _useHiResEGADithering ? _egaPixelValueTable[(dst[_shapeFadeInternal] << 4) | (dst[_shapeFadeInternal + 1] & 0x0f)] : dst[_shapeFadeInternal];
+ _shapeFadeInternal++;
+ }
+ }
+
if (_shapeFadeMode[1]) {
- c = *dst;
- } else {
- _shapeFadeInternal &= 7;
- c = *(dst + _shapeFadeInternal++);
+ uint8 cnt = _shapeFadeMode[1];
+ while (cnt--)
+ col = _fadeData[_fadeDataIndex + col];
}
}
- if (_shapeFadeMode[1]) {
- uint8 cnt = _shapeFadeMode[1];
- while (cnt--)
- c = _fadeData[_fadeDataIndex + c];
+ if (_useHiResEGADithering) {
+ col = _egaDitheringTable[col];
+ dst[0] = dst[pitch] = col >> 4;
+ dst[1] = dst[pitch + 1] = col & 0x0f;
+ } else {
+ *dst = col;
}
+}
- *dst = c;
+void Screen_EoB::scaleShapeProcessLine2Bit(uint8 *&shpDst, const uint8 *&shpSrc, uint32 transOffsetDst, uint32 transOffsetSrc) {
+ for (int i = 0; i < _dsDiv; i++) {
+ shpDst[0] = (_cgaScaleTable[shpSrc[0]] << 2) | (shpSrc[1] >> 6);
+ shpDst[1] = ((shpSrc[1] & 0x0f) << 4) | ((shpSrc[2] >> 2) & 0x0f);
+ shpDst[transOffsetDst] = (_cgaScaleTable[shpSrc[transOffsetSrc]] << 2) | (shpSrc[transOffsetSrc + 1] >> 6);
+ shpDst[transOffsetDst + 1] = ((shpSrc[transOffsetSrc + 1] & 0x0f) << 4) | ((shpSrc[transOffsetSrc + 2] >> 2) & 0x0f);
+ shpSrc += 3;
+ shpDst += 2;
+ }
+
+ if (_dsRem == 1) {
+ shpDst[0] = _cgaScaleTable[shpSrc[0]] << 2;
+ shpDst[1] = 0;
+ shpDst[transOffsetDst] = (_cgaScaleTable[shpSrc[transOffsetSrc]] << 2) | 3;
+ shpDst[transOffsetDst + 1] = 0xff;
+ shpSrc++;
+ shpDst += 2;
+
+ } else if (_dsRem == 2) {
+ shpDst[0] = (_cgaScaleTable[shpSrc[0]] << 2) | (shpSrc[1] >> 6);
+ shpDst[1] = (shpSrc[1] & 0x3f) << 2;
+ shpDst[transOffsetDst] = (_cgaScaleTable[shpSrc[transOffsetSrc]] << 2) | (shpSrc[transOffsetSrc + 1] >> 6);
+ shpDst[transOffsetDst + 1] = ((shpSrc[transOffsetSrc + 1] & 0x3f) << 2) | 3;
+ shpSrc += 2;
+ shpDst += 2;
+ }
}
-void Screen_EoB::scaleShapeProcessLine(uint8 *&dst, const uint8 *&src) {
+void Screen_EoB::scaleShapeProcessLine4Bit(uint8 *&dst, const uint8 *&src) {
for (int i = 0; i < _dsDiv; i++) {
*dst++ = *src++;
*dst++ = (READ_BE_UINT16(src) >> 4) & 0xff;
@@ -1080,13 +1420,13 @@ void Screen_EoB::scaleShapeProcessLine(uint8 *&dst, const uint8 *&src) {
if (_dsRem == 1) {
*dst++ = *src++;
- *dst++ = _dsScaleTmp;
+ *dst++ = _dsScaleTrans;
} else if (_dsRem == 2) {
*dst++ = (src[0] & 0xf0) | (src[1] >> 4);
src += 2;
- *dst++ = _dsScaleTmp;
- *dst++ = _dsScaleTmp;
- *dst++ = _dsScaleTmp;
+ *dst++ = _dsScaleTrans;
+ *dst++ = _dsScaleTrans;
+ *dst++ = _dsScaleTrans;
}
}
@@ -1096,10 +1436,129 @@ bool Screen_EoB::posWithinRect(int posX, int posY, int x1, int y1, int x2, int y
return true;
}
-OldDOSFont::OldDOSFont() {
+void Screen_EoB::generateEGADitheringTable(const Palette &pal) {
+ assert(_egaDitheringTable);
+ const uint8 *src = pal.getData();
+ uint8 *dst = _egaDitheringTable;
+
+ for (int i = 256; i; i--) {
+ int r = *src++;
+ int g = *src++;
+ int b = *src++;
+
+ uint8 col = 0;
+ uint16 min = 0x2E83;
+
+ for (int ii = 256; ii; ii--) {
+ const uint8 *palEntry = _egaMatchTable + (ii - 1) * 3;
+ if (*palEntry == 0xff)
+ continue;
+
+ int e_r = palEntry[0] - r;
+ int e_g = palEntry[1] - g;
+ int e_b = palEntry[2] - b;
+
+ uint16 s = (e_r * e_r) + (e_g * e_g) + (e_b * e_b);
+
+ if (s <= min) {
+ min = s;
+ col = ii - 1;
+ }
+ }
+ *dst++ = col;
+ }
+
+ memset(_egaPixelValueTable, 0, 256);
+ for (int i = 0; i < 256; i++)
+ _egaPixelValueTable[_egaDitheringTable[i]] = i;
+}
+
+void Screen_EoB::generateCGADitheringTables(const uint8 *mappingData) {
+ for (int i = 0; i < 256; i++) {
+ _cgaDitheringTables[0][i] = (mappingData[(i >> 4) + 16] << 8) | mappingData[i & 0x0f];
+ _cgaDitheringTables[1][i] = (mappingData[i >> 4] << 8) | mappingData[(i & 0x0f) + 16];
+ }
+}
+
+const uint8 Screen_EoB::_egaMatchTable[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x1E, 0x00, 0x00, 0x1E, 0x1E, 0x1E, 0x00, 0x00, 0x1E,
+ 0x00, 0x1E, 0x1E, 0x0F, 0x00, 0x1E, 0x1E, 0x1E, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x2D, 0x0F, 0x2D,
+ 0x0F, 0x0F, 0x2D, 0x2D, 0x2D, 0x0F, 0x0F, 0x2D, 0x0F, 0x2D, 0x2D, 0x2D, 0x0F, 0x2D, 0x2D, 0x2D,
+ 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x2A, 0x00, 0x1E, 0x1E, 0x00, 0x1E, 0x2A, 0x1E, 0x00, 0x1E, 0x1E,
+ 0x00, 0x2A, 0x1E, 0x0F, 0x1E, 0x1E, 0x1E, 0x2A, 0x0F, 0x0F, 0x21, 0x0F, 0x0F, 0x36, 0x0F, 0x2D,
+ 0x21, 0x0F, 0x2D, 0x36, 0x2D, 0x0F, 0x21, 0x2D, 0x0F, 0x36, 0x2D, 0x2D, 0x21, 0x2D, 0x2D, 0x36,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x2A, 0x00, 0x00, 0x2A, 0x1E, 0x1E, 0x1E, 0x00, 0x1E,
+ 0x1E, 0x1E, 0x1E, 0x21, 0x00, 0x1E, 0x2A, 0x1E, 0x0F, 0x21, 0x0F, 0x0F, 0x21, 0x2D, 0x0F, 0x36,
+ 0x0F, 0x0F, 0x36, 0x2D, 0x2D, 0x21, 0x0F, 0x2D, 0x21, 0x2D, 0x2D, 0x36, 0x0F, 0x2D, 0x36, 0x2D,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x2A, 0x2A, 0x1E, 0x1E, 0x1E, 0x1E,
+ 0x1E, 0x2A, 0x1E, 0x21, 0x1E, 0x1E, 0x2A, 0x2A, 0x0F, 0x21, 0x21, 0x0F, 0x21, 0x36, 0x0F, 0x36,
+ 0x21, 0x0F, 0x36, 0x36, 0x2D, 0x21, 0x21, 0x2D, 0x21, 0x36, 0x2D, 0x36, 0x21, 0x2D, 0x36, 0x36,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x2A, 0x00, 0x00, 0x2A,
+ 0x00, 0x1E, 0x2A, 0x0F, 0x00, 0x2A, 0x1E, 0x1E, 0x21, 0x0F, 0x0F, 0x21, 0x0F, 0x2D, 0x21, 0x2D,
+ 0x0F, 0x21, 0x2D, 0x2D, 0x36, 0x0F, 0x0F, 0x36, 0x0F, 0x2D, 0x36, 0x2D, 0x0F, 0x36, 0x2D, 0x2D,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x2A,
+ 0x00, 0x2A, 0x2A, 0x0F, 0x1E, 0x2A, 0x1E, 0x2A, 0x21, 0x0F, 0x21, 0x21, 0x0F, 0x36, 0x21, 0x2D,
+ 0x21, 0x21, 0x2D, 0x36, 0x36, 0x0F, 0x21, 0x36, 0x0F, 0x36, 0x36, 0x2D, 0x21, 0x36, 0x2D, 0x36,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0x2A, 0x15, 0x00, 0x2A, 0x21, 0x1E, 0x21, 0x15, 0x0F, 0x21, 0x15, 0x2D, 0x21, 0x2F,
+ 0x0F, 0x21, 0x2F, 0x2D, 0x36, 0x15, 0x0F, 0x36, 0x15, 0x2D, 0x36, 0x2F, 0x0F, 0x36, 0x2F, 0x2D,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x2A, 0x2A, 0x2A, 0x21, 0x21, 0x21, 0x21, 0x21, 0x36, 0x21, 0x36,
+ 0x21, 0x21, 0x36, 0x36, 0x36, 0x21, 0x21, 0x36, 0x21, 0x36, 0x36, 0x36, 0x21, 0x36, 0x36, 0x36,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x15, 0x15, 0x15, 0x15, 0x15, 0x2F, 0x15, 0x2F,
+ 0x15, 0x15, 0x2F, 0x2F, 0x2F, 0x15, 0x15, 0x2F, 0x15, 0x2F, 0x2F, 0x2F, 0x15, 0x2F, 0x2F, 0x2F,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x15, 0x15, 0x3F, 0x15, 0x2F,
+ 0x2F, 0x15, 0x2F, 0x3F, 0x2F, 0x15, 0x2F, 0x2F, 0x15, 0x3F, 0x2F, 0x2F, 0x2F, 0x2F, 0x2F, 0x3F,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x15, 0x3F,
+ 0x15, 0x15, 0x3F, 0x2F, 0x2F, 0x2F, 0x15, 0x2F, 0x2F, 0x2F, 0x2F, 0x3F, 0x15, 0x2F, 0x3F, 0x2F,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0x15, 0x3F, 0x3F, 0x2F, 0x2F, 0x2F, 0x2F, 0x2F, 0x3F, 0x2F, 0x3F, 0x2F, 0x2F, 0x3F, 0x3F,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0x3F, 0x15, 0x15, 0x3F, 0x15, 0x2F, 0x3F, 0x2F, 0x15, 0x3F, 0x2F, 0x2F,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x3F, 0x15, 0x3F, 0x3F, 0x2F, 0x2F, 0x3F, 0x2F, 0x3F,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x3F, 0x3F, 0x15, 0x3F, 0x3F, 0x2F,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x3F, 0x3F, 0x3F
+};
+
+uint16 *OldDOSFont::_cgaDitheringTable = 0;
+int OldDOSFont::_numRef = 0;
+
+OldDOSFont::OldDOSFont(Common::RenderMode mode, bool useHiResEGADithering) : _renderMode(mode), _useHiResEGADithering(useHiResEGADithering) {
_data = 0;
_width = _height = _numGlyphs = 0;
_bitmapOffsets = 0;
+
+ _numRef++;
+ if (!_cgaDitheringTable && _numRef == 1) {
+ _cgaDitheringTable = new uint16[256];
+ memset(_cgaDitheringTable, 0, 256 * sizeof(uint16));
+ static const uint bits[] = { 0, 3, 12, 15 };
+ for (int i = 0; i < 256; i++)
+ _cgaDitheringTable[i] = (bits[i & 3] << 8) | (bits[(i >> 2) & 3] << 12) | (bits[(i >> 4) & 3] << 0) | (bits[(i >> 6) & 3] << 4);
+ }
+}
+
+OldDOSFont::~OldDOSFont() {
+ unload();
+
+ if (_numRef)
+ --_numRef;
+
+ if (_cgaDitheringTable && !_numRef) {
+ delete[] _cgaDitheringTable;
+ _cgaDitheringTable = 0;
+ }
}
bool OldDOSFont::load(Common::SeekableReadStream &file) {
@@ -1185,44 +1644,115 @@ void OldDOSFont::drawChar(uint16 c, byte *dst, int pitch) const {
}
const uint8 *src = &_data[_bitmapOffsets[c]];
+ uint8 *dst2 = dst + pitch;
int w = (_width - 1) >> 3;
pitch -= _width;
+ if (_useHiResEGADithering)
+ pitch *= 2;
+
uint8 color1 = _colorMap[1];
uint8 color2 = _colorMap[0];
+ uint8 colEGA11 = _colorMap[3] >> 4;
+ uint8 colEGA12 = _colorMap[3] & 0x0f;
+ uint8 colEGA21 = _colorMap[2] >> 4;
+ uint8 colEGA22 = _colorMap[2] & 0x0f;
+
+ static const uint16 cgaColorMask[] = { 0, 0x5555, 0xAAAA, 0xFFFF };
+ uint16 cgaMask1 = cgaColorMask[color1 & 3];
+ uint16 cgaMask2 = cgaColorMask[color2 & 3];
+
+ if (_renderMode == Common::kRenderCGA || (_renderMode == Common::kRenderEGA && !_useHiResEGADithering)) {
+ color1 &= 0x0f;
+ color2 &= 0x0f;
+ }
+
int cH = _height;
while (cH--) {
int cW = w;
+ uint8 last = 0;
const uint8 *mtbl = _width == 8 ? renderMaskTable8 : renderMaskTable6;
- for (bool runWidthLoop = true; runWidthLoop;) {
+ if (_renderMode == Common::kRenderCGA) {
uint8 s = *src++;
uint8 m = *mtbl++;
- for (uint8 i = 0x80; i; i >>= 1) {
- if (!(m & i)) {
- runWidthLoop = false;
- break;
- }
+ uint8 in = s | last;
+ uint16 cmp1 = 0;
+ uint16 cmp2 = 0;
- if (s & i) {
- if (color1)
- *dst = color1;
- } else if (color2) {
- *dst = color2;
- }
- dst++;
+ if (color1) {
+ in &= m;
+ cmp1 = _cgaDitheringTable[in];
}
- if (cW)
- cW--;
- else
- runWidthLoop = false;
+ if (color2) {
+ in = ~in & m;
+ cmp2 = _cgaDitheringTable[in];
+ }
+
+ uint16 cDst = 0;
+ uint8 sh = 6;
+ for (int i = 0; i < _width; i++) {
+ cDst |= ((dst[i] & 3) << sh);
+ sh = (sh - 2) & 0x0f;
+ }
+
+ uint16 out = (~(cmp1 | cmp2) & cDst) | (cmp1 & cgaMask1) | (cmp2 & cgaMask2);
+
+ sh = 6;
+ for (int i = 0; i < _width; i++) {
+ *dst++ = (out >> sh) & 3;
+ sh = (sh - 2) & 0x0f;
+ }
+
+ last = s;
+
+ } else {
+ for (bool runWidthLoop = true; runWidthLoop;) {
+ uint8 s = *src++;
+ uint8 m = *mtbl++;
+
+ for (uint8 i = 0x80; i; i >>= 1) {
+ if (!(m & i)) {
+ runWidthLoop = false;
+ break;
+ }
+
+ if (_useHiResEGADithering) {
+ if (s & i) {
+ if (color1) {
+ dst[0] = dst2[0] = colEGA11;
+ dst[1] = dst2[1] = colEGA12;
+ }
+ } else if (color2) {
+ dst[0] = dst2[0] = colEGA21;
+ dst[1] = dst2[1] = colEGA22;
+ }
+ dst += 2;
+ dst2 += 2;
+ } else {
+ if (s & i) {
+ if (color1)
+ *dst = color1;
+ } else if (color2) {
+ *dst = color2;
+ }
+ dst++;
+ }
+ }
+
+ if (cW)
+ cW--;
+ else
+ runWidthLoop = false;
+ }
}
dst += pitch;
+ dst2 += pitch;
}
}
diff --git a/engines/kyra/screen_eob.h b/engines/kyra/screen_eob.h
index 7040177266..2bcfbd8f60 100644
--- a/engines/kyra/screen_eob.h
+++ b/engines/kyra/screen_eob.h
@@ -36,24 +36,36 @@ public:
virtual ~Screen_EoB();
bool init();
+ bool init(bool useHiResEGADithering);
void setClearScreenDim(int dim);
void clearCurDim();
void setMouseCursor(int x, int y, const byte *shape);
+ void setMouseCursor(int x, int y, const byte *shape, const uint8 *ovl);
void loadFileDataToPage(Common::SeekableReadStream *s, int pageNum, uint32 size);
+ void printText(const char *str, int x, int y, uint8 color1, uint8 color2);
void printShadedText(const char *string, int x, int y, int col1, int col2);
- void loadEoBBitmap(const char *file, const uint8 *ditheringData, int tempPage, int destPage, int copyToPage);
+
+ void loadEoBBitmap(const char *file, const uint8 *cgaMapping, int tempPage, int destPage, int convertToPage);
void loadShapeSetBitmap(const char *file, int tempPage, int destPage);
- uint8 *encodeShape(uint16 x, uint16 y, uint16 w, uint16 h, bool no4bitEncoding = false);
+ void convertPage(int srcPage, int dstPage, const uint8 *cgaMapping);
+
+ void fillRect(int x1, int y1, int x2, int y2, uint8 color, int pageNum = -1, bool xored = false);
+ void drawLine(bool vertical, int x, int y, int length, int color);
+ uint8 getPagePixel(int pageNum, int x, int y);
+ void setPagePixel(int pageNum, int x, int y, uint8 color);
+
+ void setScreenPalette(const Palette &pal);
+
+ uint8 *encodeShape(uint16 x, uint16 y, uint16 w, uint16 h, bool encode8bit = false, const uint8 *cgaMapping = 0);
void drawShape(uint8 pageNum, const uint8 *shapeData, int x, int y, int sd = -1, int flags = 0, ...);
const uint8 *scaleShape(const uint8 *shapeData, int blockDistance);
const uint8 *scaleShapeStep(const uint8 *shp);
- void replaceShapePalette(uint8 *shp, const uint8 *pal);
- void applyShapeOverlay(uint8 *shp, int ovlIndex);
+ const uint8 *generateShapeOverlay(const uint8 *shp, int paletteOverlayIndex);
void setShapeFrame(int x1, int y1, int x2, int y2);
void setShapeFadeMode (uint8 i, bool b);
@@ -72,12 +84,20 @@ public:
void createFadeTable(uint8 *palData, uint8 *dst, uint8 rootColor, uint8 weight);
uint8 *getFadeTable(int index);
+ const uint16 *getCGADitheringTable(int index);
+ const uint8 *getEGADitheringTable();
+
private:
- void drawShapeSetPixel(uint8 *dst, uint8 c);
- void scaleShapeProcessLine(uint8 *&dst, const uint8 *&src);
+ void drawShapeSetPixel(uint8 *dst, uint8 col, uint16 pitch);
+ void scaleShapeProcessLine2Bit(uint8 *&shpDst, const uint8 *&shpSrc, uint32 transOffsetDst, uint32 transOffsetSrc);
+ void scaleShapeProcessLine4Bit(uint8 *&dst, const uint8 *&src);
bool posWithinRect(int posX, int posY, int x1, int y1, int x2, int y2);
- int _dsDiv, _dsRem, _dsScaleTmp;
+ void generateEGADitheringTable(const Palette &pal);
+ void generateCGADitheringTables(const uint8 *mappingData);
+
+ int _dsDiv, _dsRem, _dsScaleTrans;
+ uint8 *_cgaScaleTable;
int16 _gfxX, _gfxY;
uint8 _gfxCol;
const uint8 *_gfxMaxY;
@@ -87,9 +107,18 @@ private:
uint16 _shapeFadeInternal;
uint8 *_fadeData;
int _fadeDataIndex;
+ uint8 _shapeOverlay[16];
uint8 *_dsTempPage;
+ uint16 *_cgaDitheringTables[2];
+ const uint8 *_cgaMappingDefault;
+
+ uint8 *_egaDitheringTable;
+ uint8 *_egaPixelValueTable;
+ bool _useHiResEGADithering;
+
+ static const uint8 _egaMatchTable[];
static const ScreenDim _screenDimTable[];
static const int _screenDimTableCount;
};
diff --git a/engines/kyra/script.cpp b/engines/kyra/script.cpp
index 1981341063..303cbb45aa 100644
--- a/engines/kyra/script.cpp
+++ b/engines/kyra/script.cpp
@@ -95,7 +95,7 @@ bool EMCInterpreter::callback(Common::IFFChunk &chunk) {
return false;
}
-bool EMCInterpreter::load(const char *filename, EMCData *scriptData, const Common::Array<const Opcode*> *opcodes) {
+bool EMCInterpreter::load(const char *filename, EMCData *scriptData, const Common::Array<const Opcode *> *opcodes) {
Common::SeekableReadStream *stream = _vm->resource()->createReadStream(filename);
if (!stream) {
error("Couldn't open script file '%s'", filename);
diff --git a/engines/kyra/script.h b/engines/kyra/script.h
index dffb4e27f5..ccbe733e4d 100644
--- a/engines/kyra/script.h
+++ b/engines/kyra/script.h
@@ -41,7 +41,7 @@ struct EMCData {
uint16 *ordr;
uint16 dataSize;
- const Common::Array<const Opcode*> *sysFuncs;
+ const Common::Array<const Opcode *> *sysFuncs;
};
struct EMCState {
@@ -109,7 +109,7 @@ class EMCInterpreter {
public:
EMCInterpreter(KyraEngine_v1 *vm);
- bool load(const char *filename, EMCData *data, const Common::Array<const Opcode*> *opcodes);
+ bool load(const char *filename, EMCData *data, const Common::Array<const Opcode *> *opcodes);
void unload(EMCData *data);
void init(EMCState *scriptState, const EMCData *data);
diff --git a/engines/kyra/script_eob.cpp b/engines/kyra/script_eob.cpp
index 267966dde2..c07c41f706 100644
--- a/engines/kyra/script_eob.cpp
+++ b/engines/kyra/script_eob.cpp
@@ -214,10 +214,11 @@ bool EoBInfProcessor::preventRest() const {
return _preventRest ? true : false;
}
-void EoBInfProcessor::loadState(Common::SeekableSubReadStreamEndian &in) {
- _preventRest = in.readByte();
- for (int i = 0; i < 18; i++)
- _flagTable[i] = in.readUint32BE();
+void EoBInfProcessor::loadState(Common::SeekableSubReadStreamEndian &in, bool origFile) {
+ _preventRest = (_vm->game() == GI_EOB1 && origFile) ? 0 : in.readByte();
+ int numFlags = (_vm->game() == GI_EOB1 && origFile) ? 13 : 18;
+ for (int i = 0; i < numFlags; i++)
+ _flagTable[i] = in.readUint32();
}
void EoBInfProcessor::saveState(Common::OutSaveFile *out) {
@@ -226,6 +227,11 @@ void EoBInfProcessor::saveState(Common::OutSaveFile *out) {
out->writeUint32BE(_flagTable[i]);
}
+void EoBInfProcessor::reset() {
+ _preventRest = 0;
+ memset(_flagTable, 0, 18 * sizeof(uint32));
+}
+
const char *EoBInfProcessor::getString(uint16 index) {
if (index == 0xffff)
return 0;
diff --git a/engines/kyra/script_eob.h b/engines/kyra/script_eob.h
index 66323d6846..fc8b4cfc31 100644
--- a/engines/kyra/script_eob.h
+++ b/engines/kyra/script_eob.h
@@ -47,8 +47,9 @@ public:
bool checkFlags(uint32 flags) const;
bool preventRest() const;
- void loadState(Common::SeekableSubReadStreamEndian &in);
+ void loadState(Common::SeekableSubReadStreamEndian &in, bool origFile = false);
void saveState(Common::OutSaveFile *out);
+ void reset();
private:
const char *getString(uint16 index);
@@ -98,7 +99,7 @@ private:
InfProc *proc;
Common::String desc;
};
- Common::Array<const InfOpcode*> _opcodes;
+ Common::Array<const InfOpcode *> _opcodes;
int8 *_scriptData;
uint16 _scriptSize;
diff --git a/engines/kyra/script_hof.cpp b/engines/kyra/script_hof.cpp
index 73b6915c89..b80b8105a1 100644
--- a/engines/kyra/script_hof.cpp
+++ b/engines/kyra/script_hof.cpp
@@ -1480,7 +1480,7 @@ typedef Common::Functor2Mem<const TIM *, const uint16 *, int, KyraEngine_HoF> TI
#define OpcodeTimUnImpl() _timOpcodes.push_back(new TIMOpcodeV2(this, 0))
void KyraEngine_HoF::setupOpcodeTable() {
- Common::Array<const Opcode*> *table = 0;
+ Common::Array<const Opcode *> *table = 0;
_opcodes.reserve(176);
SetOpcodeTable(_opcodes);
diff --git a/engines/kyra/script_lok.cpp b/engines/kyra/script_lok.cpp
index 135925afd9..8342bccab6 100644
--- a/engines/kyra/script_lok.cpp
+++ b/engines/kyra/script_lok.cpp
@@ -720,14 +720,19 @@ int KyraEngine_LoK::o1_displayWSASequentialFrames(EMCState *script) {
if (maxTime - 1 <= 0)
maxTime = 1;
- // Workaround for bug #1498221 "KYRA1: Glitches when meeting Zanthia"
- // the original didn't do a forced screen update after displaying a wsa frame
- // while we have to do it, which make brandon disappear for a short moment,
- // what shouldn't happen. So we're not updating the screen for this special
- // case too.
- if (startFrame == 18 && endFrame == 18 && _currentRoom == 45) {
+ // WORKAROUND for bug #1498221 "KYRA1: Glitches when meeting Zanthia".
+ // The original did not do a forced screen update after displaying a WSA
+ // frame while we have to do it, which makes Brandon disappear for a short
+ // moment. That is not supposed to happen. So we're not updating the
+ // screen for this special case.
+ // This is only an issue for the CD version, but since the floppy version
+ // does not use the specified paramaeters like these, it is safe to enable
+ // it for all versions.
+ if (startFrame == 18 && endFrame == 18 && waitTime == 10 && wsaIndex == 0 && _currentRoom == 45) {
_movieObjects[wsaIndex]->displayFrame(18, 0, xpos, ypos, 0, 0, 0);
- delay(waitTime * _tickLength);
+ // We call delayMillis manually here to avoid the screen getting
+ // updated.
+ _system->delayMillis(waitTime * _tickLength);
return 0;
}
diff --git a/engines/kyra/script_mr.cpp b/engines/kyra/script_mr.cpp
index 56b2a48b89..afe11aba02 100644
--- a/engines/kyra/script_mr.cpp
+++ b/engines/kyra/script_mr.cpp
@@ -1129,7 +1129,7 @@ typedef Common::Functor1Mem<EMCState *, int, KyraEngine_MR> OpcodeV3;
#define Opcode(x) table->push_back(new OpcodeV3(this, &KyraEngine_MR::x))
#define OpcodeUnImpl() table->push_back(new OpcodeV3(this, 0))
void KyraEngine_MR::setupOpcodeTable() {
- Common::Array<const Opcode*> *table = 0;
+ Common::Array<const Opcode *> *table = 0;
_opcodes.reserve(176);
SetOpcodeTable(_opcodes);
diff --git a/engines/kyra/script_tim.cpp b/engines/kyra/script_tim.cpp
index 7995ad21f1..177d7993a0 100644
--- a/engines/kyra/script_tim.cpp
+++ b/engines/kyra/script_tim.cpp
@@ -135,7 +135,7 @@ bool TIMInterpreter::callback(Common::IFFChunk &chunk) {
return false;
}
-TIM *TIMInterpreter::load(const char *filename, const Common::Array<const TIMOpcode*> *opcodes) {
+TIM *TIMInterpreter::load(const char *filename, const Common::Array<const TIMOpcode *> *opcodes) {
if (!_vm->resource()->exists(filename))
return 0;
diff --git a/engines/kyra/script_tim.h b/engines/kyra/script_tim.h
index e132ed78c5..aa512daae8 100644
--- a/engines/kyra/script_tim.h
+++ b/engines/kyra/script_tim.h
@@ -146,7 +146,7 @@ struct TIM {
uint16 *avtl;
uint8 *text;
- const Common::Array<const TIMOpcode*> *opcodes;
+ const Common::Array<const TIMOpcode *> *opcodes;
// TODO: Get rid of this ugly HACK to allow the
// Lands of Lore outro to be working properly.
@@ -159,7 +159,7 @@ public:
TIMInterpreter(KyraEngine_v1 *engine, Screen_v2 *screen_v2, OSystem *system);
virtual ~TIMInterpreter();
- TIM *load(const char *filename, const Common::Array<const TIMOpcode*> *opcodes);
+ TIM *load(const char *filename, const Common::Array<const TIMOpcode *> *opcodes);
void unload(TIM *&tim) const;
bool callback(Common::IFFChunk &chunk);
diff --git a/engines/kyra/sequences_darkmoon.cpp b/engines/kyra/sequences_darkmoon.cpp
index 516c71e626..d4f5c847fd 100644
--- a/engines/kyra/sequences_darkmoon.cpp
+++ b/engines/kyra/sequences_darkmoon.cpp
@@ -41,11 +41,22 @@ public:
kFinale
};
- DarkmoonSequenceHelper(OSystem *system, DarkMoonEngine *vm, Screen_EoB *screen, Mode mode, const char *const *strings, const char *const *cpsFiles, const char *const *palFiles, const EoBShapeDef **shapeDefList, const EoBSequenceStep **seqList);
+ struct Config {
+ Config(Mode m, const char *const *str, const char *const *cps, const char *const *pal, const DarkMoonShapeDef **shp, const DarkMoonAnimCommand **anim, bool paletteFading) : mode(m), strings(str), cpsFiles(cps), palFiles(pal), shapeDefs(shp), animData(anim), palFading(paletteFading) {}
+ Mode mode;
+ const char *const *strings;
+ const char *const *cpsFiles;
+ const char *const *palFiles;
+ const DarkMoonShapeDef **shapeDefs;
+ const DarkMoonAnimCommand **animData;
+ bool palFading;
+ };
+
+ DarkmoonSequenceHelper(OSystem *system, DarkMoonEngine *vm, Screen_EoB *screen, const Config *config);
~DarkmoonSequenceHelper();
void loadScene(int index, int pageNum);
- void runSequence(int index, int del = -1);
+ void animCommand(int index, int del = -1);
void printText(int index, int color);
void fadeText();
@@ -68,13 +79,7 @@ private:
OSystem *_system;
DarkMoonEngine *_vm;
Screen_EoB *_screen;
- Mode _mode;
-
- const char *const *_strings;
- const char *const *_cpsFiles;
- const char *const *_palFiles;
- const EoBShapeDef **_shapeDefs;
- const EoBSequenceStep **_seqData;
+ const Config *_config;
Palette *_palettes[12];
@@ -103,10 +108,14 @@ int DarkMoonEngine::mainMenu() {
_screen->loadFileDataToPage(s, 3, 64000);
delete s;
} else {
- _screen->loadBitmap("MENU.CPS", 3, 2, &_screen->getPalette(0));
+ _screen->loadBitmap("MENU.CPS", 3, 3, &_screen->getPalette(0));
}
+ if (_configRenderMode == Common::kRenderEGA)
+ _screen->loadPalette("MENU.EGA", _screen->getPalette(0));
+
_screen->setScreenPalette(_screen->getPalette(0));
+ _screen->convertPage(3, 2, 0);
of = _screen->setFont(Screen::FID_6_FNT);
op = _screen->setCurPage(2);
@@ -116,7 +125,9 @@ int DarkMoonEngine::mainMenu() {
_screen->_curPage = op;
_screen->copyRegion(0, 0, 0, 0, 320, 200, 2, 0, Screen::CR_NO_P_CHECK);
_screen->updateScreen();
+ _allowImport = true;
menuChoice = mainMenuLoop();
+ _allowImport = false;
} break;
case 1:
@@ -165,7 +176,8 @@ int DarkMoonEngine::mainMenuLoop() {
}
void DarkMoonEngine::seq_playIntro() {
- DarkmoonSequenceHelper sq(_system, this, _screen, DarkmoonSequenceHelper::kIntro, _introStrings, _cpsFilesIntro, _palFilesIntro, _shapesIntro, _seqIntro);
+ DarkmoonSequenceHelper::Config config(DarkmoonSequenceHelper::kIntro, _introStrings, _cpsFilesIntro, _configRenderMode == Common::kRenderEGA ? _palFilesIntroEGA : _palFilesIntroVGA, _shapesIntro, _animIntro, false);
+ DarkmoonSequenceHelper sq(_system, this, _screen, &config);
_screen->setCurPage(0);
_screen->clearCurPage();
@@ -190,24 +202,24 @@ void DarkMoonEngine::seq_playIntro() {
removeInputTop();
sq.delay(18);
- sq.runSequence(3, 18);
- sq.runSequence(6, 18);
- sq.runSequence(0);
+ sq.animCommand(3, 18);
+ sq.animCommand(6, 18);
+ sq.animCommand(0);
sq.waitForSongNotifier(1);
- sq.runSequence(11);
- sq.runSequence(7, 6);
- sq.runSequence(2, 6);
+ sq.animCommand(_configRenderMode == Common::kRenderEGA ? 12 : 11);
+ sq.animCommand(7, 6);
+ sq.animCommand(2, 6);
sq.waitForSongNotifier(2);
- sq.runSequence(38);
- sq.runSequence(3);
- sq.runSequence(8);
- sq.runSequence(1, 10);
- sq.runSequence(0, 6);
- sq.runSequence(2);
+ sq.animCommand(_configRenderMode == Common::kRenderEGA ? 39 : 38);
+ sq.animCommand(3);
+ sq.animCommand(8);
+ sq.animCommand(1, 10);
+ sq.animCommand(0, 6);
+ sq.animCommand(2);
sq.waitForSongNotifier(3);
@@ -216,22 +228,22 @@ void DarkMoonEngine::seq_playIntro() {
_screen->setClearScreenDim(17);
_screen->setCurPage(0);
- sq.runSequence(40);
- sq.runSequence(7, 18);
+ sq.animCommand(_configRenderMode == Common::kRenderEGA ? 41 : 40);
+ sq.animCommand(7, 18);
sq.printText(0, 16); // You were settling...
- sq.runSequence(7, 90);
+ sq.animCommand(7, 90);
sq.fadeText();
sq.printText(1, 16); // Then a note was slipped to you
- sq.runSequence(8);
- sq.runSequence(2, 72);
+ sq.animCommand(8);
+ sq.animCommand(2, 72);
sq.fadeText();
sq.printText(2, 16); // It was from your friend Khelben Blackstaff...
- sq.runSequence(2);
- sq.runSequence(6, 36);
- sq.runSequence(3);
+ sq.animCommand(2);
+ sq.animCommand(6, 36);
+ sq.animCommand(3);
sq.fadeText();
sq.printText(3, 16); // The message was urgent.
@@ -241,19 +253,33 @@ void DarkMoonEngine::seq_playIntro() {
// intro scroll
if (!skipFlag() && !shouldQuit()) {
- for (int i = 0; i < 280; i += 3) {
- uint32 endtime = _system->getMillis() + _tickLength;
- _screen->copyRegion(11, 8, 8, 8, 301, 128, 0, 0, Screen::CR_NO_P_CHECK);
- _screen->copyRegion(i, 0, 309, 8, 3, 128, 2, 0, Screen::CR_NO_P_CHECK);
- _screen->updateScreen();
- if (i == 96)
- sq.runSequence(42);
- delayUntil(endtime);
+ if (_configRenderMode == Common::kRenderEGA) {
+ for (int i = 0; i < 35; i++) {
+ uint32 endtime = _system->getMillis() + 2 * _tickLength;
+ _screen->copyRegion(16, 8, 8, 8, 296, 128, 0, 0, Screen::CR_NO_P_CHECK);
+ _screen->copyRegion(i << 3, 0, 304, 8, 8, 128, 2, 0, Screen::CR_NO_P_CHECK);
+ _screen->updateScreen();
+ if (i == 12)
+ sq.animCommand(42);
+ else if (i == 25)
+ snd_playSoundEffect(11);
+ delayUntil(endtime);
+ }
+ } else {
+ for (int i = 0; i < 280; i += 3) {
+ uint32 endtime = _system->getMillis() + _tickLength;
+ _screen->copyRegion(11, 8, 8, 8, 301, 128, 0, 0, Screen::CR_NO_P_CHECK);
+ _screen->copyRegion(i, 0, 309, 8, 3, 128, 2, 0, Screen::CR_NO_P_CHECK);
+ _screen->updateScreen();
+ if (i == 96)
+ sq.animCommand(42);
+ delayUntil(endtime);
+ }
}
}
_screen->copyRegion(8, 8, 0, 0, 304, 128, 0, 2, Screen::CR_NO_P_CHECK);
- sq.runSequence(4);
+ sq.animCommand(4);
sq.fadeText();
sq.delay(10);
@@ -266,22 +292,22 @@ void DarkMoonEngine::seq_playIntro() {
sq.loadScene(3, 2);
sq.delay(54);
- sq.runSequence(13);
+ sq.animCommand(13);
_screen->copyRegion(104, 16, 96, 8, 120, 100, 0, 2, Screen::CR_NO_P_CHECK);
sq.fadeText();
sq.printText(5, 15); // Welcome, please come in
- sq.runSequence(10);
- sq.runSequence(10);
- sq.runSequence(9);
- sq.runSequence(9);
+ sq.animCommand(10);
+ sq.animCommand(10);
+ sq.animCommand(9);
+ sq.animCommand(9);
sq.fadeText();
sq.printText(6, 15); // Khelben awaits you in his study
for (int i = 0; i < 3; i++)
- sq.runSequence(10);
- sq.runSequence(9);
- sq.runSequence(14);
+ sq.animCommand(10);
+ sq.animCommand(9);
+ sq.animCommand(14);
sq.loadScene(5, 2);
sq.waitForSongNotifier(5);
@@ -291,45 +317,50 @@ void DarkMoonEngine::seq_playIntro() {
_screen->updateScreen();
for (int i = 0; i < 6; i++)
- sq.runSequence(15);
+ sq.animCommand(15);
+
+ if (_configRenderMode == Common::kRenderEGA && !skipFlag() && !shouldQuit()) {
+ _screen->loadPalette("INTRO.EGA", _screen->getPalette(0));
+ _screen->setScreenPalette(_screen->getPalette(0));
+ }
sq.loadScene(6, 2);
sq.loadScene(7, 2);
_screen->clearCurPage();
sq.update(2);
- sq.runSequence(16);
+ sq.animCommand(16);
sq.printText(7, 15); // Thank you for coming so quickly
- sq.runSequence(16);
- sq.runSequence(17);
+ sq.animCommand(16);
+ sq.animCommand(17);
for (int i = 0; i < 3; i++)
- sq.runSequence(16);
+ sq.animCommand(16);
sq.fadeText();
- sq.runSequence(16);
+ sq.animCommand(16);
sq.loadScene(8, 2);
sq.update(2);
- sq.runSequence(32);
+ sq.animCommand(32);
sq.printText(8, 15); // I am troubled my friend
- sq.runSequence(33);
- sq.runSequence(33);
+ sq.animCommand(33);
+ sq.animCommand(33);
for (int i = 0; i < 4; i++)
- sq.runSequence(32);
+ sq.animCommand(32);
sq.fadeText();
sq.printText(9, 15); // Ancient evil stirs in the Temple Darkmoon
- sq.runSequence(33);
- sq.runSequence(43);
- sq.runSequence(33);
+ sq.animCommand(33);
+ sq.animCommand(43);
+ sq.animCommand(33);
for (int i = 0; i < 3; i++)
- sq.runSequence(32);
+ sq.animCommand(32);
sq.fadeText();
sq.printText(10, 15); // I fear for the safety of our city
for (int i = 0; i < 4; i++)
- sq.runSequence(33);
- sq.runSequence(32);
- sq.runSequence(32);
+ sq.animCommand(33);
+ sq.animCommand(32);
+ sq.animCommand(32);
sq.loadScene(9, 2);
sq.fadeText();
@@ -337,67 +368,67 @@ void DarkMoonEngine::seq_playIntro() {
sq.waitForSongNotifier(6);
sq.update(2);
- sq.runSequence(34);
+ sq.animCommand(34);
sq.printText(11, 15); // I need your help
for (int i = 0; i < 3; i++)
- sq.runSequence(34);
- sq.runSequence(35);
+ sq.animCommand(34);
+ sq.animCommand(35);
for (int i = 0; i < 4; i++)
- sq.runSequence(34);
+ sq.animCommand(34);
sq.fadeText();
sq.loadScene(12, 2);
sq.update(2);
sq.loadScene(6, 2);
- sq.runSequence(18);
+ sq.animCommand(18);
sq.printText(12, 15); // Three nights ago I sent forth a scout
- sq.runSequence(19);
- sq.runSequence(20);
- sq.runSequence(22);
- sq.runSequence(19);
- sq.runSequence(20);
- sq.runSequence(18);
+ sq.animCommand(19);
+ sq.animCommand(20);
+ sq.animCommand(22);
+ sq.animCommand(19);
+ sq.animCommand(20);
+ sq.animCommand(18);
sq.fadeText();
sq.printText(13, 15); // She has not yet returned
- sq.runSequence(20);
- sq.runSequence(19);
- sq.runSequence(23);
- sq.runSequence(24);
- sq.runSequence(20);
- sq.runSequence(19);
- sq.runSequence(17);
- sq.runSequence(18);
+ sq.animCommand(20);
+ sq.animCommand(19);
+ sq.animCommand(23);
+ sq.animCommand(24);
+ sq.animCommand(20);
+ sq.animCommand(19);
+ sq.animCommand(17);
+ sq.animCommand(18);
sq.fadeText();
sq.printText(14, 15); // I fear for her safety
- sq.runSequence(19);
- sq.runSequence(20);
- sq.runSequence(20);
- sq.runSequence(18);
- sq.runSequence(25);
- sq.runSequence(18);
- sq.runSequence(18);
+ sq.animCommand(19);
+ sq.animCommand(20);
+ sq.animCommand(20);
+ sq.animCommand(18);
+ sq.animCommand(25);
+ sq.animCommand(18);
+ sq.animCommand(18);
sq.fadeText();
- sq.runSequence(18);
- sq.runSequence(18);
+ sq.animCommand(18);
+ sq.animCommand(18);
sq.printText(15, 15); // Take this coin
- sq.runSequence(28);
- sq.runSequence(19);
- sq.runSequence(20);
- sq.runSequence(18);
- sq.runSequence(18);
+ sq.animCommand(28);
+ sq.animCommand(19);
+ sq.animCommand(20);
+ sq.animCommand(18);
+ sq.animCommand(18);
sq.fadeText();
sq.loadScene(10, 2);
_screen->clearCurPage();
_screen->updateScreen();
- sq.runSequence(37, 18);
- sq.runSequence(36, 36);
+ sq.animCommand(37, 18);
+ sq.animCommand(36, 36);
sq.loadScene(12, 2);
_screen->clearCurPage();
@@ -405,44 +436,44 @@ void DarkMoonEngine::seq_playIntro() {
sq.loadScene(11, 2);
sq.printText(16, 15); // I will use it to contact you
- sq.runSequence(19);
- sq.runSequence(20);
- sq.runSequence(20);
- sq.runSequence(18);
- sq.runSequence(18);
+ sq.animCommand(19);
+ sq.animCommand(20);
+ sq.animCommand(20);
+ sq.animCommand(18);
+ sq.animCommand(18);
sq.fadeText();
sq.printText(17, 15); // You must act quickly
- sq.runSequence(19);
- sq.runSequence(20);
- sq.runSequence(19);
- sq.runSequence(18);
- sq.runSequence(18);
+ sq.animCommand(19);
+ sq.animCommand(20);
+ sq.animCommand(19);
+ sq.animCommand(18);
+ sq.animCommand(18);
sq.fadeText();
- sq.runSequence(18);
+ sq.animCommand(18);
sq.printText(18, 15); // I will teleport you near Darkmoon
- sq.runSequence(20);
- sq.runSequence(27);
- sq.runSequence(20);
- sq.runSequence(19);
- sq.runSequence(18);
- sq.runSequence(18);
+ sq.animCommand(20);
+ sq.animCommand(27);
+ sq.animCommand(20);
+ sq.animCommand(19);
+ sq.animCommand(18);
+ sq.animCommand(18);
sq.fadeText();
- sq.runSequence(18);
+ sq.animCommand(18);
sq.printText(19, 15); // May luck be with you my friend
- sq.runSequence(19);
- sq.runSequence(19);
- sq.runSequence(20);
- sq.runSequence(18);
+ sq.animCommand(19);
+ sq.animCommand(19);
+ sq.animCommand(20);
+ sq.animCommand(18);
sq.fadeText();
- sq.runSequence(29);
+ sq.animCommand(29);
sq.waitForSongNotifier(7);
- sq.runSequence(30);
- sq.runSequence(31);
+ sq.animCommand(30);
+ sq.animCommand(31);
sq.waitForSongNotifier(8, true);
@@ -452,17 +483,21 @@ void DarkMoonEngine::seq_playIntro() {
_screen->setScreenDim(17);
_screen->clearCurDim();
snd_playSoundEffect(14);
- sq.fadePalette(10, 1);
+
+ if (_configRenderMode != Common::kRenderEGA)
+ sq.fadePalette(10, 1);
_screen->setClearScreenDim(18);
sq.delay(6);
- sq.fadePalette(9, 1);
+ if (_configRenderMode != Common::kRenderEGA)
+ sq.fadePalette(9, 1);
_screen->clearCurPage();
}
sq.fadePalette(9, 10);
}
void DarkMoonEngine::seq_playFinale() {
- DarkmoonSequenceHelper sq(_system, this, _screen, DarkmoonSequenceHelper::kFinale, _finaleStrings, _cpsFilesFinale, _palFilesFinale, _shapesFinale, _seqFinale);
+ DarkmoonSequenceHelper::Config config(DarkmoonSequenceHelper::kFinale, _finaleStrings, _cpsFilesFinale, _configRenderMode == Common::kRenderEGA ? _palFilesFinaleEGA : _palFilesFinaleVGA, _shapesFinale, _animFinale, true);
+ DarkmoonSequenceHelper sq(_system, this, _screen, &config);
_screen->setCurPage(0);
_screen->setFont(Screen::FID_8_FNT);
@@ -483,76 +518,76 @@ void DarkMoonEngine::seq_playFinale() {
sq.loadScene(1, 2);
- sq.runSequence(0);
- sq.runSequence(0);
+ sq.animCommand(0);
+ sq.animCommand(0);
for (int i = 0; i < 3; i++)
- sq.runSequence(2);
- sq.runSequence(1);
- sq.runSequence(2);
- sq.runSequence(2);
+ sq.animCommand(2);
+ sq.animCommand(1);
+ sq.animCommand(2);
+ sq.animCommand(2);
sq.printText(0, 10); // Finally, Dran has been defeated
for (int i = 0; i < 7; i++)
- sq.runSequence(2);
+ sq.animCommand(2);
sq.fadeText();
- sq.runSequence(2);
+ sq.animCommand(2);
sq.waitForSongNotifier(1);
sq.printText(1, 10); // Suddenly, your friend Khelben appears
- sq.runSequence(4);
+ sq.animCommand(4);
for (int i = 0; i < 3; i++)
- sq.runSequence(2);
+ sq.animCommand(2);
sq.fadeText();
sq.printText(2, 15); // Greetings, my victorious friends
for (int i = 0; i < 4; i++)
- sq.runSequence(5);
- sq.runSequence(2);
- sq.runSequence(2);
+ sq.animCommand(5);
+ sq.animCommand(2);
+ sq.animCommand(2);
sq.fadeText();
- sq.runSequence(6);
+ sq.animCommand(6);
sq.printText(3, 15); // You have defeated Dran
for (int i = 0; i < 5; i++)
- sq.runSequence(5);
- sq.runSequence(2);
- sq.runSequence(2);
+ sq.animCommand(5);
+ sq.animCommand(2);
+ sq.animCommand(2);
sq.fadeText();
sq.printText(4, 15); // I did not know Dran was a dragon
for (int i = 0; i < 4; i++)
- sq.runSequence(5);
- sq.runSequence(2);
- sq.runSequence(2);
+ sq.animCommand(5);
+ sq.animCommand(2);
+ sq.animCommand(2);
sq.fadeText();
sq.printText(5, 15); // He must have been over 300 years old
for (int i = 0; i < 4; i++)
- sq.runSequence(5);
- sq.runSequence(2);
- sq.runSequence(2);
+ sq.animCommand(5);
+ sq.animCommand(2);
+ sq.animCommand(2);
sq.fadeText();
sq.printText(6, 15); // His power is gone
for (int i = 0; i < 3; i++)
- sq.runSequence(5);
- sq.runSequence(2);
- sq.runSequence(2);
+ sq.animCommand(5);
+ sq.animCommand(2);
+ sq.animCommand(2);
sq.fadeText();
sq.printText(7, 15); // But Darkmoon is still a source of great evil
for (int i = 0; i < 4; i++)
- sq.runSequence(5);
- sq.runSequence(2);
- sq.runSequence(2);
+ sq.animCommand(5);
+ sq.animCommand(2);
+ sq.animCommand(2);
sq.fadeText();
sq.printText(8, 15); // And many of his minions remain
for (int i = 0; i < 4; i++)
- sq.runSequence(5);
- sq.runSequence(2);
- sq.runSequence(2);
+ sq.animCommand(5);
+ sq.animCommand(2);
+ sq.animCommand(2);
sq.fadeText();
sq.loadScene(2, 2);
@@ -561,29 +596,32 @@ void DarkMoonEngine::seq_playFinale() {
_screen->copyRegion(8, 8, 0, 0, 304, 128, 0, 2, Screen::CR_NO_P_CHECK);
sq.printText(9, 15); // Now we must leave this place
- sq.runSequence(7);
- sq.runSequence(8);
- sq.runSequence(7);
- sq.runSequence(7, 36);
+ sq.animCommand(7);
+ sq.animCommand(8);
+ sq.animCommand(7);
+ sq.animCommand(7, 36);
sq.fadeText();
sq.printText(10, 15); // So my forces can destroy it..
for (int i = 0; i < 3; i++)
- sq.runSequence(7);
- sq.runSequence(8);
- sq.runSequence(7);
- sq.runSequence(7, 36);
- sq.runSequence(8, 18);
+ sq.animCommand(7);
+ sq.animCommand(8);
+ sq.animCommand(7);
+ sq.animCommand(7, 36);
+ sq.animCommand(8, 18);
sq.fadeText();
sq.printText(11, 15); // Follow me
- sq.runSequence(7, 18);
- sq.runSequence(9, 18);
- sq.runSequence(8, 18);
+ sq.animCommand(7, 18);
+ sq.animCommand(9, 18);
+ sq.animCommand(8, 18);
sq.fadeText();
sq.loadScene(7, 2);
- sq.copyPalette(3, 0);
+
+ if (_configRenderMode != Common::kRenderEGA)
+ sq.copyPalette(3, 0);
+
sq.loadScene(4, 2);
sq.waitForSongNotifier(2);
@@ -605,23 +643,23 @@ void DarkMoonEngine::seq_playFinale() {
snd_playSoundEffect(7);
sq.delay(8);
- sq.runSequence(10);
- sq.runSequence(13);
+ sq.animCommand(10);
+ sq.animCommand(13);
sq.initDelayedPaletteFade(4, 1);
- sq.runSequence(14);
- sq.runSequence(13);
- sq.runSequence(14);
- sq.runSequence(14);
- sq.runSequence(13);
+ sq.animCommand(14);
+ sq.animCommand(13);
+ sq.animCommand(14);
+ sq.animCommand(14);
+ sq.animCommand(13);
sq.initDelayedPaletteFade(2, 1);
- sq.runSequence(15);
- sq.runSequence(14);
- sq.runSequence(13);
- sq.runSequence(15);
- sq.runSequence(15);
- sq.runSequence(11);
+ sq.animCommand(15);
+ sq.animCommand(14);
+ sq.animCommand(13);
+ sq.animCommand(15);
+ sq.animCommand(15);
+ sq.animCommand(11);
sq.printText(13, 10); // The temple's evil is very strong
sq.delay(72);
@@ -637,22 +675,22 @@ void DarkMoonEngine::seq_playFinale() {
snd_playSoundEffect(7);
sq.delay(8);
- sq.runSequence(10);
+ sq.animCommand(10);
sq.initDelayedPaletteFade(5, 1);
- sq.runSequence(13);
- sq.runSequence(14);
- sq.runSequence(13);
- sq.runSequence(14);
- sq.runSequence(13);
- sq.runSequence(13);
- sq.runSequence(14);
- sq.runSequence(14);
- sq.runSequence(13);
- sq.runSequence(12);
+ sq.animCommand(13);
+ sq.animCommand(14);
+ sq.animCommand(13);
+ sq.animCommand(14);
+ sq.animCommand(13);
+ sq.animCommand(13);
+ sq.animCommand(14);
+ sq.animCommand(14);
+ sq.animCommand(13);
+ sq.animCommand(12);
for (int i = 0; i < 4; i++)
- sq.runSequence(16);
- sq.runSequence(17);
- sq.runSequence(18);
+ sq.animCommand(16);
+ sq.animCommand(17);
+ sq.animCommand(18);
sq.printText(15, 10); // The temple ceases to exist
sq.initDelayedPaletteFade(6, 1);
@@ -670,40 +708,43 @@ void DarkMoonEngine::seq_playFinale() {
if (!skipFlag() && !shouldQuit())
snd_playSoundEffect(6);
- if (!skipFlag() && !shouldQuit())
+ if (!skipFlag() && !shouldQuit()) {
+ if (_configRenderMode != Common::kRenderEGA)
+ sq.setPaletteWithoutTextColor(0);
_screen->crossFadeRegion(0, 0, 8, 8, 304, 128, 2, 0);
+ }
sq.delay(18);
sq.printText(16, 15); // My friends, our work is done
- sq.runSequence(20);
- sq.runSequence(19);
- sq.runSequence(19, 36);
+ sq.animCommand(20);
+ sq.animCommand(19);
+ sq.animCommand(19, 36);
if (!skipFlag() && !shouldQuit())
snd_playSoundEffect(12);
sq.fadeText();
sq.printText(17, 15); // Thank you
- sq.runSequence(19);
- sq.runSequence(20, 36);
+ sq.animCommand(19);
+ sq.animCommand(20, 36);
sq.fadeText();
sq.printText(18, 15); // You have earned my deepest respect
if (!skipFlag() && !shouldQuit())
snd_playSoundEffect(11);
- sq.runSequence(20);
- sq.runSequence(19);
- sq.runSequence(19);
+ sq.animCommand(20);
+ sq.animCommand(19);
+ sq.animCommand(19);
if (!skipFlag() && !shouldQuit())
snd_playSoundEffect(11);
sq.delay(36);
sq.fadeText();
sq.printText(19, 15); // We will remember you always
- sq.runSequence(19);
- sq.runSequence(19, 18);
+ sq.animCommand(19);
+ sq.animCommand(19, 18);
if (!skipFlag() && !shouldQuit())
snd_playSoundEffect(11);
- sq.runSequence(20, 18);
+ sq.animCommand(20, 18);
sq.fadeText();
sq.delay(28);
@@ -716,6 +757,8 @@ void DarkMoonEngine::seq_playFinale() {
_screen->copyRegion(0, 0, 8, 8, 304, 128, 2, 0, Screen::CR_NO_P_CHECK);
} else {
snd_playSoundEffect(6);
+ if (_configRenderMode != Common::kRenderEGA)
+ sq.setPaletteWithoutTextColor(0);
_screen->crossFadeRegion(0, 0, 8, 8, 304, 128, 2, 0);
}
@@ -754,8 +797,10 @@ void DarkMoonEngine::seq_playFinale() {
resetSkipFlag(true);
- sq.setPalette(11);
- sq.fadePalette(9, 10);
+ if (_configRenderMode != Common::kRenderEGA) {
+ sq.setPalette(11);
+ sq.fadePalette(9, 10);
+ }
_screen->clearCurPage();
sq.loadScene(11, 2);
@@ -910,15 +955,15 @@ void DarkMoonEngine::seq_playCredits(DarkmoonSequenceHelper *sq, const uint8 *da
delete[] items[i].str;
}
-DarkmoonSequenceHelper::DarkmoonSequenceHelper(OSystem *system, DarkMoonEngine *vm, Screen_EoB *screen, Mode mode, const char *const *strings, const char *const *cpsFiles, const char *const *palFiles, const EoBShapeDef **shapeDefList, const EoBSequenceStep **seqList) :
- _system(system), _vm(vm), _screen(screen), _mode(mode), _strings(strings), _cpsFiles(cpsFiles), _palFiles(palFiles), _shapeDefs(shapeDefList), _seqData(seqList) {
+DarkmoonSequenceHelper::DarkmoonSequenceHelper(OSystem *system, DarkMoonEngine *vm, Screen_EoB *screen, const Config *config) :
+ _system(system), _vm(vm), _screen(screen), _config(config) {
- for (int i = 0; _palFiles[i]; i++) {
+ for (int i = 0; _config->palFiles[i]; i++) {
if (i < 4)
_palettes[i] = &_screen->getPalette(i);
else
_palettes[i] = new Palette(256);
- _screen->loadPalette(_palFiles[i], *_palettes[i]);
+ _screen->loadPalette(_config->palFiles[i], *_palettes[i]);
}
_palettes[9] = new Palette(256);
@@ -944,7 +989,7 @@ DarkmoonSequenceHelper::DarkmoonSequenceHelper(OSystem *system, DarkMoonEngine *
}
DarkmoonSequenceHelper::~DarkmoonSequenceHelper() {
- for (int i = 4; _palFiles[i]; i++)
+ for (int i = 4; _config->palFiles[i]; i++)
delete _palettes[i];
delete _palettes[9];
delete _palettes[10];
@@ -965,12 +1010,22 @@ DarkmoonSequenceHelper::~DarkmoonSequenceHelper() {
void DarkmoonSequenceHelper::loadScene(int index, int pageNum) {
char file[13];
- strcpy(file, _cpsFiles[index]);
+ strcpy(file, _config->cpsFiles[index]);
Common::SeekableReadStream *s = _vm->resource()->createReadStream(file);
- if (s && file[0] != 'X') {
+ uint32 chunkID = 0;
+ if (s) {
+ chunkID = s->readUint32LE();
+ s->seek(0);
+ }
+
+ if (s && chunkID == MKTAG('F', 'O', 'R', 'M')) {
+ // The original code also handles files with FORM chunks and ILBM and PBM sub chunks. This will probably be necessary for Amiga versions.
+ // The DOS versions do not need this, but still have the code for it. We error out for now.
+ error("DarkmoonSequenceHelper::loadScene(): CPS file loading failure in scene %d - unhandled FORM chunk encountered", index);
+ } else if (s && file[0] != 'X') {
delete s;
- _screen->loadBitmap(_cpsFiles[index], pageNum | 1, pageNum | 1, _palettes[0]);
+ _screen->loadBitmap(_config->cpsFiles[index], pageNum | 1, pageNum | 1, _palettes[0]);
} else {
if (!s) {
file[0] = 'X';
@@ -980,7 +1035,7 @@ void DarkmoonSequenceHelper::loadScene(int index, int pageNum) {
if (!s)
error("DarkmoonSequenceHelper::loadScene(): CPS file loading failure in scene %d", index);
- if (_mode == kFinale)
+ if (_config->mode == kFinale)
s->read(_palettes[0]->getData(), 768);
else
s->seek(768);
@@ -990,8 +1045,8 @@ void DarkmoonSequenceHelper::loadScene(int index, int pageNum) {
int cp = _screen->setCurPage(pageNum);
- if (_shapeDefs[index]) {
- for (const EoBShapeDef *df = _shapeDefs[index]; df->w; df++) {
+ if (_config->shapeDefs[index]) {
+ for (const DarkMoonShapeDef *df = _config->shapeDefs[index]; df->w; df++) {
uint16 shapeIndex = (df->index < 0) ? df->index * -1 : df->index;
if (_shapes[shapeIndex])
delete[] _shapes[shapeIndex];
@@ -1000,20 +1055,24 @@ void DarkmoonSequenceHelper::loadScene(int index, int pageNum) {
}
_screen->setCurPage(cp);
- _screen->copyPage(pageNum | 1, pageNum);
+
+ if (_vm->_configRenderMode == Common::kRenderEGA)
+ setPalette(0);
+
+ _screen->convertPage(pageNum | 1, pageNum, 0);
if ((pageNum == 0 || pageNum == 1) && !_vm->skipFlag() && !_vm->shouldQuit())
_screen->updateScreen();
}
-void DarkmoonSequenceHelper::runSequence(int index, int del) {
+void DarkmoonSequenceHelper::animCommand(int index, int del) {
if (_vm->skipFlag() || _vm->shouldQuit())
return;
uint32 end = 0;
- for (const EoBSequenceStep *s = _seqData[index]; s->command != 0xff && !_vm->skipFlag() && !_vm->shouldQuit(); s++) {
- int palIndex = _mode == kFinale ? (s->pal + 1) : s->pal;
+ for (const DarkMoonAnimCommand *s = _config->animData[index]; s->command != 0xff && !_vm->skipFlag() && !_vm->shouldQuit(); s++) {
+ int palIndex = _config->mode == kFinale ? (s->pal + 1) : s->pal;
int x = s->x1;
int y = s->y1;
int x2 = 0;
@@ -1023,10 +1082,10 @@ void DarkmoonSequenceHelper::runSequence(int index, int del) {
switch (s->command) {
case 0:
// flash palette
- if (s->pal)
+ if (_vm->_configRenderMode != Common::kRenderEGA && s->pal)
setPaletteWithoutTextColor(palIndex);
delay(s->delay);
- if (_mode == kIntro && s->pal)
+ if (_vm->_configRenderMode != Common::kRenderEGA && _config->mode == kIntro && s->pal)
setPaletteWithoutTextColor(0);
break;
@@ -1035,7 +1094,7 @@ void DarkmoonSequenceHelper::runSequence(int index, int del) {
shapeW = _shapes[s->obj][2];
shapeH = _shapes[s->obj][3];
- if (_mode == kFinale) {
+ if (_config->mode == kFinale) {
_screen->setScreenDim(18);
x -= (_screen->_curDim->sx << 3);
y -= _screen->_curDim->sy;
@@ -1045,17 +1104,17 @@ void DarkmoonSequenceHelper::runSequence(int index, int del) {
x2 = x;
}
- _screen->drawShape(0, _shapes[s->obj], x, y, _mode == kIntro ? 0 : 18);
+ _screen->drawShape(0, _shapes[s->obj], x, y, _config->mode == kIntro ? 0 : 18);
- if (s->pal)
+ if (_vm->_configRenderMode != Common::kRenderEGA && s->pal)
setPaletteWithoutTextColor(palIndex);
else
_screen->updateScreen();
delay(s->delay);
- if (_mode == kIntro) {
- if (s->pal)
+ if (_config->mode == kIntro) {
+ if (_vm->_configRenderMode != Common::kRenderEGA && s->pal)
setPaletteWithoutTextColor(0);
_screen->copyRegion(x - 8, y - 8, x, y, (shapeW + 1) << 3, shapeH, 2, 0, Screen::CR_NO_P_CHECK);
} else {
@@ -1069,50 +1128,59 @@ void DarkmoonSequenceHelper::runSequence(int index, int del) {
// draw shape
_screen->drawShape(_screen->_curPage, _shapes[s->obj], x, y, 0);
- if (s->pal)
+ if (_vm->_configRenderMode != Common::kRenderEGA && s->pal)
setPaletteWithoutTextColor(palIndex);
else if (!_screen->_curPage)
_screen->updateScreen();
delay(s->delay);
- if (_mode == kIntro && s->pal)
+ if (_vm->_configRenderMode != Common::kRenderEGA && _config->mode == kIntro && s->pal)
setPaletteWithoutTextColor(0);
break;
case 3:
case 4:
// fade shape in or out or restore background
- if (_mode == kFinale)
+ if (_config->mode == kFinale)
break;
- _screen->setShapeFadeMode(0, true);
- _screen->setShapeFadeMode(1, true);
+ if (_vm->_configRenderMode == Common::kRenderEGA) {
+ if (palIndex)
+ _screen->drawShape(0, _shapes[s->obj], s->x1, y, 0);
+ else
+ _screen->copyRegion(s->x1 - 8, s->y1 - 8, s->x1, s->y1, (_shapes[s->obj][2] + 1) << 3, _shapes[s->obj][3], 2, 0, Screen::CR_NO_P_CHECK);
+ _screen->updateScreen();
+ delay(s->delay /** 7*/);
+ } else {
+ _screen->setShapeFadeMode(0, true);
+ _screen->setShapeFadeMode(1, true);
- end = _system->getMillis() + s->delay * _vm->tickLength();
+ end = _system->getMillis() + s->delay * _vm->tickLength();
- if (palIndex) {
- _screen->setFadeTableIndex(palIndex - 1);
+ if (palIndex) {
+ _screen->setFadeTableIndex(palIndex - 1);
- _screen->copyRegion(s->x1 - 8, s->y1 - 8, 0, 0, (_shapes[s->obj][2] + 1) << 3, _shapes[s->obj][3], 2, 4, Screen::CR_NO_P_CHECK);
- _screen->drawShape(4, _shapes[s->obj], s->x1 & 7, 0, 0);
- _screen->copyRegion(0, 0, s->x1, s->y1, (_shapes[s->obj][2] + 1) << 3, _shapes[s->obj][3], 4, 0, Screen::CR_NO_P_CHECK);
- } else {
- _screen->copyRegion(s->x1 - 8, s->y1 - 8, s->x1, s->y1, (_shapes[s->obj][2] + 1) << 3, _shapes[s->obj][3], 2, 0, Screen::CR_NO_P_CHECK);
- }
- _screen->updateScreen();
+ _screen->copyRegion(s->x1 - 8, s->y1 - 8, 0, 0, (_shapes[s->obj][2] + 1) << 3, _shapes[s->obj][3], 2, 4, Screen::CR_NO_P_CHECK);
+ _screen->drawShape(4, _shapes[s->obj], s->x1 & 7, 0, 0);
+ _screen->copyRegion(0, 0, s->x1, s->y1, (_shapes[s->obj][2] + 1) << 3, _shapes[s->obj][3], 4, 0, Screen::CR_NO_P_CHECK);
+ } else {
+ _screen->copyRegion(s->x1 - 8, s->y1 - 8, s->x1, s->y1, (_shapes[s->obj][2] + 1) << 3, _shapes[s->obj][3], 2, 0, Screen::CR_NO_P_CHECK);
+ }
+ _screen->updateScreen();
- _vm->delayUntil(end);
- _screen->setShapeFadeMode(0, false);
- _screen->setShapeFadeMode(1, false);
+ _vm->delayUntil(end);
+ _screen->setShapeFadeMode(0, false);
+ _screen->setShapeFadeMode(1, false);
+ }
break;
case 5:
// copy region
- if (_mode == kFinale && s->pal)
+ if (_config->mode == kFinale && s->pal)
setPaletteWithoutTextColor(palIndex);
- _screen->copyRegion(s->x2 << 3, s->y2, s->x1, s->y1, s->w << 3, s->h, (s->obj && _mode == kFinale) ? 6 : 2, 0, Screen::CR_NO_P_CHECK);
+ _screen->copyRegion(s->x2 << 3, s->y2, s->x1, s->y1, s->w << 3, s->h, (s->obj && _config->mode == kFinale) ? 6 : 2, 0, Screen::CR_NO_P_CHECK);
_screen->updateScreen();
delay(s->delay);
break;
@@ -1123,8 +1191,15 @@ void DarkmoonSequenceHelper::runSequence(int index, int del) {
_vm->snd_playSoundEffect(s->obj);
break;
+ case 7:
+ // restore background (only used in EGA mode)
+ delay(s->delay);
+ _screen->copyRegion(s->x1 - 8, s->y1 - 8, s->x1, s->y1, (_shapes[s->obj][2] + 1) << 3, _shapes[s->obj][3], 2, 0, Screen::CR_NO_P_CHECK);
+ _screen->updateScreen();
+ break;
+
default:
- error("DarkmoonSequenceHelper::runSequence(): Unknown animation opcode encountered.");
+ error("DarkmoonSequenceHelper::animCommand(): Unknown animation opcode encountered.");
break;
}
}
@@ -1138,12 +1213,17 @@ void DarkmoonSequenceHelper::printText(int index, int color) {
return;
_screen->setClearScreenDim(17);
- _palettes[0]->copy(*_palettes[0], color, 1, 255);
- setPalette(0);
+ uint8 col1 = 15;
+
+ if (_vm->_configRenderMode != Common::kRenderEGA) {
+ _palettes[0]->copy(*_palettes[0], color, 1, 255);
+ setPalette(0);
+ col1 = 255;
+ }
- char *temp = new char[strlen(_strings[index]) + 1];
+ char *temp = new char[strlen(_config->strings[index]) + 1];
char *str = temp;
- strcpy(str, _strings[index]);
+ strcpy(str, _config->strings[index]);
const ScreenDim *dm = _screen->_curDim;
@@ -1154,7 +1234,7 @@ void DarkmoonSequenceHelper::printText(int index, int color) {
*cr = 0;
uint32 len = strlen(str);
- _screen->printText(str, (dm->sx + ((dm->w - len) >> 1)) << 3, dm->sy + yOffs, 255, dm->unkA);
+ _screen->printText(str, (dm->sx + ((dm->w - len) >> 1)) << 3, dm->sy + yOffs, col1, dm->unkA);
if (cr) {
*cr = 13;
@@ -1171,8 +1251,8 @@ void DarkmoonSequenceHelper::printText(int index, int color) {
void DarkmoonSequenceHelper::fadeText() {
if (_vm->skipFlag() || _vm->shouldQuit())
return;
-
- _screen->fadeTextColor(_palettes[0], 255, 8);
+ if (_vm->_configRenderMode != Common::kRenderEGA)
+ _screen->fadeTextColor(_palettes[0], 255, 8);
_screen->clearCurDim();
}
@@ -1181,11 +1261,13 @@ void DarkmoonSequenceHelper::update(int srcPage) {
return;
_screen->copyRegion(0, 0, 8, 8, 304, 128, srcPage, 0, Screen::CR_NO_P_CHECK);
- setPaletteWithoutTextColor(0);
+
+ if (_vm->_configRenderMode != Common::kRenderEGA)
+ setPaletteWithoutTextColor(0);
}
void DarkmoonSequenceHelper::setPaletteWithoutTextColor(int index) {
- if (_vm->skipFlag() || _vm->shouldQuit())
+ if (_vm->_configRenderMode == Common::kRenderEGA || _vm->skipFlag() || _vm->shouldQuit())
return;
if (!memcmp(_palettes[11]->getData(), _palettes[index]->getData(), 765))
@@ -1196,6 +1278,7 @@ void DarkmoonSequenceHelper::setPaletteWithoutTextColor(int index) {
setPalette(11);
_screen->updateScreen();
+ _system->delayMillis(10);
}
void DarkmoonSequenceHelper::setPalette(int index) {
@@ -1205,8 +1288,12 @@ void DarkmoonSequenceHelper::setPalette(int index) {
void DarkmoonSequenceHelper::fadePalette(int index, int del) {
if (_vm->skipFlag() || _vm->shouldQuit())
return;
-
- _screen->fadePalette(*_palettes[index], del * _vm->tickLength());
+ if (_vm->_configRenderMode == Common::kRenderEGA) {
+ setPalette(index);
+ _screen->updateScreen();
+ } else {
+ _screen->fadePalette(*_palettes[index], del * _vm->tickLength());
+ }
}
void DarkmoonSequenceHelper::copyPalette(int srcIndex, int destIndex) {
@@ -1225,7 +1312,7 @@ bool DarkmoonSequenceHelper::processDelayedPaletteFade() {
if (_vm->skipFlag() || _vm->shouldQuit())
return true;
- if (!_fadePalRate || (_system->getMillis() <= _fadePalTimer))
+ if (_vm->_configRenderMode == Common::kRenderEGA || !_fadePalRate || (_system->getMillis() <= _fadePalTimer))
return false;
if (_screen->delayedFadePalStep(_palettes[_fadePalIndex], _palettes[0], _fadePalRate)) {
@@ -1244,7 +1331,7 @@ void DarkmoonSequenceHelper::delay(uint32 ticks) {
uint32 end = _system->getMillis() + ticks * _vm->_tickLength;
- if (_mode == kFinale) {
+ if (_config->palFading) {
do {
if (processDelayedPaletteFade())
break;
@@ -1261,11 +1348,11 @@ void DarkmoonSequenceHelper::waitForSongNotifier(int index, bool introUpdateAnim
int seq = 0;
while (_vm->sound()->checkTrigger() < index && !(_vm->skipFlag() || _vm->shouldQuit())) {
if (introUpdateAnim) {
- runSequence(30 | seq);
+ animCommand(30 | seq);
seq ^= 1;
}
- if (_mode == kFinale)
+ if (_config->palFading)
processDelayedPaletteFade();
_vm->updateInput();
diff --git a/engines/kyra/sequences_eob.cpp b/engines/kyra/sequences_eob.cpp
index 9f54306d59..4a9f7d8a65 100644
--- a/engines/kyra/sequences_eob.cpp
+++ b/engines/kyra/sequences_eob.cpp
@@ -33,179 +33,139 @@
namespace Kyra {
-int EoBEngine::mainMenu() {
- int menuChoice = _menuChoiceInit;
- _menuChoiceInit = 0;
-
- Screen::FontId of = _screen->_currentFont;
-
- while (menuChoice >= 0 && !shouldQuit()) {
- switch (menuChoice) {
- case 0: {
- _screen->loadPalette("EOBPAL.COL", _screen->getPalette(0));
- _screen->loadEoBBitmap("INTRO", 0, 5, 3, 2);
- _screen->setScreenPalette(_screen->getPalette(0));
- _screen->_curPage = 2;
- of = _screen->setFont(Screen::FID_6_FNT);
- Common::String versionString(Common::String::format("ScummVM %s", gScummVMVersion));
- _screen->printText(versionString.c_str(), 280 - versionString.size() * 6, 153, _screen->getPagePixel(2, 0, 0), 0);
- _screen->setFont(of);
- _screen->fillRect(0, 159, 319, 199, _screen->getPagePixel(2, 0, 0));
- gui_drawBox(77, 165, 173, 29, 13, 14, 12);
- gui_drawBox(76, 164, 175, 31, 13, 14, -1);
- _screen->_curPage = 0;
- _screen->copyRegion(0, 0, 0, 0, 320, 200, 2, 0, Screen::CR_NO_P_CHECK);
- _screen->updateScreen();
- menuChoice = mainMenuLoop();
- } break;
-
- case 1:
- // load game in progress
- //
- menuChoice = -1;
- break;
-
- case 2:
- // create new party
- menuChoice = -2;
- break;
-
- case 3:
- // quit
- menuChoice = -5;
- break;
-
- case 4:
- // intro
- _sound->loadSoundFile("SOUND");
- _screen->hideMouse();
- seq_playOpeningCredits();
- seq_playIntro();
- _screen->showMouse();
- _sound->loadSoundFile("ADLIB");
- menuChoice = 0;
- break;
- }
- }
-
- return shouldQuit() ? -5 : menuChoice;
+class EoBIntroPlayer {
+public:
+ EoBIntroPlayer(EoBEngine *vm, Screen_EoB *screen);
+ ~EoBIntroPlayer() {}
+
+ void start();
+
+private:
+ void openingCredits();
+ void tower();
+ void orb();
+ void waterdeepEntry();
+ void king();
+ void hands();
+ void waterdeepExit();
+ void tunnel();
+
+ void loadAndSetPalette(const char *filename);
+ void copyBlurRegion(int x1, int y1, int x2, int y2, int w, int h, int step);
+ void boxMorphTransition(int targetDestX, int targetDestY, int targetFinalX, int targetFinalY, int targetSrcX, int targetSrcY, int targetFinalW, int targetFinalH, int originX1, int originY1, int originW, int originH);
+ void whirlTransition();
+
+ EoBEngine *_vm;
+ Screen_EoB *_screen;
+
+ const char *const *_filesOpening;
+ const char *const *_filesTower;
+ const char *const *_filesOrb;
+ const char *const *_filesWdEntry;
+ const char *const *_filesKing;
+ const char *const *_filesHands;
+ const char *const *_filesWdExit;
+ const char *const *_filesTunnel;
+ const uint8 *_openingFrmDelay;
+ const uint8 *_wdEncodeX;
+ const uint8 *_wdEncodeY;
+ const uint8 *_wdEncodeWH;
+ const uint16 *_wdDsX;
+ const uint8 *_wdDsY;
+ const uint8 *_tvlX1;
+ const uint8 *_tvlY1;
+ const uint8 *_tvlX2;
+ const uint8 *_tvlY2;
+ const uint8 *_tvlW;
+ const uint8 *_tvlH;
+};
+
+EoBIntroPlayer::EoBIntroPlayer(EoBEngine *vm, Screen_EoB *screen) : _vm(vm), _screen(screen) {
+ int temp = 0;
+ _filesOpening = _vm->staticres()->loadStrings(kEoB1IntroFilesOpening, temp);
+ _filesTower = _vm->staticres()->loadStrings(kEoB1IntroFilesTower, temp);
+ _filesOrb = _vm->staticres()->loadStrings(kEoB1IntroFilesOrb, temp);
+ _filesWdEntry = _vm->staticres()->loadStrings(kEoB1IntroFilesWdEntry, temp);
+ _filesKing = _vm->staticres()->loadStrings(kEoB1IntroFilesKing, temp);
+ _filesHands = _vm->staticres()->loadStrings(kEoB1IntroFilesHands, temp);
+ _filesWdExit = _vm->staticres()->loadStrings(kEoB1IntroFilesWdExit, temp);
+ _filesTunnel = _vm->staticres()->loadStrings(kEoB1IntroFilesTunnel, temp);
+ _openingFrmDelay = _vm->staticres()->loadRawData(kEoB1IntroOpeningFrmDelay, temp);
+ _wdEncodeX = _vm->staticres()->loadRawData(kEoB1IntroWdEncodeX, temp);
+ _wdEncodeY = _vm->staticres()->loadRawData(kEoB1IntroWdEncodeY, temp);
+ _wdEncodeWH = _vm->staticres()->loadRawData(kEoB1IntroWdEncodeWH, temp);
+ _wdDsX = _vm->staticres()->loadRawDataBe16(kEoB1IntroWdDsX, temp);
+ _wdDsY = _vm->staticres()->loadRawData(kEoB1IntroWdDsY, temp);
+ _tvlX1 = _vm->staticres()->loadRawData(kEoB1IntroTvlX1, temp);
+ _tvlY1 = _vm->staticres()->loadRawData(kEoB1IntroTvlY1, temp);
+ _tvlX2 = _vm->staticres()->loadRawData(kEoB1IntroTvlX2, temp);
+ _tvlY2 = _vm->staticres()->loadRawData(kEoB1IntroTvlY2, temp);
+ _tvlW = _vm->staticres()->loadRawData(kEoB1IntroTvlW, temp);
+ _tvlH = _vm->staticres()->loadRawData(kEoB1IntroTvlH, temp);
}
-int EoBEngine::mainMenuLoop() {
- int sel = -1;
- do {
- _screen->setScreenDim(28);
- _gui->simpleMenu_setup(8, 0, _mainMenuStrings, -1, 0, 0);
-
- while (sel == -1 && !shouldQuit())
- sel = _gui->simpleMenu_process(8, _mainMenuStrings, 0, -1, 0);
- } while ((sel < 0 || sel > 5) && !shouldQuit());
-
- return sel + 1;
-}
+void EoBIntroPlayer::start() {
+ _vm->_allowSkip = true;
+ openingCredits();
-void EoBEngine::seq_playOpeningCredits() {
- _allowSkip = true;
-
- loadSetIntroPalette(_introFilesOpening[5]);
- _screen->loadBitmap(_introFilesOpening[4], 5, 3, 0);
- _screen->copyRegion(0, 0, 0, 0, 320, 200, 2, 0, Screen::CR_NO_P_CHECK);
- _screen->updateScreen();
-
- snd_playSong(1);
- delay(_introOpeningFrmDelay[0] * _tickLength);
-
- for (int i = 0; i < 4 && !shouldQuit() && !skipFlag(); i++) {
- _screen->loadBitmap(_introFilesOpening[i], 5, 3, 0);
- uint32 nextFrameTimer = _system->getMillis() + _introOpeningFrmDelay[i + 1] * _tickLength;
- _screen->crossFadeRegion(0, 50, 0, 50, 320, 102, 2, 0);
- delayUntil(nextFrameTimer);
- }
-
- _allowSkip = false;
-}
-
-void EoBEngine::seq_playIntro() {
- _allowSkip = true;
-
- if (!shouldQuit() && !skipFlag()) {
- snd_playSong(2);
- _screen->loadBitmap("TITLE-V.CMP", 5, 3, 0);
+ if (!_vm->shouldQuit() && !_vm->skipFlag()) {
+ _vm->snd_playSong(2);
+ _screen->loadBitmap((_vm->_configRenderMode == Common::kRenderCGA || _vm->_configRenderMode == Common::kRenderEGA) ? "TITLE-E.CMP" : "TITLE-V.CMP", 3, 5, 0);
+ _screen->convertPage(5, 2, _vm->_cgaMappingDefault);
_screen->crossFadeRegion(0, 0, 0, 0, 320, 200, 2, 0);
- delay(120 * _tickLength);
+ _vm->delay(120 * _vm->_tickLength);
}
- Common::SeekableReadStream *s = _res->createReadStream("TEXT.RAW");
+ Common::SeekableReadStream *s = _vm->resource()->createReadStream("TEXT.RAW");
if (s) {
s->seek(768);
- _screen->loadFileDataToPage(s, 6, s->size() - 768);
+ _screen->loadFileDataToPage(s, 5, s->size() - 768);
delete s;
} else {
- _screen->loadBitmap("TEXT.CMP", 3, 6, 0);
+ _screen->loadBitmap("TEXT.CMP", 3, 5, 0);
}
+ _screen->convertPage(5, 6, _vm->_cgaMappingAlt);
- seq_tower();
- seq_orb();
- seq_waterdeepEntry();
- seq_king();
- seq_hands();
- seq_waterdeepExit();
- seq_tunnel();
+ tower();
+ orb();
+ waterdeepEntry();
+ king();
+ hands();
+ waterdeepExit();
+ tunnel();
whirlTransition();
- _sound->haltTrack();
- _allowSkip = false;
+ _vm->snd_stopSound();
+ _vm->_allowSkip = false;
}
-void EoBEngine::seq_playFinale() {
- Common::SeekableReadStream *s = _res->createReadStream("TEXT.DAT");
- _screen->loadFileDataToPage(s, 5, 32000);
- delete s;
-
- snd_playSoundEffect(20);
-
- _txt->resetPageBreakString();
- _txt->setWaitButtonMode(1);
- _txt->setupField(12, true);
- gui_drawBox(0, 0, 176, 175, guiSettings()->colors.frame1, guiSettings()->colors.frame2, guiSettings()->colors.fill);
- _txt->printDialogueText(51, _moreStrings[0]);
-
- if (!checkScriptFlags(0x1ffe)) {
- _screen->fadeToBlack();
- return;
- }
+void EoBIntroPlayer::openingCredits() {
+ loadAndSetPalette(_filesOpening[5]);
- _txt->printDialogueText(_finBonusStrings[0]);
- for (int i = 0; i < 6; i++) {
- _txt->printDialogueText(_finBonusStrings[1]);
- if (_characters[i].flags & 1)
- _txt->printDialogueText(_characters[i].name);
- }
+ _screen->loadBitmap(_filesOpening[4], 5, 3, 0);
+ _screen->convertPage(3, 0, _vm->_cgaMappingAlt);
+ _screen->updateScreen();
- uint32 password = 0;
- for (int i = 0; i < 4; i++) {
- if (!(_characters[i].flags & 1))
- continue;
+ _vm->snd_playSong(1);
+ _vm->delay(_openingFrmDelay[0] * _vm->_tickLength);
- int len = strlen(_characters[i].name);
- for (int ii = 0; ii < len; ii++) {
- uint32 c = _characters[i].name[ii];
- password += (c * c);
- }
+ for (int i = 0; i < 4 && !_vm->shouldQuit() && !_vm->skipFlag(); i++) {
+ _screen->loadBitmap(_filesOpening[i], 5, 3, 0);
+ uint32 nextFrameTimer = _vm->_system->getMillis() + _openingFrmDelay[i + 1] * _vm->_tickLength;
+ _screen->convertPage(3, 4, _vm->_cgaMappingAlt);
+ _screen->crossFadeRegion(0, 50, 0, 50, 320, 102, 4, 0);
+ _vm->delayUntil(nextFrameTimer);
}
-
- _txt->printDialogueText(Common::String::format(_finBonusStrings[2], password).c_str(), true);
- _screen->fadeToBlack();
}
-void EoBEngine::seq_tower() {
- if (shouldQuit() || skipFlag())
+void EoBIntroPlayer::tower() {
+ if (_vm->shouldQuit() || _vm->skipFlag())
return;
- _screen->loadBitmap(_introFilesTower[1], 5, 3, 0);
+ _screen->loadBitmap(_filesTower[1], 5, 3, 0);
_screen->setCurPage(2);
- uint8 *shp = _screen->encodeShape(0, 0, 16, 56, true);
- _screen->copyPage(3, 4);
+ uint8 *shp = _screen->encodeShape(0, 0, 16, 56, true, _vm->_cgaMappingAlt);
+ _screen->convertPage(3, 4, _vm->_cgaMappingAlt);
_screen->clearCurPage();
for (int i = 0; i < 200; i += 64)
@@ -214,7 +174,7 @@ void EoBEngine::seq_tower() {
_screen->fillRect(0, 184, 319, 199, 12);
int cp = _screen->setCurPage(0);
whirlTransition();
- loadSetIntroPalette(_introFilesTower[0]);
+ loadAndSetPalette(_filesTower[0]);
_screen->setCurPage(cp);
_screen->clearCurPage();
@@ -224,29 +184,29 @@ void EoBEngine::seq_tower() {
_screen->setCurPage(0);
- for (int i = 0; i < 64 && !shouldQuit() && !skipFlag(); i += 2) {
- uint32 end = _system->getMillis() + 2 * _tickLength;
+ for (int i = 0; i < 64 && !_vm->shouldQuit() && !_vm->skipFlag(); i += 2) {
+ uint32 end = _vm->_system->getMillis() + 2 * _vm->_tickLength;
_screen->copyRegion(0, 142 - i, 96, 0, 128, i + 1, 4, 0, Screen::CR_NO_P_CHECK);
_screen->copyRegion(0, 0, 96, i + 1, 128, 167 - i, 2, 0, Screen::CR_NO_P_CHECK);
if (!i)
_screen->copyRegion(0, 0, 0, 168, 320, 32, 6, 0, Screen::CR_NO_P_CHECK);
_screen->updateScreen();
- delayUntil(end);
+ _vm->delayUntil(end);
}
- for (int i = 0; i < 24 && !shouldQuit() && !skipFlag(); i += 2) {
- uint32 end = _system->getMillis() + 2 * _tickLength;
+ for (int i = 0; i < 24 && !_vm->shouldQuit() && !_vm->skipFlag(); i += 2) {
+ uint32 end = _vm->_system->getMillis() + 2 * _vm->_tickLength;
_screen->copyRegion(0, 79 - i, 96, 0, 24, 65 + i, 4, 0, Screen::CR_NO_P_CHECK);
_screen->copyRegion(104, 79 - i, 200, 0, 24, 65 + i, 4, 0, Screen::CR_NO_P_CHECK);
_screen->copyRegion(24, 110, 120, i + 31, 80, 34, 4, 0, Screen::CR_NO_P_CHECK);
_screen->copyRegion(152, 0, 120, 32, 80, i + 1, 4, 0, Screen::CR_NO_P_CHECK);
_screen->copyRegion(0, 0, 96, 65 + i, 128, 103 - i, 2, 0, Screen::CR_NO_P_CHECK);
_screen->updateScreen();
- delayUntil(end);
+ _vm->delayUntil(end);
}
- for (int i = 0; i < 56 && !shouldQuit() && !skipFlag(); i += 2) {
- uint32 end = _system->getMillis() + 2 * _tickLength;
+ for (int i = 0; i < 56 && !_vm->shouldQuit() && !_vm->skipFlag(); i += 2) {
+ uint32 end = _vm->_system->getMillis() + 2 * _vm->_tickLength;
_screen->copyRegion(0, 56, 96, i, 24, 54, 4, 0, Screen::CR_NO_P_CHECK);
_screen->copyRegion(104, 56, 200, i, 24, 54, 4, 0, Screen::CR_NO_P_CHECK);
_screen->copyRegion(0, 110, 96, 54 + i, 128, 34, 4, 0, Screen::CR_NO_P_CHECK);
@@ -264,143 +224,143 @@ void EoBEngine::seq_tower() {
_screen->copyRegion(128, 0, 96, 0, 128, i + 1, 2, 0, Screen::CR_NO_P_CHECK);
_screen->copyRegion(0, 0, 96, i + 89, 128, 79 - i, 2, 0, Screen::CR_NO_P_CHECK);
_screen->updateScreen();
- delayUntil(end);
+ _vm->delayUntil(end);
}
_screen->copyRegion(0, 32, 0, 168, 320, 32, 6, 0, Screen::CR_NO_P_CHECK);
_screen->updateScreen();
- delay(65 * _tickLength);
+ _vm->delay(65 * _vm->_tickLength);
delete[] shp;
}
-void EoBEngine::seq_orb() {
- if (shouldQuit() || skipFlag())
+void EoBIntroPlayer::orb() {
+ if (_vm->shouldQuit() || _vm->skipFlag())
return;
uint8 *shp[5];
- _screen->loadBitmap(_introFilesOrb[0], 5, 3, 0);
+ _screen->loadBitmap(_filesOrb[0], 5, 3, 0);
_screen->setCurPage(2);
- shp[4] = _screen->encodeShape(0, 0, 20, 136, true);
- _screen->loadBitmap(_introFilesOrb[1], 5, 3, 0);
- shp[3] = _screen->encodeShape(16, 0, 16, 104, true);
+ shp[4] = _screen->encodeShape(0, 0, 20, 136, true, _vm->_cgaMappingAlt);
+ _screen->loadBitmap(_filesOrb[1], 5, 3, 0);
+ shp[3] = _screen->encodeShape(16, 0, 16, 104, true, _vm->_cgaMappingAlt);
_screen->fillRect(0, 0, 127, 103, 12);
for (int i = 1; i < 4; i++) {
copyBlurRegion(128, 0, 0, 0, 128, 104, i);
- shp[3 - i] = _screen->encodeShape(0, 0, 16, 104, true);
+ shp[3 - i] = _screen->encodeShape(0, 0, 16, 104, true, _vm->_cgaMappingAlt);
}
_screen->fillRect(0, 0, 159, 135, 12);
_screen->setCurPage(0);
- _screen->copyPage(3, 4);
+ _screen->convertPage(3, 4, _vm->_cgaMappingAlt);
_screen->clearCurPage();
- snd_playSoundEffect(6);
+ _vm->snd_playSoundEffect(6);
- for (int i = -1; i < 4 && !shouldQuit() && !skipFlag(); i++) {
- uint32 end = _system->getMillis() + 3 * _tickLength;
+ for (int i = -1; i < 4 && !_vm->shouldQuit() && !_vm->skipFlag(); i++) {
+ uint32 end = _vm->_system->getMillis() + 3 * _vm->_tickLength;
if (i >= 0)
_screen->drawShape(2, shp[i], 16, 16, 0);
_screen->drawShape(2, shp[4], 0, 0, 0);
_screen->copyRegion(0, 0, 80, 24, 160, 136, 2, 0, Screen::CR_NO_P_CHECK);
_screen->updateScreen();
- delayUntil(end);
+ _vm->delayUntil(end);
}
_screen->copyRegion(0, 64, 0, 168, 320, 16, 6, 0, Screen::CR_NO_P_CHECK);
_screen->updateScreen();
- delay(40 * _tickLength);
+ _vm->delay(40 * _vm->_tickLength);
- snd_playSoundEffect(6);
+ _vm->snd_playSoundEffect(6);
- for (int i = 3; i > -2 && !shouldQuit() && !skipFlag(); i--) {
- uint32 end = _system->getMillis() + 3 * _tickLength;
+ for (int i = 3; i > -2 && !_vm->shouldQuit() && !_vm->skipFlag(); i--) {
+ uint32 end = _vm->_system->getMillis() + 3 * _vm->_tickLength;
_screen->fillRect(16, 16, 143, 119, 12, 2);
if (i >= 0)
_screen->drawShape(2, shp[i], 16, 16, 0);
_screen->drawShape(2, shp[4], 0, 0, 0);
_screen->copyRegion(0, 0, 80, 24, 160, 136, 2, 0, Screen::CR_NO_P_CHECK);
_screen->updateScreen();
- delayUntil(end);
+ _vm->delayUntil(end);
}
- delay(40 * _tickLength);
+ _vm->delay(40 * _vm->_tickLength);
for (int i = 0; i < 5; i++)
delete[] shp[i];
}
-void EoBEngine::seq_waterdeepEntry() {
- if (shouldQuit() || skipFlag())
+void EoBIntroPlayer::waterdeepEntry() {
+ if (_vm->shouldQuit() || _vm->skipFlag())
return;
uint8 *shp[4];
uint8 *shp2[31];
uint8 *shp3[3];
- loadSetIntroPalette(_introFilesWdEntry[0]);
- _screen->loadBitmap(_introFilesWdEntry[1], 5, 3, 0);
+ loadAndSetPalette(_filesWdEntry[0]);
+ _screen->loadBitmap(_filesWdEntry[1], 5, 3, 0);
_screen->setCurPage(2);
- shp[3] = _screen->encodeShape(0, 0, 20, 136, true);
+ shp[3] = _screen->encodeShape(0, 0, 20, 136, true, _vm->_cgaMappingAlt);
for (int i = 1; i < 4; i++) {
copyBlurRegion(0, 0, 0, 0, 160, 136, i);
- shp[3 - i] = _screen->encodeShape(0, 0, 20, 136, true);
+ shp[3 - i] = _screen->encodeShape(0, 0, 20, 136, true, _vm->_cgaMappingAlt);
}
_screen->setCurPage(0);
- _screen->copyPage(3, 4);
+ _screen->convertPage(3, 4, _vm->_cgaMappingAlt);
_screen->fillRect(0, 168, 319, 199, 12, 0);
- snd_playSoundEffect(6);
+ _vm->snd_playSoundEffect(6);
- for (int i = 0; i < 4 && !shouldQuit() && !skipFlag(); i++) {
- uint32 end = _system->getMillis() + 3 * _tickLength;
+ for (int i = 0; i < 4 && !_vm->shouldQuit() && !_vm->skipFlag(); i++) {
+ uint32 end = _vm->_system->getMillis() + 3 * _vm->_tickLength;
_screen->drawShape(0, shp[i], 80, 24, 0);
delete[] shp[i];
_screen->updateScreen();
- delayUntil(end);
+ _vm->delayUntil(end);
}
_screen->copyRegion(0, 80, 0, 168, 320, 16, 6, 0, Screen::CR_NO_P_CHECK);
_screen->updateScreen();
- delay(50 * _tickLength);
+ _vm->delay(50 * _vm->_tickLength);
_screen->setCurPage(2);
- shp[0] = _screen->encodeShape(20, 0, 20, 136, true);
- _screen->loadBitmap(_introFilesWdEntry[2], 5, 3, 0);
- shp[1] = _screen->encodeShape(0, 0, 20, 136, true);
- shp[2] = _screen->encodeShape(20, 0, 20, 136, true);
- _screen->loadBitmap(_introFilesWdEntry[3], 5, 3, 0);
+ shp[0] = _screen->encodeShape(20, 0, 20, 136, true, _vm->_cgaMappingAlt);
+ _screen->loadBitmap(_filesWdEntry[2], 5, 3, 0);
+ shp[1] = _screen->encodeShape(0, 0, 20, 136, true, _vm->_cgaMappingAlt);
+ shp[2] = _screen->encodeShape(20, 0, 20, 136, true, _vm->_cgaMappingAlt);
+ _screen->loadBitmap(_filesWdEntry[3], 5, 3, 0);
for (int i = 0; i < 31; i++)
- shp2[i] = _screen->encodeShape(_introWdEncodeX[i], 136 + (_introWdEncodeY[i] << 3), _introWdEncodeWH[i], _introWdEncodeWH[i] << 3, true);
+ shp2[i] = _screen->encodeShape(_wdEncodeX[i], 136 + (_wdEncodeY[i] << 3), _wdEncodeWH[i], _wdEncodeWH[i] << 3, true, _vm->_cgaMappingAlt);
for (int i = 0; i < 3; i++)
- shp3[i] = _screen->encodeShape(5 * i, 152, 5, 32, true);
+ shp3[i] = _screen->encodeShape(5 * i, 152, 5, 32, true, _vm->_cgaMappingAlt);
- _screen->copyPage(3, 4);
+ _screen->convertPage(3, 4, _vm->_cgaMappingAlt);
- for (int i = 0; i < 3 && !shouldQuit() && !skipFlag(); i++) {
- uint32 end = _system->getMillis() + 3 * _tickLength;
+ for (int i = 0; i < 3 && !_vm->shouldQuit() && !_vm->skipFlag(); i++) {
+ uint32 end = _vm->_system->getMillis() + 3 * _vm->_tickLength;
_screen->fillRect(0, 0, 159, 135, 12, 2);
_screen->drawShape(2, shp[i], 0, 0, 0);
_screen->copyRegion(0, 0, 80, 24, 160, 136, 2, 0, Screen::CR_NO_P_CHECK);
_screen->updateScreen();
- delayUntil(end);
+ _vm->delayUntil(end);
}
_screen->copyRegion(0, 0, 80, 24, 160, 136, 4, 0, Screen::CR_NO_P_CHECK);
_screen->updateScreen();
- delay(4 * _tickLength);
+ _vm->delay(4 * _vm->_tickLength);
_screen->copyRegion(160, 0, 80, 24, 160, 136, 4, 0, Screen::CR_NO_P_CHECK);
_screen->fillRect(0, 168, 319, 199, 12, 0);
_screen->updateScreen();
- delay(4 * _tickLength);
+ _vm->delay(4 * _vm->_tickLength);
_screen->copyRegion(0, 184, 40, 184, 232, 16, 4, 0, Screen::CR_NO_P_CHECK);
int cx = 264;
int cy = 11;
- for (int i = 0; i < 70 && !shouldQuit() && !skipFlag(); i++) {
- uint32 end = _system->getMillis() + 3 * _tickLength;
+ for (int i = 0; i < 70 && !_vm->shouldQuit() && !_vm->skipFlag(); i++) {
+ uint32 end = _vm->_system->getMillis() + 3 * _vm->_tickLength;
_screen->copyRegion(cx - 2, cy - 2, 0, 0, 48, 36, 4, 4, Screen::CR_NO_P_CHECK);
_screen->drawShape(4, shp3[((i & 3) == 3) ? 1 : (i & 3)], cx, cy, 0);
@@ -410,15 +370,15 @@ void EoBEngine::seq_waterdeepEntry() {
cy++;
for (int ii = 0; ii < 5; ii++) {
- int s = _rnd.getRandomNumber(255) % 31;
- _screen->drawShape(0, shp2[s], _introWdDsX[s] - 80, _introWdDsY[s] + 24, 0);
+ int s = _vm->_rnd.getRandomNumber(255) % 31;
+ _screen->drawShape(0, shp2[s], _wdDsX[s] - 80, _wdDsY[s] + 24, 0);
}
- if (!(_rnd.getRandomNumber(255) & 7))
- snd_playSoundEffect(_rnd.getRandomBit() ? 5 : 14);
+ if (!(_vm->_rnd.getRandomNumber(255) & 7))
+ _vm->snd_playSoundEffect(_vm->_rnd.getRandomBit() ? 5 : 14);
_screen->updateScreen();
- delayUntil(end);
+ _vm->delayUntil(end);
}
for (int i = 0; i < 3; i++) {
@@ -430,20 +390,20 @@ void EoBEngine::seq_waterdeepEntry() {
delete[] shp2[i];
}
-void EoBEngine::seq_king() {
- if (shouldQuit() || skipFlag())
+void EoBIntroPlayer::king() {
+ if (_vm->shouldQuit() || _vm->skipFlag())
return;
- _screen->loadBitmap(_introFilesKing[0], 5, 3, 0);
- _screen->copyPage(3, 4);
+ _screen->loadBitmap(_filesKing[0], 5, 3, 0);
+ _screen->convertPage(3, 4, _vm->_cgaMappingAlt);
int x = 15;
int y = 14;
int w = 1;
int h = 1;
- for (int i = 0; i < 10 && !shouldQuit() && !skipFlag(); i++) {
- uint32 end = _system->getMillis() + _tickLength;
+ for (int i = 0; i < 10 && !_vm->shouldQuit() && !_vm->skipFlag(); i++) {
+ uint32 end = _vm->_system->getMillis() + _vm->_tickLength;
_screen->copyRegion(x << 3, y << 3, x << 3, y << 3, w << 3, h << 3, 4, 0, Screen::CR_NO_P_CHECK);
if (x > 6)
x --;
@@ -456,10 +416,10 @@ void EoBEngine::seq_king() {
if (y + h > 23)
h = 23 - y;
_screen->updateScreen();
- delayUntil(end);
+ _vm->delayUntil(end);
}
- delay(25 * _tickLength);
+ _vm->delay(25 * _vm->_tickLength);
uint8 *shp[4];
int16 dy[4];
@@ -469,19 +429,19 @@ void EoBEngine::seq_king() {
static const uint8 advEncW[] = { 6, 6, 7, 6 };
static const int8 modY[] = { -4, -8, -2, -2, 1, 0, 0, 0 };
- _screen->loadBitmap(_introFilesKing[1], 5, 3, 0);
+ _screen->loadBitmap(_filesKing[1], 5, 3, 0);
_screen->setCurPage(2);
for (int i = 0; i < 4; i++) {
- shp[i] = _screen->encodeShape(advEncX[i], 0, advEncW[i], 98, true);
- dy[i] = 180 + ((_rnd.getRandomNumber(255) & 3) << 3);
+ shp[i] = _screen->encodeShape(advEncX[i], 0, advEncW[i], 98, true, _vm->_cgaMappingAlt);
+ dy[i] = 180 + ((_vm->_rnd.getRandomNumber(255) & 3) << 3);
stepY[i] = (i * 5) & 3;
}
_screen->copyPage(0, 4);
- for (bool runloop = true; runloop && !shouldQuit() && !skipFlag();) {
+ for (bool runloop = true; runloop && !_vm->shouldQuit() && !_vm->skipFlag();) {
runloop = false;
- uint32 end = _system->getMillis() + 2 * _tickLength;
+ uint32 end = _vm->_system->getMillis() + 2 * _vm->_tickLength;
for (int i = 0; i < 4; i++) {
if (dy[i] <= 82)
@@ -501,29 +461,29 @@ void EoBEngine::seq_king() {
runloop = true;
}
- if (!(_rnd.getRandomNumber(255) & 3))
- snd_playSoundEffect(7);
+ if (!(_vm->_rnd.getRandomNumber(255) & 3))
+ _vm->snd_playSoundEffect(7);
_screen->updateScreen();
- delayUntil(end);
+ _vm->delayUntil(end);
}
_screen->copyRegion(0, 96, 0, 160, 320, 32, 6, 0, Screen::CR_NO_P_CHECK);
_screen->updateScreen();
- delay(70 * _tickLength);
+ _vm->delay(70 * _vm->_tickLength);
for (int i = 0; i < 4; i++)
delete[] shp[i];
}
-void EoBEngine::seq_hands() {
- if (shouldQuit() || skipFlag())
+void EoBIntroPlayer::hands() {
+ if (_vm->shouldQuit() || _vm->skipFlag())
return;
_screen->setCurPage(2);
- uint8 *shp1 = _screen->encodeShape(0, 140, 21, 60, true);
- uint8 *shp2 = _screen->encodeShape(21, 140, 12, 60, true);
- _screen->loadBitmap(_introFilesHands[0], 3, 5, 0);
+ uint8 *shp1 = _screen->encodeShape(0, 140, 21, 60, true, _vm->_cgaMappingAlt);
+ uint8 *shp2 = _screen->encodeShape(21, 140, 12, 60, true, _vm->_cgaMappingAlt);
+ _screen->loadBitmap(_filesHands[0], 3, 5, 0);
_screen->fillRect(0, 160, 319, 199, 12, 0);
_screen->fillRect(0, 0, 191, 63, 157, 2);
@@ -533,144 +493,144 @@ void EoBEngine::seq_hands() {
_screen->copyRegion(0, 128, 0, 176, 320, 16, 6, 0, Screen::CR_NO_P_CHECK);
_screen->updateScreen();
- delay(15 * _tickLength);
- snd_playSoundEffect(11);
+ _vm->delay(15 * _vm->_tickLength);
+ _vm->snd_playSoundEffect(11);
- for (int i = -22; i <= 20 && !shouldQuit() && !skipFlag(); i += 4) {
- uint32 end = _system->getMillis() + _tickLength;
+ for (int i = -22; i <= 20 && !_vm->shouldQuit() && !_vm->skipFlag(); i += 4) {
+ uint32 end = _vm->_system->getMillis() + _vm->_tickLength;
_screen->fillRect(0, 0, 167, 63, 157);
_screen->drawShape(2, shp1, i, 4, 0);
_screen->drawShape(2, shp2, 105 - i, 4, 0);
_screen->copyRegion(0, 0, 144, 32, 168, 64, 2, 0, Screen::CR_NO_P_CHECK);
_screen->updateScreen();
- delayUntil(end);
+ _vm->delayUntil(end);
}
- snd_playSoundEffect(10);
+ _vm->snd_playSoundEffect(10);
delete[] shp1;
delete[] shp2;
- delay(15 * _tickLength);
+ _vm->delay(15 * _vm->_tickLength);
_screen->setCurPage(4);
- shp1 = _screen->encodeShape(17, 0, 11, 120, true);
- shp2 = _screen->encodeShape(28, 112, 1, 31, true);
- uint8 *shp3 = _screen->encodeShape(9, 138, 14, 54, true);
+ shp1 = _screen->encodeShape(17, 0, 11, 120, true, _vm->_cgaMappingAlt);
+ shp2 = _screen->encodeShape(28, 112, 1, 31, true, _vm->_cgaMappingAlt);
+ uint8 *shp3 = _screen->encodeShape(9, 138, 14, 54, true, _vm->_cgaMappingAlt);
_screen->setCurPage(2);
_screen->fillRect(0, 0, 135, 63, 157);
_screen->drawShape(2, shp1, 32, -80, 0);
_screen->drawShape(2, shp2, 40, -16, 0);
boxMorphTransition(18, 16, 10, 12, 0, 0, 17, 8, 17, 3, 25, 10);
- delay(15 * _tickLength);
+ _vm->delay(15 * _vm->_tickLength);
- for (int i = -80; i <= 0 && !shouldQuit() && !skipFlag(); i += 4) {
- uint32 end = _system->getMillis() + _tickLength;
+ for (int i = -80; i <= 0 && !_vm->shouldQuit() && !_vm->skipFlag(); i += 4) {
+ uint32 end = _vm->_system->getMillis() + _vm->_tickLength;
_screen->fillRect(0, 0, 135, 63, 157);
_screen->drawShape(2, shp1, 32, i, 0);
_screen->drawShape(2, shp2, 40, i + 64, 0);
_screen->copyRegion(0, 0, 80, 96, 136, 64, 2, 0, Screen::CR_NO_P_CHECK);
_screen->updateScreen();
- delayUntil(end);
+ _vm->delayUntil(end);
}
- snd_playSoundEffect(12);
- delay(5 * _tickLength);
+ _vm->snd_playSoundEffect(12);
+ _vm->delay(5 * _vm->_tickLength);
- for (int i = 0; i > -54 && !shouldQuit() && !skipFlag(); i -= 4) {
- uint32 end = _system->getMillis() + _tickLength;
+ for (int i = 0; i > -54 && !_vm->shouldQuit() && !_vm->skipFlag(); i -= 4) {
+ uint32 end = _vm->_system->getMillis() + _vm->_tickLength;
_screen->fillRect(0, 0, 135, 63, 157);
_screen->drawShape(2, shp3, 12, 64 + i, 0);
_screen->drawShape(2, shp1, 32, i, 0);
_screen->copyRegion(0, 0, 80, 96, 136, 64, 2, 0, Screen::CR_NO_P_CHECK);
_screen->updateScreen();
- delayUntil(end);
+ _vm->delayUntil(end);
}
delete[] shp1;
delete[] shp2;
delete[] shp3;
- delay(15 * _tickLength);
+ _vm->delay(15 * _vm->_tickLength);
_screen->setCurPage(4);
- shp1 = _screen->encodeShape(0, 0, 17, 136, true);
- shp2 = _screen->encodeShape(0, 136, 9, 48, true);
+ shp1 = _screen->encodeShape(0, 0, 17, 136, true, _vm->_cgaMappingAlt);
+ shp2 = _screen->encodeShape(0, 136, 9, 48, true, _vm->_cgaMappingAlt);
_screen->setCurPage(2);
_screen->fillRect(0, 0, 143, 95, 157);
_screen->drawShape(2, shp1, -56, -56, 0);
_screen->drawShape(2, shp2, 52, 49, 0);
boxMorphTransition(9, 6, 0, 0, 0, 0, 18, 12, 8, 11, 21, 10);
- delay(15 * _tickLength);
- snd_playSoundEffect(11);
+ _vm->delay(15 * _vm->_tickLength);
+ _vm->snd_playSoundEffect(11);
- for (int i = -56; i <= -8 && !shouldQuit() && !skipFlag(); i += 4) {
- uint32 end = _system->getMillis() + _tickLength;
+ for (int i = -56; i <= -8 && !_vm->shouldQuit() && !_vm->skipFlag(); i += 4) {
+ uint32 end = _vm->_system->getMillis() + _vm->_tickLength;
_screen->fillRect(0, 0, 143, 95, 157);
_screen->drawShape(2, shp1, i, i, 0);
_screen->drawShape(2, shp2, (i == -8) ? 55 : 52, (i == -8) ? 52 : 49, 0);
_screen->copyRegion(0, 0, 0, 0, 144, 96, 2, 0, Screen::CR_NO_P_CHECK);
_screen->updateScreen();
- delayUntil(end);
+ _vm->delayUntil(end);
}
- snd_playSoundEffect(10);
+ _vm->snd_playSoundEffect(10);
delete[] shp1;
delete[] shp2;
- delay(30 * _tickLength);
+ _vm->delay(30 * _vm->_tickLength);
_screen->setCurPage(4);
- shp1 = _screen->encodeShape(28, 0, 11, 40, true);
- shp2 = _screen->encodeShape(28, 40, 10, 72, true);
+ shp1 = _screen->encodeShape(28, 0, 11, 40, true, _vm->_cgaMappingAlt);
+ shp2 = _screen->encodeShape(28, 40, 10, 72, true, _vm->_cgaMappingAlt);
_screen->setCurPage(2);
_screen->fillRect(0, 0, 87, 112, 157);
_screen->drawShape(2, shp2, 0, 90, 0);
boxMorphTransition(20, 13, 15, 6, 0, 0, 11, 14, 0, 0, 24, 16);
- delay(15 * _tickLength);
+ _vm->delay(15 * _vm->_tickLength);
int dy = 90;
- for (int i = -40; i <= 0 && !shouldQuit() && !skipFlag(); i += 4) {
- uint32 end = _system->getMillis() + _tickLength;
+ for (int i = -40; i <= 0 && !_vm->shouldQuit() && !_vm->skipFlag(); i += 4) {
+ uint32 end = _vm->_system->getMillis() + _vm->_tickLength;
_screen->fillRect(0, 0, 87, 112, 157);
_screen->drawShape(2, shp2, 0, dy, 0);
_screen->copyRegion(0, 0, 120, 48, 88, 112, 2, 0, Screen::CR_NO_P_CHECK);
_screen->updateScreen();
- delayUntil(end);
+ _vm->delayUntil(end);
dy -= 5;
}
- snd_playSoundEffect(13);
+ _vm->snd_playSoundEffect(13);
- for (int i = -40; i <= 0 && !shouldQuit() && !skipFlag(); i += 4) {
- uint32 end = _system->getMillis() + _tickLength;
+ for (int i = -40; i <= 0 && !_vm->shouldQuit() && !_vm->skipFlag(); i += 4) {
+ uint32 end = _vm->_system->getMillis() + _vm->_tickLength;
_screen->fillRect(0, 0, 87, 39, 157);
_screen->drawShape(2, shp1, 0, i, 0);
_screen->copyRegion(0, 0, 120, 48, 88, 112, 2, 0, Screen::CR_NO_P_CHECK);
_screen->updateScreen();
- delayUntil(end);
+ _vm->delayUntil(end);
}
delete[] shp1;
delete[] shp2;
- delay(48 * _tickLength);
+ _vm->delay(48 * _vm->_tickLength);
}
-void EoBEngine::seq_waterdeepExit() {
- if (shouldQuit() || skipFlag())
+void EoBIntroPlayer::waterdeepExit() {
+ if (_vm->shouldQuit() || _vm->skipFlag())
return;
uint8 *shp2[31];
uint8 *shp3[3];
- _screen->loadBitmap(_introFilesWdExit[0], 5, 3, 0);
+ _screen->loadBitmap(_filesWdExit[0], 5, 3, 0);
_screen->setCurPage(2);
for (int i = 0; i < 31; i++)
- shp2[i] = _screen->encodeShape(_introWdEncodeX[i], 136 + (_introWdEncodeY[i] << 3), _introWdEncodeWH[i], _introWdEncodeWH[i] << 3, true);
+ shp2[i] = _screen->encodeShape(_wdEncodeX[i], 136 + (_wdEncodeY[i] << 3), _wdEncodeWH[i], _wdEncodeWH[i] << 3, true, _vm->_cgaMappingAlt);
for (int i = 0; i < 3; i++)
- shp3[i] = _screen->encodeShape(5 * i + 15, 152, 5, 32, true);
- uint8 *shp1 = _screen->encodeShape(31, 136, 5, 32, true);
- _screen->copyPage(3, 4);
+ shp3[i] = _screen->encodeShape(5 * i + 15, 152, 5, 32, true, _vm->_cgaMappingAlt);
+ uint8 *shp1 = _screen->encodeShape(31, 136, 5, 32, true, _vm->_cgaMappingAlt);
+ _screen->convertPage(3, 4, _vm->_cgaMappingAlt);
_screen->copyRegion(0, 0, 0, 136, 48, 36, 4, 4, Screen::CR_NO_P_CHECK);
_screen->fillRect(0, 168, 319, 199, 12, 0);
_screen->copyRegion(160, 0, 80, 24, 160, 136, 4, 0, Screen::CR_NO_P_CHECK);
@@ -678,8 +638,8 @@ void EoBEngine::seq_waterdeepExit() {
int cx = 140;
int cy = 128;
- for (int i = 0; i < 70 && !shouldQuit() && !skipFlag(); i++) {
- uint32 end = _system->getMillis() + 3 * _tickLength;
+ for (int i = 0; i < 70 && !_vm->shouldQuit() && !_vm->skipFlag(); i++) {
+ uint32 end = _vm->_system->getMillis() + 3 * _vm->_tickLength;
int fx = cx - 2;
if (fx < 160)
fx = 160;
@@ -696,15 +656,15 @@ void EoBEngine::seq_waterdeepExit() {
cy--;
for (int ii = 0; ii < 5; ii++) {
- int s = _rnd.getRandomNumber(255) % 31;
- _screen->drawShape(0, shp2[s], _introWdDsX[s] - 80, _introWdDsY[s] + 24, 0);
+ int s = _vm->_rnd.getRandomNumber(255) % 31;
+ _screen->drawShape(0, shp2[s], _wdDsX[s] - 80, _wdDsY[s] + 24, 0);
}
- if (!(_rnd.getRandomNumber(255) & 7))
- snd_playSoundEffect(_rnd.getRandomBit() ? 5 : 14);
+ if (!(_vm->_rnd.getRandomNumber(255) & 7))
+ _vm->snd_playSoundEffect(_vm->_rnd.getRandomBit() ? 5 : 14);
_screen->updateScreen();
- delayUntil(end);
+ _vm->delayUntil(end);
}
for (int i = 0; i < 3; i++)
@@ -718,19 +678,19 @@ void EoBEngine::seq_waterdeepExit() {
_screen->fillRect(0, 168, 319, 199, 12, 0);
_screen->copyRegion(0, 136, 0, 0, 48, 36, 0, 4, Screen::CR_NO_P_CHECK);
- loadSetIntroPalette(_introFilesWdExit[1]);
- _screen->loadBitmap(_introFilesWdExit[2], 3, 5, 0);
- _screen->copyPage(5, 2);
+ loadAndSetPalette(_filesWdExit[1]);
+ _screen->loadBitmap(_filesWdExit[2], 3, 5, 0);
+ _screen->convertPage(5, 2, _vm->_cgaMappingAlt);
whirlTransition();
- delay(6 * _tickLength);
+ _vm->delay(6 * _vm->_tickLength);
_screen->copyRegion(0, 144, 0, 184, 320, 16, 6, 0, Screen::CR_NO_P_CHECK);
cx = 0;
cy = 136;
int dy = 0;
- for (int i = 0; i < 19 && !shouldQuit() && !skipFlag(); i++) {
- uint32 end = _system->getMillis() + _tickLength;
+ for (int i = 0; i < 19 && !_vm->shouldQuit() && !_vm->skipFlag(); i++) {
+ uint32 end = _vm->_system->getMillis() + _vm->_tickLength;
_screen->copyRegion(cx, cy, 80, dy + 16, 160, 8, 2, 0, Screen::CR_NO_P_CHECK);
cy += 8;
dy += 8;
@@ -739,199 +699,144 @@ void EoBEngine::seq_waterdeepExit() {
cy = 0;
}
_screen->updateScreen();
- delayUntil(end);
+ _vm->delayUntil(end);
}
- snd_playSong(3);
- delay(60 * _tickLength);
+ _vm->snd_playSong(3);
+ _vm->delay(60 * _vm->_tickLength);
- for (int i = 0; i < 56 && !shouldQuit() && !skipFlag(); i++) {
- uint32 end = _system->getMillis() + _tickLength;
+ for (int i = 0; i < 56 && !_vm->shouldQuit() && !_vm->skipFlag(); i++) {
+ uint32 end = _vm->_system->getMillis() +_vm->_tickLength;
_screen->copyRegion(0, 136 + i, 80, 16, 160, 56 - i, 2, 0, Screen::CR_NO_P_CHECK);
_screen->copyRegion(160, 0, 80, 72 - i, 160, 96 + i, 2, 0, Screen::CR_NO_P_CHECK);
_screen->updateScreen();
- delayUntil(end);
+ _vm->delayUntil(end);
}
- for (int i = 1; i < 48 && !shouldQuit() && !skipFlag(); i++) {
- uint32 end = _system->getMillis() + _tickLength;
+ for (int i = 1; i < 48 && !_vm->shouldQuit() && !_vm->skipFlag(); i++) {
+ uint32 end = _vm->_system->getMillis() + _vm->_tickLength;
_screen->copyRegion(160, i, 80, 16, 160, 152, 2, 0, Screen::CR_NO_P_CHECK);
_screen->updateScreen();
- delayUntil(end);
+ _vm->delayUntil(end);
}
- _screen->loadBitmap(_introFilesWdExit[3], 3, 5, 0);
- _screen->copyPage(5, 2);
- delay(30 * _tickLength);
+ _screen->loadBitmap(_filesWdExit[3], 3, 5, 0);
+ _screen->convertPage(5, 2, _vm->_cgaMappingAlt);
+ _vm->delay(30 * _vm->_tickLength);
_screen->setCurPage(0);
_screen->fillRect(0, 16, 319, 31, 12);
_screen->fillRect(0, 136, 319, 199, 12);
_screen->copyRegion(0, 0, 80, 32, 160, 120, 2, 0, Screen::CR_NO_P_CHECK);
- loadSetIntroPalette(_introFilesWdExit[4]);
+ loadAndSetPalette(_filesWdExit[4]);
_screen->updateScreen();
- delay(50 * _tickLength);
+ _vm->delay(50 * _vm->_tickLength);
}
-void EoBEngine::seq_tunnel() {
- if (shouldQuit() || skipFlag())
+void EoBIntroPlayer::tunnel() {
+ if (_vm->shouldQuit() || _vm->skipFlag())
return;
_screen->setCurPage(4);
- uint8 *shp2 = _screen->encodeShape(20, 0, 20, 120, true);
- uint8 *shp1 = _screen->encodeShape(0, 0, 20, 120, true);
- drawBlockObject(1, 4, shp2, 160, 0, 0);
- drawBlockObject(1, 4, shp1, 0, 0, 0);
+ uint8 *shp2 = _screen->encodeShape(20, 0, 20, 120, true, _vm->_cgaMappingAlt);
+ uint8 *shp1 = _screen->encodeShape(0, 0, 20, 120, true, _vm->_cgaMappingAlt);
+ _vm->drawBlockObject(1, 4, shp2, 160, 0, 0);
+ _vm->drawBlockObject(1, 4, shp1, 0, 0, 0);
delete[] shp1;
delete[] shp2;
- for (int i = 0; i < 3 && !shouldQuit() && !skipFlag(); i++) {
- uint32 end = _system->getMillis() + 8 * _tickLength;
+ for (int i = 0; i < 3 && !_vm->shouldQuit() && !_vm->skipFlag(); i++) {
+ uint32 end = _vm->_system->getMillis() + 8 * _vm->_tickLength;
_screen->copyRegion(0, 0, 80, 32, 160, 120, 4, 0, Screen::CR_NO_P_CHECK);
- snd_playSoundEffect(7);
+ _vm->snd_playSoundEffect(7);
_screen->updateScreen();
- delayUntil(end);
+ _vm->delayUntil(end);
_screen->copyRegion(0, 0, 80, 32, 160, 120, 2, 0, Screen::CR_NO_P_CHECK);
- snd_playSoundEffect(7);
- end = _system->getMillis() + 8 * _tickLength;
+ _vm->snd_playSoundEffect(7);
+ end = _vm->_system->getMillis() + 8 * _vm->_tickLength;
_screen->updateScreen();
- delayUntil(end);
+ _vm->delayUntil(end);
}
_screen->copyRegion(0, 160, 0, 184, 320, 16, 6, 0, Screen::CR_NO_P_CHECK);
_screen->updateScreen();
- delay(18 * _tickLength);
+ _vm->delay(18 * _vm->_tickLength);
_screen->copyRegion(160, 0, 80, 32, 160, 120, 2, 0, Screen::CR_NO_P_CHECK);
_screen->updateScreen();
- delay(5 * _tickLength);
+ _vm->delay(5 * _vm->_tickLength);
_screen->copyRegion(0, 122, 80, 32, 160, 60, 2, 0, Screen::CR_NO_P_CHECK);
_screen->copyRegion(160, 122, 80, 92, 160, 60, 2, 0, Screen::CR_NO_P_CHECK);
_screen->updateScreen();
- delay(5 * _tickLength);
+ _vm->delay(5 * _vm->_tickLength);
_screen->copyRegion(160, 0, 80, 32, 160, 120, 4, 0, Screen::CR_NO_P_CHECK);
for (int i = 0; i < 6; i++)
_screen->copyRegion(i * 48, 185, 56, (i << 3) + 24, 48, 8, 2, 2, Screen::CR_NO_P_CHECK);
_screen->updateScreen();
- delay(5 * _tickLength);
+ _vm->delay(5 * _vm->_tickLength);
_screen->copyRegion(0, 0, 80, 32, 160, 120, 2, 0, Screen::CR_NO_P_CHECK);
- _screen->loadBitmap(_introFilesTunnel[0], 5, 3, 0);
- _screen->copyPage(3, 4);
+ _screen->loadBitmap(_filesTunnel[0], 5, 3, 0);
+ _screen->convertPage(3, 4, _vm->_cgaMappingAlt);
_screen->updateScreen();
- delay(40 * _tickLength);
+ _vm->delay(40 * _vm->_tickLength);
_screen->copyRegion(264, 0, 136, 56, 48, 48, 4, 0, Screen::CR_NO_P_CHECK);
- snd_playSoundEffect(8);
+ _vm->snd_playSoundEffect(8);
_screen->copyRegion(0, 0, 0, 0, 320, 184, 0, 2, Screen::CR_NO_P_CHECK);
_screen->updateScreen();
- delay(16 * _tickLength);
- snd_playSoundEffect(4);
+ _vm->delay(16 * _vm->_tickLength);
+ _vm->snd_playSoundEffect(4);
- for (int i = 0; i < 30 && !shouldQuit() && !skipFlag(); i++) {
- uint32 end = _system->getMillis() + _tickLength;
+ for (int i = 0; i < 30 && !_vm->shouldQuit() && !_vm->skipFlag(); i++) {
+ uint32 end = _vm->_system->getMillis() + _vm->_tickLength;
if (i == 0)
_screen->fillRect(0, 168, 319, 199, 12, 0);
- _screen->copyRegion(80, 25 + (_rnd.getRandomNumber(255) & 7), 80, 24, 160, 144, 2, 0, Screen::CR_NO_P_CHECK);
+ _screen->copyRegion(80, 25 + (_vm->_rnd.getRandomNumber(255) & 7), 80, 24, 160, 144, 2, 0, Screen::CR_NO_P_CHECK);
_screen->updateScreen();
- delayUntil(end);
+ _vm->delayUntil(end);
}
- snd_playSoundEffect(9);
+ _vm->snd_playSoundEffect(9);
- for (int i = 0; i < 6 && !shouldQuit() && !skipFlag(); i++) {
- uint32 end = _system->getMillis() + _tickLength;
- _screen->copyRegion(_introTvlX1[i] << 3, _introTvlY1[i], _introTvlX2[i] << 3, _introTvlY2[i], _introTvlW[i] << 3, _introTvlH[i], 4, 2, Screen::CR_NO_P_CHECK);
- for (int ii = 0; ii < 4 && !shouldQuit() && !skipFlag(); ii++) {
+ for (int i = 0; i < 6 && !_vm->shouldQuit() && !_vm->skipFlag(); i++) {
+ uint32 end = _vm->_system->getMillis() + _vm->_tickLength;
+ _screen->copyRegion(_tvlX1[i] << 3, _tvlY1[i], _tvlX2[i] << 3, _tvlY2[i], _tvlW[i] << 3, _tvlH[i], 4, 2, Screen::CR_NO_P_CHECK);
+ for (int ii = 0; ii < 4 && !_vm->shouldQuit() && !_vm->skipFlag(); ii++) {
_screen->updateScreen();
- delayUntil(end);
- end = _system->getMillis() + _tickLength;
- _screen->copyRegion(80, 25 + (_rnd.getRandomNumber(255) & 7), 80, 24, 160, 144, 2, 0, Screen::CR_NO_P_CHECK);
+ _vm->delayUntil(end);
+ end = _vm->_system->getMillis() + _vm->_tickLength;
+ _screen->copyRegion(80, 25 + (_vm->_rnd.getRandomNumber(255) & 7), 80, 24, 160, 144, 2, 0, Screen::CR_NO_P_CHECK);
}
}
_screen->copyRegion(0, 0, 0, 0, 320, 168, 2, 0, Screen::CR_NO_P_CHECK);
_screen->updateScreen();
- delay(40 * _tickLength);
+ _vm->delay(40 * _vm->_tickLength);
- _screen->loadBitmap(_introFilesTunnel[1], 5, 3, 0);
- _screen->copyPage(3, 4);
- snd_playSoundEffect(6);
+ _screen->loadBitmap(_filesTunnel[1], 5, 3, 0);
+ _screen->convertPage(3, 4, _vm->_cgaMappingAlt);
+ _vm->snd_playSoundEffect(6);
_screen->copyRegion(0, 0, 80, 32, 160, 120, 4, 0, Screen::CR_NO_P_CHECK);
_screen->updateScreen();
- delay(2 * _tickLength);
+ _vm->delay(2 * _vm->_tickLength);
_screen->copyRegion(160, 0, 80, 32, 160, 120, 4, 0, Screen::CR_NO_P_CHECK);
_screen->updateScreen();
- delay(2 * _tickLength);
+ _vm->delay(2 * _vm->_tickLength);
_screen->copyRegion(0, 120, 80, 30, 160, 64, 4, 0, Screen::CR_NO_P_CHECK);
_screen->copyRegion(160, 120, 80, 94, 160, 64, 4, 0, Screen::CR_NO_P_CHECK);
_screen->copyRegion(0, 176, 0, 184, 320, 16, 6, 0, Screen::CR_NO_P_CHECK);
_screen->setCurPage(0);
_screen->updateScreen();
- delay(50 * _tickLength);
-}
-
-void EoBEngine::seq_xdeath() {
- uint8 *shapes1[5];
- uint8 *shapes2;
-
- _screen->loadShapeSetBitmap("XDEATH2", 5, 3);
- for (int i = 0; i < 4; i++)
- shapes1[i] = _screen->encodeShape(i / 2 * 14, i / 2 * 88, 14, 88, true);
- _screen->loadShapeSetBitmap("XDEATH3", 5, 3);
- shapes2 = _screen->encodeShape(22, 0, 16, 95, true);
- _screen->loadEoBBitmap("XDEATH1", 0, 5, 3, -1);
- _screen->setCurPage(0);
-
- for (int i = 0; i < 10; i++) {
- if (i == 2)
- snd_playSoundEffect(72);
- else if (i == 4 || i == 6)
- snd_playSoundEffect(54);
- else
- snd_playSoundEffect(34);
-
- if (i < 6) {
- _screen->copyRegion((i % 3) * 104, i / 3 * 88, 32, 10, 104, 88, 2, 0, Screen::CR_NO_P_CHECK);
- } else {
- snd_playSoundEffect(42);
- _screen->drawShape(0, shapes1[i - 6], 32, 10, 0);
- }
-
- _screen->updateScreen();
- delay(4 * _tickLength);
- }
-
- const ScreenDim *dm = _screen->getScreenDim(5);
- _screen->modifyScreenDim(5, dm->sx, 8, dm->w, dm->h);
- _screen->copyRegion(0, 0, 0, 0, 176, 120, 0, 5, Screen::CR_NO_P_CHECK);
-
- for (int i = 0; i < 19; i++) {
- snd_playSoundEffect(119);
- _screen->copyRegion(0, 0, 0, 0, 176, 120, 5, 2, Screen::CR_NO_P_CHECK);
- _screen->drawShape(2, shapes2, 24, i * 5 - 90, 5);
- _screen->copyRegion(0, 0, 0, 0, 176, 120, 2, 0, Screen::CR_NO_P_CHECK);
- _screen->updateScreen();
- delay(2 * _tickLength);
- }
-
- _screen->modifyScreenDim(5, dm->sx, 0, dm->w, dm->h);
-
- snd_playSoundEffect(5);
- delay(60 * _tickLength);
-
- for (int i = 0; i < 4; i++)
- delete[] shapes1[i];
- delete[] shapes2;
-
- gui_drawPlayField(false);
- gui_drawAllCharPortraitsWithStats();
+ _vm->delay(50 * _vm->_tickLength);
}
-void EoBEngine::loadSetIntroPalette(const char *filename) {
+void EoBIntroPlayer::loadAndSetPalette(const char *filename) {
+ if (_vm->_configRenderMode == Common::kRenderCGA || _vm->_configRenderMode == Common::kRenderEGA)
+ return;
_screen->loadPalette(filename, _screen->getPalette(0));
_screen->getPalette(0).fill(0, 1, 0);
_screen->setScreenPalette(_screen->getPalette(0));
}
-void EoBEngine::copyBlurRegion(int x1, int y1, int x2, int y2, int w, int h, int step) {
+void EoBIntroPlayer::copyBlurRegion(int x1, int y1, int x2, int y2, int w, int h, int step) {
const uint8 *ptr2 = _screen->getCPagePtr(3) + y1 * 320 + x1;
if (step == 1) {
@@ -991,7 +896,7 @@ void EoBEngine::copyBlurRegion(int x1, int y1, int x2, int y2, int w, int h, int
}
}
-void EoBEngine::boxMorphTransition(int targetDestX, int targetDestY, int targetFinalX, int targetFinalY, int targetSrcX, int targetSrcY, int targetFinalW, int targetFinalH, int originX1, int originY1, int originW, int originH) {
+void EoBIntroPlayer::boxMorphTransition(int targetDestX, int targetDestY, int targetFinalX, int targetFinalY, int targetSrcX, int targetSrcY, int targetFinalW, int targetFinalH, int originX1, int originY1, int originW, int originH) {
int originX2 = originX1 + originW;
int originY2 = originY1 + originH;
if (originY2 > 21)
@@ -999,8 +904,8 @@ void EoBEngine::boxMorphTransition(int targetDestX, int targetDestY, int targetF
int w = 1;
int h = 1;
- for (bool runloop = true; runloop && !shouldQuit() && !skipFlag();) {
- uint32 end = _system->getMillis() + _tickLength;
+ for (bool runloop = true; runloop && !_vm->shouldQuit() && !_vm->skipFlag();) {
+ uint32 end = _vm->_system->getMillis() + _vm->_tickLength;
_screen->copyRegion(targetSrcX << 3, targetSrcY << 3, targetDestX << 3, targetDestY << 3, w << 3, h << 3, 2, 0, Screen::CR_NO_P_CHECK);
if (originX1 < targetDestX)
_screen->copyRegion(312, 0, originX1 << 3, 0, 8, 176, 0, 0, Screen::CR_NO_P_CHECK);
@@ -1044,14 +949,14 @@ void EoBEngine::boxMorphTransition(int targetDestX, int targetDestY, int targetF
originY2--;
_screen->updateScreen();
- delayUntil(end);
+ _vm->delayUntil(end);
}
}
-void EoBEngine::whirlTransition() {
+void EoBIntroPlayer::whirlTransition() {
for (int i = 0; i < 2; i++) {
for (int ii = 0; ii < 8; ii++) {
- uint32 e = _system->getMillis() + 3;
+ uint32 e = _vm->_system->getMillis() + 3;
if (ii & 1) {
for (int iii = i + ii; iii < 320; iii += 8)
_screen->drawClippedLine(iii, 0, iii, 199, 12);
@@ -1060,13 +965,188 @@ void EoBEngine::whirlTransition() {
_screen->drawClippedLine(0, iii, 319, iii, 12);
}
_screen->updateScreen();
- uint32 c = _system->getMillis();
+ uint32 c = _vm->_system->getMillis();
if (e > c)
- _system->delayMillis(e - c);
+ _vm->_system->delayMillis(e - c);
}
}
}
+int EoBEngine::mainMenu() {
+ int menuChoice = _menuChoiceInit;
+ _menuChoiceInit = 0;
+
+ Screen::FontId of = _screen->_currentFont;
+
+ while (menuChoice >= 0 && !shouldQuit()) {
+ switch (menuChoice) {
+ case 0: {
+ if (_configRenderMode != Common::kRenderEGA)
+ _screen->loadPalette("EOBPAL.COL", _screen->getPalette(0));
+ _screen->loadEoBBitmap("INTRO", _cgaMappingDefault, 5, 3, 2);
+ _screen->setScreenPalette(_screen->getPalette(0));
+ _screen->_curPage = 2;
+ of = _screen->setFont(Screen::FID_6_FNT);
+ Common::String versionString(Common::String::format("ScummVM %s", gScummVMVersion));
+ _screen->printText(versionString.c_str(), 280 - versionString.size() * 6, 153, _screen->getPagePixel(2, 0, 0), 0);
+ _screen->setFont(of);
+ _screen->fillRect(0, 159, 319, 199, _screen->getPagePixel(2, 0, 0));
+ gui_drawBox(77, 165, 173, 29, 14, 13, 12);
+ gui_drawBox(76, 164, 175, 31, 14, 13, -1);
+ _screen->_curPage = 0;
+ _screen->copyRegion(0, 0, 0, 0, 320, 200, 2, 0, Screen::CR_NO_P_CHECK);
+ _screen->updateScreen();
+ _allowImport = true;
+ menuChoice = mainMenuLoop();
+ _allowImport = false;
+ } break;
+
+ case 1:
+ // load game in progress
+ menuChoice = -1;
+ break;
+
+ case 2:
+ // create new party
+ menuChoice = -2;
+ break;
+
+ case 3:
+ // quit
+ menuChoice = -5;
+ break;
+
+ case 4:
+ // intro
+ _sound->loadSoundFile("SOUND");
+ _screen->hideMouse();
+ seq_playIntro();
+ _screen->showMouse();
+ _sound->loadSoundFile("ADLIB");
+ menuChoice = 0;
+ break;
+ }
+ }
+
+ return shouldQuit() ? -5 : menuChoice;
+}
+
+int EoBEngine::mainMenuLoop() {
+ int sel = -1;
+ do {
+ _screen->setScreenDim(28);
+ _gui->simpleMenu_setup(8, 0, _mainMenuStrings, -1, 0, 0);
+
+ while (sel == -1 && !shouldQuit())
+ sel = _gui->simpleMenu_process(8, _mainMenuStrings, 0, -1, 0);
+ } while ((sel < 0 || sel > 5) && !shouldQuit());
+
+ return sel + 1;
+}
+
+void EoBEngine::seq_playIntro() {
+ EoBIntroPlayer(this, _screen).start();
+}
+
+void EoBEngine::seq_playFinale() {
+ Common::SeekableReadStream *s = _res->createReadStream("TEXT.DAT");
+ _screen->loadFileDataToPage(s, 5, 32000);
+ delete s;
+
+ snd_playSoundEffect(20);
+
+ _txt->resetPageBreakString();
+ _txt->setWaitButtonMode(1);
+ _txt->setupField(12, true);
+ gui_drawBox(0, 0, 176, 175, guiSettings()->colors.frame1, guiSettings()->colors.frame2, guiSettings()->colors.fill);
+ _txt->printDialogueText(51, _moreStrings[0]);
+
+ if (!checkScriptFlags(0x1ffe)) {
+ _screen->fadeToBlack();
+ return;
+ }
+
+ _txt->printDialogueText(_finBonusStrings[0]);
+ for (int i = 0; i < 6; i++) {
+ _txt->printDialogueText(_finBonusStrings[1]);
+ if (_characters[i].flags & 1)
+ _txt->printDialogueText(_characters[i].name);
+ }
+
+ uint32 password = 0;
+ for (int i = 0; i < 4; i++) {
+ if (!(_characters[i].flags & 1))
+ continue;
+
+ int len = strlen(_characters[i].name);
+ for (int ii = 0; ii < len; ii++) {
+ uint32 c = _characters[i].name[ii];
+ password += (c * c);
+ }
+ }
+
+ _txt->printDialogueText(Common::String::format(_finBonusStrings[2], password).c_str(), true);
+ _screen->fadeToBlack();
+}
+
+void EoBEngine::seq_xdeath() {
+ uint8 *shapes1[5];
+ uint8 *shapes2;
+
+ _screen->loadShapeSetBitmap("XDEATH2", 5, 3);
+ for (int i = 0; i < 4; i++)
+ shapes1[i] = _screen->encodeShape(i / 2 * 14, i / 2 * 88, 14, 88, true, _cgaMappingDefault);
+ _screen->loadShapeSetBitmap("XDEATH3", 5, 3);
+ shapes2 = _screen->encodeShape(22, 0, 16, 95, true, _cgaMappingDefault);
+ _screen->loadEoBBitmap("XDEATH1", _cgaMappingDefault, 5, 3, -1);
+ _screen->convertPage(3, 2, _cgaMappingDefault);
+ _screen->setCurPage(0);
+
+ for (int i = 0; i < 10; i++) {
+ if (i == 2)
+ snd_playSoundEffect(72);
+ else if (i == 4 || i == 6)
+ snd_playSoundEffect(54);
+ else
+ snd_playSoundEffect(34);
+
+ if (i < 6) {
+ _screen->copyRegion((i % 3) * 104, i / 3 * 88, 32, 10, 104, 88, 2, 0, Screen::CR_NO_P_CHECK);
+ } else {
+ snd_playSoundEffect(42);
+ _screen->drawShape(0, shapes1[i - 6], 32, 10, 0);
+ }
+
+ _screen->updateScreen();
+ delay(4 * _tickLength);
+ }
+
+ const ScreenDim *dm = _screen->getScreenDim(5);
+ _screen->modifyScreenDim(5, dm->sx, 8, dm->w, dm->h);
+ _screen->copyRegion(0, 0, 0, 0, 176, 120, 0, 5, Screen::CR_NO_P_CHECK);
+
+ for (int i = 0; i < 19; i++) {
+ snd_playSoundEffect(119);
+ _screen->copyRegion(0, 0, 0, 0, 176, 120, 5, 2, Screen::CR_NO_P_CHECK);
+ _screen->drawShape(2, shapes2, 24, i * 5 - 90, 5);
+ _screen->copyRegion(0, 0, 0, 0, 176, 120, 2, 0, Screen::CR_NO_P_CHECK);
+ _screen->updateScreen();
+ delay(2 * _tickLength);
+ }
+
+ _screen->modifyScreenDim(5, dm->sx, 0, dm->w, dm->h);
+
+ snd_playSoundEffect(5);
+ delay(60 * _tickLength);
+
+ for (int i = 0; i < 4; i++)
+ delete[] shapes1[i];
+ delete[] shapes2;
+
+ gui_drawPlayField(false);
+ gui_drawAllCharPortraitsWithStats();
+}
+
} // End of namespace Kyra
#endif // ENABLE_EOB
diff --git a/engines/kyra/sequences_hof.cpp b/engines/kyra/sequences_hof.cpp
index b27f0df137..686c3c9320 100644
--- a/engines/kyra/sequences_hof.cpp
+++ b/engines/kyra/sequences_hof.cpp
@@ -234,6 +234,8 @@ void KyraEngine_HoF::seq_playSequences(int startSeq, int endSeq) {
int32 dly = _tickLength - (now - _seqSubFrameStartTime);
if (dly > 0)
delay(MIN<uint32>(dly, tdiff));
+ else
+ updateInput();
}
}
@@ -263,6 +265,8 @@ void KyraEngine_HoF::seq_playSequences(int startSeq, int endSeq) {
int32 dly = _tickLength - (now - _seqSubFrameStartTime);
if (dly > 0)
delay(MIN<uint32>(dly, tdiff));
+ else
+ updateInput();
}
seq_sequenceCommand(cseq.finalCommand);
@@ -2773,15 +2777,15 @@ void KyraEngine_HoF::seq_init() {
return;
if (_flags.isDemo && !_flags.isTalkie) {
- _demoAnimData = _staticres->loadShapeAnimData_v1(k2SeqplayShapeAnimData, _itemAnimDataSize);
+ _demoAnimData = _staticres->loadShapeAnimData_v1(k2SeqplayShapeAnimData, _itemAnimDefinitionSize);
uint8 *shp = _res->fileData("icons.shp", 0);
uint32 outsize = READ_LE_UINT16(shp + 4);
_animShapeFiledata = new uint8[outsize];
Screen::decodeFrame4(shp + 10, _animShapeFiledata, outsize);
delete[] shp;
- for (int numShp = 0; getShapePtr(numShp); ++numShp)
- addShapeToPool(_screen->getPtrToShape(_animShapeFiledata, numShp), numShp);
+ for (int i = 0; i < 20; i++)
+ addShapeToPool(_screen->getPtrToShape(_animShapeFiledata, i), i);
} else {
const MainMenu::StaticData data = {
{ _sequenceStrings[97], _sequenceStrings[96], _sequenceStrings[95], _sequenceStrings[98], 0 },
diff --git a/engines/kyra/sprites_eob.cpp b/engines/kyra/sprites_eob.cpp
index dd49735271..5c679f5cb4 100644
--- a/engines/kyra/sprites_eob.cpp
+++ b/engines/kyra/sprites_eob.cpp
@@ -37,7 +37,7 @@ void EoBCoreEngine::loadMonsterShapes(const char *filename, int monsterIndex, bo
const uint16 *enc = &_encodeMonsterShpTable[encodeTableIndex << 2];
for (int i = 0; i < 6; i++, enc += 4)
- _monsterShapes[monsterIndex + i] = _screen->encodeShape(enc[0], enc[1], enc[2], enc[3]);
+ _monsterShapes[monsterIndex + i] = _screen->encodeShape(enc[0], enc[1], enc[2], enc[3], false, _cgaMappingDefault);
generateMonsterPalettes(filename, monsterIndex);
@@ -75,7 +75,7 @@ const uint8 *EoBCoreEngine::loadMonsterProperties(const uint8 *data) {
d->dmgDc[1].base = (int8)*data++;
d->dmgDc[2].times = *data++;
d->dmgDc[2].pips = *data++;
- d->dmgDc[3].base = (int8)*data++;
+ d->dmgDc[2].base = (int8)*data++;
d->immunityFlags = READ_LE_UINT16(data);
data += 2;
d->capsFlags = READ_LE_UINT16(data);
@@ -335,6 +335,8 @@ const int16 *EoBCoreEngine::findBlockMonsters(uint16 block, int pos, int dir, in
void EoBCoreEngine::drawBlockObject(int flipped, int page, const uint8 *shape, int x, int y, int sd, uint8 *ovl) {
const ScreenDim *d = _screen->getScreenDim(sd);
+ if (_flags.gameID == GI_EOB1)
+ x &= ~1;
_screen->drawShape(page, shape, x - (d->sx << 3), y - d->sy, sd, flipped | (ovl ? 2 : 0), ovl);
}
@@ -342,9 +344,9 @@ void EoBCoreEngine::drawMonsterShape(const uint8 *shape, int x, int y, int flipp
uint8 *ovl = 0;
if (flags & 2)
- ovl = _monsterOvl1;
+ ovl = _monsterFlashOverlay;
else if (_flags.gameID == GI_EOB2 && flags & 0x20)
- ovl = _monsterOvl2;
+ ovl = _monsterStoneOverlay;
else if (palIndex != -1)
ovl = _monsterPalettes[palIndex];
@@ -462,7 +464,7 @@ void EoBCoreEngine::drawDoor(int index) {
int16 y1 = 0;
int16 y2 = 0;
- scaleLevelShapesDim(index, y1, y2, 5);
+ setDoorShapeDim(index, y1, y2, 5);
drawDoorIntern(type, index, x, y, w, s, d, y1, y2);
drawLevelModifyScreenDim(5, _shpDmX1, 0, _shpDmX2, 15);
}
diff --git a/engines/kyra/staticres.cpp b/engines/kyra/staticres.cpp
index 6c95451c5f..423b827092 100644
--- a/engines/kyra/staticres.cpp
+++ b/engines/kyra/staticres.cpp
@@ -38,7 +38,7 @@
namespace Kyra {
-#define RESFILE_VERSION 80
+#define RESFILE_VERSION 82
namespace {
bool checkKyraDat(Common::SeekableReadStream *file) {
@@ -247,7 +247,7 @@ bool StaticResource::init() {
{ k2SeqData, proc(loadHofSequenceData), proc(freeHofSequenceData) },
{ k2ShpAnimDataV1, proc(loadShapeAnimData_v1), proc(freeHofShapeAnimDataV1) },
- { k2ShpAnimDataV2, proc(loadShapeAnimData_v2), proc(freeHofShapeAnimDataV2) },
+ { k2ItemAnimDefinition, proc(loadItemAnimDefinition), proc(freeItemAnimDefinition) },
#ifdef ENABLE_LOL
{ kLoLCharData, proc(loadCharData), proc(freeCharData) },
@@ -316,8 +316,8 @@ const ItemAnimData_v1 *StaticResource::loadShapeAnimData_v1(int id, int &entries
return (const ItemAnimData_v1 *)getData(id, k2ShpAnimDataV1, entries);
}
-const ItemAnimData_v2 *StaticResource::loadShapeAnimData_v2(int id, int &entries) {
- return (const ItemAnimData_v2 *)getData(id, k2ShpAnimDataV2, entries);
+const ItemAnimDefinition *StaticResource::loadItemAnimDefinition(int id, int &entries) {
+ return (const ItemAnimDefinition *)getData(id, k2ItemAnimDefinition, entries);
}
bool StaticResource::prefetchId(int id) {
@@ -610,9 +610,9 @@ bool StaticResource::loadShapeAnimData_v1(Common::SeekableReadStream &stream, vo
return true;
}
-bool StaticResource::loadShapeAnimData_v2(Common::SeekableReadStream &stream, void *&ptr, int &size) {
+bool StaticResource::loadItemAnimDefinition(Common::SeekableReadStream &stream, void *&ptr, int &size) {
size = stream.readByte();
- ItemAnimData_v2 *loadTo = new ItemAnimData_v2[size];
+ ItemAnimDefinition *loadTo = new ItemAnimDefinition[size];
assert(loadTo);
for (int i = 0; i < size; i++) {
@@ -699,8 +699,8 @@ void StaticResource::freeHofShapeAnimDataV1(void *&ptr, int &size) {
size = 0;
}
-void StaticResource::freeHofShapeAnimDataV2(void *&ptr, int &size) {
- ItemAnimData_v2 *d = (ItemAnimData_v2 *)ptr;
+void StaticResource::freeItemAnimDefinition(void *&ptr, int &size) {
+ ItemAnimDefinition *d = (ItemAnimDefinition *)ptr;
for (int i = 0; i < size; i++)
delete[] d[i].frames;
delete[] d;
@@ -1007,7 +1007,7 @@ void KyraEngine_HoF::initStaticResource() {
_cdaTrackTableFinale = _staticres->loadRawData(k2SeqplayFinaleCDA, _cdaTrackTableFinaleSize);
_ingameTalkObjIndex = (const uint16 *)_staticres->loadRawData(k2IngameTalkObjIndex, _ingameTalkObjIndexSize);
_ingameTimJpStr = _staticres->loadStrings(k2IngameTimJpStrings, _ingameTimJpStrSize);
- _itemAnimData = _staticres->loadShapeAnimData_v2(k2IngameShapeAnimData, _itemAnimDataSize);
+ _itemAnimDefinition = _staticres->loadItemAnimDefinition(k2IngameShapeAnimData, _itemAnimDefinitionSize);
// replace sequence talkie files with localized versions
const char *const *seqSoundList = _staticres->loadStrings(k2SeqplaySfxFiles, _sequenceSoundListSize);
@@ -1143,7 +1143,7 @@ void KyraEngine_MR::initStaticResource() {
_scoreTable = _staticres->loadRawData(k3ScoreTable, _scoreTableSize);
_sfxFileList = _staticres->loadStrings(k3SfxFiles, _sfxFileListSize);
_sfxFileMap = _staticres->loadRawData(k3SfxMap, _sfxFileMapSize);
- _itemAnimData = _staticres->loadShapeAnimData_v2(k3ItemAnimData, tmp);
+ _itemAnimDefinition = _staticres->loadItemAnimDefinition(k3ItemAnimData, tmp);
_itemMagicTable = _staticres->loadRawData(k3ItemMagicTable, tmp);
_itemStringMap = _staticres->loadRawData(k3ItemStringMap, _itemStringMapSize);
}
diff --git a/engines/kyra/staticres_eob.cpp b/engines/kyra/staticres_eob.cpp
index ce43d22362..7a5012f117 100644
--- a/engines/kyra/staticres_eob.cpp
+++ b/engines/kyra/staticres_eob.cpp
@@ -28,12 +28,12 @@
namespace Kyra {
#ifdef ENABLE_EOB
-const EoBSequenceStep *StaticResource::loadEoB2SeqData(int id, int &entries) {
- return (const EoBSequenceStep *)getData(id, kEoB2SequenceData, entries);
+const DarkMoonAnimCommand *StaticResource::loadEoB2SeqData(int id, int &entries) {
+ return (const DarkMoonAnimCommand *)getData(id, kEoB2SequenceData, entries);
}
-const EoBShapeDef *StaticResource::loadEoB2ShapeData(int id, int &entries) {
- return (const EoBShapeDef *)getData(id, kEoB2ShapeData, entries);
+const DarkMoonShapeDef *StaticResource::loadEoB2ShapeData(int id, int &entries) {
+ return (const DarkMoonShapeDef *)getData(id, kEoB2ShapeData, entries);
}
const EoBCharacter *StaticResource::loadEoBNpcData(int id, int &entries) {
@@ -43,7 +43,7 @@ const EoBCharacter *StaticResource::loadEoBNpcData(int id, int &entries) {
bool StaticResource::loadEoB2SeqData(Common::SeekableReadStream &stream, void *&ptr, int &size) {
size = stream.size() / 11;
- EoBSequenceStep *s = new EoBSequenceStep[size];
+ DarkMoonAnimCommand *s = new DarkMoonAnimCommand[size];
for (int i = 0; i < size; i++) {
s[i].command = stream.readByte();
@@ -65,7 +65,7 @@ bool StaticResource::loadEoB2SeqData(Common::SeekableReadStream &stream, void *&
bool StaticResource::loadEoB2ShapeData(Common::SeekableReadStream &stream, void *&ptr, int &size) {
size = stream.size() / 6;
- EoBShapeDef *s = new EoBShapeDef[size];
+ DarkMoonShapeDef *s = new DarkMoonShapeDef[size];
for (int i = 0; i < size; i++) {
s[i].index = stream.readSint16BE();
@@ -127,14 +127,14 @@ bool StaticResource::loadEoBNpcData(Common::SeekableReadStream &stream, void *&p
}
void StaticResource::freeEoB2SeqData(void *&ptr, int &size) {
- EoBSequenceStep *d = (EoBSequenceStep *)ptr;
+ DarkMoonAnimCommand *d = (DarkMoonAnimCommand *)ptr;
delete[] d;
ptr = 0;
size = 0;
}
void StaticResource::freeEoB2ShapeData(void *&ptr, int &size) {
- EoBShapeDef *d = (EoBShapeDef *)ptr;
+ DarkMoonShapeDef *d = (DarkMoonShapeDef *)ptr;
delete[] d;
ptr = 0;
size = 0;
@@ -198,6 +198,10 @@ const uint8 EoBCoreEngine::_charClassModifier[] = {
0x00, 0x00, 0x02
};
+const uint8 EoBCoreEngine::_itemsOverlayCGA[] = {
+ 0x00, 0x55, 0x55, 0xFF
+};
+
const uint8 EoBCoreEngine::_teleporterShapeDefs[] = {
0x0C, 0x58, 0x02, 0x0E,
0x0C, 0x67, 0x01, 0x07,
@@ -369,13 +373,13 @@ void EoBCoreEngine::initStaticResource() {
_mnWord = _staticres->loadStrings(kEoBBaseManWord, _mnNumWord);
_mnPrompt = _staticres->loadStrings(kEoBBaseManPrompt, temp);
- _monsterStepTable0 = (int8 *)_staticres->loadRawData(_flags.gameID == GI_EOB2 ? kEoBBaseMonsterStepTable02 : kEoBBaseMonsterStepTable01, temp);
- _monsterStepTable1 = (int8 *)_staticres->loadRawData(kEoBBaseMonsterStepTable1, temp);
- _monsterStepTable2 = (int8 *)_staticres->loadRawData(kEoBBaseMonsterStepTable2, temp);
- _monsterStepTable3 = (int8 *)_staticres->loadRawData(kEoBBaseMonsterStepTable3, temp);
+ _monsterStepTable0 = (const int8 *)_staticres->loadRawData(_flags.gameID == GI_EOB2 ? kEoBBaseMonsterStepTable02 : kEoBBaseMonsterStepTable01, temp);
+ _monsterStepTable1 = (const int8 *)_staticres->loadRawData(kEoBBaseMonsterStepTable1, temp);
+ _monsterStepTable2 = (const int8 *)_staticres->loadRawData(kEoBBaseMonsterStepTable2, temp);
+ _monsterStepTable3 = (const int8 *)_staticres->loadRawData(kEoBBaseMonsterStepTable3, temp);
_monsterCloseAttPosTable1 = _staticres->loadRawData(kEoBBaseMonsterCloseAttPosTable1, temp);
_monsterCloseAttPosTable2 = _staticres->loadRawData(_flags.gameID == GI_EOB2 ? kEoBBaseMonsterCloseAttPosTable22 : kEoBBaseMonsterCloseAttPosTable21, temp);
- _monsterCloseAttUnkTable = (int8 *)_staticres->loadRawData(kEoBBaseMonsterCloseAttUnkTable, temp);
+ _monsterCloseAttUnkTable = (const int8 *)_staticres->loadRawData(kEoBBaseMonsterCloseAttUnkTable, temp);
_monsterCloseAttChkTable1 = _staticres->loadRawData(kEoBBaseMonsterCloseAttChkTable1, temp);
_monsterCloseAttChkTable2 = _staticres->loadRawData(kEoBBaseMonsterCloseAttChkTable2, temp);
_monsterCloseAttDstTable1 = _staticres->loadRawData(kEoBBaseMonsterCloseAttDstTable1, temp);
@@ -1016,27 +1020,6 @@ void EoBEngine::initStaticResource() {
_mainMenuStrings = _staticres->loadStrings(kEoB1MainMenuStrings, temp);
_finBonusStrings = _staticres->loadStrings(kEoB1BonusStrings, temp);
- _introFilesOpening = _staticres->loadStrings(kEoB1IntroFilesOpening, temp);
- _introFilesTower = _staticres->loadStrings(kEoB1IntroFilesTower, temp);
- _introFilesOrb = _staticres->loadStrings(kEoB1IntroFilesOrb, temp);
- _introFilesWdEntry = _staticres->loadStrings(kEoB1IntroFilesWdEntry, temp);
- _introFilesKing = _staticres->loadStrings(kEoB1IntroFilesKing, temp);
- _introFilesHands = _staticres->loadStrings(kEoB1IntroFilesHands, temp);
- _introFilesWdExit = _staticres->loadStrings(kEoB1IntroFilesWdExit, temp);
- _introFilesTunnel = _staticres->loadStrings(kEoB1IntroFilesTunnel, temp);
- _introOpeningFrmDelay = _staticres->loadRawData(kEoB1IntroOpeningFrmDelay, temp);
- _introWdEncodeX = _staticres->loadRawData(kEoB1IntroWdEncodeX, temp);
- _introWdEncodeY = _staticres->loadRawData(kEoB1IntroWdEncodeY, temp);
- _introWdEncodeWH = _staticres->loadRawData(kEoB1IntroWdEncodeWH, temp);
- _introWdDsX = _staticres->loadRawDataBe16(kEoB1IntroWdDsX, temp);
- _introWdDsY = _staticres->loadRawData(kEoB1IntroWdDsY, temp);
- _introTvlX1 = _staticres->loadRawData(kEoB1IntroTvlX1, temp);
- _introTvlY1 = _staticres->loadRawData(kEoB1IntroTvlY1, temp);
- _introTvlX2 = _staticres->loadRawData(kEoB1IntroTvlX2, temp);
- _introTvlY2 = _staticres->loadRawData(kEoB1IntroTvlY2, temp);
- _introTvlW = _staticres->loadRawData(kEoB1IntroTvlW, temp);
- _introTvlH = _staticres->loadRawData(kEoB1IntroTvlH, temp);
-
_doorShapeEncodeDefs = _staticres->loadRawData(kEoB1DoorShapeDefs, temp);
_doorSwitchShapeEncodeDefs = _staticres->loadRawData(kEoB1DoorSwitchShapeDefs, temp);
_doorSwitchCoords = _staticres->loadRawData(kEoB1DoorSwitchCoords, temp);
@@ -1056,6 +1039,18 @@ void EoBEngine::initStaticResource() {
_beholderSpellList = _staticres->loadRawData(kEoB1BeholderSpellList, temp);
_beholderSfx = _staticres->loadRawData(kEoB1BeholderSfx, temp);
+ _cgaMappingDefault = _staticres->loadRawData(kEoB1CgaMappingDefault, temp);
+ _cgaMappingAlt = _staticres->loadRawData(kEoB1CgaMappingAlt, temp);
+ _cgaMappingInv = _staticres->loadRawData(kEoB1CgaMappingInv, temp);
+ _cgaMappingItemsL = _staticres->loadRawData(kEoB1CgaMappingItemsL, temp);
+ _cgaMappingItemsS = _staticres->loadRawData(kEoB1CgaMappingItemsS, temp);
+ _cgaMappingThrown = _staticres->loadRawData(kEoB1CgaMappingThrown, temp);
+ _cgaMappingIcons = _staticres->loadRawData(kEoB1CgaMappingIcons, temp);
+ _cgaMappingDeco = _staticres->loadRawData(kEoB1CgaMappingDeco, temp);
+ _cgaLevelMappingIndex = _staticres->loadRawData(kEoB1CgaLevelMappingIndex, temp);
+ for (int i = 0; i < 5; i++)
+ _cgaMappingLevel[i] = _staticres->loadRawData(kEoB1CgaMappingLevel0 + i, temp);
+
_turnUndeadString = _staticres->loadStrings(kEoB1TurnUndeadString, temp);
_npcShpData = _staticres->loadRawData(kEoB1NpcShpData, temp);
@@ -1190,23 +1185,32 @@ void EoBEngine::initSpells() {
}
}
-const KyraRpgGUISettings EoBEngine::_guiSettings = {
+const KyraRpgGUISettings EoBEngine::_guiSettingsVGA = {
{ 9, 15, 95, 9, 7, { 285, 139 }, { 189, 162 }, { 31, 31 } },
{ 135, 130, 132, 133, 133, 17, 23, 20, 184, 177, 180, 184, 177, 180 }
};
+const KyraRpgGUISettings EoBEngine::_guiSettingsEGA = {
+ { 9, 15, 95, 9, 7, { 285, 139 }, { 189, 162 }, { 31, 31 } },
+ { 13, 9, 2, 133, 2, 6, 13, 8, 13, 15, 14, 13, 15, 14 }
+};
+
+const uint8 EoBEngine::_egaDefaultPalette[] = {
+ 0, 5, 3, 2, 10, 14, 12, 6, 4, 11, 9, 1, 0, 8, 7, 15
+};
+
void DarkMoonEngine::initStaticResource() {
int temp;
_mainMenuStrings = _staticres->loadStrings(kEoB2MainMenuStrings, temp);
_introStrings = _staticres->loadStrings(kEoB2IntroStrings, temp);
_cpsFilesIntro = _staticres->loadStrings(kEoB2IntroCPSFiles, temp);
- _seqIntro = new const EoBSequenceStep*[44];
+ _animIntro = new const DarkMoonAnimCommand*[44];
for (int i = 0; i < 44; i++)
- _seqIntro[i] = _staticres->loadEoB2SeqData(kEoB2IntroSeqData00 + i, temp);
+ _animIntro[i] = _staticres->loadEoB2SeqData(kEob2IntroAnimData00 + i, temp);
- _shapesIntro = new const EoBShapeDef*[13];
- memset(_shapesIntro, 0, sizeof(EoBShapeDef *) * 13);
+ _shapesIntro = new const DarkMoonShapeDef*[13];
+ memset(_shapesIntro, 0, sizeof(DarkMoonShapeDef*) * 13);
_shapesIntro[0] = _staticres->loadEoB2ShapeData(kEoB2IntroShapes00, temp);
_shapesIntro[1] = _staticres->loadEoB2ShapeData(kEoB2IntroShapes01, temp);
_shapesIntro[4] = _staticres->loadEoB2ShapeData(kEoB2IntroShapes04, temp);
@@ -1216,12 +1220,12 @@ void DarkMoonEngine::initStaticResource() {
_creditsData = _staticres->loadRawData(kEoB2CreditsData, temp);
_cpsFilesFinale = _staticres->loadStrings(kEoB2FinaleCPSFiles, temp);
- _seqFinale = new const EoBSequenceStep*[21];
+ _animFinale = new const DarkMoonAnimCommand*[21];
for (int i = 0; i < 21; i++)
- _seqFinale[i] = _staticres->loadEoB2SeqData(kEoB2FinaleSeqData00 + i, temp);
+ _animFinale[i] = _staticres->loadEoB2SeqData(kEob2FinaleAnimData00 + i, temp);
- _shapesFinale = new const EoBShapeDef*[13];
- memset(_shapesFinale, 0, sizeof(EoBShapeDef *) * 13);
+ _shapesFinale = new const DarkMoonShapeDef*[13];
+ memset(_shapesFinale, 0, sizeof(DarkMoonShapeDef*) * 13);
_shapesFinale[0] = _staticres->loadEoB2ShapeData(kEoB2FinaleShapes00, temp);
_shapesFinale[3] = _staticres->loadEoB2ShapeData(kEoB2FinaleShapes03, temp);
_shapesFinale[7] = _staticres->loadEoB2ShapeData(kEoB2FinaleShapes07, temp);
@@ -1296,15 +1300,23 @@ void DarkMoonEngine::initSpells() {
}
}
-const char *DarkMoonEngine::_palFilesIntro[] = {
- "PALETTE1.PAL", // EGA: palette0.pal
+const char *DarkMoonEngine::_palFilesIntroVGA[] = {
+ "PALETTE1.PAL",
+ "PALETTE3.PAL",
+ "PALETTE2.PAL",
+ "PALETTE4.PAL",
+ 0
+};
+
+const char *DarkMoonEngine::_palFilesIntroEGA[] = {
+ "PALETTE0.PAL",
"PALETTE3.PAL",
"PALETTE2.PAL",
"PALETTE4.PAL",
0
};
-const char *DarkMoonEngine::_palFilesFinale[] = {
+const char *DarkMoonEngine::_palFilesFinaleVGA[] = {
"FINALE_0.PAL",
"FINALE_0.PAL",
"FINALE_1.PAL",
@@ -1317,11 +1329,28 @@ const char *DarkMoonEngine::_palFilesFinale[] = {
0
};
+const char *DarkMoonEngine::_palFilesFinaleEGA[] = {
+ "FINALE_0.PAL",
+ "FINALE_0.PAL",
+ "FINALE_1.PAL",
+ "FINALE_2.PAL",
+ "FINALE_3.PAL",
+ "FINALE_4.PAL",
+ "FINALE_5.PAL",
+ "FINALE_0.PAL",
+ "FINALE_0.PAL",
+ 0
+};
+
const KyraRpgGUISettings DarkMoonEngine::_guiSettings = {
{ 9, 15, 95, 9, 7, { 221, 76 }, { 189, 162 }, { 95, 95 } },
{ 186, 181, 183, 133, 184, 17, 23, 20, 186, 181, 183, 182, 177, 180 }
};
+const uint8 DarkMoonEngine::_egaDefaultPalette[] = {
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
+};
+
#endif // ENABLE_EOB
} // End of namespace Kyra
diff --git a/engines/kyra/staticres_rpg.cpp b/engines/kyra/staticres_rpg.cpp
index cc75ae3442..a30cbf7d05 100644
--- a/engines/kyra/staticres_rpg.cpp
+++ b/engines/kyra/staticres_rpg.cpp
@@ -88,6 +88,10 @@ void KyraRpgEngine::initStaticResource() {
_dscDimMap = _staticres->loadRawData(kRpgCommonDscDimMap, temp);
_dscDoorShpIndex = _staticres->loadRawData(kRpgCommonDscDoorShapeIndex, _dscDoorShpIndexSize);
_dscDoorY2 = _staticres->loadRawData(kRpgCommonDscDoorY2, temp);
+ _dscDoorFrameY1 = _staticres->loadRawData(kRpgCommonDscDoorFrameY1, temp);
+ _dscDoorFrameY2 = _staticres->loadRawData(kRpgCommonDscDoorFrameY2, temp);
+ _dscDoorFrameIndex1 = _staticres->loadRawData(kRpgCommonDscDoorFrameIndex1, temp);
+ _dscDoorFrameIndex2 = _staticres->loadRawData(kRpgCommonDscDoorFrameIndex2, temp);
_moreStrings = _staticres->loadStrings(kRpgCommonMoreStrings, temp);
}
diff --git a/engines/kyra/text_rpg.cpp b/engines/kyra/text_rpg.cpp
index a78adb93d9..d0f7b5e532 100644
--- a/engines/kyra/text_rpg.cpp
+++ b/engines/kyra/text_rpg.cpp
@@ -229,7 +229,7 @@ void TextDisplayer_rpg::displayText(char *str, ...) {
break;
default:
- if (_vm->game() == GI_LOL || c > 30) {
+ if (_vm->game() == GI_LOL || (unsigned char)c > 30) {
_lineWidth += (pc98PrintFlag ? 4 : _screen->getCharWidth((uint8)c));
_currentLine[_numCharsLeft++] = c;
_currentLine[_numCharsLeft] = 0;
@@ -282,14 +282,18 @@ void TextDisplayer_rpg::readNextPara() {
_tempString1 = 0;
}
- if ((_vm->game() != GI_LOL) && (d & 0x80)) {
+ // This seems to be some sort of character conversion mechanism. The original doesn't make any use of it, however.
+ // All necessary conversions take place somewhere else. This code actually causes issues if the character conversions
+ // don't take place before calling displayText(). So we disable it for now. If some (not yet supported) localized
+ // versions depend on this code we'll have to look at this again.
+ /* if ((_vm->game() != GI_LOL) && (d & 0x80)) {
d &= 0x7f;
c = d & 7;
d = (d & 0x78) >> 3;
uint8 l = d;
c = _table1[(l << 3) + c];
d = _table2[l];
- }
+ }*/
_ctrl[1] = d;
_ctrl[2] = c;
diff --git a/engines/kyra/timer_eob.cpp b/engines/kyra/timer_eob.cpp
index 8ad28c2ec4..de1becfa72 100644
--- a/engines/kyra/timer_eob.cpp
+++ b/engines/kyra/timer_eob.cpp
@@ -195,7 +195,7 @@ void EoBCoreEngine::timerProcessFlyingObjects(int timerNum) {
if (newBl) {
bl = calcNewBlockPosition(fo->curBlock, fo->direction);
pos &= 3;
- fo->u2 = 0;
+ fo->starting = 0;
}
if (updateObjectFlight(fo, bl, pos)) {
diff --git a/engines/lastexpress/entities/alexei.cpp b/engines/lastexpress/entities/alexei.cpp
index 073ca3f175..54c2d87b89 100644
--- a/engines/lastexpress/entities/alexei.cpp
+++ b/engines/lastexpress/entities/alexei.cpp
@@ -355,7 +355,7 @@ IMPLEMENT_FUNCTION_IS(16, Alexei, function16, TimeValue)
break;
case kActionDefault:
- getEntities()->drawSequenceLeft(kEntityAlexei, (char*)&params->seq);
+ getEntities()->drawSequenceLeft(kEntityAlexei, (char *)&params->seq);
getObjects()->update(kObjectCompartment2, kEntityAlexei, kObjectLocation1, kCursorHandKnock, kCursorHand);
getObjects()->update(kObjectHandleInsideBathroom, kEntityAlexei, kObjectLocation1, kCursorHandKnock, kCursorHand);
break;
diff --git a/engines/lastexpress/entities/entity_intern.h b/engines/lastexpress/entities/entity_intern.h
index bf75e022de..2da0da15b3 100644
--- a/engines/lastexpress/entities/entity_intern.h
+++ b/engines/lastexpress/entities/entity_intern.h
@@ -94,7 +94,7 @@ void class::setup_##name() { \
// Expose parameters and check validity
#define EXPOSE_PARAMS(type) \
- type *params = (type*)_data->getCurrentParameters(); \
+ type *params = (type *)_data->getCurrentParameters(); \
if (!params) \
error("[EXPOSE_PARAMS] Trying to call an entity function with invalid parameters"); \
@@ -307,7 +307,7 @@ void class::setup_##name() { \
//////////////////////////////////////////////////////////////////////////
#define RESET_ENTITY_STATE(entity, class, function) \
getEntities()->resetState(entity); \
- ((class*)getEntities()->get(entity))->function();
+ ((class *)getEntities()->get(entity))->function();
//////////////////////////////////////////////////////////////////////////
// Parameters macros (for default IIII parameters)
diff --git a/engines/lastexpress/game/entities.cpp b/engines/lastexpress/game/entities.cpp
index 894663dda6..f27087a609 100644
--- a/engines/lastexpress/game/entities.cpp
+++ b/engines/lastexpress/game/entities.cpp
@@ -615,9 +615,9 @@ void Entities::resetSequences(EntityIndex entityIndex) const {
getData(entityIndex)->field_4A9 = false;
getData(entityIndex)->field_4AA = false;
- strcpy((char*)&getData(entityIndex)->sequenceNameCopy, "");
- strcpy((char*)&getData(entityIndex)->sequenceName, "");
- strcpy((char*)&getData(entityIndex)->sequenceName2, "");
+ strcpy((char *)&getData(entityIndex)->sequenceNameCopy, "");
+ strcpy((char *)&getData(entityIndex)->sequenceName, "");
+ strcpy((char *)&getData(entityIndex)->sequenceName2, "");
getScenes()->resetQueue();
}
diff --git a/engines/lure/hotspots.cpp b/engines/lure/hotspots.cpp
index 2f6d0f23aa..c7e7e81900 100644
--- a/engines/lure/hotspots.cpp
+++ b/engines/lure/hotspots.cpp
@@ -2334,9 +2334,11 @@ 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);
+ byte dummy = stream->readByte();
+ assert(dummy == 0xff);
+ }
_pathFinder.loadFromStream(stream);
diff --git a/engines/lure/sound.cpp b/engines/lure/sound.cpp
index 0aecae22ec..bf0abdea07 100644
--- a/engines/lure/sound.cpp
+++ b/engines/lure/sound.cpp
@@ -635,7 +635,7 @@ MidiMusic::MidiMusic(MidiDriver *driver, ChannelEntry channels[NUM_CHANNELS],
for (uint i = 0; i < packedSize; i++)
#if defined(SCUMM_NEED_ALIGNMENT)
- memcpy(dataDest++, (byte*)((byte*)data + *(idx + i) * sizeof(uint16)), sizeof(uint16));
+ memcpy(dataDest++, (byte *)((byte *)data + *(idx + i) * sizeof(uint16)), sizeof(uint16));
#else
*dataDest++ = data[*(idx + i)];
#endif
diff --git a/engines/made/database.cpp b/engines/made/database.cpp
index 454fe09a38..2b87f97392 100644
--- a/engines/made/database.cpp
+++ b/engines/made/database.cpp
@@ -56,7 +56,7 @@ const char *Object::getString() {
void Object::setString(const char *str) {
if (getClass() == 0x7FFF) {
- char *objStr = (char*)getData();
+ char *objStr = (char *)getData();
if (str)
strncpy(objStr, str, getSize());
else
@@ -86,10 +86,10 @@ int16 Object::getVectorSize() {
int16 Object::getVectorItem(int16 index) {
if (getClass() == 0x7FFF) {
- byte *vector = (byte*)getData();
+ byte *vector = (byte *)getData();
return vector[index];
} else if (getClass() <= 0x7FFE) {
- int16 *vector = (int16*)getData();
+ int16 *vector = (int16 *)getData();
return READ_LE_UINT16(&vector[index]);
} else {
// should never reach here
@@ -100,10 +100,10 @@ int16 Object::getVectorItem(int16 index) {
void Object::setVectorItem(int16 index, int16 value) {
if (getClass() == 0x7FFF) {
- byte *vector = (byte*)getData();
+ byte *vector = (byte *)getData();
vector[index] = value;
} else if (getClass() <= 0x7FFE) {
- int16 *vector = (int16*)getData();
+ int16 *vector = (int16 *)getData();
WRITE_LE_UINT16(&vector[index], value);
}
}
@@ -526,7 +526,7 @@ int16 *GameDatabaseV2::findObjectProperty(int16 objectIndex, int16 propertyId, i
error("GameDatabaseV2::findObjectProperty(%04X, %04X) Not an object", objectIndex, propertyId);
}
- int16 *prop = (int16*)obj->getData();
+ int16 *prop = (int16 *)obj->getData();
byte count1 = obj->getCount1();
byte count2 = obj->getCount2();
@@ -553,7 +553,7 @@ int16 *GameDatabaseV2::findObjectProperty(int16 objectIndex, int16 propertyId, i
obj = getObject(parentObjectIndex);
- prop = (int16*)obj->getData();
+ prop = (int16 *)obj->getData();
count1 = obj->getCount1();
count2 = obj->getCount2();
@@ -750,7 +750,7 @@ int16 *GameDatabaseV3::findObjectProperty(int16 objectIndex, int16 propertyId, i
error("GameDatabaseV2::findObjectProperty(%04X, %04X) Not an object", objectIndex, propertyId);
}
- int16 *prop = (int16*)obj->getData();
+ int16 *prop = (int16 *)obj->getData();
byte count1 = obj->getCount1();
byte count2 = obj->getCount2();
@@ -762,7 +762,7 @@ int16 *GameDatabaseV3::findObjectProperty(int16 objectIndex, int16 propertyId, i
if ((READ_LE_UINT16(prop) & 0x3FFF) == propertyId) {
if (READ_LE_UINT16(prop) & 0x4000) {
propertyFlag = 1;
- return (int16*)_gameState + READ_LE_UINT16(propPtr1);
+ return (int16 *)_gameState + READ_LE_UINT16(propPtr1);
} else {
propertyFlag = obj->getFlags() & 1;
return propPtr1;
@@ -782,7 +782,7 @@ int16 *GameDatabaseV3::findObjectProperty(int16 objectIndex, int16 propertyId, i
obj = getObject(parentObjectIndex);
- prop = (int16*)obj->getData();
+ prop = (int16 *)obj->getData();
count1 = obj->getCount1();
count2 = obj->getCount2();
@@ -794,7 +794,7 @@ int16 *GameDatabaseV3::findObjectProperty(int16 objectIndex, int16 propertyId, i
if ((READ_LE_UINT16(prop) & 0x3FFF) == propertyId) {
if (READ_LE_UINT16(prop) & 0x4000) {
propertyFlag = 1;
- return (int16*)_gameState + READ_LE_UINT16(propPtr1);
+ return (int16 *)_gameState + READ_LE_UINT16(propPtr1);
} else {
propertyFlag = obj->getFlags() & 1;
return propPtr1;
@@ -806,7 +806,7 @@ int16 *GameDatabaseV3::findObjectProperty(int16 objectIndex, int16 propertyId, i
if ((READ_LE_UINT16(prop) & 0x3FFF) == propertyId) {
if (READ_LE_UINT16(prop) & 0x4000) {
propertyFlag = 1;
- return (int16*)_gameState + READ_LE_UINT16(propertyPtr);
+ return (int16 *)_gameState + READ_LE_UINT16(propertyPtr);
} else {
propertyFlag = obj->getFlags() & 1;
return propertyPtr;
diff --git a/engines/made/database.h b/engines/made/database.h
index 63f0557196..89b4b45357 100644
--- a/engines/made/database.h
+++ b/engines/made/database.h
@@ -151,9 +151,9 @@ public:
void dumpObject(int16 index);
protected:
- typedef Common::HashMap<uint32, int16*> ObjectPropertyCacheMap;
+ typedef Common::HashMap<uint32, int16 *> ObjectPropertyCacheMap;
MadeEngine *_vm;
- Common::Array<Object*> _objects;
+ Common::Array<Object *> _objects;
ObjectPropertyCacheMap _objectPropertyCache;
byte *_gameState;
uint32 _gameStateSize;
diff --git a/engines/made/graphics.cpp b/engines/made/graphics.cpp
index 30496d8595..4d3fc7116a 100644
--- a/engines/made/graphics.cpp
+++ b/engines/made/graphics.cpp
@@ -83,7 +83,7 @@ void decompressImage(byte *source, Graphics::Surface &surface, uint16 cmdOffs, u
if ((maskFlags != 0) && (maskFlags != 2) && (pixelFlags != 0) && (pixelFlags != 2) && (cmdFlags != 0))
error("decompressImage() Unsupported flags: cmdFlags = %02X; maskFlags = %02X, pixelFlags = %02X", cmdFlags, maskFlags, pixelFlags);
- byte *destPtr = (byte*)surface.getBasePtr(0, 0);
+ byte *destPtr = (byte *)surface.getBasePtr(0, 0);
byte lineBuf[640 * 4];
byte bitBuf[40];
@@ -196,7 +196,7 @@ void decompressMovieImage(byte *source, Graphics::Surface &surface, uint16 cmdOf
byte *maskBuffer = source + maskOffs;
byte *pixelBuffer = source + pixelOffs;
- byte *destPtr = (byte*)surface.getBasePtr(0, 0);
+ byte *destPtr = (byte *)surface.getBasePtr(0, 0);
byte bitBuf[40];
diff --git a/engines/made/resource.h b/engines/made/resource.h
index 9e0a729c58..a789069272 100644
--- a/engines/made/resource.h
+++ b/engines/made/resource.h
@@ -111,7 +111,7 @@ public:
int16 getWidth() const { return _width; }
int16 getHeight() const { return _height; }
protected:
- Common::Array<Graphics::Surface*> _frames;
+ Common::Array<Graphics::Surface *> _frames;
uint16 _flags;
int16 _width, _height;
};
@@ -210,7 +210,7 @@ protected:
bool _isV1;
typedef Common::Array<ResourceSlot> ResourceSlots;
- typedef Common::HashMap<uint32, ResourceSlots*> ResMap;
+ typedef Common::HashMap<uint32, ResourceSlots *> ResMap;
void openResourceBlock(const char *filename, Common::File *blockFile, uint32 resType);
ResMap _resSlots;
@@ -219,12 +219,12 @@ protected:
void loadIndex(ResourceSlots *slots);
- template <class T>
+ template<class T>
T *createResource(uint32 resType, int index) {
ResourceSlot *slot = getResourceSlot(resType, index);
if (!slot)
return NULL;
- T *res = (T*)getResourceFromCache(slot);
+ T *res = (T *)getResourceFromCache(slot);
if (!res) {
byte *buffer;
uint32 size;
diff --git a/engines/made/screen.cpp b/engines/made/screen.cpp
index 168902d577..b49bfff840 100644
--- a/engines/made/screen.cpp
+++ b/engines/made/screen.cpp
@@ -179,10 +179,10 @@ void Screen::drawSurface(Graphics::Surface *sourceSurface, int x, int y, int16 f
clipHeight = clipInfo.clipRect.bottom - y;
}
- source = (byte*)sourceSurface->getBasePtr(0, startY);
- dest = (byte*)clipInfo.destSurface->getBasePtr(x, y);
+ source = (byte *)sourceSurface->getBasePtr(0, startY);
+ dest = (byte *)clipInfo.destSurface->getBasePtr(x, y);
if (_vm->getGameID() != GID_RTZ)
- maskp = (byte*)_maskDrawCtx.destSurface->getBasePtr(x, y);
+ maskp = (byte *)_maskDrawCtx.destSurface->getBasePtr(x, y);
int32 sourcePitch, linePtrAdd, sourceAdd;
byte *linePtr;
@@ -633,7 +633,7 @@ void Screen::printChar(uint c, int16 x, int16 y, byte color) {
return;
byte p;
- byte *dest = (byte*)_fontDrawCtx.destSurface->getBasePtr(x, y);
+ byte *dest = (byte *)_fontDrawCtx.destSurface->getBasePtr(x, y);
for (uint yc = 0; yc < height; yc++) {
p = charData[yc];
diff --git a/engines/made/screenfx.cpp b/engines/made/screenfx.cpp
index ff0d393885..4e0d463b53 100644
--- a/engines/made/screenfx.cpp
+++ b/engines/made/screenfx.cpp
@@ -231,10 +231,10 @@ void ScreenEffects::copyFxRect(Graphics::Surface *surface, int16 x1, int16 y1, i
vfxY1 = y1 & 7;
- byte *source = (byte*)surface->getBasePtr(x1, y1);
+ byte *source = (byte *)surface->getBasePtr(x1, y1);
Graphics::Surface *vgaScreen = _screen->lockScreen();
- byte *dest = (byte*)vgaScreen->getBasePtr(x1, y1);
+ byte *dest = (byte *)vgaScreen->getBasePtr(x1, y1);
int16 addX = x2 / 16;
diff --git a/engines/made/scriptfuncs.h b/engines/made/scriptfuncs.h
index 6b3301755d..03d29c4592 100644
--- a/engines/made/scriptfuncs.h
+++ b/engines/made/scriptfuncs.h
@@ -68,7 +68,7 @@ protected:
Audio::SoundHandle _pcSpeakerHandle1, _pcSpeakerHandle2;
Audio::PCSpeaker *_pcSpeaker1, *_pcSpeaker2;
- Common::Array<const ExternalFunc*> _externalFuncs;
+ Common::Array<const ExternalFunc *> _externalFuncs;
Common::Array<const char *> _externalFuncNames;
GenericResource *_musicRes;
diff --git a/engines/metaengine.h b/engines/metaengine.h
index 8eb8044b34..d9c1360042 100644
--- a/engines/metaengine.h
+++ b/engines/metaengine.h
@@ -224,9 +224,6 @@ typedef PluginSubclass<MetaEngine> EnginePlugin;
* Singleton class which manages all Engine plugins.
*/
class EngineManager : public Common::Singleton<EngineManager> {
-private:
- friend class Common::Singleton<SingletonBaseType>;
-
public:
GameDescriptor findGameInLoadedPlugins(const Common::String &gameName, const EnginePlugin **plugin = NULL) const;
GameDescriptor findGame(const Common::String &gameName, const EnginePlugin **plugin = NULL) const;
diff --git a/engines/mohawk/detection_tables.h b/engines/mohawk/detection_tables.h
index 2b1b28716e..08df0a2cbe 100644
--- a/engines/mohawk/detection_tables.h
+++ b/engines/mohawk/detection_tables.h
@@ -1011,6 +1011,22 @@ static const MohawkGameDescription gameDescriptions[] = {
0,
},
+ // Tortoise and the Hare Hebrew variant - From georgeqgreg on bug #3441928
+ {
+ {
+ "tortoise",
+ "",
+ AD_ENTRY1("TORTB.LB", "23135777370cf1ff00aa7247e93642d3"),
+ Common::HE_ISR,
+ Common::kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NOASPECT)
+ },
+ GType_LIVINGBOOKSV2,
+ 0,
+ 0,
+ },
+
// From afholman in bug#3309308
{
{
@@ -1293,6 +1309,23 @@ static const MohawkGameDescription gameDescriptions[] = {
0
},
+ // Just Grandma and Me 2.0 Macintosh
+ // From aluff in bug #3461368
+ {
+ {
+ "grandma",
+ "v2.0",
+ AD_ENTRY1("BookOutline", "99fe5c8ace79f0542e6390bc3b58f25a"),
+ Common::EN_ANY,
+ Common::kPlatformMacintosh,
+ ADGF_UNSTABLE,
+ GUIO1(GUIO_NOASPECT)
+ },
+ GType_LIVINGBOOKSV3,
+ 0,
+ 0
+ },
+
// Just Grandma and Me 1.0
// From scoriae
{
@@ -1782,6 +1815,23 @@ static const MohawkGameDescription gameDescriptions[] = {
0
},
+ // Arthur Birthday (English) Version 2.0 Macintosh
+ // From aluff in bug #3461368
+ {
+ {
+ "arthurbday",
+ "",
+ AD_ENTRY1("BookOutline", "8e4fddb5b761c8cf2a3b448dd38422be"),
+ Common::EN_ANY,
+ Common::kPlatformMacintosh,
+ ADGF_UNSTABLE,
+ GUIO1(GUIO_NOASPECT)
+ },
+ GType_LIVINGBOOKSV3,
+ 0,
+ 0
+ },
+
{
{
"arthurbday",
@@ -2251,6 +2301,22 @@ static const MohawkGameDescription gameDescriptions[] = {
0
},
+ // From aluff in bug #3461368
+ {
+ {
+ "beardark",
+ "",
+ AD_ENTRY1("BookOutline", "b56746b3b2c062c8588bfb6b28e137c1"),
+ Common::EN_ANY,
+ Common::kPlatformMacintosh,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NOASPECT)
+ },
+ GType_LIVINGBOOKSV3,
+ 0,
+ 0
+ },
+
{
{
"arthurcomp",
diff --git a/engines/mohawk/graphics.cpp b/engines/mohawk/graphics.cpp
index dcb0c7940d..2ffabf1e8c 100644
--- a/engines/mohawk/graphics.cpp
+++ b/engines/mohawk/graphics.cpp
@@ -108,9 +108,9 @@ GraphicsManager::~GraphicsManager() {
}
void GraphicsManager::clearCache() {
- for (Common::HashMap<uint16, MohawkSurface*>::iterator it = _cache.begin(); it != _cache.end(); it++)
+ for (Common::HashMap<uint16, MohawkSurface *>::iterator it = _cache.begin(); it != _cache.end(); it++)
delete it->_value;
- for (Common::HashMap<uint16, Common::Array<MohawkSurface*> >::iterator it = _subImageCache.begin(); it != _subImageCache.end(); it++) {
+ for (Common::HashMap<uint16, Common::Array<MohawkSurface *> >::iterator it = _subImageCache.begin(); it != _subImageCache.end(); it++) {
Common::Array<MohawkSurface *> &array = it->_value;
for (uint i = 0; i < array.size(); i++)
delete array[i];
diff --git a/engines/mohawk/graphics.h b/engines/mohawk/graphics.h
index 463608a2aa..8fa5d5f895 100644
--- a/engines/mohawk/graphics.h
+++ b/engines/mohawk/graphics.h
@@ -99,8 +99,8 @@ protected:
private:
// An image cache that stores images until clearCache() is called
- Common::HashMap<uint16, MohawkSurface*> _cache;
- Common::HashMap<uint16, Common::Array<MohawkSurface*> > _subImageCache;
+ Common::HashMap<uint16, MohawkSurface *> _cache;
+ Common::HashMap<uint16, Common::Array<MohawkSurface *> > _subImageCache;
};
#ifdef ENABLE_MYST
@@ -222,7 +222,7 @@ private:
uint16 frameCount;
Common::Rect rect;
uint16 speed;
- Common::Array<Common::SeekableReadStream*> frameScripts;
+ Common::Array<Common::SeekableReadStream *> frameScripts;
// Cur frame
uint16 curFrame;
diff --git a/engines/mohawk/livingbooks.cpp b/engines/mohawk/livingbooks.cpp
index 08f3b86c7c..708478a6d8 100644
--- a/engines/mohawk/livingbooks.cpp
+++ b/engines/mohawk/livingbooks.cpp
@@ -388,10 +388,13 @@ bool MohawkEngine_LivingBooks::loadPage(LBMode mode, uint page, uint subpage) {
}
// TODO: fading between pages
+#if 0
bool fade = false;
if (leftover.contains("fade")) {
fade = true;
}
+#endif
+
if (leftover.contains("read")) {
_readOnly = true;
}
diff --git a/engines/mohawk/livingbooks_code.cpp b/engines/mohawk/livingbooks_code.cpp
index 41acea19c4..bb8f7a0d05 100644
--- a/engines/mohawk/livingbooks_code.cpp
+++ b/engines/mohawk/livingbooks_code.cpp
@@ -1766,7 +1766,7 @@ uint LBCode::parseCode(const Common::String &source) {
{
Common::String tempString;
while (pos < source.size()) {
- if (!isalpha(source[pos]) && !isdigit(source[pos]))
+ if (!Common::isAlpha(source[pos]) && !Common::isDigit(source[pos]))
break;
tempString += source[pos++];
}
@@ -1777,7 +1777,7 @@ uint LBCode::parseCode(const Common::String &source) {
}
break;
default:
- if (isdigit(token)) {
+ if (Common::isDigit(token)) {
const char *in = source.c_str() + pos - 1;
// FIXME: handle floats?
char *endptr;
@@ -1792,11 +1792,11 @@ uint LBCode::parseCode(const Common::String &source) {
WRITE_BE_UINT16(tmp, (int16)intValue);
code.push_back(tmp[0]);
code.push_back(tmp[1]);
- } else if (isalpha(token)) {
+ } else if (Common::isAlpha(token)) {
Common::String tempString;
tempString += token;
while (pos < source.size()) {
- if (!isalpha(source[pos]) && !isdigit(source[pos]))
+ if (!Common::isAlpha(source[pos]) && !Common::isDigit(source[pos]))
break;
tempString += source[pos++];
}
diff --git a/engines/mohawk/myst.h b/engines/mohawk/myst.h
index 02f0a46e3f..30770f7ec9 100644
--- a/engines/mohawk/myst.h
+++ b/engines/mohawk/myst.h
@@ -173,7 +173,7 @@ public:
MystGraphics *_gfx;
MystGameState *_gameState;
MystScriptParser *_scriptParser;
- Common::Array<MystResource*> _resources;
+ Common::Array<MystResource *> _resources;
MystResource *_dragResource;
Common::RandomSource *_rnd;
diff --git a/engines/mohawk/myst_areas.h b/engines/mohawk/myst_areas.h
index 136356ea4f..297a7cc92b 100644
--- a/engines/mohawk/myst_areas.h
+++ b/engines/mohawk/myst_areas.h
@@ -137,7 +137,7 @@ public:
protected:
uint16 _var7;
uint16 _numSubResources;
- Common::Array<MystResource*> _subResources;
+ Common::Array<MystResource *> _subResources;
};
class MystResourceType8 : public MystResourceType7 {
diff --git a/engines/mohawk/myst_scripts.h b/engines/mohawk/myst_scripts.h
index 18f5b27a6d..ccb76e0dc8 100644
--- a/engines/mohawk/myst_scripts.h
+++ b/engines/mohawk/myst_scripts.h
@@ -143,7 +143,7 @@ protected:
const char *desc;
};
- Common::Array<MystOpcode*> _opcodes;
+ Common::Array<MystOpcode *> _opcodes;
MystResource *_invokingResource;
diff --git a/engines/mohawk/riven_external.h b/engines/mohawk/riven_external.h
index 5f5d0cb0b2..9f076325a2 100644
--- a/engines/mohawk/riven_external.h
+++ b/engines/mohawk/riven_external.h
@@ -53,7 +53,7 @@ private:
ExternalCmd proc;
};
- Common::Array<RivenExternalCmd*> _externalCommands;
+ Common::Array<RivenExternalCmd *> _externalCommands;
void setupCommands();
// Supplementary Functions
diff --git a/engines/mohawk/riven_scripts.h b/engines/mohawk/riven_scripts.h
index 2932ba5939..a871f0afa0 100644
--- a/engines/mohawk/riven_scripts.h
+++ b/engines/mohawk/riven_scripts.h
@@ -125,7 +125,7 @@ private:
DECLARE_OPCODE(activateMLST);
};
-typedef Common::Array<RivenScript*> RivenScriptList;
+typedef Common::Array<RivenScript *> RivenScriptList;
class RivenScriptManager {
public:
diff --git a/engines/mohawk/video.cpp b/engines/mohawk/video.cpp
index 7958906897..8d72fa3f72 100644
--- a/engines/mohawk/video.cpp
+++ b/engines/mohawk/video.cpp
@@ -261,7 +261,7 @@ bool VideoManager::updateMovies() {
// Clip the width/height to make sure we stay on the screen (Myst does this a few times)
uint16 width = MIN<int32>(_videoStreams[i]->getWidth(), _vm->_system->getWidth() - _videoStreams[i].x);
uint16 height = MIN<int32>(_videoStreams[i]->getHeight(), _vm->_system->getHeight() - _videoStreams[i].y);
- _vm->_system->copyRectToScreen((byte*)frame->pixels, frame->pitch, _videoStreams[i].x, _videoStreams[i].y, width, height);
+ _vm->_system->copyRectToScreen((byte *)frame->pixels, frame->pitch, _videoStreams[i].x, _videoStreams[i].y, width, height);
// We've drawn something to the screen, make sure we update it
updateScreen = true;
diff --git a/engines/parallaction/balloons.cpp b/engines/parallaction/balloons.cpp
index f74eef18e1..1ddd401b20 100644
--- a/engines/parallaction/balloons.cpp
+++ b/engines/parallaction/balloons.cpp
@@ -179,7 +179,7 @@ protected:
uint16 rx = 10;
uint16 ry = 4 + _lines * _font->height(); // y
- byte *dst = (byte*)_surf->getBasePtr(rx, ry);
+ byte *dst = (byte *)_surf->getBasePtr(rx, ry);
_font->setColor(_color);
_font->drawString(dst, _surf->w, _line.c_str());
}
@@ -494,7 +494,7 @@ protected:
uint16 rx = _x + (_surf->w - _lineWidth) / 2;
uint16 ry = _y + _lines * _font->height(); // y
- byte *dst = (byte*)_surf->getBasePtr(rx, ry);
+ byte *dst = (byte *)_surf->getBasePtr(rx, ry);
_font->setColor(_color);
_font->drawString(dst, _surf->w, _line.c_str());
}
diff --git a/engines/parallaction/callables_br.cpp b/engines/parallaction/callables_br.cpp
index ac5ff88560..7d3e63dfba 100644
--- a/engines/parallaction/callables_br.cpp
+++ b/engines/parallaction/callables_br.cpp
@@ -26,31 +26,31 @@
namespace Parallaction {
-void Parallaction_br::_c_null(void*) {
+void Parallaction_br::_c_null(void *) {
// do nothing :)
}
-void Parallaction_br::_c_blufade(void*) {
+void Parallaction_br::_c_blufade(void *) {
warning("Parallaction_br::_c_blufade() not yet implemented");
}
-void Parallaction_br::_c_resetpalette(void*) {
+void Parallaction_br::_c_resetpalette(void *) {
warning("Parallaction_br::_c_resetpalette() not yet implemented");
}
-void Parallaction_br::_c_ferrcycle(void*) {
+void Parallaction_br::_c_ferrcycle(void *) {
warning("Parallaction_br::_c_ferrcycle() not yet implemented");
}
-void Parallaction_br::_c_lipsinc(void*) {
+void Parallaction_br::_c_lipsinc(void *) {
warning("Unexpected lipsinc routine call! Please notify the team");
}
-void Parallaction_br::_c_albcycle(void*) {
+void Parallaction_br::_c_albcycle(void *) {
warning("Parallaction_br::_c_albcycle() not yet implemented");
}
-void Parallaction_br::_c_password(void*) {
+void Parallaction_br::_c_password(void *) {
warning("Parallaction_br::_c_password() not yet implemented");
}
diff --git a/engines/parallaction/callables_ns.cpp b/engines/parallaction/callables_ns.cpp
index 77f54fcc98..64885c7ff3 100644
--- a/engines/parallaction/callables_ns.cpp
+++ b/engines/parallaction/callables_ns.cpp
@@ -260,7 +260,7 @@ void Parallaction_ns::stopMovingSarcophagus() {
void Parallaction_ns::_c_moveSarc(void *parm) {
if (!_movingSarcophagus) {
- startMovingSarcophagus(*(ZonePtr*)parm);
+ startMovingSarcophagus(*(ZonePtr *)parm);
} else {
stopMovingSarcophagus();
}
@@ -417,18 +417,18 @@ void Parallaction_ns::_c_testResult(void *parm) {
return;
}
-void Parallaction_ns::_c_offSound(void*) {
+void Parallaction_ns::_c_offSound(void *) {
_soundManI->stopSfx(0);
_soundManI->stopSfx(1);
_soundManI->stopSfx(2);
_soundManI->stopSfx(3);
}
-void Parallaction_ns::_c_startMusic(void*) {
+void Parallaction_ns::_c_startMusic(void *) {
_soundManI->playMusic();
}
-void Parallaction_ns::_c_closeMusic(void*) {
+void Parallaction_ns::_c_closeMusic(void *) {
_soundManI->stopMusic();
}
@@ -490,7 +490,7 @@ void Parallaction_ns::_c_moveSheet(void *parm) {
}
void zeroMask(int x, int y, int color, void *data) {
- BackgroundInfo *info = (BackgroundInfo*)data;
+ BackgroundInfo *info = (BackgroundInfo *)data;
uint16 _ax = x + y * info->_mask->w;
info->_mask->data[_ax >> 2] &= ~(3 << ((_ax & 3) << 1));
@@ -575,16 +575,16 @@ int16 projectorProgram[] = {
25, 116, 25, 115, 25, 114, 25, 113, 25, 112, 25, 111, 25, 110, 25, -1, -1
};
-void Parallaction_ns::_c_projector(void*) {
+void Parallaction_ns::_c_projector(void *) {
_gfx->setHalfbriteMode(true);
_gfx->setProjectorProgram(projectorProgram);
}
-void Parallaction_ns::_c_HBOff(void*) {
+void Parallaction_ns::_c_HBOff(void *) {
_gfx->setHalfbriteMode(false);
}
-void Parallaction_ns::_c_HBOn(void*) {
+void Parallaction_ns::_c_HBOn(void *) {
_gfx->setHalfbriteMode(true);
}
diff --git a/engines/parallaction/debug.cpp b/engines/parallaction/debug.cpp
index 72f26cb6b9..0cb329e0f0 100644
--- a/engines/parallaction/debug.cpp
+++ b/engines/parallaction/debug.cpp
@@ -69,14 +69,14 @@ bool Debugger::Cmd_Location(int argc, const char **argv) {
switch (argc) {
case 3:
- character = const_cast<char*>(argv[2]);
- location = const_cast<char*>(argv[1]);
+ character = const_cast<char *>(argv[2]);
+ location = const_cast<char *>(argv[1]);
sprintf(tmp, "%s.%s", location, character);
_vm->scheduleLocationSwitch(tmp);
break;
case 2:
- location = const_cast<char*>(argv[1]);
+ location = const_cast<char *>(argv[1]);
_vm->scheduleLocationSwitch(location);
break;
diff --git a/engines/parallaction/dialogue.cpp b/engines/parallaction/dialogue.cpp
index a908152bf8..e0bd6a6677 100644
--- a/engines/parallaction/dialogue.cpp
+++ b/engines/parallaction/dialogue.cpp
@@ -381,7 +381,7 @@ protected:
}
void accumPassword(uint16 ascii) {
- if (!isdigit(ascii)) {
+ if (!Common::isDigit(ascii)) {
return;
}
diff --git a/engines/parallaction/disk.cpp b/engines/parallaction/disk.cpp
index 61172d0896..f20e05771a 100644
--- a/engines/parallaction/disk.cpp
+++ b/engines/parallaction/disk.cpp
@@ -38,7 +38,7 @@ void ILBMLoader::setupBuffer(uint32 w, uint32 h) {
}
_surf->create(w, h, Graphics::PixelFormat::createFormatCLUT8());
_mode = Graphics::ILBMDecoder::ILBM_UNPACK_PLANES;
- _intBuffer = (byte*)_surf->pixels;
+ _intBuffer = (byte *)_surf->pixels;
break;
case BODYMODE_MASKBUFFER:
@@ -82,7 +82,7 @@ bool ILBMLoader::callback(Common::IFFChunk &chunk) {
case ID_CRNG:
if (_crng) {
PaletteFxRange *ptr = &_crng[_numCRNG];
- chunk._stream->read((byte*)ptr, chunk._size);
+ chunk._stream->read((byte *)ptr, chunk._size);
ptr->_timer = FROM_BE_16(ptr->_timer);
ptr->_step = FROM_BE_16(ptr->_step);
ptr->_flags = FROM_BE_16(ptr->_flags);
diff --git a/engines/parallaction/disk_br.cpp b/engines/parallaction/disk_br.cpp
index f9e368ab39..5e39c893db 100644
--- a/engines/parallaction/disk_br.cpp
+++ b/engines/parallaction/disk_br.cpp
@@ -283,7 +283,7 @@ Sprites* DosDisk_br::createSprites(Common::ReadStream *stream) {
spr->w = stream->readUint16LE();
spr->h = stream->readUint16LE();
- spr->packedData = (byte*)malloc(spr->size);
+ spr->packedData = (byte *)malloc(spr->size);
stream->read(spr->packedData, spr->size);
}
delete stream;
@@ -450,7 +450,7 @@ void AmigaDisk_br::init() {
void AmigaDisk_br::adjustForPalette(Graphics::Surface &surf, int transparentColor) {
uint size = surf.w * surf.h;
- byte *data = (byte*)surf.pixels;
+ byte *data = (byte *)surf.pixels;
for (uint i = 0; i < size; i++, data++) {
if (transparentColor == -1 || transparentColor != *data)
*data += 16;
@@ -609,7 +609,7 @@ GfxObj* AmigaDisk_br::loadStatic(const char* name) {
stream->read(shadow, shadowSize);
for (int32 i = 0; i < surf->h; ++i) {
byte *src = shadow + shadowWidth * i;
- byte *dst = (byte*)surf->pixels + surf->pitch * i;
+ byte *dst = (byte *)surf->pixels + surf->pitch * i;
for (int32 j = 0; j < surf->w; ++j, ++dst) {
byte bit = src[j/8] & (1 << (7 - (j & 7)));
@@ -637,7 +637,7 @@ Sprites* AmigaDisk_br::createSprites(Common::ReadStream *stream) {
spr->w = stream->readUint16BE();
spr->h = stream->readUint16BE() - 1;
- spr->packedData = (byte*)malloc(spr->size);
+ spr->packedData = (byte *)malloc(spr->size);
stream->read(spr->packedData, spr->size);
}
@@ -725,7 +725,7 @@ GfxObj* AmigaDisk_br::loadObjects(const char *name, uint8 part) {
max = 72;
byte *data = new byte[max * 2601];
- byte *srcPtr = (byte*)loader._surf->getBasePtr(0,0);
+ byte *srcPtr = (byte *)loader._surf->getBasePtr(0,0);
int w = loader._surf->w;
// Convert to the expected display format
diff --git a/engines/parallaction/disk_ns.cpp b/engines/parallaction/disk_ns.cpp
index e145743f09..b2285d0da3 100644
--- a/engines/parallaction/disk_ns.cpp
+++ b/engines/parallaction/disk_ns.cpp
@@ -473,7 +473,7 @@ void DosDisk_ns::loadBackground(BackgroundInfo& info, const char *filename) {
// read bitmap, mask and path data and extract them into the 3 buffers
info.bg.create(info.width, info.height, Graphics::PixelFormat::createFormatCLUT8());
createMaskAndPathBuffers(info);
- unpackBackground(stream, (byte*)info.bg.pixels, info._mask->data, info._path->data);
+ unpackBackground(stream, (byte *)info.bg.pixels, info._mask->data, info._path->data);
delete stream;
}
@@ -661,10 +661,10 @@ public:
stream.seek(-4, SEEK_END);
uint32 decrlen = stream.readUint32BE() >> 8;
- byte *dest = (byte*)malloc(decrlen);
+ byte *dest = (byte *)malloc(decrlen);
uint32 crlen = stream.size() - 4;
- byte *src = (byte*)malloc(crlen);
+ byte *src = (byte *)malloc(crlen);
stream.seek(4, SEEK_SET);
stream.read(src, crlen);
@@ -757,14 +757,14 @@ void AmigaDisk_ns::unpackFrame(byte *dst, byte *src, uint16 planeSize) {
*/
void AmigaDisk_ns::patchFrame(byte *dst, byte *dlta, uint16 bytesPerPlane, uint16 height) {
- uint32 *dataIndex = (uint32*)dlta;
- uint32 *ofslenIndex = (uint32*)dlta + 8;
+ uint32 *dataIndex = (uint32 *)dlta;
+ uint32 *ofslenIndex = (uint32 *)dlta + 8;
- uint16 *base = (uint16*)dlta;
+ uint16 *base = (uint16 *)dlta;
uint16 wordsPerLine = bytesPerPlane >> 1;
for (uint j = 0; j < NUM_PLANES; j++) {
- uint16 *dst16 = (uint16*)(dst + j * bytesPerPlane * height);
+ uint16 *dst16 = (uint16 *)(dst + j * bytesPerPlane * height);
uint16 *data = base + READ_BE_UINT32(dataIndex);
dataIndex++;
@@ -804,7 +804,7 @@ void AmigaDisk_ns::unpackBitmap(byte *dst, byte *src, uint16 numFrames, uint16 b
uint size = READ_BE_UINT32(src + 4);
if (tempBuffer == 0)
- tempBuffer = (byte*)malloc(planeSize * NUM_PLANES);
+ tempBuffer = (byte *)malloc(planeSize * NUM_PLANES);
memcpy(tempBuffer, baseFrame, planeSize * NUM_PLANES);
diff --git a/engines/parallaction/exec.h b/engines/parallaction/exec.h
index 4ca3947514..b966d677cd 100644
--- a/engines/parallaction/exec.h
+++ b/engines/parallaction/exec.h
@@ -55,7 +55,7 @@ struct CommandContext {
// in Parallaction_XX
};
typedef Common::Functor1<CommandContext&, void> CommandOpcode;
-typedef Common::Array<const CommandOpcode*> CommandOpcodeSet;
+typedef Common::Array<const CommandOpcode *> CommandOpcodeSet;
#define DECLARE_UNQUALIFIED_COMMAND_OPCODE(op) void cmdOp_##op(CommandContext &)
struct ProgramContext {
@@ -67,11 +67,11 @@ struct ProgramContext {
bool _suspend;
};
typedef Common::Functor1<ProgramContext&, void> ProgramOpcode;
-typedef Common::Array<const ProgramOpcode*> ProgramOpcodeSet;
+typedef Common::Array<const ProgramOpcode *> ProgramOpcodeSet;
#define DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(op) void instOp_##op(ProgramContext &)
-template <class OpcodeSet>
+template<class OpcodeSet>
class Exec {
protected:
OpcodeSet _opcodes;
diff --git a/engines/parallaction/font.cpp b/engines/parallaction/font.cpp
index cc7f320e1c..d4c9aefd32 100644
--- a/engines/parallaction/font.cpp
+++ b/engines/parallaction/font.cpp
@@ -57,17 +57,17 @@ public:
_numGlyphs = stream.readByte();
_height = stream.readUint32BE();
- _widths = (byte*)malloc(_numGlyphs);
+ _widths = (byte *)malloc(_numGlyphs);
stream.read(_widths, _numGlyphs);
- _offsets = (uint*)malloc(_numGlyphs * sizeof(uint));
+ _offsets = (uint *)malloc(_numGlyphs * sizeof(uint));
_offsets[0] = 0;
for (uint i = 1; i < _numGlyphs; i++)
_offsets[i] = _offsets[i-1] + _widths[i-1] * _height;
uint size = _offsets[_numGlyphs-1] + _widths[_numGlyphs-1] * _height;
- _data = (byte*)malloc(size);
+ _data = (byte *)malloc(size);
stream.read(_data, size);
}
@@ -503,25 +503,25 @@ AmigaFont::AmigaFont(Common::SeekableReadStream &stream) {
stream.seek(32); // skips dummy header
_dataSize = stream.size() - stream.pos();
- _data = (byte*)malloc(_dataSize);
+ _data = (byte *)malloc(_dataSize);
stream.read(_data, _dataSize);
- _font = (AmigaDiskFont*)(_data + 78);
+ _font = (AmigaDiskFont *)(_data + 78);
_font->_ySize = FROM_BE_16(_font->_ySize);
_font->_xSize = FROM_BE_16(_font->_xSize);
_font->_baseline = FROM_BE_16(_font->_baseline);
_font->_modulo = FROM_BE_16(_font->_modulo);
- _charLoc = (CharLoc*)(_data + FROM_BE_32(_font->_charLoc));
+ _charLoc = (CharLoc *)(_data + FROM_BE_32(_font->_charLoc));
_charData = _data + FROM_BE_32(_font->_charData);
_charSpace = 0;
_charKern = 0;
if (_font->_charSpace != 0)
- _charSpace = (uint16*)(_data + FROM_BE_32(_font->_charSpace));
+ _charSpace = (uint16 *)(_data + FROM_BE_32(_font->_charSpace));
if (_font->_charKern != 0)
- _charKern = (uint16*)(_data + FROM_BE_32(_font->_charKern));
+ _charKern = (uint16 *)(_data + FROM_BE_32(_font->_charKern));
}
diff --git a/engines/parallaction/gfxbase.cpp b/engines/parallaction/gfxbase.cpp
index c351551e36..852235ce34 100644
--- a/engines/parallaction/gfxbase.cpp
+++ b/engines/parallaction/gfxbase.cpp
@@ -235,7 +235,7 @@ void Gfx::drawGfxObject(GfxObj *obj, Graphics::Surface &surf) {
}
void Gfx::drawText(Font *font, Graphics::Surface* surf, uint16 x, uint16 y, const char *text, byte color) {
- byte *dst = (byte*)surf->getBasePtr(x, y);
+ byte *dst = (byte *)surf->getBasePtr(x, y);
font->setColor(color);
font->drawString(dst, surf->w, text);
}
@@ -308,7 +308,7 @@ void Gfx::bltMaskScale(const Common::Rect& r, byte *data, Graphics::Surface *sur
dp.y = dstRect.top;
byte *s = data + srcRect.left + srcRect.top * width;
- byte *d = (byte*)surf->getBasePtr(dp.x, dp.y);
+ byte *d = (byte *)surf->getBasePtr(dp.x, dp.y);
uint line = 0, col = 0;
@@ -380,7 +380,7 @@ void Gfx::bltMaskNoScale(const Common::Rect& r, byte *data, Graphics::Surface *s
q.translate(-r.left, -r.top);
byte *s = data + q.left + q.top * r.width();
- byte *d = (byte*)surf->getBasePtr(dp.x, dp.y);
+ byte *d = (byte *)surf->getBasePtr(dp.x, dp.y);
uint sPitch = r.width() - q.width();
uint dPitch = surf->w - q.width();
@@ -422,7 +422,7 @@ void Gfx::bltNoMaskNoScale(const Common::Rect& r, byte *data, Graphics::Surface
q.translate(-r.left, -r.top);
byte *s = data + q.left + q.top * r.width();
- byte *d = (byte*)surf->getBasePtr(dp.x, dp.y);
+ byte *d = (byte *)surf->getBasePtr(dp.x, dp.y);
uint sPitch = r.width() - q.width();
uint dPitch = surf->w - q.width();
diff --git a/engines/parallaction/graphics.cpp b/engines/parallaction/graphics.cpp
index a006edf114..6868505c52 100644
--- a/engines/parallaction/graphics.cpp
+++ b/engines/parallaction/graphics.cpp
@@ -44,7 +44,7 @@ namespace Parallaction {
void halfbritePixel(int x, int y, int color, void *data) {
Graphics::Surface *surf = (Graphics::Surface *)data;
- byte *pixel = (byte*)surf->getBasePtr(x, y);
+ byte *pixel = (byte *)surf->getBasePtr(x, y);
*pixel &= ~0x20;
}
@@ -319,7 +319,7 @@ void Gfx::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int
y += _scrollPosY;
}
- byte *dst = (byte*)_backBuffer.getBasePtr(x, y);
+ byte *dst = (byte *)_backBuffer.getBasePtr(x, y);
for (int i = 0; i < h; i++) {
memcpy(dst, buf, w);
buf += pitch;
@@ -357,7 +357,7 @@ void Gfx::unlockScreen() {
void Gfx::updateScreenIntern() {
if (_doubleBuffering) {
- byte *data = (byte*)_backBuffer.getBasePtr(_scrollPosX, _scrollPosY);
+ byte *data = (byte *)_backBuffer.getBasePtr(_scrollPosX, _scrollPosY);
_vm->_system->copyRectToScreen(data, _backBuffer.pitch, 0, 0, _vm->_screenWidth, _vm->_screenHeight);
}
@@ -425,7 +425,7 @@ void Gfx::updateScreen() {
// background may not cover the whole screen, so adjust bulk update size
uint w = _backgroundInfo->width;
uint h = _backgroundInfo->height;
- byte *backgroundData = (byte*)_backgroundInfo->bg.getBasePtr(0, 0);
+ byte *backgroundData = (byte *)_backgroundInfo->bg.getBasePtr(0, 0);
uint16 backgroundPitch = _backgroundInfo->bg.pitch;
copyRectToScreen(backgroundData, backgroundPitch, _backgroundInfo->_x, _backgroundInfo->_y, w, h);
}
@@ -450,7 +450,7 @@ void Gfx::applyHalfbriteEffect_NS(Graphics::Surface &surf) {
return;
}
- byte *buf = (byte*)surf.pixels;
+ byte *buf = (byte *)surf.pixels;
for (int i = 0; i < surf.w*surf.h; i++) {
*buf++ |= 0x20;
}
@@ -493,7 +493,7 @@ void Gfx::patchBackground(Graphics::Surface &surf, int16 x, int16 y, bool mask)
r.moveTo(x, y);
uint16 z = (mask) ? _backgroundInfo->getMaskLayer(y) : LAYER_FOREGROUND;
- blt(r, (byte*)surf.pixels, &_backgroundInfo->bg, z, 100, 0);
+ blt(r, (byte *)surf.pixels, &_backgroundInfo->bg, z, 100, 0);
}
void Gfx::fillBackground(const Common::Rect& r, byte color) {
@@ -502,7 +502,7 @@ void Gfx::fillBackground(const Common::Rect& r, byte color) {
void Gfx::invertBackground(const Common::Rect& r) {
- byte *d = (byte*)_backgroundInfo->bg.getBasePtr(r.left, r.top);
+ byte *d = (byte *)_backgroundInfo->bg.getBasePtr(r.left, r.top);
for (int i = 0; i < r.height(); i++) {
for (int j = 0; j < r.width(); j++) {
@@ -536,12 +536,12 @@ GfxObj *Gfx::renderFloatingLabel(Font *font, char *text) {
setupLabelSurface(*cnv, w, h);
font->setColor((_gameType == GType_BRA) ? 0 : 7);
- font->drawString((byte*)cnv->pixels + 1, cnv->w, text);
- font->drawString((byte*)cnv->pixels + 1 + cnv->w * 2, cnv->w, text);
- font->drawString((byte*)cnv->pixels + cnv->w, cnv->w, text);
- font->drawString((byte*)cnv->pixels + 2 + cnv->w, cnv->w, text);
+ font->drawString((byte *)cnv->pixels + 1, cnv->w, text);
+ font->drawString((byte *)cnv->pixels + 1 + cnv->w * 2, cnv->w, text);
+ font->drawString((byte *)cnv->pixels + cnv->w, cnv->w, text);
+ font->drawString((byte *)cnv->pixels + 2 + cnv->w, cnv->w, text);
font->setColor((_gameType == GType_BRA) ? 11 : 1);
- font->drawString((byte*)cnv->pixels + 1 + cnv->w, cnv->w, text);
+ font->drawString((byte *)cnv->pixels + 1 + cnv->w, cnv->w, text);
} else {
w = font->getStringWidth(text);
h = font->height();
@@ -703,8 +703,8 @@ void Gfx::unregisterLabel(GfxObj *label) {
void Gfx::copyRect(const Common::Rect &r, Graphics::Surface &src, Graphics::Surface &dst) {
- byte *s = (byte*)src.getBasePtr(r.left, r.top);
- byte *d = (byte*)dst.getBasePtr(0, 0);
+ byte *s = (byte *)src.getBasePtr(r.left, r.top);
+ byte *d = (byte *)dst.getBasePtr(0, 0);
for (uint16 i = 0; i < r.height(); i++) {
memcpy(d, s, r.width());
@@ -1017,7 +1017,7 @@ void MaskBuffer::create(uint16 width, uint16 height) {
internalWidth = w >> 2;
h = height;
size = (internalWidth * h);
- data = (byte*)calloc(size, 1);
+ data = (byte *)calloc(size, 1);
}
void MaskBuffer::free() {
@@ -1096,7 +1096,7 @@ void PathBuffer::create(uint16 width, uint16 height) {
internalWidth = w >> 3;
h = height;
size = (internalWidth * h);
- data = (byte*)calloc(size, 1);
+ data = (byte *)calloc(size, 1);
}
void PathBuffer::free() {
diff --git a/engines/parallaction/graphics.h b/engines/parallaction/graphics.h
index dacf7715ae..b43dd193b5 100644
--- a/engines/parallaction/graphics.h
+++ b/engines/parallaction/graphics.h
@@ -103,7 +103,7 @@ public:
}
byte* getData(uint16 index) {
assert(index == 0);
- return (byte*)_surf->getBasePtr(0,0);
+ return (byte *)_surf->getBasePtr(0,0);
}
void getRect(uint16 index, Common::Rect &r) {
assert(index == 0);
@@ -341,12 +341,12 @@ public:
*/
struct BackgroundInfo {
protected:
- typedef Common::Array<MaskBuffer*> MaskPatches;
+ typedef Common::Array<MaskBuffer *> MaskPatches;
MaskPatches _maskPatches;
MaskBuffer _maskBackup;
void clearMaskData();
- typedef Common::Array<PathBuffer*> PathPatches;
+ typedef Common::Array<PathBuffer *> PathPatches;
PathPatches _pathPatches;
PathBuffer _pathBackup;
void clearPathData();
@@ -415,7 +415,7 @@ public:
};
-typedef Common::Array<GfxObj*> GfxObjArray;
+typedef Common::Array<GfxObj *> GfxObjArray;
#define SCENE_DRAWLIST_SIZE 100
class Gfx {
diff --git a/engines/parallaction/gui.h b/engines/parallaction/gui.h
index 95c5653220..a6eed240c4 100644
--- a/engines/parallaction/gui.h
+++ b/engines/parallaction/gui.h
@@ -36,7 +36,7 @@ namespace Parallaction {
class MenuInputState;
class MenuInputHelper {
- typedef Common::HashMap<Common::String, MenuInputState*> StateMap;
+ typedef Common::HashMap<Common::String, MenuInputState *> StateMap;
StateMap _map;
MenuInputState *_state;
diff --git a/engines/parallaction/gui_br.cpp b/engines/parallaction/gui_br.cpp
index 56148d78d8..5bc5acf630 100644
--- a/engines/parallaction/gui_br.cpp
+++ b/engines/parallaction/gui_br.cpp
@@ -488,10 +488,10 @@ public:
_font->setColor(0);
int x = (w - questionW)/2;
int y = 13;
- _font->drawString((byte*)surf->getBasePtr(x, y), surf->pitch, question);
+ _font->drawString((byte *)surf->getBasePtr(x, y), surf->pitch, question);
x = (w - optionW)/2;
y = 13 + _font->height()*2;
- _font->drawString((byte*)surf->getBasePtr(x,y), surf->pitch, option);
+ _font->drawString((byte *)surf->getBasePtr(x,y), surf->pitch, option);
_obj = new GfxObj(kGfxObjTypeMenu, new SurfaceToFrames(surf), "quitdialog");
assert(_obj);
diff --git a/engines/parallaction/inventory.cpp b/engines/parallaction/inventory.cpp
index 8fd9f56802..1cae63be42 100644
--- a/engines/parallaction/inventory.cpp
+++ b/engines/parallaction/inventory.cpp
@@ -183,7 +183,7 @@ ItemPosition InventoryRenderer::hitTest(const Common::Point &p) const {
void InventoryRenderer::drawItem(ItemPosition pos, ItemName name) {
Common::Rect r;
getItemRect(pos, r);
- byte* d = (byte*)_surf.getBasePtr(r.left, r.top);
+ byte* d = (byte *)_surf.getBasePtr(r.left, r.top);
drawItem(name, d, _surf.pitch);
}
@@ -238,7 +238,7 @@ void InventoryRenderer::getItemRect(ItemPosition pos, Common::Rect &r) {
}
Inventory::Inventory(int maxItems, InventoryItem *verbs) : _numItems(0), _maxItems(maxItems) {
- _items = (InventoryItem*)calloc(_maxItems, sizeof(InventoryItem));
+ _items = (InventoryItem *)calloc(_maxItems, sizeof(InventoryItem));
int i = 0;
for ( ; verbs[i]._id; i++) {
diff --git a/engines/parallaction/inventory.h b/engines/parallaction/inventory.h
index 91c06d1e93..a3b7bf953f 100644
--- a/engines/parallaction/inventory.h
+++ b/engines/parallaction/inventory.h
@@ -108,7 +108,7 @@ public:
void highlightItem(ItemPosition pos, byte color);
void drawItem(ItemName name, byte *buffer, uint pitch);
- byte* getData() const { return (byte*)_surf.pixels; }
+ byte* getData() const { return (byte *)_surf.pixels; }
void getRect(Common::Rect &r) const;
int16 getNumLines() const;
diff --git a/engines/parallaction/objects.cpp b/engines/parallaction/objects.cpp
index fe21732f03..d3529c5dd9 100644
--- a/engines/parallaction/objects.cpp
+++ b/engines/parallaction/objects.cpp
@@ -386,11 +386,11 @@ ScriptVar::~ScriptVar() {
Table::Table(uint32 size) : _size(size), _used(0), _disposeMemory(true) {
- _data = (char**)calloc(size, sizeof(char*));
+ _data = (char**)calloc(size, sizeof(char *));
}
Table::Table(uint32 size, const char **data) : _size(size), _used(size), _disposeMemory(false) {
- _data = const_cast<char**>(data);
+ _data = const_cast<char **>(data);
}
Table::~Table() {
diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp
index 2fffc9071c..3b1b7d54a0 100644
--- a/engines/parallaction/parallaction.cpp
+++ b/engines/parallaction/parallaction.cpp
@@ -795,7 +795,7 @@ bool Location::keepAnimation_br(AnimationPtr a) {
return keepZone_br(a);
}
-template <class T>
+template<class T>
void Location::freeList(Common::List<T> &list, bool removeAll, Common::MemFunc1<bool, T, Location> filter) {
typedef typename Common::List<T>::iterator iterator;
iterator it = list.begin();
diff --git a/engines/parallaction/parallaction.h b/engines/parallaction/parallaction.h
index 5554eff3c5..0d56b62e2f 100644
--- a/engines/parallaction/parallaction.h
+++ b/engines/parallaction/parallaction.h
@@ -178,7 +178,7 @@ protected:
bool keepAnimation_ns(AnimationPtr a);
bool keepAnimation_br(AnimationPtr a);
- template <class T>
+ template<class T>
void freeList(Common::List<T> &list, bool removeAll, Common::MemFunc1<bool, T, Location> filter);
public:
@@ -447,7 +447,7 @@ private:
// callables data
- typedef void (Parallaction_ns::*Callable)(void*);
+ typedef void (Parallaction_ns::*Callable)(void *);
const Callable *_callables;
ZonePtr _moveSarcGetZone;
ZonePtr _moveSarcExaZone;
@@ -468,37 +468,37 @@ private:
PathWalker_NS *_walker;
// common callables
- void _c_play_boogie(void*);
- void _c_startIntro(void*);
- void _c_endIntro(void*);
- void _c_moveSheet(void*);
- void _c_sketch(void*);
- void _c_shade(void*);
- void _c_score(void*);
- void _c_fade(void*);
- void _c_moveSarc(void*);
- void _c_contaFoglie(void*);
- void _c_zeroFoglie(void*);
- void _c_trasformata(void*);
- void _c_offMouse(void*);
- void _c_onMouse(void*);
- void _c_setMask(void*);
- void _c_endComment(void*);
- void _c_frankenstein(void*);
- void _c_finito(void*);
- void _c_ridux(void*);
- void _c_testResult(void*);
+ void _c_play_boogie(void *);
+ void _c_startIntro(void *);
+ void _c_endIntro(void *);
+ void _c_moveSheet(void *);
+ void _c_sketch(void *);
+ void _c_shade(void *);
+ void _c_score(void *);
+ void _c_fade(void *);
+ void _c_moveSarc(void *);
+ void _c_contaFoglie(void *);
+ void _c_zeroFoglie(void *);
+ void _c_trasformata(void *);
+ void _c_offMouse(void *);
+ void _c_onMouse(void *);
+ void _c_setMask(void *);
+ void _c_endComment(void *);
+ void _c_frankenstein(void *);
+ void _c_finito(void *);
+ void _c_ridux(void *);
+ void _c_testResult(void *);
// dos specific callables
- void _c_null(void*);
+ void _c_null(void *);
// amiga specific callables
- void _c_projector(void*);
- void _c_HBOff(void*);
- void _c_offSound(void*);
- void _c_startMusic(void*);
- void _c_closeMusic(void*);
- void _c_HBOn(void*);
+ void _c_projector(void *);
+ void _c_HBOff(void *);
+ void _c_offSound(void *);
+ void _c_startMusic(void *);
+ void _c_closeMusic(void *);
+ void _c_HBOn(void *);
};
@@ -582,7 +582,7 @@ private:
void startIngameMenu();
void freeCharacter();
- typedef void (Parallaction_br::*Callable)(void*);
+ typedef void (Parallaction_br::*Callable)(void *);
const Callable *_callables;
static const Callable _dosCallables[6];
static const Callable _amigaCallables[6];
@@ -592,13 +592,13 @@ private:
PathWalker_BR *_walker;
// dos callables
- void _c_null(void*);
- void _c_blufade(void*);
- void _c_resetpalette(void*);
- void _c_ferrcycle(void*);
- void _c_lipsinc(void*);
- void _c_albcycle(void*);
- void _c_password(void*);
+ void _c_null(void *);
+ void _c_blufade(void *);
+ void _c_resetpalette(void *);
+ void _c_ferrcycle(void *);
+ void _c_lipsinc(void *);
+ void _c_albcycle(void *);
+ void _c_password(void *);
};
extern Parallaction *_vm;
diff --git a/engines/parallaction/parser.h b/engines/parallaction/parser.h
index 1cf8e2f7ff..3e2604eda2 100644
--- a/engines/parallaction/parser.h
+++ b/engines/parallaction/parser.h
@@ -57,7 +57,7 @@ public:
typedef Common::Functor0<void> Opcode;
-typedef Common::Array<const Opcode*> OpcodeSet;
+typedef Common::Array<const Opcode *> OpcodeSet;
@@ -69,8 +69,8 @@ public:
uint _lookup;
- Common::Stack<OpcodeSet*> _opcodes;
- Common::Stack<Table*> _statements;
+ Common::Stack<OpcodeSet *> _opcodes;
+ Common::Stack<Table *> _statements;
OpcodeSet *_currentOpcodes;
Table *_currentStatements;
@@ -199,7 +199,7 @@ protected:
void addCommand();
void clearSet(OpcodeSet &opcodes) {
- for (Common::Array<const Opcode*>::iterator i = opcodes.begin(); i != opcodes.end(); ++i)
+ for (Common::Array<const Opcode *>::iterator i = opcodes.begin(); i != opcodes.end(); ++i)
delete *i;
opcodes.clear();
}
@@ -357,7 +357,7 @@ protected:
virtual void parseRValue(ScriptVar &var, const char *str);
void clearSet(OpcodeSet &opcodes) {
- for (Common::Array<const Opcode*>::iterator i = opcodes.begin(); i != opcodes.end(); ++i)
+ for (Common::Array<const Opcode *>::iterator i = opcodes.begin(); i != opcodes.end(); ++i)
delete *i;
opcodes.clear();
}
diff --git a/engines/parallaction/parser_br.cpp b/engines/parallaction/parser_br.cpp
index df53ecca3f..0904dbf655 100644
--- a/engines/parallaction/parser_br.cpp
+++ b/engines/parallaction/parser_br.cpp
@@ -524,14 +524,14 @@ DECLARE_COMMAND_PARSER(location) {
ctxt.cmd->_startPos.x = -1000;
ctxt.cmd->_startPos2.x = -1000;
if (_tokens[ctxt.nextToken][0] != '\0') {
- if (isdigit(static_cast<unsigned char>(_tokens[ctxt.nextToken][0])) || _tokens[ctxt.nextToken][0] == '-') {
+ if (Common::isDigit(_tokens[ctxt.nextToken][0]) || _tokens[ctxt.nextToken][0] == '-') {
ctxt.cmd->_startPos.x = atoi(_tokens[ctxt.nextToken]);
ctxt.nextToken++;
ctxt.cmd->_startPos.y = atoi(_tokens[ctxt.nextToken]);
ctxt.nextToken++;
}
- if (isdigit(static_cast<unsigned char>(_tokens[ctxt.nextToken][0])) || _tokens[ctxt.nextToken][0] == '-') {
+ if (Common::isDigit(_tokens[ctxt.nextToken][0]) || _tokens[ctxt.nextToken][0] == '-') {
ctxt.cmd->_startPos2.x = atoi(_tokens[ctxt.nextToken]);
ctxt.nextToken++;
ctxt.cmd->_startPos2.y = atoi(_tokens[ctxt.nextToken]);
@@ -677,7 +677,7 @@ DECLARE_COMMAND_PARSER(text) {
createCommand(_parser->_lookup);
- if (isdigit(static_cast<unsigned char>(_tokens[1][1]))) {
+ if (Common::isDigit(_tokens[1][1])) {
ctxt.cmd->_zeta0 = atoi(_tokens[1]);
ctxt.nextToken++;
} else {
@@ -714,7 +714,7 @@ DECLARE_COMMAND_PARSER(unary) {
DECLARE_ZONE_PARSER(limits) {
debugC(7, kDebugParser, "ZONE_PARSER(limits) ");
- if (isalpha(static_cast<unsigned char>(_tokens[1][1]))) {
+ if (Common::isAlpha(_tokens[1][1])) {
ctxt.z->_flags |= kFlagsAnimLinked;
ctxt.z->_linkedName = _tokens[1];
} else {
@@ -1003,7 +1003,7 @@ DECLARE_INSTRUCTION_PARSER(text) {
int _si = 1;
- if (isdigit(static_cast<unsigned char>(_tokens[1][1]))) {
+ if (Common::isDigit(_tokens[1][1])) {
ctxt.inst->_y = atoi(_tokens[1]);
_si = 2;
} else {
@@ -1066,7 +1066,7 @@ DECLARE_INSTRUCTION_PARSER(endif) {
void ProgramParser_br::parseRValue(ScriptVar &v, const char *str) {
- if (isdigit(static_cast<unsigned char>(str[0])) || str[0] == '-') {
+ if (Common::isDigit(str[0]) || str[0] == '-') {
v.setImmediate(atoi(str));
return;
}
@@ -1131,7 +1131,7 @@ void LocationParser_br::init() {
_locationZoneStmt = new Table(ARRAYSIZE(_locationZoneStmtRes_br), _locationZoneStmtRes_br);
_locationAnimStmt = new Table(ARRAYSIZE(_locationAnimStmtRes_br), _locationAnimStmtRes_br);
- Common::Array<const Opcode*> *table = 0;
+ Common::Array<const Opcode *> *table = 0;
SetOpcodeTable(_commandParsers);
WARNING_PARSER(unexpected);
@@ -1234,7 +1234,7 @@ void ProgramParser_br::init() {
_instructionNames = new Table(ARRAYSIZE(_instructionNamesRes_br), _instructionNamesRes_br);
- Common::Array<const Opcode*> *table = 0;
+ Common::Array<const Opcode *> *table = 0;
SetOpcodeTable(_instructionParsers);
INSTRUCTION_PARSER(defLocal); // invalid opcode -> local definition
diff --git a/engines/parallaction/parser_ns.cpp b/engines/parallaction/parser_ns.cpp
index a73f1558e8..f1d1db53e9 100644
--- a/engines/parallaction/parser_ns.cpp
+++ b/engines/parallaction/parser_ns.cpp
@@ -534,7 +534,7 @@ DECLARE_INSTRUCTION_PARSER(endscript) {
void ProgramParser_ns::parseRValue(ScriptVar &v, const char *str) {
- if (isdigit(static_cast<unsigned char>(str[0])) || str[0] == '-') {
+ if (Common::isDigit(str[0]) || str[0] == '-') {
v.setImmediate(atoi(str));
return;
}
@@ -1107,7 +1107,7 @@ void LocationParser_ns::init() {
_locationZoneStmt = new Table(ARRAYSIZE(_locationZoneStmtRes_ns), _locationZoneStmtRes_ns);
_locationAnimStmt = new Table(ARRAYSIZE(_locationAnimStmtRes_ns), _locationAnimStmtRes_ns);
- Common::Array<const Opcode*> *table = 0;
+ Common::Array<const Opcode *> *table = 0;
SetOpcodeTable(_commandParsers);
WARNING_PARSER(unexpected);
@@ -1177,7 +1177,7 @@ void ProgramParser_ns::init() {
_instructionNames = new Table(ARRAYSIZE(_instructionNamesRes_ns), _instructionNamesRes_ns);
- Common::Array<const Opcode*> *table = 0;
+ Common::Array<const Opcode *> *table = 0;
SetOpcodeTable(_instructionParsers);
INSTRUCTION_PARSER(defLocal); // invalid opcode -> local definition
INSTRUCTION_PARSER(animation); // on
diff --git a/engines/parallaction/sound_br.cpp b/engines/parallaction/sound_br.cpp
index 16ffd24a82..0925e55309 100644
--- a/engines/parallaction/sound_br.cpp
+++ b/engines/parallaction/sound_br.cpp
@@ -378,7 +378,7 @@ Audio::AudioStream *AmigaSoundMan_br::loadChannelData(const char *filename, Chan
if (_vm->getFeatures() & GF_DEMO) {
uint32 dataSize = stream->size();
- int8 *data = (int8*)malloc(dataSize);
+ int8 *data = (int8 *)malloc(dataSize);
if (stream->read(data, dataSize) != dataSize)
error("DosSoundMan_br::loadChannelData: Read failed");
diff --git a/engines/parallaction/sound_ns.cpp b/engines/parallaction/sound_ns.cpp
index b5d4c72ea4..3cc25b36b0 100644
--- a/engines/parallaction/sound_ns.cpp
+++ b/engines/parallaction/sound_ns.cpp
@@ -165,7 +165,7 @@ void DosSoundMan_ns::playCharacterMusic(const char *character) {
return;
}
- char *name = const_cast<char*>(character);
+ char *name = const_cast<char *>(character);
const char *newMusicFile = 0;
if (!scumm_stricmp(name, _dinoName)) {
diff --git a/engines/queen/logic.cpp b/engines/queen/logic.cpp
index f60ac59ff1..6d90254608 100644
--- a/engines/queen/logic.cpp
+++ b/engines/queen/logic.cpp
@@ -1193,14 +1193,11 @@ void Logic::handlePinnacleRoom() {
uint16 prevObj = 0;
CmdText *cmdText = CmdText::makeCmdTextInstance(5, _vm);
cmdText->setVerb(VERB_WALK_TO);
- while (_vm->input()->mouseButton() == 0 || _entryObj == 0) {
+ while (!_vm->shouldQuit() && (_vm->input()->mouseButton() == 0 || _entryObj == 0)) {
_vm->update();
mouse = _vm->input()->getMousePos();
- // update screen scrolling
- _vm->display()->horizontalScroll(mouse.x);
-
// update bobs position / frame
joe->x = piton->x = 3 * mouse.x / 4 + 200;
joe->frameNum = mouse.x / 36 + 45;
@@ -1218,6 +1215,9 @@ void Logic::handlePinnacleRoom() {
}
prevObj = curObj;
}
+
+ // update screen scrolling
+ _vm->display()->horizontalScroll(mouse.x);
}
delete cmdText;
_vm->input()->clearMouseButton();
diff --git a/engines/queen/music.cpp b/engines/queen/music.cpp
index 858692703c..2835954003 100644
--- a/engines/queen/music.cpp
+++ b/engines/queen/music.cpp
@@ -303,7 +303,7 @@ void MidiMusic::playMusic() {
for (uint i = 0; i < packedSize; i++)
#if defined(SCUMM_NEED_ALIGNMENT)
- memcpy(&_buf[i], (byte*)((byte*)data + *(idx + i) * sizeof(uint16)), sizeof(uint16));
+ memcpy(&_buf[i], (byte *)((byte *)data + *(idx + i) * sizeof(uint16)), sizeof(uint16));
#else
_buf[i] = data[*(idx + i)];
#endif
diff --git a/engines/queen/talk.cpp b/engines/queen/talk.cpp
index f38c78c825..94bc105bb0 100644
--- a/engines/queen/talk.cpp
+++ b/engines/queen/talk.cpp
@@ -657,7 +657,7 @@ void Talk::stringAnimation(const SpeechParameters *parameters, int startFrame, i
} else if (parameters->animation[0] == 'E') {
// Talking head animation
return;
- } else if (!isdigit(static_cast<unsigned char>(parameters->animation[0]))) {
+ } else if (!Common::isDigit(parameters->animation[0])) {
debug(6, "Error in speak string animation: '%s'", parameters->animation);
return;
} else
diff --git a/engines/saga/animation.cpp b/engines/saga/animation.cpp
index 8b2d1e9dad..fd602ff4fb 100644
--- a/engines/saga/animation.cpp
+++ b/engines/saga/animation.cpp
@@ -501,7 +501,7 @@ void Anim::play(uint16 animId, int vectorTime, bool playing) {
}
anim = getAnimation(animId);
- displayBuffer = (byte*)_vm->_render->getBackGroundSurface()->pixels;
+ displayBuffer = (byte *)_vm->_render->getBackGroundSurface()->pixels;
if (playing) {
anim->state = ANIM_PLAYING;
diff --git a/engines/saga/gfx.cpp b/engines/saga/gfx.cpp
index 8e98f0fbe7..62250a0820 100644
--- a/engines/saga/gfx.cpp
+++ b/engines/saga/gfx.cpp
@@ -156,7 +156,7 @@ void Surface::transitionDissolve(const byte *sourceBuffer, const Common::Rect &s
if (sourceRect.contains(x1, y1)) {
color = sourceBuffer[(x1-sourceRect.left) + sourceRect.width()*(y1-sourceRect.top)];
if (flags == 0 || color)
- ((byte*)pixels)[seq] = color;
+ ((byte *)pixels)[seq] = color;
}
}
}
diff --git a/engines/saga/interface.cpp b/engines/saga/interface.cpp
index 994b35cbf8..a7bd7edbe5 100644
--- a/engines/saga/interface.cpp
+++ b/engines/saga/interface.cpp
@@ -1151,7 +1151,7 @@ void Interface::processStatusTextInput(Common::KeyState keystate) {
if (_statusTextInputPos >= STATUS_TEXT_INPUT_MAX) {
break;
}
- if (isalnum(keystate.ascii) || (keystate.ascii == ' ')) {
+ if (Common::isAlnum(keystate.ascii) || (keystate.ascii == ' ')) {
_statusTextInputString[_statusTextInputPos++] = keystate.ascii;
_statusTextInputString[_statusTextInputPos] = 0;
}
@@ -1209,7 +1209,7 @@ bool Interface::processTextInput(Common::KeyState keystate) {
_textInputPos = _textInputStringLength + 1;
break;
default:
- if (((keystate.ascii <= 255) && (isalnum(keystate.ascii))) || (keystate.ascii == ' ') ||
+ if (((keystate.ascii <= 255) && (Common::isAlnum(keystate.ascii))) || (keystate.ascii == ' ') ||
(keystate.ascii == '-') || (keystate.ascii == '_')) {
if (_textInputStringLength < save_title_size - 1) {
ch[0] = keystate.ascii;
diff --git a/engines/saga/isomap.cpp b/engines/saga/isomap.cpp
index ec6b13f313..945b4ad5a7 100644
--- a/engines/saga/isomap.cpp
+++ b/engines/saga/isomap.cpp
@@ -346,7 +346,7 @@ int16 IsoMap::findMulti(int16 tileIndex, int16 absU, int16 absV, int16 absH) {
if (offset + sizeof(int16) > _multiTableData.size() * sizeof(int16)) {
error("wrong multiTileEntryData->offset");
}
- tiles = (int16*)((byte*)&_multiTableData.front() + offset);
+ tiles = (int16 *)((byte *)&_multiTableData.front() + offset);
tileIndex = *tiles;
if (tileIndex >= 256) {
warning("something terrible happened");
diff --git a/engines/saga/resource.h b/engines/saga/resource.h
index 2124f3e29f..a8e2e92361 100644
--- a/engines/saga/resource.h
+++ b/engines/saga/resource.h
@@ -157,7 +157,7 @@ protected:
virtual void processPatches(Resource *resource, const GamePatchDescription *patchFiles) { }
};
-typedef Common::List<ResourceContext*> ResourceContextList;
+typedef Common::List<ResourceContext *> ResourceContextList;
struct MetaResource {
int16 sceneIndex;
diff --git a/engines/saga/script.h b/engines/saga/script.h
index 227b58a298..c4ea2d62b3 100644
--- a/engines/saga/script.h
+++ b/engines/saga/script.h
@@ -196,9 +196,9 @@ public:
case kAddressModule:
return _moduleBase;
case kAddressStack:
- return (byte*)&_stackBuf[_frameIndex];
+ return (byte *)&_stackBuf[_frameIndex];
case kAddressThread:
- return (byte*)_threadVars;
+ return (byte *)_threadVars;
default:
return _commonBase;
}
diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp
index 571d2f834b..9607a8e66d 100644
--- a/engines/sci/console.cpp
+++ b/engines/sci/console.cpp
@@ -860,14 +860,14 @@ bool Console::cmdVerifyScripts(int argc, const char **argv) {
return true;
}
- Common::List<ResourceId> *resources = _engine->getResMan()->listResources(kResourceTypeScript);
- Common::sort(resources->begin(), resources->end());
- Common::List<ResourceId>::iterator itr = resources->begin();
+ Common::List<ResourceId> resources = _engine->getResMan()->listResources(kResourceTypeScript);
+ Common::sort(resources.begin(), resources.end());
- DebugPrintf("%d SCI1.1-SCI3 scripts found, performing sanity checks...\n", resources->size());
+ DebugPrintf("%d SCI1.1-SCI3 scripts found, performing sanity checks...\n", resources.size());
Resource *script, *heap;
- while (itr != resources->end()) {
+ Common::List<ResourceId>::iterator itr;
+ for (itr = resources.begin(); itr != resources.end(); ++itr) {
script = _engine->getResMan()->findResource(*itr, false);
if (!script)
DebugPrintf("Error: script %d couldn't be loaded\n", itr->getNumber());
@@ -885,12 +885,9 @@ bool Console::cmdVerifyScripts(int argc, const char **argv) {
DebugPrintf("Error: script %d is larger than 64KB (%d bytes)\n",
itr->getNumber(), script->size);
}
-
- ++itr;
}
DebugPrintf("SCI1.1-SCI2.1 script check finished\n");
- delete resources;
return true;
}
@@ -914,9 +911,8 @@ bool Console::cmdShowInstruments(int argc, const char **argv) {
MidiParser_SCI *parser = new MidiParser_SCI(doSoundVersion, 0);
parser->setMidiDriver(player);
- Common::List<ResourceId> *resources = _engine->getResMan()->listResources(kResourceTypeSound);
- Common::sort(resources->begin(), resources->end());
- Common::List<ResourceId>::iterator itr = resources->begin();
+ Common::List<ResourceId> resources = _engine->getResMan()->listResources(kResourceTypeSound);
+ Common::sort(resources.begin(), resources.end());
int instruments[128];
bool instrumentsSongs[128][1000];
@@ -928,26 +924,21 @@ bool Console::cmdShowInstruments(int argc, const char **argv) {
instrumentsSongs[i][j] = false;
if (songNumber == -1) {
- DebugPrintf("%d sounds found, checking their instrument mappings...\n", resources->size());
+ DebugPrintf("%d sounds found, checking their instrument mappings...\n", resources.size());
DebugPrintf("Instruments:\n");
DebugPrintf("============\n");
}
- SoundResource *sound;
-
- while (itr != resources->end()) {
- if (songNumber >= 0 && itr->getNumber() != songNumber) {
- ++itr;
+ Common::List<ResourceId>::iterator itr;
+ for (itr = resources.begin(); itr != resources.end(); ++itr) {
+ if (songNumber >= 0 && itr->getNumber() != songNumber)
continue;
- }
- sound = new SoundResource(itr->getNumber(), _engine->getResMan(), doSoundVersion);
- int channelFilterMask = sound->getChannelFilterMask(player->getPlayId(), player->hasRhythmChannel());
- SoundResource::Track *track = sound->getTrackByType(player->getPlayId());
+ SoundResource sound(itr->getNumber(), _engine->getResMan(), doSoundVersion);
+ int channelFilterMask = sound.getChannelFilterMask(player->getPlayId(), player->hasRhythmChannel());
+ SoundResource::Track *track = sound.getTrackByType(player->getPlayId());
if (track->digitalChannelNr != -1) {
// Skip digitized sound effects
- delete sound;
- ++itr;
continue;
}
@@ -1027,9 +1018,6 @@ bool Console::cmdShowInstruments(int argc, const char **argv) {
} while (!endOfTrack);
DebugPrintf("\n");
-
- delete sound;
- ++itr;
}
delete parser;
@@ -1069,7 +1057,6 @@ bool Console::cmdShowInstruments(int argc, const char **argv) {
DebugPrintf("\n\n");
}
- delete resources;
return true;
}
@@ -1132,12 +1119,12 @@ bool Console::cmdList(int argc, const char **argv) {
number = atoi(argv[2]);
}
- Common::List<ResourceId> *resources = _engine->getResMan()->listResources(res, number);
- Common::sort(resources->begin(), resources->end());
- Common::List<ResourceId>::iterator itr = resources->begin();
+ Common::List<ResourceId> resources = _engine->getResMan()->listResources(res, number);
+ Common::sort(resources.begin(), resources.end());
int cnt = 0;
- while (itr != resources->end()) {
+ Common::List<ResourceId>::iterator itr;
+ for (itr = resources.begin(); itr != resources.end(); ++itr) {
if (number == -1) {
DebugPrintf("%8i", itr->getNumber());
if (++cnt % 10 == 0)
@@ -1149,10 +1136,8 @@ bool Console::cmdList(int argc, const char **argv) {
if (++cnt % 4 == 0)
DebugPrintf("\n");
}
- ++itr;
}
DebugPrintf("\n");
- delete resources;
}
return true;
@@ -1448,7 +1433,7 @@ bool Console::cmdSaid(int argc, const char **argv) {
_engine->getVocabulary()->dumpParseTree();
_engine->getVocabulary()->parserIsValid = true;
- int ret = said((byte*)spec, true);
+ int ret = said((byte *)spec, true);
DebugPrintf("kSaid: %s\n", (ret == SAID_NO_MATCH ? "No match" : "Match"));
}
@@ -1620,7 +1605,7 @@ bool Console::cmdWindowList(int argc, const char **argv) {
bool Console::cmdSavedBits(int argc, const char **argv) {
SegManager *segman = _engine->_gamestate->_segMan;
SegmentId id = segman->findSegmentByType(SEG_TYPE_HUNK);
- HunkTable* hunks = (HunkTable*)segman->getSegmentObj(id);
+ HunkTable* hunks = (HunkTable *)segman->getSegmentObj(id);
if (!hunks) {
DebugPrintf("No hunk segment found.\n");
return true;
@@ -1632,7 +1617,7 @@ bool Console::cmdSavedBits(int argc, const char **argv) {
uint16 offset = entries[i].offset;
const Hunk& h = hunks->_table[offset];
if (strcmp(h.type, "SaveBits()") == 0) {
- byte* memoryPtr = (byte*)h.mem;
+ byte* memoryPtr = (byte *)h.mem;
if (memoryPtr) {
DebugPrintf("%04x:%04x:", PRINT_REG(entries[i]));
@@ -1686,7 +1671,7 @@ bool Console::cmdShowSavedBits(int argc, const char **argv) {
SegManager *segman = _engine->_gamestate->_segMan;
SegmentId id = segman->findSegmentByType(SEG_TYPE_HUNK);
- HunkTable* hunks = (HunkTable*)segman->getSegmentObj(id);
+ HunkTable* hunks = (HunkTable *)segman->getSegmentObj(id);
if (!hunks) {
DebugPrintf("No hunk segment found.\n");
return true;
@@ -2915,12 +2900,11 @@ bool Console::cmdDisassembleAddress(int argc, const char **argv) {
}
void Console::printKernelCallsFound(int kernelFuncNum, bool showFoundScripts) {
- Common::List<ResourceId> *resources = _engine->getResMan()->listResources(kResourceTypeScript);
- Common::sort(resources->begin(), resources->end());
- Common::List<ResourceId>::iterator itr = resources->begin();
+ Common::List<ResourceId> resources = _engine->getResMan()->listResources(kResourceTypeScript);
+ Common::sort(resources.begin(), resources.end());
if (showFoundScripts)
- DebugPrintf("%d scripts found, dissassembling...\n", resources->size());
+ DebugPrintf("%d scripts found, dissassembling...\n", resources.size());
int scriptSegment;
Script *script;
@@ -2928,13 +2912,13 @@ void Console::printKernelCallsFound(int kernelFuncNum, bool showFoundScripts) {
// manager won't be affected by loading and unloading scripts here.
SegManager *customSegMan = new SegManager(_engine->getResMan());
- while (itr != resources->end()) {
+ Common::List<ResourceId>::iterator itr;
+ for (itr = resources.begin(); itr != resources.end(); ++itr) {
// Ignore specific leftover scripts, which require other non-existing scripts
if ((_engine->getGameId() == GID_HOYLE3 && itr->getNumber() == 995) ||
(_engine->getGameId() == GID_KQ5 && itr->getNumber() == 980) ||
(_engine->getGameId() == GID_SLATER && itr->getNumber() == 947) ||
(_engine->getGameId() == GID_MOTHERGOOSE256 && itr->getNumber() == 980)) {
- itr++;
continue;
}
@@ -2993,12 +2977,9 @@ void Console::printKernelCallsFound(int kernelFuncNum, bool showFoundScripts) {
} // for (it = script->_objects.begin(); it != end; ++it)
customSegMan->uninstantiateScript(itr->getNumber());
- ++itr;
}
delete customSegMan;
-
- delete resources;
}
bool Console::cmdFindKernelFunctionCall(int argc, const char **argv) {
diff --git a/engines/sci/detection.cpp b/engines/sci/detection.cpp
index 80f45b4325..c43849056b 100644
--- a/engines/sci/detection.cpp
+++ b/engines/sci/detection.cpp
@@ -303,29 +303,29 @@ Common::String convertSierraGameId(Common::String sierraId, uint32 *gameFlags, R
if (sierraId == "fp" || sierraId == "gk" || sierraId == "pq4")
demoThreshold = 150;
- Common::ScopedPtr<Common::List<ResourceId> > resources(resMan.listResources(kResourceTypeScript, -1));
- if (resources->size() < demoThreshold) {
+ Common::List<ResourceId> resources = resMan.listResources(kResourceTypeScript, -1);
+ if (resources.size() < demoThreshold) {
*gameFlags |= ADGF_DEMO;
// Crazy Nick's Picks
- if (sierraId == "lsl1" && resources->size() == 34)
+ if (sierraId == "lsl1" && resources.size() == 34)
return "cnick-lsl";
- if (sierraId == "sq4" && resources->size() == 34)
+ if (sierraId == "sq4" && resources.size() == 34)
return "cnick-sq";
- if (sierraId == "hoyle3" && resources->size() == 42)
+ if (sierraId == "hoyle3" && resources.size() == 42)
return "cnick-kq";
- if (sierraId == "rh budget" && resources->size() == 39)
+ if (sierraId == "rh budget" && resources.size() == 39)
return "cnick-longbow";
// TODO: cnick-laurabow (the name of the game object contains junk)
// Handle Astrochicken 1 (SQ3) and 2 (SQ4)
- if (sierraId == "sq3" && resources->size() == 20)
+ if (sierraId == "sq3" && resources.size() == 20)
return "astrochicken";
if (sierraId == "sq4")
return "msastrochicken";
}
- if (sierraId == "torin" && resources->size() == 226) // Torin's Passage demo
+ if (sierraId == "torin" && resources.size() == 226) // Torin's Passage demo
*gameFlags |= ADGF_DEMO;
for (const OldNewIdTableEntry *cur = s_oldNewTable; cur->oldId[0]; ++cur) {
@@ -350,7 +350,7 @@ Common::String convertSierraGameId(Common::String sierraId, uint32 *gameFlags, R
return "qfg4";
// qfg4 demo has less than 50 scripts
- if (resources->size() < 50)
+ if (resources.size() < 50)
return "qfg4";
// Otherwise it's qfg3
diff --git a/engines/sci/engine/features.cpp b/engines/sci/engine/features.cpp
index a5c1b970f1..b3cfee873c 100644
--- a/engines/sci/engine/features.cpp
+++ b/engines/sci/engine/features.cpp
@@ -430,19 +430,16 @@ SciVersion GameFeatures::detectMessageFunctionType() {
return _messageFunctionType;
}
- Common::List<ResourceId> *resources = g_sci->getResMan()->listResources(kResourceTypeMessage, -1);
-
- if (resources->empty()) {
- delete resources;
+ Common::List<ResourceId> resources = g_sci->getResMan()->listResources(kResourceTypeMessage, -1);
+ if (resources.empty()) {
// No messages found, so this doesn't really matter anyway...
_messageFunctionType = SCI_VERSION_1_1;
return _messageFunctionType;
}
- Resource *res = g_sci->getResMan()->findResource(*resources->begin(), false);
+ Resource *res = g_sci->getResMan()->findResource(*resources.begin(), false);
assert(res);
- delete resources;
// Only v2 Message resources use the kGetMessage kernel function.
// v3-v5 use the kMessage kernel function.
diff --git a/engines/sci/engine/kernel_tables.h b/engines/sci/engine/kernel_tables.h
index fe0c9fc2ef..622511c906 100644
--- a/engines/sci/engine/kernel_tables.h
+++ b/engines/sci/engine/kernel_tables.h
@@ -610,6 +610,12 @@ static SciKernelMapEntry s_kernelMap[] = {
{ MAP_DUMMY(DeletePic), SIG_EVERYWHERE, "(.*)", NULL, NULL },
{ MAP_DUMMY(GetSierraProfileString), SIG_EVERYWHERE, "(.*)", NULL, NULL },
+ // Unused / debug functions in the in-between SCI2.1 interpreters
+ { MAP_DUMMY(PreloadResource), SIG_EVERYWHERE, "(.*)", NULL, NULL },
+ { MAP_DUMMY(CheckCDisc), SIG_EVERYWHERE, "(.*)", NULL, NULL },
+ { MAP_DUMMY(GetSaveCDisc), SIG_EVERYWHERE, "(.*)", NULL, NULL },
+ { MAP_DUMMY(TestPoly), SIG_EVERYWHERE, "(.*)", NULL, NULL },
+
// SCI2.1 unmapped functions - TODO!
// MovePlaneItems - used by SQ6 to scroll through the inventory via the up/down buttons
diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp
index ce903626e7..aade40fd9f 100644
--- a/engines/sci/engine/kfile.cpp
+++ b/engines/sci/engine/kfile.cpp
@@ -823,7 +823,7 @@ reg_t kFileIOWriteRaw(EngineState *s, int argc, reg_t *argv) {
int size = argv[2].toUint16();
char *buf = new char[size];
bool success = false;
- s->_segMan->memcpy((byte*)buf, argv[1], size);
+ s->_segMan->memcpy((byte *)buf, argv[1], size);
debugC(kDebugLevelFile, "kFileIO(writeRaw): %d, %d", handle, size);
FileHandle *f = getFileFromHandle(s, handle);
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index 76c6778f0a..caae562d67 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -25,6 +25,7 @@
#include "engines/util.h"
#include "graphics/cursorman.h"
#include "graphics/surface.h"
+#include "graphics/palette.h" // temporary, for the fadeIn()/fadeOut() functions below
#include "gui/message.h"
@@ -58,11 +59,13 @@
namespace Sci {
static int16 adjustGraphColor(int16 color) {
- // WORKAROUND: SCI1 EGA and Amiga games can set invalid colors (above 0 - 15).
- // Colors above 15 are all white in SCI1 EGA games, which is why this was never
- // observed. We clip them all to (0, 15) instead, as colors above 15 are used
- // for the undithering algorithm in EGA games - bug #3048908.
- if (getSciVersion() >= SCI_VERSION_1_EARLY && g_sci->getResMan()->getViewType() == kViewEga)
+ // WORKAROUND: EGA and Amiga games can set invalid colors (above 0 - 15).
+ // It seems only the lower nibble was used in these games.
+ // bug #3048908, #3486899.
+ // Confirmed in EGA games KQ4(late), QFG1(ega), LB1 that
+ // at least FillBox (only one of the functions using adjustGraphColor)
+ // behaves like this.
+ if (g_sci->getResMan()->getViewType() == kViewEga)
return color & 0x0F; // 0 - 15
else
return color;
@@ -1212,7 +1215,8 @@ reg_t kRemapColors(EngineState *s, int argc, reg_t *argv) {
switch (operation) {
case 0: { // Set remapping to base. 0 turns remapping off.
int16 base = (argc >= 2) ? argv[1].toSint16() : 0;
- warning("kRemapColors: Set remapping to base %d", base);
+ if (base != 0) // 0 is the default behavior when changing rooms in GK1, thus silencing the warning
+ warning("kRemapColors: Set remapping to base %d", base);
}
break;
case 1: { // unknown
@@ -1440,6 +1444,46 @@ reg_t kWinHelp(EngineState *s, int argc, reg_t *argv) {
return s->r_acc;
}
+// Taken from the SCI16 GfxTransitions class
+static void fadeOut() {
+ byte oldPalette[3 * 256], workPalette[3 * 256];
+ int16 stepNr, colorNr;
+ // Sierra did not fade in/out color 255 for sci1.1, but they used it in
+ // several pictures (e.g. qfg3 demo/intro), so the fading looked weird
+ int16 tillColorNr = getSciVersion() >= SCI_VERSION_1_1 ? 255 : 254;
+
+ g_system->getPaletteManager()->grabPalette(oldPalette, 0, 256);
+
+ for (stepNr = 100; stepNr >= 0; stepNr -= 10) {
+ for (colorNr = 1; colorNr <= tillColorNr; colorNr++) {
+ if (g_sci->_gfxPalette->colorIsFromMacClut(colorNr)) {
+ workPalette[colorNr * 3 + 0] = oldPalette[colorNr * 3];
+ workPalette[colorNr * 3 + 1] = oldPalette[colorNr * 3 + 1];
+ workPalette[colorNr * 3 + 2] = oldPalette[colorNr * 3 + 2];
+ } else {
+ workPalette[colorNr * 3 + 0] = oldPalette[colorNr * 3] * stepNr / 100;
+ workPalette[colorNr * 3 + 1] = oldPalette[colorNr * 3 + 1] * stepNr / 100;
+ workPalette[colorNr * 3 + 2] = oldPalette[colorNr * 3 + 2] * stepNr / 100;
+ }
+ }
+ g_system->getPaletteManager()->setPalette(workPalette + 3, 1, tillColorNr);
+ g_sci->getEngineState()->wait(2);
+ }
+}
+
+// Taken from the SCI16 GfxTransitions class
+static void fadeIn() {
+ int16 stepNr;
+ // Sierra did not fade in/out color 255 for sci1.1, but they used it in
+ // several pictures (e.g. qfg3 demo/intro), so the fading looked weird
+ int16 tillColorNr = getSciVersion() >= SCI_VERSION_1_1 ? 255 : 254;
+
+ for (stepNr = 0; stepNr <= 100; stepNr += 10) {
+ g_sci->_gfxPalette->kernelSetIntensity(1, tillColorNr + 1, stepNr, true);
+ g_sci->getEngineState()->wait(2);
+ }
+}
+
/**
* Used for scene transitions, replacing (but reusing parts of) the old
* transition code.
@@ -1450,31 +1494,65 @@ reg_t kSetShowStyle(EngineState *s, int argc, reg_t *argv) {
// tables inside graphics/transitions.cpp
uint16 showStyle = argv[0].toUint16(); // 0 - 15
reg_t planeObj = argv[1]; // the affected plane
- //argv[2] // seconds that the transition lasts
- //argv[3] // back color to be used(?)
- //int16 priority = argv[4].toSint16();
- //argv[5] // boolean, animate or not while the transition lasts
- //argv[6] // refFrame
+ uint16 seconds = argv[2].toUint16(); // seconds that the transition lasts
+ uint16 backColor = argv[3].toUint16(); // target back color(?). When fading out, it's 0x0000. When fading in, it's 0xffff
+ int16 priority = argv[4].toSint16(); // always 0xc8 (200) when fading in/out
+ uint16 animate = argv[5].toUint16(); // boolean, animate or not while the transition lasts
+ uint16 refFrame = argv[6].toUint16(); // refFrame, always 0 when fading in/out
+ int16 divisions;
// If the game has the pFadeArray selector, another parameter is used here,
// before the optional last parameter
- /*bool hasFadeArray = g_sci->getKernel()->findSelector("pFadeArray") > 0;
+ bool hasFadeArray = g_sci->getKernel()->findSelector("pFadeArray") > 0;
if (hasFadeArray) {
// argv[7]
- //int16 unk7 = (argc >= 9) ? argv[8].toSint16() : 0; // divisions (transition steps?)
+ divisions = (argc >= 9) ? argv[8].toSint16() : -1; // divisions (transition steps?)
} else {
- //int16 unk7 = (argc >= 8) ? argv[7].toSint16() : 0; // divisions (transition steps?)
- }*/
+ divisions = (argc >= 8) ? argv[7].toSint16() : -1; // divisions (transition steps?)
+ }
if (showStyle > 15) {
warning("kSetShowStyle: Illegal style %d for plane %04x:%04x", showStyle, PRINT_REG(planeObj));
return s->r_acc;
}
+ // TODO: Proper implementation. This is a very basic version. I'm not even
+ // sure if the rest of the styles will work with this mechanism.
+
+ // Check if the passed parameters are the ones we expect
+ if (showStyle == 13 || showStyle == 14) { // fade out / fade in
+ if (seconds != 1)
+ warning("kSetShowStyle(fade): seconds isn't 1, it's %d", seconds);
+ if (backColor != 0 && backColor != 0xFFFF)
+ warning("kSetShowStyle(fade): backColor isn't 0 or 0xFFFF, it's %d", backColor);
+ if (priority != 200)
+ warning("kSetShowStyle(fade): priority isn't 200, it's %d", priority);
+ if (animate != 0)
+ warning("kSetShowStyle(fade): animate isn't 0, it's %d", animate);
+ if (refFrame != 0)
+ warning("kSetShowStyle(fade): refFrame isn't 0, it's %d", refFrame);
+ if (divisions >= 0 && divisions != 20)
+ warning("kSetShowStyle(fade): divisions isn't 20, it's %d", divisions);
+ }
+
// TODO: Check if the plane is in the list of planes to draw
- // TODO: This is all a stub/skeleton, thus we're invoking kStub() for now
- kStub(s, argc, argv);
+ switch (showStyle) {
+ //case 0: // no transition, perhaps? (like in the previous SCI versions)
+ case 13: // fade out
+ // TODO: Temporary implementation, which ignores all additional parameters
+ fadeOut();
+ break;
+ case 14: // fade in
+ // TODO: Temporary implementation, which ignores all additional parameters
+ g_sci->_gfxFrameout->kernelFrameout(); // draw new scene before fading in
+ fadeIn();
+ break;
+ default:
+ // TODO: This is all a stub/skeleton, thus we're invoking kStub() for now
+ kStub(s, argc, argv);
+ break;
+ }
return s->r_acc;
}
diff --git a/engines/sci/engine/klists.cpp b/engines/sci/engine/klists.cpp
index 83e59c9c20..2a33df26bc 100644
--- a/engines/sci/engine/klists.cpp
+++ b/engines/sci/engine/klists.cpp
@@ -753,7 +753,6 @@ reg_t kArray(EngineState *s, int argc, reg_t *argv) {
reg_t arrayHandle = argv[1];
SciArray<reg_t> *array1 = s->_segMan->lookupArray(argv[1]);
- //SciArray<reg_t> *array1 = !argv[1].isNull() ? s->_segMan->lookupArray(argv[1]) : s->_segMan->allocateArray(&arrayHandle);
SciArray<reg_t> *array2 = s->_segMan->lookupArray(argv[3]);
uint32 index1 = argv[2].toUint16();
uint32 index2 = argv[4].toUint16();
@@ -790,21 +789,8 @@ reg_t kArray(EngineState *s, int argc, reg_t *argv) {
#endif
return NULL_REG;
}
- SegmentType sourceType = s->_segMan->getSegmentObj(argv[1].segment)->getType();
- if (sourceType == SEG_TYPE_SCRIPT) {
- // A technique used in later SCI2.1 and SCI3 games: the contents of a script
- // are loaded in an array (well, actually a string).
- Script *scr = s->_segMan->getScript(argv[1].segment);
- reg_t stringHandle;
-
- SciString *dupString = s->_segMan->allocateString(&stringHandle);
- dupString->setSize(scr->getBufSize());
- dupString->fromString(Common::String((const char *)scr->getBuf()));
-
- return stringHandle;
- } else if (sourceType != SEG_TYPE_ARRAY && sourceType != SEG_TYPE_SCRIPT) {
- error("kArray(Dup): Request to duplicate a segment which isn't an array or a script");
- }
+ if (s->_segMan->getSegmentObj(argv[1].segment)->getType() != SEG_TYPE_ARRAY)
+ error("kArray(Dup): Request to duplicate a segment which isn't an array");
reg_t arrayHandle;
SciArray<reg_t> *dupArray = s->_segMan->allocateArray(&arrayHandle);
diff --git a/engines/sci/engine/kpathing.cpp b/engines/sci/engine/kpathing.cpp
index 375aeaa06b..089b325a7f 100644
--- a/engines/sci/engine/kpathing.cpp
+++ b/engines/sci/engine/kpathing.cpp
@@ -1545,7 +1545,6 @@ reg_t kAvoidPath(EngineState *s, int argc, reg_t *argv) {
default:
warning("Unknown AvoidPath subfunction %d", argc);
return NULL_REG;
- break;
}
}
diff --git a/engines/sci/engine/kscripts.cpp b/engines/sci/engine/kscripts.cpp
index 93c1fffe3c..9b0e490d7e 100644
--- a/engines/sci/engine/kscripts.cpp
+++ b/engines/sci/engine/kscripts.cpp
@@ -74,17 +74,13 @@ reg_t kLock(EngineState *s, int argc, reg_t *argv) {
case 0 :
if (id.getNumber() == 0xFFFF) {
// Unlock all resources of the requested type
- Common::List<ResourceId> *resources = g_sci->getResMan()->listResources(type);
- Common::List<ResourceId>::iterator itr = resources->begin();
-
- while (itr != resources->end()) {
+ Common::List<ResourceId> resources = g_sci->getResMan()->listResources(type);
+ Common::List<ResourceId>::iterator itr;
+ for (itr = resources.begin(); itr != resources.end(); ++itr) {
Resource *res = g_sci->getResMan()->testResource(*itr);
if (res->isLocked())
g_sci->getResMan()->unlockResource(res);
- ++itr;
}
-
- delete resources;
} else {
which = g_sci->getResMan()->findResource(id, 0);
diff --git a/engines/sci/engine/kstring.cpp b/engines/sci/engine/kstring.cpp
index 5ae18c1367..fe8d631497 100644
--- a/engines/sci/engine/kstring.cpp
+++ b/engines/sci/engine/kstring.cpp
@@ -147,7 +147,7 @@ reg_t kReadNumber(EngineState *s, int argc, reg_t *argv) {
Common::String source_str = s->_segMan->getString(argv[0]);
const char *source = source_str.c_str();
- while (isspace((unsigned char)*source))
+ while (Common::isSpace(*source))
source++; /* Skip whitespace */
int16 result = 0;
@@ -246,14 +246,14 @@ reg_t kFormat(EngineState *s, int argc, reg_t *argv) {
/* int writelength; -- unused atm */
- if (xfer && (isdigit(static_cast<unsigned char>(xfer)) || xfer == '-' || xfer == '=')) {
+ if (xfer && (Common::isDigit(xfer) || xfer == '-' || xfer == '=')) {
char *destp;
if (xfer == '0')
fillchar = '0';
else if (xfer == '=')
align = ALIGN_CENTER;
- else if (isdigit(static_cast<unsigned char>(xfer)) || (xfer == '-'))
+ else if (Common::isDigit(xfer) || (xfer == '-'))
source--; // Go to start of length argument
strLength = strtol(source, &destp, 10);
@@ -745,28 +745,16 @@ reg_t kString(EngineState *s, int argc, reg_t *argv) {
return make_reg(0, strcmp(string1.c_str(), string2.c_str()));
}
case 8: { // Dup
- const char *rawString = 0;
- uint32 size = 0;
reg_t stringHandle;
- // We allocate the new string first because if the StringTable needs to
- // grow, our rawString pointer will be invalidated
+
SciString *dupString = s->_segMan->allocateString(&stringHandle);
if (argv[1].segment == s->_segMan->getStringSegmentId()) {
- SciString *string = s->_segMan->lookupString(argv[1]);
- rawString = string->getRawData();
- size = string->getSize();
+ *dupString = *s->_segMan->lookupString(argv[1]);
} else {
- Common::String string = s->_segMan->getString(argv[1]);
- rawString = string.c_str();
- size = string.size() + 1;
+ dupString->fromString(s->_segMan->getString(argv[1]));
}
- dupString->setSize(size);
-
- for (uint32 i = 0; i < size; i++)
- dupString->setValue(i, rawString[i]);
-
return stringHandle;
}
case 9: // Getdata
diff --git a/engines/sci/engine/message.cpp b/engines/sci/engine/message.cpp
index f30f4e923e..cddd01e10c 100644
--- a/engines/sci/engine/message.cpp
+++ b/engines/sci/engine/message.cpp
@@ -345,7 +345,7 @@ bool MessageState::stringLit(Common::String &outStr, const Common::String &inStr
}
bool MessageState::stringStage(Common::String &outstr, const Common::String &inStr, uint &index) {
- // Stage directions of the form (n*), where n is anything but a digit or a lowercase character
+ // Stage directions of the form (n *), where n is anything but a digit or a lowercase character
if (inStr[index] != '(')
return false;
diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp
index f1c7133d01..404bea799d 100644
--- a/engines/sci/engine/savegame.cpp
+++ b/engines/sci/engine/savegame.cpp
@@ -66,7 +66,7 @@ void syncWithSerializer(Common::Serializer &s, T &obj) {
}
// By default, sync using syncWithSerializer, which in turn can easily be overloaded.
-template <typename T>
+template<typename T>
struct DefaultSyncer : Common::BinaryFunction<Common::Serializer, T, void> {
void operator()(Common::Serializer &s, T &obj) const {
//obj.saveLoadWithSerializer(s);
@@ -87,7 +87,7 @@ struct DefaultSyncer : Common::BinaryFunction<Common::Serializer, T, void> {
*
* TODO: Add something like this for lists, queues....
*/
-template <typename T, class Syncer = DefaultSyncer<T> >
+template<typename T, class Syncer = DefaultSyncer<T> >
struct ArraySyncer : Common::BinaryFunction<Common::Serializer, T, void> {
void operator()(Common::Serializer &s, Common::Array<T> &arr) const {
uint len = arr.size();
@@ -113,13 +113,13 @@ void syncArray(Common::Serializer &s, Common::Array<T> &arr) {
}
-template <>
+template<>
void syncWithSerializer(Common::Serializer &s, reg_t &obj) {
s.syncAsUint16LE(obj.segment);
s.syncAsUint16LE(obj.offset);
}
-template <>
+template<>
void syncWithSerializer(Common::Serializer &s, synonym_t &obj) {
s.syncAsUint16LE(obj.replaceant);
s.syncAsUint16LE(obj.replacement);
@@ -247,7 +247,7 @@ void SegManager::saveLoadWithSerializer(Common::Serializer &s) {
}
-template <>
+template<>
void syncWithSerializer(Common::Serializer &s, Class &obj) {
s.syncAsSint32LE(obj.script);
syncWithSerializer(s, obj.reg);
@@ -326,14 +326,14 @@ void Object::saveLoadWithSerializer(Common::Serializer &s) {
syncArray<reg_t>(s, _variables);
}
-template <>
+template<>
void syncWithSerializer(Common::Serializer &s, SegmentObjTable<Clone>::Entry &obj) {
s.syncAsSint32LE(obj.next_free);
syncWithSerializer<Object>(s, obj);
}
-template <>
+template<>
void syncWithSerializer(Common::Serializer &s, SegmentObjTable<List>::Entry &obj) {
s.syncAsSint32LE(obj.next_free);
@@ -341,7 +341,7 @@ void syncWithSerializer(Common::Serializer &s, SegmentObjTable<List>::Entry &obj
syncWithSerializer(s, obj.last);
}
-template <>
+template<>
void syncWithSerializer(Common::Serializer &s, SegmentObjTable<Node>::Entry &obj) {
s.syncAsSint32LE(obj.next_free);
@@ -352,7 +352,7 @@ void syncWithSerializer(Common::Serializer &s, SegmentObjTable<Node>::Entry &obj
}
#ifdef ENABLE_SCI32
-template <>
+template<>
void syncWithSerializer(Common::Serializer &s, SegmentObjTable<SciArray<reg_t> >::Entry &obj) {
s.syncAsSint32LE(obj.next_free);
@@ -388,7 +388,7 @@ void syncWithSerializer(Common::Serializer &s, SegmentObjTable<SciArray<reg_t> >
}
}
-template <>
+template<>
void syncWithSerializer(Common::Serializer &s, SegmentObjTable<SciString>::Entry &obj) {
s.syncAsSint32LE(obj.next_free);
@@ -416,7 +416,7 @@ void syncWithSerializer(Common::Serializer &s, SegmentObjTable<SciString>::Entry
}
#endif
-template <typename T>
+template<typename T>
void sync_Table(Common::Serializer &s, T &obj) {
s.syncAsSint32LE(obj.first_free);
s.syncAsSint32LE(obj.entries_used);
diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp
index 7efcb42f4b..187f1ce021 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -366,7 +366,7 @@ const uint16 freddypharkasPatchLadderEvent[] = {
// script, description, magic DWORD, adjust
const SciScriptSignature freddypharkasSignatures[] = {
{ 0, "CD: score early disposal", 1, PATCH_MAGICDWORD(0x39, 0x0d, 0x43, 0x75), -3, freddypharkasSignatureScoreDisposal, freddypharkasPatchScoreDisposal },
- { 235, "CD: canister pickup hang", 3, PATCH_MAGICDWORD(0x39, 0x07, 0x39, 0x08), -4, freddypharkasSignatureCanisterHang, freddypharkasPatchCanisterHang },
+ { 235, "CD: canister pickup hang", 3, PATCH_MAGICDWORD(0x39, 0x07, 0x39, 0x08), -4, freddypharkasSignatureCanisterHang, freddypharkasPatchCanisterHang },
{ 320, "ladder event issue", 2, PATCH_MAGICDWORD(0x6d, 0x76, 0x38, 0xf5), -1, freddypharkasSignatureLadderEvent, freddypharkasPatchLadderEvent },
SCI_SIGNATUREENTRY_TERMINATOR
};
@@ -437,8 +437,68 @@ const uint16 gk1PatchDay5PhoneFreeze[] = {
PATCH_END
};
+// Floppy version: Interrogation::dispose() compares an object reference
+// (stored in the view selector) with a number, leading to a crash (this kind
+// of comparison was not used in SCI32). The view selector is used to store
+// both a view number (in some cases), and a view reference (in other cases).
+// In the floppy version, the checks are in the wrong order, so there is a
+// comparison between a number an an object. In the CD version, the checks are
+// in the correct order, thus the comparison is correct, thus we use the code
+// from the CD version in the floppy one.
+const byte gk1SignatureInterrogationBug[] = {
+ 43,
+ 0x65, 0x4c, // aTop 4c
+ 0x67, 0x50, // pTos 50
+ 0x34, 0x10, 0x27, // ldi 2710
+ 0x1e, // gt?
+ 0x31, 0x08, // bnt 08 [05a0]
+ 0x67, 0x50, // pTos 50
+ 0x34, 0x10, 0x27, // ldi 2710
+ 0x04, // sub
+ 0x65, 0x50, // aTop 50
+ 0x63, 0x50, // pToa 50
+ 0x31, 0x15, // bnt 15 [05b9]
+ 0x39, 0x0e, // pushi 0e
+ 0x76, // push0
+ 0x4a, 0x04, 0x00, // send 0004
+ 0xa5, 0x00, // sat 00
+ 0x38, 0x93, 0x00, // pushi 0093
+ 0x76, // push0
+ 0x63, 0x50, // pToa 50
+ 0x4a, 0x04, 0x00, // send 0004
+ 0x85, 0x00, // lat 00
+ 0x65, 0x50, // aTop 50
+ 0
+};
+
+const uint16 gk1PatchInterrogationBug[] = {
+ 0x65, 0x4c, // aTop 4c
+ 0x63, 0x50, // pToa 50
+ 0x31, 0x15, // bnt 15 [05b9]
+ 0x39, 0x0e, // pushi 0e
+ 0x76, // push0
+ 0x4a, 0x04, 0x00, // send 0004
+ 0xa5, 0x00, // sat 00
+ 0x38, 0x93, 0x00, // pushi 0093
+ 0x76, // push0
+ 0x63, 0x50, // pToa 50
+ 0x4a, 0x04, 0x00, // send 0004
+ 0x85, 0x00, // lat 00
+ 0x65, 0x50, // aTop 50
+ 0x67, 0x50, // pTos 50
+ 0x34, 0x10, 0x27, // ldi 2710
+ 0x1e, // gt?
+ 0x31, 0x08, // bnt 08 [05b9]
+ 0x67, 0x50, // pTos 50
+ 0x34, 0x10, 0x27, // ldi 2710
+ 0x04, // sub
+ 0x65, 0x50, // aTop 50
+ PATCH_END
+};
+
// script, description, magic DWORD, adjust
const SciScriptSignature gk1Signatures[] = {
+ { 51, "interrogation bug", 1, PATCH_MAGICDWORD(0x65, 0x4c, 0x67, 0x50), 0, gk1SignatureInterrogationBug, gk1PatchInterrogationBug },
{ 212, "day 5 phone freeze", 1, PATCH_MAGICDWORD(0x35, 0x03, 0x65, 0x1a), 0, gk1SignatureDay5PhoneFreeze, gk1PatchDay5PhoneFreeze },
{ 230, "day 6 police beignet timer issue", 1, PATCH_MAGICDWORD(0x34, 0xdc, 0x00, 0x65), -16, gk1SignatureDay6PoliceBeignet, gk1PatchDay6PoliceBeignet },
{ 230, "day 6 police sleep timer issue", 1, PATCH_MAGICDWORD(0x34, 0xdc, 0x00, 0x65), -5, gk1SignatureDay6PoliceSleep, gk1PatchDay6PoliceSleep },
diff --git a/engines/sci/engine/scriptdebug.cpp b/engines/sci/engine/scriptdebug.cpp
index 554a6b6a2c..ef61b2e28a 100644
--- a/engines/sci/engine/scriptdebug.cpp
+++ b/engines/sci/engine/scriptdebug.cpp
@@ -727,7 +727,7 @@ void logKernelCall(const KernelFunction *kernelCall, const KernelSubFunction *ke
switch (mobj->getType()) {
case SEG_TYPE_HUNK:
{
- HunkTable *ht = (HunkTable*)mobj;
+ HunkTable *ht = (HunkTable *)mobj;
int index = argv[parmNr].offset;
if (ht->isValidEntry(index)) {
// NOTE: This ", deleted" isn't as useful as it could
diff --git a/engines/sci/engine/seg_manager.cpp b/engines/sci/engine/seg_manager.cpp
index 04c61f7b7c..cc127c8dbc 100644
--- a/engines/sci/engine/seg_manager.cpp
+++ b/engines/sci/engine/seg_manager.cpp
@@ -691,7 +691,7 @@ void SegManager::memcpy(reg_t dest, const byte* src, size_t n) {
if (dest_r.isRaw) {
// raw -> raw
- ::memcpy((char*)dest_r.raw, src, n);
+ ::memcpy((char *)dest_r.raw, src, n);
} else {
// raw -> non-raw
for (uint i = 0; i < n; i++)
diff --git a/engines/sci/engine/segment.cpp b/engines/sci/engine/segment.cpp
index 73d81baf3a..36b7d92c07 100644
--- a/engines/sci/engine/segment.cpp
+++ b/engines/sci/engine/segment.cpp
@@ -294,18 +294,19 @@ void SciString::fromString(const Common::String &string) {
if (_type != 3)
error("SciString::fromString(): Array is not a string");
- if (string.size() > _size)
- setSize(string.size());
+ setSize(string.size() + 1);
for (uint32 i = 0; i < string.size(); i++)
_data[i] = string[i];
+
+ _data[string.size()] = 0;
}
SegmentRef StringTable::dereference(reg_t pointer) {
SegmentRef ret;
ret.isRaw = true;
ret.maxSize = _table[pointer.offset].getSize();
- ret.raw = (byte*)_table[pointer.offset].getRawData();
+ ret.raw = (byte *)_table[pointer.offset].getRawData();
return ret;
}
diff --git a/engines/sci/engine/segment.h b/engines/sci/engine/segment.h
index 009a2558ce..54cf7b98af 100644
--- a/engines/sci/engine/segment.h
+++ b/engines/sci/engine/segment.h
@@ -370,7 +370,7 @@ public:
#ifdef ENABLE_SCI32
-template <typename T>
+template<typename T>
class SciArray {
public:
SciArray() : _type(-1), _data(NULL), _size(0), _actualSize(0) { }
diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp
index cbe4736ba2..162dce9fcc 100644
--- a/engines/sci/engine/vm.cpp
+++ b/engines/sci/engine/vm.cpp
@@ -235,6 +235,9 @@ ExecStack *execute_method(EngineState *s, uint16 script, uint16 pubfunct, StackP
if (g_sci->getGameId() == GID_TORIN && script == 64036) {
// Script 64036 in Torin's Passage is empty and contains an invalid
// (empty) export
+ } else if (g_sci->getGameId() == GID_RAMA && script == 64908) {
+ // Script 64908 in the demo of RAMA contains an invalid (empty)
+ // export
} else
#endif
error("Request for invalid exported function 0x%x of script %d", pubfunct, script);
diff --git a/engines/sci/engine/workarounds.cpp b/engines/sci/engine/workarounds.cpp
index f68b74e1e0..a556134e32 100644
--- a/engines/sci/engine/workarounds.cpp
+++ b/engines/sci/engine/workarounds.cpp
@@ -353,7 +353,7 @@ const SciWorkaroundEntry kNewWindow_workarounds[] = {
// gameID, room,script,lvl, object-name, method-name, call,index, workaround
const SciWorkaroundEntry kPaletteUnsetFlag_workarounds[] = {
- { GID_QFG4, 100, 100, 0, "doMovie", "<noname144>", -1, 0, { WORKAROUND_IGNORE, 0 } }, // after the Sierra logo, no flags are passed, thus the call is meaningless - bug #3034506
+ { GID_QFG4, 100, 100, 0, "doMovie", "changeState", -1, 0, { WORKAROUND_IGNORE, 0 } }, // after the Sierra logo, no flags are passed, thus the call is meaningless - bug #3034506
SCI_WORKAROUNDENTRY_TERMINATOR
};
diff --git a/engines/sci/graphics/cursor.cpp b/engines/sci/graphics/cursor.cpp
index 50da48aaf3..daab532d0e 100644
--- a/engines/sci/graphics/cursor.cpp
+++ b/engines/sci/graphics/cursor.cpp
@@ -125,18 +125,28 @@ void GfxCursor::kernelSetShape(GuiResourceId resourceId) {
error("cursor resource %d has invalid size", resourceId);
resourceData = resource->data;
- // hotspot is specified for SCI1 cursors
- hotspot.x = READ_LE_UINT16(resourceData);
- hotspot.y = READ_LE_UINT16(resourceData + 2);
- // bit 0 of resourceData[3] is set on <SCI1 games, which means center hotspot
- if ((hotspot.x == 0) && (hotspot.y == 256))
- hotspot.x = hotspot.y = SCI_CURSOR_SCI0_HEIGHTWIDTH / 2;
+
+ if (getSciVersion() <= SCI_VERSION_0_LATE) {
+ // SCI0 cursors contain hotspot flags, not actual hotspot coordinates.
+ // If bit 0 of resourceData[3] is set, the hotspot should be centered,
+ // otherwise it's in the top left of the mouse cursor.
+ hotspot.x = hotspot.y = resourceData[3] ? SCI_CURSOR_SCI0_HEIGHTWIDTH / 2 : 0;
+ } else {
+ // Cursors in newer SCI versions contain actual hotspot coordinates.
+ hotspot.x = READ_LE_UINT16(resourceData);
+ hotspot.y = READ_LE_UINT16(resourceData + 2);
+ }
// Now find out what colors we are supposed to use
colorMapping[0] = 0; // Black is hardcoded
colorMapping[1] = _screen->getColorWhite(); // White is also hardcoded
colorMapping[2] = SCI_CURSOR_SCI0_TRANSPARENCYCOLOR;
colorMapping[3] = _palette->matchColor(170, 170, 170); // Grey
+ // Special case for the magnifier cursor in LB1 (bug #3487092).
+ // No other SCI0 game has a cursor resource of 1, so this is handled
+ // specifically for LB1.
+ if (g_sci->getGameId() == GID_LAURABOW && resourceId == 1)
+ colorMapping[3] = _screen->getColorWhite();
// Seek to actual data
resourceData += 4;
@@ -165,6 +175,11 @@ void GfxCursor::kernelSetShape(GuiResourceId resourceId) {
rawBitmap = upscaledBitmap;
}
+ if (hotspot.x >= heightWidth || hotspot.y >= heightWidth) {
+ error("cursor %d's hotspot (%d, %d) is out of range of the cursor's dimensions (%dx%d)",
+ resourceId, hotspot.x, hotspot.y, heightWidth, heightWidth);
+ }
+
CursorMan.replaceCursor(rawBitmap, heightWidth, heightWidth, hotspot.x, hotspot.y, SCI_CURSOR_SCI0_TRANSPARENCYCOLOR);
kernelShow();
diff --git a/engines/sci/graphics/frameout.cpp b/engines/sci/graphics/frameout.cpp
index 7bb4162020..b12413ab69 100644
--- a/engines/sci/graphics/frameout.cpp
+++ b/engines/sci/graphics/frameout.cpp
@@ -61,12 +61,13 @@ GfxFrameout::GfxFrameout(SegManager *segMan, ResourceManager *resMan, GfxCoordAd
}
GfxFrameout::~GfxFrameout() {
+ clear();
}
void GfxFrameout::clear() {
- _screenItems.clear();
+ deletePlaneItems(NULL_REG);
_planes.clear();
- _planePictures.clear();
+ deletePlanePictures(NULL_REG);
}
void GfxFrameout::kernelAddPlane(reg_t object) {
@@ -101,7 +102,7 @@ void GfxFrameout::kernelAddPlane(reg_t object) {
}
void GfxFrameout::kernelUpdatePlane(reg_t object) {
- for (PlaneList::iterator it = _planes.begin(); it != _planes.end(); it++) {
+ for (PlaneList::iterator it = _planes.begin(); it != _planes.end(); ++it) {
if (it->object == object) {
// Read some information
it->priority = readSelectorValue(_segMan, object, SELECTOR(priority));
@@ -178,8 +179,10 @@ void GfxFrameout::kernelUpdatePlane(reg_t object) {
}
void GfxFrameout::kernelDeletePlane(reg_t object) {
+ deletePlaneItems(object);
deletePlanePictures(object);
- for (PlaneList::iterator it = _planes.begin(); it != _planes.end(); it++) {
+
+ for (PlaneList::iterator it = _planes.begin(); it != _planes.end(); ++it) {
if (it->object == object) {
_planes.erase(it);
Common::Rect planeRect;
@@ -193,10 +196,6 @@ void GfxFrameout::kernelDeletePlane(reg_t object) {
planeRect.left = (planeRect.left * screenRect.width()) / _scriptsRunningWidth;
planeRect.bottom = (planeRect.bottom * screenRect.height()) / _scriptsRunningHeight;
planeRect.right = (planeRect.right * screenRect.width()) / _scriptsRunningWidth;
- planeRect.clip(screenRect); // we need to do this, at least in gk1 on cemetary we get bottom right -> 201, 321
- // FIXME: The code above incorrectly added 1 pixel to the plane's
- // bottom and right, so probably the plane clipping code is no
- // longer necessary
// Blackout removed plane rect
_paint32->fillRect(planeRect, 0);
return;
@@ -216,12 +215,15 @@ void GfxFrameout::addPlanePicture(reg_t object, GuiResourceId pictureId, uint16
}
void GfxFrameout::deletePlanePictures(reg_t object) {
- for (PlanePictureList::iterator it = _planePictures.begin(); it != _planePictures.end(); it++) {
- if (it->object == object) {
+ PlanePictureList::iterator it = _planePictures.begin();
+
+ while (it != _planePictures.end()) {
+ if (it->object == object || object.isNull()) {
+ delete it->pictureCels;
delete it->picture;
- _planePictures.erase(it);
- deletePlanePictures(object);
- return;
+ it = _planePictures.erase(it);
+ } else {
+ ++it;
}
}
}
@@ -274,6 +276,29 @@ void GfxFrameout::kernelDeleteScreenItem(reg_t object) {
}
_screenItems.remove(itemEntry);
+ delete itemEntry;
+}
+
+void GfxFrameout::deletePlaneItems(reg_t planeObject) {
+ FrameoutList::iterator listIterator = _screenItems.begin();
+
+ while (listIterator != _screenItems.end()) {
+ bool objectMatches = false;
+ if (!planeObject.isNull()) {
+ reg_t itemPlane = readSelector(_segMan, (*listIterator)->object, SELECTOR(plane));
+ objectMatches = (planeObject == itemPlane);
+ } else {
+ objectMatches = true;
+ }
+
+ if (objectMatches) {
+ FrameoutEntry *itemEntry = *listIterator;
+ listIterator = _screenItems.erase(listIterator);
+ delete itemEntry;
+ } else {
+ ++listIterator;
+ }
+ }
}
FrameoutEntry *GfxFrameout::findScreenItem(reg_t object) {
@@ -498,7 +523,8 @@ void GfxFrameout::kernelFrameout() {
// There is a race condition lurking in SQ6, which causes the game to hang in the intro, when teleporting to Polysorbate LX.
// Since I first wrote the patch, the race has stopped occurring for me though.
// I'll leave this for investigation later, when someone can reproduce.
- if (it->pictureId == 0xffff)
+ //if (it->pictureId == 0xffff) // FIXME: This is what SSCI does, and fixes the intro of LSL7, but breaks the dialogs in GK1 (adds black boxes)
+ if (it->planeBack)
_paint32->fillRect(it->planeRect, it->planeBack);
GuiResourceId planeMainPictureId = it->pictureId;
diff --git a/engines/sci/graphics/frameout.h b/engines/sci/graphics/frameout.h
index a4a0a853e4..8c3cc261d5 100644
--- a/engines/sci/graphics/frameout.h
+++ b/engines/sci/graphics/frameout.h
@@ -94,6 +94,7 @@ public:
void kernelAddScreenItem(reg_t object);
void kernelUpdateScreenItem(reg_t object);
void kernelDeleteScreenItem(reg_t object);
+ void deletePlaneItems(reg_t planeObject);
FrameoutEntry *findScreenItem(reg_t object);
int16 kernelGetHighPlanePri();
void kernelAddPicAt(reg_t planeObj, GuiResourceId pictureId, int16 pictureX, int16 pictureY);
diff --git a/engines/sci/graphics/screen.cpp b/engines/sci/graphics/screen.cpp
index 6469bc0cb3..4020518b72 100644
--- a/engines/sci/graphics/screen.cpp
+++ b/engines/sci/graphics/screen.cpp
@@ -438,7 +438,7 @@ void GfxScreen::bitsSaveScreen(Common::Rect rect, byte *screen, uint16 screenWid
screen += (rect.top * screenWidth) + rect.left;
for (y = rect.top; y < rect.bottom; y++) {
- memcpy(memoryPtr, (void*)screen, width); memoryPtr += width;
+ memcpy(memoryPtr, (void *)screen, width); memoryPtr += width;
screen += screenWidth;
}
}
@@ -458,7 +458,7 @@ void GfxScreen::bitsSaveDisplayScreen(Common::Rect rect, byte *&memoryPtr) {
}
for (y = rect.top; y < rect.bottom; y++) {
- memcpy(memoryPtr, (void*)screen, width); memoryPtr += width;
+ memcpy(memoryPtr, (void *)screen, width); memoryPtr += width;
screen += _displayWidth;
}
}
@@ -503,7 +503,7 @@ void GfxScreen::bitsRestoreScreen(Common::Rect rect, byte *&memoryPtr, byte *scr
screen += (rect.top * screenWidth) + rect.left;
for (y = rect.top; y < rect.bottom; y++) {
- memcpy((void*) screen, memoryPtr, width); memoryPtr += width;
+ memcpy((void *) screen, memoryPtr, width); memoryPtr += width;
screen += screenWidth;
}
}
@@ -523,7 +523,7 @@ void GfxScreen::bitsRestoreDisplayScreen(Common::Rect rect, byte *&memoryPtr) {
}
for (y = rect.top; y < rect.bottom; y++) {
- memcpy((void*) screen, memoryPtr, width); memoryPtr += width;
+ memcpy((void *) screen, memoryPtr, width); memoryPtr += width;
screen += _displayWidth;
}
}
diff --git a/engines/sci/graphics/text16.cpp b/engines/sci/graphics/text16.cpp
index 84547d9828..7eaa0168b8 100644
--- a/engines/sci/graphics/text16.cpp
+++ b/engines/sci/graphics/text16.cpp
@@ -100,7 +100,7 @@ int16 GfxText16::CodeProcessing(const char *&text, GuiResourceId orgFontId, int1
// cX -> sets textColor to _textColors[X-1]
curCode = textCode[0];
curCodeParm = textCode[1];
- if (isdigit(static_cast<unsigned char>(curCodeParm))) {
+ if (Common::isDigit(curCodeParm)) {
curCodeParm -= '0';
} else {
curCodeParm = -1;
diff --git a/engines/sci/graphics/text32.cpp b/engines/sci/graphics/text32.cpp
index 000bb691dc..e24799f6b8 100644
--- a/engines/sci/graphics/text32.cpp
+++ b/engines/sci/graphics/text32.cpp
@@ -173,13 +173,18 @@ void GfxText32::disposeTextBitmap(reg_t hunkId) {
_segMan->freeHunkEntry(hunkId);
}
-void GfxText32::drawTextBitmap(uint16 x, uint16 y, Common::Rect planeRect, reg_t textObject) {
+void GfxText32::drawTextBitmap(int16 x, int16 y, Common::Rect planeRect, reg_t textObject) {
reg_t hunkId = readSelector(_segMan, textObject, SELECTOR(bitmap));
+ uint16 backColor = readSelectorValue(_segMan, textObject, SELECTOR(back));
// Sanity check: Check if the hunk is set. If not, either the game scripts
// didn't set it, or an old saved game has been loaded, where it wasn't set.
if (hunkId.isNull())
return;
+ // Negative coordinates indicate that text shouldn't be displayed
+ if (x < 0 || y < 0)
+ return;
+
byte *memoryPtr = _segMan->getHunkPointer(hunkId);
if (!memoryPtr)
@@ -204,7 +209,7 @@ void GfxText32::drawTextBitmap(uint16 x, uint16 y, Common::Rect planeRect, reg_t
for (int curY = 0; curY < height; curY++) {
for (int curX = 0; curX < width; curX++) {
byte pixel = surface[curByte++];
- if (pixel != skipColor)
+ if (pixel != skipColor && pixel != backColor)
_screen->putFontPixel(textY, curX + textX, curY, pixel);
}
}
diff --git a/engines/sci/graphics/text32.h b/engines/sci/graphics/text32.h
index 3c1898858b..3505de85eb 100644
--- a/engines/sci/graphics/text32.h
+++ b/engines/sci/graphics/text32.h
@@ -34,7 +34,7 @@ public:
~GfxText32();
reg_t createTextBitmap(reg_t textObject, uint16 maxWidth = 0, uint16 maxHeight = 0, reg_t prevHunk = NULL_REG);
void disposeTextBitmap(reg_t hunkId);
- void drawTextBitmap(uint16 x, uint16 y, Common::Rect planeRect, reg_t textObject);
+ void drawTextBitmap(int16 x, int16 y, Common::Rect planeRect, reg_t textObject);
int16 GetLongest(const char *text, int16 maxWidth, GfxFont *font);
void kernelTextSize(const char *text, int16 font, int16 maxWidth, int16 *textWidth, int16 *textHeight);
diff --git a/engines/sci/graphics/transitions.cpp b/engines/sci/graphics/transitions.cpp
index d047eb10a1..b385c2c1db 100644
--- a/engines/sci/graphics/transitions.cpp
+++ b/engines/sci/graphics/transitions.cpp
@@ -52,8 +52,8 @@ static const GfxTransitionTranslateEntry oldTransitionIDs[] = {
{ 3, SCI_TRANSITIONS_STRAIGHT_FROM_LEFT, false },
{ 4, SCI_TRANSITIONS_STRAIGHT_FROM_BOTTOM, false },
{ 5, SCI_TRANSITIONS_STRAIGHT_FROM_TOP, false },
- { 6, SCI_TRANSITIONS_DIAGONALROLL_FROMCENTER, false },
- { 7, SCI_TRANSITIONS_DIAGONALROLL_TOCENTER, false },
+ { 6, SCI_TRANSITIONS_DIAGONALROLL_TOCENTER, false },
+ { 7, SCI_TRANSITIONS_DIAGONALROLL_FROMCENTER, false },
{ 8, SCI_TRANSITIONS_BLOCKS, false },
{ 9, SCI_TRANSITIONS_VERTICALROLL_TOCENTER, false },
{ 10, SCI_TRANSITIONS_HORIZONTALROLL_TOCENTER, false },
@@ -295,12 +295,12 @@ void GfxTransitions::fadeOut() {
int16 stepNr, colorNr;
// Sierra did not fade in/out color 255 for sci1.1, but they used it in
// several pictures (e.g. qfg3 demo/intro), so the fading looked weird
- int16 tillColorNr = getSciVersion() >= SCI_VERSION_1_1 ? 256 : 255;
+ int16 tillColorNr = getSciVersion() >= SCI_VERSION_1_1 ? 255 : 254;
g_system->getPaletteManager()->grabPalette(oldPalette, 0, 256);
for (stepNr = 100; stepNr >= 0; stepNr -= 10) {
- for (colorNr = 1; colorNr < tillColorNr; colorNr++) {
+ for (colorNr = 1; colorNr <= tillColorNr; colorNr++) {
if (_palette->colorIsFromMacClut(colorNr)) {
workPalette[colorNr * 3 + 0] = oldPalette[colorNr * 3];
workPalette[colorNr * 3 + 1] = oldPalette[colorNr * 3 + 1];
@@ -311,7 +311,7 @@ void GfxTransitions::fadeOut() {
workPalette[colorNr * 3 + 2] = oldPalette[colorNr * 3 + 2] * stepNr / 100;
}
}
- g_system->getPaletteManager()->setPalette(workPalette + 3, 1, 254);
+ g_system->getPaletteManager()->setPalette(workPalette + 3, 1, tillColorNr);
g_sci->getEngineState()->wait(2);
}
}
@@ -322,10 +322,10 @@ void GfxTransitions::fadeIn() {
int16 stepNr;
// Sierra did not fade in/out color 255 for sci1.1, but they used it in
// several pictures (e.g. qfg3 demo/intro), so the fading looked weird
- int16 tillColorNr = getSciVersion() >= SCI_VERSION_1_1 ? 256 : 255;
+ int16 tillColorNr = getSciVersion() >= SCI_VERSION_1_1 ? 255 : 254;
for (stepNr = 0; stepNr <= 100; stepNr += 10) {
- _palette->kernelSetIntensity(1, tillColorNr, stepNr, true);
+ _palette->kernelSetIntensity(1, tillColorNr + 1, stepNr, true);
g_sci->getEngineState()->wait(2);
}
}
diff --git a/engines/sci/parser/said.cpp b/engines/sci/parser/said.cpp
index d44109faec..eff4a29f49 100644
--- a/engines/sci/parser/said.cpp
+++ b/engines/sci/parser/said.cpp
@@ -743,7 +743,7 @@ static void node_print_desc(ParseTreeNode* node) {
}
}
#else
-static void node_print_desc(ParseTreeNode*) { }
+static void node_print_desc(ParseTreeNode *) { }
#endif
diff --git a/engines/sci/parser/vocabulary.cpp b/engines/sci/parser/vocabulary.cpp
index a5c4686b3b..e56158ecc1 100644
--- a/engines/sci/parser/vocabulary.cpp
+++ b/engines/sci/parser/vocabulary.cpp
@@ -534,7 +534,7 @@ bool Vocabulary::tokenizeString(ResultWordListList &retval, const char *sentence
do {
c = sentence[pos_in_sentence++];
- if (isalnum(c) || (c == '-' && wordLen) || (c >= 0x80)) {
+ if (Common::isAlnum(c) || (c == '-' && wordLen) || (c >= 0x80)) {
currentWord[wordLen] = lowerCaseMap[c];
++wordLen;
}
diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp
index 9171e5e5d9..50b3387159 100644
--- a/engines/sci/resource.cpp
+++ b/engines/sci/resource.cpp
@@ -753,12 +753,10 @@ void ResourceManager::addScriptChunkSources() {
// to try to get to any scripts in there. The Lighthouse SCI2.1 demo
// does exactly this.
- Common::List<ResourceId> *resources = listResources(kResourceTypeScript);
+ Common::List<ResourceId> resources = listResources(kResourceTypeScript);
- if (resources->empty() && testResource(ResourceId(kResourceTypeChunk, 0)))
+ if (resources.empty() && testResource(ResourceId(kResourceTypeChunk, 0)))
addResourcesFromChunk(0);
-
- delete resources;
}
#endif
}
@@ -1045,13 +1043,13 @@ void ResourceManager::freeOldResources() {
}
}
-Common::List<ResourceId> *ResourceManager::listResources(ResourceType type, int mapNumber) {
- Common::List<ResourceId> *resources = new Common::List<ResourceId>;
+Common::List<ResourceId> ResourceManager::listResources(ResourceType type, int mapNumber) {
+ Common::List<ResourceId> resources;
ResourceMap::iterator itr = _resMap.begin();
while (itr != _resMap.end()) {
if ((itr->_value->getType() == type) && ((mapNumber == -1) || (itr->_value->getNumber() == mapNumber)))
- resources->push_back(itr->_value->_id);
+ resources.push_back(itr->_value->_id);
++itr;
}
@@ -1560,7 +1558,7 @@ void ResourceManager::readResourcePatches() {
name = (*x)->getName();
// SCI1 scheme
- if (isdigit(static_cast<unsigned char>(name[0]))) {
+ if (Common::isDigit(name[0])) {
char *end = 0;
resourceNr = strtol(name.c_str(), &end, 10);
bAdd = (*end == '.'); // Ensure the next character is the period
@@ -1568,7 +1566,7 @@ void ResourceManager::readResourcePatches() {
// SCI0 scheme
int resname_len = strlen(szResType);
if (scumm_strnicmp(name.c_str(), szResType, resname_len) == 0
- && !isalpha(static_cast<unsigned char>(name[resname_len + 1]))) {
+ && !Common::isAlpha(name[resname_len + 1])) {
resourceNr = atoi(name.c_str() + resname_len + 1);
bAdd = true;
}
@@ -2199,14 +2197,16 @@ void ResourceManager::detectSciVersion() {
// Handle SCI32 versions here
if (_volVersion >= kResVersionSci2) {
- Common::List<ResourceId> *heaps = listResources(kResourceTypeHeap);
+ Common::List<ResourceId> heaps = listResources(kResourceTypeHeap);
+ bool hasHeapResources = !heaps.empty();
+
// SCI2.1/3 and SCI1 Late resource maps are the same, except that
// SCI1 Late resource maps have the resource types or'd with
// 0x80. We differentiate between SCI2 and SCI2.1/3 based on that.
if (_mapVersion == kResVersionSci1Late) {
s_sciVersion = SCI_VERSION_2;
return;
- } else if (!heaps->empty()) {
+ } else if (hasHeapResources) {
s_sciVersion = SCI_VERSION_2_1;
return;
} else {
diff --git a/engines/sci/resource.h b/engines/sci/resource.h
index 47602de017..294a4672e2 100644
--- a/engines/sci/resource.h
+++ b/engines/sci/resource.h
@@ -322,7 +322,7 @@ public:
* @param mapNumber For audio36 and sync36, limit search to this map
* @return The resource list
*/
- Common::List<ResourceId> *listResources(ResourceType type, int mapNumber = -1);
+ Common::List<ResourceId> listResources(ResourceType type, int mapNumber = -1);
void setAudioLanguage(int language);
int getAudioLanguage() const;
diff --git a/engines/sci/resource_audio.cpp b/engines/sci/resource_audio.cpp
index a3cf1b0c84..684e1a1d0d 100644
--- a/engines/sci/resource_audio.cpp
+++ b/engines/sci/resource_audio.cpp
@@ -185,6 +185,7 @@ void ResourceManager::processWavePatch(ResourceId resourceId, Common::String nam
file.open(name);
updateResource(resourceId, resSrc, file.size());
+ _sources.push_back(resSrc);
debugC(1, kDebugLevelResMan, "Patching %s - OK", name.c_str());
}
@@ -197,7 +198,7 @@ void ResourceManager::readWaveAudioPatches() {
for (Common::ArchiveMemberList::const_iterator x = files.begin(); x != files.end(); ++x) {
Common::String name = (*x)->getName();
- if (isdigit(static_cast<unsigned char>(name[0])))
+ if (Common::isDigit(name[0]))
processWavePatch(ResourceId(kResourceTypeAudio, atoi(name.c_str())), name);
}
}
@@ -538,11 +539,10 @@ bool ResourceManager::isGMTrackIncluded() {
// Read the first song and check if it has a GM track
bool result = false;
- Common::List<ResourceId> *resources = listResources(kResourceTypeSound, -1);
- Common::sort(resources->begin(), resources->end());
- Common::List<ResourceId>::iterator itr = resources->begin();
+ Common::List<ResourceId> resources = listResources(kResourceTypeSound, -1);
+ Common::sort(resources.begin(), resources.end());
+ Common::List<ResourceId>::iterator itr = resources.begin();
int firstSongId = itr->getNumber();
- delete resources;
SoundResource *song1 = new SoundResource(firstSongId, this, soundVersion);
if (!song1) {
@@ -892,10 +892,10 @@ void AudioVolumeResourceSource::loadResource(ResourceManager *resMan, Resource *
}
bool ResourceManager::addAudioSources() {
- Common::List<ResourceId> *resources = listResources(kResourceTypeMap);
- Common::List<ResourceId>::iterator itr = resources->begin();
+ Common::List<ResourceId> resources = listResources(kResourceTypeMap);
+ Common::List<ResourceId>::iterator itr;
- while (itr != resources->end()) {
+ for (itr = resources.begin(); itr != resources.end(); ++itr) {
ResourceSource *src = addSource(new IntMapResourceSource("MAP", itr->getNumber()));
if ((itr->getNumber() == 65535) && Common::File::exists("RESOURCE.SFX"))
@@ -904,12 +904,8 @@ bool ResourceManager::addAudioSources() {
addSource(new AudioVolumeResourceSource(this, "RESOURCE.AUD", src, 0));
else
return false;
-
- ++itr;
}
- delete resources;
-
return true;
}
@@ -943,8 +939,9 @@ void ResourceManager::changeAudioDirectory(Common::String path) {
audioResourceName = Common::String::format("%s/RESOURCE.AUD", path.c_str());
}
- Common::List<ResourceId> *resources = listResources(kResourceTypeMap);
- for (Common::List<ResourceId>::iterator it = resources->begin(); it != resources->end(); ++it) {
+ Common::List<ResourceId> resources = listResources(kResourceTypeMap);
+ Common::List<ResourceId>::iterator it;
+ for (it = resources.begin(); it != resources.end(); ++it) {
// Don't readd 65535.map or resource.sfx
if ((it->getNumber() == 65535))
continue;
@@ -953,8 +950,6 @@ void ResourceManager::changeAudioDirectory(Common::String path) {
addSource(new AudioVolumeResourceSource(this, audioResourceName, src, 0));
}
- delete resources;
-
// Rescan the newly added resources
scanNewSources();
}
diff --git a/engines/sci/sound/drivers/amigamac.cpp b/engines/sci/sound/drivers/amigamac.cpp
index 41697d4a07..131a85f371 100644
--- a/engines/sci/sound/drivers/amigamac.cpp
+++ b/engines/sci/sound/drivers/amigamac.cpp
@@ -524,7 +524,7 @@ MidiDriver_AmigaMac::InstrumentSample *MidiDriver_AmigaMac::readInstrumentSCI0(C
instrument->size = seg_size[0];
instrument->loop_size = seg_size[1];
- instrument->loop = (int8*)malloc(instrument->loop_size + 1);
+ instrument->loop = (int8 *)malloc(instrument->loop_size + 1);
memcpy(instrument->loop, instrument->samples + loop_offset, instrument->loop_size);
instrument->samples[instrument->size] = instrument->loop[0];
@@ -708,7 +708,7 @@ void MidiDriver_AmigaMac::generateSamples(int16 *data, int len) {
if (len == 0)
return;
- int16 *buffers = (int16*)malloc(len * 2 * kChannels);
+ int16 *buffers = (int16 *)malloc(len * 2 * kChannels);
memset(buffers, 0, len * 2 * kChannels);
@@ -869,7 +869,7 @@ bool MidiDriver_AmigaMac::loadInstrumentsSCI0Mac(Common::SeekableReadStream &fil
instrument->size = seg_size[0];
instrument->loop_size = seg_size[1] - seg_size[0];
- instrument->loop = (int8*)malloc(instrument->loop_size + 1);
+ instrument->loop = (int8 *)malloc(instrument->loop_size + 1);
memcpy(instrument->loop, instrument->samples + loop_offset, instrument->loop_size);
instrument->samples[instrument->size] = instrument->loop[0];
diff --git a/engines/scumm/actor.cpp b/engines/scumm/actor.cpp
index eb23c30ebe..b8722b6963 100644
--- a/engines/scumm/actor.cpp
+++ b/engines/scumm/actor.cpp
@@ -42,6 +42,14 @@ namespace Scumm {
byte Actor::kInvalidBox = 0;
+static const byte v0ActorTalkArray[0x19] = {
+ 0x00, 0x06, 0x06, 0x06, 0x06,
+ 0x06, 0x06, 0x00, 0x46, 0x06,
+ 0x06, 0x06, 0x06, 0xFF, 0xFF,
+ 0x06, 0xC0, 0x06, 0x06, 0x00,
+ 0xC0, 0xC0, 0x00, 0x06, 0x06
+};
+
Actor::Actor(ScummEngine *scumm, int id) :
_vm(scumm), _number(id) {
assert(_vm != 0);
@@ -167,6 +175,21 @@ void Actor_v2::initActor(int mode) {
_talkStopFrame = 4;
}
+void Actor_v0::initActor(int mode) {
+ Actor_v2::initActor(mode);
+
+ _costCommandNew = 0xFF;
+ _costCommand = 0xFF;
+ _miscflags = 0;
+ _speaking = 0;
+
+ _animFrameRepeat = 0;
+ for (int i = 0; i < 8; ++i) {
+ _limbFrameRepeatNew[i] = 0;
+ _limbFrameRepeat[i] = 0;
+ _limb_flipped[i] = false;
+ }
+}
void Actor::setBox(int box) {
_walkbox = box;
@@ -226,12 +249,9 @@ void Actor::stopActorMoving() {
if (_walkScript)
_vm->stopScript(_walkScript);
- // V0 Games will walk on the spot if the actor is stopped mid-walk
- // So we must set the stand still frame
- if (_vm->_game.version == 0)
- startWalkAnim(3, -1);
-
_moving = 0;
+ if (_vm->_game.version == 0)
+ setDirection(_facing);
}
void Actor::setActorWalkSpeed(uint newSpeedX, uint newSpeedY) {
@@ -286,7 +306,7 @@ int Actor::calcMovementFactor(const Common::Point& next) {
deltaYFactor = 0;
}
- if ((uint) ABS((int)(deltaXFactor >> 16)) > _speedx) {
+ if ((uint) ABS(deltaXFactor) > (_speedx << 16)) {
deltaXFactor = _speedx << 16;
if (diffX < 0)
deltaXFactor = -deltaXFactor;
@@ -319,6 +339,9 @@ int Actor::actorWalkStep() {
int distX, distY;
int nextFacing;
+ if (_vm->_game.version == 0)
+ ((Actor_v0 *)this)->_animFrameRepeat = -1;
+
_needRedraw = true;
nextFacing = updateActorDirection(true);
@@ -327,6 +350,10 @@ int Actor::actorWalkStep() {
startWalkAnim(1, nextFacing);
}
_moving |= MF_IN_LEG;
+
+ // V0: Don't move during the turn
+ if (_vm->_game.version == 0)
+ return 0;
}
if (_walkbox != _walkdata.curbox && _vm->checkXYInBoxBounds(_walkdata.curbox, _pos.x, _pos.y)) {
@@ -361,6 +388,10 @@ int Actor::actorWalkStep() {
_moving &= ~MF_IN_LEG;
return 0;
}
+
+ if (_vm->_game.version == 0)
+ ((Actor_v0 *)this)->animateActor(newDirToOldDir(_facing));
+
return 1;
}
@@ -536,23 +567,101 @@ void Actor::walkActor() {
calcMovementFactor(_walkdata.dest);
}
+bool Actor_v2::checkWalkboxesHaveDirectPath(Common::Point &foundPath) {
+ // only MM v0 supports walking in direct line between walkboxes.
+ // MM v1 already does not support it anymore.
+ return false;
+}
+
+bool Actor_v0::intersectLineSegments(const Common::Point &line1Start, const Common::Point &line1End,
+ const Common::Point &line2Start, const Common::Point &line2End, Common::Point &result)
+{
+ const Common::Point v1 = line1End - line1Start; // line1(n1) = line1Start + n1 * v1
+ const Common::Point v2 = line2End - line2Start; // line2(n2) = line2Start + n2 * v2
+
+ double det = v2.x * v1.y - v1.x * v2.y;
+ if (det == 0)
+ return false;
+
+ double n1 = ((double)v2.x * (line2Start.y - line1Start.y) -
+ (double)v2.y * (line2Start.x - line1Start.x)) / det;
+ double n2 = ((double)v1.x * (line2Start.y - line1Start.y) -
+ (double)v1.y * (line2Start.x - line1Start.x)) / det;
+
+ // both coefficients have to be in [0, 1], otherwise the intersection is
+ // not inside of at least one of the two line segments
+ if (n1 < 0.0 || n1 > 1.0 || n2 < 0.0 || n2 > 1.0)
+ return false;
+
+ result.x = line1Start.x + (int)(n1 * v1.x);
+ result.y = line1Start.y + (int)(n1 * v1.y);
+ return true;
+}
+
+/*
+ * MM v0 allows the actor to walk in a direct line between boxes to the target
+ * if actor and target share a horizontal or vertical corridor.
+ * If such a corridor is found the actor is not forced to go horizontally or
+ * vertically from one box to the next but can also walk diagonally.
+ *
+ * Note: the original v0 interpreter sets the target destination for diagonal
+ * walking only once and then rechecks whenever the actor reaches a new box if the
+ * walk destination is still suitable for the current box.
+ * ScummVM does not perform such a check, so it is possible to leave the walkboxes
+ * in some cases, for example L-shaped rooms like the swimming pool (actor walks over water)
+ * or the medical room (actor walks over examination table).
+ * To solve this we intersect the new walk destination with the actor's walkbox borders,
+ * so a recheck is done when the actor leaves his box. This is done by the
+ * intersectLineSegments() routine calls.
+ */
+bool Actor_v0::checkWalkboxesHaveDirectPath(Common::Point &foundPath) {
+ BoxCoords boxCoords = _vm->getBoxCoordinates(_walkbox);
+ BoxCoords curBoxCoords = _vm->getBoxCoordinates(_walkdata.curbox);
+
+ // check if next walkbox is left or right to actor's box
+ if (boxCoords.ll.x > curBoxCoords.lr.x || boxCoords.lr.x < curBoxCoords.ll.x) {
+ // determine horizontal corridor gates
+ int gateUpper = MAX(boxCoords.ul.y, curBoxCoords.ul.y);
+ int gateLower = MIN(boxCoords.ll.y, curBoxCoords.ll.y);
+
+ // check if actor and target are in the same horizontal corridor between the boxes
+ if ((_pos.y >= gateUpper && _pos.y <= gateLower) &&
+ (_walkdata.dest.y >= gateUpper && _walkdata.dest.y <= gateLower)) {
+ if (boxCoords.ll.x > curBoxCoords.lr.x) // next box is left
+ return intersectLineSegments(_pos, _walkdata.dest, boxCoords.ll, boxCoords.ul, foundPath);
+ else // next box is right
+ return intersectLineSegments(_pos, _walkdata.dest, boxCoords.lr, boxCoords.ur, foundPath);
+ }
+ // check if next walkbox is above or below actor's box
+ } else if (boxCoords.ul.y > curBoxCoords.ll.y || boxCoords.ll.y < curBoxCoords.ul.y) {
+ // determine vertical corridor gates
+ int gateLeft = MAX(boxCoords.ll.x, curBoxCoords.ll.x);
+ int gateRight = MIN(boxCoords.lr.x, curBoxCoords.lr.x);
+
+ // check if actor and target are in the same vertical corridor between the boxes
+ if ((_pos.x >= gateLeft && _pos.x <= gateRight) &&
+ (_walkdata.dest.x >= gateLeft && _walkdata.dest.x <= gateRight)) {
+ if (boxCoords.ul.y > curBoxCoords.ll.y) // next box is above
+ return intersectLineSegments(_pos, _walkdata.dest, boxCoords.ul, boxCoords.ur, foundPath);
+ else // next box is below
+ return intersectLineSegments(_pos, _walkdata.dest, boxCoords.ll, boxCoords.lr, foundPath);
+ }
+ }
+
+ return false;
+}
+
void Actor_v2::walkActor() {
Common::Point foundPath, tmp;
int new_dir, next_box;
if (_moving & MF_TURN) {
new_dir = updateActorDirection(false);
- // FIXME: is this correct?
if (_facing != new_dir) {
-
- // Actor never stops walking when an object has been selected without this
- if (_vm->_game.version ==0)
- _moving = 0;
-
setDirection(new_dir);
-
- } else
+ } else {
_moving = 0;
+ }
return;
}
@@ -588,14 +697,7 @@ void Actor_v2::walkActor() {
_walkdata.curbox = next_box;
- // WORKAROUND: The route of the meteor landing in the introduction isn't correct.
- // MM V0 in contrast to MM V2 uses two walkboxes instead of just one. Hence a route
- // from walkbox 1 to 0 is calculated first. This causes the meteor to fly on a
- // horizontal line to walkbox 0 then vertically to the ground.
- // To fix this problem, the box-to-box routing has been disabled in room 33.
- if (_vm->_game.version == 0 && _vm->_currentRoom == 33) {
- foundPath = _walkdata.dest;
- } else {
+ if (!checkWalkboxesHaveDirectPath(foundPath)) {
getClosestPtOnBox(_vm->getBoxCoordinates(_walkdata.curbox), _pos.x, _pos.y, tmp.x, tmp.y);
getClosestPtOnBox(_vm->getBoxCoordinates(_walkbox), tmp.x, tmp.y, foundPath.x, foundPath.y);
}
@@ -781,7 +883,7 @@ int Actor::remapDirection(int dir, bool is_walking) {
return 180;
}
- // MM C64 stores flags as a part of the mask
+ // MM v0 stores flags as a part of the mask
if (_vm->_game.version == 0) {
mask = _vm->getMaskFromBox(_walkbox);
// face the wall if climbing/descending a ladder
@@ -857,16 +959,6 @@ void Actor::setDirection(int direction) {
if (_costume == 0)
return;
- // V0 MM
- if (_vm->_game.version == 0) {
- if (_moving)
- _vm->_costumeLoader->costumeDecodeData(this, _walkFrame, 0);
- else
- _vm->_costumeLoader->costumeDecodeData(this, _standFrame, 0);
- _needRedraw = true;
- return;
- }
-
// Update the costume for the new direction (and mark the actor for redraw)
aMask = 0x8000;
for (i = 0; i < 16; i++, aMask >>= 1) {
@@ -879,6 +971,34 @@ void Actor::setDirection(int direction) {
_needRedraw = true;
}
+void Actor_v0::setDirection(int direction) {
+ int dir = newDirToOldDir( direction );
+ int res = 0;
+
+ switch (dir) {
+ case 0:
+ res = 4; // Left
+ break;
+
+ case 1:
+ res = 5; // Right
+ break;
+
+ case 2:
+ res = 6; // Face Away
+ break;
+
+ default:
+ res = 7; // Face Camera
+ break;
+ }
+
+ _animFrameRepeat = -1;
+ animateActor(res);
+ if (_moving)
+ animateCostume();
+}
+
void Actor::faceToObject(int obj) {
int x2, y2, dir;
@@ -963,6 +1083,10 @@ void Actor::putActor(int dstX, int dstY, int newRoom) {
if (isInCurrentRoom())
showActor();
}
+
+ // V0 always sets the actor to face the camera upon entering a room
+ if (_vm->_game.version == 0)
+ setDirection(oldDirToNewDir(2));
}
static bool inBoxQuickReject(const BoxCoords &box, int x, int y, int threshold) {
@@ -1062,16 +1186,11 @@ static int checkXYInBoxBounds(int boxnum, int x, int y, int &destX, int &destY)
// yDist must be divided by 4, as we are using 8x2 pixels
// blocks for actor coordinates).
int xDist = ABS(x - destX);
- int yDist;
+ int yDist = ABS(y - destY) / 4;
int dist;
- // MM C64: This fixes the trunk bug (#3070065), as well
- // as the fruit bowl, however im not sure if its
- // the proper solution or not.
- if( g_scumm->_game.version == 0 )
- yDist = ABS(y - destY);
- else
- yDist = ABS(y - destY) / 4;
+ if (g_scumm->_game.version == 0)
+ xDist *= 2;
if (xDist < yDist)
dist = (xDist >> 1) + yDist;
@@ -1090,7 +1209,9 @@ AdjustBoxResult Actor_v2::adjustXYToBeInBox(const int dstX, const int dstY) {
int numBoxes = _vm->getNumBoxes() - 1;
int bestDist = 0xFF;
- for (int box = numBoxes; box >= 0; box--) {
+ for (int i = 0; i <= numBoxes; i++) {
+ // MM v0 prioritizes lower boxes, other engines higher boxes
+ int box = (_vm->_game.version == 0 ? i : numBoxes - i);
int foundX, foundY;
int flags = _vm->getBoxFlags(box);
if ((flags & kBoxInvisible) && !((flags & kBoxPlayerOnly) && !isPlayer()))
@@ -1286,8 +1407,24 @@ void Actor::showActor() {
_vm->ensureResourceLoaded(rtCostume, _costume);
if (_vm->_game.version == 0) {
+ Actor_v0 *a = ((Actor_v0 *)this);
+
+ a->_costCommand = a->_costCommandNew = 0xFF;
+
+ for (int i = 0; i < 8; ++i) {
+ a->_limbFrameRepeat[i] = 0;
+ a->_limbFrameRepeatNew[i] = 0;
+ }
+
_cost.reset();
+
+ a->_animFrameRepeat = 1;
+ a->_speaking = 0;
+
startAnimActor(_standFrame);
+ _visible = true;
+ return;
+
} else if (_vm->_game.version <= 2) {
_cost.reset();
startAnimActor(_standFrame);
@@ -1323,23 +1460,23 @@ static const byte v0ActorSounds[24] = {
0x06, // Bernard
0x06, // Wendy
0x00, // Jeff
- 0x46, // ???
+ 0x46, // Radiation Suit
0x06, // Dr Fred
0x06, // Nurse Edna
0x06, // Weird Ed
0x06, // Dead Cousin Ted
0xFF, // Purple Tentacle
0xFF, // Green Tentacle
- 0x06, // Meteor
- 0xC0, // Plant
- 0x06, // ???
- 0x06, // ???
- 0x00, // ???
- 0xC0, // ???
- 0xC0, // ???
- 0x00, // ???
- 0x06, // Sandy
- 0x06, // ???
+ 0x06, // Meteor police
+ 0xC0, // Meteor
+ 0x06, // Mark Eteer
+ 0x06, // Talkshow Host
+ 0x00, // Plant
+ 0xC0, // Meteor Radiation
+ 0xC0, // Edsel (small, outro)
+ 0x00, // Meteor (small, intro)
+ 0x06, // Sandy (Lab)
+ 0x06, // Sandy (Cut-Scene)
};
/* Used in Scumm v5 only. Play sounds associated with actors */
@@ -1355,7 +1492,10 @@ void ScummEngine::playActorSounds() {
} else {
sound = _actors[i]->_sound[0];
}
- _sound->addSoundToQueue(sound);
+ // fast mode will flood the queue with walk sounds
+ if (!_fastMode) {
+ _sound->addSoundToQueue(sound);
+ }
for (j = 1; j < _numActors; j++) {
_actors[j]->_cost.soundCounter = 0;
}
@@ -1462,6 +1602,18 @@ void ScummEngine::processActors() {
}
}
}
+ } else if (_game.version == 0) {
+ for (int j = 0; j < numactors; ++j) {
+ for (int i = 0; i < numactors; ++i) {
+ // Note: the plant is handled different in v0, the y value is not used.
+ // In v1/2 this is done by the actor's elevation instead.
+ int sc_actor1 = (_sortedActors[j]->_number == 19 ? 0 : _sortedActors[j]->getPos().y);
+ int sc_actor2 = (_sortedActors[i]->_number == 19 ? 0 : _sortedActors[i]->getPos().y);
+ if (sc_actor1 < sc_actor2) {
+ SWAP(_sortedActors[i], _sortedActors[j]);
+ }
+ }
+ }
} else {
for (int j = 0; j < numactors; ++j) {
for (int i = 0; i < numactors; ++i) {
@@ -1479,11 +1631,26 @@ void ScummEngine::processActors() {
for (Actor** ac = _sortedActors; ac != end; ++ac) {
Actor* a = *ac;
- // V0 MM: 0x057B
if (_game.version == 0) {
- ActorC64 *A = (ActorC64*) a;
- if ((A->_speaking & 1))
- A->_speaking ^= 0xFE;
+ // 0x057B
+ Actor_v0 *a0 = (Actor_v0*) a;
+ if (a0->_speaking & 1)
+ a0->_speaking ^= 0xFE;
+
+ // 0x22B5
+ if (a0->_miscflags & kActorMiscFlagHide)
+ continue;
+
+ // Sound
+ if (a0->_moving && _currentRoom != 1 && _currentRoom != 44) {
+ if (a0->_cost.soundPos == 0)
+ a0->_cost.soundCounter++;
+
+ // Is this the correct location?
+ // 0x073C
+ if (v0ActorTalkArray[a0->_number] & 0x3F)
+ a0->_cost.soundPos = (a0->_cost.soundPos + 1) % 3;
+ }
}
// Draw and animate the actors, except those w/o a costume.
// Note: We could 'optimize' this a little bit by only putting
@@ -1779,6 +1946,25 @@ void Actor::startAnimActor(int f) {
}
}
+void Actor_v0::startAnimActor(int f) {
+ if (f == _talkStartFrame) {
+ if (v0ActorTalkArray[_number] & 0x40)
+ return;
+
+ _speaking = 1;
+ return;
+ }
+
+ if (f == _talkStopFrame) {
+
+ _speaking = 0;
+ return;
+ }
+
+ if (f == _standFrame)
+ setDirection(_facing);
+}
+
void Actor::animateActor(int anim) {
int cmd, dir;
@@ -1841,6 +2027,47 @@ void Actor::animateCostume() {
}
}
+void Actor_v0::limbFrameCheck(int limb) {
+ if (_cost.frame[limb] == 0xFFFF)
+ return;
+
+ if (_cost.start[limb] == _cost.frame[limb])
+ return;
+
+ // 0x25A4
+ _cost.start[limb] = _cost.frame[limb];
+
+ _limbFrameRepeat[limb] = _limbFrameRepeatNew[limb];
+
+ // 0x25C3
+ _cost.active[limb] = ((V0CostumeLoader *)_vm->_costumeLoader)->getFrame(this, limb);
+ _cost.curpos[limb] = 0;
+
+ _needRedraw = true;
+}
+
+void Actor_v0::animateCostume() {
+ speakCheck();
+
+ if (_vm->_costumeLoader->increaseAnims(this))
+ _needRedraw = true;
+}
+
+void Actor_v0::speakCheck() {
+ if (v0ActorTalkArray[_number] & 0x80)
+ return;
+
+ int cmd = newDirToOldDir(_facing);
+
+ if (_speaking & 0x80)
+ cmd += 0x0C;
+ else
+ cmd += 0x10;
+
+ _animFrameRepeat = -1;
+ animateActor(cmd);
+}
+
#ifdef ENABLE_SCUMM_7_8
void Actor::animateLimb(int limb, int f) {
// This methods is very similiar to animateCostume().
@@ -1994,7 +2221,7 @@ void ScummEngine::setTalkingActor(int i) {
VAR(VAR_TALK_ACTOR) = i;
}
-static const int c64MMActorTalkColor[25] = {
+static const int v0MMActorTalkColor[25] = {
1, 7, 2, 14, 8, 15, 3, 7, 7, 15, 1, 13, 1, 4, 5, 5, 4, 3, 1, 5, 1, 1, 1, 1, 7
};
static const int v1MMActorTalkColor[25] = {
@@ -2006,7 +2233,7 @@ void ScummEngine::resetV1ActorTalkColor() {
for (i = 1; i < _numActors; i++) {
if (_game.version == 0) {
- _actors[i]->_talkColor = c64MMActorTalkColor[i];
+ _actors[i]->_talkColor = v0MMActorTalkColor[i];
} else {
_actors[i]->_talkColor = v1MMActorTalkColor[i];
}
@@ -2295,22 +2522,23 @@ static const char *const v0ActorNames_English[25] = {
"Bernard",
"Wendy",
"Jeff",
- "",
+ "", // Radiation Suit
"Dr Fred",
"Nurse Edna",
"Weird Ed",
"Dead Cousin Ted",
"Purple Tentacle",
"Green Tentacle",
+ "", // Meteor Police
"Meteor",
- "",
- "",
- "",
+ "", // Mark Eteer
+ "", // Talkshow Host
"Plant",
- "",
- "",
- "",
- "Sandy"
+ "", // Meteor Radiation
+ "", // Edsel (small, outro)
+ "", // Meteor (small, intro)
+ "Sandy", // (Lab)
+ "", // Sandy (Cut-Scene)
};
static const char *const v0ActorNames_German[25] = {
@@ -2328,15 +2556,16 @@ static const char *const v0ActorNames_German[25] = {
"Ted",
"Lila Tentakel",
"Gr<nes Tentakel",
- "Meteor",
"",
+ "Meteor",
"",
"",
"Pflanze",
"",
"",
"",
- "Sandy"
+ "Sandy",
+ "",
};
const byte *Actor::getActorName() {
@@ -2467,6 +2696,8 @@ bool Actor::isPlayer() {
}
bool Actor_v2::isPlayer() {
+ // isPlayer() is not supported by v0
+ assert(_vm->_game.version != 0);
return _vm->VAR(42) <= _number && _number <= _vm->VAR(43);
}
@@ -2621,16 +2852,64 @@ void ScummEngine_v71he::queueAuxEntry(int actorNum, int subIndex) {
}
#endif
+void Actor_v0::animateActor(int anim) {
+ int dir = -1;
+
+ switch (anim) {
+ case 0x00:
+ case 0x04:
+ dir = 0;
+ break;
+
+ case 0x01:
+ case 0x05:
+ dir = 1;
+ break;
+
+ case 0x02:
+ case 0x06:
+ dir = 2;
+ break;
+
+ case 0x03:
+ case 0x07:
+ dir = 3;
+ break;
+
+ default:
+ break;
+ }
+
+ if (isInCurrentRoom()) {
+
+ _costCommandNew = anim;
+ _vm->_costumeLoader->costumeDecodeData(this, 0, 0);
+
+ if (dir == -1)
+ return;
+
+ _facing = normalizeAngle(oldDirToNewDir(dir));
+
+ } else {
+
+ if (anim > 4 && anim <= 7)
+ _facing = normalizeAngle(oldDirToNewDir(dir));
+ }
+}
-void ActorC64::saveLoadWithSerializer(Serializer *ser) {
+void Actor_v0::saveLoadWithSerializer(Serializer *ser) {
Actor::saveLoadWithSerializer(ser);
static const SaveLoadEntry actorEntries[] = {
- MKLINE(ActorC64, _costCommand, sleByte, VER(84)),
- MKLINE(ActorC64, _costFrame, sleByte, VER(84)),
- MKLINE(ActorC64, _miscflags, sleByte, VER(84)),
- MKLINE(ActorC64, _speaking, sleByte, VER(84)),
- MKLINE(ActorC64, _speakingPrev, sleByte, VER(84)),
+ MKLINE(Actor_v0, _costCommand, sleByte, VER(84)),
+ MK_OBSOLETE(Actor_v0, _costFrame, sleByte, VER(84), VER(89)),
+ MKLINE(Actor_v0, _miscflags, sleByte, VER(84)),
+ MKLINE(Actor_v0, _speaking, sleByte, VER(84)),
+ MK_OBSOLETE(Actor_v0, _speakingPrev, sleByte, VER(84), VER(89)),
+ MK_OBSOLETE(Actor_v0, _limbTemp, sleByte, VER(89), VER(89)),
+ MKLINE(Actor_v0, _animFrameRepeat, sleByte, VER(89)),
+ MKARRAY(Actor_v0, _limbFrameRepeatNew[0], sleInt8, 8, VER(89)),
+ MKARRAY(Actor_v0, _limbFrameRepeat[0], sleInt8, 8, VER(90)),
MKEND()
};
diff --git a/engines/scumm/actor.h b/engines/scumm/actor.h
index 1584d0a78b..0ed239d005 100644
--- a/engines/scumm/actor.h
+++ b/engines/scumm/actor.h
@@ -202,13 +202,13 @@ public:
void adjustActorPos();
virtual AdjustBoxResult adjustXYToBeInBox(int dstX, int dstY);
- void setDirection(int direction);
+ virtual void setDirection(int direction);
void faceToObject(int obj);
void turnToDirection(int newdir);
virtual void walkActor();
void drawActorCostume(bool hitTestMode = false);
virtual void prepareDrawActorCostume(BaseCostumeRenderer *bcr);
- void animateCostume();
+ virtual void animateCostume();
virtual void setActorCostume(int c);
void animateLimb(int limb, int f);
@@ -222,7 +222,7 @@ protected:
void startWalkAnim(int cmd, int angle);
public:
void runActorTalkScript(int f);
- void startAnimActor(int frame);
+ virtual void startAnimActor(int frame);
void remapActorPalette(int r_fact, int g_fact, int b_fact, int threshold);
void remapActorPaletteColor(int slot, int color);
@@ -333,33 +333,53 @@ public:
protected:
virtual bool isPlayer();
virtual void prepareDrawActorCostume(BaseCostumeRenderer *bcr);
+ virtual bool checkWalkboxesHaveDirectPath(Common::Point &foundPath);
};
-class ActorC64 : public Actor_v2 {
+enum ActorV0MiscFlags {
+ kActorMiscFlagStrong = 0x01, // Kid is strong (Hunk-O-Matic used)
+ kActorMiscFlagGTFriend = 0x02, // Kid is green tentacle's friend (recording contract)
+ kActorMiscFlagWatchedTV = 0x04, // Kid knows publisher's address (watched TV)
+ kActorMiscFlagEdsEnemy = 0x08, // Kid is not Weird Ed's friend
+ kActorMiscFlag_10 = 0x10, // ???
+ kActorMiscFlag_20 = 0x20, // ???
+ kActorMiscFlagFreeze = 0x40, // Stop moving
+ kActorMiscFlagHide = 0x80 // Kid is invisible (dead or in radiation suit)
+};
+
+class Actor_v0 : public Actor_v2 {
public:
- byte _costCommand, _costFrame;
- byte _miscflags; // 0x1: strong, 0x8: Ed's enemy, 0x40: stop moving, 0x80: hide(dead/radiation suit)
- byte _speaking, _speakingPrev;
+ byte _costCommandNew;
+ byte _costCommand;
+ byte _miscflags;
+ byte _speaking;
+
+ int8 _animFrameRepeat;
+ int8 _limbFrameRepeatNew[8];
+ int8 _limbFrameRepeat[8];
+
+ bool _limb_flipped[8];
public:
- ActorC64(ScummEngine *scumm, int id) : Actor_v2(scumm, id) {
- _costCommand = 0;
- _costFrame = 0;
- _speaking = 0;
- _speakingPrev = 0;
- }
- virtual void initActor(int mode) {
- Actor_v2::initActor(mode);
- if (mode == -1) {
- _miscflags = 0;
- }
- }
+ Actor_v0(ScummEngine *scumm, int id) : Actor_v2(scumm, id) {}
+
+ virtual void initActor(int mode);
+ virtual void animateActor(int anim);
+ virtual void animateCostume();
+
+ void limbFrameCheck(int limb);
+
+ void speakCheck();
+ virtual void setDirection(int direction);
+ void startAnimActor(int f);
// Used by the save/load system:
virtual void saveLoadWithSerializer(Serializer *ser);
protected:
-
+ bool intersectLineSegments(const Common::Point &line1Start, const Common::Point &line1End,
+ const Common::Point &line2Start, const Common::Point &line2End, Common::Point &result);
+ virtual bool checkWalkboxesHaveDirectPath(Common::Point &foundPath);
};
diff --git a/engines/scumm/boxes.cpp b/engines/scumm/boxes.cpp
index 64d4d7422c..f6d2a18f38 100644
--- a/engines/scumm/boxes.cpp
+++ b/engines/scumm/boxes.cpp
@@ -42,7 +42,7 @@ struct Box { /* Internal walkbox file format */
byte y1;
byte y2;
byte mask;
- } c64;
+ } v0;
struct {
byte uy;
@@ -181,7 +181,7 @@ byte ScummEngine::getMaskFromBox(int box) {
if (_game.version == 8)
return (byte) FROM_LE_32(ptr->v8.mask);
else if (_game.version == 0)
- return ptr->c64.mask;
+ return ptr->v0.mask;
else if (_game.version <= 2)
return ptr->v2.mask;
else
@@ -479,7 +479,7 @@ Box *ScummEngine::getBoxBaseAddr(int box) {
assertRange(0, box, ptr[0] - 1, "box");
if (_game.version == 0)
- return (Box *)(ptr + box * SIZEOF_BOX_C64 + 1);
+ return (Box *)(ptr + box * SIZEOF_BOX_V0 + 1);
else if (_game.version <= 2)
return (Box *)(ptr + box * SIZEOF_BOX_V2 + 1);
else if (_game.version == 3)
@@ -602,19 +602,19 @@ BoxCoords ScummEngine::getBoxCoordinates(int boxnum) {
SWAP(box->ll, box->lr);
}
} else if (_game.version == 0) {
- box->ul.x = bp->c64.x1;
- box->ul.y = bp->c64.y1;
- box->ur.x = bp->c64.x2;
- box->ur.y = bp->c64.y1;
+ box->ul.x = bp->v0.x1;
+ box->ul.y = bp->v0.y1;
+ box->ur.x = bp->v0.x2;
+ box->ur.y = bp->v0.y1;
- box->ll.x = bp->c64.x1;
- box->ll.y = bp->c64.y2;
- box->lr.x = bp->c64.x2;
- box->lr.y = bp->c64.y2;
+ box->ll.x = bp->v0.x1;
+ box->ll.y = bp->v0.y2;
+ box->lr.x = bp->v0.x2;
+ box->lr.y = bp->v0.y2;
- if ((bp->c64.mask & 0x88) == 0x88) {
+ if ((bp->v0.mask & 0x88) == 0x88) {
// walkbox for (right/left) corner
- if (bp->c64.mask & 0x04)
+ if (bp->v0.mask & 0x04)
box->ur = box->ul;
else
box->ul = box->ur;
diff --git a/engines/scumm/boxes.h b/engines/scumm/boxes.h
index e554aea1b5..345d6a9d36 100644
--- a/engines/scumm/boxes.h
+++ b/engines/scumm/boxes.h
@@ -27,7 +27,7 @@
namespace Scumm {
-#define SIZEOF_BOX_C64 5
+#define SIZEOF_BOX_V0 5
#define SIZEOF_BOX_V2 8
#define SIZEOF_BOX_V3 18
#define SIZEOF_BOX 20
diff --git a/engines/scumm/charset-fontdata.cpp b/engines/scumm/charset-fontdata.cpp
index 29465584f8..16193f5503 100644
--- a/engines/scumm/charset-fontdata.cpp
+++ b/engines/scumm/charset-fontdata.cpp
@@ -420,7 +420,7 @@ static const byte germanCharsetDataV2[] = {
126, 10,
};
-// German C64 MM.
+// German v0 MM.
static const byte germanCharsetDataV0[] = {
36, 11,
42, 12,
diff --git a/engines/scumm/costume.cpp b/engines/scumm/costume.cpp
index eb3cc3262c..6e7e9ff688 100644
--- a/engines/scumm/costume.cpp
+++ b/engines/scumm/costume.cpp
@@ -72,14 +72,6 @@ static const int v1MMNESLookup[25] = {
0x17, 0x00, 0x01, 0x05, 0x16
};
-static const byte v0ActorTalkArray[0x19] = {
- 0x00, 0x06, 0x06, 0x06, 0x06,
- 0x06, 0x06, 0x00, 0x46, 0x06,
- 0x06, 0x06, 0x06, 0xFF, 0xFF,
- 0x06, 0xC0, 0x06, 0x06, 0x00,
- 0xC0, 0xC0, 0x00, 0x06, 0x06
-};
-
byte ClassicCostumeRenderer::mainRoutine(int xmoveCur, int ymoveCur) {
int i, skip = 0;
byte drawFlag = 1;
@@ -676,7 +668,7 @@ void ClassicCostumeRenderer::procPCEngine(Codec1 &v1) {
(v1.mask_ptr && (mask[0] & maskbit));
if (pcolor && !masked) {
- WRITE_UINT16(dst, ((uint16*)_palette)[pcolor]);
+ WRITE_UINT16(dst, ((uint16 *)_palette)[pcolor]);
}
xPos += xStep;
@@ -1171,7 +1163,7 @@ byte NESCostumeLoader::increaseAnim(Actor *a, int slot) {
return (a->_cost.curpos[slot] != oldframe);
}
-static const byte actorColorsMMC64[25] = {
+static const byte actorV0Colors[25] = {
0, 7, 2, 6, 9, 1, 3, 7, 7, 1, 1, 9, 1, 4, 5, 5, 4, 1, 0, 5, 4, 2, 2, 7, 7
};
@@ -1186,24 +1178,25 @@ static const byte actorColorsMMC64[25] = {
dst[p + 1] = palette[pcolor]; \
}
-byte C64CostumeRenderer::drawLimb(const Actor *a, int limb) {
- if (limb >= 8)
- return 0;
+byte V0CostumeRenderer::drawLimb(const Actor *a, int limb) {
+ const Actor_v0* a0 = (const Actor_v0 *)a;
- if (a->_cost.start[limb] == 0xFFFF)
+ if (limb >= 8)
return 0;
if (limb == 0) {
_draw_top = 200;
_draw_bottom = 0;
}
-
- bool flipped = (a->_cost.start[limb] & 0x80) != 0;
- byte frameStart = _loaded._frameOffsets[a->_cost.frame[limb]];
- byte frame = _loaded._frameOffsets[frameStart + a->_cost.curpos[limb]];
- if (frame == 0xFF)
+
+ // Invalid current position?
+ if (a->_cost.curpos[limb] == 0xFFFF)
return 0;
+ _loaded.loadCostume(a->_costume);
+ byte frame = _loaded._frameOffsets[a->_cost.curpos[limb] + a->_cost.active[limb]];
+
+ // Get the frame ptr
byte ptrLow = _loaded._baseptr[frame];
byte ptrHigh = ptrLow + _loaded._dataOffsets[4];
int frameOffset = (_loaded._baseptr[ptrHigh] << 8) + _loaded._baseptr[ptrLow + 2]; // 0x23EF / 0x2400
@@ -1214,7 +1207,7 @@ byte C64CostumeRenderer::drawLimb(const Actor *a, int limb) {
byte palette[4] = { 0, 0, 0, 0 };
if (_vm->getCurrentLights() & LIGHTMODE_actor_use_colors) {
palette[1] = 10;
- palette[2] = actorColorsMMC64[_actorID];
+ palette[2] = actorV0Colors[_actorID];
} else {
palette[2] = 11;
palette[3] = 11;
@@ -1231,7 +1224,7 @@ byte C64CostumeRenderer::drawLimb(const Actor *a, int limb) {
if (!width || !height)
return 0;
- int xpos = _actorX + (flipped ? -1 : +1) * (offsetX * 8 - a->_width / 2);
+ int xpos = _actorX + (a0->_limb_flipped[limb] ? -1 : +1) * (offsetX * 8 - a->_width / 2);
// +1 as we appear to be 1 pixel away from the original interpreter
int ypos = _actorY - offsetY + 1;
@@ -1241,13 +1234,13 @@ byte C64CostumeRenderer::drawLimb(const Actor *a, int limb) {
byte color = data[y * width + x];
byte pcolor;
- int destX = xpos + (flipped ? -(x + 1) : x) * 8;
+ int destX = xpos + (a0->_limb_flipped[limb] ? -(x + 1) : x) * 8;
int destY = ypos + y;
if (destY >= 0 && destY < _out.h && destX >= 0 && destX < _out.w) {
byte *dst = (byte *)_out.pixels + destY * _out.pitch + destX;
byte *mask = _vm->getMaskBuffer(0, destY, _zbuf);
- if (flipped) {
+ if (a0->_limb_flipped[limb]) {
LINE(0, 0); LINE(2, 2); LINE(4, 4); LINE(6, 6);
} else {
LINE(6, 0); LINE(4, 2); LINE(2, 4); LINE(0, 6);
@@ -1258,7 +1251,7 @@ byte C64CostumeRenderer::drawLimb(const Actor *a, int limb) {
_draw_top = MIN(_draw_top, ypos);
_draw_bottom = MAX(_draw_bottom, ypos + height);
- if (flipped)
+ if (a0->_limb_flipped[limb])
_vm->markRectAsDirty(kMainVirtScreen, xpos - (width * 8), xpos, ypos, ypos + height, _actorID);
else
_vm->markRectAsDirty(kMainVirtScreen, xpos, xpos + (width * 8), ypos, ypos + height, _actorID);
@@ -1268,11 +1261,11 @@ byte C64CostumeRenderer::drawLimb(const Actor *a, int limb) {
#undef LINE
#undef MASK_AT
-void C64CostumeRenderer::setCostume(int costume, int shadow) {
+void V0CostumeRenderer::setCostume(int costume, int shadow) {
_loaded.loadCostume(costume);
}
-void C64CostumeLoader::loadCostume(int id) {
+void V0CostumeLoader::loadCostume(int id) {
const byte *ptr = _vm->getResourceAddress(rtCostume, id);
_id = id;
@@ -1282,166 +1275,128 @@ void C64CostumeLoader::loadCostume(int id) {
_numColors = 0;
_numAnim = 0;
_mirror = 0;
- _palette = &actorColorsMMC64[id];
+ _palette = &actorV0Colors[id];
_frameOffsets = _baseptr + READ_LE_UINT16(ptr + 5);
_dataOffsets = ptr;
_animCmds = _baseptr + READ_LE_UINT16(ptr + 7);
-
- _maxHeight = 0;
}
-void C64CostumeLoader::frameUpdate(ActorC64 *a, int cmd ) {
- byte limbFrames = 0;
+void V0CostumeLoader::costumeDecodeData(Actor *a, int frame, uint usemask) {
+ Actor_v0 *a0 = (Actor_v0 *)a;
+
+ if (!a->_costume)
+ return;
+
+ loadCostume(a->_costume);
+
+ // Invalid costume command?
+ if (a0->_costCommandNew == 0xFF || (a0->_costCommand == a0->_costCommandNew))
+ return;
+
+ a0->_costCommand = a0->_costCommandNew;
+
+ int cmd = a0->_costCommand;
+ byte limbFrameNumber = 0;
// Each costume-command has 8 limbs (0x2622)
cmd <<= 3;
- for (int limb = 0, pos = 0; limb < 8; ++limb, pos = 0) {
- // get a limb frames ptr from the costume command
- limbFrames = ((_animCmds + cmd)[limb]);
-
- // Dont change limb if entry is invalid
- if (limbFrames == 0xFF)
- continue;
+ for (int limb = 0; limb < 8; ++limb) {
- // Has limb frames ptr changed since last update?
- if (a->_cost.start[limb] == limbFrames)
- continue;
+ // get the frame number for the beginning of the costume command
+ limbFrameNumber = ((_animCmds + cmd)[limb]);
- // Set new limb command addresses
- a->_cost.start[limb] = limbFrames;
- a->_cost.frame[limb] = _frameOffsets[limb] + (limbFrames & 0x7f); // limb animation-frames ptr
+ // Is this limb flipped?
+ if (limbFrameNumber & 0x80) {
- // Get first entry of a limbs' frames
- byte frameStart = _frameOffsets[ a->_cost.frame[limb]];
+ // Invalid frame?
+ if (limbFrameNumber == 0xFF)
+ continue;
- // Loop each frame in this limb until we reach the end marker
- while (pos != 0xFF) { // This is just so we dont overflow
- byte frame = _frameOffsets[frameStart + pos];
+ // Store the limb frame number (clear the flipped status)
+ a->_cost.frame[limb] = (limbFrameNumber & 0x7f);
- // Each animation-frame until we find end
- if (frame == 0xFF)
- break;
+ if (a0->_limb_flipped[limb] != true)
+ a->_cost.start[limb] = 0xFFFF;
- byte ptrLow = _baseptr[frame];
- byte ptrHigh = ptrLow + _dataOffsets[4];
- int frameOffset = (_baseptr[ptrHigh] << 8) + _baseptr[ptrLow + 2]; // 0x23EF / 0x2400
+ a0->_limb_flipped[limb] = true;
- const byte *data = _baseptr + frameOffset;
+ } else {
+ //Store the limb frame number
+ a->_cost.frame[limb] = limbFrameNumber;
- if (data[3] > _maxHeight)
- _maxHeight = data[3] + 1;
+ if (a0->_limb_flipped[limb] != false)
+ a->_cost.start[limb] = 0xFFFF;
- ++pos;
+ a0->_limb_flipped[limb] = false;
}
- // Set ending position of limb frames
- a->_cost.end[limb] = pos - 1;
- a->_cost.curpos[limb] = 0;
- }
-}
-
-// based on 0x2BCA, doesn't match disassembly because 'oldDir' variable
-// is not the same value as stored in the original interpreter
-int C64CostumeLoader::dirToDirStop(int oldDir) {
- switch (oldDir) {
- case 0:
- return 4; // Left
- case 1:
- return 5; // Right
- case 2:
- return 6; // Face Camera
- case 3:
- return 7; // Face Away
+ // Set the repeat value
+ a0->_limbFrameRepeatNew[limb] = a0->_animFrameRepeat;
}
- // shouldnt' be reached
- return 4;
}
-void C64CostumeLoader::actorSpeak(ActorC64 *a, int &cmd) {
- if (v0ActorTalkArray[a->_number] & 0x80)
- return;
+byte V0CostumeLoader::getFrame(Actor *a, int limb) {
+ loadCostume(a->_costume);
- if ((a->_speaking & 0x80))
- cmd += 0x0C;
- else
- cmd += 0x10;
+ // Get the frame number for the current limb / Command
+ return _frameOffsets[_frameOffsets[limb] + a->_cost.start[limb]];
}
-void C64CostumeLoader::costumeDecodeData(Actor *a, int frame, uint usemask) {
- ActorC64 *A = (ActorC64 *)a;
- int dir = newDirToOldDir(a->getFacing());
- int command = dir;
-
- loadCostume(a->_costume);
-
- // Enable/Disable speaking flag
- if (frame == a->_talkStartFrame) {
- if (v0ActorTalkArray[a->_number] & 0x40)
- return;
+byte V0CostumeLoader::increaseAnims(Actor *a) {
+ Actor_v0 *a0 = (Actor_v0 *)a;
+ int i;
+ byte r = 0;
- A->_speaking = 1;
- return;
- }
- if (frame == a->_talkStopFrame) {
- A->_speaking = 0;
- return;
+ for (i = 0; i != 8; i++) {
+ a0->limbFrameCheck(i);
+ r += increaseAnim(a, i);
}
+ return r;
+}
- // Different command for stand frame
- if (frame == a->_standFrame)
- command = dirToDirStop(dir);
-
- // Update the limb frames
- frameUpdate(A, command);
-
- // Keep current command/frame mode
- A->_costCommand = dir;
- A->_costFrame = frame;
+byte V0CostumeLoader::increaseAnim(Actor *a, int limb) {
+ Actor_v0 *a0 = (Actor_v0 *)a;
+ const uint16 limbPrevious = a->_cost.curpos[limb]++;
- // Update 'speaking' frames?
- if (A->_speaking) {
- command = dir; // Incase standing frame was set as cmd
- actorSpeak(A, command);
+ loadCostume(a->_costume);
- // Update the limb speak frames
- frameUpdate(A, command);
- }
-}
+ // 0x2543
+ byte frame = _frameOffsets[a->_cost.curpos[limb] + a->_cost.active[limb]];
-byte C64CostumeLoader::increaseAnims(Actor *a) {
- ActorC64 *A = (ActorC64 *)a;
+ // Is this frame invalid?
+ if (frame == 0xFF) {
- // check if the actor speak flag has changed since last frame increase
- if (A->_speaking != A->_speakingPrev) {
- int cmd = A->_costCommand;
- A->_speakingPrev = A->_speaking;
+ // Repeat timer has reached 0?
+ if (a0->_limbFrameRepeat[limb] == 0) {
- actorSpeak(A, cmd);
+ // Use the previous frame
+ --a0->_cost.curpos[limb];
- // Update the limb frames
- frameUpdate(A, cmd);
- }
+ // Reset the comstume command
+ a0->_costCommandNew = 0xFF;
+ a0->_costCommand = 0xFF;
+
+ // Set the frame/start to invalid
+ a0->_cost.frame[limb] = 0xFFFF;
+ a0->_cost.start[limb] = 0xFFFF;
- if (A->_moving && _vm->_currentRoom != 1 && _vm->_currentRoom != 44) {
- if (a->_cost.soundPos == 0)
- a->_cost.soundCounter++;
+ } else {
- // Is this the correct location?
- // 0x073C
- if (v0ActorTalkArray[a->_number] & 0x3F)
- a->_cost.soundPos = (a->_cost.soundPos + 1) % 3;
- }
+ // Repeat timer enabled?
+ if (a0->_limbFrameRepeat[limb] != -1)
+ --a0->_limbFrameRepeat[limb];
- // increase each frame pos
- for (int limb = 0; limb < 8; ++limb) {
- if (a->_cost.curpos[limb] < a->_cost.end[limb])
- a->_cost.curpos[limb]++;
- else
+ // No, restart at frame 0
a->_cost.curpos[limb] = 0;
+ }
}
+ // Limb frame has changed?
+ if (limbPrevious == a->_cost.curpos[limb])
+ return 0;
+
return 1;
}
diff --git a/engines/scumm/costume.h b/engines/scumm/costume.h
index 3acf2a1f6c..4a21692ddb 100644
--- a/engines/scumm/costume.h
+++ b/engines/scumm/costume.h
@@ -67,20 +67,16 @@ protected:
byte increaseAnim(Actor *a, int slot);
};
-class C64CostumeLoader : public ClassicCostumeLoader {
+class V0CostumeLoader : public ClassicCostumeLoader {
public:
- C64CostumeLoader(ScummEngine *vm) : ClassicCostumeLoader(vm) {}
+ V0CostumeLoader(ScummEngine *vm) : ClassicCostumeLoader(vm) {}
void loadCostume(int id);
void costumeDecodeData(Actor *a, int frame, uint usemask);
byte increaseAnims(Actor *a);
-
- int _maxHeight;
+ byte getFrame(Actor *a, int limb);
protected:
- void actorSpeak(ActorC64 *a, int &cmd);
- int dirToDirStop(int oldDir);
- void frameUpdate(ActorC64 *A, int cmd);
-
+ byte increaseAnim(Actor *a, int limb);
};
class ClassicCostumeRenderer : public BaseCostumeRenderer {
@@ -135,12 +131,12 @@ public:
};
#endif
-class C64CostumeRenderer : public BaseCostumeRenderer {
+class V0CostumeRenderer : public BaseCostumeRenderer {
protected:
- C64CostumeLoader _loaded;
+ V0CostumeLoader _loaded;
public:
- C64CostumeRenderer(ScummEngine *vm) : BaseCostumeRenderer(vm), _loaded(vm) {}
+ V0CostumeRenderer(ScummEngine *vm) : BaseCostumeRenderer(vm), _loaded(vm) {}
void setPalette(uint16 *palette) {}
void setFacing(const Actor *a) {}
diff --git a/engines/scumm/cursor.cpp b/engines/scumm/cursor.cpp
index 36f06a4889..42f11498d9 100644
--- a/engines/scumm/cursor.cpp
+++ b/engines/scumm/cursor.cpp
@@ -636,7 +636,7 @@ void ScummEngine_v5::setBuiltinCursor(int idx) {
byte *dst2 = (_textSurfaceMultiplier == 2) ? dst1 + 16 * scl : dst1;
if (_outputPixelFormat.bytesPerPixel == 2) {
for (int b = 0; b < scl; b += 2) {
- *((uint16*)dst1) = *((uint16*)dst2) = color;
+ *((uint16 *)dst1) = *((uint16 *)dst2) = color;
dst1 += 2;
dst2 += 2;
}
diff --git a/engines/scumm/debugger.cpp b/engines/scumm/debugger.cpp
index 54f7fea97b..edcf2e6fea 100644
--- a/engines/scumm/debugger.cpp
+++ b/engines/scumm/debugger.cpp
@@ -382,7 +382,8 @@ bool ScummDebugger::Cmd_Actor(int argc, const char **argv) {
DebugPrintf("Actor[%d].costume = %d\n", actnum, a->_costume);
}
} else if (!strcmp(argv[2], "name")) {
- DebugPrintf("Name of actor %d: %s\n", actnum, _vm->getObjOrActorName(actnum));
+ DebugPrintf("Name of actor %d: %s\n", actnum,
+ _vm->getObjOrActorName(_vm->actorToObj(actnum)));
} else if (!strcmp(argv[2], "condmask")) {
if (argc > 3) {
a->_heCondMask = value;
@@ -427,9 +428,10 @@ bool ScummDebugger::Cmd_PrintObjects(int argc, const char **argv) {
o = &(_vm->_objs[i]);
if (o->obj_nr == 0)
continue;
+ int classData = (_vm->_game.version != 0 ? _vm->_classData[o->obj_nr] : 0);
DebugPrintf("|%4d|%4d|%4d|%5d|%6d|%5d|%2d|$%08x|\n",
o->obj_nr, o->x_pos, o->y_pos, o->width, o->height, o->state,
- o->fl_object_index, _vm->_classData[o->obj_nr]);
+ o->fl_object_index, classData);
}
DebugPrintf("\n");
@@ -446,7 +448,7 @@ bool ScummDebugger::Cmd_Object(int argc, const char **argv) {
}
obj = atoi(argv[1]);
- if (obj >= _vm->_numGlobalObjects) {
+ if (_vm->_game.version != 0 && obj >= _vm->_numGlobalObjects) {
DebugPrintf("Object %d is out of range (range: 1 - %d)\n", obj, _vm->_numGlobalObjects);
return true;
}
diff --git a/engines/scumm/detection.cpp b/engines/scumm/detection.cpp
index d925cc9198..b47982af00 100644
--- a/engines/scumm/detection.cpp
+++ b/engines/scumm/detection.cpp
@@ -598,7 +598,7 @@ static void detectGames(const Common::FSList &fslist, Common::List<DetectorResul
}
if (isDiskImg)
- closeDiskImage((ScummDiskImage*)tmp);
+ closeDiskImage((ScummDiskImage *)tmp);
delete tmp;
}
@@ -971,9 +971,6 @@ GameList ScummMetaEngine::detectGames(const Common::FSList &fslist) const {
::detectGames(fslist, results, 0);
- // TODO: We still don't handle the FM-TOWNS demos (like zakloom) very well.
- // In particular, they are detected as ZakTowns, which is bad.
-
for (Common::List<DetectorResult>::iterator
x = results.begin(); x != results.end(); ++x) {
const PlainGameDescriptor *g = findPlainGameDescriptor(x->game.gameid, gameDescriptions);
@@ -987,26 +984,6 @@ GameList ScummMetaEngine::detectGames(const Common::FSList &fslist) const {
// Based on generateComplexID() in advancedDetector.cpp.
dg["preferredtarget"] = generatePreferredTarget(*x);
- // HACK: Detect and distinguish the FM-TOWNS demos
- if (x->game.platform == Common::kPlatformFMTowns && (x->game.features & GF_DEMO)) {
- if (x->md5 == "2d388339d6050d8ccaa757b64633954e") {
- // Indy + Loom demo
- dg.description() = "Indiana Jones and the Last Crusade & Loom";
- dg.updateDesc(x->extra);
- dg["preferredtarget"] = "indyloom";
- } else if (x->md5 == "77f5c9cc0986eb729c1a6b4c8823bbae") {
- // Zak + Loom demo
- dg.description() = "Zak McKracken & Loom";
- dg.updateDesc(x->extra);
- dg["preferredtarget"] = "zakloom";
- } else if (x->md5 == "3938ee1aa4433fca9d9308c9891172b1") {
- // Indy + Zak demo
- dg.description() = "Indiana Jones and the Last Crusade & Zak McKracken";
- dg.updateDesc(x->extra);
- dg["preferredtarget"] = "indyzak";
- }
- }
-
dg.setGUIOptions(x->game.guioptions + MidiDriver::musicType2GUIO(x->game.midi));
dg.appendGUIOptions(getGameGUIOptionsDescriptionLanguage(x->language));
diff --git a/engines/scumm/detection_tables.h b/engines/scumm/detection_tables.h
index bd2ff3062b..a44497f193 100644
--- a/engines/scumm/detection_tables.h
+++ b/engines/scumm/detection_tables.h
@@ -70,6 +70,9 @@ static const PlainGameDescriptor gameDescriptions[] = {
{ "samnmax", "Sam & Max Hit the Road" },
{ "tentacle", "Day of the Tentacle" },
{ "zak", "Zak McKracken and the Alien Mindbenders" },
+ { "indyloom", "Indiana Jones and the Last Crusade & Loom" },
+ { "indyzak", "Indiana Jones and the Last Crusade & Zak McKracken" },
+ { "zakloom", "Zak McKracken & Loom" },
#ifdef ENABLE_SCUMM_7_8
{ "ft", "Full Throttle" },
@@ -210,6 +213,9 @@ static const GameSettings gameVariantsTable[] = {
{"zak", "V1", "v1", GID_ZAK, 1, 0, MDT_PCSPK | MDT_PCJR, 0, UNK, GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)},
{"zak", "V2", "v2", GID_ZAK, 2, 0, MDT_PCSPK | MDT_PCJR, 0, UNK, GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)},
{"zak", "FM-TOWNS", 0, GID_ZAK, 3, 0, MDT_TOWNS, GF_OLD256 | GF_AUDIOTRACKS, Common::kPlatformFMTowns, GUIO4(GUIO_NOSPEECH, GUIO_NOMIDI, GUIO_MIDITOWNS, GUIO_NOASPECT)},
+ {"zakloom", "FM-TOWNS", 0, GID_ZAK, 3, 0, MDT_TOWNS, GF_OLD256 | GF_AUDIOTRACKS, Common::kPlatformFMTowns, GUIO4(GUIO_NOSPEECH, GUIO_NOMIDI, GUIO_MIDITOWNS, GUIO_NOASPECT)},
+ {"indyloom", "FM-TOWNS", 0, GID_ZAK, 3, 0, MDT_TOWNS, GF_OLD256 | GF_AUDIOTRACKS, Common::kPlatformFMTowns, GUIO4(GUIO_NOSPEECH, GUIO_NOMIDI, GUIO_MIDITOWNS, GUIO_NOASPECT)},
+ {"indyzak", "FM-TOWNS", 0, GID_ZAK, 3, 0, MDT_TOWNS, GF_OLD256 | GF_AUDIOTRACKS, Common::kPlatformFMTowns, GUIO4(GUIO_NOSPEECH, GUIO_NOMIDI, GUIO_MIDITOWNS, GUIO_NOASPECT)},
{"indy3", "EGA", "ega", GID_INDY3, 3, 0, MDT_PCSPK | MDT_PCJR | MDT_CMS | MDT_ADLIB, 0, UNK, GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)},
{"indy3", "No AdLib", "ega", GID_INDY3, 3, 0, MDT_PCSPK | MDT_PCJR, 0, UNK, GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)},
@@ -437,6 +443,10 @@ static const GameFilenamePattern gameFilenamesTable[] = {
{ "indy3", "%02d.LFL", kGenRoomNum, UNK_LANG, UNK, 0 },
+ { "indyloom", "%02d.LFL", kGenRoomNum, UNK_LANG, UNK, 0 },
+ { "indyzak", "%02d.LFL", kGenRoomNum, UNK_LANG, UNK, 0 },
+ { "zakloom", "%02d.LFL", kGenRoomNum, UNK_LANG, UNK, 0 },
+
{ "loom", "%02d.LFL", kGenRoomNum, UNK_LANG, UNK, 0 },
{ "loom", "%03d.LFL", kGenRoomNum, UNK_LANG, UNK, "VGA" }, // Loom CD
@@ -647,7 +657,7 @@ static const GameFilenamePattern gameFilenamesTable[] = {
{ "freddi", "MM-DEMO", kGenHEPC, UNK_LANG, UNK, 0 },
{ "freddi2", "freddi2", kGenHEPC, UNK_LANG, UNK, 0 },
- { "freddi2", "ff2-demo", kGenHEPC, UNK_LANG, UNK, 0 },
+ { "freddi2", "ff2-demo", kGenHEPC, UNK_LANG, Common::kPlatformWindows, 0 },
{ "freddi2", "FFHSDemo", kGenHEMac, UNK_LANG, Common::kPlatformMacintosh, 0 },
{ "freddi2", "FFHSDemo", kGenHEPC, UNK_LANG, UNK, 0 },
{ "freddi2", "Freddi Fish 2 Demo", kGenHEMac, UNK_LANG, Common::kPlatformMacintosh, 0 },
@@ -660,7 +670,9 @@ static const GameFilenamePattern gameFilenamesTable[] = {
{ "freddi3", "freddi3", kGenHEPC, UNK_LANG, UNK, 0 },
{ "freddi3", "F3-Mdemo", kGenHEMac, UNK_LANG, Common::kPlatformMacintosh, 0 },
{ "freddi3", "f3-mdemo", kGenHEPC, UNK_LANG, UNK, 0 },
- { "freddi3", "FF3-DEMO", kGenHEPC, UNK_LANG, UNK, 0 },
+ { "freddi3", "FF3 Demo", kGenHEMac, UNK_LANG, Common::kPlatformMacintosh, 0 },
+ { "freddi3", "FF3-demo", kGenHEMac, UNK_LANG, Common::kPlatformMacintosh, 0 },
+ { "freddi3", "FF3-DEMO", kGenHEPC, UNK_LANG, Common::kPlatformWindows, 0 },
{ "freddi3", "FF3DEMO", kGenHEPC, Common::HE_ISR, UNK, 0 },
{ "freddi3", "Freddi 3", kGenHEMac, Common::NL_NLD, Common::kPlatformMacintosh, 0 },
{ "freddi3", "Freddi Fish 3", kGenHEMac, UNK_LANG, Common::kPlatformMacintosh, 0 },
@@ -741,7 +753,7 @@ static const GameFilenamePattern gameFilenamesTable[] = {
{ "pajama2", "PJP2DEMO", kGenHEPC, Common::DE_DEU, UNK, 0 },
{ "pajama2", "PJ2Demo", kGenHEMac, UNK_LANG, Common::kPlatformMacintosh, 0 },
{ "pajama2", "pj2demo", kGenHEPC, UNK_LANG, UNK, 0 },
- { "pajama2", "Pjs2demo", kGenHEPC, UNK_LANG, UNK, 0 },
+ { "pajama2", "Pjs2demo", kGenHEPC, UNK_LANG, Common::kPlatformWindows, 0 },
{ "pajama2", "PJ2 Demo", kGenHEMac, Common::NL_NLD, Common::kPlatformMacintosh, 0 },
{ "pajama2", "PS2DEMO", kGenHEPC, Common::HE_ISR, UNK, 0 },
@@ -776,7 +788,7 @@ static const GameFilenamePattern gameFilenamesTable[] = {
{ "puttcircus", "ToffToffGZZ", kGenHEPC, Common::DE_DEU, UNK, 0 },
{ "puttrace", "puttrace", kGenHEPC, UNK_LANG, UNK, 0 },
- { "puttrace", "500demo", kGenHEPC, Common::NL_NLD, UNK, 0 },
+ { "puttrace", "500demo", kGenHEPC, Common::NL_NLD, Common::kPlatformWindows, 0 },
{ "puttrace", "course", kGenHEPC, Common::FR_FRA, UNK, 0 },
{ "puttrace", "CourseDemo", kGenHEPC, Common::FR_FRA, UNK, 0 },
{ "puttrace", "racedemo", kGenHEPC, UNK_LANG, UNK, 0 },
@@ -808,7 +820,8 @@ static const GameFilenamePattern gameFilenamesTable[] = {
{ "putttime", "Putt Time", kGenHEMac, UNK_LANG, Common::kPlatformMacintosh, 0 },
{ "putttime", "PuttTTT", kGenHEMac, UNK_LANG, Common::kPlatformMacintosh, 0 },
{ "putttime", "PuttTTT", kGenHEPC, UNK_LANG, UNK, 0 },
- { "putttime", "TIJDDEMO", kGenHEPC, UNK_LANG, UNK, 0 },
+ { "putttime", "TIJDDEMO", kGenHEPC, Common::NL_NLD, Common::kPlatformWindows, 0 },
+ { "putttime", "TijdDemo", kGenHEMac, Common::NL_NLD, Common::kPlatformMacintosh, 0 },
{ "putttime", "timedemo", kGenHEPC, UNK_LANG, UNK, 0 },
{ "putttime", "TimeDemo", kGenHEMac, UNK_LANG, Common::kPlatformMacintosh, 0 },
{ "putttime", "TEMPDEMO", kGenHEPC, Common::FR_FRA, UNK, 0 },
diff --git a/engines/scumm/gfx.cpp b/engines/scumm/gfx.cpp
index a22aa1802f..48ccdfd1cf 100644
--- a/engines/scumm/gfx.cpp
+++ b/engines/scumm/gfx.cpp
@@ -26,6 +26,7 @@
#include "scumm/he/intern_he.h"
#endif
#include "scumm/resource.h"
+#include "scumm/scumm_v0.h"
#include "scumm/scumm_v5.h"
#include "scumm/scumm_v6.h"
#include "scumm/usage_bits.h"
@@ -239,7 +240,7 @@ GdiPCEngine::~GdiPCEngine() {
#endif
GdiV1::GdiV1(ScummEngine *vm) : Gdi(vm) {
- memset(&_C64, 0, sizeof(_C64));
+ memset(&_V1, 0, sizeof(_V1));
}
GdiV2::GdiV2(ScummEngine *vm) : Gdi(vm) {
@@ -296,17 +297,17 @@ void GdiPCEngine::loadTiles(byte *roomptr) {
void GdiV1::roomChanged(byte *roomptr) {
for (int i = 0; i < 4; i++){
- _C64.colors[i] = roomptr[6 + i];
+ _V1.colors[i] = roomptr[6 + i];
}
- decodeC64Gfx(roomptr + READ_LE_UINT16(roomptr + 10), _C64.charMap, 2048);
- decodeC64Gfx(roomptr + READ_LE_UINT16(roomptr + 12), _C64.picMap, roomptr[4] * roomptr[5]);
- decodeC64Gfx(roomptr + READ_LE_UINT16(roomptr + 14), _C64.colorMap, roomptr[4] * roomptr[5]);
- decodeC64Gfx(roomptr + READ_LE_UINT16(roomptr + 16), _C64.maskMap, roomptr[4] * roomptr[5]);
+ decodeV1Gfx(roomptr + READ_LE_UINT16(roomptr + 10), _V1.charMap, 2048);
+ decodeV1Gfx(roomptr + READ_LE_UINT16(roomptr + 12), _V1.picMap, roomptr[4] * roomptr[5]);
+ decodeV1Gfx(roomptr + READ_LE_UINT16(roomptr + 14), _V1.colorMap, roomptr[4] * roomptr[5]);
+ decodeV1Gfx(roomptr + READ_LE_UINT16(roomptr + 16), _V1.maskMap, roomptr[4] * roomptr[5]);
// Read the mask data. The 16bit length value seems to always be 8 too big.
// See bug #1837375 for details on this.
const byte *maskPtr = roomptr + READ_LE_UINT16(roomptr + 18);
- decodeC64Gfx(maskPtr + 2, _C64.maskChar, READ_LE_UINT16(maskPtr) - 8);
+ decodeV1Gfx(maskPtr + 2, _V1.maskChar, READ_LE_UINT16(maskPtr) - 8);
_objectMode = true;
}
@@ -1135,7 +1136,7 @@ void ScummEngine::clearTextSurface() {
_townsScreen->fillLayerRect(1, 0, 0, _textSurface.w, _textSurface.h, 0);
#endif
- fill((byte*)_textSurface.pixels, _textSurface.pitch,
+ fill((byte *)_textSurface.pixels, _textSurface.pitch,
#ifndef DISABLE_TOWNS_DUAL_LAYER_MODE
_game.platform == Common::kPlatformFMTowns ? 0 :
#endif
@@ -1487,15 +1488,17 @@ void ScummEngine_v5::drawFlashlight() {
_flashlight.isDrawn = true;
}
-// V0 Maniac doesn't have a ScummVar for VAR_CURRENT_LIGHTS, and just uses
-// an internal variable. Emulate this to prevent overwriting script vars...
-// And V6 games do not use the "lights" at all. There, the whole screen is
-// always visible, and actors are always colored, so we fake the correct
-// light value for it.
+int ScummEngine_v0::getCurrentLights() const {
+ // V0 Maniac doesn't have a ScummVar for VAR_CURRENT_LIGHTS, and just uses
+ // an internal variable. Emulate this to prevent overwriting script vars...
+ // And V6 games do not use the "lights" at all. There, the whole screen is
+ // always visible, and actors are always colored, so we fake the correct
+ // light value for it.
+ return _currentLights;
+}
+
int ScummEngine::getCurrentLights() const {
- if (_game.id == GID_MANIAC && _game.version == 0)
- return _currentLights;
- else if (_game.version >= 6)
+ if (_game.version >= 6)
return LIGHTMODE_room_lights_on | LIGHTMODE_actor_use_colors;
else
return VAR(VAR_CURRENT_LIGHTS);
@@ -1538,7 +1541,7 @@ void GdiV1::prepareDrawBitmap(const byte *ptr, VirtScreen *vs,
const int x, const int y, const int width, const int height,
int stripnr, int numstrip) {
if (_objectMode) {
- decodeC64Gfx(ptr, _C64.objectMap, (width / 8) * (height / 8) * 3);
+ decodeV1Gfx(ptr, _V1.objectMap, (width / 8) * (height / 8) * 3);
}
}
@@ -1925,9 +1928,9 @@ bool GdiPCEngine::drawStrip(byte *dstPtr, VirtScreen *vs, int x, int y, const in
bool GdiV1::drawStrip(byte *dstPtr, VirtScreen *vs, int x, int y, const int width, const int height,
int stripnr, const byte *smap_ptr) {
if (_objectMode)
- drawStripC64Object(dstPtr, vs->pitch, stripnr, width, height);
+ drawStripV1Object(dstPtr, vs->pitch, stripnr, width, height);
else
- drawStripC64Background(dstPtr, vs->pitch, stripnr, height);
+ drawStripV1Background(dstPtr, vs->pitch, stripnr, height);
return false;
}
@@ -2068,7 +2071,7 @@ void GdiV1::decodeMask(int x, int y, const int width, const int height,
int stripnr, int numzbuf, const byte *zplane_list[9],
bool transpStrip, byte flag) {
byte *mask_ptr = getMaskBuffer(x, y, 1);
- drawStripC64Mask(mask_ptr, stripnr, width, height);
+ drawStripV1Mask(mask_ptr, stripnr, width, height);
}
void GdiV2::decodeMask(int x, int y, const int width, const int height,
@@ -2770,7 +2773,7 @@ void GdiNES::drawStripNESMask(byte *dst, int stripnr, int top, int height) const
void readOffsetTable(const byte *ptr, uint16 **table, int *count) {
int pos = 0;
*count = READ_LE_UINT16(ptr) / 2 + 1;
- *table = (uint16*)malloc(*count * sizeof(uint16));
+ *table = (uint16 *)malloc(*count * sizeof(uint16));
for (int i = 0; i < *count; i++) {
(*table)[i] = READ_LE_UINT16(ptr + pos) + pos + 2;
pos += 2;
@@ -2974,10 +2977,10 @@ void GdiPCEngine::decodePCEngineTileData(const byte *ptr) {
if (_distaff) {
free(_PCE.staffTiles);
- _PCE.staffTiles = (byte*)calloc(_PCE.numTiles * 8 * 8, sizeof(byte));
+ _PCE.staffTiles = (byte *)calloc(_PCE.numTiles * 8 * 8, sizeof(byte));
} else {
free(_PCE.roomTiles);
- _PCE.roomTiles = (byte*)calloc(_PCE.numTiles * 8 * 8, sizeof(byte));
+ _PCE.roomTiles = (byte *)calloc(_PCE.numTiles * 8 * 8, sizeof(byte));
}
for (int i = 0; i < _PCE.numTiles; ++i) {
@@ -3020,7 +3023,7 @@ void GdiPCEngine::decodePCEngineMaskData(const byte *ptr) {
readOffsetTable(ptr, &maskOffsets, &_PCE.numMasks);
free(_PCE.masks);
- _PCE.masks = (byte*)malloc(_PCE.numMasks * 8 * sizeof(byte));
+ _PCE.masks = (byte *)malloc(_PCE.numMasks * 8 * sizeof(byte));
for (int i = 0; i < _PCE.numMasks; ++i) {
mask = &_PCE.masks[i * 8];
@@ -3086,67 +3089,67 @@ void GdiPCEngine::drawStripPCEngineMask(byte *dst, int stripnr, int top, int hei
}
#endif
-void GdiV1::drawStripC64Background(byte *dst, int dstPitch, int stripnr, int height) {
+void GdiV1::drawStripV1Background(byte *dst, int dstPitch, int stripnr, int height) {
int charIdx;
height /= 8;
for (int y = 0; y < height; y++) {
- _C64.colors[3] = (_C64.colorMap[y + stripnr * height] & 7);
+ _V1.colors[3] = (_V1.colorMap[y + stripnr * height] & 7);
// Check for room color change in V1 zak
if (_roomPalette[0] == 255) {
- _C64.colors[2] = _roomPalette[2];
- _C64.colors[1] = _roomPalette[1];
+ _V1.colors[2] = _roomPalette[2];
+ _V1.colors[1] = _roomPalette[1];
}
- charIdx = _C64.picMap[y + stripnr * height] * 8;
+ charIdx = _V1.picMap[y + stripnr * height] * 8;
for (int i = 0; i < 8; i++) {
- byte c = _C64.charMap[charIdx + i];
- dst[0] = dst[1] = _C64.colors[(c >> 6) & 3];
- dst[2] = dst[3] = _C64.colors[(c >> 4) & 3];
- dst[4] = dst[5] = _C64.colors[(c >> 2) & 3];
- dst[6] = dst[7] = _C64.colors[(c >> 0) & 3];
+ byte c = _V1.charMap[charIdx + i];
+ dst[0] = dst[1] = _V1.colors[(c >> 6) & 3];
+ dst[2] = dst[3] = _V1.colors[(c >> 4) & 3];
+ dst[4] = dst[5] = _V1.colors[(c >> 2) & 3];
+ dst[6] = dst[7] = _V1.colors[(c >> 0) & 3];
dst += dstPitch;
}
}
}
-void GdiV1::drawStripC64Object(byte *dst, int dstPitch, int stripnr, int width, int height) {
+void GdiV1::drawStripV1Object(byte *dst, int dstPitch, int stripnr, int width, int height) {
int charIdx;
height /= 8;
width /= 8;
for (int y = 0; y < height; y++) {
- _C64.colors[3] = (_C64.objectMap[(y + height) * width + stripnr] & 7);
- charIdx = _C64.objectMap[y * width + stripnr] * 8;
+ _V1.colors[3] = (_V1.objectMap[(y + height) * width + stripnr] & 7);
+ charIdx = _V1.objectMap[y * width + stripnr] * 8;
for (int i = 0; i < 8; i++) {
- byte c = _C64.charMap[charIdx + i];
- dst[0] = dst[1] = _C64.colors[(c >> 6) & 3];
- dst[2] = dst[3] = _C64.colors[(c >> 4) & 3];
- dst[4] = dst[5] = _C64.colors[(c >> 2) & 3];
- dst[6] = dst[7] = _C64.colors[(c >> 0) & 3];
+ byte c = _V1.charMap[charIdx + i];
+ dst[0] = dst[1] = _V1.colors[(c >> 6) & 3];
+ dst[2] = dst[3] = _V1.colors[(c >> 4) & 3];
+ dst[4] = dst[5] = _V1.colors[(c >> 2) & 3];
+ dst[6] = dst[7] = _V1.colors[(c >> 0) & 3];
dst += dstPitch;
}
}
}
-void GdiV1::drawStripC64Mask(byte *dst, int stripnr, int width, int height) const {
+void GdiV1::drawStripV1Mask(byte *dst, int stripnr, int width, int height) const {
int maskIdx;
height /= 8;
width /= 8;
for (int y = 0; y < height; y++) {
if (_objectMode)
- maskIdx = _C64.objectMap[(y + 2 * height) * width + stripnr] * 8;
+ maskIdx = _V1.objectMap[(y + 2 * height) * width + stripnr] * 8;
else
- maskIdx = _C64.maskMap[y + stripnr * height] * 8;
+ maskIdx = _V1.maskMap[y + stripnr * height] * 8;
for (int i = 0; i < 8; i++) {
- byte c = _C64.maskChar[maskIdx + i];
+ byte c = _V1.maskChar[maskIdx + i];
- // V1/C64 masks are inverted compared to what ScummVM expects
+ // V1/V0 masks are inverted compared to what ScummVM expects
*dst = c ^ 0xFF;
dst += _numStrips;
}
}
}
-void GdiV1::decodeC64Gfx(const byte *src, byte *dst, int size) const {
+void GdiV1::decodeV1Gfx(const byte *src, byte *dst, int size) const {
int x, z;
byte color, run, common[4];
diff --git a/engines/scumm/gfx.h b/engines/scumm/gfx.h
index 4b44ddc376..0d81698c50 100644
--- a/engines/scumm/gfx.h
+++ b/engines/scumm/gfx.h
@@ -375,19 +375,19 @@ public:
class GdiV1 : public Gdi {
protected:
- /** Render settings which are specific to the C64 graphic decoders. */
+ /** Render settings which are specific to the v0/v1 graphic decoders. */
struct {
byte colors[4];
byte charMap[2048], objectMap[2048], picMap[4096], colorMap[4096];
byte maskMap[4096], maskChar[4096];
- } _C64;
+ } _V1;
protected:
- void decodeC64Gfx(const byte *src, byte *dst, int size) const;
+ void decodeV1Gfx(const byte *src, byte *dst, int size) const;
- void drawStripC64Object(byte *dst, int dstPitch, int stripnr, int width, int height);
- void drawStripC64Background(byte *dst, int dstPitch, int stripnr, int height);
- void drawStripC64Mask(byte *dst, int stripnr, int width, int height) const;
+ void drawStripV1Object(byte *dst, int dstPitch, int stripnr, int width, int height);
+ void drawStripV1Background(byte *dst, int dstPitch, int stripnr, int height);
+ void drawStripV1Mask(byte *dst, int stripnr, int width, int height) const;
virtual bool drawStrip(byte *dstPtr, VirtScreen *vs,
int x, int y, const int width, const int height,
diff --git a/engines/scumm/gfx_towns.cpp b/engines/scumm/gfx_towns.cpp
index 6a3f50a1af..8bffcab4a0 100644
--- a/engines/scumm/gfx_towns.cpp
+++ b/engines/scumm/gfx_towns.cpp
@@ -39,7 +39,7 @@ void ScummEngine::towns_drawStripToScreen(VirtScreen *vs, int dstX, int dstY, in
int m = _textSurfaceMultiplier;
uint8 *src1 = vs->getPixels(srcX, srcY);
- uint8 *src2 = (uint8*)_textSurface.getBasePtr(srcX * m, (srcY + vs->topline - _screenTop) * m);
+ uint8 *src2 = (uint8 *)_textSurface.getBasePtr(srcX * m, (srcY + vs->topline - _screenTop) * m);
uint8 *dst1 = _townsScreen->getLayerPixels(0, dstX, dstY);
uint8 *dst2 = _townsScreen->getLayerPixels(1, dstX * m, dstY * m);
@@ -52,7 +52,7 @@ void ScummEngine::towns_drawStripToScreen(VirtScreen *vs, int dstX, int dstY, in
for (int h = 0; h < height; ++h) {
if (_outputPixelFormat.bytesPerPixel == 2) {
for (int w = 0; w < width; ++w) {
- *(uint16*)dst1 = _16BitPalette[*src1++];
+ *(uint16 *)dst1 = _16BitPalette[*src1++];
dst1 += _outputPixelFormat.bytesPerPixel;
}
@@ -245,7 +245,7 @@ void TownsScreen::setupLayer(int layer, int width, int height, int numCol, void
l->numCol = numCol;
l->bpp = ((numCol - 1) & 0xff00) ? 2 : 1;
l->pitch = width * l->bpp;
- l->palette = (uint8*)pal;
+ l->palette = (uint8 *)pal;
if (l->palette && _pixelFormat.bytesPerPixel == 1)
warning("TownsScreen::setupLayer(): Layer palette usage requires 16 bit graphics setting.\nLayer palette will be ignored.");
@@ -304,7 +304,7 @@ void TownsScreen::fillLayerRect(int layer, int x, int y, int w, int h, int col)
for (int i = 0; i < h; ++i) {
if (l->bpp == 2) {
for (int ii = 0; ii < w; ++ii) {
- *(uint16*)pos = col;
+ *(uint16 *)pos = col;
pos += 2;
}
pos += (l->pitch - w * 2);
@@ -472,10 +472,10 @@ void TownsScreen::updateOutputBuffer() {
if (col || l->onBottom) {
if (l->numCol == 16)
col = (col >> 4) & (col & 0x0f);
- *(uint16*)dst = l->bltTmpPal[col];
+ *(uint16 *)dst = l->bltTmpPal[col];
}
} else {
- *(uint16*)dst = *(uint16*)src;
+ *(uint16 *)dst = *(uint16 *)src;
}
dst += 2;
}
diff --git a/engines/scumm/he/sound_he.cpp b/engines/scumm/he/sound_he.cpp
index 85e2a2f1dd..1007d2a7b0 100644
--- a/engines/scumm/he/sound_he.cpp
+++ b/engines/scumm/he/sound_he.cpp
@@ -652,7 +652,7 @@ void SoundHE::playHESound(int soundID, int heOffset, int heChannel, int heFlags)
* even addresses, so the use of (void *) in the
* following cast shuts the compiler from warning
* unnecessarily. */
- size = voxStream->readBuffer((int16*)(void *)sound, size * 2);
+ size = voxStream->readBuffer((int16 *)(void *)sound, size * 2);
size *= 2; // 16bits.
delete voxStream;
diff --git a/engines/scumm/he/wiz_he.cpp b/engines/scumm/he/wiz_he.cpp
index f67922c81c..47b4b8ad33 100644
--- a/engines/scumm/he/wiz_he.cpp
+++ b/engines/scumm/he/wiz_he.cpp
@@ -687,7 +687,7 @@ void Wiz::copyRawWizImage(uint8 *dst, const uint8 *src, int dstPitch, int dstTyp
}
#ifdef USE_RGB_COLOR
-template <int type>
+template<int type>
void Wiz::write16BitColor(uint8 *dstPtr, const uint8 *dataPtr, int dstType, const uint8 *xmapPtr) {
uint16 col = READ_LE_UINT16(dataPtr);
if (type == kWizXMap) {
@@ -701,7 +701,7 @@ void Wiz::write16BitColor(uint8 *dstPtr, const uint8 *dataPtr, int dstType, cons
}
}
-template <int type>
+template<int type>
void Wiz::decompress16BitWizImage(uint8 *dst, int dstPitch, int dstType, const uint8 *src, const Common::Rect &srcRect, int flags, const uint8 *xmapPtr) {
const uint8 *dataPtr, *dataPtrNext;
uint8 code;
@@ -804,7 +804,7 @@ void Wiz::decompress16BitWizImage(uint8 *dst, int dstPitch, int dstType, const u
}
#endif
-template <int type>
+template<int type>
void Wiz::write8BitColor(uint8 *dstPtr, const uint8 *dataPtr, int dstType, const uint8 *palPtr, const uint8 *xmapPtr, uint8 bitDepth) {
if (bitDepth == 2) {
if (type == kWizXMap) {
@@ -833,7 +833,7 @@ void Wiz::write8BitColor(uint8 *dstPtr, const uint8 *dataPtr, int dstType, const
}
}
-template <int type>
+template<int type>
void Wiz::decompressWizImage(uint8 *dst, int dstPitch, int dstType, const uint8 *src, const Common::Rect &srcRect, int flags, const uint8 *palPtr, const uint8 *xmapPtr, uint8 bitDepth) {
const uint8 *dataPtr, *dataPtrNext;
uint8 code, *dstPtr, *dstPtrNext;
@@ -942,7 +942,7 @@ template void Wiz::decompressWizImage<kWizXMap>(uint8 *dst, int dstPitch, int ds
template void Wiz::decompressWizImage<kWizRMap>(uint8 *dst, int dstPitch, int dstType, const uint8 *src, const Common::Rect &srcRect, int flags, const uint8 *palPtr, const uint8 *xmapPtr, uint8 bitDepth);
template void Wiz::decompressWizImage<kWizCopy>(uint8 *dst, int dstPitch, int dstType, const uint8 *src, const Common::Rect &srcRect, int flags, const uint8 *palPtr, const uint8 *xmapPtr, uint8 bitDepth);
-template <int type>
+template<int type>
void Wiz::decompressRawWizImage(uint8 *dst, int dstPitch, int dstType, const uint8 *src, int srcPitch, int w, int h, int transColor, const uint8 *palPtr, uint8 bitDepth) {
if (type == kWizRMap) {
assert(palPtr != 0);
diff --git a/engines/scumm/object.cpp b/engines/scumm/object.cpp
index da238dc517..399cd91324 100644
--- a/engines/scumm/object.cpp
+++ b/engines/scumm/object.cpp
@@ -178,10 +178,7 @@ void ScummEngine::clearOwnerOf(int obj) {
// Alternatively, scan the inventory to see if the object is in there...
for (i = 0; i < _numInventory; i++) {
if (_inventory[i] == obj) {
- if (_game.version == 0)
- assert(WIO_INVENTORY == whereIsObjectInventory(obj));
- else
- assert(WIO_INVENTORY == whereIsObject(obj));
+ assert(WIO_INVENTORY == whereIsObject(obj));
// Found the object! Nuke it from the inventory.
_res->nukeResource(rtInventory, i);
@@ -206,6 +203,9 @@ void ScummEngine::clearOwnerOf(int obj) {
}
bool ScummEngine::getClass(int obj, int cls) const {
+ if (_game.version == 0)
+ return false;
+
assertRange(0, obj, _numGlobalObjects - 1, "object");
cls &= 0x7F;
assertRange(1, cls, 32, "class");
@@ -233,6 +233,9 @@ bool ScummEngine::getClass(int obj, int cls) const {
}
void ScummEngine::putClass(int obj, int cls, bool set) {
+ if (_game.version == 0)
+ return;
+
assertRange(0, obj, _numGlobalObjects - 1, "object");
cls &= 0x7F;
assertRange(1, cls, 32, "class");
@@ -315,47 +318,38 @@ int ScummEngine::getObjectIndex(int object) const {
return -1;
for (i = (_numLocalObjects-1); i > 0; i--) {
- if (_game.version == 0 )
- if( _objs[i].flags != _v0ObjectFlag )
- continue;
-
if (_objs[i].obj_nr == object)
return i;
}
return -1;
}
-int ScummEngine::whereIsObjectInventory(int object) {
- int res = 0;
- _v0ObjectInInventory = true;
- res = whereIsObject(object);
- _v0ObjectInInventory = false;
-
- return res;
-}
-
int ScummEngine::whereIsObject(int object) const {
int i;
- if (object >= _numGlobalObjects)
+ // Note: in MM v0 bg objects are greater _numGlobalObjects
+ if (_game.version != 0 && object >= _numGlobalObjects)
return WIO_NOT_FOUND;
if (object < 1)
return WIO_NOT_FOUND;
- if ((_objectOwnerTable[object] != OF_OWNER_ROOM && _game.version != 0) || _v0ObjectInInventory) {
+ if ((_game.version != 0 || OBJECT_V0_TYPE(object) == 0) &&
+ _objectOwnerTable[object] != OF_OWNER_ROOM)
+ {
for (i = 0; i < _numInventory; i++)
if (_inventory[i] == object)
return WIO_INVENTORY;
return WIO_NOT_FOUND;
}
- for (i = (_numLocalObjects-1); i > 0; i--)
- if ((_objs[i].obj_nr == object && !_v0ObjectIndex) || (_v0ObjectIndex && i == object)) {
+ for (i = (_numLocalObjects-1); i > 0; i--) {
+ if (_objs[i].obj_nr == object) {
if (_objs[i].fl_object_index)
return WIO_FLOBJECT;
return WIO_ROOM;
}
+ }
return WIO_NOT_FOUND;
}
@@ -363,8 +357,8 @@ int ScummEngine::whereIsObject(int object) const {
int ScummEngine::getObjectOrActorXY(int object, int &x, int &y) {
Actor *act;
- if (object < _numActors) {
- act = derefActorSafe(object, "getObjectOrActorXY");
+ if (objIsActor(object)) {
+ act = derefActorSafe(objToActor(object), "getObjectOrActorXY");
if (act && act->isInCurrentRoom()) {
x = act->getRealPos().x;
y = act->getRealPos().y;
@@ -377,7 +371,7 @@ int ScummEngine::getObjectOrActorXY(int object, int &x, int &y) {
case WIO_NOT_FOUND:
return -1;
case WIO_INVENTORY:
- if (_objectOwnerTable[object] < _numActors) {
+ if (objIsActor(_objectOwnerTable[object])) {
act = derefActor(_objectOwnerTable[object], "getObjectOrActorXY(2)");
if (act && act->isInCurrentRoom()) {
x = act->getRealPos().x;
@@ -396,7 +390,7 @@ int ScummEngine::getObjectOrActorXY(int object, int &x, int &y) {
* Returns X, Y and direction in angles
*/
void ScummEngine::getObjectXYPos(int object, int &x, int &y, int &dir) {
- int idx = (_v0ObjectIndex) ? object : getObjectIndex(object);
+ int idx = getObjectIndex(object);
assert(idx >= 0);
ObjectData &od = _objs[idx];
int state;
@@ -439,8 +433,15 @@ void ScummEngine::getObjectXYPos(int object, int &x, int &y, int &dir) {
y = od.y_pos + (int16)READ_LE_UINT16(&imhd->old.hotspot[state].y);
}
} else if (_game.version <= 2) {
- x = od.walk_x >> V12_X_SHIFT;
- y = od.walk_y >> V12_Y_SHIFT;
+ if (od.actordir) {
+ x = od.walk_x;
+ y = od.walk_y;
+ } else {
+ x = od.x_pos + od.width / 2;
+ y = od.y_pos + od.height / 2;
+ }
+ x = x >> V12_X_SHIFT;
+ y = y >> V12_Y_SHIFT;
} else {
x = od.walk_x;
y = od.walk_y;
@@ -462,11 +463,11 @@ int ScummEngine::getObjActToObjActDist(int a, int b) {
Actor *acta = NULL;
Actor *actb = NULL;
- if (a < _numActors)
- acta = derefActorSafe(a, "getObjActToObjActDist");
+ if (objIsActor(a))
+ acta = derefActorSafe(objToActor(a), "getObjActToObjActDist");
- if (b < _numActors)
- actb = derefActorSafe(b, "getObjActToObjActDist(2)");
+ if (objIsActor(b))
+ actb = derefActorSafe(objToActor(b), "getObjActToObjActDist(2)");
if (acta && actb && acta->getRoom() == actb->getRoom() && acta->getRoom() && !acta->isInCurrentRoom())
return 0;
@@ -492,14 +493,6 @@ int ScummEngine::getObjActToObjActDist(int a, int b) {
return getDist(x, y, x2, y2);
}
-int ScummEngine_v0::findObjectIndex(int x, int y) {
- int objIdx;
- _v0ObjectIndex = true;
- objIdx = findObject(x, y);
- _v0ObjectIndex = false;
- return objIdx;
-}
-
int ScummEngine::findObject(int x, int y) {
int i, b;
byte a;
@@ -509,11 +502,9 @@ int ScummEngine::findObject(int x, int y) {
if ((_objs[i].obj_nr < 1) || getClass(_objs[i].obj_nr, kObjectClassUntouchable))
continue;
- if (_game.version == 0) {
- if (_objs[i].flags == 0 && _objs[i].state & kObjectStateUntouchable)
- continue;
- } else {
- if (_game.version <= 2 && _objs[i].state & kObjectStateUntouchable)
+ if ((_game.version == 0 && OBJECT_V0_TYPE(_objs[i].obj_nr) == kObjectV0TypeFG) ||
+ (_game.version > 0 && _game.version <= 2)) {
+ if (_objs[i].state & kObjectStateUntouchable)
continue;
}
@@ -529,15 +520,8 @@ int ScummEngine::findObject(int x, int y) {
}
#endif
if (_objs[i].x_pos <= x && _objs[i].width + _objs[i].x_pos > x &&
- _objs[i].y_pos <= y && _objs[i].height + _objs[i].y_pos > y) {
- // MMC64: Set the object search flag
- if (_game.version == 0)
- _v0ObjectFlag = _objs[i].flags;
- if (_game.version == 0 && _v0ObjectIndex)
- return i;
- else
- return _objs[i].obj_nr;
- }
+ _objs[i].y_pos <= y && _objs[i].height + _objs[i].y_pos > y)
+ return _objs[i].obj_nr;
break;
}
} while ((_objs[b].state & mask) == a);
@@ -824,7 +808,7 @@ void ScummEngine_v3old::resetRoomObjects() {
else
ptr = room + 29;
- // Default pointer of objects without image, in C64 verison of Maniac Mansion
+ // Default pointer of objects without image, in v0 version of Maniac Mansion
int defaultPtr = READ_LE_UINT16(ptr + 2 * _numObjectsInRoom);
for (i = 0; i < _numObjectsInRoom; i++) {
@@ -843,9 +827,6 @@ void ScummEngine_v3old::resetRoomObjects() {
if (_dumpScripts) {
char buf[32];
sprintf(buf, "roomobj-%d-", _roomResource);
- if (_game.version == 0)
- sprintf(buf + 11, "%d-", od->flags);
-
dumpResource(buf, od->obj_nr, room + od->OBCDoffset);
}
}
@@ -911,8 +892,7 @@ void ScummEngine_v0::resetRoomObject(ObjectData *od, const byte *room, const byt
const byte *ptr = room + od->OBCDoffset;
ptr -= 2;
- od->obj_nr = *(ptr + 6);
- od->flags = *(ptr + 7);
+ od->obj_nr = OBJECT_V0(*(ptr + 6), *(ptr + 7));
od->x_pos = *(ptr + 8) * 8;
od->y_pos = ((*(ptr + 9)) & 0x7F) * 8;
@@ -1072,8 +1052,8 @@ void ScummEngine::updateObjectStates() {
int i;
ObjectData *od = &_objs[1];
for (i = 1; i < _numLocalObjects; i++, od++) {
- // V0 MM, Room objects with Flag == 1 are objects with 'no-state' (room specific objects, non-pickup)
- if (_game.version == 0 && od->flags == 1)
+ // V0 MM, objects with type == 1 are room objects (room specific objects, non-pickup)
+ if (_game.version == 0 && OBJECT_V0_TYPE(od->obj_nr) == kObjectV0TypeBG)
continue;
if (od->obj_nr > 0)
@@ -1163,8 +1143,8 @@ const byte *ScummEngine::getObjOrActorName(int obj) {
byte *objptr;
int i;
- if (obj < _numActors && _game.version >= 1)
- return derefActor(obj, "getObjOrActorName")->getActorName();
+ if (objIsActor(obj))
+ return derefActor(objToActor(obj), "getObjOrActorName")->getActorName();
for (i = 0; i < _numNewNames; i++) {
if (_newNames[i] == obj) {
@@ -1173,7 +1153,7 @@ const byte *ScummEngine::getObjOrActorName(int obj) {
}
}
- objptr = getOBCDFromObject(obj);
+ objptr = getOBCDFromObject(obj, true);
if (objptr == NULL)
return NULL;
@@ -1200,7 +1180,7 @@ const byte *ScummEngine::getObjOrActorName(int obj) {
void ScummEngine::setObjectName(int obj) {
int i;
- if (obj < _numActors && _game.version != 0)
+ if (objIsActor(obj))
error("Can't set actor %d name with new-name-of", obj);
for (i = 0; i < _numNewNames; i++) {
@@ -1226,13 +1206,10 @@ void ScummEngine::setObjectName(int obj) {
uint32 ScummEngine::getOBCDOffs(int object) const {
int i;
- if ((_objectOwnerTable[object] != OF_OWNER_ROOM && (_game.version != 0)) || _v0ObjectInInventory)
+ if ((_game.version != 0 || OBJECT_V0_TYPE(object) == 0) &&
+ _objectOwnerTable[object] != OF_OWNER_ROOM)
return 0;
- // V0 MM Return by Index
- if (_v0ObjectIndex)
- return _objs[object].OBCDoffset;
-
for (i = (_numLocalObjects-1); i > 0; i--) {
if (_objs[i].obj_nr == object) {
if (_objs[i].fl_object_index != 0)
@@ -1243,21 +1220,22 @@ uint32 ScummEngine::getOBCDOffs(int object) const {
return 0;
}
-byte *ScummEngine::getOBCDFromObject(int obj) {
- bool useInventory = _v0ObjectInInventory;
+byte *ScummEngine::getOBCDFromObject(int obj, bool v0CheckInventory) {
int i;
byte *ptr;
- _v0ObjectInInventory = false;
-
- if ((_objectOwnerTable[obj] != OF_OWNER_ROOM && (_game.version != 0)) || useInventory) {
+ if ((_game.version != 0 || OBJECT_V0_TYPE(obj) == 0) &&
+ _objectOwnerTable[obj] != OF_OWNER_ROOM)
+ {
+ if (_game.version == 0 && !v0CheckInventory)
+ return 0;
for (i = 0; i < _numInventory; i++) {
if (_inventory[i] == obj)
return getResourceAddress(rtInventory, i);
}
} else {
for (i = (_numLocalObjects-1); i > 0; --i) {
- if ((_objs[i].obj_nr == obj && !_v0ObjectIndex) || (_v0ObjectIndex && i == obj)) {
+ if (_objs[i].obj_nr == obj) {
if (_objs[i].fl_object_index) {
assert(_objs[i].OBCDoffset == 8);
ptr = getResourceAddress(rtFlObject, _objs[i].fl_object_index);
@@ -1510,11 +1488,37 @@ void ScummEngine::findObjectInRoom(FindObjectInRoom *fo, byte findWhat, uint id,
}
}
+bool ScummEngine_v0::objIsActor(int obj) {
+ // object IDs < _numActors are used in v0 for objects too (e.g. hamster)
+ return OBJECT_V0_TYPE(obj) == kObjectV0TypeActor;
+}
+
+int ScummEngine_v0::objToActor(int obj) {
+ return OBJECT_V0_ID(obj);
+}
+
+int ScummEngine_v0::actorToObj(int actor) {
+ return OBJECT_V0(actor, kObjectV0TypeActor);
+}
+
+bool ScummEngine::objIsActor(int obj) {
+ return obj < _numActors;
+}
+
+int ScummEngine::objToActor(int obj) {
+ return obj;
+}
+
+int ScummEngine::actorToObj(int actor) {
+ return actor;
+}
+
int ScummEngine::getObjX(int obj) {
- if (obj < _numActors) {
- if (obj < 1)
- return 0; /* fix for indy4's map */
- return derefActor(obj, "getObjX")->getRealPos().x;
+ if (obj < 1)
+ return 0; /* fix for indy4's map */
+
+ if (objIsActor(obj)) {
+ return derefActor(objToActor(obj), "getObjX")->getRealPos().x;
} else {
if (whereIsObject(obj) == WIO_NOT_FOUND)
return -1;
@@ -1525,10 +1529,11 @@ int ScummEngine::getObjX(int obj) {
}
int ScummEngine::getObjY(int obj) {
- if (obj < _numActors) {
- if (obj < 1)
- return 0; /* fix for indy4's map */
- return derefActor(obj, "getObjY")->getRealPos().y;
+ if (obj < 1)
+ return 0; /* fix for indy4's map */
+
+ if (objIsActor(obj)) {
+ return derefActor(objToActor(obj), "getObjY")->getRealPos().y;
} else {
if (whereIsObject(obj) == WIO_NOT_FOUND)
return -1;
@@ -1544,8 +1549,8 @@ int ScummEngine::getObjOldDir(int obj) {
int ScummEngine::getObjNewDir(int obj) {
int dir;
- if (obj < _numActors) {
- dir = derefActor(obj, "getObjNewDir")->getFacing();
+ if (objIsActor(obj)) {
+ dir = derefActor(objToActor(obj), "getObjNewDir")->getFacing();
} else {
int x, y;
getObjectXYPos(obj, x, y, dir);
diff --git a/engines/scumm/object.h b/engines/scumm/object.h
index cdf8b09e6f..8212075e43 100644
--- a/engines/scumm/object.h
+++ b/engines/scumm/object.h
@@ -24,6 +24,26 @@
namespace Scumm {
+static inline int OBJECT_V0(int id, byte type) {
+ assert(id < 256);
+ return (type << 8 | id);
+}
+#define OBJECT_V0_ID(obj) (obj & 0xFF)
+#define OBJECT_V0_TYPE(obj) ((obj >> 8) & 0xFF)
+
+enum ObjectV0Type {
+ kObjectV0TypeFG = 0, // foreground object
+ // - with owner/state, might (but has not to) be pickupable
+ // -> with entry in _objectOwner/StateTable
+ // -> all objects in _inventory have this type
+ // - image can be exchanged (background overlay)
+ kObjectV0TypeBG = 1, // background object
+ // - without owner/state, not pickupable (room only)
+ // -> without entry in _objectOwner/StateTable
+ // - image cannot be exchanged (part of background image)
+ kObjectV0TypeActor = 2 // object is an actor
+};
+
enum ObjectClass {
kObjectClassNeverClip = 20,
kObjectClassAlwaysClip = 21,
diff --git a/engines/scumm/player_apple2.h b/engines/scumm/player_apple2.h
index 4cbd24b81d..b4a7d409fb 100644
--- a/engines/scumm/player_apple2.h
+++ b/engines/scumm/player_apple2.h
@@ -209,7 +209,7 @@ public:
}
uint32 readSamples(void *buffer, int numSamples) {
- return _buffer.read((byte*)buffer, numSamples * 2) / 2;
+ return _buffer.read((byte *)buffer, numSamples * 2) / 2;
}
private:
@@ -247,7 +247,6 @@ public:
_sampleRate = rate;
_sampleConverter.setSampleRate(rate);
}
- void startMusic(int songResIndex);
virtual void startSound(int sound);
virtual void stopSound(int sound);
virtual void stopAllSounds();
diff --git a/engines/scumm/player_nes.cpp b/engines/scumm/player_nes.cpp
index 3f8bcef8b7..a6ffc9ed86 100644
--- a/engines/scumm/player_nes.cpp
+++ b/engines/scumm/player_nes.cpp
@@ -507,7 +507,7 @@ void APU::Reset () {
Frame.Cycles = 1;
}
-template <class T>
+template<class T>
int step(T &obj, int sampcycles, uint frame_Cycles, int frame_Num) {
int samppos = 0;
while (sampcycles) {
diff --git a/engines/scumm/player_pce.cpp b/engines/scumm/player_pce.cpp
index 786971c683..8d886ee008 100644
--- a/engines/scumm/player_pce.cpp
+++ b/engines/scumm/player_pce.cpp
@@ -269,13 +269,13 @@ void PSG_HuC6280::init() {
reset();
// Make waveform frequency table
- for(i = 0; i < 4096; i++) {
+ for (i = 0; i < 4096; i++) {
step = ((_clock / _rate) * 4096) / (i+1);
_waveFreqTable[(1 + i) & 0xFFF] = (uint32)step;
}
// Make noise frequency table
- for(i = 0; i < 32; i++) {
+ for (i = 0; i < 32; i++) {
step = ((_clock / _rate) * 32) / (i+1);
_noiseFreqTable[i] = (uint32)step;
}
@@ -283,7 +283,7 @@ void PSG_HuC6280::init() {
// Make volume table
// PSG_HuC6280 has 48dB volume range spread over 32 steps
step = 48.0 / 32.0;
- for(i = 0; i < 31; i++) {
+ for (i = 0; i < 31; i++) {
_volumeTable[i] = (uint16)level;
level /= pow(10.0, step / 20.0);
}
@@ -323,7 +323,7 @@ void PSG_HuC6280::write(int offset, byte data) {
case 0x04: // Channel control (key-on, DDA mode, volume)
// 1-to-0 transition of DDA bit resets waveform index
- if((chan->control & 0x40) && ((data & 0x40) == 0)) {
+ if ((chan->control & 0x40) && ((data & 0x40) == 0)) {
chan->index = 0;
}
chan->control = data;
@@ -383,9 +383,9 @@ void PSG_HuC6280::update(int16* samples, int sampleCnt) {
// Clear buffer
memset(samples, 0, 2 * sampleCnt * sizeof(int16));
- for(ch = 0; ch < 6; ch++) {
+ for (ch = 0; ch < 6; ch++) {
// Only look at enabled channels
- if(_channel[ch].control & 0x80) {
+ if (_channel[ch].control & 0x80) {
int lal = (_channel[ch].balance >> 4) & 0x0F;
int ral = (_channel[ch].balance >> 0) & 0x0F;
int al = _channel[ch].control & 0x1F;
@@ -395,25 +395,25 @@ void PSG_HuC6280::update(int16* samples, int sampleCnt) {
// Calculate volume just as the patent says
vll = (0x1F - lal) + (0x1F - al) + (0x1F - lmal);
- if(vll > 0x1F) vll = 0x1F;
+ if (vll > 0x1F) vll = 0x1F;
vlr = (0x1F - ral) + (0x1F - al) + (0x1F - rmal);
- if(vlr > 0x1F) vlr = 0x1F;
+ if (vlr > 0x1F) vlr = 0x1F;
vll = _volumeTable[vll];
vlr = _volumeTable[vlr];
// Check channel mode
- if(_channel[ch].control & 0x40) {
+ if (_channel[ch].control & 0x40) {
/* DDA mode */
- for(i = 0; i < sampleCnt; i++) {
+ for (i = 0; i < sampleCnt; i++) {
samples[2*i] += (int16)(vll * (_channel[ch].dda - 16));
samples[2*i + 1] += (int16)(vlr * (_channel[ch].dda - 16));
}
} else {
/* Waveform mode */
uint32 step = _waveFreqTable[_channel[ch].frequency];
- for(i = 0; i < sampleCnt; i += 1) {
+ for (i = 0; i < sampleCnt; i += 1) {
int offset;
int16 data;
offset = (_channel[ch].counter >> 12) & 0x1F;
diff --git a/engines/scumm/player_pce.h b/engines/scumm/player_pce.h
index eb6afd892a..427fb1ace6 100644
--- a/engines/scumm/player_pce.h
+++ b/engines/scumm/player_pce.h
@@ -76,7 +76,6 @@ public:
virtual ~Player_PCE();
virtual void setMusicVolume(int vol) { _maxvol = vol; }
- void startMusic(int songResIndex);
virtual void startSound(int sound);
virtual void stopSound(int sound);
virtual void stopAllSounds();
diff --git a/engines/scumm/player_sid.cpp b/engines/scumm/player_sid.cpp
index f0f60a3924..7a609364e5 100644
--- a/engines/scumm/player_sid.cpp
+++ b/engines/scumm/player_sid.cpp
@@ -683,7 +683,7 @@ void Player_SID::stopSound_intern(int soundResID) { // $5093
releaseResource(soundResID);
}
-void Player_SID::stopAllSounds_intern() { // $4CAA
+void Player_SID::stopMusic_intern() { // $4CAA
statusBits1B = 0;
isMusicPlaying = false;
@@ -1293,7 +1293,7 @@ int Player_SID::readBuffer(int16 *buffer, const int numSamples) {
_cpuCyclesLeft = timingProps[_videoSystem].cyclesPerFrame;
}
// fetch samples
- int sampleCount = _sid->updateClock(_cpuCyclesLeft, (short*)buffer, samplesLeft);
+ int sampleCount = _sid->updateClock(_cpuCyclesLeft, (short *)buffer, samplesLeft);
samplesLeft -= sampleCount;
buffer += sampleCount;
}
@@ -1352,7 +1352,7 @@ void Player_SID::stopSound(int nr) {
void Player_SID::stopAllSounds() {
Common::StackLock lock(_mutex);
- stopAllSounds_intern();
+ resetPlayerState();
}
int Player_SID::getSoundStatus(int nr) const {
diff --git a/engines/scumm/player_sid.h b/engines/scumm/player_sid.h
index baeb7bbef0..12e3573575 100644
--- a/engines/scumm/player_sid.h
+++ b/engines/scumm/player_sid.h
@@ -57,7 +57,6 @@ public:
virtual ~Player_SID();
virtual void setMusicVolume(int vol) { _maxvol = vol; }
- void startMusic(int songResIndex);
virtual void startSound(int sound);
virtual void stopSound(int sound);
virtual void stopAllSounds();
@@ -95,7 +94,7 @@ private:
void initMusic(int songResIndex); // $7de6
int initSound(int soundResID); // $4D0A
void stopSound_intern(int soundResID); // $5093
- void stopAllSounds_intern(); // $4CAA
+ void stopMusic_intern(); // $4CAA
void resetSID(); // $48D8
void update(); // $481B
diff --git a/engines/scumm/player_v1.cpp b/engines/scumm/player_v1.cpp
index 8afede8c5a..8e784e9866 100644
--- a/engines/scumm/player_v1.cpp
+++ b/engines/scumm/player_v1.cpp
@@ -351,8 +351,8 @@ parse_again:
*_value_ptr_2 = _start_2;
}
debug(6, "chunk 1: %lu: %d step %d for %d, %lu: %d step %d for %d",
- (long)(_value_ptr - (uint*)_channels), _start, _delta, _time_left,
- (long)(_value_ptr_2 - (uint*)_channels), _start_2, _delta_2, _time_left_2);
+ (long)(_value_ptr - (uint *)_channels), _start, _delta, _time_left,
+ (long)(_value_ptr_2 - (uint *)_channels), _start_2, _delta_2, _time_left_2);
break;
case 2:
diff --git a/engines/scumm/resource.cpp b/engines/scumm/resource.cpp
index f445a44ded..b2093e9c1a 100644
--- a/engines/scumm/resource.cpp
+++ b/engines/scumm/resource.cpp
@@ -232,7 +232,7 @@ void ScummEngine::askForDisk(const char *filename, int disknum) {
#endif
} else {
sprintf(buf, "Cannot find file: '%s'", filename);
- InfoDialog dialog(this, (char*)buf);
+ InfoDialog dialog(this, (char *)buf);
runDialog(dialog);
error("Cannot find file: '%s'", filename);
}
@@ -350,7 +350,7 @@ void ScummEngine_v7::readIndexBlock(uint32 blocktype, uint32 itemsize) {
switch (blocktype) {
case MKTAG('A','N','A','M'): // Used by: The Dig, FT
num = _fileHandle->readUint16LE();
- ptr = (char*)malloc(num * 9);
+ ptr = (char *)malloc(num * 9);
_fileHandle->read(ptr, num * 9);
_imuseDigital->setAudioNames(num, ptr);
break;
diff --git a/engines/scumm/room.cpp b/engines/scumm/room.cpp
index 63cbef8944..9ee8fb93a9 100644
--- a/engines/scumm/room.cpp
+++ b/engines/scumm/room.cpp
@@ -747,7 +747,7 @@ void ScummEngine_v3old::resetRoomSubBlocks() {
}
ptr = roomptr + *(roomptr + 0x15);
- size = numOfBoxes * SIZEOF_BOX_C64 + 1;
+ size = numOfBoxes * SIZEOF_BOX_V0 + 1;
_res->createResource(rtMatrix, 2, size + 1);
getResourceAddress(rtMatrix, 2)[0] = numOfBoxes;
diff --git a/engines/scumm/saveload.cpp b/engines/scumm/saveload.cpp
index 38dbd8270a..beac077fd1 100644
--- a/engines/scumm/saveload.cpp
+++ b/engines/scumm/saveload.cpp
@@ -875,21 +875,21 @@ void ScummEngine::saveOrLoad(Serializer *s) {
// vm.localvar grew from 25 to 40 script entries and then from
// 16 to 32 bit variables (but that wasn't reflect here)... and
// THEN from 16 to 25 variables.
- MKARRAY2_OLD(ScummEngine, vm.localvar[0][0], sleUint16, 17, 25, (byte*)vm.localvar[1] - (byte*)vm.localvar[0], VER(8), VER(8)),
- MKARRAY2_OLD(ScummEngine, vm.localvar[0][0], sleUint16, 17, 40, (byte*)vm.localvar[1] - (byte*)vm.localvar[0], VER(9), VER(14)),
+ MKARRAY2_OLD(ScummEngine, vm.localvar[0][0], sleUint16, 17, 25, (byte *)vm.localvar[1] - (byte *)vm.localvar[0], VER(8), VER(8)),
+ MKARRAY2_OLD(ScummEngine, vm.localvar[0][0], sleUint16, 17, 40, (byte *)vm.localvar[1] - (byte *)vm.localvar[0], VER(9), VER(14)),
// We used to save 25 * 40 = 1000 blocks; but actually, each 'row consisted of 26 entry,
// i.e. 26 * 40 = 1040. Thus the last 40 blocks of localvar where not saved at all. To be
// able to load this screwed format, we use a trick: We load 26 * 38 = 988 blocks.
// Then, we mark the followin 12 blocks (24 bytes) as obsolete.
- MKARRAY2_OLD(ScummEngine, vm.localvar[0][0], sleUint16, 26, 38, (byte*)vm.localvar[1] - (byte*)vm.localvar[0], VER(15), VER(17)),
+ MKARRAY2_OLD(ScummEngine, vm.localvar[0][0], sleUint16, 26, 38, (byte *)vm.localvar[1] - (byte *)vm.localvar[0], VER(15), VER(17)),
MK_OBSOLETE_ARRAY(ScummEngine, vm.localvar[39][0], sleUint16, 12, VER(15), VER(17)),
// This was the first proper multi dimensional version of the localvars, with 32 bit values
- MKARRAY2_OLD(ScummEngine, vm.localvar[0][0], sleUint32, 26, 40, (byte*)vm.localvar[1] - (byte*)vm.localvar[0], VER(18), VER(19)),
+ MKARRAY2_OLD(ScummEngine, vm.localvar[0][0], sleUint32, 26, 40, (byte *)vm.localvar[1] - (byte *)vm.localvar[0], VER(18), VER(19)),
// Then we doubled the script slots again, from 40 to 80
- MKARRAY2(ScummEngine, vm.localvar[0][0], sleUint32, 26, NUM_SCRIPT_SLOT, (byte*)vm.localvar[1] - (byte*)vm.localvar[0], VER(20)),
+ MKARRAY2(ScummEngine, vm.localvar[0][0], sleUint32, 26, NUM_SCRIPT_SLOT, (byte *)vm.localvar[1] - (byte *)vm.localvar[0], VER(20)),
MKARRAY(ScummEngine, _resourceMapper[0], sleByte, 128, VER(8)),
@@ -1205,12 +1205,19 @@ void ScummEngine::saveOrLoad(Serializer *s) {
// Save/load local objects
//
s->saveLoadArrayOf(_objs, _numLocalObjects, sizeof(_objs[0]), objectEntries);
- if (s->isLoading() && s->getVersion() < VER(13)) {
- // Since roughly v13 of the save games, the objs storage has changed a bit
- for (i = _numObjectsInRoom; i < _numLocalObjects; i++) {
- _objs[i].obj_nr = 0;
+ if (s->isLoading()) {
+ if (s->getVersion() < VER(13)) {
+ // Since roughly v13 of the save games, the objs storage has changed a bit
+ for (i = _numObjectsInRoom; i < _numLocalObjects; i++)
+ _objs[i].obj_nr = 0;
+ } else if (_game.version == 0 && s->getVersion() < VER(91)) {
+ for (i = 0; i < _numLocalObjects; i++) {
+ // Merge object id and type (previously stored in flags)
+ if (_objs[i].obj_nr != 0 && OBJECT_V0_TYPE(_objs[i].obj_nr) == 0 && _objs[i].flags != 0)
+ _objs[i].obj_nr = OBJECT_V0(_objs[i].obj_nr, _objs[i].flags);
+ _objs[i].flags = 0;
+ }
}
-
}
@@ -1497,6 +1504,14 @@ void ScummEngine_v0::saveOrLoad(Serializer *s) {
const SaveLoadEntry v0Entrys[] = {
MKLINE(ScummEngine_v0, _currentMode, sleByte, VER(78)),
MKLINE(ScummEngine_v0, _currentLights, sleByte, VER(78)),
+ MKLINE(ScummEngine_v0, _activeVerb, sleByte, VER(92)),
+ MKLINE(ScummEngine_v0, _activeObject, sleUint16, VER(92)),
+ MKLINE(ScummEngine_v0, _activeObject2, sleUint16, VER(92)),
+ MKLINE(ScummEngine_v0, _cmdVerb, sleByte, VER(92)),
+ MKLINE(ScummEngine_v0, _cmdObject, sleUint16, VER(92)),
+ MKLINE(ScummEngine_v0, _cmdObject2, sleUint16, VER(92)),
+ MKLINE(ScummEngine_v0, _walkToObject, sleUint16, VER(92)),
+ MKLINE(ScummEngine_v0, _walkToObjectState, sleByte, VER(92)),
MKEND()
};
s->saveLoadEntries(this, v0Entrys);
@@ -1523,7 +1538,7 @@ void ScummEngine_v5::saveOrLoad(Serializer *s) {
ScummEngine::saveOrLoad(s);
const SaveLoadEntry cursorEntries[] = {
- MKARRAY2(ScummEngine_v5, _cursorImages[0][0], sleUint16, 16, 4, (byte*)_cursorImages[1] - (byte*)_cursorImages[0], VER(44)),
+ MKARRAY2(ScummEngine_v5, _cursorImages[0][0], sleUint16, 16, 4, (byte *)_cursorImages[1] - (byte *)_cursorImages[0], VER(44)),
MKARRAY(ScummEngine_v5, _cursorHotspots[0], sleByte, 8, VER(44)),
MKEND()
};
diff --git a/engines/scumm/saveload.h b/engines/scumm/saveload.h
index 064bdf1406..d5f7ea526e 100644
--- a/engines/scumm/saveload.h
+++ b/engines/scumm/saveload.h
@@ -47,7 +47,7 @@ namespace Scumm {
* only saves/loads those which are valid for the version of the savegame
* which is being loaded/saved currently.
*/
-#define CURRENT_VER 88
+#define CURRENT_VER 92
/**
* An auxillary macro, used to specify savegame versions. We use this instead
@@ -74,13 +74,13 @@ namespace Scumm {
* what POD means refer to <http://en.wikipedia.org/wiki/Plain_Old_Data_Structures> or
* to <http://www.informit.com/guides/content.asp?g=cplusplus&seqNum=32&rl=1>)
*/
-#define OFFS(type,item) (((ptrdiff_t)(&((type*)42)->type::item))-42)
+#define OFFS(type,item) (((ptrdiff_t)(&((type *)42)->type::item))-42)
/**
* Similar to the OFFS macro, this macro computes the size (in bytes) of a
* member of a given struct/class type.
*/
-#define SIZE(type,item) sizeof(((type*)42)->type::item)
+#define SIZE(type,item) sizeof(((type *)42)->type::item)
// Any item that is still in use automatically gets a maxVersion equal to CURRENT_VER
#define MKLINE(type,item,saveas,minVer) {OFFS(type,item),saveas,SIZE(type,item),minVer,CURRENT_VER}
diff --git a/engines/scumm/script.cpp b/engines/scumm/script.cpp
index cfc4b3c419..39420ee974 100644
--- a/engines/scumm/script.cpp
+++ b/engines/scumm/script.cpp
@@ -28,7 +28,9 @@
#include "scumm/object.h"
#include "scumm/resource.h"
#include "scumm/util.h"
+#include "scumm/scumm_v0.h"
#include "scumm/scumm_v2.h"
+#include "scumm/sound.h"
#include "scumm/verbs.h"
namespace Scumm {
@@ -130,8 +132,6 @@ void ScummEngine::runObjectScript(int object, int entry, bool freezeResistant, b
initializeLocals(slot, vars);
- // V0 Ensure we don't try and access objects via index inside the script
- _v0ObjectIndex = false;
runScriptNested(slot);
}
@@ -195,9 +195,10 @@ int ScummEngine::getVerbEntrypoint(int obj, int entry) {
return verboffs + 8 + READ_LE_UINT32(ptr + 1);
} else if (_game.version <= 2) {
do {
+ const int kFallbackEntry = (_game.version == 0 ? 0x0F : 0xFF);
if (!*verbptr)
return 0;
- if (*verbptr == entry || *verbptr == 0xFF)
+ if (*verbptr == entry || *verbptr == kFallbackEntry)
break;
verbptr += 2;
} while (1);
@@ -935,6 +936,17 @@ void ScummEngine::runExitScript() {
}
if (VAR_EXIT_SCRIPT2 != 0xFF && VAR(VAR_EXIT_SCRIPT2))
runScript(VAR(VAR_EXIT_SCRIPT2), 0, 0, 0);
+
+#ifdef ENABLE_SCUMM_7_8
+ // WORKAROUND: The spider lair (room 44) will optionally play the sound
+ // of trickling water (sound 215), but it never stops it. The same sound
+ // effect is also used in room 33, so let's do the same fade out that it
+ // does in that room's exit script.
+ if (_game.id == GID_DIG && _currentRoom == 44) {
+ int scriptCmds[] = { 14, 215, 0x600, 0, 30, 0, 0, 0 };
+ _sound->soundKludge(scriptCmds, ARRAYSIZE(scriptCmds));
+ }
+#endif
}
void ScummEngine::runEntryScript() {
@@ -988,7 +1000,7 @@ void ScummEngine::killScriptsAndResources() {
for (i = 0; i < _numNewNames; i++) {
const int obj = _newNames[i];
if (obj) {
- const int owner = getOwner(obj);
+ const int owner = getOwner((_game.version != 0 ? obj : OBJECT_V0_ID(obj)));
// We can delete custom name resources if either the object is
// no longer in use (i.e. not owned by anyone anymore); or if
// it is an object which is owned by a room.
@@ -1118,6 +1130,183 @@ void ScummEngine::checkAndRunSentenceScript() {
runScript(sentenceScript, 0, 0, localParamList);
}
+void ScummEngine_v0::walkToActorOrObject(int object) {
+ int x, y, dir;
+ Actor_v0 *a = (Actor_v0 *)derefActor(VAR(VAR_EGO), "walkToObject");
+
+ _walkToObject = object;
+ _walkToObjectState = kWalkToObjectStateWalk;
+
+ if (OBJECT_V0_TYPE(object) == kObjectV0TypeActor) {
+ walkActorToActor(VAR(VAR_EGO), OBJECT_V0_ID(object), 4);
+ x = a->getRealPos().x;
+ y = a->getRealPos().y;
+ } else {
+ walkActorToObject(VAR(VAR_EGO), object);
+ getObjectXYPos(object, x, y, dir);
+ }
+
+ VAR(6) = x;
+ VAR(7) = y;
+
+ // actor must not move if frozen
+ if (a->_miscflags & kActorMiscFlagFreeze)
+ a->stopActorMoving();
+}
+
+bool ScummEngine_v0::checkPendingWalkAction() {
+ // before a sentence script is executed, it might be necessary to walk to
+ // and pickup objects before. Check if such an action is pending and handle
+ // it if available.
+ if (_walkToObjectState == kWalkToObjectStateDone)
+ return false;
+
+ int actor = VAR(VAR_EGO);
+ Actor_v0 *a = (Actor_v0 *)derefActor(actor, "checkPendingWalkAction");
+
+ // wait until walking or turning action is finished
+ if (a->_moving)
+ return true;
+
+ // after walking and turning finally execute the script
+ if (_walkToObjectState == kWalkToObjectStateTurn) {
+ runSentenceScript();
+ // change actor facing
+ } else {
+ int x, y, distX, distY;
+ if (objIsActor(_walkToObject)) {
+ Actor *b = derefActor(objToActor(_walkToObject), "checkPendingWalkAction(2)");
+ x = b->getRealPos().x;
+ y = b->getRealPos().y;
+ if (x < a->getRealPos().x)
+ x += 4;
+ else
+ x -= 4;
+ } else {
+ getObjectXYPos(_walkToObject, x, y);
+ }
+ AdjustBoxResult abr = a->adjustXYToBeInBox(x, y);
+ distX = ABS(a->getRealPos().x - abr.x);
+ distY = ABS(a->getRealPos().y - abr.y);
+
+ if (distX <= 4 && distY <= 8) {
+ if (objIsActor(_walkToObject)) { // walk to actor finished
+ // make actors turn to each other
+ a->faceToObject(_walkToObject);
+ int otherActor = objToActor(_walkToObject);
+ // ignore the plant
+ if (otherActor != 19) {
+ Actor *b = derefActor(otherActor, "checkPendingWalkAction(3)");
+ b->faceToObject(actorToObj(actor));
+ }
+ } else { // walk to object finished
+ int tmpX, tmpY, dir;
+ getObjectXYPos(_walkToObject, tmpX, tmpY, dir);
+ a->turnToDirection(dir);
+ }
+ _walkToObjectState = kWalkToObjectStateTurn;
+ return true;
+ }
+ }
+
+ _walkToObjectState = kWalkToObjectStateDone;
+ return false;
+}
+
+void ScummEngine_v0::checkAndRunSentenceScript() {
+ if (checkPendingWalkAction())
+ return;
+
+ if (!_sentenceNum || _sentence[_sentenceNum - 1].freezeCount)
+ return;
+
+ SentenceTab &st = _sentence[_sentenceNum - 1];
+
+ if (st.preposition && st.objectB == st.objectA) {
+ _sentenceNum--;
+ return;
+ }
+
+ _currentScript = 0xFF;
+
+ assert(st.objectA);
+
+ // If two objects are involved, at least one must be in the actors inventory
+ if (st.objectB &&
+ (OBJECT_V0_TYPE(st.objectA) != kObjectV0TypeFG || _objectOwnerTable[st.objectA] != VAR(VAR_EGO)) &&
+ (OBJECT_V0_TYPE(st.objectB) != kObjectV0TypeFG || _objectOwnerTable[st.objectB] != VAR(VAR_EGO)))
+ {
+ if (getVerbEntrypoint(st.objectA, kVerbPickUp))
+ doSentence(kVerbPickUp, st.objectA, 0);
+ else if (getVerbEntrypoint(st.objectB, kVerbPickUp))
+ doSentence(kVerbPickUp, st.objectB, 0);
+ else
+ _sentenceNum--;
+ return;
+ }
+
+ _cmdVerb = st.verb;
+ _cmdObject = st.objectA;
+ _cmdObject2 = st.objectB;
+ _sentenceNum--;
+
+ // abort sentence execution if the number of nested scripts is too high.
+ // This might happen for instance if the sentence command depends on an
+ // object that the actor has to pick-up in a nested doSentence() call.
+ // If the actor is not able to pick-up the object (e.g. because it is not
+ // reachable or pickupable) a nested pick-up command is triggered again
+ // and again, so the actual sentence command will never be executed.
+ // In this case the sentence command has to be aborted.
+ _sentenceNestedCount++;
+ if (_sentenceNestedCount > 6) {
+ _sentenceNestedCount = 0;
+ _sentenceNum = 0;
+ return;
+ }
+
+ if (whereIsObject(st.objectA) != WIO_INVENTORY) {
+ if (_currentMode != kModeKeypad) {
+ walkToActorOrObject(st.objectA);
+ return;
+ }
+ } else if (st.objectB && whereIsObject(st.objectB) != WIO_INVENTORY) {
+ walkToActorOrObject(st.objectB);
+ return;
+ }
+
+ runSentenceScript();
+ if (_currentMode == kModeKeypad) {
+ _walkToObjectState = kWalkToObjectStateDone;
+ }
+}
+
+void ScummEngine_v0::runSentenceScript() {
+ _redrawSentenceLine = true;
+
+ if (getVerbEntrypoint(_cmdObject, _cmdVerb) != 0) {
+ // do not read in the dark
+ if (!(_cmdVerb == kVerbRead && _currentLights == 0)) {
+ VAR(VAR_ACTIVE_OBJECT2) = OBJECT_V0_ID(_cmdObject2);
+ runObjectScript(_cmdObject, _cmdVerb, false, false, NULL);
+ return;
+ }
+ } else {
+ if (_cmdVerb == kVerbGive) {
+ // no "give to"-script: give to other kid or ignore
+ int actor = OBJECT_V0_ID(_cmdObject2);
+ if (actor < 8)
+ setOwnerOf(_cmdObject, actor);
+ return;
+ }
+ }
+
+ if (_cmdVerb != kVerbWalkTo) {
+ // perform verb's fallback action
+ VAR(VAR_ACTIVE_VERB) = _cmdVerb;
+ runScript(3, 0, 0, 0);
+ }
+}
+
void ScummEngine_v2::runInputScript(int clickArea, int val, int mode) {
int args[24];
int verbScript;
diff --git a/engines/scumm/script_v0.cpp b/engines/scumm/script_v0.cpp
index e2d3f40e8e..45901186cd 100644
--- a/engines/scumm/script_v0.cpp
+++ b/engines/scumm/script_v0.cpp
@@ -27,6 +27,7 @@
#include "scumm/resource.h"
#include "scumm/scumm_v0.h"
#include "scumm/verbs.h"
+#include "scumm/util.h"
namespace Scumm {
@@ -50,7 +51,7 @@ void ScummEngine_v0::setupOpcodes() {
OPCODE(0x0b, o_setActorBitVar);
/* 0C */
OPCODE(0x0c, o_loadSound);
- OPCODE(0x0d, o_printEgo_c64);
+ OPCODE(0x0d, o_printEgo);
OPCODE(0x0e, o_putActorAtObject);
OPCODE(0x0f, o2_clearState02);
/* 10 */
@@ -59,7 +60,7 @@ void ScummEngine_v0::setupOpcodes() {
OPCODE(0x12, o2_panCameraTo);
OPCODE(0x13, o_lockCostume);
/* 14 */
- OPCODE(0x14, o_print_c64);
+ OPCODE(0x14, o_print);
OPCODE(0x15, o5_walkActorToActor);
OPCODE(0x16, o5_getRandomNr);
OPCODE(0x17, o2_clearState08);
@@ -79,9 +80,9 @@ void ScummEngine_v0::setupOpcodes() {
OPCODE(0x22, o4_saveLoadGame);
OPCODE(0x23, o_stopCurrentScript);
/* 24 */
- OPCODE(0x24, o_unknown2);
+ OPCODE(0x24, o_ifNotEqualActiveObject2);
OPCODE(0x25, o5_loadRoom);
- OPCODE(0x26, o_getClosestObjActor);
+ OPCODE(0x26, o_getClosestActor);
OPCODE(0x27, o2_getActorY);
/* 28 */
OPCODE(0x28, o5_equalZero);
@@ -91,7 +92,7 @@ void ScummEngine_v0::setupOpcodes() {
/* 2C */
OPCODE(0x2c, o_stopCurrentScript);
OPCODE(0x2d, o2_putActorInRoom);
- OPCODE(0x2e, o_print_c64);
+ OPCODE(0x2e, o_print);
OPCODE(0x2f, o2_ifState08);
/* 30 */
OPCODE(0x30, o_loadCostume);
@@ -101,7 +102,7 @@ void ScummEngine_v0::setupOpcodes() {
/* 34 */
OPCODE(0x34, o5_getDist);
OPCODE(0x35, o_stopCurrentScript);
- OPCODE(0x36, o2_walkActorToObject);
+ OPCODE(0x36, o_walkActorToObject);
OPCODE(0x37, o2_clearState04);
/* 38 */
OPCODE(0x38, o2_isLessEqual);
@@ -144,7 +145,7 @@ void ScummEngine_v0::setupOpcodes() {
OPCODE(0x56, o_getActorMoving);
OPCODE(0x57, o2_clearState08);
/* 58 */
- OPCODE(0x58, o_beginOverride);
+ OPCODE(0x58, o2_beginOverride);
OPCODE(0x59, o_stopCurrentScript);
OPCODE(0x5a, o2_add);
OPCODE(0x5b, o_getActorBitVar);
@@ -154,14 +155,14 @@ void ScummEngine_v0::setupOpcodes() {
OPCODE(0x5e, o2_walkActorTo);
OPCODE(0x5f, o2_ifState04);
/* 60 */
- OPCODE(0x60, o_cursorCommand);
+ OPCODE(0x60, o_setMode);
OPCODE(0x61, o2_putActor);
OPCODE(0x62, o2_stopScript);
OPCODE(0x63, o_stopCurrentScript);
/* 64 */
- OPCODE(0x64, o_ifActiveObject);
+ OPCODE(0x64, o_ifEqualActiveObject2);
OPCODE(0x65, o_stopCurrentScript);
- OPCODE(0x66, o_getClosestObjActor);
+ OPCODE(0x66, o_getClosestActor);
OPCODE(0x67, o5_getActorFacing);
/* 68 */
OPCODE(0x68, o5_isScriptRunning);
@@ -177,11 +178,11 @@ void ScummEngine_v0::setupOpcodes() {
OPCODE(0x70, o_lights);
OPCODE(0x71, o_getBitVar);
OPCODE(0x72, o_nop);
- OPCODE(0x73, o5_getObjectOwner);
+ OPCODE(0x73, o_getObjectOwner);
/* 74 */
OPCODE(0x74, o5_getDist);
- OPCODE(0x75, o_printEgo_c64);
- OPCODE(0x76, o2_walkActorToObject);
+ OPCODE(0x75, o_printEgo);
+ OPCODE(0x76, o_walkActorToObject);
OPCODE(0x77, o2_clearState04);
/* 78 */
OPCODE(0x78, o2_isGreater);
@@ -239,7 +240,7 @@ void ScummEngine_v0::setupOpcodes() {
OPCODE(0xa2, o4_saveLoadGame);
OPCODE(0xa3, o_stopCurrentScript);
/* A4 */
- OPCODE(0xa4, o_unknown2);
+ OPCODE(0xa4, o_ifNotEqualActiveObject2);
OPCODE(0xa5, o5_loadRoom);
OPCODE(0xa6, o_stopCurrentScript);
OPCODE(0xa7, o2_getActorY);
@@ -251,7 +252,7 @@ void ScummEngine_v0::setupOpcodes() {
/* AC */
OPCODE(0xac, o_stopCurrentScript);
OPCODE(0xad, o2_putActorInRoom);
- OPCODE(0xae, o_print_c64);
+ OPCODE(0xae, o_print);
OPCODE(0xaf, o2_ifNotState08);
/* B0 */
OPCODE(0xb0, o_loadCostume);
@@ -261,7 +262,7 @@ void ScummEngine_v0::setupOpcodes() {
/* B4 */
OPCODE(0xb4, o5_getDist);
OPCODE(0xb5, o_stopCurrentScript);
- OPCODE(0xb6, o2_walkActorToObject);
+ OPCODE(0xb6, o_walkActorToObject);
OPCODE(0xb7, o2_setState04);
/* B8 */
OPCODE(0xb8, o2_isLessEqual);
@@ -314,12 +315,12 @@ void ScummEngine_v0::setupOpcodes() {
OPCODE(0xde, o2_walkActorTo);
OPCODE(0xdf, o2_ifNotState04);
/* E0 */
- OPCODE(0xe0, o_cursorCommand);
+ OPCODE(0xe0, o_setMode);
OPCODE(0xe1, o2_putActor);
OPCODE(0xe2, o2_stopScript);
OPCODE(0xe3, o_stopCurrentScript);
/* E4 */
- OPCODE(0xe4, o_ifActiveObject);
+ OPCODE(0xe4, o_ifEqualActiveObject2);
OPCODE(0xe5, o_loadRoomWithEgo);
OPCODE(0xe6, o_stopCurrentScript);
OPCODE(0xe7, o5_getActorFacing);
@@ -337,11 +338,11 @@ void ScummEngine_v0::setupOpcodes() {
OPCODE(0xf0, o_lights);
OPCODE(0xf1, o_getBitVar);
OPCODE(0xf2, o_nop);
- OPCODE(0xf3, o5_getObjectOwner);
+ OPCODE(0xf3, o_getObjectOwner);
/* F4 */
OPCODE(0xf4, o5_getDist);
OPCODE(0xf5, o_stopCurrentScript);
- OPCODE(0xf6, o2_walkActorToObject);
+ OPCODE(0xf6, o_walkActorToObject);
OPCODE(0xf7, o2_setState04);
/* F8 */
OPCODE(0xf8, o2_isGreater);
@@ -365,7 +366,7 @@ uint ScummEngine_v0::fetchScriptWord() {
int ScummEngine_v0::getActiveObject() {
if (_opcode & PARAM_2)
- return _activeObject;
+ return OBJECT_V0_ID(_cmdObject);
return fetchScriptByte();
}
@@ -406,172 +407,121 @@ void ScummEngine_v0::decodeParseString() {
actorTalk(buffer);
}
-void ScummEngine_v0::drawSentenceWord(int object, bool usePrep, bool objInInventory) {
- const byte *temp;
- int sentencePrep = 0;
-
- // If object not in inventory, we except an index
- if (!objInInventory)
- _v0ObjectIndex = true;
- else
- _v0ObjectInInventory = true;
-
- temp = getObjOrActorName(object);
+void ScummEngine_v0::clearSentenceLine() {
+ Common::Rect sentenceline;
+ sentenceline.top = _virtscr[kVerbVirtScreen].topline;
+ sentenceline.bottom = _virtscr[kVerbVirtScreen].topline + 8;
+ sentenceline.left = 0;
+ sentenceline.right = _virtscr[kVerbVirtScreen].w - 1;
+ restoreBackground(sentenceline);
+}
- _v0ObjectInInventory = false;
- _v0ObjectIndex = false;
+void ScummEngine_v0::flushSentenceLine() {
+ byte string[80];
+ const char *ptr = _sentenceBuf.c_str();
+ int i = 0, len = 0;
- // Append the 'object-name'
- if (temp) {
- _sentenceBuf += " ";
- _sentenceBuf += (const char *)temp;
- }
+ // Maximum length of printable characters
+ int maxChars = 40;
+ while (*ptr) {
+ if (*ptr != '@')
+ len++;
+ if (len > maxChars) {
+ break;
+ }
- // Append the modifier? (With / On / To / In)
- if (!usePrep)
- return;
+ string[i++] = *ptr++;
- if (_verbs[_activeVerb].prep == 0xFF) {
- _v0ObjectInInventory = objInInventory;
- sentencePrep = verbPrep(object);
- } else {
- sentencePrep = _verbs[_activeVerb].prep;
}
+ string[i] = 0;
- if (sentencePrep > 0 && sentencePrep <= 4) {
- // The prepositions, like the fonts, were hard code in the engine. Thus
- // we have to do that, too, and provde localized versions for all the
- // languages MM/Zak are available in.
- static const char *const prepositions[][5] = {
- { " ", " in", " with", " on", " to" }, // English
- { " ", " mit", " mit", " mit", " zu" }, // German
- { " ", " dans", " avec", " sur", " <" }, // French
- { " ", " in", " con", " su", " a" }, // Italian
- { " ", " en", " con", " en", " a" }, // Spanish
- };
- int lang;
- switch (_language) {
- case Common::DE_DEU:
- lang = 1;
- break;
- case Common::FR_FRA:
- lang = 2;
- break;
- case Common::IT_ITA:
- lang = 3;
- break;
- case Common::ES_ESP:
- lang = 4;
- break;
- default:
- lang = 0; // Default to english
- }
+ _string[2].charset = 1;
+ _string[2].ypos = _virtscr[kVerbVirtScreen].topline;
+ _string[2].xpos = 0;
+ _string[2].right = _virtscr[kVerbVirtScreen].w - 1;
+ _string[2].color = 16;
+ drawString(2, (byte *)string);
+}
- _sentenceBuf += prepositions[lang][sentencePrep];
+void ScummEngine_v0::drawSentenceObject(int object) {
+ const byte *temp;
+ temp = getObjOrActorName(object);
+ if (temp) {
+ _sentenceBuf += " ";
+ _sentenceBuf += (const char *)temp;
}
}
-void ScummEngine_v0::drawSentence() {
- Common::Rect sentenceline;
- bool inventoryFirst = false;
- if (!(_userState & 32))
- return;
+void ScummEngine_v0::drawSentenceLine() {
+ _redrawSentenceLine = false;
- // Current Verb, Walk/Use
- if (getResourceAddress(rtVerb, _activeVerb)) {
- _sentenceBuf = (char *)getResourceAddress(rtVerb, _activeVerb);
- } else {
+ if (!(_userState & USERSTATE_IFACE_SENTENCE))
return;
- }
-
- // If using inventory first, draw it first
- if (_activeInvExecute && _activeInventory) {
- drawSentenceWord(_activeInventory, true, true);
- } else {
- // Not using inventory, use selected object
- if (_activeObject)
- drawSentenceWord(_activeObjectIndex, true, false);
- else
- inventoryFirst = true;
- }
-
- // Draw the inventory?
- if (_activeInventory > 0 && _activeObject2 == 0) {
- // Only if inventory isnt first (it will already be drawn by now)
- if (!_activeInvExecute) {
- drawSentenceWord(_activeInventory, inventoryFirst, true);
- } else {
- // Draw the active object, which could be inventory based, or room based
- if (_activeObject && !_activeObjectIndex) {
- drawSentenceWord(_activeObject, inventoryFirst, true);
- } else // Room based
- drawSentenceWord(_activeObjectIndex, inventoryFirst, false);
- }
-
- // Draw the 2nd active object
- } else if (_activeObject2) {
-
- // 2nd Object is in inventory
- if (_activeObject2Inv) {
- _v0ObjectInInventory = true;
- drawSentenceWord(_activeObject2, inventoryFirst, true);
- } else {
- drawSentenceWord(_activeObject2Index, inventoryFirst, false);
+ clearSentenceLine();
+
+ if (_activeVerb == kVerbNewKid) {
+ _sentenceBuf = "";
+ for (int i = 0; i < 3; ++i) {
+ const char *actorName;
+ int actorId = VAR(97 + i);
+ if (actorId == 0) {
+ // after usage of the radiation suit, kid vars are set to 0
+ actorName = " ";
+ } else {
+ Actor *a = derefActor(actorId, "drawSentenceLine");
+ actorName = (char *)a->getActorName();
+ }
+ _sentenceBuf += Common::String::format("%-13s", actorName);
}
+ flushSentenceLine();
+ return;
}
- // Draw the active actor
- if (_activeActor) {
- Actor *a = derefActor(_activeActor, "");
+ // Current Verb
+ if (_activeVerb == kVerbNone)
+ _activeVerb = kVerbWalkTo;
- _sentenceBuf += " ";
- _sentenceBuf += (const char *)a->getActorName();
- }
+ char *verbName = (char *)getResourceAddress(rtVerb, _activeVerb);
+ assert(verbName);
+ _sentenceBuf = verbName;
- _string[2].charset = 1;
- _string[2].ypos = _virtscr[kVerbVirtScreen].topline;
- _string[2].xpos = 0;
- _string[2].right = _virtscr[kVerbVirtScreen].w - 1;
- _string[2].color = 16;
+ if (_activeObject) {
+ // Draw the 1st active object
+ drawSentenceObject(_activeObject);
- byte string[80];
- const char *ptr = _sentenceBuf.c_str();
- int i = 0, len = 0;
+ // Append verb preposition
+ int sentencePrep = activeVerbPrep();
+ if (sentencePrep) {
+ drawPreposition(sentencePrep);
- // Maximum length of printable characters
- int maxChars = 40;
- while (*ptr) {
- if (*ptr != '@')
- len++;
- if (len > maxChars) {
- break;
+ // Draw the 2nd active object
+ if (_activeObject2)
+ drawSentenceObject(_activeObject2);
}
-
- string[i++] = *ptr++;
-
}
- string[i] = 0;
- sentenceline.top = _virtscr[kVerbVirtScreen].topline;
- sentenceline.bottom = _virtscr[kVerbVirtScreen].topline + 8;
- sentenceline.left = 0;
- sentenceline.right = _virtscr[kVerbVirtScreen].w - 1;
- restoreBackground(sentenceline);
-
- drawString(2, (byte *)string);
+ flushSentenceLine();
}
void ScummEngine_v0::o_stopCurrentScript() {
- int script;
+ stopScriptCommon(0);
+}
- script = vm.slot[_currentScript].number;
+void ScummEngine_v0::o_walkActorToObject() {
+ int actor = getVarOrDirectByte(PARAM_1);
+ int objId = fetchScriptByte();
+ int obj;
- if (_currentScript != 0 && vm.slot[_currentScript].number == script)
- stopObjectCode();
+ if (_opcode & 0x40)
+ obj = OBJECT_V0(objId, kObjectV0TypeBG);
else
- stopScript(script);
+ obj = OBJECT_V0(objId, kObjectV0TypeFG);
+
+ if (whereIsObject(obj) != WIO_NOT_FOUND) {
+ walkActorToObject(actor, obj);
+ }
}
void ScummEngine_v0::o_loadSound() {
@@ -625,18 +575,16 @@ void ScummEngine_v0::o_loadRoom() {
}
void ScummEngine_v0::o_loadRoomWithEgo() {
- Actor *a;
+ Actor_v0 *a;
int obj, room, x, y, dir;
obj = fetchScriptByte();
room = fetchScriptByte();
- a = derefActor(VAR(VAR_EGO), "o_loadRoomWithEgo");
+ a = (Actor_v0 *)derefActor(VAR(VAR_EGO), "o_loadRoomWithEgo");
//0x634F
- if (((ActorC64 *)a)->_miscflags & 0x40) {
- // TODO: Check if this is the correct function
- // to be calling here
+ if (a->_miscflags & kActorMiscFlagFreeze) {
stopObjectCode();
return;
}
@@ -654,15 +602,14 @@ void ScummEngine_v0::o_loadRoomWithEgo() {
x = r.x;
y = r.y;
a->putActor(x, y, _currentRoom);
- a->setDirection(dir + 180);
-
+
camera._dest.x = camera._cur.x = a->getPos().x;
setCameraAt(a->getPos().x, a->getPos().y);
setCameraFollows(a);
_fullRedraw = true;
- resetSentence(false);
+ resetSentence();
if (x >= 0 && y >= 0) {
a->startWalkActor(x, y, -1);
@@ -679,27 +626,39 @@ void ScummEngine_v0::o_unlockRoom() {
_res->unlock(rtRoom, resid);
}
-void ScummEngine_v0::o_cursorCommand() {
- // TODO
- int state = 0;
+void ScummEngine_v0::setMode(byte mode) {
+ int state;
+
+ _currentMode = mode;
- _currentMode = fetchScriptByte();
switch (_currentMode) {
- case 0:
- state = 15;
+ case kModeCutscene:
+ _redrawSentenceLine = false;
+ // Note: do not change freeze state here
+ state = USERSTATE_SET_IFACE |
+ USERSTATE_SET_CURSOR;
break;
- case 1:
- state = 31;
+ case kModeKeypad:
+ _redrawSentenceLine = false;
+ state = USERSTATE_SET_IFACE |
+ USERSTATE_SET_CURSOR | USERSTATE_CURSOR_ON |
+ USERSTATE_SET_FREEZE | USERSTATE_FREEZE_ON;
break;
- case 2:
- break;
- case 3:
- state = 247;
+ case kModeNormal:
+ case kModeNoNewKid:
+ state = USERSTATE_SET_IFACE | USERSTATE_IFACE_ALL |
+ USERSTATE_SET_CURSOR | USERSTATE_CURSOR_ON |
+ USERSTATE_SET_FREEZE;
break;
+ default:
+ error("Invalid mode: %d", mode);
}
setUserState(state);
- debug(0, "o_cursorCommand(%d)", _currentMode);
+}
+
+void ScummEngine_v0::o_setMode() {
+ setMode(fetchScriptByte());
}
void ScummEngine_v0::o_lights() {
@@ -724,24 +683,31 @@ void ScummEngine_v0::o_lights() {
void ScummEngine_v0::o_animateActor() {
int act = getVarOrDirectByte(PARAM_1);
int anim = getVarOrDirectByte(PARAM_2);
- int unk = fetchScriptByte();
-
- debug(0,"o_animateActor: unk %d", unk);
-
- ActorC64 *a = (ActorC64*) derefActor(act, "o_animateActor");
-
- // 0x6993
- if (anim == 0xFE) {
- a->_speaking = 0x80; // Enabled, but not switching
- return;
- }
- // 0x69A3
- if (anim == 0xFD) {
- a->_speaking = 0x00;
- return;
+ int8 repeat = (int8) fetchScriptByte();
+
+ Actor_v0 *a = (Actor_v0*) derefActor(act, "o_animateActor");
+
+ a->_animFrameRepeat = repeat;
+
+ switch (anim) {
+
+ case 0xFE:
+ // 0x6993
+ a->_speaking = 0x80; // Enabled, but not switching
+ return;
+
+ case 0xFD:
+ // 0x69A3
+ a->_speaking = 0x00;
+ return;
+
+ case 0xFF:
+ a->stopActorMoving();
+ return;
}
a->animateActor(anim);
+ a->animateCostume();
}
void ScummEngine_v0::o_getActorMoving() {
@@ -760,7 +726,12 @@ void ScummEngine_v0::o_putActorAtObject() {
a = derefActor(getVarOrDirectByte(PARAM_1), "o_putActorAtObject");
- obj = fetchScriptByte();
+ int objId = fetchScriptByte();
+ if (_opcode & 0x40)
+ obj = OBJECT_V0(objId, kObjectV0TypeBG);
+ else
+ obj = OBJECT_V0(objId, kObjectV0TypeFG);
+
if (whereIsObject(obj) != WIO_NOT_FOUND) {
getObjectXYPos(obj, x, y);
AdjustBoxResult r = a->adjustXYToBeInBox(x, y);
@@ -776,20 +747,13 @@ void ScummEngine_v0::o_putActorAtObject() {
void ScummEngine_v0::o_pickupObject() {
int obj = fetchScriptByte();
- if (obj == 0) {
- obj = _activeObject;
- }
+ if (!obj)
+ obj = _cmdObject;
- if (obj < 1) {
- error("pickupObject received invalid index %d (script %d)", obj, vm.slot[_currentScript].number);
- }
-
- if (getObjectIndex(obj) == -1)
+ /* Don't take an object twice */
+ if (whereIsObject(obj) == WIO_INVENTORY)
return;
- if (whereIsObjectInventory(_activeObject2) == WIO_INVENTORY) /* Don't take an */
- return; /* object twice */
-
addObjectToInventory(obj, _roomResource);
markObjectRectAsDirty(obj);
putOwner(obj, VAR(VAR_EGO));
@@ -800,14 +764,22 @@ void ScummEngine_v0::o_pickupObject() {
}
void ScummEngine_v0::o_setObjectName() {
- int obj = fetchScriptByte();
+ int obj;
+ int objId = fetchScriptByte();
+ if (!objId) {
+ obj = _cmdObject;
+ } else {
+ if (_opcode & 0x80)
+ obj = OBJECT_V0(objId, kObjectV0TypeBG);
+ else
+ obj = OBJECT_V0(objId, kObjectV0TypeFG);
+ }
setObjectName(obj);
}
void ScummEngine_v0::o_nop() {
}
-// TODO: Maybe translate actor flags in future.
void ScummEngine_v0::o_setActorBitVar() {
byte act = getVarOrDirectByte(PARAM_1);
byte mask = getVarOrDirectByte(PARAM_2);
@@ -817,7 +789,7 @@ void ScummEngine_v0::o_setActorBitVar() {
if (act >= _numActors)
return;
- ActorC64 *a = (ActorC64 *)derefActor(act, "o_setActorBitVar");
+ Actor_v0 *a = (Actor_v0 *)derefActor(act, "o_setActorBitVar");
if (mod)
a->_miscflags |= mask;
@@ -825,20 +797,24 @@ void ScummEngine_v0::o_setActorBitVar() {
a->_miscflags &= ~mask;
// This flag causes the actor to stop moving (used by script #158, Green Tentacle 'Oomph!')
- if (a->_miscflags & 0x40)
+ if (a->_miscflags & kActorMiscFlagFreeze)
a->stopActorMoving();
- if (a->_miscflags & 0x80)
- a->setActorCostume(0);
debug(0, "o_setActorBitVar(%d, %d, %d)", act, mask, mod);
}
+void ScummEngine_v0::o_getObjectOwner() {
+ getResultPos();
+ int obj = getVarOrDirectWord(PARAM_1);
+ setResult(getOwner(obj ? obj : _cmdObject));
+}
+
void ScummEngine_v0::o_getActorBitVar() {
getResultPos();
byte act = getVarOrDirectByte(PARAM_1);
byte mask = getVarOrDirectByte(PARAM_2);
- ActorC64 *a = (ActorC64 *)derefActor(act, "o_getActorBitVar");
+ Actor_v0 *a = (Actor_v0 *)derefActor(act, "o_getActorBitVar");
setResult((a->_miscflags & mask) ? 1 : 0);
debug(0, "o_getActorBitVar(%d, %d, %d)", act, mask, (a->_miscflags & mask));
@@ -867,74 +843,97 @@ void ScummEngine_v0::o_getBitVar() {
debug(0, "o_getBitVar (%d, %d %d)", flag, mask, _bitVars[flag] & (1 << mask));
}
-void ScummEngine_v0::o_print_c64() {
+void ScummEngine_v0::o_print() {
_actorToPrintStrFor = fetchScriptByte();
decodeParseString();
}
-void ScummEngine_v0::o_printEgo_c64() {
+void ScummEngine_v0::o_printEgo() {
_actorToPrintStrFor = (byte)VAR(VAR_EGO);
decodeParseString();
}
void ScummEngine_v0::o_doSentence() {
- byte entry = fetchScriptByte();
- byte obj = fetchScriptByte();
- fetchScriptByte();
+ byte verb = fetchScriptByte();
+ int obj, obj2;
+ byte b;
+
+ b = fetchScriptByte();
+ if (b == 0xFF) {
+ obj = _cmdObject2;
+ } else if (b == 0xFE) {
+ obj = _cmdObject;
+ } else {
+ obj = OBJECT_V0(b, (_opcode & 0x80) ? kObjectV0TypeBG : kObjectV0TypeFG);
+ }
- runObjectScript(obj, entry, false, false, NULL);
-}
+ b = fetchScriptByte();
+ if (b == 0xFF) {
+ obj2 = _cmdObject2;
+ } else if (b == 0xFE) {
+ obj2 = _cmdObject;
+ } else {
+ obj2 = OBJECT_V0(b, (_opcode & 0x40) ? kObjectV0TypeBG : kObjectV0TypeFG);
+ }
-void ScummEngine_v0::o_unknown2() {
- byte var1 = fetchScriptByte();
- error("STUB: o_unknown2(%d)", var1);
+ doSentence(verb, obj, obj2);
}
-void ScummEngine_v0::o_ifActiveObject() {
+bool ScummEngine_v0::ifEqualActiveObject2Common(bool checkType) {
byte obj = fetchScriptByte();
+ if (!checkType || (OBJECT_V0_TYPE(_cmdObject2) == kObjectV0TypeFG))
+ return (obj == OBJECT_V0_ID(_cmdObject2));
+ return false;
+}
- jumpRelative(obj == _activeInventory);
+void ScummEngine_v0::o_ifEqualActiveObject2() {
+ bool equal = ifEqualActiveObject2Common((_opcode & 0x80) == 0);
+ jumpRelative(equal);
}
-void ScummEngine_v0::o_getClosestObjActor() {
- int obj;
- int act;
+void ScummEngine_v0::o_ifNotEqualActiveObject2() {
+ bool equal = ifEqualActiveObject2Common((_opcode & 0x80) == 0);
+ jumpRelative(!equal);
+}
+
+void ScummEngine_v0::o_getClosestActor() {
+ int act, check_act;
int dist;
// This code can't detect any actors farther away than 255 units
// (pixels in newer games, characters in older ones.) But this is
// perfectly OK, as it is exactly how the original behaved.
- int closest_obj = 0xFF, closest_dist = 0xFF;
+ int closest_act = 0xFF, closest_dist = 0xFF;
getResultPos();
act = getVarOrDirectByte(PARAM_1);
- obj = (_opcode & PARAM_2) ? 25 : 7;
+ check_act = (_opcode & PARAM_2) ? 25 : 7;
do {
- dist = getObjActToObjActDist(act, obj);
+ dist = getObjActToObjActDist(actorToObj(act), actorToObj(check_act));
if (dist < closest_dist) {
closest_dist = dist;
- closest_obj = obj;
+ closest_act = check_act;
}
- } while (--obj);
+ } while (--check_act);
- setResult(closest_obj);
+ setResult(closest_act);
}
void ScummEngine_v0::o_cutscene() {
- vm.cutSceneData[0] = _userState | (_userPut ? 16 : 0);
+ vm.cutSceneData[0] = _currentMode;
vm.cutSceneData[2] = _currentRoom;
- vm.cutSceneData[3] = camera._mode;
- // Hide inventory, freeze scripts, hide cursor
- setUserState(15);
+ freezeScripts(0);
+ setMode(kModeCutscene);
_sentenceNum = 0;
- resetSentence(false);
+ resetSentence();
vm.cutScenePtr[0] = 0;
+ vm.cutSceneScript[0] = 0;
}
void ScummEngine_v0::o_endCutscene() {
@@ -944,68 +943,43 @@ void ScummEngine_v0::o_endCutscene() {
vm.cutSceneScript[0] = 0;
vm.cutScenePtr[0] = 0;
- // Reset user state to values before cutscene
- setUserState(vm.cutSceneData[0] | 7);
+ setMode(vm.cutSceneData[0]);
- camera._mode = (byte) vm.cutSceneData[3];
- if (camera._mode == kFollowActorCameraMode) {
- actorFollowCamera(VAR(VAR_EGO));
- } else if (vm.cutSceneData[2] != _currentRoom) {
+ if (_currentMode == kModeKeypad) {
startScene(vm.cutSceneData[2], 0, 0);
+ // in contrast to the normal keypad behavior we unfreeze scripts here
+ unfreezeScripts();
+ } else {
+ unfreezeScripts();
+ actorFollowCamera(VAR(VAR_EGO));
+ // set mode again to have the freeze mode right
+ setMode(vm.cutSceneData[0]);
+ _redrawSentenceLine = true;
}
}
-void ScummEngine_v0::o_beginOverride() {
- const int idx = vm.cutSceneStackPointer;
- assert(0 <= idx && idx < 5);
-
- vm.cutScenePtr[idx] = _scriptPointer - _scriptOrgPointer;
- vm.cutSceneScript[idx] = _currentScript;
-
- // Skip the jump instruction following the override instruction
- // (the jump is responsible for "skipping" cutscenes, and the reason
- // why we record the current script position in vm.cutScenePtr).
- fetchScriptByte();
- ScummEngine::fetchScriptWord();
-
- // This is based on disassembly
- VAR(VAR_OVERRIDE) = 0;
-}
-
void ScummEngine_v0::o_setOwnerOf() {
int obj, owner;
obj = getVarOrDirectWord(PARAM_1);
owner = getVarOrDirectByte(PARAM_2);
- if (obj == 0)
- obj = _activeInventory;
+ if (!obj)
+ obj = _cmdObject;
setOwnerOf(obj, owner);
}
-void ScummEngine_v0::resetSentence(bool walking) {
- _activeVerb = 13;
-
- // If the actor is walking, or the screen is a keypad (no sentence verbs/objects are drawn)
- // Then reset all active objects (stops the radio crash, bug #3077966)
- if (!walking || !(_userState & 32)) {
- _v0ObjectFlag = 0;
- _activeInventory = 0;
- _activeObject = 0;
- _activeObject2 = 0;
- _activeObjectIndex = 0;
- _activeObject2Index = 0;
- }
+void ScummEngine_v0::resetSentence() {
+ _activeVerb = kVerbWalkTo;
+ _activeObject = 0;
+ _activeObject2 = 0;
- _verbExecuting = false;
- _verbPickup = false;
+ _walkToObjectState = kWalkToObjectStateDone;
+ _redrawSentenceLine = true;
- _activeActor = 0;
- _activeInvExecute = false;
- _activeObject2Inv = false;
- _activeObjectObtained = false;
- _activeObject2Obtained = false;
+ _sentenceNum = 0;
+ _sentenceNestedCount = 0;
}
} // End of namespace Scumm
diff --git a/engines/scumm/script_v2.cpp b/engines/scumm/script_v2.cpp
index 7f02e899b4..ce162b4a6a 100644
--- a/engines/scumm/script_v2.cpp
+++ b/engines/scumm/script_v2.cpp
@@ -401,7 +401,7 @@ void ScummEngine_v2::decodeParseString() {
_string[textSlot].overhead = false;
if (_game.id == GID_MANIAC && _actorToPrintStrFor == 0xFF) {
- if (_game.platform == Common::kPlatformC64) {
+ if (_game.version == 0) {
_string[textSlot].color = 14;
} else if (_game.features & GF_DEMO) {
_string[textSlot].color = (_game.version == 2) ? 15 : 1;
@@ -412,7 +412,7 @@ void ScummEngine_v2::decodeParseString() {
}
int ScummEngine_v2::readVar(uint var) {
- if (var >= 14 && var <= 16)
+ if (_game.version >= 1 && var >= 14 && var <= 16)
var = _scummVars[var];
assertRange(0, var, _numVariables - 1, "variable (reading)");
@@ -873,7 +873,7 @@ void ScummEngine_v2::o2_doSentence() {
return;
}
if (a == 0xFB) {
- resetSentence(false);
+ resetSentence();
return;
}
@@ -953,12 +953,48 @@ void ScummEngine_v2::o2_doSentence() {
}
}
+void ScummEngine_v2::drawPreposition(int index) {
+ // The prepositions, like the fonts, were hard code in the engine. Thus
+ // we have to do that, too, and provde localized versions for all the
+ // languages MM/Zak are available in.
+ const char *prepositions[][5] = {
+ { " ", " in", " with", " on", " to" }, // English
+ { " ", " mit", " mit", " mit", " zu" }, // German
+ { " ", " dans", " avec", " sur", " <" }, // French
+ { " ", " in", " con", " su", " a" }, // Italian
+ { " ", " en", " con", " en", " a" }, // Spanish
+ };
+ int lang;
+ switch (_language) {
+ case Common::DE_DEU:
+ lang = 1;
+ break;
+ case Common::FR_FRA:
+ lang = 2;
+ break;
+ case Common::IT_ITA:
+ lang = 3;
+ break;
+ case Common::ES_ESP:
+ lang = 4;
+ break;
+ default:
+ lang = 0; // Default to english
+ }
+
+ if (_game.platform == Common::kPlatformNES) {
+ _sentenceBuf += (const char *)(getResourceAddress(rtCostume, 78) + VAR(VAR_SENTENCE_PREPOSITION) * 8 + 2);
+ } else
+ _sentenceBuf += prepositions[lang][index];
+}
+
void ScummEngine_v2::o2_drawSentence() {
Common::Rect sentenceline;
const byte *temp;
int slot = getVerbSlot(VAR(VAR_SENTENCE_VERB), 0);
- if (!((_userState & 32) || (_game.platform == Common::kPlatformNES && _userState & 0xe0)))
+ if (!((_userState & USERSTATE_IFACE_SENTENCE) ||
+ (_game.platform == Common::kPlatformNES && (_userState & USERSTATE_IFACE_ALL))))
return;
if (getResourceAddress(rtVerb, slot))
@@ -986,38 +1022,7 @@ void ScummEngine_v2::o2_drawSentence() {
}
if (0 < VAR(VAR_SENTENCE_PREPOSITION) && VAR(VAR_SENTENCE_PREPOSITION) <= 4) {
- // The prepositions, like the fonts, were hard code in the engine. Thus
- // we have to do that, too, and provde localized versions for all the
- // languages MM/Zak are available in.
- const char *prepositions[][5] = {
- { " ", " in", " with", " on", " to" }, // English
- { " ", " mit", " mit", " mit", " zu" }, // German
- { " ", " dans", " avec", " sur", " <" }, // French
- { " ", " in", " con", " su", " a" }, // Italian
- { " ", " en", " con", " en", " a" }, // Spanish
- };
- int lang;
- switch (_language) {
- case Common::DE_DEU:
- lang = 1;
- break;
- case Common::FR_FRA:
- lang = 2;
- break;
- case Common::IT_ITA:
- lang = 3;
- break;
- case Common::ES_ESP:
- lang = 4;
- break;
- default:
- lang = 0; // Default to english
- }
-
- if (_game.platform == Common::kPlatformNES) {
- _sentenceBuf += (const char *)(getResourceAddress(rtCostume, 78) + VAR(VAR_SENTENCE_PREPOSITION) * 8 + 2);
- } else
- _sentenceBuf += prepositions[lang][VAR(VAR_SENTENCE_PREPOSITION)];
+ drawPreposition(VAR(VAR_SENTENCE_PREPOSITION));
}
if (VAR(VAR_SENTENCE_OBJECT2) > 0) {
@@ -1171,25 +1176,30 @@ void ScummEngine_v2::o2_startScript() {
// imprisonment of the player), then any attempt to start script 87
// (which makes Ted go answer the door bell) is simply ignored. This
// way, the door bell still chimes, but Ted ignores it.
- if (_game.id == GID_MANIAC && script == 87) {
- if (isScriptRunning(88) || isScriptRunning(89)) {
- return;
+ if (_game.id == GID_MANIAC) {
+ if (_game.version >= 1 && script == 87) {
+ if (isScriptRunning(88) || isScriptRunning(89))
+ return;
+ }
+ // Script numbers are different in V0
+ if (_game.version == 0 && script == 82) {
+ if (isScriptRunning(83) || isScriptRunning(84))
+ return;
}
}
runScript(script, 0, 0, 0);
}
-void ScummEngine_v2::o2_stopScript() {
- int script;
-
- script = getVarOrDirectByte(PARAM_1);
-
+void ScummEngine_v2::stopScriptCommon(int script) {
if (_game.id == GID_MANIAC && _roomResource == 26 && vm.slot[_currentScript].number == 10001) {
// FIXME: Nasty hack for bug #915575
// Don't let the exit script for room 26 stop the script (116), when
// switching to the dungeon (script 89)
- if ((script == 116) && isScriptRunning(89))
+ if (_game.version >= 1 && script == 116 && isScriptRunning(89))
+ return;
+ // Script numbers are different in V0
+ if (_game.version == 0 && script == 111 && isScriptRunning(84))
return;
}
@@ -1202,26 +1212,31 @@ void ScummEngine_v2::o2_stopScript() {
stopScript(script);
}
+void ScummEngine_v2::o2_stopScript() {
+ stopScriptCommon(getVarOrDirectByte(PARAM_1));
+}
+
void ScummEngine_v2::o2_panCameraTo() {
panCameraTo(getVarOrDirectByte(PARAM_1) * V12_X_MULTIPLIER, 0);
}
-void ScummEngine_v2::o2_walkActorToObject() {
- int obj;
- Actor *a;
+void ScummEngine_v2::walkActorToObject(int actor, int obj) {
+ int x, y, dir;
+ getObjectXYPos(obj, x, y, dir);
- _v0ObjectFlag = 0;
+ Actor *a = derefActor(actor, "walkActorToObject");
+ AdjustBoxResult r = a->adjustXYToBeInBox(x, y);
+ x = r.x;
+ y = r.y;
- a = derefActor(getVarOrDirectByte(PARAM_1), "o2_walkActorToObject");
- obj = getVarOrDirectWord(PARAM_2);
- if (whereIsObject(obj) != WIO_NOT_FOUND) {
- int x, y, dir;
- getObjectXYPos(obj, x, y, dir);
- AdjustBoxResult r = a->adjustXYToBeInBox(x, y);
- x = r.x;
- y = r.y;
+ a->startWalkActor(x, y, dir);
+}
- a->startWalkActor(x, y, dir);
+void ScummEngine_v2::o2_walkActorToObject() {
+ int actor = getVarOrDirectByte(PARAM_1);
+ int obj = getVarOrDirectWord(PARAM_2);
+ if (whereIsObject(obj) != WIO_NOT_FOUND) {
+ walkActorToObject(actor, obj);
}
}
@@ -1289,7 +1304,7 @@ void ScummEngine_v2::o2_findObject() {
int x = getVarOrDirectByte(PARAM_1) * V12_X_MULTIPLIER;
int y = getVarOrDirectByte(PARAM_2) * V12_Y_MULTIPLIER;
obj = findObject(x, y);
- if (obj == 0 && (_game.platform == Common::kPlatformNES) && (_userState & 0x40)) {
+ if (obj == 0 && (_game.platform == Common::kPlatformNES) && (_userState & USERSTATE_IFACE_INVENTORY)) {
if (_mouseOverBoxV2 >= 0 && _mouseOverBoxV2 < 4)
obj = findInventory(VAR(VAR_EGO), _mouseOverBoxV2 + _inventoryOffset + 1);
}
@@ -1301,7 +1316,7 @@ void ScummEngine_v2::o2_getActorX() {
getResultPos();
a = getVarOrDirectByte(PARAM_1);
- setResult(getObjX(a));
+ setResult(getObjX(actorToObj(a)));
}
void ScummEngine_v2::o2_getActorY() {
@@ -1309,7 +1324,7 @@ void ScummEngine_v2::o2_getActorY() {
getResultPos();
a = getVarOrDirectByte(PARAM_1);
- setResult(getObjY(a));
+ setResult(getObjY(actorToObj(a)));
}
void ScummEngine_v2::o2_isGreater() {
@@ -1396,7 +1411,7 @@ void ScummEngine_v2::o2_loadRoomWithEgo() {
_fullRedraw = true;
- resetSentence(false);
+ resetSentence();
if (x >= 0 && y >= 0) {
a->startWalkActor(x, y, -1);
@@ -1471,11 +1486,13 @@ void ScummEngine_v2::o2_cutscene() {
VAR(VAR_CURSORSTATE) = 200;
// Hide inventory, freeze scripts, hide cursor
- setUserState(15);
+ setUserState(USERSTATE_SET_IFACE |
+ USERSTATE_SET_CURSOR |
+ USERSTATE_SET_FREEZE | USERSTATE_FREEZE_ON);
_sentenceNum = 0;
stopScript(SENTENCE_SCRIPT);
- resetSentence(false);
+ resetSentence();
vm.cutScenePtr[0] = 0;
}
@@ -1490,7 +1507,7 @@ void ScummEngine_v2::o2_endCutscene() {
VAR(VAR_CURSORSTATE) = vm.cutSceneData[1];
// Reset user state to values before cutscene
- setUserState(vm.cutSceneData[0] | 7);
+ setUserState(vm.cutSceneData[0] | USERSTATE_SET_IFACE | USERSTATE_SET_CURSOR | USERSTATE_SET_FREEZE);
if ((_game.id == GID_MANIAC) && !(_game.platform == Common::kPlatformNES)) {
camera._mode = (byte) vm.cutSceneData[3];
@@ -1510,7 +1527,7 @@ void ScummEngine_v2::o2_beginOverride() {
// Skip the jump instruction following the override instruction
fetchScriptByte();
- fetchScriptWord();
+ ScummEngine::fetchScriptWord();
}
void ScummEngine_v2::o2_chainScript() {
@@ -1556,24 +1573,24 @@ void ScummEngine_v2::o2_cursorCommand() { // TODO: Define the magic numbers
}
void ScummEngine_v2::setUserState(byte state) {
- if (state & 4) { // Userface
+ if (state & USERSTATE_SET_IFACE) { // Userface
if (_game.platform == Common::kPlatformNES)
- _userState = (_userState & ~0xE0) | (state & 0xE0);
+ _userState = (_userState & ~USERSTATE_IFACE_ALL) | (state & USERSTATE_IFACE_ALL);
else
- _userState = state & (32 | 64 | 128);
+ _userState = state & USERSTATE_IFACE_ALL;
}
- if (state & 1) { // Freeze
- if (state & 8)
+ if (state & USERSTATE_SET_FREEZE) { // Freeze
+ if (state & USERSTATE_FREEZE_ON)
freezeScripts(0);
else
unfreezeScripts();
}
- if (state & 2) { // Cursor Show/Hide
+ if (state & USERSTATE_SET_CURSOR) { // Cursor Show/Hide
if (_game.platform == Common::kPlatformNES)
- _userState = (_userState & ~0x10) | (state & 0x10);
- if (state & 16) {
+ _userState = (_userState & ~USERSTATE_CURSOR_ON) | (state & USERSTATE_CURSOR_ON);
+ if (state & USERSTATE_CURSOR_ON) {
_userPut = 1;
_cursor.state = 1;
} else {
@@ -1623,7 +1640,7 @@ void ScummEngine_v2::o2_switchCostumeSet() {
o2_dummy();
}
-void ScummEngine_v2::resetSentence(bool walking) {
+void ScummEngine_v2::resetSentence() {
VAR(VAR_SENTENCE_VERB) = VAR(VAR_BACKUP_VERB);
VAR(VAR_SENTENCE_OBJECT1) = 0;
VAR(VAR_SENTENCE_OBJECT2) = 0;
diff --git a/engines/scumm/script_v4.cpp b/engines/scumm/script_v4.cpp
index 8340f62dbc..1de9f08168 100644
--- a/engines/scumm/script_v4.cpp
+++ b/engines/scumm/script_v4.cpp
@@ -350,7 +350,7 @@ void ScummEngine_v4::loadIQPoints(byte *ptr, int size) {
file = _saveFileMan->openForLoading(filename);
if (file != NULL) {
- byte *tmp = (byte*)malloc(size);
+ byte *tmp = (byte *)malloc(size);
int nread = file->read(tmp, size);
if (nread == size) {
memcpy(ptr, tmp, size);
@@ -414,7 +414,7 @@ void ScummEngine_v4::o4_saveLoadGame() {
// use name entered by the user
char* ptr;
int firstSlot = (_game.id == GID_LOOM) ? STRINGID_SAVENAME1_LOOM : STRINGID_SAVENAME1;
- ptr = (char*)getStringAddress(slot + firstSlot - 1);
+ ptr = (char *)getStringAddress(slot + firstSlot - 1);
strncpy(name, ptr, sizeof(name));
}
diff --git a/engines/scumm/script_v5.cpp b/engines/scumm/script_v5.cpp
index 6426b75e1e..a5591b701f 100644
--- a/engines/scumm/script_v5.cpp
+++ b/engines/scumm/script_v5.cpp
@@ -1095,10 +1095,16 @@ void ScummEngine_v5::o5_getClosestObjActor() {
void ScummEngine_v5::o5_getDist() {
int o1, o2;
int r;
+
getResultPos();
+
o1 = getVarOrDirectWord(PARAM_1);
o2 = getVarOrDirectWord(PARAM_2);
- r = getObjActToObjActDist(o1, o2);
+
+ if (_game.version == 0) // in v0 both parameters are always actor IDs, never objects
+ r = getObjActToObjActDist(actorToObj(o1), actorToObj(o2));
+ else
+ r = getObjActToObjActDist(o1, o2);
// FIXME: MI2 race workaround, see bug #597022. We never quite figured out
// what the real cause of this, or if it maybe occurs in the original, too...
@@ -2464,8 +2470,40 @@ void ScummEngine_v5::o5_walkActorTo() {
a->startWalkActor(x, y, -1);
}
+void ScummEngine_v5::walkActorToActor(int actor, int toActor, int dist) {
+ Actor *a = derefActor(actor, "walkActorToActor");
+ Actor *to = derefActor(toActor, "walkActorToActor(2)");
+
+ if (_game.version <= 2) {
+ dist *= V12_X_MULTIPLIER;
+ } else if (dist == 0xFF) {
+ dist = a->_scalex * a->_width / 0xFF;
+ dist += (to->_scalex * to->_width / 0xFF) / 2;
+ }
+ int x = to->getPos().x;
+ int y = to->getPos().y;
+ if (x < a->getPos().x)
+ x += dist;
+ else
+ x -= dist;
+
+ if (_game.version <= 2) {
+ x /= V12_X_MULTIPLIER;
+ y /= V12_Y_MULTIPLIER;
+ }
+ if (_game.version <= 3) {
+ AdjustBoxResult abr = a->adjustXYToBeInBox(x, y);
+ x = abr.x;
+ y = abr.y;
+ }
+ a->startWalkActor(x, y, -1);
+
+ // WORKAROUND: See bug #2971126 for details on why this is here.
+ if (_game.version == 0)
+ o5_breakHere();
+}
+
void ScummEngine_v5::o5_walkActorToActor() {
- int x, y;
Actor *a, *a2;
int nr = getVarOrDirectByte(PARAM_1);
int nr2 = getVarOrDirectByte(PARAM_2);
@@ -2499,33 +2537,7 @@ void ScummEngine_v5::o5_walkActorToActor() {
if (!a2->isInCurrentRoom())
return;
- if (_game.version <= 2) {
- dist *= V12_X_MULTIPLIER;
- } else if (dist == 0xFF) {
- dist = a->_scalex * a->_width / 0xFF;
- dist += (a2->_scalex * a2->_width / 0xFF) / 2;
- }
- x = a2->getPos().x;
- y = a2->getPos().y;
- if (x < a->getPos().x)
- x += dist;
- else
- x -= dist;
-
- if (_game.version <= 2) {
- x /= V12_X_MULTIPLIER;
- y /= V12_Y_MULTIPLIER;
- }
- if (_game.version <= 3) {
- AdjustBoxResult abr = a->adjustXYToBeInBox(x, y);
- x = abr.x;
- y = abr.y;
- }
- a->startWalkActor(x, y, -1);
-
- // WORKAROUND: See bug #2971126 for details on why this is here.
- if (_game.version == 0)
- o5_breakHere();
+ walkActorToActor(nr, nr2, dist);
}
void ScummEngine_v5::o5_walkActorToObject() {
diff --git a/engines/scumm/script_v8.cpp b/engines/scumm/script_v8.cpp
index c8b92be3c8..f6f376f3c9 100644
--- a/engines/scumm/script_v8.cpp
+++ b/engines/scumm/script_v8.cpp
@@ -1122,7 +1122,7 @@ void ScummEngine_v8::o8_kernelSetFunctions() {
}
case 26: { // saveGameWrite
// FIXME: This doesn't work
- char *address = (char*)getStringAddress(args[2]);
+ char *address = (char *)getStringAddress(args[2]);
debug(0, "o8_kernelSetFunctions: saveGame(%d, %s)", args[1], address);
break;
}
diff --git a/engines/scumm/scumm-md5.h b/engines/scumm/scumm-md5.h
index 06e779c164..301361d916 100644
--- a/engines/scumm/scumm-md5.h
+++ b/engines/scumm/scumm-md5.h
@@ -1,5 +1,5 @@
/*
- This file was generated by the md5table tool on Sun Jan 1 20:12:16 2012
+ This file was generated by the md5table tool on Sun Jan 22 19:25:34 2012
DO NOT EDIT MANUALLY!
*/
@@ -50,6 +50,7 @@ static const MD5Table md5table[] = {
{ "0c45eb4baff0c12c3d9dfa889c8070ab", "pajama3", "", "Demo", 13884, Common::DE_DEU, Common::kPlatformUnknown },
{ "0cccfa5223099a60e76cfcca57a1a141", "freddi3", "", "", -1, Common::NL_NLD, Common::kPlatformUnknown },
{ "0d1b69471605201ef2fa9cec1f5f02d2", "maniac", "V2", "V2", -1, Common::ES_ESP, Common::kPlatformPC },
+ { "0ddf1174d0d097956ba10dd452ea65e6", "freddi3", "HE 99", "", -1, Common::HE_ISR, Common::kPlatformWindows },
{ "0e4c5d54a0ad4b26132e78b5ea76642a", "samnmax", "Floppy", "Demo", 6485, Common::EN_ANY, Common::kPlatformPC },
{ "0e96ab45a4eb72acc1b46813976589fd", "activity", "", "", -1, Common::EN_ANY, Common::kPlatformMacintosh },
{ "0e9b01430e31d9fcd94071d433bbc6bf", "loom", "No AdLib", "EGA", -1, Common::FR_FRA, Common::kPlatformAtariST },
@@ -89,6 +90,7 @@ static const MD5Table md5table[] = {
{ "19263586f749a560c1adf8b3393a9593", "socks", "HE 85", "", -1, Common::RU_RUS, Common::kPlatformWindows },
{ "19bf6938a94698296bcb0c99c31c91a7", "spyfox2", "", "Demo", -1, Common::EN_GRB, Common::kPlatformWindows },
{ "1a6e5ae2777a6a33f06ffc0226210934", "atlantis", "", "CD", -1, Common::EN_ANY, Common::kPlatformMacintosh },
+ { "1af4eb581a33d808707d66d50e084dca", "pajama2", "HE 99", "", -1, Common::HE_ISR, Common::kPlatformWindows },
{ "1c792d28376d45e145cb916bca0400a2", "spyfox2", "", "Demo", -1, Common::NL_NLD, Common::kPlatformUnknown },
{ "1c7e7db2cfab1ad62746ab680a634204", "maniac", "NES", "", -1, Common::FR_FRA, Common::kPlatformNES },
{ "1ca86e2cf9aaa2068738a1e5ba477e60", "zak", "FM-TOWNS", "", -1, Common::JA_JPN, Common::kPlatformFMTowns },
@@ -127,7 +129,7 @@ static const MD5Table md5table[] = {
{ "2c04aacffb8428f30ccf4f734fbe3adc", "activity", "", "", -1, Common::EN_ANY, Common::kPlatformPC },
{ "2ccd8891ce4d3f1a334d21bff6a88ca2", "monkey", "CD", "", 9455, Common::EN_ANY, Common::kPlatformMacintosh },
{ "2d1e891fe52df707c30185e52c50cd92", "monkey", "CD", "CD", 8955, Common::EN_ANY, Common::kPlatformPC },
- { "2d388339d6050d8ccaa757b64633954e", "zak", "FM-TOWNS", "Demo", 7520, Common::EN_ANY, Common::kPlatformFMTowns },
+ { "2d388339d6050d8ccaa757b64633954e", "indyloom", "FM-TOWNS", "Demo", 7520, Common::EN_ANY, Common::kPlatformFMTowns },
{ "2d4536a56e01da4b02eb021e7770afa2", "zak", "FM-TOWNS", "", 7520, Common::EN_ANY, Common::kPlatformFMTowns },
{ "2d4acbdcfd8e374c9da8c2e7303a5cd0", "BluesBirthday", "", "Demo", -1, Common::EN_ANY, Common::kPlatformUnknown },
{ "2d624d1b214f7faf0094daea65c6d1a6", "maniac", "Apple II", "", -1, Common::EN_ANY, Common::kPlatformApple2GS },
@@ -158,7 +160,7 @@ static const MD5Table md5table[] = {
{ "37ff1b308999c4cca7319edfcc1280a0", "puttputt", "HE 70", "Demo", 8269, Common::EN_ANY, Common::kPlatformWindows },
{ "3824e60cdf639d22f6df92a03dc4b131", "fbear", "HE 62", "", 7732, Common::EN_ANY, Common::kPlatformPC },
{ "387a544b8b10b26912d8413bab63a853", "monkey2", "", "Demo", -1, Common::EN_ANY, Common::kPlatformPC },
- { "3938ee1aa4433fca9d9308c9891172b1", "zak", "FM-TOWNS", "Demo", 7520, Common::EN_ANY, Common::kPlatformFMTowns },
+ { "3938ee1aa4433fca9d9308c9891172b1", "indyzak", "FM-TOWNS", "Demo", 7520, Common::EN_ANY, Common::kPlatformFMTowns },
{ "399b217b0c8d65d0398076da486363a9", "indy3", "VGA", "VGA", 6295, Common::DE_DEU, Common::kPlatformPC },
{ "39cb9dec16fa16f38d79acd80effb059", "loom", "EGA", "EGA", -1, Common::FR_FRA, Common::kPlatformAmiga },
{ "39cb9dec16fa16f38d79acd80effb059", "loom", "EGA", "EGA", -1, Common::IT_ITA, Common::kPlatformAmiga },
@@ -290,7 +292,7 @@ static const MD5Table md5table[] = {
{ "6a30a07f353a75cdc602db27d73e1b42", "puttputt", "HE 70", "", -1, Common::EN_ANY, Common::kPlatformWindows },
{ "6a60d395b78b205c93a956100b1bf5ae", "pajama2", "HE 98.5", "", -1, Common::DE_DEU, Common::kPlatformUnknown },
{ "6af2419fe3db5c2fdb091ae4e5833770", "puttrace", "HE 98.5", "Demo", -1, Common::NL_NLD, Common::kPlatformUnknown },
- { "6b19d0e25cbf720d05822379b8b90ed9", "PuttTime", "HE 90", "Demo", -1, Common::NL_NLD, Common::kPlatformWindows },
+ { "6b19d0e25cbf720d05822379b8b90ed9", "PuttTime", "HE 90", "Demo", -1, Common::NL_NLD, Common::kPlatformUnknown },
{ "6b257bb2827dd894b8109a50a1a18b5a", "freddicove", "HE 100", "Demo", -1, Common::NL_NLD, Common::kPlatformUnknown },
{ "6b27dbcd8d5697d5c918eeca0f68ef6a", "puttrace", "HE CUP", "Preview", 3901484, Common::UNK_LANG, Common::kPlatformUnknown },
{ "6b3ec67da214f558dc5ceaa2acd47453", "indy3", "EGA", "EGA", -1, Common::EN_ANY, Common::kPlatformPC },
@@ -321,13 +323,13 @@ static const MD5Table md5table[] = {
{ "7410a8ba9795020cd42f171c4320659e", "pajama3", "", "", -1, Common::FR_FRA, Common::kPlatformWindows },
{ "746e88c172a5b7a1ae89ac0ee3ee681a", "freddi", "HE 90", "Updated", -1, Common::RU_RUS, Common::kPlatformWindows },
{ "74da3494fbe1a7d20213b0afe0954755", "catalog", "HE CUP", "Preview", 10841544, Common::FR_FRA, Common::kPlatformUnknown },
- { "754feb59d3bf86b8a00840df74fd7b26", "freddi3", "", "Demo", -1, Common::NL_NLD, Common::kPlatformWindows },
+ { "754feb59d3bf86b8a00840df74fd7b26", "freddi3", "", "Demo", -1, Common::NL_NLD, Common::kPlatformUnknown },
{ "75ba23fff4fd63fa446c02864f2a5a4b", "zak", "V2", "V2", -1, Common::IT_ITA, Common::kPlatformPC },
{ "75bff95816b84672b877d22a911ab811", "freddi3", "HE 99", "Updated", -1, Common::RU_RUS, Common::kPlatformWindows },
{ "76b66b43e593ad4d2f1dfb5cc8f19700", "spyfox", "HE 99", "", -1, Common::NL_NLD, Common::kPlatformWindows },
{ "771bc18ec6f93837b839c992b211904b", "monkey", "Demo", "EGA Demo", -1, Common::DE_DEU, Common::kPlatformPC },
{ "7766c9487f9d53a8cb0edabda5119c3d", "puttputt", "HE 60", "", 8022, Common::EN_ANY, Common::kPlatformPC },
- { "77f5c9cc0986eb729c1a6b4c8823bbae", "zak", "FM-TOWNS", "Demo", 7520, Common::EN_ANY, Common::kPlatformFMTowns },
+ { "77f5c9cc0986eb729c1a6b4c8823bbae", "zakloom", "FM-TOWNS", "Demo", 7520, Common::EN_ANY, Common::kPlatformFMTowns },
{ "780e4a0ae2ff17dc296f4a79543b44f8", "puttmoon", "", "", -1, Common::UNK_LANG, Common::kPlatformPC },
{ "782393c5934ecd0b536eaf5fd541bd26", "pajama", "HE 100", "Updated", -1, Common::EN_ANY, Common::kPlatformWindows },
{ "784b499c98d07260a30952685758636b", "pajama3", "", "Demo", 13911, Common::DE_DEU, Common::kPlatformWindows },
@@ -486,7 +488,7 @@ static const MD5Table md5table[] = {
{ "bfdf584b01503f0762baded581f6a0a2", "SoccerMLS", "", "", -1, Common::EN_ANY, Common::kPlatformWindows },
{ "c0039ad982999c92d0de81910d640fa0", "freddi", "HE 71", "", -1, Common::NL_NLD, Common::kPlatformWindows },
{ "c13225cb1bbd3bc9fe578301696d8021", "monkey", "SEGA", "", -1, Common::EN_ANY, Common::kPlatformSegaCD },
- { "c20848f53c2d48bfacdc840993843765", "freddi2", "HE 80", "Demo", -1, Common::NL_NLD, Common::kPlatformWindows },
+ { "c20848f53c2d48bfacdc840993843765", "freddi2", "HE 80", "Demo", -1, Common::NL_NLD, Common::kPlatformUnknown },
{ "c225bec1b6c0798a2b8c89ac226dc793", "pajama", "HE 100", "", -1, Common::EN_ANY, Common::kPlatformWii },
{ "c24c490373aeb48fbd54caa8e7ae376d", "loom", "No AdLib", "EGA", -1, Common::DE_DEU, Common::kPlatformAtariST },
{ "c25755b08a8d0d47695e05f1e2111bfc", "freddi4", "", "Demo", -1, Common::EN_USA, Common::kPlatformUnknown },
@@ -505,6 +507,7 @@ static const MD5Table md5table[] = {
{ "c7890e038806df2bb5c0c8c6f1986ea2", "monkey", "VGA", "VGA", -1, Common::EN_ANY, Common::kPlatformPC },
{ "c7be10f775404fd9785a8b92a06d240c", "atlantis", "FM-TOWNS", "", 12030, Common::EN_ANY, Common::kPlatformFMTowns },
{ "c7c492a107ec520d7a7943037d0ca54a", "freddi", "HE 71", "Demo", -1, Common::NL_NLD, Common::kPlatformWindows },
+ { "c8253da0f4626d2236b5291b99e33408", "puttcircus", "HE 99", "", -1, Common::HE_ISR, Common::kPlatformWindows },
{ "c83079157ec765a28de445aec9768d60", "tentacle", "", "Demo", 7477, Common::EN_ANY, Common::kPlatformUnknown },
{ "c8575e0b973ff1723aba6cd92c642db2", "puttrace", "HE 99", "Demo", -1, Common::FR_FRA, Common::kPlatformWindows },
{ "c8aac5e3e701874e2fa4117896f9e1b1", "freddi", "HE 73", "Demo", -1, Common::EN_ANY, Common::kPlatformMacintosh },
diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp
index d3cc218cd3..fc46f88df4 100644
--- a/engines/scumm/scumm.cpp
+++ b/engines/scumm/scumm.cpp
@@ -151,9 +151,6 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr)
_fileHandle = 0;
// Init all vars
- _v0ObjectIndex = false;
- _v0ObjectInInventory = false;
- _v0ObjectFlag = 0;
_imuse = NULL;
_imuseDigital = NULL;
_musicEngine = NULL;
@@ -266,7 +263,6 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr)
_bytesPerPixel = 1;
_doEffect = false;
_snapScroll = false;
- _currentLights = 0;
_shakeEnabled = false;
_shakeFrame = 0;
_screenStartStrip = 0;
@@ -701,10 +697,6 @@ ScummEngine_v2::ScummEngine_v2(OSystem *syst, const DetectorResult &dr)
_inventoryOffset = 0;
- _activeInventory = 0;
- _activeObject = 0;
- _activeVerb = 0;
-
VAR_SENTENCE_VERB = 0xFF;
VAR_SENTENCE_OBJECT1 = 0xFF;
VAR_SENTENCE_OBJECT2 = 0xFF;
@@ -719,19 +711,18 @@ ScummEngine_v2::ScummEngine_v2(OSystem *syst, const DetectorResult &dr)
ScummEngine_v0::ScummEngine_v0(OSystem *syst, const DetectorResult &dr)
: ScummEngine_v2(syst, dr) {
- _verbExecuting = false;
- _verbPickup = false;
_currentMode = 0;
+ _currentLights = 0;
+ _activeVerb = kVerbNone;
+ _activeObject = 0;
_activeObject2 = 0;
- _activeObjectIndex = 0;
- _activeObject2Index = 0;
- _activeInvExecute = false;
- _activeObject2Inv = false;
- _activeObjectObtained = false;
- _activeObject2Obtained = false;
-
- VAR_ACTIVE_ACTOR = 0xFF;
+
+ _cmdVerb = kVerbNone;
+ _cmdObject = 0;
+ _cmdObject2 = 0;
+
+ VAR_ACTIVE_OBJECT2 = 0xFF;
VAR_IS_SOUND_RUNNING = 0xFF;
VAR_ACTIVE_VERB = 0xFF;
}
@@ -1034,7 +1025,7 @@ Common::Error ScummEngine::init() {
// The kGenUnchanged method is only used for 'container files', i.e. files
// that contain the real game files bundled together in an archive format.
- // This is the case of the NES, C64 and Mac versions of certain games.
+ // This is the case of the NES, v0 and Mac versions of certain games.
// Note: All of these can also occur in 'extracted' form, in which case they
// are treated like any other SCUMM game.
if (_filenamePattern.genMethod == kGenUnchanged) {
@@ -1388,8 +1379,8 @@ void ScummEngine::setupCostumeRenderer() {
_costumeRenderer = new AkosRenderer(this);
_costumeLoader = new AkosCostumeLoader(this);
} else if (_game.version == 0) {
- _costumeRenderer = new C64CostumeRenderer(this);
- _costumeLoader = new C64CostumeLoader(this);
+ _costumeRenderer = new V0CostumeRenderer(this);
+ _costumeLoader = new V0CostumeLoader(this);
} else if (_game.platform == Common::kPlatformNES) {
_costumeRenderer = new NESCostumeRenderer(this);
_costumeLoader = new NESCostumeLoader(this);
@@ -1468,7 +1459,7 @@ void ScummEngine::resetScumm() {
_sortedActors = new Actor * [_numActors];
for (i = 0; i < _numActors; ++i) {
if (_game.version == 0)
- _actors[i] = new ActorC64(this, i);
+ _actors[i] = new Actor_v0(this, i);
else if (_game.version <= 2)
_actors[i] = new Actor_v2(this, i);
else if (_game.version == 3)
@@ -1973,6 +1964,14 @@ Common::Error ScummEngine::go() {
if (delta < 1) // Ensure we don't get into an endless loop
delta = 1; // by not decreasing sleepers.
+ // WORKAROUND: walking speed in the original v0/v1 interpreter
+ // is sometimes slower (e.g. during scrolling) than in ScummVM.
+ // This is important for the door-closing action in the dungeon,
+ // otherwise (delta < 6) a single kid is able to escape.
+ if ((_game.version == 0 && isScriptRunning(132)) ||
+ (_game.version == 1 && isScriptRunning(137)))
+ delta = 6;
+
// Wait...
waitForTimer(delta * 1000 / 60 - diff);
diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h
index d9237b2b30..2f1e536f0a 100644
--- a/engines/scumm/scumm.h
+++ b/engines/scumm/scumm.h
@@ -303,6 +303,19 @@ struct SaveStateMetaInfos {
uint32 playtime;
};
+enum UserStates {
+ USERSTATE_SET_FREEZE = 0x01, // freeze scripts if USERSTATE_FREEZE_ON is set, unfreeze otherwise
+ USERSTATE_SET_CURSOR = 0x02, // shows cursor if USERSTATE_CURSOR_ON is set, hides it otherwise
+ USERSTATE_SET_IFACE = 0x04, // change user-interface (sentence-line, inventory, verb-area)
+ USERSTATE_FREEZE_ON = 0x08, // only interpreted if USERSTATE_SET_FREEZE is set
+ USERSTATE_CURSOR_ON = 0x10, // only interpreted if USERSTATE_SET_CURSOR is set
+ USERSTATE_IFACE_SENTENCE = 0x20, // only interpreted if USERSTATE_SET_IFACE is set
+ USERSTATE_IFACE_INVENTORY = 0x40, // only interpreted if USERSTATE_SET_IFACE is set
+ USERSTATE_IFACE_VERBS = 0x80 // only interpreted if USERSTATE_SET_IFACE is set
+};
+
+#define USERSTATE_IFACE_ALL (USERSTATE_IFACE_SENTENCE | USERSTATE_IFACE_INVENTORY | USERSTATE_IFACE_VERBS)
+
/**
* A list of resource types.
* WARNING: Do not change the order of these, as the savegame format relies
@@ -502,10 +515,6 @@ protected:
int32 *_scummVars;
byte *_bitVars;
- bool _v0ObjectIndex; // V0 Use object index, instead of object number
- bool _v0ObjectInInventory; // V0 Use object number from inventory
- byte _v0ObjectFlag;
-
/* Global resource tables */
int _numVariables, _numBitVariables, _numLocalObjects;
int _numGlobalObjects, _numArray, _numVerbs, _numFlObject;
@@ -646,7 +655,7 @@ protected:
void updateScriptPtr();
virtual void runInventoryScript(int i);
void inventoryScriptIndy3Mac();
- void checkAndRunSentenceScript();
+ virtual void checkAndRunSentenceScript();
void runExitScript();
void runEntryScript();
void runAllScripts();
@@ -791,6 +800,9 @@ protected:
void setOwnerOf(int obj, int owner);
void clearOwnerOf(int obj);
int getObjectRoom(int obj) const;
+ virtual bool objIsActor(int obj);
+ virtual int objToActor(int obj);
+ virtual int actorToObj(int actor);
int getObjX(int obj);
int getObjY(int obj);
void getObjectXYPos(int object, int &x, int &y) { int dir; getObjectXYPos(object, x, y, dir); }
@@ -799,7 +811,6 @@ protected:
int getObjNewDir(int obj);
int getObjectIndex(int object) const;
int getObjectImageCount(int object);
- int whereIsObjectInventory(int object);
int whereIsObject(int object) const;
int findObject(int x, int y);
void findObjectInRoom(FindObjectInRoom *fo, byte findWhat, uint object, uint room);
@@ -820,7 +831,7 @@ protected:
virtual void clearDrawQueues();
uint32 getOBCDOffs(int object) const;
- byte *getOBCDFromObject(int obj);
+ byte *getOBCDFromObject(int obj, bool v0CheckInventory = true);
const byte *getOBIMFromObjectData(const ObjectData &od);
const byte *getObjectImage(const byte *ptr, int state);
virtual int getObjectIdFromOBIM(const byte *obim);
@@ -931,8 +942,7 @@ protected:
public:
bool isLightOn() const;
- byte _currentLights;
- int getCurrentLights() const;
+ virtual int getCurrentLights() const;
protected:
void initScreens(int b, int h);
diff --git a/engines/scumm/scumm_v0.h b/engines/scumm/scumm_v0.h
index af481df0e0..7f532c04d7 100644
--- a/engines/scumm/scumm_v0.h
+++ b/engines/scumm/scumm_v0.h
@@ -32,20 +32,35 @@ namespace Scumm {
*/
class ScummEngine_v0 : public ScummEngine_v2 {
protected:
+ enum CurrentMode {
+ kModeCutscene = 0, // cutscene active
+ kModeKeypad = 1, // kid selection / dial pad / save-load dialog
+ kModeNoNewKid = 2, // verb "new kid" disabled (e.g. when entering lab)
+ kModeNormal = 3 // normal playing mode
+ };
+
+ enum WalkToObjectState {
+ kWalkToObjectStateDone = 0,
+ kWalkToObjectStateWalk = 1,
+ kWalkToObjectStateTurn = 2
+ };
+
+protected:
byte _currentMode;
- bool _verbExecuting; // is a verb executing
- bool _verbPickup; // are we picking up an object during a verb execute
+ byte _currentLights;
- int _activeActor; // Actor Number
- int _activeObject2; // 2nd Object Number
+ int _activeVerb; // selected verb
+ int _activeObject; // 1st selected object (see OBJECT_V0())
+ int _activeObject2; // 2nd selected object or actor (see OBJECT_V0())
- bool _activeInvExecute; // is activeInventory first to be executed
- bool _activeObject2Inv; // is activeobject2 in the inventory
- bool _activeObjectObtained; // collected _activeobject?
- bool _activeObject2Obtained; // collected _activeObject2?
+ int _cmdVerb; // script verb
+ int _cmdObject; // 1st script object (see OBJECT_V0())
+ int _cmdObject2; // 2nd script object or actor (see OBJECT_V0())
+ int _sentenceNestedCount;
- int _activeObjectIndex;
- int _activeObject2Index;
+ int _walkToObject;
+ int _walkToObjectState;
+ bool _redrawSentenceLine;
public:
ScummEngine_v0(OSystem *syst, const DetectorResult &dr);
@@ -64,26 +79,33 @@ protected:
virtual void processInput();
- virtual void runObject(int obj, int entry);
virtual void saveOrLoad(Serializer *s);
- // V0 MM Verb commands
- int verbPrep(int object);
- bool verbMove(int object, int objectIndex, bool invObject);
- bool verbMoveToActor(int actor);
- bool verbObtain(int object, int objIndex);
- bool verbExecutes(int object, bool inventory = false);
- bool verbExec();
-
- int findObjectIndex(int x, int y);
+ virtual bool objIsActor(int obj);
+ virtual int objToActor(int obj);
+ virtual int actorToObj(int actor);
+ // V0 MM Verb commands
+ int getVerbPrepId();
+ int activeVerbPrep();
+ void walkToActorOrObject(int object);
+ void verbExec();
+
+ virtual void runSentenceScript();
+ virtual void checkAndRunSentenceScript();
+ bool checkPendingWalkAction();
+ bool checkSentenceComplete();
virtual void checkExecVerbs();
virtual void handleMouseOver(bool updateInventory);
+ int verbPrepIdType(int verbid);
void resetVerbs();
- void setNewKidVerbs();
- void drawSentenceWord(int object, bool usePrep, bool objInInventory);
- void drawSentence();
+ void clearSentenceLine();
+ void flushSentenceLine();
+ void drawSentenceObject(int object);
+ void drawSentenceLine();
+
+ void setMode(byte mode);
void switchActor(int slot);
@@ -92,12 +114,17 @@ protected:
virtual int getActiveObject();
- virtual void resetSentence(bool walking);
+ void resetSentence();
virtual bool areBoxesNeighbors(int box1nr, int box2nr);
- /* Version C64 script opcodes */
+ bool ifEqualActiveObject2Common(bool checkType);
+
+ virtual int getCurrentLights() const;
+
+ /* Version 0 script opcodes */
void o_stopCurrentScript();
+ void o_walkActorToObject();
void o_loadSound();
void o_getActorMoving();
void o_animateActor();
@@ -112,30 +139,30 @@ protected:
void o_lockScript();
void o_loadScript();
void o_lockRoom();
- void o_cursorCommand();
+ void o_setMode();
void o_lights();
void o_unlockCostume();
void o_unlockScript();
void o_decrement();
void o_nop();
+ void o_getObjectOwner();
void o_getActorBitVar();
void o_setActorBitVar();
void o_getBitVar();
void o_setBitVar();
void o_doSentence();
- void o_unknown2();
- void o_ifActiveObject();
- void o_getClosestObjActor();
- void o_printEgo_c64();
- void o_print_c64();
+ void o_ifEqualActiveObject2();
+ void o_ifNotEqualActiveObject2();
+ void o_getClosestActor();
+ void o_printEgo();
+ void o_print();
void o_unlockRoom();
void o_unlockSound();
void o_cutscene();
void o_endCutscene();
- void o_beginOverride();
void o_setOwnerOf();
- byte VAR_ACTIVE_ACTOR;
+ byte VAR_ACTIVE_OBJECT2;
byte VAR_IS_SOUND_RUNNING;
byte VAR_ACTIVE_VERB;
};
diff --git a/engines/scumm/scumm_v2.h b/engines/scumm/scumm_v2.h
index 47c5fa2626..316a08d325 100644
--- a/engines/scumm/scumm_v2.h
+++ b/engines/scumm/scumm_v2.h
@@ -44,17 +44,13 @@ protected:
Common::String _sentenceBuf;
uint16 _inventoryOffset;
- int _activeInventory;
- int _activeObject;
- int _activeVerb;
-
public:
ScummEngine_v2(OSystem *syst, const DetectorResult &dr);
virtual void resetScumm();
void checkV2MouseOver(Common::Point pos);
- void checkV2Inventory(int x, int y);
+ int checkV2Inventory(int x, int y);
void redrawV2Inventory();
protected:
@@ -89,8 +85,9 @@ protected:
void ifNotStateCommon(byte type);
void setStateCommon(byte type);
void clearStateCommon(byte type);
+ void stopScriptCommon(int script);
- virtual void resetSentence(bool walking);
+ void resetSentence();
void setUserState(byte state);
virtual void handleMouseOver(bool updateInventory);
@@ -100,6 +97,10 @@ protected:
virtual void setBuiltinCursor(int index);
+ void drawPreposition(int index);
+
+ void walkActorToObject(int actor, int obj);
+
/* Version 2 script opcodes */
void o2_actorFromPos();
void o2_actorOps();
diff --git a/engines/scumm/scumm_v5.h b/engines/scumm/scumm_v5.h
index b8a61c1677..0eef04b8de 100644
--- a/engines/scumm/scumm_v5.h
+++ b/engines/scumm/scumm_v5.h
@@ -87,6 +87,8 @@ protected:
void drawFlashlight();
+ void walkActorToActor(int actor, int toActor, int dist);
+
/**
* Fetch the next script word, then if cond is *false*, perform a relative jump.
* So this corresponds to a "jne" jump instruction.
diff --git a/engines/scumm/smush/smush_player.cpp b/engines/scumm/smush/smush_player.cpp
index 2f4e86bf61..a53b808ba1 100644
--- a/engines/scumm/smush/smush_player.cpp
+++ b/engines/scumm/smush/smush_player.cpp
@@ -90,13 +90,13 @@ public:
assert(def_end != NULL);
char *id_end = def_end;
- while (id_end >= def_start && !isdigit(static_cast<unsigned char>(*(id_end-1)))) {
+ while (id_end >= def_start && !Common::isDigit(*(id_end-1))) {
id_end--;
}
assert(id_end > def_start);
char *id_start = id_end;
- while (isdigit(static_cast<unsigned char>(*(id_start - 1)))) {
+ while (Common::isDigit(*(id_start - 1))) {
id_start--;
}
diff --git a/engines/scumm/sound.cpp b/engines/scumm/sound.cpp
index f058ef1a2c..1dc026ad52 100644
--- a/engines/scumm/sound.cpp
+++ b/engines/scumm/sound.cpp
@@ -94,6 +94,7 @@ Sound::Sound(ScummEngine *parent, Audio::Mixer *mixer)
Sound::~Sound() {
stopCDTimer();
g_system->getAudioCDManager()->stop();
+ free(_offsetTable);
}
void Sound::addSoundToQueue(int sound, int heOffset, int heChannel, int heFlags) {
diff --git a/engines/scumm/string.cpp b/engines/scumm/string.cpp
index 61bb89328d..975307d0d0 100644
--- a/engines/scumm/string.cpp
+++ b/engines/scumm/string.cpp
@@ -112,7 +112,7 @@ void ScummEngine::showMessageDialog(const byte *msg) {
if (_string[3].color == 0)
_string[3].color = 4;
- InfoDialog dialog(this, (char*)buf);
+ InfoDialog dialog(this, (char *)buf);
VAR(VAR_KEYPRESS) = runDialog(dialog);
}
@@ -1389,10 +1389,10 @@ void ScummEngine_v7::loadLanguageBundle() {
} else if (*ptr == '#') {
// Number of subtags following a given basetag. We don't need that
// information so we just skip it
- } else if (isdigit(static_cast<unsigned char>(*ptr))) {
+ } else if (Common::isDigit(*ptr)) {
int idx = 0;
// A number (up to three digits)...
- while (isdigit(static_cast<unsigned char>(*ptr))) {
+ while (Common::isDigit(*ptr)) {
idx = idx * 10 + (*ptr - '0');
ptr++;
}
@@ -1430,12 +1430,12 @@ void ScummEngine_v7::loadLanguageBundle() {
for (i = 0; i < _languageIndexSize; i++) {
// First 8 chars in the line give the string ID / 'tag'
int j;
- for (j = 0; j < 8 && !isspace(static_cast<unsigned char>(*ptr)); j++, ptr++)
+ for (j = 0; j < 8 && !Common::isSpace(*ptr); j++, ptr++)
_languageIndex[i].tag[j] = toupper(*ptr);
_languageIndex[i].tag[j] = 0;
// After that follows a single space which we skip
- assert(isspace(static_cast<unsigned char>(*ptr)));
+ assert(Common::isSpace(*ptr));
ptr++;
// Then comes the translated string: we record an offset to that.
diff --git a/engines/scumm/vars.cpp b/engines/scumm/vars.cpp
index 26a6a2f3b1..6d132c601f 100644
--- a/engines/scumm/vars.cpp
+++ b/engines/scumm/vars.cpp
@@ -115,7 +115,7 @@ void ScummEngine_v0::setupScummVars() {
VAR_CAMERA_POS_X = 2;
VAR_HAVE_MSG = 3;
VAR_ROOM = 4;
- VAR_ACTIVE_ACTOR = 5;
+ VAR_ACTIVE_OBJECT2 = 5;
VAR_OVERRIDE = 6;
VAR_IS_SOUND_RUNNING = 8;
VAR_ACTIVE_VERB = 9;
@@ -546,7 +546,7 @@ void ScummEngine_v8::setupScummVars() {
#endif
void ScummEngine_v0::resetScummVars() {
- resetSentence(false);
+ resetSentence();
VAR(VAR_EGO) = 3;
diff --git a/engines/scumm/verbs.cpp b/engines/scumm/verbs.cpp
index 67ed17c024..567ca31485 100644
--- a/engines/scumm/verbs.cpp
+++ b/engines/scumm/verbs.cpp
@@ -41,47 +41,58 @@ struct VerbSettings {
int id;
int x_pos;
int y_pos;
- int prep;
const char *name;
};
static const VerbSettings v0VerbTable_English[] = {
- { 1, 8, 0, 0, "Open"},
- { 2, 8, 1, 0, "Close"},
- { 3, 0, 2, 4, "Give"},
- { 4, 32, 0, 0, "Turn on"},
- { 5, 32, 1, 0, "Turn off"},
- { 6, 32, 2, 2, "Fix"},
- { 7, 24, 0, 0, "New Kid"},
- { 8, 24, 1, 2, "Unlock"},
- { 9, 0, 0, 0, "Push"},
- {10, 0, 1, 0, "Pull"},
- {11, 24, 2, 255, "Use"},
- {12, 8, 2, 0, "Read"},
- {13, 15, 0, 0, "Walk to"},
- {14, 15, 1, 0, "Pick up"},
- {15, 15, 2, 0, "What is"}
+ {kVerbOpen, 8, 0, "Open"},
+ {kVerbClose, 8, 1, "Close"},
+ {kVerbGive, 0, 2, "Give"},
+ {kVerbTurnOn, 32, 0, "Turn on"},
+ {kVerbTurnOff, 32, 1, "Turn off"},
+ {kVerbFix, 32, 2, "Fix"},
+ {kVerbNewKid, 24, 0, "New Kid"},
+ {kVerbUnlock, 24, 1, "Unlock"},
+ {kVerbPush, 0, 0, "Push"},
+ {kVerbPull, 0, 1, "Pull"},
+ {kVerbUse, 24, 2, "Use"},
+ {kVerbRead, 8, 2, "Read"},
+ {kVerbWalkTo, 15, 0, "Walk to"},
+ {kVerbPickUp, 15, 1, "Pick up"},
+ {kVerbWhatIs, 15, 2, "What is"}
};
-// FIXME: Replace * with the correct character
static const VerbSettings v0VerbTable_German[] = {
- { 1, 7, 0, 0, "$ffne"},
- { 2, 13, 1, 0, "Schlie*e"},
- { 3, 0, 2, 4, "Gebe"},
- { 4, 37, 1, 0, "Ein"},
- { 5, 37, 0, 0, "Aus"},
- { 6, 23, 1, 2, "Repariere"},
- { 7, 34, 2, 0, "Person"},
- { 8, 23, 0, 2, "Schlie*e auf"},
- { 9, 0, 0, 0, "Dr<cke"},
- {10, 0, 1, 0, "Ziehe"},
- {11, 23, 2, 255, "Benutz"},
- {12, 7, 2, 0, "Lese"},
- {13, 13, 0, 0, "Gehe zu"},
- {14, 7, 1, 0, "Nimm"},
- {15, 13, 2, 0, "Was ist"}
+ {kVerbOpen, 7, 0, "$ffne"},
+ {kVerbClose, 13, 1, "Schlie*e"},
+ {kVerbGive, 0, 2, "Gebe"},
+ {kVerbTurnOn, 37, 1, "Ein"},
+ {kVerbTurnOff, 37, 0, "Aus"},
+ {kVerbFix, 23, 1, "Repariere"},
+ {kVerbNewKid, 34, 2, "Person"},
+ {kVerbUnlock, 23, 0, "Schlie*e auf"},
+ {kVerbPush, 0, 0, "Dr<cke"},
+ {kVerbPull, 0, 1, "Ziehe"},
+ {kVerbUse, 23, 2, "Benutz"},
+ {kVerbRead, 7, 2, "Lese"},
+ {kVerbWalkTo, 13, 0, "Gehe zu"},
+ {kVerbPickUp, 7, 1, "Nimm"},
+ {kVerbWhatIs, 13, 2, "Was ist"}
};
+int ScummEngine_v0::verbPrepIdType(int verbid) {
+ switch (verbid) {
+ case kVerbUse: // depends on object1
+ return kVerbPrepObject;
+ case kVerbGive:
+ return kVerbPrepTo;
+ case kVerbUnlock: case kVerbFix:
+ return kVerbPrepWith;
+ default:
+ return kVerbPrepNone;
+ }
+}
+
void ScummEngine_v0::resetVerbs() {
VirtScreen *virt = &_virtscr[kVerbVirtScreen];
VerbSlot *vs;
@@ -112,62 +123,22 @@ void ScummEngine_v0::resetVerbs() {
vs->key = 0;
vs->center = 0;
vs->imgindex = 0;
- vs->prep = vtable[i - 1].prep;
+ vs->prep = verbPrepIdType(vtable[i - 1].id);
vs->curRect.left = vtable[i - 1].x_pos * 8;
vs->curRect.top = vtable[i - 1].y_pos * 8 + virt->topline + 8;
loadPtrToResource(rtVerb, i, (const byte*)vtable[i - 1].name);
}
}
-void ScummEngine_v0::setNewKidVerbs() {
- VirtScreen *virt = &_virtscr[kVerbVirtScreen];
- VerbSlot *vs;
- int i;
-
- for (i = 1; i < 16; i++)
- killVerb(i);
-
- for (i = 1; i < 4; i++) {
- vs = &_verbs[i];
- vs->verbid = i;
- vs->color = 5;
- vs->hicolor = 7;
- vs->dimcolor = 11;
- vs->type = kTextVerbType;
- vs->charset_nr = _string[0]._default.charset;
- vs->curmode = 1;
- vs->saveid = 0;
- vs->key = 0;
- vs->center = 0;
- vs->imgindex = 0;
- vs->prep = 0;
- vs->curRect.left = (i * 8) * 8;
- vs->curRect.top = virt->topline + 8;
-
- Actor *a = derefActor(VAR(96 + i), "setNewKidVerbs");
- loadPtrToResource(rtVerb, i, (const byte*)a->getActorName());
- }
- setUserState(191);
-}
-
void ScummEngine_v0::switchActor(int slot) {
- resetSentence(false);
-
- if (_currentRoom == 45)
- return;
-
- // radiation suit? don't let the player switch
- if (VAR(VAR_EGO) == 8)
- return;
+ resetSentence();
- // verbs disabled? or just new kid button?
- if (_currentMode == 0 || _currentMode == 1 || _currentMode == 2)
+ // actor switching only allowed during normal gamplay (not cutscene, ...)
+ if (_currentMode != kModeNormal)
return;
VAR(VAR_EGO) = VAR(97 + slot);
- resetVerbs();
actorFollowCamera(VAR(VAR_EGO));
- setUserState(247);
}
void ScummEngine_v2::initV2MouseOver() {
@@ -301,7 +272,7 @@ void ScummEngine_v2::checkV2MouseOver(Common::Point pos) {
int i, x, y, new_box = -1;
// Don't do anything unless the inventory is active
- if (!(_userState & 64)) {
+ if (!(_userState & USERSTATE_IFACE_INVENTORY)) {
_mouseOverBoxV2 = -1;
return;
}
@@ -354,14 +325,14 @@ void ScummEngine_v2::checkV2MouseOver(Common::Point pos) {
}
}
-void ScummEngine_v2::checkV2Inventory(int x, int y) {
+int ScummEngine_v2::checkV2Inventory(int x, int y) {
int inventoryArea = (_game.platform == Common::kPlatformNES) ? 48: 32;
int object = 0;
y -= _virtscr[kVerbVirtScreen].topline;
if ((y < inventoryArea) || !(_mouseAndKeyboardStat & MBS_LEFT_CLICK))
- return;
+ return 0;
if (_mouseOverBoxesV2[kInventoryUpArrow].rect.contains(x, y)) {
if (_inventoryOffset >= 2) {
@@ -382,18 +353,9 @@ void ScummEngine_v2::checkV2Inventory(int x, int y) {
}
if (object >= 4)
- return;
-
- object = findInventory(_scummVars[VAR_EGO], object + 1 + _inventoryOffset);
-
- if (object > 0) {
- if (_game.version == 0) {
- _activeInventory = object;
+ return 0;
- } else {
- runInputScript(kInventoryClickArea, object, 0);
- }
- }
+ return findInventory(_scummVars[VAR_EGO], object + 1 + _inventoryOffset);
}
void ScummEngine_v2::redrawV2Inventory() {
@@ -406,7 +368,7 @@ void ScummEngine_v2::redrawV2Inventory() {
_mouseOverBoxV2 = -1;
- if (!(_userState & 64)) // Don't draw inventory unless active
+ if (!(_userState & USERSTATE_IFACE_INVENTORY)) // Don't draw inventory unless active
return;
// Clear on all invocations
@@ -431,9 +393,7 @@ void ScummEngine_v2::redrawV2Inventory() {
_string[1].right = _mouseOverBoxesV2[i].rect.right - 1;
_string[1].color = _mouseOverBoxesV2[i].color;
- _v0ObjectInInventory = true;
const byte *tmp = getObjOrActorName(obj);
- _v0ObjectInInventory = false;
assert(tmp);
// Prevent inventory entries from overflowing by truncating the text
@@ -472,7 +432,7 @@ void ScummEngine_v2::redrawV2Inventory() {
}
void ScummEngine::redrawVerbs() {
- if (_game.version <= 2 && !(_userState & 128)) // Don't draw verbs unless active
+ if (_game.version <= 2 && !(_userState & USERSTATE_IFACE_VERBS)) // Don't draw verbs unless active
return;
int i, verb = 0;
@@ -516,7 +476,6 @@ void ScummEngine_v2::handleMouseOver(bool updateInventory) {
}
void ScummEngine_v0::handleMouseOver(bool updateInventory) {
- drawSentence();
ScummEngine_v2::handleMouseOver(updateInventory);
}
@@ -674,15 +633,8 @@ void ScummEngine_v2::checkExecVerbs() {
if (object != -1) {
object = findInventory(_scummVars[VAR_EGO], object + 1 + _inventoryOffset);
-
- if (object > 0) {
- if (_game.version == 0) {
- _activeInventory = object;
-
- } else {
- runInputScript(kInventoryClickArea, object, 0);
- }
- }
+ if (object > 0)
+ runInputScript(kInventoryClickArea, object, 0);
return;
}
@@ -703,7 +655,9 @@ void ScummEngine_v2::checkExecVerbs() {
runInputScript(kSentenceClickArea, 0, 0);
} else if (zone->number == kVerbVirtScreen && _mouse.y > zone->topline + inventoryArea) {
// Click into V2 inventory
- checkV2Inventory(_mouse.x, _mouse.y);
+ int object = checkV2Inventory(_mouse.x, _mouse.y);
+ if (object > 0)
+ runInputScript(kInventoryClickArea, object, 0);
} else {
over = findVerbAtPos(_mouse.x, _mouse.y);
if (over != 0) {
@@ -717,550 +671,210 @@ void ScummEngine_v2::checkExecVerbs() {
}
}
-void ScummEngine_v0::runObject(int obj, int entry) {
- bool prev = _v0ObjectInInventory;
-
- if (getVerbEntrypoint(obj, entry) == 0) {
- // If nothing was found, attempt to find the 'WHAT-IS' verb script
- // (which is not really the what-is script, as this verb never actually executes
- // it merely seems to be some type of fallback)
- if (getVerbEntrypoint(obj, 0x0F) != 0) {
- entry = 0x0F;
- }
- }
-
- _v0ObjectInInventory = prev;
-
- if (getVerbEntrypoint(obj, entry) != 0) {
- _v0ObjectInInventory = prev;
- runObjectScript(obj, entry, false, false, NULL);
- } else if (entry != 13 && entry != 15) {
- if (_activeVerb != 3) {
- VAR(VAR_ACTIVE_VERB) = entry;
- runScript(3, 0, 0, 0);
-
- // For some reasons, certain objects don't have a "give" script
- } else if (VAR(VAR_ACTIVE_ACTOR) > 0 && VAR(VAR_ACTIVE_ACTOR) < 8) {
- if (_activeInventory)
- setOwnerOf(_activeInventory, VAR(VAR_ACTIVE_ACTOR));
- }
- }
-}
-
-bool ScummEngine_v0::verbMoveToActor(int actor) {
- Actor *a = derefActor(VAR(VAR_EGO), "verbMoveToActor");
- Actor *a2 = derefActor(actor, "verbMoveToActor");
- int dist = getDist(a->getRealPos().x, a->getRealPos().y, a2->getRealPos().x, a2->getRealPos().y);
-
- if (!a->_moving && dist > 4) {
- a->startWalkActor(a2->getRealPos().x, a2->getRealPos().y, -1);
+int ScummEngine_v0::getVerbPrepId() {
+ if (_verbs[_activeVerb].prep != 0xFF) {
+ return _verbs[_activeVerb].prep;
} else {
- if (dist <= 4) {
- a->stopActorMoving();
- return false;
- }
+ byte *ptr = getOBCDFromObject(_activeObject, true);
+ assert(ptr);
+ return (*(ptr + 11) >> 5);
}
-
- return true;
}
-bool ScummEngine_v0::verbMove(int object, int objectIndex, bool invObject) {
- int x, y, dir;
- Actor *a = derefActor(VAR(VAR_EGO), "verbMove");
-
- if (_currentMode != 3 && _currentMode != 2)
- return false;
-
- _v0ObjectIndex = true;
- getObjectXYPos(objectIndex, x, y, dir);
- _v0ObjectIndex = false;
-
- // Detect distance from target object
- int dist = getDist(a->getRealPos().x, a->getRealPos().y, x, y);
-
- if (a->_moving)
- return true;
-
- if (dist > 5) {
- a->startWalkActor(x, y, dir);
- VAR(6) = x;
- VAR(7) = y;
- return true;
- } else {
- // Finished walk, are we picking up the item?
- if (_verbPickup) {
- int oldActive = _activeObject, oldIndex = _activeObjectIndex;
- _activeObject = object;
- _activeObjectIndex = objectIndex;
-
- _v0ObjectIndex = true;
- // Execute pickup
- runObject(objectIndex, 14);
- _v0ObjectIndex = false;
-
- _activeObject = oldActive;
- _activeObjectIndex = oldIndex;
-
- // Finished picking up
- _verbPickup = false;
- }
- }
-
- return false;
+int ScummEngine_v0::activeVerbPrep() {
+ if (!_activeVerb || !_activeObject)
+ return 0;
+ return getVerbPrepId();
}
-bool ScummEngine_v0::verbObtain(int obj, int objIndex) {
- bool didPickup = false;
+void ScummEngine_v0::verbExec() {
+ _sentenceNum = 0;
+ _sentenceNestedCount = 0;
- int prep, where = whereIsObjectInventory(obj);
-
- if (objIndex == 0)
- return false;
-
- // Object in inventory ?
- if (where != WIO_INVENTORY) {
- _v0ObjectIndex = true;
- prep = verbPrep(objIndex);
-
- if (prep == 1 || prep == 4) {
- if (_activeVerb != 13 && _activeVerb != 14) {
- _verbPickup = true;
- didPickup = true;
- }
- } else {
- _verbPickup = false;
- }
-
- // Ignore verbs?
- Actor *a = derefActor(VAR(VAR_EGO), "verbObtain");
- if (((ActorC64 *)a)->_miscflags & 0x40) {
- resetSentence(false);
- return false;
+ if (_activeVerb == kVerbWhatIs)
+ return;
+
+ if (!(_activeVerb == kVerbWalkTo && _activeObject == 0)) {
+ doSentence(_activeVerb, _activeObject, _activeObject2);
+ if (_activeVerb != kVerbWalkTo) {
+ _activeVerb = kVerbWalkTo;
+ _activeObject = 0;
+ _activeObject2 = 0;
}
-
- //attempt move to object
- if (verbMove(obj, objIndex, false))
- return true;
-
- if (didPickup && (prep == 1 || prep == 4))
- if (_activeVerb != 13 && _activeVerb != 14) {
- _v0ObjectInInventory = true;
-
- if (whereIsObject(obj) == WIO_INVENTORY)
- _activeInventory = obj;
- else
- resetSentence(false);
-
- _v0ObjectInInventory = false;
- }
+ _walkToObjectState = kWalkToObjectStateDone;
+ return;
}
- return false;
-}
-
-int ScummEngine_v0::verbPrep(int object) {
- if (!_v0ObjectInInventory)
- _v0ObjectIndex = true;
- else
- _v0ObjectIndex = false;
+ Actor_v0 *a = (Actor_v0 *)derefActor(VAR(VAR_EGO), "verbExec");
+ int x = _virtualMouse.x / V12_X_MULTIPLIER;
+ int y = _virtualMouse.y / V12_Y_MULTIPLIER;
+ //actorSetPosInBox();
- byte *ptr = getOBCDFromObject(object);
- _v0ObjectIndex = false;
- assert(ptr);
- return (*(ptr + 11) >> 5);
-}
+ // 0xB31
+ VAR(6) = x;
+ VAR(7) = y;
-bool ScummEngine_v0::verbExecutes(int object, bool inventory) {
- _v0ObjectInInventory = inventory;
- int prep = verbPrep(object);
-
- if (prep == 2 || prep == 0) {
- return true;
- }
+ if (a->_miscflags & kActorMiscFlagFreeze)
+ return;
- return false;
+ a->stopActorMoving();
+ a->startWalkActor(VAR(6), VAR(7), -1);
}
-bool ScummEngine_v0::verbExec() {
- int prep = 0;
- int entry = (_currentMode != 0 && _currentMode != 1) ? _activeVerb : 15;
-
- if ((!_activeInvExecute && _activeObject && getObjectIndex(_activeObject) == -1)) {
- resetSentence(false);
- return false;
- }
-
- // Lets try walk to the object
- if (_activeObject && _activeObjectIndex && !_activeObjectObtained && _currentMode != 0) {
- prep = verbPrep(_activeObjectIndex);
-
- if (verbObtain(_activeObject, _activeObjectIndex))
+bool ScummEngine_v0::checkSentenceComplete() {
+ if (_activeVerb && _activeVerb != kVerbWalkTo && _activeVerb != kVerbWhatIs) {
+ if (_activeObject && (!activeVerbPrep() || _activeObject2))
return true;
-
- _activeObjectObtained = true;
}
-
- // Attempt to obtain/reach object2
- if (_activeObject2 && _activeObject2Index && !_activeObject2Obtained && _currentMode != 0) {
- prep = verbPrep(_activeObject2Index);
-
- _v0ObjectInInventory = false;
- if (verbObtain(_activeObject2, _activeObject2Index))
- return true;
-
- if (prep != 1 && prep != 4) {
- _activeInventory = _activeObject;
- _activeObject = _activeObject2;
- _activeObjectIndex = _activeObject2Index;
- _activeObject2 = 0;
- _activeObject2Index = 0;
- }
-
- _activeObject2Obtained = true;
- }
-
- // Give-To
- if (_activeVerb == 3 && _activeInventory && _activeActor) {
- // FIXME: Actors need to turn and face each other
- if (verbMoveToActor(_activeActor)) {
- // Ignore verbs?
- Actor *a = derefActor(VAR(VAR_EGO), "verbExec");
- if (((ActorC64 *)a)->_miscflags & 0x40) {
- resetSentence(false);
- return false;
- }
-
- return true;
- }
- _v0ObjectInInventory = true;
- VAR(VAR_ACTIVE_ACTOR) = _activeActor;
- runObject(_activeInventory , 3);
- _v0ObjectInInventory = false;
-
- resetSentence(false);
- return false;
- }
-
- // Where we performing an action on an actor?
- if (_activeActor) {
- _v0ObjectIndex = true;
- runObject(_activeActor, entry);
- _v0ObjectIndex = false;
- _verbExecuting = false;
-
- resetSentence(false);
- return false;
- }
-
- // If we've finished walking (now near target), execute the action
- if (_activeObject && _activeObjectIndex && verbPrep(_activeObjectIndex) == 2) {
- _v0ObjectIndex = true;
- runObject(_activeObjectIndex, entry);
- _v0ObjectIndex = false;
- _verbExecuting = false;
-
- if ((_currentMode == 3 || _currentMode == 2) && _activeVerb == 13)
- return false;
-
- resetSentence(false);
- return false;
- }
-
- // We acted on an inventory item
- if (_activeInventory && verbExecutes(_activeInventory, true) && _activeVerb != 3) {
- _v0ObjectInInventory = true;
- _activeObject = _activeInventory;
- runObject(_activeInventory, _activeVerb);
-
- _verbExecuting = false;
-
- if (_currentMode == 3 && _activeVerb == 13) {
- resetSentence(true);
- return false;
- }
-
- resetSentence(false);
- return false;
- }
-
- // Item not in inventory is executed
- if (_activeObject) {
- _v0ObjectIndex = true;
- runObject(_activeObjectIndex, entry);
- _v0ObjectIndex = false;
- } else if (_activeInventory) {
- // Not sure this is the correct way to do this,
- // however its working for most situations - segra
- if (verbExecutes(_activeInventory, true) == false) {
- if (_activeObject2 && _activeObject2Inv && verbExecutes(_activeObject2, true)) {
- _v0ObjectInInventory = true;
-
- _activeObject = _activeInventory;
- _activeInventory = _activeObject2;
-
- runObject(_activeObject, _activeVerb);
- } else {
- _v0ObjectInInventory = true;
-
- if (_activeObject2) {
- _activeObject = _activeObject2;
-
- runObject(_activeObject, _activeVerb);
- } else
- runObject(_activeInventory, _activeVerb);
- }
- } else {
- _v0ObjectInInventory = true;
- runObject(_activeInventory, _activeVerb);
- }
- }
-
- _verbExecuting = false;
-
- if (_activeVerb == 13) {
- resetSentence(true);
- return false;
- }
-
- resetSentence(false);
-
return false;
}
void ScummEngine_v0::checkExecVerbs() {
- ActorC64 *a = (ActorC64 *)derefActor(VAR(VAR_EGO), "checkExecVerbs");
+ Actor_v0 *a = (Actor_v0 *)derefActor(VAR(VAR_EGO), "checkExecVerbs");
VirtScreen *zone = findVirtScreen(_mouse.y);
- // Is a verb currently executing
- if (_verbExecuting) {
- // Check if mouse click
- if (_mouseAndKeyboardStat & MBS_MOUSE_MASK) {
- int over = findVerbAtPos(_mouse.x, _mouse.y);
- int act = getActorFromPos(_virtualMouse.x, _virtualMouse.y);
- int obj = findObject(_virtualMouse.x, _virtualMouse.y);
-
- if (over && over != _activeVerb) {
+ bool execute = false;
+
+ if (_mouseAndKeyboardStat & MBS_MOUSE_MASK) {
+ int over = findVerbAtPos(_mouse.x, _mouse.y);
+ // click region: verbs
+ if (over) {
+ if (_activeVerb != over) { // new verb
+ // keep first object if no preposition is used yet
+ if (activeVerbPrep())
+ _activeObject = 0;
+ _activeObject2 = 0;
_activeVerb = over;
- _verbExecuting = false;
- return;
- }
-
- if (!obj && !act && !over) {
- resetSentence(false);
+ _redrawSentenceLine = true;
} else {
- a->stopActorMoving();
+ // execute sentence if complete
+ if (checkSentenceComplete())
+ execute = true;
}
- } else {
-
- if (_verbExecuting && !verbExec())
- return;
}
}
- // What-Is selected, any object we hover over is selected, on mouse press we set to WalkTo
- if (_activeVerb == 15) {
- int obj = findObject(_virtualMouse.x, _virtualMouse.y);
- int objIdx = findObjectIndex(_virtualMouse.x, _virtualMouse.y);
- _activeObject = obj;
- _activeObjectIndex = objIdx;
-
- if ((_mouseAndKeyboardStat & MBS_MOUSE_MASK))
- _activeVerb = 13; // Walk-To
-
- return;
+ if (a->_miscflags & kActorMiscFlagHide) {
+ if (_activeVerb != kVerbNewKid) {
+ _activeVerb = kVerbNone;
+ }
}
- if (_userPut <= 0 || _mouseAndKeyboardStat == 0)
- return;
-
- if (_mouseAndKeyboardStat < MBS_MAX_KEY) {
- /* Check keypresses */
- // TODO
- } else if (_mouseAndKeyboardStat & MBS_MOUSE_MASK) {
- if (zone->number == kVerbVirtScreen && _mouse.y <= zone->topline + 8) {
- // TODO
- } else if (zone->number == kVerbVirtScreen && _mouse.y > zone->topline + 32) {
- int prevInventory = _activeInventory;
- int invOff = _inventoryOffset;
-
- // Click into V2 inventory
- checkV2Inventory(_mouse.x, _mouse.y);
-
- // Did the Inventory position changed (arrows pressed, do nothing)
- if (invOff != _inventoryOffset)
- return;
-
- // No inventory selected?
- if (!_activeInventory)
- return;
+ if (_currentMode != kModeCutscene) {
+ if (_currentMode == kModeKeypad) {
+ _activeVerb = kVerbPush;
+ }
- // Did we just change the selected inventory item?
- if (prevInventory && prevInventory != _activeInventory && _activeInventory != _activeObject2) {
- _v0ObjectInInventory = true;
- int prep = verbPrep(_activeInventory);
- _v0ObjectInInventory = true;
- int prep2 = verbPrep(prevInventory);
-
- // Should the new inventory object remain as the secondary selected object
- // Or should the new inventory object become primary?
- if (prep != prep2 || prep != 1) {
- if (prep == 1 || prep == 3) {
- int tmp = _activeInventory;
- _activeInventory = prevInventory;
- prevInventory = tmp;
+ if (_mouseAndKeyboardStat > 0 && _mouseAndKeyboardStat < MBS_MAX_KEY) {
+ // keys already checked by input handler
+ } else if ((_mouseAndKeyboardStat & MBS_MOUSE_MASK) || _activeVerb == kVerbWhatIs) {
+ // click region: sentence line
+ if (zone->number == kVerbVirtScreen && _mouse.y <= zone->topline + 8) {
+ if (_activeVerb == kVerbNewKid) {
+ if (_currentMode == kModeNormal) {
+ int kid;
+ int lineX = _mouse.x >> V12_X_SHIFT;
+ if (lineX < 11)
+ kid = 0;
+ else if (lineX < 25)
+ kid = 1;
+ else
+ kid = 2;
+ _activeVerb = kVerbWalkTo;
+ _redrawSentenceLine = true;
+ drawSentenceLine();
+ switchActor(kid);
}
- }
-
- // Setup object2
- _activeObject = 0;
- _activeInvExecute = true;
- _activeObject2Inv = true;
- _activeObject2 = _activeInventory;
- _activeInventory = prevInventory;
- return;
- }
-
- // is the new selected inventory the same as the last selected?, reset to previous if it is
- if (_activeInventory == _activeObject2)
- _activeInventory = prevInventory;
-
- // Inventory Selected changed
- if (prevInventory != _activeInventory)
- if (!_activeObject2 || prevInventory != _activeObject2)
- return;
-
- if (_activeVerb == 11 && !(((_activeObject || _activeInventory)) || !_activeObject2))
- return;
- } else {
- int over = findVerbAtPos(_mouse.x, _mouse.y);
- int act = getActorFromPos(_virtualMouse.x, _virtualMouse.y);
- int obj = findObject(_virtualMouse.x, _virtualMouse.y);
- int objIdx = findObjectIndex(_virtualMouse.x, _virtualMouse.y);
-
- // If we already have an object selected, and we just clicked an actor
- // Clear any object we may of also clicked on
- if ((_activeObject || _activeInventory) && act) {
- obj = 0;
- objIdx = 0;
- }
-
- if (a->_miscflags & 0x80) {
- if (_activeVerb != 7 && over != 7) {
- _activeVerb = 0;
- over = 0;
- }
- }
-
- // Handle New Kid verb options
- if (_activeVerb == 7 || over == 7) {
- // Disable New-Kid (in the secret lab)
- if (_currentMode == 2 || _currentMode == 0)
- return;
-
- if (_activeVerb == 7 && over) {
- _activeVerb = 13;
- switchActor(_verbs[over].verbid - 1);
+ _activeVerb = kVerbWalkTo;
+ _redrawSentenceLine = true;
return;
+ } else {
+ // execute sentence if complete
+ if (checkSentenceComplete())
+ execute = true;
}
-
- setNewKidVerbs();
- _activeVerb = 7;
-
- return;
- }
-
- // Clicked on nothing, walk here?
- if (!over && !act && _activeVerb == 13 && !obj && _currentMode != 0) {
- // Clear all selected
- resetSentence(false);
-
- // 0xB31
- VAR(6) = _virtualMouse.x / V12_X_MULTIPLIER;
- VAR(7) = _virtualMouse.y / V12_Y_MULTIPLIER;
-
- if (zone->number == kMainVirtScreen) {
- // Ignore verbs?
- if (a->_miscflags & 0x40) {
- resetSentence(false);
+ // click region: inventory or main screen
+ } else if ((zone->number == kVerbVirtScreen && _mouse.y > zone->topline + 32) ||
+ (zone->number == kMainVirtScreen))
+ {
+ int obj = 0;
+
+ // click region: inventory
+ if (zone->number == kVerbVirtScreen && _mouse.y > zone->topline + 32) {
+ // click into inventory
+ int invOff = _inventoryOffset;
+ obj = checkV2Inventory(_mouse.x, _mouse.y);
+ if (invOff != _inventoryOffset) {
+ // inventory position changed (arrows pressed, do nothing)
return;
}
- a->stopActorMoving();
- a->startWalkActor(VAR(6), VAR(7), -1);
- _verbExecuting = true;
- }
- return;
- }
-
- // No new verb, use previous
- if (over == 0)
- over = _activeVerb;
-
- // No verb selected, use walk-to
- if (!_activeVerb)
- _activeVerb = over = 13; // Walk-To
-
- // New verb selected
- if (_activeVerb != over) {
- _activeVerb = over;
- if (_activeVerb == 13) {
- resetSentence(false);
- }
- return;
- }
-
- // Only allowing targetting actors if its the GIVE/USE verb
- if (_activeVerb == 3 || _activeVerb == 11) {
- // Different actor selected?
- if (act) {
- if (_activeActor != act) {
- _activeActor = act;
- return;
+ // the second object of a give-to command has to be an actor
+ if (_activeVerb == kVerbGive && _activeObject)
+ obj = 0;
+ // click region: main screen
+ } else if (zone->number == kMainVirtScreen) {
+ // click into main screen
+ if (_activeVerb == kVerbGive && _activeObject) {
+ int actor = getActorFromPos(_virtualMouse.x, _virtualMouse.y);
+ if (actor != 0)
+ obj = OBJECT_V0(actor, kObjectV0TypeActor);
+ } else {
+ obj = findObject(_virtualMouse.x, _virtualMouse.y);
}
}
- }
-
- if (obj && obj != _activeObject) {
- if (!_activeObject)
- if (_activeInventory)
- _activeInvExecute = true;
- // USE
- if (_activeVerb == 11 || _activeVerb == 8) {
- if (obj != _activeObject || obj != _activeObject2) {
- if (!_activeObject || _activeInventory) {
+ if (!obj) {
+ if (_activeVerb == kVerbWalkTo) {
+ _activeObject = 0;
+ _activeObject2 = 0;
+ }
+ } else {
+ if (activeVerbPrep() == kVerbPrepNone) {
+ if (obj == _activeObject)
+ execute = true;
+ else
_activeObject = obj;
- _activeObjectIndex = objIdx;
- return;
- } else {
- if (_activeObject2 != obj) {
- _activeObject2 = obj;
- _activeObject2Index = objIdx;
- return;
- }
+ // immediately execute action in keypad/selection mode
+ if (_currentMode == kModeKeypad)
+ execute = true;
+ } else {
+ if (obj == _activeObject2)
+ execute = true;
+ if (obj != _activeObject) {
+ _activeObject2 = obj;
+ if (_currentMode == kModeKeypad)
+ execute = true;
}
}
- } else {
- a->stopActorMoving();
-
- _activeObject = obj;
- _activeObjectIndex = objIdx;
-
- if (_activeVerb != 13)
- return;
+ }
- //return;
+ _redrawSentenceLine = true;
+ if (_activeVerb == kVerbWalkTo && zone->number == kMainVirtScreen) {
+ _walkToObjectState = kWalkToObjectStateDone;
+ execute = true;
}
}
}
+ }
- _verbExecuting = true;
+ if (_redrawSentenceLine)
+ drawSentenceLine();
- } // mouse k/b action
+ if (!execute || !_activeVerb)
+ return;
+
+ if (_activeVerb == kVerbWalkTo)
+ verbExec();
+ else if (_activeObject) {
+ // execute if we have a 1st object and either have or do not need a 2nd
+ if (activeVerbPrep() == kVerbPrepNone || _activeObject2)
+ verbExec();
+ }
}
void ScummEngine::verbMouseOver(int verb) {
// Don't do anything unless verbs are active
- if (_game.version <= 2 && !(_userState & 128))
+ if (_game.version <= 2 && !(_userState & USERSTATE_IFACE_VERBS))
return;
if (_game.id == GID_FT)
diff --git a/engines/scumm/verbs.h b/engines/scumm/verbs.h
index fb4dc969e2..0aa008b4de 100644
--- a/engines/scumm/verbs.h
+++ b/engines/scumm/verbs.h
@@ -57,6 +57,34 @@ struct VerbSlot {
uint16 imgindex;
};
+enum VerbsV0 {
+ kVerbNone = 0,
+ kVerbOpen = 1,
+ kVerbClose = 2,
+ kVerbGive = 3,
+ kVerbTurnOn = 4,
+ kVerbTurnOff = 5,
+ kVerbFix = 6,
+ kVerbNewKid = 7,
+ kVerbUnlock = 8,
+ kVerbPush = 9,
+ kVerbPull = 10,
+ kVerbUse = 11,
+ kVerbRead = 12,
+ kVerbWalkTo = 13,
+ kVerbPickUp = 14,
+ kVerbWhatIs = 15
+};
+
+enum VerbPrepsV0 {
+ kVerbPrepNone = 0,
+ kVerbPrepIn = 1,
+ kVerbPrepWith = 2,
+ kVerbPrepOn = 3,
+ kVerbPrepTo = 4,
+ kVerbPrepObject = 0xFF // prep depends on object (USE)
+};
+
} // End of namespace Scumm
#endif
diff --git a/engines/sky/autoroute.cpp b/engines/sky/autoroute.cpp
index 5273b21807..ab791cb066 100644
--- a/engines/sky/autoroute.cpp
+++ b/engines/sky/autoroute.cpp
@@ -242,7 +242,7 @@ uint16 AutoRoute::autoRoute(Compact *cpt) {
clipCoordX(cpt->arTargetX, destX, initDestX);
clipCoordY(cpt->arTargetY, destY, initDestY);
- uint16 *routeDest = (uint16*)_skyCompact->fetchCpt(cpt->animScratchId);
+ uint16 *routeDest = (uint16 *)_skyCompact->fetchCpt(cpt->animScratchId);
memset(routeDest, 0, 64);
if ((startX == destX) && (startY == destY))
return 2;
diff --git a/engines/sky/compact.cpp b/engines/sky/compact.cpp
index fd81cb9bea..cf9bd55b1a 100644
--- a/engines/sky/compact.cpp
+++ b/engines/sky/compact.cpp
@@ -34,7 +34,7 @@ namespace Sky {
#define SKY_CPT_SIZE 419427
-#define OFFS(type,item) (((ptrdiff_t)(&((type*)42)->item))-42)
+#define OFFS(type,item) (((ptrdiff_t)(&((type *)42)->item))-42)
#define MK32(type,item) OFFS(type, item),0,0,0
#define MK16(type,item) OFFS(type, item),0
#define MK32_A5(type, item) MK32(type, item[0]), MK32(type, item[1]), \
@@ -147,28 +147,28 @@ SkyCompact::SkyCompact() {
_numDataLists = _cptFile->readUint16LE();
_cptNames = (char***)malloc(_numDataLists * sizeof(char**));
_dataListLen = (uint16 *)malloc(_numDataLists * sizeof(uint16));
- _cptSizes = (uint16 **)malloc(_numDataLists * sizeof(uint16*));
- _cptTypes = (uint16 **)malloc(_numDataLists * sizeof(uint16*));
+ _cptSizes = (uint16 **)malloc(_numDataLists * sizeof(uint16 *));
+ _cptTypes = (uint16 **)malloc(_numDataLists * sizeof(uint16 *));
_compacts = (Compact***)malloc(_numDataLists * sizeof(Compact**));
for (int i = 0; i < _numDataLists; i++) {
_dataListLen[i] = _cptFile->readUint16LE();
- _cptNames[i] = (char**)malloc(_dataListLen[i] * sizeof(char*));
+ _cptNames[i] = (char**)malloc(_dataListLen[i] * sizeof(char *));
_cptSizes[i] = (uint16 *)malloc(_dataListLen[i] * sizeof(uint16));
_cptTypes[i] = (uint16 *)malloc(_dataListLen[i] * sizeof(uint16));
- _compacts[i] = (Compact**)malloc(_dataListLen[i] * sizeof(Compact*));
+ _compacts[i] = (Compact**)malloc(_dataListLen[i] * sizeof(Compact *));
}
uint32 rawSize = _cptFile->readUint32LE() * sizeof(uint16);
- uint16 *rawPos = _rawBuf = (uint16*)malloc(rawSize);
+ uint16 *rawPos = _rawBuf = (uint16 *)malloc(rawSize);
uint32 srcSize = _cptFile->readUint32LE() * sizeof(uint16);
- uint16 *srcBuf = (uint16*)malloc(srcSize);
+ uint16 *srcBuf = (uint16 *)malloc(srcSize);
uint16 *srcPos = srcBuf;
_cptFile->read(srcBuf, srcSize);
uint32 asciiSize = _cptFile->readUint32LE();
- char *asciiPos = _asciiBuf = (char*)malloc(asciiSize);
+ char *asciiPos = _asciiBuf = (char *)malloc(asciiSize);
_cptFile->read(_asciiBuf, asciiSize);
// and fill them with the compact data
@@ -177,7 +177,7 @@ SkyCompact::SkyCompact() {
_cptSizes[lcnt][ecnt] = READ_LE_UINT16(srcPos++);
if (_cptSizes[lcnt][ecnt]) {
_cptTypes[lcnt][ecnt] = READ_LE_UINT16(srcPos++);
- _compacts[lcnt][ecnt] = (Compact*)rawPos;
+ _compacts[lcnt][ecnt] = (Compact *)rawPos;
_cptNames[lcnt][ecnt] = asciiPos;
asciiPos += strlen(asciiPos) + 1;
@@ -193,7 +193,7 @@ SkyCompact::SkyCompact() {
free(srcBuf);
uint16 numDlincs = _cptFile->readUint16LE();
- uint16 *dlincBuf = (uint16*)malloc(numDlincs * 2 * sizeof(uint16));
+ uint16 *dlincBuf = (uint16 *)malloc(numDlincs * 2 * sizeof(uint16));
uint16 *dlincPos = dlincBuf;
_cptFile->read(dlincBuf, numDlincs * 2 * sizeof(uint16));
// these compacts don't actually exist but only point to other ones...
@@ -213,13 +213,13 @@ SkyCompact::SkyCompact() {
// if this is v0.0288, parse this diff data
uint16 numDiffs = _cptFile->readUint16LE();
uint16 diffSize = _cptFile->readUint16LE();
- uint16 *diffBuf = (uint16*)malloc(diffSize * sizeof(uint16));
+ uint16 *diffBuf = (uint16 *)malloc(diffSize * sizeof(uint16));
_cptFile->read(diffBuf, diffSize * sizeof(uint16));
if (SkyEngine::_systemVars.gameVersion == 288) {
uint16 *diffPos = diffBuf;
for (cnt = 0; cnt < numDiffs; cnt++) {
uint16 cptId = READ_LE_UINT16(diffPos++);
- uint16 *rawCpt = (uint16*)fetchCpt(cptId);
+ uint16 *rawCpt = (uint16 *)fetchCpt(cptId);
rawCpt += READ_LE_UINT16(diffPos++);
uint16 len = READ_LE_UINT16(diffPos++);
for (uint16 elemCnt = 0; elemCnt < len; elemCnt++)
@@ -231,7 +231,7 @@ SkyCompact::SkyCompact() {
// these are the IDs that have to be saved into savegame files.
_numSaveIds = _cptFile->readUint16LE();
- _saveIds = (uint16*)malloc(_numSaveIds * sizeof(uint16));
+ _saveIds = (uint16 *)malloc(_numSaveIds * sizeof(uint16));
_cptFile->read(_saveIds, _numSaveIds * sizeof(uint16));
for (cnt = 0; cnt < _numSaveIds; cnt++)
_saveIds[cnt] = FROM_LE_16(_saveIds[cnt]);
@@ -318,7 +318,7 @@ uint16 *SkyCompact::getSub(Compact *cpt, uint16 mode) {
}
uint16 *SkyCompact::getGrafixPtr(Compact *cpt) {
- uint16 *gfxBase = (uint16*)fetchCpt(cpt->grafixProgId);
+ uint16 *gfxBase = (uint16 *)fetchCpt(cpt->grafixProgId);
if (gfxBase == NULL)
return NULL;
@@ -358,7 +358,7 @@ MegaSet *SkyCompact::getMegaSet(Compact *cpt) {
*/
uint16 *SkyCompact::getTurnTable(Compact *cpt, uint16 dir) {
MegaSet *m = getMegaSet(cpt);
- TurnTable *turnTable = (TurnTable*)fetchCpt(m->turnTableId);
+ TurnTable *turnTable = (TurnTable *)fetchCpt(m->turnTableId);
switch (dir) {
case 0:
return turnTable->turnTableUp;
@@ -418,7 +418,7 @@ void *SkyCompact::getCompactElem(Compact *cpt, uint16 off) {
uint8 *SkyCompact::createResetData(uint16 gameVersion) {
_cptFile->seek(_resetDataPos);
uint32 dataSize = _cptFile->readUint16LE() * sizeof(uint16);
- uint16 *resetBuf = (uint16*)malloc(dataSize);
+ uint16 *resetBuf = (uint16 *)malloc(dataSize);
_cptFile->read(resetBuf, dataSize);
uint16 numDiffs = _cptFile->readUint16LE();
for (uint16 cnt = 0; cnt < numDiffs; cnt++) {
@@ -429,7 +429,7 @@ uint8 *SkyCompact::createResetData(uint16 gameVersion) {
uint16 pos = _cptFile->readUint16LE();
resetBuf[pos] = TO_LE_16(_cptFile->readUint16LE());
}
- return (uint8*)resetBuf;
+ return (uint8 *)resetBuf;
} else
_cptFile->seek(diffFields * 2 * sizeof(uint16), SEEK_CUR);
}
diff --git a/engines/sky/control.cpp b/engines/sky/control.cpp
index 9efa6ce769..c1ed763281 100644
--- a/engines/sky/control.cpp
+++ b/engines/sky/control.cpp
@@ -535,7 +535,7 @@ uint16 Control::handleClick(ConResource *pButton) {
return saveRestorePanel(true); // texts can be edited
case SAVE_A_GAME:
animClick(pButton);
- return saveGameToFile();
+ return saveGameToFile(true);
case RESTORE_A_GAME:
animClick(pButton);
return restoreGameFromFile(false);
@@ -878,6 +878,8 @@ uint16 Control::saveRestorePanel(bool allowSave) {
clickRes = handleClick(lookList[0]);
if (clickRes == GAME_SAVED)
saveDescriptions(saveGameTexts);
+ else if (clickRes == NO_DISK_SPACE)
+ displayMessage(0, "Could not save the game. (%s)", _saveFileMan->popErrorDesc().c_str());
quitPanel = true;
_mouseClicked = false;
_keyPressed.reset();
@@ -972,7 +974,7 @@ void Control::handleKeyPress(Common::KeyState kbd, Common::String &textBuf) {
// Allow the key only if is a letter, a digit, or one of a selected
// list of extra characters
- if (isalnum(kbd.ascii) || strchr(" ,().='-&+!?\"", kbd.ascii) != 0) {
+ if (Common::isAlnum(kbd.ascii) || strchr(" ,().='-&+!?\"", kbd.ascii) != 0) {
textBuf += kbd.ascii;
}
}
@@ -1092,35 +1094,33 @@ void Control::doAutoSave() {
strcpy(fName, "SKY-VM-CD.ASD");
else
sprintf(fName, "SKY-VM%03d.ASD", SkyEngine::_systemVars.gameVersion);
- Common::OutSaveFile *outf;
- outf = _saveFileMan->openForSaving(fName);
- if (outf == NULL) {
- displayMessage(0, "Unable to create autosave file '%s'. (%s)", fName, _saveFileMan->popErrorDesc().c_str());
- return;
- }
- uint8 *saveData = (uint8 *)malloc(0x20000);
- uint32 fSize = prepareSaveData(saveData);
-
- outf->write(saveData, fSize);
- outf->finalize();
+ uint16 res = saveGameToFile(false, fName);
- if (outf->err())
- displayMessage(0, "Unable to write autosave file '%s'. Disk full? (%s)", fName, _saveFileMan->popErrorDesc().c_str());
+ if (res != GAME_SAVED)
+ displayMessage(0, "Unable to perform autosave to '%s'. (%s)", fName, _saveFileMan->popErrorDesc().c_str());
- delete outf;
- free(saveData);
}
-uint16 Control::saveGameToFile() {
+uint16 Control::saveGameToFile(bool fromControlPanel, const char *filename) {
char fName[20];
- sprintf(fName,"SKY-VM.%03d", _selectedGame);
+ if (!filename) {
+ sprintf(fName,"SKY-VM.%03d", _selectedGame);
+ filename = fName;
+ }
Common::OutSaveFile *outf;
- outf = _saveFileMan->openForSaving(fName);
+ outf = _saveFileMan->openForSaving(filename);
if (outf == NULL)
return NO_DISK_SPACE;
+ if (!fromControlPanel) {
+ // These variables are usually set when entering the control panel,
+ // but not when using the GMM.
+ _savedCharSet = _skyText->giveCurrentCharSet();
+ _savedMouse = _skyMouse->giveCurrentMouseType();
+ }
+
uint8 *saveData = (uint8 *)malloc(0x20000);
uint32 fSize = prepareSaveData(saveData);
@@ -1160,7 +1160,7 @@ uint32 Control::prepareSaveData(uint8 *destBuf) {
for (cnt = 0; cnt < _skyCompact->_numSaveIds; cnt++) {
uint16 numElems;
- uint16 *rawCpt = (uint16*)_skyCompact->fetchCptInfo(_skyCompact->_saveIds[cnt], &numElems, NULL, NULL);
+ uint16 *rawCpt = (uint16 *)_skyCompact->fetchCptInfo(_skyCompact->_saveIds[cnt], &numElems, NULL, NULL);
for (uint16 elemCnt = 0; elemCnt < numElems; elemCnt++)
STOSW(destPos, rawCpt[elemCnt]);
}
@@ -1209,9 +1209,9 @@ void Control::importOldCompact(Compact* destCpt, uint8 **srcPos, uint16 numElems
else if (graphType == OG_COMPACT)
destCpt->grafixProgId = target;
else if (graphType == OG_TALKTABLE)
- destCpt->grafixProgId = ((uint16*)_skyCompact->fetchCpt(CPT_TALK_TABLE_LIST))[target];
+ destCpt->grafixProgId = ((uint16 *)_skyCompact->fetchCpt(CPT_TALK_TABLE_LIST))[target];
else if (graphType == OG_COMPACTELEM)
- destCpt->grafixProgId = *(uint16*)_skyCompact->getCompactElem(destCpt, target);
+ destCpt->grafixProgId = *(uint16 *)_skyCompact->getCompactElem(destCpt, target);
else
error("Illegal GrafixProg type encountered for compact %s", name);
}
@@ -1330,7 +1330,7 @@ uint16 Control::parseSaveData(uint8 *srcBuf) {
LODSD(srcPos, mouseType);
LODSD(srcPos, palette);
- _skyLogic->parseSaveData((uint32*)srcPos);
+ _skyLogic->parseSaveData((uint32 *)srcPos);
srcPos += NUM_SKY_SCRIPTVARS * sizeof(uint32);
for (cnt = 0; cnt < 60; cnt++)
@@ -1339,7 +1339,7 @@ uint16 Control::parseSaveData(uint8 *srcBuf) {
if (saveRev == SAVE_FILE_REVISION) {
for (cnt = 0; cnt < _skyCompact->_numSaveIds; cnt++) {
uint16 numElems;
- uint16 *rawCpt = (uint16*)_skyCompact->fetchCptInfo(_skyCompact->_saveIds[cnt], &numElems, NULL, NULL);
+ uint16 *rawCpt = (uint16 *)_skyCompact->fetchCptInfo(_skyCompact->_saveIds[cnt], &numElems, NULL, NULL);
for (uint16 elemCnt = 0; elemCnt < numElems; elemCnt++)
LODSW(srcPos, rawCpt[elemCnt]);
}
@@ -1348,19 +1348,19 @@ uint16 Control::parseSaveData(uint8 *srcBuf) {
uint16 numElems;
uint16 type;
char name[128];
- uint16 *rawCpt = (uint16*)_skyCompact->fetchCptInfo(_skyCompact->_saveIds[cnt], &numElems, &type, name);
+ uint16 *rawCpt = (uint16 *)_skyCompact->fetchCptInfo(_skyCompact->_saveIds[cnt], &numElems, &type, name);
if (type == COMPACT) {
- importOldCompact((Compact*)rawCpt, &srcPos, numElems, type, name);
+ importOldCompact((Compact *)rawCpt, &srcPos, numElems, type, name);
} else if (type == ROUTEBUF) {
assert(numElems == 32);
for (uint32 elemCnt = 0; elemCnt < numElems; elemCnt++)
LODSW(srcPos, rawCpt[elemCnt]);
}
}
- uint16 *rawCpt = (uint16*)_skyCompact->fetchCpt(0xBF);
+ uint16 *rawCpt = (uint16 *)_skyCompact->fetchCpt(0xBF);
for (cnt = 0; cnt < 3; cnt++)
LODSW(srcPos, rawCpt[cnt]);
- rawCpt = (uint16*)_skyCompact->fetchCpt(0xC2);
+ rawCpt = (uint16 *)_skyCompact->fetchCpt(0xC2);
for (cnt = 0; cnt < 13; cnt++)
LODSW(srcPos, rawCpt[cnt]);
}
@@ -1467,7 +1467,7 @@ void Control::restartGame() {
return; // no restart for floppy demo
uint8 *resetData = _skyCompact->createResetData((uint16)SkyEngine::_systemVars.gameVersion);
- parseSaveData((uint8*)resetData);
+ parseSaveData((uint8 *)resetData);
free(resetData);
_skyScreen->forceRefresh();
diff --git a/engines/sky/control.h b/engines/sky/control.h
index 6aa7a41c62..280f7e19cd 100644
--- a/engines/sky/control.h
+++ b/engines/sky/control.h
@@ -136,7 +136,7 @@ class ConResource {
public:
ConResource(void *pSpData, uint32 pNSprites, uint32 pCurSprite, uint16 pX, uint16 pY, uint32 pText, uint8 pOnClick, OSystem *system, uint8 *screen);
virtual ~ConResource() {}
- void setSprite(void *pSpData) { _spriteData = (DataFileHeader*)pSpData; }
+ void setSprite(void *pSpData) { _spriteData = (DataFileHeader *)pSpData; }
void setText(uint32 pText) { if (pText) _text = pText + 0x7000; else _text = 0; }
void setXY(uint16 x, uint16 y) { _x = x; _y = y; }
bool isMouseOver(uint32 mouseX, uint32 mouseY);
@@ -190,7 +190,7 @@ public:
bool loadSaveAllowed();
uint16 _selectedGame;
- uint16 saveGameToFile();
+ uint16 saveGameToFile(bool fromControlPanel, const char *filename = 0);
void loadDescriptions(Common::StringArray &list);
void saveDescriptions(const Common::StringArray &list);
diff --git a/engines/sky/detection.cpp b/engines/sky/detection.cpp
index 484958ca52..2b702e99ea 100644
--- a/engines/sky/detection.cpp
+++ b/engines/sky/detection.cpp
@@ -206,7 +206,7 @@ SaveStateList SkyMetaEngine::listSaves(const char *target) const {
// Extract the extension
Common::String ext = file->c_str() + file->size() - 3;
ext.toUppercase();
- if (isdigit(static_cast<unsigned char>(ext[0])) && isdigit(static_cast<unsigned char>(ext[1])) && isdigit(static_cast<unsigned char>(ext[2]))){
+ if (Common::isDigit(ext[0]) && Common::isDigit(ext[1]) && Common::isDigit(ext[2])) {
int slotNum = atoi(ext.c_str());
Common::InSaveFile *in = saveFileMan->openForLoading(*file);
if (in) {
@@ -286,7 +286,7 @@ Common::Error SkyEngine::saveGameState(int slot, const Common::String &desc) {
// Set the save slot and save the game
_skyControl->_selectedGame = slot - 1;
- if (_skyControl->saveGameToFile() != GAME_SAVED)
+ if (_skyControl->saveGameToFile(false) != GAME_SAVED)
return Common::kWritePermissionDenied;
// Load current save game descriptions
diff --git a/engines/sky/disk.cpp b/engines/sky/disk.cpp
index 99b707dcf1..e97aeb01a2 100644
--- a/engines/sky/disk.cpp
+++ b/engines/sky/disk.cpp
@@ -117,7 +117,7 @@ uint8 *Disk::loadFile(uint16 fileNr) {
cflag = (uint8)((fileFlags >> 23) & 0x1);
//if cflag == 0 then file is compressed, 1 == uncompressed
- DataFileHeader *fileHeader = (DataFileHeader*)fileDest;
+ DataFileHeader *fileHeader = (DataFileHeader *)fileDest;
if ((!cflag) && ((FROM_LE_16(fileHeader->flag) >> 7) & 1)) {
debug(4, "File is RNC compressed.");
@@ -175,7 +175,7 @@ uint8 *Disk::loadFile(uint16 fileNr) {
}
uint16 *Disk::loadScriptFile(uint16 fileNr) {
- uint16 *buf = (uint16*)loadFile(fileNr);
+ uint16 *buf = (uint16 *)loadFile(fileNr);
#ifdef SCUMM_BIG_ENDIAN
for (uint i = 0; i < _lastLoadedFileSize / 2; i++)
buf[i] = FROM_LE_16(buf[i]);
diff --git a/engines/sky/intro.cpp b/engines/sky/intro.cpp
index f1ea4d2df2..2f75a19b69 100644
--- a/engines/sky/intro.cpp
+++ b/engines/sky/intro.cpp
@@ -633,8 +633,8 @@ Intro::Intro(Disk *disk, Screen *screen, MusicBase *music, Sound *sound, Text *t
_skyText = text;
_mixer = mixer;
_system = system;
- _textBuf = (uint8*)malloc(10000);
- _saveBuf = (uint8*)malloc(10000);
+ _textBuf = (uint8 *)malloc(10000);
+ _saveBuf = (uint8 *)malloc(10000);
_bgBuf = NULL;
_relDelay = 0;
}
@@ -774,7 +774,7 @@ bool Intro::nextPart(uint16 *&data) {
}
bool Intro::floppyScrollFlirt() {
- uint8 *scrollScreen = (uint8*)malloc(FRAME_SIZE * 2);
+ uint8 *scrollScreen = (uint8 *)malloc(FRAME_SIZE * 2);
memset(scrollScreen, 0, FRAME_SIZE);
memcpy(scrollScreen + FRAME_SIZE, _skyScreen->giveCurrent(), FRAME_SIZE);
uint8 *scrollPos = scrollScreen + FRAME_SIZE;
@@ -828,8 +828,8 @@ bool Intro::commandFlirt(uint16 *&data) {
_skyText->displayText(*data++, _textBuf, true, INTRO_TEXT_WIDTH, 255);
break;
case IC_SHOW_TEXT:
- ((DataFileHeader*)_textBuf)->s_x = *data++;
- ((DataFileHeader*)_textBuf)->s_y = *data++;
+ ((DataFileHeader *)_textBuf)->s_x = *data++;
+ ((DataFileHeader *)_textBuf)->s_y = *data++;
showTextBuf();
break;
case IC_REMOVE_TEXT:
@@ -858,10 +858,10 @@ bool Intro::commandFlirt(uint16 *&data) {
}
void Intro::showTextBuf() {
- uint16 x = ((DataFileHeader*)_textBuf)->s_x;
- uint16 y = ((DataFileHeader*)_textBuf)->s_y;
- uint16 width = ((DataFileHeader*)_textBuf)->s_width;
- uint16 height = ((DataFileHeader*)_textBuf)->s_height;
+ uint16 x = ((DataFileHeader *)_textBuf)->s_x;
+ uint16 y = ((DataFileHeader *)_textBuf)->s_y;
+ uint16 width = ((DataFileHeader *)_textBuf)->s_width;
+ uint16 height = ((DataFileHeader *)_textBuf)->s_height;
uint8 *screenBuf = _skyScreen->giveCurrent() + y * GAME_SCREEN_WIDTH + x;
memcpy(_saveBuf, _textBuf, sizeof(DataFileHeader));
uint8 *saveBuf = _saveBuf + sizeof(DataFileHeader);
@@ -880,10 +880,10 @@ void Intro::showTextBuf() {
}
void Intro::restoreScreen() {
- uint16 x = ((DataFileHeader*)_saveBuf)->s_x;
- uint16 y = ((DataFileHeader*)_saveBuf)->s_y;
- uint16 width = ((DataFileHeader*)_saveBuf)->s_width;
- uint16 height = ((DataFileHeader*)_saveBuf)->s_height;
+ uint16 x = ((DataFileHeader *)_saveBuf)->s_x;
+ uint16 y = ((DataFileHeader *)_saveBuf)->s_y;
+ uint16 width = ((DataFileHeader *)_saveBuf)->s_width;
+ uint16 height = ((DataFileHeader *)_saveBuf)->s_height;
uint8 *screenBuf = _skyScreen->giveCurrent() + y * GAME_SCREEN_WIDTH + x;
uint8 *saveBuf = _saveBuf + sizeof(DataFileHeader);
for (uint16 cnt = 0; cnt < height; cnt++) {
diff --git a/engines/sky/logic.cpp b/engines/sky/logic.cpp
index 18fb4f7e82..e92e768272 100644
--- a/engines/sky/logic.cpp
+++ b/engines/sky/logic.cpp
@@ -382,8 +382,8 @@ void Logic::mainAnim() {
}
};
- uint16 animId = *(uint16*)_skyCompact->getCompactElem(_compact, C_ANIM_UP + _compact->megaSet + dir * 4);
- uint16 *animList = (uint16*)_skyCompact->fetchCpt(animId);
+ uint16 animId = *(uint16 *)_skyCompact->getCompactElem(_compact, C_ANIM_UP + _compact->megaSet + dir * 4);
+ uint16 *animList = (uint16 *)_skyCompact->fetchCpt(animId);
uint16 arAnimIndex = _compact->arAnimIndex;
if (!animList[arAnimIndex / 2]) {
@@ -400,7 +400,7 @@ void Logic::mainAnim() {
}
void Logic::arTurn() {
- uint16 *turnData = (uint16*)_skyCompact->fetchCpt(_compact->turnProgId) + _compact->turnProgPos;
+ uint16 *turnData = (uint16 *)_skyCompact->fetchCpt(_compact->turnProgId) + _compact->turnProgPos;
_compact->frame = *turnData++;
_compact->turnProgPos++;
@@ -453,7 +453,7 @@ void Logic::anim() {
}
void Logic::turn() {
- uint16 *turnData = (uint16*)_skyCompact->fetchCpt(_compact->turnProgId) + _compact->turnProgPos;
+ uint16 *turnData = (uint16 *)_skyCompact->fetchCpt(_compact->turnProgId) + _compact->turnProgPos;
if (*turnData) {
_compact->frame = *turnData;
_compact->turnProgPos++;
@@ -1425,12 +1425,12 @@ uint16 Logic::script(uint16 scriptNo, uint16 offset) {
bool Logic::fnCacheChip(uint32 a, uint32 b, uint32 c) {
_skySound->fnStopFx();
- _skyDisk->fnCacheChip((uint16*)_skyCompact->fetchCpt((uint16)a));
+ _skyDisk->fnCacheChip((uint16 *)_skyCompact->fetchCpt((uint16)a));
return true;
}
bool Logic::fnCacheFast(uint32 a, uint32 b, uint32 c) {
- _skyDisk->fnCacheFast((uint16*)_skyCompact->fetchCpt((uint16)a));
+ _skyDisk->fnCacheFast((uint16 *)_skyCompact->fetchCpt((uint16)a));
return true;
}
@@ -1577,7 +1577,7 @@ bool Logic::fnGetTo(uint32 targetPlaceId, uint32 mode, uint32 c) {
warning("can't find _compact's getToTable. Place compact is NULL");
return false;
}
- uint16 *getToTable = (uint16*)_skyCompact->fetchCpt(cpt->getToTableId);
+ uint16 *getToTable = (uint16 *)_skyCompact->fetchCpt(cpt->getToTableId);
if (!getToTable) {
warning("Place compact's getToTable is NULL");
return false;
@@ -1596,7 +1596,7 @@ bool Logic::fnGetTo(uint32 targetPlaceId, uint32 mode, uint32 c) {
bool Logic::fnSetToStand(uint32 a, uint32 b, uint32 c) {
_compact->mood = 1; // high level stood still
- _compact->grafixProgId = *(uint16*)_skyCompact->getCompactElem(_compact, C_STAND_UP + _compact->megaSet + _compact->dir * 4);
+ _compact->grafixProgId = *(uint16 *)_skyCompact->getCompactElem(_compact, C_STAND_UP + _compact->megaSet + _compact->dir * 4);
_compact->grafixProgPos = 0;
uint16 *standList = _skyCompact->getGrafixPtr(_compact);
@@ -2158,8 +2158,8 @@ bool Logic::fnSetMegaSet(uint32 mega, uint32 setNo, uint32 c) {
bool Logic::fnMoveItems(uint32 listNo, uint32 screenNo, uint32 c) {
// Move a list of id's to another screen
- uint16 *p = (uint16*)_skyCompact->fetchCpt(CPT_MOVE_LIST);
- p = (uint16*)_skyCompact->fetchCpt(p[listNo]);
+ uint16 *p = (uint16 *)_skyCompact->fetchCpt(CPT_MOVE_LIST);
+ p = (uint16 *)_skyCompact->fetchCpt(p[listNo]);
for (int i = 0; i < 2; i++) {
if (!*p)
return true;
@@ -2528,7 +2528,7 @@ void Logic::stdSpeak(Compact *target, uint32 textNum, uint32 animNum, uint32 bas
animNum += target->megaSet / NEXT_MEGA_SET;
animNum &= 0xFF;
- uint16 *talkTable = (uint16*)_skyCompact->fetchCpt(CPT_TALK_TABLE_LIST);
+ uint16 *talkTable = (uint16 *)_skyCompact->fetchCpt(CPT_TALK_TABLE_LIST);
target->grafixProgId = talkTable[animNum];
target->grafixProgPos = 0;
uint16 *animPtr = _skyCompact->getGrafixPtr(target);
diff --git a/engines/sky/mouse.cpp b/engines/sky/mouse.cpp
index 98f942889e..74a92c8f00 100644
--- a/engines/sky/mouse.cpp
+++ b/engines/sky/mouse.cpp
@@ -319,7 +319,7 @@ void Mouse::fnOpenCloseHand(bool open) {
if (open)
cursor++;
- uint32 size = ((DataFileHeader*)_objectMouseData)->s_sp_size;
+ uint32 size = ((DataFileHeader *)_objectMouseData)->s_sp_size;
uint8 *srcData;
uint8 *destData;
diff --git a/engines/sky/music/adlibchannel.cpp b/engines/sky/music/adlibchannel.cpp
index 896b58aa22..99509554c7 100644
--- a/engines/sky/music/adlibchannel.cpp
+++ b/engines/sky/music/adlibchannel.cpp
@@ -49,32 +49,32 @@ AdLibChannel::AdLibChannel(FM_OPL *opl, uint8 *pMusicData, uint16 startOfData) {
if (SkyEngine::_systemVars.gameVersion == 109) {
//instrumentDataLoc = (_musicData[0x11D0] << 8) | _musicData[0x11CF];
- //_frequenceTable = (uint16*)(_musicData + 0x835);
+ //_frequenceTable = (uint16 *)(_musicData + 0x835);
//_registerTable = _musicData + 0xE35;
//_opOutputTable = _musicData + 0xE47;
//_adlibRegMirror = _musicData + 0xF4A;
instrumentDataLoc = READ_LE_UINT16(_musicData + 0x1204);
- _frequenceTable = (uint16*)(_musicData + 0x868);
+ _frequenceTable = (uint16 *)(_musicData + 0x868);
_registerTable = _musicData + 0xE68;
_opOutputTable = _musicData + 0xE7A;
_adlibRegMirror = _musicData + 0xF7D;
} else if (SkyEngine::_systemVars.gameVersion == 267) {
instrumentDataLoc = READ_LE_UINT16(_musicData + 0x11FB);
- _frequenceTable = (uint16*)(_musicData + 0x7F4);
+ _frequenceTable = (uint16 *)(_musicData + 0x7F4);
_registerTable = _musicData + 0xDF4;
_opOutputTable = _musicData + 0xE06;
_adlibRegMirror = _musicData + 0xF55;
} else {
instrumentDataLoc = READ_LE_UINT16(_musicData + 0x1205);
- _frequenceTable = (uint16*)(_musicData + 0x7FE);
+ _frequenceTable = (uint16 *)(_musicData + 0x7FE);
_registerTable = _musicData + 0xDFE;
_opOutputTable = _musicData + 0xE10;
_adlibRegMirror = _musicData + 0xF5F;
}
_instrumentMap = _musicData+instrumentDataLoc;
- _instruments = (InstrumentStruct*)(_instrumentMap+0x80);
+ _instruments = (InstrumentStruct *)(_instrumentMap+0x80);
}
AdLibChannel::~AdLibChannel() {
diff --git a/engines/sky/music/gmmusic.cpp b/engines/sky/music/gmmusic.cpp
index 85240ea82e..84f6a654d0 100644
--- a/engines/sky/music/gmmusic.cpp
+++ b/engines/sky/music/gmmusic.cpp
@@ -31,7 +31,7 @@
namespace Sky {
void GmMusic::passTimerFunc(void *param) {
- ((GmMusic*)param)->timerCall();
+ ((GmMusic *)param)->timerCall();
}
GmMusic::GmMusic(MidiDriver *pMidiDrv, Audio::Mixer *pMixer, Disk *pDisk) : MusicBase(pMixer, pDisk) {
diff --git a/engines/sky/music/mt32music.cpp b/engines/sky/music/mt32music.cpp
index 18ebf123ff..a3fdd42713 100644
--- a/engines/sky/music/mt32music.cpp
+++ b/engines/sky/music/mt32music.cpp
@@ -31,7 +31,7 @@
namespace Sky {
void MT32Music::passTimerFunc(void *param) {
- ((MT32Music*)param)->timerCall();
+ ((MT32Music *)param)->timerCall();
}
MT32Music::MT32Music(MidiDriver *pMidiDrv, Audio::Mixer *pMixer, Disk *pDisk) : MusicBase(pMixer, pDisk) {
diff --git a/engines/sky/music/musicbase.cpp b/engines/sky/music/musicbase.cpp
index c4e5ba4bd0..b388afdb13 100644
--- a/engines/sky/music/musicbase.cpp
+++ b/engines/sky/music/musicbase.cpp
@@ -117,10 +117,6 @@ void MusicBase::loadNewMusic() {
} else if (section == 5 && song == 6) {
section = 4;
song = 4;
- } else if (section == 0 && song == 1) {
- // floppy intro
- section = 5;
- song = 3;
}
Common::String trackName = Common::String::format("music_%d%02d", section, song);
Audio::SeekableAudioStream *stream = Audio::SeekableAudioStream::openStreamFile(trackName);
diff --git a/engines/sky/text.cpp b/engines/sky/text.cpp
index 3e119b3b20..38a01116fe 100644
--- a/engines/sky/text.cpp
+++ b/engines/sky/text.cpp
@@ -136,7 +136,7 @@ void Text::getText(uint32 textNr) { //load text #"textNr" into textBuffer
textNr &= 0x1F;
if (blockNr) {
- uint16 *blockPtr = (uint16*)(textDataPtr + 4);
+ uint16 *blockPtr = (uint16 *)(textDataPtr + 4);
uint32 nr32MsgBlocks = blockNr >> 5;
do {
@@ -298,7 +298,7 @@ DisplayedText Text::displayText(char *textPtr, uint8 *dest, bool center, uint16
uint32 numBytes = (dtLineSize * numLines) + sizeof(DataFileHeader) + 4;
if (!dest)
- dest = (uint8*)malloc(numBytes);
+ dest = (uint8 *)malloc(numBytes);
// clear text sprite buffer
memset(dest + sizeof(DataFileHeader), 0, numBytes - sizeof(DataFileHeader));
diff --git a/engines/sword1/animation.cpp b/engines/sword1/animation.cpp
index a3d732e13b..1e2964054a 100644
--- a/engines/sword1/animation.cpp
+++ b/engines/sword1/animation.cpp
@@ -102,7 +102,7 @@ MoviePlayer::MoviePlayer(SwordEngine *vm, Text *textMan, ResMan *resMan, Audio::
_decoderType = decoderType;
_decoder = decoder;
- _white = 255;
+ _c1Color = _c2Color = _c3Color = _c4Color = 255;
_black = 0;
}
@@ -145,7 +145,7 @@ bool MoviePlayer::load(uint32 id) {
int startFrame = strtoul(ptr, const_cast<char **>(&ptr), 10);
int endFrame = strtoul(ptr, const_cast<char **>(&ptr), 10);
- while (*ptr && isspace(static_cast<unsigned char>(*ptr)))
+ while (*ptr && Common::isSpace(*ptr))
ptr++;
if (startFrame > endFrame) {
@@ -157,8 +157,16 @@ bool MoviePlayer::load(uint32 id) {
warning("%s:%d startFrame (%d) <= lastEnd (%d)", filename.c_str(), lineNo, startFrame, lastEnd);
continue;
}
-
- _movieTexts.push_back(MovieText(startFrame, endFrame, ptr));
+
+ int color = 0;
+ if (*ptr == '@') {
+ ++ptr;
+ color = strtoul(ptr, const_cast<char **>(&ptr), 10);
+ while (*ptr && Common::isSpace(*ptr))
+ ptr++;
+ }
+
+ _movieTexts.push_back(MovieText(startFrame, endFrame, ptr, color));
lastEnd = endFrame;
}
f.close();
@@ -238,6 +246,7 @@ void MoviePlayer::performPostProcessing(byte *screen) {
_textHeight = _resMan->toUint16(frame->height);
_textX = 320 - _textWidth / 2;
_textY = 420 - _textHeight;
+ _textColor = _movieTexts.front()._color;
}
if (_decoder->getCurFrame() == _movieTexts.front()._endFrame) {
_textMan->releaseText(2, false);
@@ -259,7 +268,7 @@ void MoviePlayer::performPostProcessing(byte *screen) {
dst[x] = getBlackColor();
break;
case LETTER_COL:
- dst[x] = getWhiteColor();
+ dst[x] = findTextColor();
break;
}
}
@@ -313,28 +322,88 @@ bool MoviePlayer::playVideo() {
if (_decoder->hasDirtyPalette()) {
_decoder->setSystemPalette();
- uint32 maxWeight = 0;
- uint32 minWeight = 0xFFFFFFFF;
- uint32 weight;
- byte r, g, b;
-
- const byte *palette = _decoder->getPalette();
-
- for (int i = 0; i < 256; i++) {
- r = *palette++;
- g = *palette++;
- b = *palette++;
-
- weight = 3 * r * r + 6 * g * g + 2 * b * b;
-
- if (weight >= maxWeight) {
- maxWeight = weight;
- _white = i;
- }
-
- if (weight <= minWeight) {
- minWeight = weight;
- _black = i;
+ if (!_movieTexts.empty()) {
+ // Look for the best color indexes to use to display the subtitles
+ uint32 minWeight = 0xFFFFFFFF;
+ uint32 weight;
+ float c1Weight = 1e+30f;
+ float c2Weight = 1e+30f;
+ float c3Weight = 1e+30f;
+ float c4Weight = 1e+30f;
+ byte r, g, b;
+ float h, s, v, hd, hsvWeight;
+
+ const byte *palette = _decoder->getPalette();
+
+ // Color comparaison for the subtitles colors is done in HSL
+ // C1 color is used for George and is almost white (R = 248, G = 252, B = 248)
+ const float h1 = 0.333333f, s1 = 0.02f, v1 = 0.99f;
+
+ // C2 color is used for George as a narrator and is grey (R = 184, G = 188, B = 184)
+ const float h2 = 0.333333f, s2 = 0.02f, v2 = 0.74f;
+
+ // C3 color is used for Nicole and is rose (R = 200, G = 120, B = 184)
+ const float h3 = 0.866667f, s3 = 0.4f, v3 = 0.78f;
+
+ // C4 color is used for Maguire and is blue (R = 80, G = 152, B = 184)
+ const float h4 = 0.55f, s4 = 0.57f, v4 = 0.72f;
+
+ for (int i = 0; i < 256; i++) {
+ r = *palette++;
+ g = *palette++;
+ b = *palette++;
+
+ weight = 3 * r * r + 6 * g * g + 2 * b * b;
+
+ if (weight <= minWeight) {
+ minWeight = weight;
+ _black = i;
+ }
+
+ convertColor(r, g, b, h, s, v);
+
+ // C1 color
+ // It is almost achromatic (very low saturation) so the hue as litle impact on the color.
+ // Therefore use a low weight on hue and high weight on saturation.
+ hd = h - h1;
+ hd += hd < -0.5f ? 1.0f : hd > 0.5f ? -1.0f : 0.0f;
+ hsvWeight = 1.0f * hd * hd + 4.0f * (s - s1) * (s - s1) + 3.0f * (v - v1) * (v - v1);
+ if (hsvWeight <= c1Weight) {
+ c1Weight = hsvWeight;
+ _c1Color = i;
+ }
+
+ // C2 color
+ // Also an almost achromatic color so use the same weights as for C1 color.
+ hd = h - h2;
+ hd += hd < -0.5f ? 1.0f : hd > 0.5f ? -1.0f : 0.0f;
+ hsvWeight = 1.0f * hd * hd + 4.0f * (s - s2) * (s - s2) + 3.0f * (v - v2) * (v - v2);
+ if (hsvWeight <= c2Weight) {
+ c2Weight = hsvWeight;
+ _c2Color = i;
+ }
+
+ // C3 color
+ // A light rose. Use a high weight on the hue to get a rose.
+ // The color is a bit gray and the saturation has not much impact so use a low weight.
+ hd = h - h3;
+ hd += hd < -0.5f ? 1.0f : hd > 0.5f ? -1.0f : 0.0f;
+ hsvWeight = 4.0f * hd * hd + 1.0f * (s - s3) * (s - s3) + 2.0f * (v - v3) * (v - v3);
+ if (hsvWeight <= c3Weight) {
+ c3Weight = hsvWeight;
+ _c3Color = i;
+ }
+
+ // C4 color
+ // Blue. Use a hight weight on the hue to get a blue.
+ // The color is darker and more saturated than C3 and the saturation has more impact.
+ hd = h - h4;
+ hd += hd < -0.5f ? 1.0f : hd > 0.5f ? -1.0f : 0.0f;
+ hsvWeight = 5.0f * hd * hd + 3.0f * (s - s4) * (s - s4) + 2.0f * (v - v4) * (v - v4);
+ if (hsvWeight <= c4Weight) {
+ c4Weight = hsvWeight;
+ _c4Color = i;
+ }
}
}
}
@@ -365,8 +434,59 @@ uint32 MoviePlayer::getBlackColor() {
return (_decoderType == kVideoDecoderPSX) ? g_system->getScreenFormat().RGBToColor(0x00, 0x00, 0x00) : _black;
}
-uint32 MoviePlayer::getWhiteColor() {
- return (_decoderType == kVideoDecoderPSX) ? g_system->getScreenFormat().RGBToColor(0xFF, 0xFF, 0xFF) : _white;
+uint32 MoviePlayer::findTextColor() {
+ if (_decoderType == kVideoDecoderPSX) {
+ // We're in true color mode, so return the actual colors
+ switch (_textColor) {
+ case 1:
+ return g_system->getScreenFormat().RGBToColor(248, 252, 248);
+ case 2:
+ return g_system->getScreenFormat().RGBToColor(184, 188, 184);
+ case 3:
+ return g_system->getScreenFormat().RGBToColor(200, 120, 184);
+ case 4:
+ return g_system->getScreenFormat().RGBToColor(80, 152, 184);
+ }
+
+ return g_system->getScreenFormat().RGBToColor(0xFF, 0xFF, 0xFF);
+ }
+
+ switch (_textColor) {
+ case 1:
+ return _c1Color;
+ case 2:
+ return _c2Color;
+ case 3:
+ return _c3Color;
+ case 4:
+ return _c4Color;
+ }
+ return _c1Color;
+}
+
+void MoviePlayer::convertColor(byte r, byte g, byte b, float &h, float &s, float &v) {
+ float varR = r / 255.0f;
+ float varG = g / 255.0f;
+ float varB = b / 255.0f;
+
+ float min = MIN(varR, MIN(varG, varB));
+ float max = MAX(varR, MAX(varG, varB));
+
+ v = max;
+ float d = max - min;
+ s = max == 0.0f ? 0.0f : d / max;
+
+ if (min == max) {
+ h = 0.0f; // achromatic
+ } else {
+ if (max == varR)
+ h = (varG - varB) / d + (varG < varB ? 6.0f : 0.0f);
+ else if (max == varG)
+ h = (varB - varR) / d + 2.0f;
+ else
+ h = (varR - varG) / d + 4.0f;
+ h /= 6.0f;
+ }
}
void MoviePlayer::drawFramePSX(const Graphics::Surface *frame) {
diff --git a/engines/sword1/animation.h b/engines/sword1/animation.h
index 23dae7f56d..f64b03dd1b 100644
--- a/engines/sword1/animation.h
+++ b/engines/sword1/animation.h
@@ -45,11 +45,13 @@ class MovieText {
public:
uint16 _startFrame;
uint16 _endFrame;
+ uint16 _color;
Common::String _text;
- MovieText(int startFrame, int endFrame, const Common::String &text) {
+ MovieText(int startFrame, int endFrame, const Common::String &text, int color) {
_startFrame = startFrame;
_endFrame = endFrame;
_text = text;
+ _color = color;
}
};
@@ -80,7 +82,9 @@ protected:
OSystem *_system;
Common::List<MovieText> _movieTexts;
int _textX, _textY, _textWidth, _textHeight;
- uint32 _white, _black;
+ int _textColor;
+ uint32 _black;
+ uint32 _c1Color, _c2Color, _c3Color, _c4Color;
DecoderType _decoderType;
Video::VideoDecoder *_decoder;
@@ -92,7 +96,8 @@ protected:
void drawFramePSX(const Graphics::Surface *frame);
uint32 getBlackColor();
- uint32 getWhiteColor();
+ uint32 findTextColor();
+ void convertColor(byte r, byte g, byte b, float &h, float &s, float &v);
};
MoviePlayer *makeMoviePlayer(uint32 id, SwordEngine *vm, Text *textMan, ResMan *resMan, Audio::Mixer *snd, OSystem *system);
diff --git a/engines/sword2/music.cpp b/engines/sword2/music.cpp
index 1bb08fd36f..40a4021a5c 100644
--- a/engines/sword2/music.cpp
+++ b/engines/sword2/music.cpp
@@ -115,7 +115,7 @@ static Audio::AudioStream *getAudioStream(SoundFileHandle *fh, const char *base,
fh->idxLen = fh->file.readUint32LE();
fh->file.seek(entrySize * 4);
- fh->idxTab = (uint32*)malloc(fh->idxLen * 3 * sizeof(uint32));
+ fh->idxTab = (uint32 *)malloc(fh->idxLen * 3 * sizeof(uint32));
for (uint32 cnt = 0; cnt < fh->idxLen; cnt++) {
fh->idxTab[cnt * 3 + 0] = fh->file.readUint32LE();
fh->idxTab[cnt * 3 + 1] = fh->file.readUint32LE();
diff --git a/engines/sword2/sprite.cpp b/engines/sword2/sprite.cpp
index 8d260947f1..cb0923cc2f 100644
--- a/engines/sword2/sprite.cpp
+++ b/engines/sword2/sprite.cpp
@@ -500,6 +500,16 @@ int32 Screen::drawSprite(SpriteInfo *s) {
recomposePsxSprite(s);
}
+ // If the height is not an even value, fix it.
+ // Apparently it's a problem in the data of a few sprites
+ // of the PSX version. This should fix an evident problem
+ // in the foyer at the beginning of the game, where a line
+ // of pixels is missing near the stairs. But it should also
+ // fix a more subtle one in the glease gallery and in quaramonte
+ // police office.
+ if (s->h % 2)
+ s->h++;
+
freeSprite = true;
byte *tempBuf = (byte *)malloc(s->w * s->h * 2);
memset(tempBuf, 0, s->w * s->h * 2);
@@ -762,14 +772,18 @@ int32 Screen::drawSprite(SpriteInfo *s) {
src = sprite + rs.top * srcPitch + rs.left;
dst = _buffer + _screenWide * rd.top + rd.left;
- if (s->type & RDSPR_BLEND && !Sword2Engine::isPsx()) { // Blending is unavailable in PSX version
+ if (s->type & RDSPR_BLEND) {
// The original code had two different blending cases. One for
// s->blend & 0x01 and one for s->blend & 0x02. However, the
// only values that actually appear in the cluster files are
// 0, 513 and 1025 so the s->blend & 0x02 case was never used.
// Which is just as well since that code made no sense to me.
- if (!(_renderCaps & RDBLTFX_SPRITEBLEND)) {
+ // TODO: In PSX version, blending is done through hardware transparency.
+ // The only correct way to simulate this would be using 16-bit mode.
+ // As this is not yet available for this engine, fake transparency is used
+ // as placeholder.
+ if (!(_renderCaps & RDBLTFX_SPRITEBLEND) || Sword2Engine::isPsx()) {
for (i = 0; i < rs.height(); i++) {
for (j = 0; j < rs.width(); j++) {
if (src[j] && ((i & 1) == (j & 1)))
diff --git a/engines/sword25/gfx/screenshot.cpp b/engines/sword25/gfx/screenshot.cpp
index de7b62fba9..0ea4bff906 100644
--- a/engines/sword25/gfx/screenshot.cpp
+++ b/engines/sword25/gfx/screenshot.cpp
@@ -74,7 +74,7 @@ Common::SeekableReadStream *Screenshot::createThumbnail(Graphics::Surface *data)
// The source image must be 800x600.
if (data->w != 800 || data->h != 600 || data->format.bytesPerPixel != 4) {
error("The sreenshot dimensions have to be 800x600 in order to be saved as a thumbnail.");
- return false;
+ return 0;
}
// Buffer for the output thumbnail
diff --git a/engines/sword25/util/lua/lbaselib.cpp b/engines/sword25/util/lua/lbaselib.cpp
index 3f0b645164..659c61d956 100644
--- a/engines/sword25/util/lua/lbaselib.cpp
+++ b/engines/sword25/util/lua/lbaselib.cpp
@@ -6,10 +6,7 @@
-#include <ctype.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
+#include "common/util.h"
#define lbaselib_c
#define LUA_LIB
@@ -62,7 +59,7 @@ static int luaB_tonumber (lua_State *L) {
luaL_argcheck(L, 2 <= base && base <= 36, 2, "base out of range");
n = strtoul(s1, &s2, base);
if (s1 != s2) { /* at least one valid digit? */
- while (isspace((unsigned char)(*s2))) s2++; /* skip trailing spaces */
+ while (Common::isSpace(*s2)) s2++; /* skip trailing spaces */
if (*s2 == '\0') { /* no invalid trailing characters? */
lua_pushnumber(L, (lua_Number)n);
return 1;
diff --git a/engines/sword25/util/lua/llex.cpp b/engines/sword25/util/lua/llex.cpp
index 464ab3ec15..f8433d3afa 100644
--- a/engines/sword25/util/lua/llex.cpp
+++ b/engines/sword25/util/lua/llex.cpp
@@ -5,9 +5,7 @@
*/
-#include <ctype.h>
-#include <stdio.h>
-#include <string.h>
+#include "common/util.h"
#define llex_c
#define LUA_CORE
@@ -188,7 +186,7 @@ static void trydecpoint (LexState *ls, SemInfo *seminfo) {
sprintf(buf, "%.1f", 1.0);
ls->decpoint = '.';
for (i = 0; buf[i]; i++) {
- if (!isspace(static_cast<unsigned char>(buf[i])) && !isdigit(static_cast<unsigned char>(buf[i]))) {
+ if (!Common::isSpace(buf[i]) && !Common::isDigit(buf[i])) {
ls->decpoint = buf[i];
break;
}
@@ -204,13 +202,13 @@ static void trydecpoint (LexState *ls, SemInfo *seminfo) {
/* LUA_NUMBER */
static void read_numeral (LexState *ls, SemInfo *seminfo) {
- lua_assert(isdigit(ls->current));
+ lua_assert(Common::isDigit(ls->current));
do {
save_and_next(ls);
- } while (isdigit(ls->current) || ls->current == '.');
+ } while (Common::isDigit(ls->current) || ls->current == '.');
if (check_next(ls, "Ee")) /* `E'? */
check_next(ls, "+-"); /* optional exponent sign */
- while (isalnum(ls->current) || ls->current == '_')
+ while (Common::isAlnum(ls->current) || ls->current == '_')
save_and_next(ls);
save(ls, '\0');
buffreplace(ls, '.', ls->decpoint); /* follow locale for decimal point */
@@ -313,7 +311,7 @@ static void read_string (LexState *ls, int del, SemInfo *seminfo) {
case '\r': save(ls, '\n'); inclinenumber(ls); continue;
case EOZ: continue; /* will raise an error next loop */
default: {
- if (!isdigit(ls->current))
+ if (!Common::isDigit(ls->current))
save_and_next(ls); /* handles \\, \", \', and \? */
else { /* \xxx */
int i = 0;
@@ -321,7 +319,7 @@ static void read_string (LexState *ls, int del, SemInfo *seminfo) {
do {
c = 10*c + (ls->current-'0');
next(ls);
- } while (++i<3 && isdigit(ls->current));
+ } while (++i<3 && Common::isDigit(ls->current));
if (c > UCHAR_MAX)
luaX_lexerror(ls, "escape sequence too large", TK_STRING);
save(ls, c);
@@ -412,7 +410,7 @@ static int llex (LexState *ls, SemInfo *seminfo) {
return TK_DOTS; /* ... */
else return TK_CONCAT; /* .. */
}
- else if (!isdigit(ls->current)) return '.';
+ else if (!Common::isDigit(ls->current)) return '.';
else {
read_numeral(ls, seminfo);
return TK_NUMBER;
@@ -422,21 +420,21 @@ static int llex (LexState *ls, SemInfo *seminfo) {
return TK_EOS;
}
default: {
- if (isspace(ls->current)) {
+ if (Common::isSpace(ls->current)) {
lua_assert(!currIsNewline(ls));
next(ls);
continue;
}
- else if (isdigit(ls->current)) {
+ else if (Common::isDigit(ls->current)) {
read_numeral(ls, seminfo);
return TK_NUMBER;
}
- else if (isalpha(ls->current) || ls->current == '_') {
+ else if (Common::isAlpha(ls->current) || ls->current == '_') {
/* identifier or reserved word */
TString *ts;
do {
save_and_next(ls);
- } while (isalnum(ls->current) || ls->current == '_');
+ } while (Common::isAlnum(ls->current) || ls->current == '_');
ts = luaX_newstring(ls, luaZ_buffer(ls->buff),
luaZ_bufflen(ls->buff));
if (ts->tsv.reserved > 0) /* reserved word? */
diff --git a/engines/sword25/util/lua/lobject.cpp b/engines/sword25/util/lua/lobject.cpp
index 24718931ed..1ffee52556 100644
--- a/engines/sword25/util/lua/lobject.cpp
+++ b/engines/sword25/util/lua/lobject.cpp
@@ -4,11 +4,7 @@
** See Copyright Notice in lua.h
*/
-#include <ctype.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
+#include "common/util.h"
#define lobject_c
#define LUA_CORE
@@ -94,7 +90,7 @@ int luaO_str2d (const char *s, lua_Number *result) {
if (*endptr == 'x' || *endptr == 'X') /* maybe an hexadecimal constant? */
*result = cast_num(strtoul(s, &endptr, 16));
if (*endptr == '\0') return 1; /* most common case */
- while (isspace(cast(unsigned char, *endptr))) endptr++;
+ while (Common::isSpace(*endptr)) endptr++;
if (*endptr != '\0') return 0; /* invalid trailing characters? */
return 1;
}
diff --git a/engines/sword25/util/lua/lstrlib.cpp b/engines/sword25/util/lua/lstrlib.cpp
index bcc869cb98..ed68a2fa00 100644
--- a/engines/sword25/util/lua/lstrlib.cpp
+++ b/engines/sword25/util/lua/lstrlib.cpp
@@ -5,6 +5,8 @@
*/
+#define FORBIDDEN_SYMBOL_EXCEPTION_ctype_h
+
#include <ctype.h>
#include <stddef.h>
#include <stdio.h>
diff --git a/engines/sword25/util/lua/luaconf.h b/engines/sword25/util/lua/luaconf.h
index f5affe9fd7..38ff9e1320 100644
--- a/engines/sword25/util/lua/luaconf.h
+++ b/engines/sword25/util/lua/luaconf.h
@@ -643,7 +643,7 @@ union luai_Cast { double l_d; long l_l; };
** CHANGE it if you have a way to implement it in your system.
*/
#define lua_popen(L,c,m) ((void)((void)c, m), \
- luaL_error(L, LUA_QL("popen") " not supported"), (FILE*)0)
+ luaL_error(L, LUA_QL("popen") " not supported"), (FILE *)0)
#define lua_pclose(L,file) ((void)((void)L, file), 0)
/*
diff --git a/engines/sword25/util/pluto/pluto.cpp b/engines/sword25/util/pluto/pluto.cpp
index 957f5af795..d645e5ed2a 100644
--- a/engines/sword25/util/pluto/pluto.cpp
+++ b/engines/sword25/util/pluto/pluto.cpp
@@ -159,7 +159,7 @@ static int persistspecialobject(PersistInfo *pi, int defaction)
lua_pushvalue(pi->L, -3);
/* perms reftbl ... obj mt __persist obj */
#ifdef PLUTO_PASS_USERDATA_TO_PERSIST
- lua_pushlightuserdata(pi->L, (void*)pi->writer);
+ lua_pushlightuserdata(pi->L, (void *)pi->writer);
lua_pushlightuserdata(pi->L, pi->ud);
/* perms reftbl ... obj mt __persist obj ud */
lua_call(pi->L, 3, 1);
@@ -663,7 +663,7 @@ static void persist(PersistInfo *pi)
}
lua_pushvalue(pi->L, -1);
/* perms reftbl ... obj obj */
- lua_pushlightuserdata(pi->L, (void*)(++(pi->counter)));
+ lua_pushlightuserdata(pi->L, (void *)(++(pi->counter)));
/* perms reftbl ... obj obj ref */
lua_rawset(pi->L, 2);
/* perms reftbl ... obj */
@@ -854,7 +854,7 @@ static void registerobject(int ref, UnpersistInfo *upi)
{
/* perms reftbl ... obj */
lua_checkstack(upi->L, 2);
- lua_pushlightuserdata(upi->L, (void*)ref);
+ lua_pushlightuserdata(upi->L, (void *)ref);
/* perms reftbl ... obj ref */
lua_pushvalue(upi->L, -2);
/* perms reftbl ... obj ref obj */
@@ -989,7 +989,7 @@ static void unpersisttable(int ref, UnpersistInfo *upi)
static UpVal *makeupval(lua_State *L, int stackpos)
{
UpVal *uv = pdep_new(L, UpVal);
- pdep_link(L, (GCObject*)uv, LUA_TUPVAL);
+ pdep_link(L, (GCObject *)uv, LUA_TUPVAL);
uv->tt = LUA_TUPVAL;
uv->v = &uv->u.value;
uv->u.l.prev = NULL;
@@ -1025,8 +1025,8 @@ static Proto *makefakeproto(lua_State *L, lu_byte nups)
static void boxupval_start(lua_State *L)
{
LClosure *lcl;
- lcl = (LClosure*)pdep_newLclosure(L, 1, hvalue(&L->l_gt));
- pushclosure(L, (Closure*)lcl);
+ lcl = (LClosure *)pdep_newLclosure(L, 1, hvalue(&L->l_gt));
+ pushclosure(L, (Closure *)lcl);
/* ... func */
lcl->p = makefakeproto(L, 1);
@@ -1053,7 +1053,7 @@ static void unboxupval(lua_State *L)
LClosure *lcl;
UpVal *uv;
- lcl = (LClosure*)clvalue(getobject(L, -1));
+ lcl = (LClosure *)clvalue(getobject(L, -1));
uv = lcl->upvals[0];
lua_pop(L, 1);
/* ... */
@@ -1071,8 +1071,8 @@ static void unpersistfunction(int ref, UnpersistInfo *upi)
verify(LIF(Z,read)(&upi->zio, &nupvalues, sizeof(lu_byte)) == 0);
- lcl = (LClosure*)pdep_newLclosure(upi->L, nupvalues, hvalue(&upi->L->l_gt));
- pushclosure(upi->L, (Closure*)lcl);
+ lcl = (LClosure *)pdep_newLclosure(upi->L, nupvalues, hvalue(&upi->L->l_gt));
+ pushclosure(upi->L, (Closure *)lcl);
/* perms reftbl ... func */
/* Put *some* proto in the closure, before the GC can find it */
@@ -1393,9 +1393,9 @@ static void unpersistthread(int ref, UnpersistInfo *upi)
verify(LIF(Z,read)(&upi->zio, &stackpos, sizeof(size_t)) == 0);
uv->v = L2->stack + stackpos;
- gcunlink(upi->L, (GCObject*)uv);
+ gcunlink(upi->L, (GCObject *)uv);
uv->marked = luaC_white(g);
- *nextslot = (GCObject*)uv;
+ *nextslot = (GCObject *)uv;
nextslot = &uv->next;
uv->u.l.prev = &G(L2)->uvhead;
uv->u.l.next = G(L2)->uvhead.u.l.next;
@@ -1482,7 +1482,7 @@ static int inreftable(lua_State *L, int ref)
int res;
lua_checkstack(L, 1);
/* perms reftbl ... */
- lua_pushlightuserdata(L, (void*)ref);
+ lua_pushlightuserdata(L, (void *)ref);
/* perms reftbl ... ref */
lua_gettable(L, 2);
/* perms reftbl ... obj? */
@@ -1571,7 +1571,7 @@ static void unpersist(UnpersistInfo *upi)
lua_pushnil(upi->L);
/* perms reftbl ... nil */
} else {
- lua_pushlightuserdata(upi->L, (void*)ref);
+ lua_pushlightuserdata(upi->L, (void *)ref);
/* perms reftbl ... ref */
lua_gettable(upi->L, 2);
/* perms reftbl ... obj? */
diff --git a/engines/tinsel/background.cpp b/engines/tinsel/background.cpp
index 72397db97f..8e3fc50f12 100644
--- a/engines/tinsel/background.cpp
+++ b/engines/tinsel/background.cpp
@@ -34,7 +34,7 @@ namespace Tinsel {
// FIXME: Avoid non-const global vars
// current background
-const BACKGND *pCurBgnd = NULL;
+const BACKGND *g_pCurBgnd = NULL;
/**
* Called to initialize a background.
@@ -46,7 +46,7 @@ void InitBackground(const BACKGND *pBgnd) {
PLAYFIELD *pPlayfield; // pointer to current playfield
// set current background
- pCurBgnd = pBgnd;
+ g_pCurBgnd = pBgnd;
// init background sky color
SetBgndColor(pBgnd->rgbSkyColor);
@@ -83,13 +83,13 @@ void PlayfieldSetPos(int which, int newXpos, int newYpos) {
PLAYFIELD *pPlayfield; // pointer to relavent playfield
// make sure there is a background
- assert(pCurBgnd != NULL);
+ assert(g_pCurBgnd != NULL);
// make sure the playfield number is in range
- assert(which >= 0 && which < pCurBgnd->numPlayfields);
+ assert(which >= 0 && which < g_pCurBgnd->numPlayfields);
// get playfield pointer
- pPlayfield = pCurBgnd->fieldArray + which;
+ pPlayfield = g_pCurBgnd->fieldArray + which;
// set new integer position
pPlayfield->fieldX = intToFrac(newXpos);
@@ -110,13 +110,13 @@ void PlayfieldGetPos(int which, int *pXpos, int *pYpos) {
PLAYFIELD *pPlayfield; // pointer to relavent playfield
// make sure there is a background
- assert(pCurBgnd != NULL);
+ assert(g_pCurBgnd != NULL);
// make sure the playfield number is in range
- assert(which >= 0 && which < pCurBgnd->numPlayfields);
+ assert(which >= 0 && which < g_pCurBgnd->numPlayfields);
// get playfield pointer
- pPlayfield = pCurBgnd->fieldArray + which;
+ pPlayfield = g_pCurBgnd->fieldArray + which;
// get current integer position
*pXpos = fracToInt(pPlayfield->fieldX);
@@ -132,13 +132,13 @@ int PlayfieldGetCenterX(int which) {
PLAYFIELD *pPlayfield; // pointer to relavent playfield
// make sure there is a background
- assert(pCurBgnd != NULL);
+ assert(g_pCurBgnd != NULL);
// make sure the playfield number is in range
- assert(which >= 0 && which < pCurBgnd->numPlayfields);
+ assert(which >= 0 && which < g_pCurBgnd->numPlayfields);
// get playfield pointer
- pPlayfield = pCurBgnd->fieldArray + which;
+ pPlayfield = g_pCurBgnd->fieldArray + which;
// get current integer position
return fracToInt(pPlayfield->fieldX) + SCREEN_WIDTH/2;
@@ -153,13 +153,13 @@ OBJECT **GetPlayfieldList(int which) {
PLAYFIELD *pPlayfield; // pointer to relavent playfield
// make sure there is a background
- assert(pCurBgnd != NULL);
+ assert(g_pCurBgnd != NULL);
// make sure the playfield number is in range
- assert(which >= 0 && which < pCurBgnd->numPlayfields);
+ assert(which >= 0 && which < g_pCurBgnd->numPlayfields);
// get playfield pointer
- pPlayfield = pCurBgnd->fieldArray + which;
+ pPlayfield = g_pCurBgnd->fieldArray + which;
// return the display list pointer for this playfield
return &pPlayfield->pDispList;
@@ -177,13 +177,13 @@ void DrawBackgnd() {
int prevX, prevY; // save interger part of position
Common::Point ptWin; // window top left
- if (pCurBgnd == NULL)
+ if (g_pCurBgnd == NULL)
return; // no current background
// scroll each background playfield
- for (i = 0; i < pCurBgnd->numPlayfields; i++) {
+ for (i = 0; i < g_pCurBgnd->numPlayfields; i++) {
// get pointer to correct playfield
- pPlay = pCurBgnd->fieldArray + i;
+ pPlay = g_pCurBgnd->fieldArray + i;
// save integer part of position
prevX = fracToInt(pPlay->fieldX);
@@ -220,11 +220,11 @@ void DrawBackgnd() {
for (RectList::const_iterator r = clipRects.begin(); r != clipRects.end(); ++r) {
// clear the clip rectangle on the virtual screen
// for each background playfield
- for (i = 0; i < pCurBgnd->numPlayfields; i++) {
+ for (i = 0; i < g_pCurBgnd->numPlayfields; i++) {
Common::Rect rcPlayClip; // clip rect for this playfield
// get pointer to correct playfield
- pPlay = pCurBgnd->fieldArray + i;
+ pPlay = g_pCurBgnd->fieldArray + i;
// convert fixed point window pos to a int
ptWin.x = fracToInt(pPlay->fieldX);
diff --git a/engines/tinsel/bg.cpp b/engines/tinsel/bg.cpp
index cf692e16ea..72ba05f0b9 100644
--- a/engines/tinsel/bg.cpp
+++ b/engines/tinsel/bg.cpp
@@ -47,59 +47,59 @@ namespace Tinsel {
#define MAX_BG 10
// FIXME: Avoid non-const global vars
-static SCNHANDLE hBgPal = 0; // Background's palette
-static POBJECT pBG[MAX_BG];
-static ANIM thisAnim[MAX_BG]; // used by BGmainProcess()
-static int BGspeed = 0;
-static SCNHANDLE hBackground = 0; // Current scene handle - stored in case of Save_Scene()
-static bool bDoFadeIn = false;
-static int bgReels;
+static SCNHANDLE g_hBgPal = 0; // Background's palette
+static POBJECT g_pBG[MAX_BG];
+static ANIM g_thisAnim[MAX_BG]; // used by BGmainProcess()
+static int g_BGspeed = 0;
+static SCNHANDLE g_hBackground = 0; // Current scene handle - stored in case of Save_Scene()
+static bool g_bDoFadeIn = false;
+static int g_bgReels;
/**
* GetBgObject
*/
OBJECT *GetBgObject() {
- return pBG[0];
+ return g_pBG[0];
}
/**
* BackPal
*/
SCNHANDLE BgPal() {
- return hBgPal;
+ return g_hBgPal;
}
/**
* SetDoFadeIn
*/
void SetDoFadeIn(bool tf) {
- bDoFadeIn = tf;
+ g_bDoFadeIn = tf;
}
/**
* Called before scene change.
*/
void DropBackground() {
- pBG[0] = NULL; // No background
+ g_pBG[0] = NULL; // No background
if (!TinselV2)
- hBgPal = 0; // No background palette
+ g_hBgPal = 0; // No background palette
}
/**
* Return the width of the current background.
*/
int BgWidth() {
- assert(pBG[0]);
- return MultiRightmost(pBG[0]) + 1;
+ assert(g_pBG[0]);
+ return MultiRightmost(g_pBG[0]) + 1;
}
/**
* Return the height of the current background.
*/
int BgHeight() {
- assert(pBG[0]);
- return MultiLowest(pBG[0]) + 1;
+ assert(g_pBG[0]);
+ return MultiLowest(g_pBG[0]) + 1;
}
/**
@@ -117,7 +117,7 @@ static void BGmainProcess(CORO_PARAM, const void *param) {
const MULTI_INIT *pmi;
// get the stuff copied to process when it was created
- if (pBG[0] == NULL) {
+ if (g_pBG[0] == NULL) {
/*** At start of scene ***/
if (!TinselV2) {
@@ -127,40 +127,40 @@ static void BGmainProcess(CORO_PARAM, const void *param) {
pmi = (const MULTI_INIT *)LockMem(FROM_LE_32(pReel->mobj));
// Initialize and insert the object, and initialize its script.
- pBG[0] = MultiInitObject(pmi);
- MultiInsertObject(GetPlayfieldList(FIELD_WORLD), pBG[0]);
- InitStepAnimScript(&thisAnim[0], pBG[0], FROM_LE_32(pReel->script), BGspeed);
- bgReels = 1;
+ g_pBG[0] = MultiInitObject(pmi);
+ MultiInsertObject(GetPlayfieldList(FIELD_WORLD), g_pBG[0]);
+ InitStepAnimScript(&g_thisAnim[0], g_pBG[0], FROM_LE_32(pReel->script), g_BGspeed);
+ g_bgReels = 1;
} else {
/*** At start of scene ***/
- pFilm = (const FILM *)LockMem(hBackground);
- bgReels = FROM_LE_32(pFilm->numreels);
+ pFilm = (const FILM *)LockMem(g_hBackground);
+ g_bgReels = FROM_LE_32(pFilm->numreels);
int i;
- for (i = 0; i < bgReels; i++) {
+ for (i = 0; i < g_bgReels; i++) {
// Get the MULTI_INIT structure
pmi = (PMULTI_INIT) LockMem(FROM_LE_32(pFilm->reels[i].mobj));
// Initialize and insert the object, and initialize its script.
- pBG[i] = MultiInitObject(pmi);
- MultiInsertObject(GetPlayfieldList(FIELD_WORLD), pBG[i]);
- MultiSetZPosition(pBG[i], 0);
- InitStepAnimScript(&thisAnim[i], pBG[i], FROM_LE_32(pFilm->reels[i].script), BGspeed);
+ g_pBG[i] = MultiInitObject(pmi);
+ MultiInsertObject(GetPlayfieldList(FIELD_WORLD), g_pBG[i]);
+ MultiSetZPosition(g_pBG[i], 0);
+ InitStepAnimScript(&g_thisAnim[i], g_pBG[i], FROM_LE_32(pFilm->reels[i].script), g_BGspeed);
if (i > 0)
- pBG[i-1]->pSlave = pBG[i];
+ g_pBG[i-1]->pSlave = g_pBG[i];
}
}
- if (bDoFadeIn) {
+ if (g_bDoFadeIn) {
FadeInFast(NULL);
- bDoFadeIn = false;
+ g_bDoFadeIn = false;
} else if (TinselV2)
PokeInTagColor();
for (;;) {
- for (int i = 0; i < bgReels; i++) {
- if (StepAnimScript(&thisAnim[i]) == ScriptFinished)
+ for (int i = 0; i < g_bgReels; i++) {
+ if (StepAnimScript(&g_thisAnim[i]) == ScriptFinished)
error("Background animation has finished");
}
@@ -170,16 +170,16 @@ static void BGmainProcess(CORO_PARAM, const void *param) {
// New background during scene
if (!TinselV2) {
pReel = (const FREEL *)param;
- InitStepAnimScript(&thisAnim[0], pBG[0], FROM_LE_32(pReel->script), BGspeed);
- StepAnimScript(&thisAnim[0]);
+ InitStepAnimScript(&g_thisAnim[0], g_pBG[0], FROM_LE_32(pReel->script), g_BGspeed);
+ StepAnimScript(&g_thisAnim[0]);
} else {
- pFilm = (const FILM *)LockMem(hBackground);
- assert(bgReels == (int32)FROM_LE_32(pFilm->numreels));
+ pFilm = (const FILM *)LockMem(g_hBackground);
+ assert(g_bgReels == (int32)FROM_LE_32(pFilm->numreels));
// Just re-initialize the scripts.
- for (int i = 0; i < bgReels; i++) {
- InitStepAnimScript(&thisAnim[i], pBG[i], pFilm->reels[i].script, BGspeed);
- StepAnimScript(&thisAnim[i]);
+ for (int i = 0; i < g_bgReels; i++) {
+ InitStepAnimScript(&g_thisAnim[i], g_pBG[i], pFilm->reels[i].script, g_BGspeed);
+ StepAnimScript(&g_thisAnim[i]);
}
}
}
@@ -206,7 +206,7 @@ static void BGotherProcess(CORO_PARAM, const void *param) {
_ctx->pObj = MultiInitObject(pmi);
MultiInsertObject(GetPlayfieldList(FIELD_WORLD), _ctx->pObj);
- InitStepAnimScript(&_ctx->anim, pBG[0], FROM_LE_32(pReel->script), BGspeed);
+ InitStepAnimScript(&_ctx->anim, g_pBG[0], FROM_LE_32(pReel->script), g_BGspeed);
while (StepAnimScript(&_ctx->anim) != ScriptFinished)
CORO_SLEEP(1);
@@ -218,14 +218,14 @@ static void BGotherProcess(CORO_PARAM, const void *param) {
* AetBgPal()
*/
void SetBackPal(SCNHANDLE hPal) {
- hBgPal = hPal;
+ g_hBgPal = hPal;
- FettleFontPal(hBgPal);
- CreateTranslucentPalette(hBgPal);
+ FettleFontPal(g_hBgPal);
+ CreateTranslucentPalette(g_hBgPal);
}
void ChangePalette(SCNHANDLE hPal) {
- SwapPalette(FindPalette(hBgPal), hPal);
+ SwapPalette(FindPalette(g_hBgPal), hPal);
SetBackPal(hPal);
}
@@ -245,14 +245,14 @@ void StartupBackground(CORO_PARAM, SCNHANDLE hFilm) {
const FILM *pfilm;
IMAGE *pim;
- hBackground = hFilm; // Save handle in case of Save_Scene()
+ g_hBackground = hFilm; // Save handle in case of Save_Scene()
pim = GetImageFromFilm(hFilm, 0, NULL, NULL, &pfilm);
SetBackPal(FROM_LE_32(pim->hImgPal));
// Extract the film speed
- BGspeed = ONE_SECOND / FROM_LE_32(pfilm->frate);
+ g_BGspeed = ONE_SECOND / FROM_LE_32(pfilm->frate);
// Start display process for each reel in the film
g_scheduler->createProcess(PID_REEL, BGmainProcess, &pfilm->reels[0], sizeof(FREEL));
@@ -262,7 +262,7 @@ void StartupBackground(CORO_PARAM, SCNHANDLE hFilm) {
g_scheduler->createProcess(PID_REEL, BGotherProcess, &pfilm->reels[i], sizeof(FREEL));
}
- if (pBG[0] == NULL)
+ if (g_pBG[0] == NULL)
ControlStartOff();
if (TinselV2 && (coroParam != nullContext))
@@ -275,7 +275,7 @@ void StartupBackground(CORO_PARAM, SCNHANDLE hFilm) {
* Return the current scene handle.
*/
SCNHANDLE GetBgroundHandle() {
- return hBackground;
+ return g_hBackground;
}
} // End of namespace Tinsel
diff --git a/engines/tinsel/cursor.cpp b/engines/tinsel/cursor.cpp
index 8248609a81..bf901c03b6 100644
--- a/engines/tinsel/cursor.cpp
+++ b/engines/tinsel/cursor.cpp
@@ -56,36 +56,36 @@ namespace Tinsel {
// FIXME: Avoid non-const global vars
-static OBJECT *McurObj = NULL; // Main cursor object
-static OBJECT *AcurObj = NULL; // Auxiliary cursor object
+static OBJECT *g_McurObj = NULL; // Main cursor object
+static OBJECT *g_AcurObj = NULL; // Auxiliary cursor object
-static ANIM McurAnim = {0,0,0,0,0}; // Main cursor animation structure
-static ANIM AcurAnim = {0,0,0,0,0}; // Auxiliary cursor animation structure
+static ANIM g_McurAnim = {0,0,0,0,0}; // Main cursor animation structure
+static ANIM g_AcurAnim = {0,0,0,0,0}; // Auxiliary cursor animation structure
-static bool bHiddenCursor = false; // Set when cursor is hidden
-static bool bTempNoTrailers = false; // Set when cursor trails are hidden
-static bool bTempHide = false; // Set when cursor is hidden
+static bool g_bHiddenCursor = false; // Set when cursor is hidden
+static bool g_bTempNoTrailers = false; // Set when cursor trails are hidden
+static bool g_bTempHide = false; // Set when cursor is hidden
-static bool bFrozenCursor = false; // Set when cursor position is frozen
+static bool g_bFrozenCursor = false; // Set when cursor position is frozen
-static frac_t IterationSize = 0;
+static frac_t g_IterationSize = 0;
-static SCNHANDLE hCursorFilm = 0; // Handle to cursor reel data
+static SCNHANDLE g_hCursorFilm = 0; // Handle to cursor reel data
-static int numTrails = 0;
-static int nextTrail = 0;
+static int g_numTrails = 0;
+static int g_nextTrail = 0;
-static bool bWhoa = false; // Set by DropCursor() at the end of a scene
+static bool g_bWhoa = false; // Set by DropCursor() at the end of a scene
// - causes cursor processes to do nothing
// Reset when main cursor has re-initialized
-static uint16 restart = 0; // When main cursor has been bWhoa-ed, it waits
+static uint16 g_restart = 0; // When main cursor has been bWhoa-ed, it waits
// for this to be set to 0x8000.
// Main cursor sets all the bits after a re-start
// - each cursor trail examines it's own bit
// to trigger a trail restart.
-static short ACoX = 0, ACoY = 0; // Auxillary cursor image's animation offsets
+static short g_ACoX = 0, g_ACoY = 0; // Auxillary cursor image's animation offsets
@@ -96,9 +96,9 @@ static struct {
ANIM trailAnim; // Animation structure
OBJECT *trailObj; // This trailer's object
-} ntrailData [MAX_TRAILERS];
+} g_ntrailData [MAX_TRAILERS];
-static int lastCursorX = 0, lastCursorY = 0;
+static int g_lastCursorX = 0, g_lastCursorY = 0;
//----------------- FORWARD REFERENCES --------------------
@@ -116,26 +116,26 @@ static void InitCurTrailObj(int i, int x, int y) {
const FILM *pfilm;
- if (!numTrails)
+ if (!g_numTrails)
return;
// Get rid of old object
- if (ntrailData[i].trailObj != NULL)
- MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), ntrailData[i].trailObj);
+ if (g_ntrailData[i].trailObj != NULL)
+ MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), g_ntrailData[i].trailObj);
- pim = GetImageFromFilm(hCursorFilm, i+1, &pfr, &pmi, &pfilm);// Get pointer to image
+ pim = GetImageFromFilm(g_hCursorFilm, i+1, &pfr, &pmi, &pfilm);// Get pointer to image
assert(BgPal()); // No background palette
pim->hImgPal = TO_LE_32(BgPal());
// Initialize and insert the object, set its Z-pos, and hide it
- ntrailData[i].trailObj = MultiInitObject(pmi);
- MultiInsertObject(GetPlayfieldList(FIELD_STATUS), ntrailData[i].trailObj);
- MultiSetZPosition(ntrailData[i].trailObj, Z_CURSORTRAIL);
- MultiSetAniXY(ntrailData[i].trailObj, x, y);
+ g_ntrailData[i].trailObj = MultiInitObject(pmi);
+ MultiInsertObject(GetPlayfieldList(FIELD_STATUS), g_ntrailData[i].trailObj);
+ MultiSetZPosition(g_ntrailData[i].trailObj, Z_CURSORTRAIL);
+ MultiSetAniXY(g_ntrailData[i].trailObj, x, y);
// Initialize the animation script
- InitStepAnimScript(&ntrailData[i].trailAnim, ntrailData[i].trailObj, FROM_LE_32(pfr->script), ONE_SECOND / FROM_LE_32(pfilm->frate));
- StepAnimScript(&ntrailData[i].trailAnim);
+ InitStepAnimScript(&g_ntrailData[i].trailAnim, g_ntrailData[i].trailObj, FROM_LE_32(pfr->script), ONE_SECOND / FROM_LE_32(pfilm->frate));
+ StepAnimScript(&g_ntrailData[i].trailAnim);
}
/**
@@ -196,12 +196,12 @@ void SetCursorScreenXY(int newx, int newy) {
* Returns false if there is no cursor object.
*/
bool GetCursorXYNoWait(int *x, int *y, bool absolute) {
- if (McurObj == NULL) {
+ if (g_McurObj == NULL) {
*x = *y = 0;
return false;
}
- GetAniPosition(McurObj, x, y);
+ GetAniPosition(g_McurObj, x, y);
if (absolute) {
int Loffset, Toffset; // Screen offset
@@ -222,7 +222,7 @@ bool GetCursorXYNoWait(int *x, int *y, bool absolute) {
void GetCursorXY(int *x, int *y, bool absolute) {
//while (McurObj == NULL)
// ProcessSleepSelf();
- assert(McurObj);
+ assert(g_McurObj);
GetCursorXYNoWait(x, y, absolute);
}
@@ -234,22 +234,22 @@ void GetCursorXY(int *x, int *y, bool absolute) {
void RestoreMainCursor() {
const FILM *pfilm;
- if (McurObj != NULL) {
- pfilm = (const FILM *)LockMem(hCursorFilm);
+ if (g_McurObj != NULL) {
+ pfilm = (const FILM *)LockMem(g_hCursorFilm);
- InitStepAnimScript(&McurAnim, McurObj, FROM_LE_32(pfilm->reels->script), ONE_SECOND / FROM_LE_32(pfilm->frate));
- StepAnimScript(&McurAnim);
+ InitStepAnimScript(&g_McurAnim, g_McurObj, FROM_LE_32(pfilm->reels->script), ONE_SECOND / FROM_LE_32(pfilm->frate));
+ StepAnimScript(&g_McurAnim);
}
- bHiddenCursor = false;
- bFrozenCursor = false;
+ g_bHiddenCursor = false;
+ g_bFrozenCursor = false;
}
/**
* Called from INVENTRY.C to customise the main cursor.
*/
void SetTempCursor(SCNHANDLE pScript) {
- if (McurObj != NULL)
- InitStepAnimScript(&McurAnim, McurObj, pScript, 2);
+ if (g_McurObj != NULL)
+ InitStepAnimScript(&g_McurAnim, g_McurObj, pScript, 2);
}
/**
@@ -258,17 +258,17 @@ void SetTempCursor(SCNHANDLE pScript) {
void DwHideCursor() {
int i;
- bHiddenCursor = true;
+ g_bHiddenCursor = true;
- if (McurObj)
- MultiHideObject(McurObj);
- if (AcurObj)
- MultiHideObject(AcurObj);
+ if (g_McurObj)
+ MultiHideObject(g_McurObj);
+ if (g_AcurObj)
+ MultiHideObject(g_AcurObj);
- for (i = 0; i < numTrails; i++) {
- if (ntrailData[i].trailObj != NULL) {
- MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), ntrailData[i].trailObj);
- ntrailData[i].trailObj = NULL;
+ for (i = 0; i < g_numTrails; i++) {
+ if (g_ntrailData[i].trailObj != NULL) {
+ MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), g_ntrailData[i].trailObj);
+ g_ntrailData[i].trailObj = NULL;
}
}
}
@@ -277,21 +277,21 @@ void DwHideCursor() {
* Unhide the cursor.
*/
void UnHideCursor() {
- bHiddenCursor = false;
+ g_bHiddenCursor = false;
}
/**
* Freeze the cursor.
*/
void FreezeCursor() {
- bFrozenCursor = true;
+ g_bFrozenCursor = true;
}
/**
* Freeze the cursor, or not.
*/
void DoFreezeCursor(bool bFreeze) {
- bFrozenCursor = bFreeze;
+ g_bFrozenCursor = bFreeze;
}
/**
@@ -300,12 +300,12 @@ void DoFreezeCursor(bool bFreeze) {
void HideCursorTrails() {
int i;
- bTempNoTrailers = true;
+ g_bTempNoTrailers = true;
- for (i = 0; i < numTrails; i++) {
- if (ntrailData[i].trailObj != NULL) {
- MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), ntrailData[i].trailObj);
- ntrailData[i].trailObj = NULL;
+ for (i = 0; i < g_numTrails; i++) {
+ if (g_ntrailData[i].trailObj != NULL) {
+ MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), g_ntrailData[i].trailObj);
+ g_ntrailData[i].trailObj = NULL;
}
}
}
@@ -314,7 +314,7 @@ void HideCursorTrails() {
* UnHideCursorTrails
*/
void UnHideCursorTrails() {
- bTempNoTrailers = false;
+ g_bTempNoTrailers = false;
}
/**
@@ -356,9 +356,9 @@ IMAGE *GetImageFromFilm(SCNHANDLE hFilm, int reel, const FREEL **ppfr, const MUL
* Delete auxillary cursor. Restore animation offsets in the image.
*/
void DelAuxCursor() {
- if (AcurObj != NULL) {
- MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), AcurObj);
- AcurObj = NULL;
+ if (g_AcurObj != NULL) {
+ MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), g_AcurObj);
+ g_AcurObj = NULL;
}
}
@@ -381,21 +381,21 @@ void SetAuxCursor(SCNHANDLE hFilm) {
assert(BgPal()); // no background palette
pim->hImgPal = TO_LE_32(BgPal()); // Poke in the background palette
- ACoX = (short)(FROM_LE_16(pim->imgWidth)/2 - ((int16) FROM_LE_16(pim->anioffX)));
- ACoY = (short)((FROM_LE_16(pim->imgHeight) & ~C16_FLAG_MASK)/2 -
+ g_ACoX = (short)(FROM_LE_16(pim->imgWidth)/2 - ((int16) FROM_LE_16(pim->anioffX)));
+ g_ACoY = (short)((FROM_LE_16(pim->imgHeight) & ~C16_FLAG_MASK)/2 -
((int16) FROM_LE_16(pim->anioffY)));
// Initialize and insert the auxillary cursor object
- AcurObj = MultiInitObject(pmi);
- MultiInsertObject(GetPlayfieldList(FIELD_STATUS), AcurObj);
+ g_AcurObj = MultiInitObject(pmi);
+ MultiInsertObject(GetPlayfieldList(FIELD_STATUS), g_AcurObj);
// Initialize the animation and set its position
- InitStepAnimScript(&AcurAnim, AcurObj, FROM_LE_32(pfr->script), ONE_SECOND / FROM_LE_32(pfilm->frate));
- MultiSetAniXY(AcurObj, x - ACoX, y - ACoY);
- MultiSetZPosition(AcurObj, Z_ACURSOR);
+ InitStepAnimScript(&g_AcurAnim, g_AcurObj, FROM_LE_32(pfr->script), ONE_SECOND / FROM_LE_32(pfilm->frate));
+ MultiSetAniXY(g_AcurObj, x - g_ACoX, y - g_ACoY);
+ MultiSetZPosition(g_AcurObj, Z_ACURSOR);
- if (bHiddenCursor)
- MultiHideObject(AcurObj);
+ if (g_bHiddenCursor)
+ MultiHideObject(g_AcurObj);
}
/**
@@ -421,52 +421,52 @@ static void DoCursorMove() {
dir = _vm->getKeyDirection();
if (dir != 0) {
if (dir & MSK_LEFT)
- newX -= IterationSize;
+ newX -= g_IterationSize;
if (dir & MSK_RIGHT)
- newX += IterationSize;
+ newX += g_IterationSize;
if (dir & MSK_UP)
- newY -= IterationSize;
+ newY -= g_IterationSize;
if (dir & MSK_DOWN)
- newY += IterationSize;
+ newY += g_IterationSize;
- IterationSize += ITER_ACCELERATION;
+ g_IterationSize += ITER_ACCELERATION;
// set new mouse driver position
_vm->setMousePosition(Common::Point(fracToInt(newX), fracToInt(newY)));
} else
- IterationSize = ITERATION_BASE;
+ g_IterationSize = ITERATION_BASE;
// get new mouse driver position - could have been modified
ptMouse = _vm->getMousePosition();
- if (lastCursorX != ptMouse.x || lastCursorY != ptMouse.y) {
+ if (g_lastCursorX != ptMouse.x || g_lastCursorY != ptMouse.y) {
resetUserEventTime();
- if (!bTempNoTrailers && !bHiddenCursor) {
- InitCurTrailObj(nextTrail++, lastCursorX, lastCursorY);
- if (nextTrail == numTrails)
- nextTrail = 0;
+ if (!g_bTempNoTrailers && !g_bHiddenCursor) {
+ InitCurTrailObj(g_nextTrail++, g_lastCursorX, g_lastCursorY);
+ if (g_nextTrail == g_numTrails)
+ g_nextTrail = 0;
}
}
// adjust cursor to new mouse position
- if (McurObj)
- MultiSetAniXY(McurObj, ptMouse.x, ptMouse.y);
- if (AcurObj != NULL)
- MultiSetAniXY(AcurObj, ptMouse.x - ACoX, ptMouse.y - ACoY);
+ if (g_McurObj)
+ MultiSetAniXY(g_McurObj, ptMouse.x, ptMouse.y);
+ if (g_AcurObj != NULL)
+ MultiSetAniXY(g_AcurObj, ptMouse.x - g_ACoX, ptMouse.y - g_ACoY);
- if (InventoryActive() && McurObj) {
+ if (InventoryActive() && g_McurObj) {
// Notify the inventory
Xmovement(ptMouse.x - startX);
Ymovement(ptMouse.y - startY);
}
- lastCursorX = ptMouse.x;
- lastCursorY = ptMouse.y;
+ g_lastCursorX = ptMouse.x;
+ g_lastCursorY = ptMouse.y;
}
/**
@@ -479,7 +479,7 @@ static void InitCurObj() {
IMAGE *pim;
if (TinselV2) {
- pFilm = (const FILM *)LockMem(hCursorFilm);
+ pFilm = (const FILM *)LockMem(g_hCursorFilm);
pfr = (const FREEL *)&pFilm->reels[0];
pmi = (MULTI_INIT *)LockMem(FROM_LE_32(pfr->mobj));
@@ -487,16 +487,16 @@ static void InitCurObj() {
} else {
assert(BgPal()); // no background palette
- pim = GetImageFromFilm(hCursorFilm, 0, &pfr, &pmi, &pFilm);// Get pointer to image
+ pim = GetImageFromFilm(g_hCursorFilm, 0, &pfr, &pmi, &pFilm);// Get pointer to image
pim->hImgPal = TO_LE_32(BgPal());
- AcurObj = NULL; // No auxillary cursor
+ g_AcurObj = NULL; // No auxillary cursor
}
- McurObj = MultiInitObject(pmi);
- MultiInsertObject(GetPlayfieldList(FIELD_STATUS), McurObj);
+ g_McurObj = MultiInitObject(pmi);
+ MultiInsertObject(GetPlayfieldList(FIELD_STATUS), g_McurObj);
- InitStepAnimScript(&McurAnim, McurObj, FROM_LE_32(pfr->script), ONE_SECOND / FROM_LE_32(pFilm->frate));
+ InitStepAnimScript(&g_McurAnim, g_McurObj, FROM_LE_32(pfr->script), ONE_SECOND / FROM_LE_32(pFilm->frate));
}
/**
@@ -504,14 +504,14 @@ static void InitCurObj() {
*/
static void InitCurPos() {
Common::Point ptMouse = _vm->getMousePosition();
- lastCursorX = ptMouse.x;
- lastCursorY = ptMouse.y;
+ g_lastCursorX = ptMouse.x;
+ g_lastCursorY = ptMouse.y;
- MultiSetZPosition(McurObj, Z_CURSOR);
+ MultiSetZPosition(g_McurObj, Z_CURSOR);
DoCursorMove();
- MultiHideObject(McurObj);
+ MultiHideObject(g_McurObj);
- IterationSize = ITERATION_BASE;
+ g_IterationSize = ITERATION_BASE;
}
/**
@@ -525,9 +525,9 @@ static void CursorStoppedCheck(CORO_PARAM) {
CORO_BEGIN_CODE(_ctx);
// If scene is closing down
- if (bWhoa) {
+ if (g_bWhoa) {
// ...wait for next scene start-up
- while (restart != 0x8000)
+ while (g_restart != 0x8000)
CORO_SLEEP(1);
// Re-initialize
@@ -536,8 +536,8 @@ static void CursorStoppedCheck(CORO_PARAM) {
InventoryIconCursor(false); // May be holding something
// Re-start the cursor trails
- restart = (uint16)-1; // set all bits
- bWhoa = false;
+ g_restart = (uint16)-1; // set all bits
+ g_bWhoa = false;
}
CORO_END_CODE;
}
@@ -552,15 +552,15 @@ void CursorProcess(CORO_PARAM, const void *) {
CORO_BEGIN_CODE(_ctx);
- while (!hCursorFilm || !BgPal())
+ while (!g_hCursorFilm || !BgPal())
CORO_SLEEP(1);
InitCurObj();
InitCurPos();
InventoryIconCursor(false); // May be holding something
- bWhoa = false;
- restart = 0;
+ g_bWhoa = false;
+ g_restart = 0;
while (1) {
// allow rescheduling
@@ -570,36 +570,36 @@ void CursorProcess(CORO_PARAM, const void *) {
CORO_INVOKE_0(CursorStoppedCheck);
// Step the animation script(s)
- StepAnimScript(&McurAnim);
- if (AcurObj != NULL)
- StepAnimScript(&AcurAnim);
- for (int i = 0; i < numTrails; i++) {
- if (ntrailData[i].trailObj != NULL) {
- if (StepAnimScript(&ntrailData[i].trailAnim) == ScriptFinished) {
- MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), ntrailData[i].trailObj);
- ntrailData[i].trailObj = NULL;
+ StepAnimScript(&g_McurAnim);
+ if (g_AcurObj != NULL)
+ StepAnimScript(&g_AcurAnim);
+ for (int i = 0; i < g_numTrails; i++) {
+ if (g_ntrailData[i].trailObj != NULL) {
+ if (StepAnimScript(&g_ntrailData[i].trailAnim) == ScriptFinished) {
+ MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), g_ntrailData[i].trailObj);
+ g_ntrailData[i].trailObj = NULL;
}
}
}
// Move the cursor as appropriate
- if (!bFrozenCursor)
+ if (!g_bFrozenCursor)
DoCursorMove();
// If the cursor should be hidden...
- if (bHiddenCursor || bTempHide) {
+ if (g_bHiddenCursor || g_bTempHide) {
// ...hide the cursor object(s)
- MultiHideObject(McurObj);
- if (AcurObj)
- MultiHideObject(AcurObj);
+ MultiHideObject(g_McurObj);
+ if (g_AcurObj)
+ MultiHideObject(g_AcurObj);
- for (int i = 0; i < numTrails; i++) {
- if (ntrailData[i].trailObj != NULL)
- MultiHideObject(ntrailData[i].trailObj);
+ for (int i = 0; i < g_numTrails; i++) {
+ if (g_ntrailData[i].trailObj != NULL)
+ MultiHideObject(g_ntrailData[i].trailObj);
}
// Wait 'til cursor is again required.
- while (bHiddenCursor) {
+ while (g_bHiddenCursor) {
CORO_SLEEP(1);
// Stop/start between scenes
@@ -617,12 +617,12 @@ void CursorProcess(CORO_PARAM, const void *) {
void DwInitCursor(SCNHANDLE bfilm) {
const FILM *pfilm;
- hCursorFilm = bfilm;
+ g_hCursorFilm = bfilm;
- pfilm = (const FILM *)LockMem(hCursorFilm);
- numTrails = FROM_LE_32(pfilm->numreels) - 1;
+ pfilm = (const FILM *)LockMem(g_hCursorFilm);
+ g_numTrails = FROM_LE_32(pfilm->numreels) - 1;
- assert(numTrails <= MAX_TRAILERS);
+ assert(g_numTrails <= MAX_TRAILERS);
}
/**
@@ -630,24 +630,24 @@ void DwInitCursor(SCNHANDLE bfilm) {
*/
void DropCursor() {
if (TinselV2) {
- if (AcurObj)
- MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), AcurObj);
- if (McurObj)
- MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), McurObj);
+ if (g_AcurObj)
+ MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), g_AcurObj);
+ if (g_McurObj)
+ MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), g_McurObj);
- restart = 0;
+ g_restart = 0;
}
- AcurObj = NULL; // No auxillary cursor
- McurObj = NULL; // No cursor object (imminently deleted elsewhere)
- bHiddenCursor = false; // Not hidden in next scene
- bTempNoTrailers = false; // Trailers not hidden in next scene
- bWhoa = true; // Suspend cursor processes
+ g_AcurObj = NULL; // No auxillary cursor
+ g_McurObj = NULL; // No cursor object (imminently deleted elsewhere)
+ g_bHiddenCursor = false; // Not hidden in next scene
+ g_bTempNoTrailers = false; // Trailers not hidden in next scene
+ g_bWhoa = true; // Suspend cursor processes
- for (int i = 0; i < numTrails; i++) {
- if (ntrailData[i].trailObj != NULL) {
- MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), ntrailData[i].trailObj);
- ntrailData[i].trailObj = NULL;
+ for (int i = 0; i < g_numTrails; i++) {
+ if (g_ntrailData[i].trailObj != NULL) {
+ MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), g_ntrailData[i].trailObj);
+ g_ntrailData[i].trailObj = NULL;
}
}
}
@@ -656,7 +656,7 @@ void DropCursor() {
* RestartCursor is called when a new scene is starting up.
*/
void RestartCursor() {
- restart = 0x8000; // Get the main cursor to re-initialize
+ g_restart = 0x8000; // Get the main cursor to re-initialize
}
/**
@@ -664,32 +664,32 @@ void RestartCursor() {
* pointers etc.
*/
void RebootCursor() {
- McurObj = AcurObj = NULL;
+ g_McurObj = g_AcurObj = NULL;
for (int i = 0; i < MAX_TRAILERS; i++)
- ntrailData[i].trailObj = NULL;
+ g_ntrailData[i].trailObj = NULL;
- bHiddenCursor = bTempNoTrailers = bFrozenCursor = false;
+ g_bHiddenCursor = g_bTempNoTrailers = g_bFrozenCursor = false;
- hCursorFilm = 0;
+ g_hCursorFilm = 0;
- bWhoa = false;
- restart = 0;
+ g_bWhoa = false;
+ g_restart = 0;
}
void StartCursorFollowed() {
DelAuxCursor();
if (!SysVar(SV_ENABLEPRINTCURSOR))
- bTempHide = true;
+ g_bTempHide = true;
}
void EndCursorFollowed() {
InventoryIconCursor(false); // May be holding something
- bTempHide = false;
+ g_bTempHide = false;
}
bool isCursorShown() {
- return !(bTempHide || bHiddenCursor);
+ return !(g_bTempHide || g_bHiddenCursor);
}
} // End of namespace Tinsel
diff --git a/engines/tinsel/detection.cpp b/engines/tinsel/detection.cpp
index 1fce032633..0f662e22bd 100644
--- a/engines/tinsel/detection.cpp
+++ b/engines/tinsel/detection.cpp
@@ -169,7 +169,7 @@ struct SizeMD5 {
};
typedef Common::HashMap<Common::String, SizeMD5, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> SizeMD5Map;
typedef Common::HashMap<Common::String, Common::FSNode, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> FileMap;
-typedef Common::Array<const ADGameDescription*> ADGameDescList;
+typedef Common::Array<const ADGameDescription *> ADGameDescList;
/**
* Fallback detection scans the list of Discworld 2 targets to see if it can detect an installation
diff --git a/engines/tinsel/dialogs.cpp b/engines/tinsel/dialogs.cpp
index 6ca070b67a..5396e47566 100644
--- a/engines/tinsel/dialogs.cpp
+++ b/engines/tinsel/dialogs.cpp
@@ -63,17 +63,6 @@
namespace Tinsel {
-//----------------- EXTERNAL GLOBAL DATA --------------------
-
-// In DOS_DW.C
-extern bool bRestart; // restart flag - set to restart the game
-
-#ifdef MAC_OPTIONS
-// In MAC_SOUND.C
-extern int volMaster;
-#endif
-
-
//----------------- LOCAL DEFINES --------------------
#define HOPPER_FILENAME "hopper"
@@ -312,23 +301,23 @@ static const int vFillers[MAXVICONS] = {
//----- Permanent data (set once) -----
-static SCNHANDLE hWinParts = 0; // Window members and cursors' graphic data
-static SCNHANDLE flagFilm = 0; // Window members and cursors' graphic data
-static SCNHANDLE configStrings[20];
+static SCNHANDLE g_hWinParts = 0; // Window members and cursors' graphic data
+static SCNHANDLE g_flagFilm = 0; // Window members and cursors' graphic data
+static SCNHANDLE g_configStrings[20];
-static INV_OBJECT *invObjects = NULL; // Inventory objects' data
-static int numObjects = 0; // Number of inventory objects
-static SCNHANDLE *invFilms = NULL;
-static bool bNoLanguage = false;
-static DIRECTION initialDirection;
+static INV_OBJECT *g_invObjects = NULL; // Inventory objects' data
+static int g_numObjects = 0; // Number of inventory objects
+static SCNHANDLE *g_invFilms = NULL;
+static bool g_bNoLanguage = false;
+static DIRECTION g_initialDirection;
//----- Permanent data (updated, valid while inventory closed) -----
-static enum {NO_INV, IDLE_INV, ACTIVE_INV, BOGUS_INV} InventoryState;
+static enum {NO_INV, IDLE_INV, ACTIVE_INV, BOGUS_INV} g_InventoryState;
-static int HeldItem = INV_NOICON; // Current held item
+static int g_heldItem = INV_NOICON; // Current held item
-static SCNHANDLE heldFilm;
+static SCNHANDLE g_heldFilm;
struct INV_DEF {
@@ -364,60 +353,60 @@ struct INV_DEF {
};
-static INV_DEF InvD[NUM_INV]; // Conversation + 2 inventories + ...
+static INV_DEF g_InvD[NUM_INV]; // Conversation + 2 inventories + ...
// Permanent contents of conversation inventory
-static int permIcons[MAX_PERMICONS]; // Basic items i.e. permanent contents
-static int numPermIcons = 0; // - copy to conv. inventory at pop-up time
-static int numEndIcons = 0;
+static int g_permIcons[MAX_PERMICONS]; // Basic items i.e. permanent contents
+static int g_numPermIcons = 0; // - copy to conv. inventory at pop-up time
+static int g_numEndIcons = 0;
//----- Data pertinant to current active inventory -----
-static int ino = 0; // Which inventory is currently active
+static int g_ino = 0; // Which inventory is currently active
-static bool InventoryHidden = false;
-static bool InventoryMaximised = false;
+static bool g_InventoryHidden = false;
+static bool g_InventoryMaximised = false;
static enum { ID_NONE, ID_MOVE, ID_SLIDE,
ID_BOTTOM, ID_TOP, ID_LEFT, ID_RIGHT,
ID_TLEFT, ID_TRIGHT, ID_BLEFT, ID_BRIGHT,
- ID_CSLIDE, ID_MDCONT } InvDragging;
+ ID_CSLIDE, ID_MDCONT } g_InvDragging;
-static int SuppH = 0; // 'Linear' element of
-static int SuppV = 0; // dimensions during re-sizing
+static int g_SuppH = 0; // 'Linear' element of
+static int g_SuppV = 0; // dimensions during re-sizing
-static int Ychange = 0; //
-static int Ycompensate = 0; // All to do with re-sizing.
-static int Xchange = 0; //
-static int Xcompensate = 0; //
+static int g_Ychange = 0; //
+static int g_Ycompensate = 0; // All to do with re-sizing.
+static int g_Xchange = 0; //
+static int g_Xcompensate = 0; //
-static bool ItemsChanged = 0; // When set, causes items to be re-drawn
+static bool g_ItemsChanged = 0; // When set, causes items to be re-drawn
-static bool bReOpenMenu = 0;
+static bool g_bReOpenMenu = 0;
-static int TL = 0, TR = 0, BL = 0, BR = 0; // Used during window construction
-static int TLwidth = 0, TLheight = 0; //
-static int TRwidth = 0; //
-static int BLheight = 0; //
+static int g_TL = 0, g_TR = 0, g_BL = 0, g_BR = 0; // Used during window construction
+static int g_TLwidth = 0, g_TLheight = 0; //
+static int g_TRwidth = 0; //
+static int g_BLheight = 0; //
-static LANGUAGE displayedLanguage;
+static LANGUAGE g_displayedLanguage;
-static OBJECT *objArray[MAX_WCOMP]; // Current display objects (window)
-static OBJECT *iconArray[MAX_ICONS]; // Current display objects (icons)
-static ANIM iconAnims[MAX_ICONS];
-static OBJECT *DobjArray[MAX_WCOMP]; // Current display objects (re-sizing window)
+static OBJECT *g_objArray[MAX_WCOMP]; // Current display objects (window)
+static OBJECT *g_iconArray[MAX_ICONS]; // Current display objects (icons)
+static ANIM g_iconAnims[MAX_ICONS];
+static OBJECT *g_DobjArray[MAX_WCOMP]; // Current display objects (re-sizing window)
-static OBJECT *RectObject = 0, *SlideObject = 0; // Current display objects, for reference
+static OBJECT *g_RectObject = 0, *g_SlideObject = 0; // Current display objects, for reference
// objects are in objArray.
-static int sliderYpos = 0; // For positioning the slider
-static int sliderYmax = 0, sliderYmin = 0; //
+static int g_sliderYpos = 0; // For positioning the slider
+static int g_sliderYmax = 0, g_sliderYmin = 0; //
-#define sliderRange (sliderYmax - sliderYmin)
+#define sliderRange (g_sliderYmax - g_sliderYmin)
// Also to do with the slider
-static struct { int n; int y; } slideStuff[MAX_ININV_TOT+1];
+static struct { int n; int y; } g_slideStuff[MAX_ININV_TOT+1];
#define MAXSLIDES 4
struct MDSLIDES {
@@ -425,25 +414,25 @@ struct MDSLIDES {
OBJECT *obj;
int min, max;
};
-static MDSLIDES mdSlides[MAXSLIDES];
-static int numMdSlides = 0;
+static MDSLIDES g_mdSlides[MAXSLIDES];
+static int g_numMdSlides = 0;
-static int GlitterIndex = 0;
+static int g_GlitterIndex = 0;
// Icon clicked on to cause an event
// - Passed to conversation polygon or actor code via Topic()
// - (sometimes) Passed to inventory icon code via OtherObject()
-static int thisIcon = 0;
+static int g_thisIcon = 0;
-static CONV_PARAM thisConvFn; // Top, 'Middle' or Bottom
-static HPOLYGON thisConvPoly = 0; // Conversation code is in a polygon code block
-static int thisConvActor; // ...or an actor's code block.
-static int pointedIcon = INV_NOICON; // used by InvLabels - icon pointed to on last call
-static volatile int PointedWaitCount = 0; // used by ObjectProcess - fix the 'repeated pressing bug'
-static int sX = 0; // used by SlideMSlider() - current x-coordinate
-static int lX = 0; // used by SlideMSlider() - last x-coordinate
+static CONV_PARAM g_thisConvFn; // Top, 'Middle' or Bottom
+static HPOLYGON g_thisConvPoly = 0; // Conversation code is in a polygon code block
+static int g_thisConvActor; // ...or an actor's code block.
+static int g_pointedIcon = INV_NOICON; // used by InvLabels - icon pointed to on last call
+static volatile int g_PointedWaitCount = 0; // used by ObjectProcess - fix the 'repeated pressing bug'
+static int g_sX = 0; // used by SlideMSlider() - current x-coordinate
+static int g_lX = 0; // used by SlideMSlider() - last x-coordinate
-static bool bMoveOnUnHide; // Set before start of conversation
+static bool g_bMoveOnUnHide; // Set before start of conversation
// - causes conversation to be started in a sensible place
//----- Data pertinant to configure (incl. load/save game) -----
@@ -486,16 +475,16 @@ typedef HOPENTRY *PHOPENTRY;
#include "common/pack-end.h" // END STRUCT PACKING
-static PHOPPER pHopper;
-static PHOPENTRY pEntries;
-static int numScenes;
+static PHOPPER g_pHopper;
+static PHOPENTRY g_pEntries;
+static int g_numScenes;
-static int numEntries;
+static int g_numEntries;
-static PHOPPER pChosenScene = NULL;
+static PHOPPER g_pChosenScene = NULL;
-static int lastChosenScene;
-static bool bRemember;
+static int g_lastChosenScene;
+static bool g_bRemember;
//--------------------------------------------------------------
@@ -970,7 +959,7 @@ static struct {
};
// For editing save game names
-static char sedit[SG_DESC_LEN+2];
+static char g_sedit[SG_DESC_LEN+2];
#define HL1 0 // Hilight that moves with the cursor
#define HL2 1 // Hilight on selected RGROUP box
@@ -1096,7 +1085,7 @@ static void PrimeSceneHopper() {
vSize = f.readUint32LE();
// allocate a buffer for it all
- assert(pHopper == NULL);
+ assert(g_pHopper == NULL);
uint32 size = f.size() - 8;
// make sure memory allocated
@@ -1111,9 +1100,9 @@ static void PrimeSceneHopper() {
error(FILE_IS_CORRUPT, HOPPER_FILENAME);
// Set data pointers
- pHopper = (PHOPPER)pBuffer;
- pEntries = (PHOPENTRY)(pBuffer + vSize);
- numScenes = vSize / sizeof(HOPPER);
+ g_pHopper = (PHOPPER)pBuffer;
+ g_pEntries = (PHOPENTRY)(pBuffer + vSize);
+ g_numScenes = vSize / sizeof(HOPPER);
// close the file
f.close();
@@ -1123,31 +1112,31 @@ static void PrimeSceneHopper() {
* Free the scene hopper data file
*/
static void FreeSceneHopper() {
- free(pHopper);
- pHopper = NULL;
+ free(g_pHopper);
+ g_pHopper = NULL;
}
static void FirstScene(int first) {
int i;
- assert(numScenes && pHopper);
+ assert(g_numScenes && g_pHopper);
- if (bRemember) {
+ if (g_bRemember) {
assert(first == 0);
- first = lastChosenScene;
- bRemember = false;
+ first = g_lastChosenScene;
+ g_bRemember = false;
}
// Force it to a sensible value
- if (first > numScenes - NUM_RGROUP_BOXES)
- first = numScenes - NUM_RGROUP_BOXES;
+ if (first > g_numScenes - NUM_RGROUP_BOXES)
+ first = g_numScenes - NUM_RGROUP_BOXES;
if (first < 0)
first = 0;
// Fill in the rest
- for (i = 0; i < NUM_RGROUP_BOXES && i + first < numScenes; i++) {
+ for (i = 0; i < NUM_RGROUP_BOXES && i + first < g_numScenes; i++) {
cd.box[i].textMethod = TM_STRINGNUM;
- cd.box[i].ixText = FROM_LE_32(pHopper[i + first].hSceneDesc);
+ cd.box[i].ixText = FROM_LE_32(g_pHopper[i + first].hSceneDesc);
}
// Blank out the spare ones (if any)
while (i < NUM_RGROUP_BOXES) {
@@ -1159,31 +1148,31 @@ static void FirstScene(int first) {
}
static void RememberChosenScene() {
- bRemember = true;
+ g_bRemember = true;
}
static void SetChosenScene() {
- lastChosenScene = cd.selBox + cd.extraBase;
- pChosenScene = &pHopper[cd.selBox + cd.extraBase];
+ g_lastChosenScene = cd.selBox + cd.extraBase;
+ g_pChosenScene = &g_pHopper[cd.selBox + cd.extraBase];
}
static void FirstEntry(int first) {
int i;
- InvD[INV_MENU].hInvTitle = FROM_LE_32(pChosenScene->hSceneDesc);
+ g_InvD[INV_MENU].hInvTitle = FROM_LE_32(g_pChosenScene->hSceneDesc);
// get number of entrances
- numEntries = FROM_LE_32(pChosenScene->numEntries);
+ g_numEntries = FROM_LE_32(g_pChosenScene->numEntries);
// Force first to a sensible value
- if (first > numEntries-NUM_RGROUP_BOXES)
- first = numEntries-NUM_RGROUP_BOXES;
+ if (first > g_numEntries-NUM_RGROUP_BOXES)
+ first = g_numEntries-NUM_RGROUP_BOXES;
if (first < 0)
first = 0;
- for (i = 0; i < NUM_RGROUP_BOXES && i < numEntries; i++) {
+ for (i = 0; i < NUM_RGROUP_BOXES && i < g_numEntries; i++) {
cd.box[i].textMethod = TM_STRINGNUM;
- cd.box[i].ixText = FROM_LE_32(pEntries[FROM_LE_32(pChosenScene->entryIndex) + i + first].hDesc);
+ cd.box[i].ixText = FROM_LE_32(g_pEntries[FROM_LE_32(g_pChosenScene->entryIndex) + i + first].hDesc);
}
// Blank out the spare ones (if any)
while (i < NUM_RGROUP_BOXES) {
@@ -1195,15 +1184,15 @@ static void FirstEntry(int first) {
}
static void HopAction() {
- PHOPENTRY pEntry = pEntries + FROM_LE_32(pChosenScene->entryIndex) + cd.selBox + cd.extraBase;
+ PHOPENTRY pEntry = g_pEntries + FROM_LE_32(g_pChosenScene->entryIndex) + cd.selBox + cd.extraBase;
- uint32 hScene = FROM_LE_32(pChosenScene->hScene);
+ uint32 hScene = FROM_LE_32(g_pChosenScene->hScene);
uint32 eNumber = FROM_LE_32(pEntry->eNumber);
debugC(DEBUG_BASIC, kTinselDebugAnimations, "Scene hopper chose scene %xh,%d\n", hScene, eNumber);
if (FROM_LE_32(pEntry->flags) & fCall) {
SaveScene(nullContext);
- NewScene(nullContext, pChosenScene->hScene, pEntry->eNumber, TRANS_FADE);
+ NewScene(nullContext, g_pChosenScene->hScene, pEntry->eNumber, TRANS_FADE);
}
else if (FROM_LE_32(pEntry->flags) & fHook)
HookScene(hScene, eNumber, TRANS_FADE);
@@ -1220,9 +1209,9 @@ static void HopAction() {
*/
static void DumpIconArray() {
for (int i = 0; i < MAX_ICONS; i++) {
- if (iconArray[i] != NULL) {
- MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), iconArray[i]);
- iconArray[i] = NULL;
+ if (g_iconArray[i] != NULL) {
+ MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), g_iconArray[i]);
+ g_iconArray[i] = NULL;
}
}
}
@@ -1232,9 +1221,9 @@ static void DumpIconArray() {
*/
static void DumpDobjArray() {
for (int i = 0; i < MAX_WCOMP; i++) {
- if (DobjArray[i] != NULL) {
- MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), DobjArray[i]);
- DobjArray[i] = NULL;
+ if (g_DobjArray[i] != NULL) {
+ MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), g_DobjArray[i]);
+ g_DobjArray[i] = NULL;
}
}
}
@@ -1244,9 +1233,9 @@ static void DumpDobjArray() {
*/
static void DumpObjArray() {
for (int i = 0; i < MAX_WCOMP; i++) {
- if (objArray[i] != NULL) {
- MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), objArray[i]);
- objArray[i] = NULL;
+ if (g_objArray[i] != NULL) {
+ MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), g_objArray[i]);
+ g_objArray[i] = NULL;
}
}
}
@@ -1256,9 +1245,9 @@ static void DumpObjArray() {
* i.e. Image data and Glitter code.
*/
static INV_OBJECT *GetInvObject(int id) {
- INV_OBJECT *pObject = invObjects;
+ INV_OBJECT *pObject = g_invObjects;
- for (int i = 0; i < numObjects; i++, pObject++) {
+ for (int i = 0; i < g_numObjects; i++, pObject++) {
if (pObject->id == id)
return pObject;
}
@@ -1270,9 +1259,9 @@ static INV_OBJECT *GetInvObject(int id) {
* Convert item ID number to index.
*/
static int GetObjectIndex(int id) {
- INV_OBJECT *pObject = invObjects;
+ INV_OBJECT *pObject = g_invObjects;
- for (int i = 0; i < numObjects; i++, pObject++) {
+ for (int i = 0; i < g_numObjects; i++, pObject++) {
if (pObject->id == id)
return i;
}
@@ -1287,15 +1276,15 @@ static int GetObjectIndex(int id) {
extern int InventoryPos(int num) {
int i;
- for (i = 0; i < InvD[INV_1].NoofItems; i++) // First inventory
- if (InvD[INV_1].contents[i] == num)
+ for (i = 0; i < g_InvD[INV_1].NoofItems; i++) // First inventory
+ if (g_InvD[INV_1].contents[i] == num)
return i;
- for (i = 0; i < InvD[INV_2].NoofItems; i++) // Second inventory
- if (InvD[INV_2].contents[i] == num)
+ for (i = 0; i < g_InvD[INV_2].NoofItems; i++) // Second inventory
+ if (g_InvD[INV_2].contents[i] == num)
return i;
- if (HeldItem == num)
+ if (g_heldItem == num)
return INV_HELDNOTIN; // Held, but not in either inventory
return INV_NOICON; // Not held, not in either inventory
@@ -1304,8 +1293,8 @@ extern int InventoryPos(int num) {
extern bool IsInInventory(int object, int invnum) {
assert(invnum == INV_1 || invnum == INV_2);
- for (int i = 0; i < InvD[invnum].NoofItems; i++) // First inventory
- if (InvD[invnum].contents[i] == object)
+ for (int i = 0; i < g_InvD[invnum].NoofItems; i++) // First inventory
+ if (g_InvD[invnum].contents[i] == object)
return true;
return false;
@@ -1315,7 +1304,7 @@ extern bool IsInInventory(int object, int invnum) {
* Returns which item is held (INV_NOICON (-1) if none)
*/
extern int WhichItemHeld() {
- return HeldItem;
+ return g_heldItem;
}
/**
@@ -1324,15 +1313,15 @@ extern int WhichItemHeld() {
*/
extern void InventoryIconCursor(bool bNewItem) {
- if (HeldItem != INV_NOICON) {
+ if (g_heldItem != INV_NOICON) {
if (TinselV2) {
if (bNewItem) {
- int objIndex = GetObjectIndex(HeldItem);
- heldFilm = invFilms[objIndex];
+ int objIndex = GetObjectIndex(g_heldItem);
+ g_heldFilm = g_invFilms[objIndex];
}
- SetAuxCursor(heldFilm);
+ SetAuxCursor(g_heldFilm);
} else {
- INV_OBJECT *invObj = GetInvObject(HeldItem);
+ INV_OBJECT *invObj = GetInvObject(g_heldItem);
SetAuxCursor(invObj->hIconFilm);
}
}
@@ -1342,14 +1331,14 @@ extern void InventoryIconCursor(bool bNewItem) {
* Returns true if the inventory is active.
*/
extern bool InventoryActive() {
- return (InventoryState == ACTIVE_INV);
+ return (g_InventoryState == ACTIVE_INV);
}
extern int WhichInventoryOpen() {
- if (InventoryState != ACTIVE_INV)
+ if (g_InventoryState != ACTIVE_INV)
return 0;
else
- return ino;
+ return g_ino;
}
@@ -1387,7 +1376,7 @@ static void ObjectProcess(CORO_PARAM, const void *param) {
CORO_INVOKE_1(Interpret, _ctx->pic);
if (to->event == POINTED) {
- _ctx->ThisPointedWait = ++PointedWaitCount;
+ _ctx->ThisPointedWait = ++g_PointedWaitCount;
while (1) {
CORO_SLEEP(1);
int x, y;
@@ -1396,7 +1385,7 @@ static void ObjectProcess(CORO_PARAM, const void *param) {
break;
// Fix the 'repeated pressing bug'
- if (_ctx->ThisPointedWait != PointedWaitCount)
+ if (_ctx->ThisPointedWait != g_PointedWaitCount)
CORO_KILL_SELF();
}
@@ -1413,10 +1402,10 @@ static void ObjectProcess(CORO_PARAM, const void *param) {
static 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))
+ if (g_InventoryHidden || (TinselV2 && !pinvo->hScript))
return;
- GlitterIndex = index;
+ g_GlitterIndex = index;
g_scheduler->createProcess(PID_TCODE, ObjectProcess, &to, sizeof(to));
}
@@ -1491,9 +1480,9 @@ static void FirstFile(int first) {
static void InvSaveGame() {
if (cd.selBox != NOBOX) {
#ifndef JAPAN
- sedit[strlen(sedit)-1] = 0; // Don't include the cursor!
+ g_sedit[strlen(g_sedit)-1] = 0; // Don't include the cursor!
#endif
- SaveGame(ListEntry(cd.selBox-cd.modifier+cd.extraBase, LE_NAME), sedit);
+ SaveGame(ListEntry(cd.selBox-cd.modifier+cd.extraBase, LE_NAME), g_sedit);
}
}
@@ -1506,17 +1495,17 @@ static void InvLoadGame() {
if (cd.selBox != NOBOX && (cd.selBox+cd.extraBase < cd.numSaved)) {
rGame = cd.selBox;
cd.selBox = NOBOX;
- if (iconArray[HL3] != NULL) {
- MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), iconArray[HL3]);
- iconArray[HL3] = NULL;
+ if (g_iconArray[HL3] != NULL) {
+ MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), g_iconArray[HL3]);
+ g_iconArray[HL3] = NULL;
}
- if (iconArray[HL2] != NULL) {
- MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), iconArray[HL2]);
- iconArray[HL2] = NULL;
+ if (g_iconArray[HL2] != NULL) {
+ MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), g_iconArray[HL2]);
+ g_iconArray[HL2] = NULL;
}
- if (iconArray[HL1] != NULL) {
- MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), iconArray[HL1]);
- iconArray[HL1] = NULL;
+ if (g_iconArray[HL1] != NULL) {
+ MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), g_iconArray[HL1]);
+ g_iconArray[HL1] = NULL;
}
RestoreGame(rGame+cd.extraBase);
}
@@ -1533,7 +1522,7 @@ static bool UpdateString(const Common::KeyState &kbd) {
if (!cd.editableRgroup)
return false;
- cpos = strlen(sedit)-1;
+ cpos = strlen(g_sedit)-1;
if (kbd.ascii == 0)
return false;
@@ -1541,18 +1530,18 @@ static bool UpdateString(const Common::KeyState &kbd) {
if (kbd.keycode == Common::KEYCODE_BACKSPACE) {
if (!cpos)
return false;
- sedit[cpos] = 0;
+ g_sedit[cpos] = 0;
cpos--;
- sedit[cpos] = CURSOR_CHAR;
+ g_sedit[cpos] = CURSOR_CHAR;
return true;
// } else if (isalnum(c) || c == ',' || c == '.' || c == '\'' || (c == ' ' && cpos != 0)) {
} else if (IsCharImage(GetTagFontHandle(), kbd.ascii) || (kbd.ascii == ' ' && cpos != 0)) {
if (cpos == SG_DESC_LEN)
return false;
- sedit[cpos] = kbd.ascii;
+ g_sedit[cpos] = kbd.ascii;
cpos++;
- sedit[cpos] = CURSOR_CHAR;
- sedit[cpos+1] = 0;
+ g_sedit[cpos] = CURSOR_CHAR;
+ g_sedit[cpos+1] = 0;
return true;
}
return false;
@@ -1582,25 +1571,25 @@ static bool InvKeyIn(const Common::KeyState &kbd) {
* Delete display of text currently being edited,
* and replace it with freshly edited text.
*/
- if (iconArray[HL3] != NULL) {
- MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), iconArray[HL3]);
- iconArray[HL3] = NULL;
+ if (g_iconArray[HL3] != NULL) {
+ MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), g_iconArray[HL3]);
+ g_iconArray[HL3] = NULL;
}
- iconArray[HL3] = ObjectTextOut(
- GetPlayfieldList(FIELD_STATUS), sedit, 0,
- InvD[ino].inventoryX + cd.box[cd.selBox].xpos + 2,
- InvD[ino].inventoryY + cd.box[cd.selBox].ypos + TYOFF,
+ g_iconArray[HL3] = ObjectTextOut(
+ GetPlayfieldList(FIELD_STATUS), g_sedit, 0,
+ g_InvD[g_ino].inventoryX + cd.box[cd.selBox].xpos + 2,
+ g_InvD[g_ino].inventoryY + cd.box[cd.selBox].ypos + TYOFF,
GetTagFontHandle(), 0);
- if (MultiRightmost(iconArray[HL3]) > MAX_NAME_RIGHT) {
- MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), iconArray[HL3]);
+ if (MultiRightmost(g_iconArray[HL3]) > MAX_NAME_RIGHT) {
+ MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), g_iconArray[HL3]);
UpdateString(Common::KeyState(Common::KEYCODE_BACKSPACE));
- iconArray[HL3] = ObjectTextOut(
- GetPlayfieldList(FIELD_STATUS), sedit, 0,
- InvD[ino].inventoryX + cd.box[cd.selBox].xpos + 2,
- InvD[ino].inventoryY + cd.box[cd.selBox].ypos + TYOFF,
+ g_iconArray[HL3] = ObjectTextOut(
+ GetPlayfieldList(FIELD_STATUS), g_sedit, 0,
+ g_InvD[g_ino].inventoryX + cd.box[cd.selBox].xpos + 2,
+ g_InvD[g_ino].inventoryY + cd.box[cd.selBox].ypos + TYOFF,
GetTagFontHandle(), 0);
}
- MultiSetZPosition(iconArray[HL3], Z_INV_ITEXT + 2);
+ MultiSetZPosition(g_iconArray[HL3], Z_INV_ITEXT + 2);
}
#endif
}
@@ -1625,28 +1614,28 @@ static void Select(int i, bool force) {
cd.selBox = i;
// Clear previous selected highlight and text
- if (iconArray[HL2] != NULL) {
- MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), iconArray[HL2]);
- iconArray[HL2] = NULL;
+ if (g_iconArray[HL2] != NULL) {
+ MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), g_iconArray[HL2]);
+ g_iconArray[HL2] = NULL;
}
- if (iconArray[HL3] != NULL) {
- MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), iconArray[HL3]);
- iconArray[HL3] = NULL;
+ if (g_iconArray[HL3] != NULL) {
+ MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), g_iconArray[HL3]);
+ g_iconArray[HL3] = NULL;
}
// New highlight box
switch (cd.box[i].boxType) {
case RGROUP:
- iconArray[HL2] = RectangleObject(BgPal(),
+ g_iconArray[HL2] = RectangleObject(BgPal(),
(TinselV2 ? HighlightColor() : COL_HILIGHT), cd.box[i].w, cd.box[i].h);
- MultiInsertObject(GetPlayfieldList(FIELD_STATUS), iconArray[HL2]);
- MultiSetAniXY(iconArray[HL2],
- InvD[ino].inventoryX + cd.box[i].xpos,
- InvD[ino].inventoryY + cd.box[i].ypos);
+ MultiInsertObject(GetPlayfieldList(FIELD_STATUS), g_iconArray[HL2]);
+ MultiSetAniXY(g_iconArray[HL2],
+ g_InvD[g_ino].inventoryX + cd.box[i].xpos,
+ g_InvD[g_ino].inventoryY + cd.box[i].ypos);
// Z-position of box, and add edit text if appropriate
if (cd.editableRgroup) {
- MultiSetZPosition(iconArray[HL2], Z_INV_ITEXT+1);
+ MultiSetZPosition(g_iconArray[HL2], Z_INV_ITEXT+1);
if (TinselV2) {
assert(cd.box[i].textMethod == TM_POINTER);
@@ -1657,29 +1646,29 @@ static void Select(int i, bool force) {
// Current date and time
time(&secs_now);
time_now = localtime(&secs_now);
- strftime(sedit, SG_DESC_LEN, "%D %H:%M", time_now);
+ strftime(g_sedit, SG_DESC_LEN, "%D %H:%M", time_now);
#else
// Current description with cursor appended
if (cd.box[i].boxText != NULL) {
- strcpy(sedit, cd.box[i].boxText);
- strcat(sedit, sCursor);
+ strcpy(g_sedit, cd.box[i].boxText);
+ strcat(g_sedit, sCursor);
} else {
- strcpy(sedit, sCursor);
+ strcpy(g_sedit, sCursor);
}
#endif
- iconArray[HL3] = ObjectTextOut(
- GetPlayfieldList(FIELD_STATUS), sedit, 0,
- InvD[ino].inventoryX + cd.box[i].xpos + 2,
+ g_iconArray[HL3] = ObjectTextOut(
+ GetPlayfieldList(FIELD_STATUS), g_sedit, 0,
+ g_InvD[g_ino].inventoryX + cd.box[i].xpos + 2,
#ifdef JAPAN
- InvD[ino].inventoryY + cd.box[i].ypos + 2,
+ g_InvD[g_ino].inventoryY + cd.box[i].ypos + 2,
#else
- InvD[ino].inventoryY + cd.box[i].ypos + TYOFF,
+ g_InvD[g_ino].inventoryY + cd.box[i].ypos + TYOFF,
#endif
GetTagFontHandle(), 0);
- MultiSetZPosition(iconArray[HL3], Z_INV_ITEXT + 2);
+ MultiSetZPosition(g_iconArray[HL3], Z_INV_ITEXT + 2);
} else {
- MultiSetZPosition(iconArray[HL2], Z_INV_ICONS + 1);
+ MultiSetZPosition(g_iconArray[HL2], Z_INV_ICONS + 1);
}
_vm->divertKeyInput(InvKeyIn);
@@ -1687,12 +1676,12 @@ static void Select(int i, bool force) {
break;
case FRGROUP:
- iconArray[HL2] = RectangleObject(BgPal(), COL_HILIGHT, cd.box[i].w+6, cd.box[i].h+6);
- MultiInsertObject(GetPlayfieldList(FIELD_STATUS), iconArray[HL2]);
- MultiSetAniXY(iconArray[HL2],
- InvD[ino].inventoryX + cd.box[i].xpos - 2,
- InvD[ino].inventoryY + cd.box[i].ypos - 2);
- MultiSetZPosition(iconArray[HL2], Z_INV_BRECT+1);
+ g_iconArray[HL2] = RectangleObject(BgPal(), COL_HILIGHT, cd.box[i].w+6, cd.box[i].h+6);
+ MultiInsertObject(GetPlayfieldList(FIELD_STATUS), g_iconArray[HL2]);
+ MultiSetAniXY(g_iconArray[HL2],
+ g_InvD[g_ino].inventoryX + cd.box[i].xpos - 2,
+ g_InvD[g_ino].inventoryY + cd.box[i].ypos - 2);
+ MultiSetZPosition(g_iconArray[HL2], Z_INV_BRECT+1);
break;
@@ -1710,13 +1699,13 @@ static void Select(int i, bool force) {
* Stop holding an item.
*/
extern void DropItem(int item) {
- if (HeldItem == item) {
- HeldItem = INV_NOICON; // Item not held
+ if (g_heldItem == item) {
+ g_heldItem = INV_NOICON; // Item not held
DelAuxCursor(); // no longer aux cursor
}
// Redraw contents - held item was not displayed as a content.
- ItemsChanged = true;
+ g_ItemsChanged = true;
}
/**
@@ -1725,8 +1714,8 @@ extern void DropItem(int item) {
extern void ClearInventory(int invno) {
assert(invno == INV_1 || invno == INV_2);
- InvD[invno].NoofItems = 0;
- memset(InvD[invno].contents, 0, sizeof(InvD[invno].contents));
+ g_InvD[invno].NoofItems = 0;
+ memset(g_InvD[invno].contents, 0, sizeof(g_InvD[invno].contents));
}
/**
@@ -1743,12 +1732,12 @@ extern void AddToInventory(int invno, int icon, bool hold) {
|| 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
- invno = ino;
+ assert(g_InventoryState == ACTIVE_INV && (g_ino == INV_1 || g_ino == INV_2)); // addopeninv() with inventry not open
+ invno = g_ino;
bOpen = true;
// Make sure it doesn't get in both!
- RemFromInventory(ino == INV_1 ? INV_2 : INV_1, icon);
+ RemFromInventory(g_ino == INV_1 ? INV_2 : INV_1, icon);
} else {
bOpen = false;
@@ -1769,61 +1758,61 @@ extern void AddToInventory(int invno, int icon, bool hold) {
RemFromInventory(INV_1, icon);
// See if it's already there
- for (i = 0; i < InvD[invno].NoofItems; i++) {
- if (InvD[invno].contents[i] == icon)
+ for (i = 0; i < g_InvD[invno].NoofItems; i++) {
+ if (g_InvD[invno].contents[i] == icon)
break;
}
// Add it if it isn't already there
- if (i == InvD[invno].NoofItems) {
+ if (i == g_InvD[invno].NoofItems) {
if (!bOpen) {
if (invno == INV_CONV) {
if (TinselV2) {
int nei;
// Count how many current contents have end attribute
- for (i = 0, nei = 0; i < InvD[INV_CONV].NoofItems; i++) {
- invObj = GetInvObject(InvD[INV_CONV].contents[i]);
+ for (i = 0, nei = 0; i < g_InvD[INV_CONV].NoofItems; i++) {
+ invObj = GetInvObject(g_InvD[INV_CONV].contents[i]);
if (invObj->attribute & CONVENDITEM)
nei++;
}
// For conversation, insert before end icons
- memmove(&InvD[INV_CONV].contents[i-nei+1],
- &InvD[INV_CONV].contents[i-nei], nei * sizeof(int));
- InvD[INV_CONV].contents[i - nei] = icon;
- InvD[INV_CONV].NoofItems++;
- InvD[INV_CONV].NoofHicons = InvD[INV_CONV].NoofItems;
+ memmove(&g_InvD[INV_CONV].contents[i-nei+1],
+ &g_InvD[INV_CONV].contents[i-nei], nei * sizeof(int));
+ g_InvD[INV_CONV].contents[i - nei] = icon;
+ g_InvD[INV_CONV].NoofItems++;
+ g_InvD[INV_CONV].NoofHicons = g_InvD[INV_CONV].NoofItems;
// Get the window to re-position
- bMoveOnUnHide = true;
+ g_bMoveOnUnHide = true;
} else {
// For conversation, insert before last icon
// which will always be the goodbye icon
- InvD[invno].contents[InvD[invno].NoofItems] = InvD[invno].contents[InvD[invno].NoofItems-1];
- InvD[invno].contents[InvD[invno].NoofItems-1] = icon;
- InvD[invno].NoofItems++;
+ g_InvD[invno].contents[g_InvD[invno].NoofItems] = g_InvD[invno].contents[g_InvD[invno].NoofItems-1];
+ g_InvD[invno].contents[g_InvD[invno].NoofItems-1] = icon;
+ g_InvD[invno].NoofItems++;
}
} else {
- InvD[invno].contents[InvD[invno].NoofItems++] = icon;
+ g_InvD[invno].contents[g_InvD[invno].NoofItems++] = icon;
}
- ItemsChanged = true;
+ g_ItemsChanged = true;
} else {
// It could be that the index is beyond what you'd expect
// as delinv may well have been called
- if (GlitterIndex < InvD[invno].NoofItems) {
- memmove(&InvD[invno].contents[GlitterIndex + 1],
- &InvD[invno].contents[GlitterIndex],
- (InvD[invno].NoofItems - GlitterIndex) * sizeof(int));
- InvD[invno].contents[GlitterIndex] = icon;
+ if (g_GlitterIndex < g_InvD[invno].NoofItems) {
+ memmove(&g_InvD[invno].contents[g_GlitterIndex + 1],
+ &g_InvD[invno].contents[g_GlitterIndex],
+ (g_InvD[invno].NoofItems - g_GlitterIndex) * sizeof(int));
+ g_InvD[invno].contents[g_GlitterIndex] = icon;
} else {
- InvD[invno].contents[InvD[invno].NoofItems] = icon;
+ g_InvD[invno].contents[g_InvD[invno].NoofItems] = icon;
}
- InvD[invno].NoofItems++;
+ g_InvD[invno].NoofItems++;
}
// Move here after bug on Japenese DW1
- ItemsChanged = true;
+ g_ItemsChanged = true;
}
// Hold it if requested
@@ -1841,25 +1830,25 @@ extern bool RemFromInventory(int invno, int icon) {
assert(invno == INV_1 || invno == INV_2 || invno == INV_CONV); // Trying to delete from illegal inventory
// See if it's there
- for (i = 0; i < InvD[invno].NoofItems; i++) {
- if (InvD[invno].contents[i] == icon)
+ for (i = 0; i < g_InvD[invno].NoofItems; i++) {
+ if (g_InvD[invno].contents[i] == icon)
break;
}
- if (i == InvD[invno].NoofItems)
+ if (i == g_InvD[invno].NoofItems)
return false; // Item wasn't there
else {
- memmove(&InvD[invno].contents[i], &InvD[invno].contents[i+1], (InvD[invno].NoofItems-i)*sizeof(int));
- InvD[invno].NoofItems--;
+ memmove(&g_InvD[invno].contents[i], &g_InvD[invno].contents[i+1], (g_InvD[invno].NoofItems-i)*sizeof(int));
+ g_InvD[invno].NoofItems--;
if (TinselV2 && invno == INV_CONV) {
- InvD[INV_CONV].NoofHicons = InvD[invno].NoofItems;
+ g_InvD[INV_CONV].NoofHicons = g_InvD[invno].NoofItems;
// Get the window to re-position
- bMoveOnUnHide = true;
+ g_bMoveOnUnHide = true;
}
- ItemsChanged = true;
+ g_ItemsChanged = true;
return true; // Item removed
}
}
@@ -1870,27 +1859,27 @@ extern bool RemFromInventory(int invno, int icon) {
extern void HoldItem(int item, bool bKeepFilm) {
INV_OBJECT *invObj;
- if (HeldItem != item) {
- if (TinselV2 && (HeldItem != NOOBJECT)) {
+ if (g_heldItem != item) {
+ if (TinselV2 && (g_heldItem != NOOBJECT)) {
// No longer holding previous item
DelAuxCursor(); // no longer aux cursor
// If old held object is not in an inventory, and
// has a default, stick it in its default inventory.
- if (!IsInInventory(HeldItem, INV_1) && !IsInInventory(HeldItem, INV_2)) {
- invObj = GetInvObject(HeldItem);
+ if (!IsInInventory(g_heldItem, INV_1) && !IsInInventory(g_heldItem, INV_2)) {
+ invObj = GetInvObject(g_heldItem);
if (invObj->attribute & DEFINV1)
- AddToInventory(INV_1, HeldItem);
+ AddToInventory(INV_1, g_heldItem);
else if (invObj->attribute & DEFINV2)
- AddToInventory(INV_2, HeldItem);
+ AddToInventory(INV_2, g_heldItem);
else
// Hook for definable default inventory
- AddToInventory(INV_1, HeldItem);
+ AddToInventory(INV_1, g_heldItem);
}
} else if (!TinselV2) {
- if (item == INV_NOICON && HeldItem != INV_NOICON)
+ if (item == INV_NOICON && g_heldItem != INV_NOICON)
DelAuxCursor(); // no longer aux cursor
if (item != INV_NOICON) {
@@ -1899,19 +1888,19 @@ extern void HoldItem(int item, bool bKeepFilm) {
}
}
- HeldItem = item; // Item held
+ g_heldItem = item; // Item held
if (TinselV2) {
InventoryIconCursor(!bKeepFilm);
// Redraw contents - held item not displayed as a content.
- ItemsChanged = true;
+ g_ItemsChanged = true;
}
}
if (!TinselV2)
// Redraw contents - held item not displayed as a content.
- ItemsChanged = true;
+ g_ItemsChanged = true;
}
/**************************************************************************/
@@ -1929,8 +1918,8 @@ enum { I_NOTIN, I_HEADER, I_BODY,
// the active area of the borders for re-sizing.
/*---------------------------------*/
-#define LeftX InvD[ino].inventoryX
-#define TopY InvD[ino].inventoryY
+#define LeftX g_InvD[g_ino].inventoryX
+#define TopY g_InvD[g_ino].inventoryY
/*---------------------------------*/
/**
@@ -1943,8 +1932,8 @@ enum { I_NOTIN, I_HEADER, I_BODY,
*/
static int InvArea(int x, int y) {
if (TinselV2) {
- int RightX = MultiRightmost(RectObject) - NM_BG_SIZ_X - NM_BG_POS_X - NM_RS_R_INSET;
- int BottomY = MultiLowest(RectObject) - NM_BG_SIZ_Y - NM_BG_POS_Y - NM_RS_B_INSET;
+ int RightX = MultiRightmost(g_RectObject) - NM_BG_SIZ_X - NM_BG_POS_X - NM_RS_R_INSET;
+ int BottomY = MultiLowest(g_RectObject) - NM_BG_SIZ_Y - NM_BG_POS_Y - NM_RS_B_INSET;
// Outside the whole rectangle?
if (x <= LeftX || x > RightX || y <= TopY || y > BottomY)
@@ -1983,7 +1972,7 @@ static int InvArea(int x, int y) {
return I_HEADER;
// Scroll bits
- if (!(ino == INV_MENU && cd.bExtraWin)) {
+ if (!(g_ino == INV_MENU && cd.bExtraWin)) {
if (x > RightX - NM_SLIDE_INSET && x <= RightX - NM_SLIDE_INSET + NM_SLIDE_THICKNESS) {
if (y > TopY + NM_UP_ARROW_TOP && y < TopY + NM_UP_ARROW_BOTTOM)
return I_UP;
@@ -1992,10 +1981,10 @@ static int InvArea(int x, int y) {
/* '3' is a magic adjustment with no apparent sense */
- if (y >= TopY + sliderYmin - 3 && y < TopY + sliderYmax + NM_SLH) {
- if (y < TopY + sliderYpos - 3)
+ if (y >= TopY + g_sliderYmin - 3 && y < TopY + g_sliderYmax + NM_SLH) {
+ if (y < TopY + g_sliderYpos - 3)
return I_SLIDE_UP;
- if (y < TopY + sliderYpos + NM_SLH - 3)
+ if (y < TopY + g_sliderYpos + NM_SLH - 3)
return I_SLIDE;
else
return I_SLIDE_DOWN;
@@ -2003,8 +1992,8 @@ static int InvArea(int x, int y) {
}
}
} else {
- int RightX = MultiRightmost(RectObject) + 1;
- int BottomY = MultiLowest(RectObject) + 1;
+ int RightX = MultiRightmost(g_RectObject) + 1;
+ int BottomY = MultiLowest(g_RectObject) + 1;
// Outside the whole rectangle?
if (x <= LeftX - EXTRA || x > RightX + EXTRA
@@ -2041,7 +2030,7 @@ static int InvArea(int x, int y) {
/*
* In the move area?
*/
- if (ino != INV_CONF
+ if (g_ino != INV_CONF
&& x >= LeftX + M_SW - 2 && x <= RightX - M_SW + 3 &&
y >= TopY + M_TH - 2 && y < TopY + M_TBB + 2)
return I_HEADER;
@@ -2049,17 +2038,17 @@ static int InvArea(int x, int y) {
/*
* Scroll bits
*/
- if (!(ino == INV_CONF && cd.bExtraWin)) {
+ if (!(g_ino == INV_CONF && cd.bExtraWin)) {
if (x > RightX - NM_SLIDE_INSET && x <= RightX - NM_SLIDE_INSET + NM_SLIDE_THICKNESS) {
if (y > TopY + M_IUT + 1 && y < TopY + M_IUB - 1)
return I_UP;
if (y > BottomY - M_IDT + 4 && y <= BottomY - M_IDB + 1)
return I_DOWN;
- if (y >= TopY + sliderYmin && y < TopY + sliderYmax + M_SH) {
- if (y < TopY + sliderYpos)
+ if (y >= TopY + g_sliderYmin && y < TopY + g_sliderYmax + M_SH) {
+ if (y < TopY + g_sliderYpos)
return I_SLIDE_UP;
- if (y < TopY + sliderYpos + M_SH)
+ if (y < TopY + g_sliderYpos + M_SH)
return I_SLIDE;
else
return I_SLIDE_DOWN;
@@ -2081,14 +2070,14 @@ extern int InvItem(int *x, int *y, bool update) {
int item;
int IconsX;
- itop = InvD[ino].inventoryY + START_ICONY;
+ itop = g_InvD[g_ino].inventoryY + START_ICONY;
- IconsX = InvD[ino].inventoryX + START_ICONX;
+ IconsX = g_InvD[g_ino].inventoryX + START_ICONX;
- for (item = InvD[ino].FirstDisp, row = 0; row < InvD[ino].NoofVicons; row++) {
+ for (item = g_InvD[g_ino].FirstDisp, row = 0; row < g_InvD[g_ino].NoofVicons; row++) {
ileft = IconsX;
- for (col = 0; col < InvD[ino].NoofHicons; col++, item++) {
+ for (col = 0; col < g_InvD[g_ino].NoofHicons; col++, item++) {
if (*x >= ileft && *x < ileft + ITEM_WIDTH &&
*y >= itop && *y < itop + ITEM_HEIGHT) {
if (update) {
@@ -2121,20 +2110,20 @@ int InvItemId(int x, int y) {
int row, col;
int item;
- if (InventoryHidden || InventoryState == IDLE_INV)
+ if (g_InventoryHidden || g_InventoryState == IDLE_INV)
return INV_NOICON;
- itop = InvD[ino].inventoryY + START_ICONY;
+ itop = g_InvD[g_ino].inventoryY + START_ICONY;
- int IconsX = InvD[ino].inventoryX + START_ICONX;
+ int IconsX = g_InvD[g_ino].inventoryX + START_ICONX;
- for (item = InvD[ino].FirstDisp, row = 0; row < InvD[ino].NoofVicons; row++) {
+ for (item = g_InvD[g_ino].FirstDisp, row = 0; row < g_InvD[g_ino].NoofVicons; row++) {
ileft = IconsX;
- for (col = 0; col < InvD[ino].NoofHicons; col++, item++) {
+ for (col = 0; col < g_InvD[g_ino].NoofHicons; col++, item++) {
if (x >= ileft && x < ileft + ITEM_WIDTH &&
y >= itop && y < itop + ITEM_HEIGHT) {
- return InvD[ino].contents[item];
+ return g_InvD[g_ino].contents[item];
}
ileft += ITEM_WIDTH + 1;
@@ -2149,15 +2138,15 @@ int InvItemId(int x, int y) {
*/
static int WhichMenuBox(int curX, int curY, bool bSlides) {
if (bSlides) {
- for (int i = 0; i < numMdSlides; i++) {
- if (curY > MultiHighest(mdSlides[i].obj) && curY < MultiLowest(mdSlides[i].obj)
- && curX > MultiLeftmost(mdSlides[i].obj) && curX < MultiRightmost(mdSlides[i].obj))
- return mdSlides[i].num | IS_SLIDER;
+ for (int i = 0; i < g_numMdSlides; i++) {
+ if (curY > MultiHighest(g_mdSlides[i].obj) && curY < MultiLowest(g_mdSlides[i].obj)
+ && curX > MultiLeftmost(g_mdSlides[i].obj) && curX < MultiRightmost(g_mdSlides[i].obj))
+ return g_mdSlides[i].num | IS_SLIDER;
}
}
- curX -= InvD[ino].inventoryX;
- curY -= InvD[ino].inventoryY;
+ curX -= g_InvD[g_ino].inventoryX;
+ curY -= g_InvD[g_ino].inventoryY;
for (int i = 0; i < cd.NumBoxes; i++) {
switch (cd.box[i].boxType) {
@@ -2184,7 +2173,7 @@ static int WhichMenuBox(int curX, int curY, bool bSlides) {
break;
case ROTATE:
- if (bNoLanguage)
+ if (g_bNoLanguage)
break;
if (curY > cd.box[i].ypos && curY < cd.box[i].ypos + cd.box[i].h) {
@@ -2222,9 +2211,9 @@ static int WhichMenuBox(int curX, int curY, bool bSlides) {
return IB_UP;
else if (curY > (r.bottom - (TinselV2 ? 18 : 5)))
return IB_DOWN;
- else if (curY + InvD[ino].inventoryY < sliderYpos)
+ else if (curY + g_InvD[g_ino].inventoryY < g_sliderYpos)
return IB_SLIDE_UP;
- else if (curY + InvD[ino].inventoryY >= sliderYpos + NM_SLH)
+ else if (curY + g_InvD[g_ino].inventoryY >= g_sliderYpos + NM_SLH)
return IB_SLIDE_DOWN;
else
return IB_SLIDE;
@@ -2260,60 +2249,60 @@ static void InvBoxes(bool InBody, int curX, int curY) {
if (index < 0) {
// unhigh-light box (if one was)
cd.pointBox = NOBOX;
- if (iconArray[HL1] != NULL) {
- MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), iconArray[HL1]);
- iconArray[HL1] = NULL;
+ if (g_iconArray[HL1] != NULL) {
+ MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), g_iconArray[HL1]);
+ g_iconArray[HL1] = NULL;
}
} else if (index != cd.pointBox) {
cd.pointBox = index;
// A new box is pointed to - high-light it
- if (iconArray[HL1] != NULL) {
- MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), iconArray[HL1]);
- iconArray[HL1] = NULL;
+ if (g_iconArray[HL1] != NULL) {
+ MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), g_iconArray[HL1]);
+ g_iconArray[HL1] = NULL;
}
if ((cd.box[cd.pointBox].boxType == ARSBUT && cd.selBox != NOBOX) ||
///* 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(),
+ g_iconArray[HL1] = RectangleObject(BgPal(),
(TinselV2 ? HighlightColor() : COL_HILIGHT),
cd.box[cd.pointBox].w, cd.box[cd.pointBox].h);
- MultiInsertObject(GetPlayfieldList(FIELD_STATUS), iconArray[HL1]);
- MultiSetAniXY(iconArray[HL1],
- InvD[ino].inventoryX + cd.box[cd.pointBox].xpos,
- InvD[ino].inventoryY + cd.box[cd.pointBox].ypos);
- MultiSetZPosition(iconArray[HL1], Z_INV_ICONS+1);
+ MultiInsertObject(GetPlayfieldList(FIELD_STATUS), g_iconArray[HL1]);
+ MultiSetAniXY(g_iconArray[HL1],
+ g_InvD[g_ino].inventoryX + cd.box[cd.pointBox].xpos,
+ g_InvD[g_ino].inventoryY + cd.box[cd.pointBox].ypos);
+ MultiSetZPosition(g_iconArray[HL1], Z_INV_ICONS+1);
} else if (cd.box[cd.pointBox].boxType == AAGBUT ||
cd.box[cd.pointBox].boxType == ARSGBUT ||
cd.box[cd.pointBox].boxType == TOGGLE ||
cd.box[cd.pointBox].boxType == TOGGLE1 ||
cd.box[cd.pointBox].boxType == TOGGLE2) {
- pfilm = (const FILM *)LockMem(hWinParts);
+ pfilm = (const FILM *)LockMem(g_hWinParts);
- iconArray[HL1] = AddObject(&pfilm->reels[cd.box[cd.pointBox].bi+HIGRAPH], -1);
- MultiSetAniXY(iconArray[HL1],
- InvD[ino].inventoryX + cd.box[cd.pointBox].xpos,
- InvD[ino].inventoryY + cd.box[cd.pointBox].ypos);
- MultiSetZPosition(iconArray[HL1], Z_INV_ICONS+1);
+ g_iconArray[HL1] = AddObject(&pfilm->reels[cd.box[cd.pointBox].bi+HIGRAPH], -1);
+ MultiSetAniXY(g_iconArray[HL1],
+ g_InvD[g_ino].inventoryX + cd.box[cd.pointBox].xpos,
+ g_InvD[g_ino].inventoryY + cd.box[cd.pointBox].ypos);
+ MultiSetZPosition(g_iconArray[HL1], Z_INV_ICONS+1);
} else if (cd.box[cd.pointBox].boxType == ROTATE) {
- if (bNoLanguage)
+ if (g_bNoLanguage)
return;
- pfilm = (const FILM *)LockMem(hWinParts);
+ pfilm = (const FILM *)LockMem(g_hWinParts);
rotateIndex = cd.box[cd.pointBox].bi;
if (rotateIndex == IX2_LEFT1) {
- iconArray[HL1] = AddObject(&pfilm->reels[IX2_LEFT2], -1 );
- MultiSetAniXY(iconArray[HL1],
- InvD[ino].inventoryX + cd.box[cd.pointBox].xpos - ROTX1,
- InvD[ino].inventoryY + cd.box[cd.pointBox].ypos);
- MultiSetZPosition(iconArray[HL1], Z_INV_ICONS+1);
+ g_iconArray[HL1] = AddObject(&pfilm->reels[IX2_LEFT2], -1 );
+ MultiSetAniXY(g_iconArray[HL1],
+ g_InvD[g_ino].inventoryX + cd.box[cd.pointBox].xpos - ROTX1,
+ g_InvD[g_ino].inventoryY + cd.box[cd.pointBox].ypos);
+ MultiSetZPosition(g_iconArray[HL1], Z_INV_ICONS+1);
} else if (rotateIndex == IX2_RIGHT1) {
- iconArray[HL1] = AddObject(&pfilm->reels[IX2_RIGHT2], -1);
- MultiSetAniXY(iconArray[HL1],
- InvD[ino].inventoryX + cd.box[cd.pointBox].xpos + ROTX1,
- InvD[ino].inventoryY + cd.box[cd.pointBox].ypos);
- MultiSetZPosition(iconArray[HL1], Z_INV_ICONS + 1);
+ g_iconArray[HL1] = AddObject(&pfilm->reels[IX2_RIGHT2], -1);
+ MultiSetAniXY(g_iconArray[HL1],
+ g_InvD[g_ino].inventoryX + cd.box[cd.pointBox].xpos + ROTX1,
+ g_InvD[g_ino].inventoryY + cd.box[cd.pointBox].ypos);
+ MultiSetZPosition(g_iconArray[HL1], Z_INV_ICONS + 1);
}
}
}
@@ -2330,37 +2319,37 @@ static void ButtonPress(CORO_PARAM, CONFBOX *box) {
assert(box->boxType == AAGBUT || box->boxType == ARSGBUT);
// Replace highlight image with normal image
- pfilm = (const FILM *)LockMem(hWinParts);
- if (iconArray[HL1] != NULL)
- MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), iconArray[HL1]);
- pfilm = (const FILM *)LockMem(hWinParts);
- iconArray[HL1] = AddObject(&pfilm->reels[box->bi+NORMGRAPH], -1);
- MultiSetAniXY(iconArray[HL1], InvD[ino].inventoryX + box->xpos, InvD[ino].inventoryY + box->ypos);
- MultiSetZPosition(iconArray[HL1], Z_INV_ICONS+1);
+ pfilm = (const FILM *)LockMem(g_hWinParts);
+ if (g_iconArray[HL1] != NULL)
+ MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), g_iconArray[HL1]);
+ pfilm = (const FILM *)LockMem(g_hWinParts);
+ g_iconArray[HL1] = AddObject(&pfilm->reels[box->bi+NORMGRAPH], -1);
+ MultiSetAniXY(g_iconArray[HL1], g_InvD[g_ino].inventoryX + box->xpos, g_InvD[g_ino].inventoryY + box->ypos);
+ MultiSetZPosition(g_iconArray[HL1], Z_INV_ICONS+1);
// Hold normal image for 1 frame
CORO_SLEEP(1);
- if (iconArray[HL1] == NULL)
+ if (g_iconArray[HL1] == NULL)
return;
// Replace normal image with depresses image
- pfilm = (const FILM *)LockMem(hWinParts);
- MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), iconArray[HL1]);
- iconArray[HL1] = AddObject(&pfilm->reels[box->bi+DOWNGRAPH], -1);
- MultiSetAniXY(iconArray[HL1], InvD[ino].inventoryX + box->xpos, InvD[ino].inventoryY + box->ypos);
- MultiSetZPosition(iconArray[HL1], Z_INV_ICONS+1);
+ pfilm = (const FILM *)LockMem(g_hWinParts);
+ MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), g_iconArray[HL1]);
+ g_iconArray[HL1] = AddObject(&pfilm->reels[box->bi+DOWNGRAPH], -1);
+ MultiSetAniXY(g_iconArray[HL1], g_InvD[g_ino].inventoryX + box->xpos, g_InvD[g_ino].inventoryY + box->ypos);
+ MultiSetZPosition(g_iconArray[HL1], Z_INV_ICONS+1);
// Hold depressed image for 2 frames
CORO_SLEEP(2);
- if (iconArray[HL1] == NULL)
+ if (g_iconArray[HL1] == NULL)
return;
// Replace depressed image with normal image
- pfilm = (const FILM *)LockMem(hWinParts);
- MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), iconArray[HL1]);
- iconArray[HL1] = AddObject(&pfilm->reels[box->bi+NORMGRAPH], -1);
- MultiSetAniXY(iconArray[HL1], InvD[ino].inventoryX + box->xpos, InvD[ino].inventoryY + box->ypos);
- MultiSetZPosition(iconArray[HL1], Z_INV_ICONS+1);
+ pfilm = (const FILM *)LockMem(g_hWinParts);
+ MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), g_iconArray[HL1]);
+ g_iconArray[HL1] = AddObject(&pfilm->reels[box->bi+NORMGRAPH], -1);
+ MultiSetAniXY(g_iconArray[HL1], g_InvD[g_ino].inventoryX + box->xpos, g_InvD[g_ino].inventoryY + box->ypos);
+ MultiSetZPosition(g_iconArray[HL1], Z_INV_ICONS+1);
CORO_SLEEP(1);
@@ -2379,25 +2368,25 @@ static void ButtonToggle(CORO_PARAM, CONFBOX *box) {
|| (box->boxType == TOGGLE2));
// Remove hilight image
- if (iconArray[HL1] != NULL) {
- MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), iconArray[HL1]);
- iconArray[HL1] = NULL;
+ if (g_iconArray[HL1] != NULL) {
+ MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), g_iconArray[HL1]);
+ g_iconArray[HL1] = NULL;
}
// Hold normal image for 1 frame
CORO_SLEEP(1);
- if (InventoryState != ACTIVE_INV)
+ if (g_InventoryState != ACTIVE_INV)
return;
// Add depressed image
- pfilm = (const FILM *)LockMem(hWinParts);
- iconArray[HL1] = AddObject(&pfilm->reels[box->bi+DOWNGRAPH], -1);
- MultiSetAniXY(iconArray[HL1], InvD[ino].inventoryX + box->xpos, InvD[ino].inventoryY + box->ypos);
- MultiSetZPosition(iconArray[HL1], Z_INV_ICONS+1);
+ pfilm = (const FILM *)LockMem(g_hWinParts);
+ g_iconArray[HL1] = AddObject(&pfilm->reels[box->bi+DOWNGRAPH], -1);
+ MultiSetAniXY(g_iconArray[HL1], g_InvD[g_ino].inventoryX + box->xpos, g_InvD[g_ino].inventoryY + box->ypos);
+ MultiSetZPosition(g_iconArray[HL1], Z_INV_ICONS+1);
// Hold depressed image for 1 frame
CORO_SLEEP(1);
- if (iconArray[HL1] == NULL)
+ if (g_iconArray[HL1] == NULL)
return;
// Toggle state
@@ -2409,34 +2398,34 @@ static void ButtonToggle(CORO_PARAM, CONFBOX *box) {
Select(cd.selBox, true);
// New state, depressed image
- pfilm = (const FILM *)LockMem(hWinParts);
- if (iconArray[HL1] != NULL)
- MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), iconArray[HL1]);
- iconArray[HL1] = AddObject(&pfilm->reels[box->bi+DOWNGRAPH], -1);
- MultiSetAniXY(iconArray[HL1], InvD[ino].inventoryX + box->xpos, InvD[ino].inventoryY + box->ypos);
- MultiSetZPosition(iconArray[HL1], Z_INV_ICONS+1);
+ pfilm = (const FILM *)LockMem(g_hWinParts);
+ if (g_iconArray[HL1] != NULL)
+ MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), g_iconArray[HL1]);
+ g_iconArray[HL1] = AddObject(&pfilm->reels[box->bi+DOWNGRAPH], -1);
+ MultiSetAniXY(g_iconArray[HL1], g_InvD[g_ino].inventoryX + box->xpos, g_InvD[g_ino].inventoryY + box->ypos);
+ MultiSetZPosition(g_iconArray[HL1], Z_INV_ICONS+1);
// Hold new depressed image for 1 frame
CORO_SLEEP(1);
- if (iconArray[HL1] == NULL)
+ if (g_iconArray[HL1] == NULL)
return;
// New state, normal
- MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), iconArray[HL1]);
- iconArray[HL1] = NULL;
+ MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), g_iconArray[HL1]);
+ g_iconArray[HL1] = NULL;
// Hold normal image for 1 frame
CORO_SLEEP(1);
- if (InventoryState != ACTIVE_INV)
+ if (g_InventoryState != ACTIVE_INV)
return;
// New state, highlighted
- pfilm = (const FILM *)LockMem(hWinParts);
- if (iconArray[HL1] != NULL)
- MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), iconArray[HL1]);
- iconArray[HL1] = AddObject(&pfilm->reels[box->bi+HIGRAPH], -1);
- MultiSetAniXY(iconArray[HL1], InvD[ino].inventoryX + box->xpos, InvD[ino].inventoryY + box->ypos);
- MultiSetZPosition(iconArray[HL1], Z_INV_ICONS+1);
+ pfilm = (const FILM *)LockMem(g_hWinParts);
+ if (g_iconArray[HL1] != NULL)
+ MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), g_iconArray[HL1]);
+ g_iconArray[HL1] = AddObject(&pfilm->reels[box->bi+HIGRAPH], -1);
+ MultiSetAniXY(g_iconArray[HL1], g_InvD[g_ino].inventoryX + box->xpos, g_InvD[g_ino].inventoryY + box->ypos);
+ MultiSetZPosition(g_iconArray[HL1], Z_INV_ICONS+1);
CORO_END_CODE;
}
@@ -2454,23 +2443,23 @@ static void InvLabels(bool InBody, int aniX, int aniY) {
else {
index = InvItem(&aniX, &aniY, false);
if (index != INV_NOICON) {
- if (index >= InvD[ino].NoofItems)
+ if (index >= g_InvD[g_ino].NoofItems)
index = INV_NOICON;
else
- index = InvD[ino].contents[index];
+ index = g_InvD[g_ino].contents[index];
}
}
// If no icon pointed to, or points to (logical position of)
// currently held icon, then no icon is pointed to!
- if (index == INV_NOICON || index == HeldItem) {
- pointedIcon = INV_NOICON;
- } else if (index != pointedIcon) {
+ if (index == INV_NOICON || index == g_heldItem) {
+ g_pointedIcon = INV_NOICON;
+ } else if (index != g_pointedIcon) {
// A new icon is pointed to - run its script with POINTED event
invObj = GetInvObject(index);
if (invObj->hScript)
InvTinselEvent(invObj, POINTED, PLR_NOEVENT, index);
- pointedIcon = index;
+ g_pointedIcon = index;
}
}
@@ -2492,54 +2481,54 @@ static void AdjustTop() {
int n, i;
// Only do this if there's a slider
- if (!SlideObject)
+ if (!g_SlideObject)
return;
- rowsWanted = (InvD[ino].NoofItems - InvD[ino].FirstDisp + InvD[ino].NoofHicons-1) / InvD[ino].NoofHicons;
+ rowsWanted = (g_InvD[g_ino].NoofItems - g_InvD[g_ino].FirstDisp + g_InvD[g_ino].NoofHicons-1) / g_InvD[g_ino].NoofHicons;
- while (rowsWanted < InvD[ino].NoofVicons) {
- if (InvD[ino].FirstDisp) {
- InvD[ino].FirstDisp -= InvD[ino].NoofHicons;
- if (InvD[ino].FirstDisp < 0)
- InvD[ino].FirstDisp = 0;
+ while (rowsWanted < g_InvD[g_ino].NoofVicons) {
+ if (g_InvD[g_ino].FirstDisp) {
+ g_InvD[g_ino].FirstDisp -= g_InvD[g_ino].NoofHicons;
+ if (g_InvD[g_ino].FirstDisp < 0)
+ g_InvD[g_ino].FirstDisp = 0;
rowsWanted++;
} else
break;
}
- tMissing = InvD[ino].FirstDisp ? (InvD[ino].FirstDisp + InvD[ino].NoofHicons-1)/InvD[ino].NoofHicons : 0;
- bMissing = (rowsWanted > InvD[ino].NoofVicons) ? rowsWanted - InvD[ino].NoofVicons : 0;
+ tMissing = g_InvD[g_ino].FirstDisp ? (g_InvD[g_ino].FirstDisp + g_InvD[g_ino].NoofHicons-1)/g_InvD[g_ino].NoofHicons : 0;
+ bMissing = (rowsWanted > g_InvD[g_ino].NoofVicons) ? rowsWanted - g_InvD[g_ino].NoofVicons : 0;
nMissing = tMissing + bMissing;
- slideRange = sliderYmax - sliderYmin;
+ slideRange = g_sliderYmax - g_sliderYmin;
if (!tMissing)
- nsliderYpos = sliderYmin;
+ nsliderYpos = g_sliderYmin;
else if (!bMissing)
- nsliderYpos = sliderYmax;
+ nsliderYpos = g_sliderYmax;
else {
nsliderYpos = tMissing*slideRange/nMissing;
- nsliderYpos += sliderYmin;
+ nsliderYpos += g_sliderYmin;
}
if (nMissing) {
- n = InvD[ino].FirstDisp - tMissing*InvD[ino].NoofHicons;
- for (i = 0; i <= nMissing; i++, n += InvD[ino].NoofHicons) {
- slideStuff[i].n = n;
- slideStuff[i].y = (i*slideRange/nMissing) + sliderYmin;
+ n = g_InvD[g_ino].FirstDisp - tMissing*g_InvD[g_ino].NoofHicons;
+ for (i = 0; i <= nMissing; i++, n += g_InvD[g_ino].NoofHicons) {
+ g_slideStuff[i].n = n;
+ g_slideStuff[i].y = (i*slideRange/nMissing) + g_sliderYmin;
}
- if (slideStuff[0].n < 0)
- slideStuff[0].n = 0;
+ if (g_slideStuff[0].n < 0)
+ g_slideStuff[0].n = 0;
assert(i < MAX_ININV + 1);
- slideStuff[i].n = -1;
+ g_slideStuff[i].n = -1;
} else {
- slideStuff[0].n = 0;
- slideStuff[0].y = sliderYmin;
- slideStuff[1].n = -1;
+ g_slideStuff[0].n = 0;
+ g_slideStuff[0].y = g_sliderYmin;
+ g_slideStuff[1].n = -1;
}
- if (nsliderYpos != sliderYpos) {
- MultiMoveRelXY(SlideObject, 0, nsliderYpos - sliderYpos);
- sliderYpos = nsliderYpos;
+ if (nsliderYpos != g_sliderYpos) {
+ MultiMoveRelXY(g_SlideObject, 0, nsliderYpos - g_sliderYpos);
+ g_sliderYpos = nsliderYpos;
}
}
@@ -2580,26 +2569,26 @@ static void FillInInventory() {
DumpIconArray();
- if (InvDragging != ID_SLIDE)
+ if (g_InvDragging != ID_SLIDE)
AdjustTop(); // Set up slideStuff[]
- Index = InvD[ino].FirstDisp; // Start from first displayed object
+ Index = g_InvD[g_ino].FirstDisp; // Start from first displayed object
n = 0;
ypos = START_ICONY; // Y-offset of first display row
- for (row = 0; row < InvD[ino].NoofVicons; row++, ypos += ITEM_HEIGHT + 1) {
+ for (row = 0; row < g_InvD[g_ino].NoofVicons; row++, ypos += ITEM_HEIGHT + 1) {
xpos = START_ICONX; // X-offset of first display column
- for (col = 0; col < InvD[ino].NoofHicons; col++) {
- if (Index >= InvD[ino].NoofItems)
+ for (col = 0; col < g_InvD[g_ino].NoofHicons; col++) {
+ if (Index >= g_InvD[g_ino].NoofItems)
break;
- else if (InvD[ino].contents[Index] != HeldItem) {
+ else if (g_InvD[g_ino].contents[Index] != g_heldItem) {
// Create a display object and position it
- iconArray[n] = AddInvObject(InvD[ino].contents[Index], &pfr, &pfilm);
- MultiSetAniXY(iconArray[n], InvD[ino].inventoryX + xpos , InvD[ino].inventoryY + ypos);
- MultiSetZPosition(iconArray[n], Z_INV_ICONS);
+ g_iconArray[n] = AddInvObject(g_InvD[g_ino].contents[Index], &pfr, &pfilm);
+ MultiSetAniXY(g_iconArray[n], g_InvD[g_ino].inventoryX + xpos , g_InvD[g_ino].inventoryY + ypos);
+ MultiSetZPosition(g_iconArray[n], Z_INV_ICONS);
- InitStepAnimScript(&iconAnims[n], iconArray[n], FROM_LE_32(pfr->script), ONE_SECOND / FROM_LE_32(pfilm->frate));
+ InitStepAnimScript(&g_iconAnims[n], g_iconArray[n], FROM_LE_32(pfr->script), ONE_SECOND / FROM_LE_32(pfilm->frate));
n++;
}
@@ -2617,16 +2606,16 @@ enum {FROM_HANDLE, FROM_STRING};
*/
static void AddBackground(OBJECT **rect, OBJECT **title, int extraH, int extraV, int textFrom) {
// Why not 2 ????
- int width = TLwidth + extraH + TRwidth + NM_BG_SIZ_X;
- int height = TLheight + extraV + BLheight + NM_BG_SIZ_Y;
+ int width = g_TLwidth + extraH + g_TRwidth + NM_BG_SIZ_X;
+ int height = g_TLheight + extraV + g_BLheight + NM_BG_SIZ_Y;
// Create a rectangle object
- RectObject = *rect = TranslucentObject(width, height);
+ g_RectObject = *rect = TranslucentObject(width, height);
// add it to display list and position it
MultiInsertObject(GetPlayfieldList(FIELD_STATUS), *rect);
- MultiSetAniXY(*rect, InvD[ino].inventoryX + NM_BG_POS_X,
- InvD[ino].inventoryY + NM_BG_POS_Y);
+ MultiSetAniXY(*rect, g_InvD[g_ino].inventoryX + NM_BG_POS_X,
+ g_InvD[g_ino].inventoryY + NM_BG_POS_Y);
MultiSetZPosition(*rect, Z_INV_BRECT);
if (title == NULL)
@@ -2634,16 +2623,16 @@ static void AddBackground(OBJECT **rect, OBJECT **title, int extraH, int extraV,
// Create text object using title string
if (textFrom == FROM_HANDLE) {
- LoadStringRes(InvD[ino].hInvTitle, TextBufferAddr(), TBUFSZ);
+ LoadStringRes(g_InvD[g_ino].hInvTitle, TextBufferAddr(), TBUFSZ);
*title = ObjectTextOut(GetPlayfieldList(FIELD_STATUS), TextBufferAddr(), 0,
- InvD[ino].inventoryX + width/2, InvD[ino].inventoryY + M_TOFF,
+ g_InvD[g_ino].inventoryX + width/2, g_InvD[g_ino].inventoryY + M_TOFF,
GetTagFontHandle(), TXT_CENTER);
assert(*title); // Inventory title string produced NULL text
MultiSetZPosition(*title, Z_INV_HTEXT);
} else if (textFrom == FROM_STRING && cd.ixHeading != NO_HEADING) {
- LoadStringRes(configStrings[cd.ixHeading], TextBufferAddr(), TBUFSZ);
+ LoadStringRes(g_configStrings[cd.ixHeading], TextBufferAddr(), TBUFSZ);
*title = ObjectTextOut(GetPlayfieldList(FIELD_STATUS), TextBufferAddr(), 0,
- InvD[ino].inventoryX + width/2, InvD[ino].inventoryY + M_TOFF,
+ g_InvD[g_ino].inventoryX + width/2, g_InvD[g_ino].inventoryY + M_TOFF,
GetTagFontHandle(), TXT_CENTER);
assert(*title); // Inventory title string produced NULL text
MultiSetZPosition(*title, Z_INV_HTEXT);
@@ -2661,13 +2650,13 @@ static void AddBackground(OBJECT **rect, int extraH, int extraV) {
* Adds a title for a dialog
*/
static void AddTitle(POBJECT *title, int extraH) {
- int width = TLwidth + extraH + TRwidth + NM_BG_SIZ_X;
+ int width = g_TLwidth + extraH + g_TRwidth + NM_BG_SIZ_X;
// Create text object using title string
- if (InvD[ino].hInvTitle != (SCNHANDLE)NO_HEADING) {
- LoadStringRes(InvD[ino].hInvTitle, TextBufferAddr(), TBUFSZ);
+ if (g_InvD[g_ino].hInvTitle != (SCNHANDLE)NO_HEADING) {
+ LoadStringRes(g_InvD[g_ino].hInvTitle, TextBufferAddr(), TBUFSZ);
*title = ObjectTextOut(GetPlayfieldList(FIELD_STATUS), TextBufferAddr(), 0,
- InvD[ino].inventoryX + (width/2)+NM_BG_POS_X, InvD[ino].inventoryY + NM_TOFF,
+ g_InvD[g_ino].inventoryX + (width/2)+NM_BG_POS_X, g_InvD[g_ino].inventoryY + NM_TOFF,
GetTagFontHandle(), TXT_CENTER, 0);
assert(*title);
MultiSetZPosition(*title, Z_INV_HTEXT);
@@ -2691,13 +2680,13 @@ static OBJECT *AddObject(const FREEL *pfreel, int num) {
// Horrible bodge involving global variables to save
// width and/or height of some window frame components
- if (num == TL) {
- TLwidth = FROM_LE_16(pim->imgWidth);
- TLheight = FROM_LE_16(pim->imgHeight) & ~C16_FLAG_MASK;
- } else if (num == TR) {
- TRwidth = FROM_LE_16(pim->imgWidth);
- } else if (num == BL) {
- BLheight = FROM_LE_16(pim->imgHeight) & ~C16_FLAG_MASK;
+ if (num == g_TL) {
+ g_TLwidth = FROM_LE_16(pim->imgWidth);
+ g_TLheight = FROM_LE_16(pim->imgHeight) & ~C16_FLAG_MASK;
+ } else if (num == g_TR) {
+ g_TRwidth = FROM_LE_16(pim->imgWidth);
+ } else if (num == g_BL) {
+ g_BLheight = FROM_LE_16(pim->imgHeight) & ~C16_FLAG_MASK;
}
// Set up and insert the multi-object
@@ -2712,9 +2701,9 @@ static OBJECT *AddObject(const FREEL *pfreel, int num) {
*/
static void AddSlider(OBJECT **slide, const FILM *pfilm) {
- SlideObject = *slide = AddObject(&pfilm->reels[IX_SLIDE], -1);
- MultiSetAniXY(*slide, MultiRightmost(RectObject) + (TinselV2 ? NM_SLX : -M_SXOFF + 2) - 1,
- InvD[ino].inventoryY + sliderYpos);
+ g_SlideObject = *slide = AddObject(&pfilm->reels[IX_SLIDE], -1);
+ MultiSetAniXY(*slide, MultiRightmost(g_RectObject) + (TinselV2 ? NM_SLX : -M_SXOFF + 2) - 1,
+ g_InvD[g_ino].inventoryY + g_sliderYpos);
MultiSetZPosition(*slide, Z_INV_MFRAME);
}
@@ -2722,8 +2711,8 @@ static void AddSlider(OBJECT **slide, const FILM *pfilm) {
* Display a box with some text in it.
*/
static void AddBox(int *pi, const int i) {
- int x = InvD[ino].inventoryX + cd.box[i].xpos;
- int y = InvD[ino].inventoryY + cd.box[i].ypos;
+ int x = g_InvD[g_ino].inventoryX + cd.box[i].xpos;
+ int y = g_InvD[g_ino].inventoryY + cd.box[i].ypos;
int *pival = cd.box[i].ival;
int xdisp;
const FILM *pFilm;
@@ -2735,11 +2724,11 @@ static void AddBox(int *pi, const int i) {
break;
// Give us a box
- iconArray[*pi] = RectangleObject(BgPal(), TinselV2 ? BoxColor() : COL_BOX,
+ g_iconArray[*pi] = RectangleObject(BgPal(), TinselV2 ? BoxColor() : COL_BOX,
cd.box[i].w, cd.box[i].h);
- MultiInsertObject(GetPlayfieldList(FIELD_STATUS), iconArray[*pi]);
- MultiSetAniXY(iconArray[*pi], x, y);
- MultiSetZPosition(iconArray[*pi], Z_INV_BRECT + 1);
+ MultiInsertObject(GetPlayfieldList(FIELD_STATUS), g_iconArray[*pi]);
+ MultiSetAniXY(g_iconArray[*pi], x, y);
+ MultiSetZPosition(g_iconArray[*pi], Z_INV_BRECT + 1);
*pi += 1;
// Stick in the text
@@ -2747,14 +2736,14 @@ static void AddBox(int *pi, const int i) {
(!TinselV2 && (cd.box[i].ixText == USE_POINTER))) {
if (cd.box[i].boxText != NULL) {
if (cd.box[i].boxType == RGROUP) {
- iconArray[*pi] = ObjectTextOut(GetPlayfieldList(FIELD_STATUS), cd.box[i].boxText, 0,
+ g_iconArray[*pi] = ObjectTextOut(GetPlayfieldList(FIELD_STATUS), cd.box[i].boxText, 0,
#ifdef JAPAN
x + 2, y+2, GetTagFontHandle(), 0);
#else
x + 2, y + TYOFF, GetTagFontHandle(), 0);
#endif
} else {
- iconArray[*pi] = ObjectTextOut(GetPlayfieldList(FIELD_STATUS), cd.box[i].boxText, 0,
+ g_iconArray[*pi] = ObjectTextOut(GetPlayfieldList(FIELD_STATUS), cd.box[i].boxText, 0,
#ifdef JAPAN
// Note: it never seems to go here!
x + cd.box[i].w/2, y+2, GetTagFontHandle(), TXT_CENTER);
@@ -2763,7 +2752,7 @@ static void AddBox(int *pi, const int i) {
#endif
}
- MultiSetZPosition(iconArray[*pi], Z_INV_ITEXT);
+ MultiSetZPosition(g_iconArray[*pi], Z_INV_ITEXT);
*pi += 1;
}
} else {
@@ -2775,61 +2764,61 @@ static void AddBox(int *pi, const int i) {
LoadStringRes(cd.box[i].ixText, TextBufferAddr(), TBUFSZ);
}
} else {
- LoadStringRes(configStrings[cd.box[i].ixText], TextBufferAddr(), TBUFSZ);
+ LoadStringRes(g_configStrings[cd.box[i].ixText], TextBufferAddr(), TBUFSZ);
assert(cd.box[i].boxType != RGROUP); // You'll need to add some code!
}
if (TinselV2 && (cd.box[i].boxType == RGROUP))
- iconArray[*pi] = ObjectTextOut(GetPlayfieldList(FIELD_STATUS), TextBufferAddr(),
+ g_iconArray[*pi] = ObjectTextOut(GetPlayfieldList(FIELD_STATUS), TextBufferAddr(),
0, x + 2, y + TYOFF, GetTagFontHandle(), 0, 0);
else
- iconArray[*pi] = ObjectTextOut(GetPlayfieldList(FIELD_STATUS),
+ g_iconArray[*pi] = ObjectTextOut(GetPlayfieldList(FIELD_STATUS),
TextBufferAddr(), 0,
#ifdef JAPAN
x + cd.box[i].w/2, y+2, GetTagFontHandle(), TXT_CENTER);
#else
x + cd.box[i].w / 2, y + TYOFF, GetTagFontHandle(), TXT_CENTER);
#endif
- MultiSetZPosition(iconArray[*pi], Z_INV_ITEXT);
+ MultiSetZPosition(g_iconArray[*pi], Z_INV_ITEXT);
*pi += 1;
}
break;
case AAGBUT:
case ARSGBUT:
- pFilm = (const FILM *)LockMem(hWinParts);
+ pFilm = (const FILM *)LockMem(g_hWinParts);
- iconArray[*pi] = AddObject(&pFilm->reels[cd.box[i].bi + NORMGRAPH], -1);
- MultiSetAniXY(iconArray[*pi], x, y);
- MultiSetZPosition(iconArray[*pi], Z_INV_BRECT + 1);
+ g_iconArray[*pi] = AddObject(&pFilm->reels[cd.box[i].bi + NORMGRAPH], -1);
+ MultiSetAniXY(g_iconArray[*pi], x, y);
+ MultiSetZPosition(g_iconArray[*pi], Z_INV_BRECT + 1);
*pi += 1;
break;
case FRGROUP:
- assert(flagFilm != 0); // Language flags not declared!
+ assert(g_flagFilm != 0); // Language flags not declared!
- pFilm = (const FILM *)LockMem(flagFilm);
+ pFilm = (const FILM *)LockMem(g_flagFilm);
if (_vm->_config->_isAmericanEnglishVersion && cd.box[i].bi == FIX_UK)
cd.box[i].bi = FIX_USA;
- iconArray[*pi] = AddObject(&pFilm->reels[cd.box[i].bi], -1);
- MultiSetAniXY(iconArray[*pi], x, y);
- MultiSetZPosition(iconArray[*pi], Z_INV_BRECT+2);
+ g_iconArray[*pi] = AddObject(&pFilm->reels[cd.box[i].bi], -1);
+ MultiSetAniXY(g_iconArray[*pi], x, y);
+ MultiSetZPosition(g_iconArray[*pi], Z_INV_BRECT+2);
*pi += 1;
break;
case FLIP:
- pFilm = (const FILM *)LockMem(hWinParts);
+ pFilm = (const FILM *)LockMem(g_hWinParts);
if (*pival)
- iconArray[*pi] = AddObject(&pFilm->reels[cd.box[i].bi], -1);
+ g_iconArray[*pi] = AddObject(&pFilm->reels[cd.box[i].bi], -1);
else
- iconArray[*pi] = AddObject(&pFilm->reels[cd.box[i].bi+1], -1);
- MultiSetAniXY(iconArray[*pi], x, y);
- MultiSetZPosition(iconArray[*pi], Z_INV_BRECT+1);
+ g_iconArray[*pi] = AddObject(&pFilm->reels[cd.box[i].bi+1], -1);
+ MultiSetAniXY(g_iconArray[*pi], x, y);
+ MultiSetZPosition(g_iconArray[*pi], Z_INV_BRECT+1);
*pi += 1;
// Stick in the text
@@ -2838,23 +2827,23 @@ static void AddBox(int *pi, const int i) {
LoadStringRes(SysString(cd.box[i].ixText), TextBufferAddr(), TBUFSZ);
} else {
assert(cd.box[i].ixText != USE_POINTER);
- LoadStringRes(configStrings[cd.box[i].ixText], TextBufferAddr(), TBUFSZ);
+ LoadStringRes(g_configStrings[cd.box[i].ixText], TextBufferAddr(), TBUFSZ);
}
- iconArray[*pi] = ObjectTextOut(GetPlayfieldList(FIELD_STATUS),
+ g_iconArray[*pi] = ObjectTextOut(GetPlayfieldList(FIELD_STATUS),
TextBufferAddr(), 0, x + MDTEXT_XOFF, y + MDTEXT_YOFF, GetTagFontHandle(), TXT_RIGHT);
- MultiSetZPosition(iconArray[*pi], Z_INV_ITEXT);
+ MultiSetZPosition(g_iconArray[*pi], Z_INV_ITEXT);
*pi += 1;
break;
case TOGGLE:
case TOGGLE1:
case TOGGLE2:
- pFilm = (const FILM *)LockMem(hWinParts);
+ pFilm = (const FILM *)LockMem(g_hWinParts);
cd.box[i].bi = *pival ? IX_TICK1 : IX_CROSS1;
- iconArray[*pi] = AddObject(&pFilm->reels[cd.box[i].bi + NORMGRAPH], -1);
- MultiSetAniXY(iconArray[*pi], x, y);
- MultiSetZPosition(iconArray[*pi], Z_INV_BRECT+1);
+ g_iconArray[*pi] = AddObject(&pFilm->reels[cd.box[i].bi + NORMGRAPH], -1);
+ MultiSetAniXY(g_iconArray[*pi], x, y);
+ MultiSetZPosition(g_iconArray[*pi], Z_INV_BRECT+1);
*pi += 1;
// Stick in the text
@@ -2863,39 +2852,39 @@ static void AddBox(int *pi, const int i) {
LoadStringRes(SysString(cd.box[i].ixText), TextBufferAddr(), TBUFSZ);
} else {
assert(cd.box[i].ixText != USE_POINTER);
- LoadStringRes(configStrings[cd.box[i].ixText], TextBufferAddr(), TBUFSZ);
+ LoadStringRes(g_configStrings[cd.box[i].ixText], TextBufferAddr(), TBUFSZ);
}
if (cd.box[i].boxType == TOGGLE2) {
- iconArray[*pi] = ObjectTextOut(GetPlayfieldList(FIELD_STATUS),
+ g_iconArray[*pi] = ObjectTextOut(GetPlayfieldList(FIELD_STATUS),
TextBufferAddr(), 0, x + cd.box[i].w / 2, y + TOG2_YOFF,
GetTagFontHandle(), TXT_CENTER, 0);
} else {
- iconArray[*pi] = ObjectTextOut(GetPlayfieldList(FIELD_STATUS),
+ g_iconArray[*pi] = ObjectTextOut(GetPlayfieldList(FIELD_STATUS),
TextBufferAddr(), 0, x + MDTEXT_XOFF, y + MDTEXT_YOFF,
GetTagFontHandle(), TXT_RIGHT, 0);
}
- MultiSetZPosition(iconArray[*pi], Z_INV_ITEXT);
+ MultiSetZPosition(g_iconArray[*pi], Z_INV_ITEXT);
*pi += 1;
break;
case SLIDER:
- pFilm = (const FILM *)LockMem(hWinParts);
+ pFilm = (const FILM *)LockMem(g_hWinParts);
xdisp = SLIDE_RANGE*(*pival)/cd.box[i].w;
- iconArray[*pi] = AddObject(&pFilm->reels[IX_MDGROOVE], -1);
- MultiSetAniXY(iconArray[*pi], x, y);
- MultiSetZPosition(iconArray[*pi], Z_MDGROOVE);
+ g_iconArray[*pi] = AddObject(&pFilm->reels[IX_MDGROOVE], -1);
+ MultiSetAniXY(g_iconArray[*pi], x, y);
+ MultiSetZPosition(g_iconArray[*pi], Z_MDGROOVE);
*pi += 1;
- iconArray[*pi] = AddObject(&pFilm->reels[IX_MDSLIDER], -1);
- MultiSetAniXY(iconArray[*pi], x+SLIDE_MINX+xdisp, y);
- MultiSetZPosition(iconArray[*pi], Z_MDSLIDER);
- assert(numMdSlides < MAXSLIDES);
- mdSlides[numMdSlides].num = i;
- mdSlides[numMdSlides].min = x + SLIDE_MINX;
- mdSlides[numMdSlides].max = x + SLIDE_MAXX;
- mdSlides[numMdSlides++].obj = iconArray[*pi];
+ g_iconArray[*pi] = AddObject(&pFilm->reels[IX_MDSLIDER], -1);
+ MultiSetAniXY(g_iconArray[*pi], x+SLIDE_MINX+xdisp, y);
+ MultiSetZPosition(g_iconArray[*pi], Z_MDSLIDER);
+ assert(g_numMdSlides < MAXSLIDES);
+ g_mdSlides[g_numMdSlides].num = i;
+ g_mdSlides[g_numMdSlides].min = x + SLIDE_MINX;
+ g_mdSlides[g_numMdSlides].max = x + SLIDE_MAXX;
+ g_mdSlides[g_numMdSlides++].obj = g_iconArray[*pi];
*pi += 1;
// Stick in the text
@@ -2904,55 +2893,55 @@ static void AddBox(int *pi, const int i) {
LoadStringRes(SysString(cd.box[i].ixText), TextBufferAddr(), TBUFSZ);
} else {
assert(cd.box[i].ixText != USE_POINTER);
- LoadStringRes(configStrings[cd.box[i].ixText], TextBufferAddr(), TBUFSZ);
+ LoadStringRes(g_configStrings[cd.box[i].ixText], TextBufferAddr(), TBUFSZ);
}
- iconArray[*pi] = ObjectTextOut(GetPlayfieldList(FIELD_STATUS),
+ g_iconArray[*pi] = ObjectTextOut(GetPlayfieldList(FIELD_STATUS),
TextBufferAddr(), 0, x+MDTEXT_XOFF, y+MDTEXT_YOFF, GetTagFontHandle(), TXT_RIGHT);
- MultiSetZPosition(iconArray[*pi], Z_INV_ITEXT);
+ MultiSetZPosition(g_iconArray[*pi], Z_INV_ITEXT);
*pi += 1;
break;
case ROTATE:
- pFilm = (const FILM *)LockMem(hWinParts);
+ pFilm = (const FILM *)LockMem(g_hWinParts);
// Left one
- if (!bNoLanguage) {
- iconArray[*pi] = AddObject(&pFilm->reels[IX2_LEFT1], -1);
- MultiSetAniXY(iconArray[*pi], x-ROTX1, y);
- MultiSetZPosition(iconArray[*pi], Z_INV_BRECT + 1);
+ if (!g_bNoLanguage) {
+ g_iconArray[*pi] = AddObject(&pFilm->reels[IX2_LEFT1], -1);
+ MultiSetAniXY(g_iconArray[*pi], x-ROTX1, y);
+ MultiSetZPosition(g_iconArray[*pi], Z_INV_BRECT + 1);
*pi += 1;
// Right one
- iconArray[*pi] = AddObject( &pFilm->reels[IX2_RIGHT1], -1);
- MultiSetAniXY(iconArray[*pi], x + ROTX1, y);
- MultiSetZPosition(iconArray[*pi], Z_INV_BRECT + 1);
+ g_iconArray[*pi] = AddObject( &pFilm->reels[IX2_RIGHT1], -1);
+ MultiSetAniXY(g_iconArray[*pi], x + ROTX1, y);
+ MultiSetZPosition(g_iconArray[*pi], Z_INV_BRECT + 1);
*pi += 1;
// Stick in the text
assert(cd.box[i].textMethod == TM_INDEX);
LoadStringRes(SysString(cd.box[i].ixText), TextBufferAddr(), TBUFSZ);
- iconArray[*pi] = ObjectTextOut(GetPlayfieldList(FIELD_STATUS),
+ g_iconArray[*pi] = ObjectTextOut(GetPlayfieldList(FIELD_STATUS),
TextBufferAddr(), 0, x + cd.box[i].w / 2, y + TOG2_YOFF,
GetTagFontHandle(), TXT_CENTER, 0);
- MultiSetZPosition(iconArray[*pi], Z_INV_ITEXT);
+ MultiSetZPosition(g_iconArray[*pi], Z_INV_ITEXT);
*pi += 1;
}
// Current language's text
- if (LanguageDesc(displayedLanguage) == 0)
+ if (LanguageDesc(g_displayedLanguage) == 0)
break;
- LoadStringRes(LanguageDesc(displayedLanguage), TextBufferAddr(), TBUFSZ);
- iconArray[*pi] = ObjectTextOut(GetPlayfieldList(FIELD_STATUS), TextBufferAddr(), 0,
+ LoadStringRes(LanguageDesc(g_displayedLanguage), TextBufferAddr(), TBUFSZ);
+ g_iconArray[*pi] = ObjectTextOut(GetPlayfieldList(FIELD_STATUS), TextBufferAddr(), 0,
x + cd.box[i].w / 2, y + ROT_YOFF, GetTagFontHandle(), TXT_CENTER, 0);
- MultiSetZPosition(iconArray[*pi], Z_INV_ITEXT);
+ MultiSetZPosition(g_iconArray[*pi], Z_INV_ITEXT);
*pi += 1;
// Current language's flag
- pFilm = (const FILM *)LockMem(LanguageFlag(displayedLanguage));
- iconArray[*pi] = AddObject(&pFilm->reels[0], -1);
- MultiSetAniXY(iconArray[*pi], x + FLAGX, y + FLAGY);
- MultiSetZPosition(iconArray[*pi], Z_INV_BRECT + 1);
+ pFilm = (const FILM *)LockMem(LanguageFlag(g_displayedLanguage));
+ g_iconArray[*pi] = AddObject(&pFilm->reels[0], -1);
+ MultiSetAniXY(g_iconArray[*pi], x + FLAGX, y + FLAGY);
+ MultiSetZPosition(g_iconArray[*pi], Z_INV_BRECT + 1);
*pi += 1;
break;
}
@@ -2965,7 +2954,7 @@ static void AddBoxes(bool bPosnSlide) {
int objCount = NUMHL; // Object count - allow for HL1, HL2 etc.
DumpIconArray();
- numMdSlides = 0;
+ g_numMdSlides = 0;
for (int i = 0; i < cd.NumBoxes; i++) {
AddBox(&objCount, i);
@@ -2973,32 +2962,32 @@ static void AddBoxes(bool bPosnSlide) {
if (cd.bExtraWin) {
if (bPosnSlide && !TinselV2)
- sliderYpos = sliderYmin + (cd.extraBase*(sliderYmax-sliderYmin))/(MAX_SAVED_FILES-NUM_RGROUP_BOXES);
+ g_sliderYpos = g_sliderYmin + (cd.extraBase*(g_sliderYmax-g_sliderYmin))/(MAX_SAVED_FILES-NUM_RGROUP_BOXES);
else if (bPosnSlide) {
// Tinsel 2 bPosnSlide code
- int lastY = sliderYpos;
+ int lastY = g_sliderYpos;
if (cd.box == loadBox || cd.box == saveBox)
- sliderYpos = sliderYmin + (cd.extraBase * (sliderRange)) /
+ g_sliderYpos = g_sliderYmin + (cd.extraBase * (sliderRange)) /
(MAX_SAVED_FILES - NUM_RGROUP_BOXES);
else if (cd.box == hopperBox1) {
- if (numScenes <= NUM_RGROUP_BOXES)
- sliderYpos = sliderYmin;
+ if (g_numScenes <= NUM_RGROUP_BOXES)
+ g_sliderYpos = g_sliderYmin;
else
- sliderYpos = sliderYmin + (cd.extraBase*(sliderRange))/(numScenes-NUM_RGROUP_BOXES);
+ g_sliderYpos = g_sliderYmin + (cd.extraBase*(sliderRange))/(g_numScenes-NUM_RGROUP_BOXES);
} else if (cd.box == hopperBox2) {
- if (numEntries <= NUM_RGROUP_BOXES)
- sliderYpos = sliderYmin;
+ if (g_numEntries <= NUM_RGROUP_BOXES)
+ g_sliderYpos = g_sliderYmin;
else
- sliderYpos = sliderYmin + (cd.extraBase * (sliderRange)) /
- (numEntries-NUM_RGROUP_BOXES);
+ g_sliderYpos = g_sliderYmin + (cd.extraBase * (sliderRange)) /
+ (g_numEntries-NUM_RGROUP_BOXES);
}
- MultiMoveRelXY(SlideObject, 0, sliderYpos - lastY);
+ MultiMoveRelXY(g_SlideObject, 0, g_sliderYpos - lastY);
}
if (!TinselV2)
- MultiSetAniXY(SlideObject, InvD[ino].inventoryX + 24 + 179, sliderYpos);
+ MultiSetAniXY(g_SlideObject, g_InvD[g_ino].inventoryX + 24 + 179, g_sliderYpos);
}
assert(objCount < MAX_ICONS); // added too many icons
@@ -3008,8 +2997,8 @@ static void AddBoxes(bool bPosnSlide) {
* Display the scroll bar slider.
*/
static void AddEWSlider(OBJECT **slide, const FILM *pfilm) {
- SlideObject = *slide = AddObject(&pfilm->reels[IX_SLIDE], -1);
- MultiSetAniXY(*slide, InvD[ino].inventoryX + 24 + 127, sliderYpos);
+ g_SlideObject = *slide = AddObject(&pfilm->reels[IX_SLIDE], -1);
+ MultiSetAniXY(*slide, g_InvD[g_ino].inventoryX + 24 + 127, g_sliderYpos);
MultiSetZPosition(*slide, Z_INV_MFRAME);
}
@@ -3021,7 +3010,7 @@ static int AddExtraWindow(int x, int y, OBJECT **retObj) {
const FILM *pfilm;
// Get the frame's data
- pfilm = (const FILM *)LockMem(hWinParts);
+ pfilm = (const FILM *)LockMem(g_hWinParts);
x += TinselV2 ? 30 : 20;
y += TinselV2 ? 38 : 24;
@@ -3032,56 +3021,56 @@ static int AddExtraWindow(int x, int y, OBJECT **retObj) {
MultiSetZPosition(retObj[n], Z_INV_MFRAME);
n++;
retObj[n] = AddObject(&pfilm->reels[IX_NTR], -1); // Top right
- MultiSetAniXY(retObj[n], x + (TinselV2 ? TLwidth + 312 : 152), y);
+ MultiSetAniXY(retObj[n], x + (TinselV2 ? g_TLwidth + 312 : 152), y);
MultiSetZPosition(retObj[n], Z_INV_MFRAME);
n++;
retObj[n] = AddObject(&pfilm->reels[IX_BL], -1); // Bottom left
- MultiSetAniXY(retObj[n], x, y + (TinselV2 ? TLheight + 208 : 124));
+ MultiSetAniXY(retObj[n], x, y + (TinselV2 ? g_TLheight + 208 : 124));
MultiSetZPosition(retObj[n], Z_INV_MFRAME);
n++;
retObj[n] = AddObject(&pfilm->reels[IX_BR], -1); // Bottom right
- MultiSetAniXY(retObj[n], x + (TinselV2 ? TLwidth + 312 : 152),
- y + (TinselV2 ? TLheight + 208 : 124));
+ MultiSetAniXY(retObj[n], x + (TinselV2 ? g_TLwidth + 312 : 152),
+ y + (TinselV2 ? g_TLheight + 208 : 124));
MultiSetZPosition(retObj[n], Z_INV_MFRAME);
n++;
// Draw the edges
retObj[n] = AddObject(&pfilm->reels[IX_H156], -1); // Top
- MultiSetAniXY(retObj[n], x + (TinselV2 ? TLwidth : 6), y + NM_TBT);
+ MultiSetAniXY(retObj[n], x + (TinselV2 ? g_TLwidth : 6), y + NM_TBT);
MultiSetZPosition(retObj[n], Z_INV_MFRAME);
n++;
retObj[n] = AddObject(&pfilm->reels[IX_H156], -1); // Bottom
- MultiSetAniXY(retObj[n], x + (TinselV2 ? TLwidth : 6), y +
- (TinselV2 ? TLheight + 208 + BLheight + NM_BSY : 143));
+ MultiSetAniXY(retObj[n], x + (TinselV2 ? g_TLwidth : 6), y +
+ (TinselV2 ? g_TLheight + 208 + g_BLheight + NM_BSY : 143));
MultiSetZPosition(retObj[n], Z_INV_MFRAME);
n++;
retObj[n] = AddObject(&pfilm->reels[IX_V104], -1); // Left
- MultiSetAniXY(retObj[n], x + NM_LSX, y + (TinselV2 ? TLheight : 20));
+ MultiSetAniXY(retObj[n], x + NM_LSX, y + (TinselV2 ? g_TLheight : 20));
MultiSetZPosition(retObj[n], Z_INV_MFRAME);
n++;
retObj[n] = AddObject(&pfilm->reels[IX_V104], -1); // Right 1
- MultiSetAniXY(retObj[n], x + (TinselV2 ? TLwidth + 312 + TRwidth + NM_RSX : 179),
- y + (TinselV2 ? TLheight : 20));
+ MultiSetAniXY(retObj[n], x + (TinselV2 ? g_TLwidth + 312 + g_TRwidth + NM_RSX : 179),
+ y + (TinselV2 ? g_TLheight : 20));
MultiSetZPosition(retObj[n], Z_INV_MFRAME);
n++;
retObj[n] = AddObject(&pfilm->reels[IX_V104], -1); // Right 2
- MultiSetAniXY(retObj[n], x + (TinselV2 ? TLwidth + 312 + TRwidth + NM_SBL : 188),
- y + (TinselV2 ? TLheight : 20));
+ MultiSetAniXY(retObj[n], x + (TinselV2 ? g_TLwidth + 312 + g_TRwidth + NM_SBL : 188),
+ y + (TinselV2 ? g_TLheight : 20));
MultiSetZPosition(retObj[n], Z_INV_MFRAME);
n++;
if (TinselV2) {
- sliderYpos = sliderYmin = y + 27;
- sliderYmax = y + 273;
-
- retObj[n++] = SlideObject = AddObject( &pfilm->reels[IX_SLIDE], -1);
- MultiSetAniXY(SlideObject,
- x + TLwidth + 320 + TRwidth - NM_BG_POS_X + NM_BG_SIZ_X - 2,
- sliderYpos);
- MultiSetZPosition(SlideObject, Z_INV_MFRAME);
+ g_sliderYpos = g_sliderYmin = y + 27;
+ g_sliderYmax = y + 273;
+
+ retObj[n++] = g_SlideObject = AddObject( &pfilm->reels[IX_SLIDE], -1);
+ MultiSetAniXY(g_SlideObject,
+ x + g_TLwidth + 320 + g_TRwidth - NM_BG_POS_X + NM_BG_SIZ_X - 2,
+ g_sliderYpos);
+ MultiSetZPosition(g_SlideObject, Z_INV_MFRAME);
} else {
- sliderYpos = sliderYmin = y + 9;
- sliderYmax = y + 134;
+ g_sliderYpos = g_sliderYmin = y + 9;
+ g_sliderYmax = y + 134;
AddEWSlider(&retObj[n++], pfilm);
}
@@ -3099,17 +3088,17 @@ static void ConstructInventory(InventoryType filling) {
int eH, eV; // Extra width and height
int n = 0; // Index into object array
int zpos; // Z-position of frame
- int invX = InvD[ino].inventoryX;
- int invY = InvD[ino].inventoryY;
+ int invX = g_InvD[g_ino].inventoryX;
+ int invY = g_InvD[g_ino].inventoryY;
OBJECT **retObj;
const FILM *pfilm;
// Select the object array to use
if (filling == FULL || filling == CONF) {
- retObj = objArray; // Standard window
+ retObj = g_objArray; // Standard window
zpos = Z_INV_MFRAME;
} else {
- retObj = DobjArray; // Re-sizing window
+ retObj = g_DobjArray; // Re-sizing window
zpos = Z_INV_RFRAME;
}
@@ -3122,83 +3111,83 @@ static void ConstructInventory(InventoryType filling) {
}
// Get the frame's data
- pfilm = (const FILM *)LockMem(hWinParts);
+ pfilm = (const FILM *)LockMem(g_hWinParts);
// Standard window is of granular dimensions
if (filling == FULL) {
// Round-up/down to nearest number of icons
- if (SuppH > ITEM_WIDTH / 2)
- InvD[ino].NoofHicons++;
- if (SuppV > ITEM_HEIGHT / 2)
- InvD[ino].NoofVicons++;
- SuppH = SuppV = 0;
+ if (g_SuppH > ITEM_WIDTH / 2)
+ g_InvD[g_ino].NoofHicons++;
+ if (g_SuppV > ITEM_HEIGHT / 2)
+ g_InvD[g_ino].NoofVicons++;
+ g_SuppH = g_SuppV = 0;
}
// Extra width and height
- eH = (InvD[ino].NoofHicons - 1) * (ITEM_WIDTH+I_SEPARATION) + SuppH;
- eV = (InvD[ino].NoofVicons - 1) * (ITEM_HEIGHT+I_SEPARATION) + SuppV;
+ eH = (g_InvD[g_ino].NoofHicons - 1) * (ITEM_WIDTH+I_SEPARATION) + g_SuppH;
+ eV = (g_InvD[g_ino].NoofVicons - 1) * (ITEM_HEIGHT+I_SEPARATION) + g_SuppV;
// Which window frame corners to use
- if (TinselV2 && (ino == INV_CONV)) {
- TL = IX_TL;
- TR = IX2_TR4;
- BL = IX_BL;
- BR = IX_RBR;
- } else if ((filling == FULL) && (ino != INV_CONV)) {
- TL = IX_TL;
- TR = IX_TR;
- BL = IX_BL;
- BR = IX_BR;
+ if (TinselV2 && (g_ino == INV_CONV)) {
+ g_TL = IX_TL;
+ g_TR = IX2_TR4;
+ g_BL = IX_BL;
+ g_BR = IX_RBR;
+ } else if ((filling == FULL) && (g_ino != INV_CONV)) {
+ g_TL = IX_TL;
+ g_TR = IX_TR;
+ g_BL = IX_BL;
+ g_BR = IX_BR;
} else {
- TL = IX_RTL;
- TR = IX_RTR;
- BL = IX_BL;
- BR = IX_RBR;
+ g_TL = IX_RTL;
+ g_TR = IX_RTR;
+ g_BL = IX_BL;
+ g_BR = IX_RBR;
}
// Draw the four corners
- retObj[n] = AddObject(&pfilm->reels[TL], TL);
+ retObj[n] = AddObject(&pfilm->reels[g_TL], g_TL);
MultiSetAniXY(retObj[n], invX, invY);
MultiSetZPosition(retObj[n], zpos);
n++;
- retObj[n] = AddObject(&pfilm->reels[TR], TR);
- MultiSetAniXY(retObj[n], invX + TLwidth + eH, invY);
+ retObj[n] = AddObject(&pfilm->reels[g_TR], g_TR);
+ MultiSetAniXY(retObj[n], invX + g_TLwidth + eH, invY);
MultiSetZPosition(retObj[n], zpos);
n++;
- retObj[n] = AddObject(&pfilm->reels[BL], BL);
- MultiSetAniXY(retObj[n], invX, invY + TLheight + eV);
+ retObj[n] = AddObject(&pfilm->reels[g_BL], g_BL);
+ MultiSetAniXY(retObj[n], invX, invY + g_TLheight + eV);
MultiSetZPosition(retObj[n], zpos);
n++;
- retObj[n] = AddObject(&pfilm->reels[BR], BR);
- MultiSetAniXY(retObj[n], invX + TLwidth + eH, invY + TLheight + eV);
+ retObj[n] = AddObject(&pfilm->reels[g_BR], g_BR);
+ MultiSetAniXY(retObj[n], invX + g_TLwidth + eH, invY + g_TLheight + eV);
MultiSetZPosition(retObj[n], zpos);
n++;
// Draw extra Top and bottom parts
- if (InvD[ino].NoofHicons > 1) {
+ if (g_InvD[g_ino].NoofHicons > 1) {
// Top side
- retObj[n] = AddObject(&pfilm->reels[hFillers[InvD[ino].NoofHicons-2]], -1);
- MultiSetAniXY(retObj[n], invX + TLwidth, invY + NM_TBT);
+ retObj[n] = AddObject(&pfilm->reels[hFillers[g_InvD[g_ino].NoofHicons-2]], -1);
+ MultiSetAniXY(retObj[n], invX + g_TLwidth, invY + NM_TBT);
MultiSetZPosition(retObj[n], zpos);
n++;
// Bottom of header box
if (filling == FULL) {
if (TinselV2) {
- retObj[n] = AddObject(&pfilm->reels[hFillers[InvD[ino].NoofHicons-2]], -1);
- MultiSetAniXY(retObj[n], invX + TLwidth, invY + NM_TBB);
+ retObj[n] = AddObject(&pfilm->reels[hFillers[g_InvD[g_ino].NoofHicons-2]], -1);
+ MultiSetAniXY(retObj[n], invX + g_TLwidth, invY + NM_TBB);
MultiSetZPosition(retObj[n], zpos);
n++;
} else {
- retObj[n] = AddObject(&pfilm->reels[hFillers[InvD[ino].NoofHicons-2]], -1);
- MultiSetAniXY(retObj[n], invX + TLwidth, invY + M_TBB + 1);
+ retObj[n] = AddObject(&pfilm->reels[hFillers[g_InvD[g_ino].NoofHicons-2]], -1);
+ MultiSetAniXY(retObj[n], invX + g_TLwidth, invY + M_TBB + 1);
MultiSetZPosition(retObj[n], zpos);
n++;
// Extra bits for conversation - hopefully temporary
- if (ino == INV_CONV) {
+ if (g_ino == INV_CONV) {
retObj[n] = AddObject(&pfilm->reels[IX_H26], -1);
- MultiSetAniXY(retObj[n], invX + TLwidth - 2, invY + M_TBB + 1);
+ MultiSetAniXY(retObj[n], invX + g_TLwidth - 2, invY + M_TBB + 1);
MultiSetZPosition(retObj[n], zpos);
n++;
@@ -3211,16 +3200,16 @@ static void ConstructInventory(InventoryType filling) {
}
// Bottom side
- retObj[n] = AddObject(&pfilm->reels[hFillers[InvD[ino].NoofHicons-2]], -1);
- MultiSetAniXY(retObj[n], invX + TLwidth, invY + TLheight + eV + BLheight + NM_BSY);
+ retObj[n] = AddObject(&pfilm->reels[hFillers[g_InvD[g_ino].NoofHicons-2]], -1);
+ MultiSetAniXY(retObj[n], invX + g_TLwidth, invY + g_TLheight + eV + g_BLheight + NM_BSY);
MultiSetZPosition(retObj[n], zpos);
n++;
}
- if (SuppH) {
- int offx = TLwidth + eH - (TinselV2 ? ITEM_WIDTH + I_SEPARATION : 26);
- if (offx < TLwidth) // Not too far!
- offx = TLwidth;
+ if (g_SuppH) {
+ int offx = g_TLwidth + eH - (TinselV2 ? ITEM_WIDTH + I_SEPARATION : 26);
+ if (offx < g_TLwidth) // Not too far!
+ offx = g_TLwidth;
// Top side extra
retObj[n] = AddObject(&pfilm->reels[IX_H26], -1);
@@ -3230,39 +3219,39 @@ static 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);
+ MultiSetAniXY(retObj[n], invX + offx, invY + g_TLheight + eV + g_BLheight + NM_BSY);
MultiSetZPosition(retObj[n], zpos);
n++;
}
// Draw extra side parts
- if (InvD[ino].NoofVicons > 1) {
+ if (g_InvD[g_ino].NoofVicons > 1) {
// Left side
- retObj[n] = AddObject(&pfilm->reels[vFillers[InvD[ino].NoofVicons-2]], -1);
- MultiSetAniXY(retObj[n], invX + NM_LSX, invY + TLheight);
+ retObj[n] = AddObject(&pfilm->reels[vFillers[g_InvD[g_ino].NoofVicons-2]], -1);
+ MultiSetAniXY(retObj[n], invX + NM_LSX, invY + g_TLheight);
MultiSetZPosition(retObj[n], zpos);
n++;
// Left side of scroll bar
- if (filling == FULL && ino != INV_CONV) {
- retObj[n] = AddObject(&pfilm->reels[vFillers[InvD[ino].NoofVicons-2]], -1);
+ if (filling == FULL && g_ino != INV_CONV) {
+ retObj[n] = AddObject(&pfilm->reels[vFillers[g_InvD[g_ino].NoofVicons-2]], -1);
if (TinselV2)
- MultiSetAniXY(retObj[n], invX + TLwidth + eH + TRwidth + NM_SBL, invY + TLheight);
+ MultiSetAniXY(retObj[n], invX + g_TLwidth + eH + g_TRwidth + NM_SBL, invY + g_TLheight);
else
- MultiSetAniXY(retObj[n], invX + TLwidth + eH + M_SBL + 1, invY + TLheight);
+ MultiSetAniXY(retObj[n], invX + g_TLwidth + eH + M_SBL + 1, invY + g_TLheight);
MultiSetZPosition(retObj[n], zpos);
n++;
}
// Right side
- retObj[n] = AddObject(&pfilm->reels[vFillers[InvD[ino].NoofVicons-2]], -1);
- MultiSetAniXY(retObj[n], invX + TLwidth + eH + TRwidth + NM_RSX, invY + TLheight);
+ retObj[n] = AddObject(&pfilm->reels[vFillers[g_InvD[g_ino].NoofVicons-2]], -1);
+ MultiSetAniXY(retObj[n], invX + g_TLwidth + eH + g_TRwidth + NM_RSX, invY + g_TLheight);
MultiSetZPosition(retObj[n], zpos);
n++;
}
- if (SuppV) {
- int offy = TLheight + eV - (TinselV2 ? ITEM_HEIGHT + I_SEPARATION : 26);
+ if (g_SuppV) {
+ int offy = g_TLheight + eV - (TinselV2 ? ITEM_HEIGHT + I_SEPARATION : 26);
int minAmount = TinselV2 ? 20 : 5;
if (offy < minAmount)
offy = minAmount;
@@ -3275,7 +3264,7 @@ static void ConstructInventory(InventoryType filling) {
// Right side extra
retObj[n] = AddObject(&pfilm->reels[IX_V26], -1);
- MultiSetAniXY(retObj[n], invX + TLwidth + eH + TRwidth + NM_RSX, invY + offy);
+ MultiSetAniXY(retObj[n], invX + g_TLwidth + eH + g_TRwidth + NM_RSX, invY + offy);
MultiSetZPosition(retObj[n], zpos);
n++;
}
@@ -3296,20 +3285,20 @@ static void ConstructInventory(InventoryType filling) {
AddBackground(rect, title, eH, eV, FROM_HANDLE);
}
- if (ino == INV_CONV) {
- SlideObject = NULL;
+ if (g_ino == INV_CONV) {
+ g_SlideObject = NULL;
if (TinselV2) {
// !!!!! MAGIC NUMBER ALERT !!!!!
// Make sure it's big enough for the heading
- if (MultiLeftmost(retObj[n-1]) < InvD[INV_CONV].inventoryX + 10) {
- InvD[INV_CONV].NoofHicons++;
+ if (MultiLeftmost(retObj[n-1]) < g_InvD[INV_CONV].inventoryX + 10) {
+ g_InvD[INV_CONV].NoofHicons++;
ConstructInventory(FULL);
}
}
- } else if (InvD[ino].NoofItems > InvD[ino].NoofHicons*InvD[ino].NoofVicons) {
- sliderYmin = TLheight - (TinselV2 ? 2 : 1);
- sliderYmax = TLheight + eV + (TinselV2 ? 12 : 10);
+ } else if (g_InvD[g_ino].NoofItems > g_InvD[g_ino].NoofHicons*g_InvD[g_ino].NoofVicons) {
+ g_sliderYmin = g_TLheight - (TinselV2 ? 2 : 1);
+ g_sliderYmax = g_TLheight + eV + (TinselV2 ? 12 : 10);
AddSlider(&retObj[n++], pfilm);
}
@@ -3333,7 +3322,7 @@ static void ConstructInventory(InventoryType filling) {
assert(n < MAX_WCOMP); // added more parts than we can handle!
// Reposition returns true if needs to move
- if (InvD[ino].bMoveable && filling == FULL && RePosition()) {
+ if (g_InvD[g_ino].bMoveable && filling == FULL && RePosition()) {
ConstructInventory(FULL);
}
}
@@ -3348,32 +3337,32 @@ static bool RePosition() {
int p;
bool bMoveitMoveit = false;
- assert(RectObject); // no recangle object!
+ assert(g_RectObject); // no recangle object!
// Test for off-screen horizontally
- p = MultiLeftmost(RectObject);
+ p = MultiLeftmost(g_RectObject);
if (p > MAXLEFT) {
// Too far to the right
- InvD[ino].inventoryX += MAXLEFT - p;
+ g_InvD[g_ino].inventoryX += MAXLEFT - p;
bMoveitMoveit = true; // I like to....
} else {
// Too far to the left?
- p = MultiRightmost(RectObject);
+ p = MultiRightmost(g_RectObject);
if (p < MINRIGHT) {
- InvD[ino].inventoryX += MINRIGHT - p;
+ g_InvD[g_ino].inventoryX += MINRIGHT - p;
bMoveitMoveit = true; // I like to....
}
}
// Test for off-screen vertically
- p = MultiHighest(RectObject);
+ p = MultiHighest(g_RectObject);
if (p < MINTOP) {
// Too high
- InvD[ino].inventoryY += MINTOP - p;
+ g_InvD[g_ino].inventoryY += MINTOP - p;
bMoveitMoveit = true; // I like to....
} else if (p > MAXTOP) {
// Too low
- InvD[ino].inventoryY += MAXTOP - p;
+ g_InvD[g_ino].inventoryY += MAXTOP - p;
bMoveitMoveit = true; // I like to....
}
@@ -3393,7 +3382,7 @@ static void AlterCursor(int num) {
IMAGE *pim;
// Get pointer to image
- pim = GetImageFromFilm(hWinParts, num, &pfreel);
+ pim = GetImageFromFilm(g_hWinParts, num, &pfreel);
// Poke in the background palette
pim->hImgPal = TO_LE_32(BgPal());
@@ -3414,7 +3403,7 @@ static void InvCursor(InvCursorFN fn, int CurX, int CurY) {
bool restoreMain = false;
// If currently dragging, don't be messing about with the cursor shape
- if (InvDragging != ID_NONE)
+ if (g_InvDragging != ID_NONE)
return;
switch (fn) {
@@ -3427,7 +3416,7 @@ static void InvCursor(InvCursorFN fn, int CurX, int CurY) {
area = InvArea(CurX, CurY);
// Check for POINTED events
- if (ino == INV_CONF)
+ if (g_ino == INV_CONF)
InvBoxes(area == I_BODY, CurX, CurY);
else
InvLabels(area == I_BODY, CurX, CurY);
@@ -3445,7 +3434,7 @@ static void InvCursor(InvCursorFN fn, int CurX, int CurY) {
case I_TLEFT:
case I_BRIGHT:
- if (!InvD[ino].resizable)
+ if (!g_InvD[g_ino].resizable)
restoreMain = true;
else if (ICursor != IC_DR) {
AlterCursor(IX_CURDD);
@@ -3455,7 +3444,7 @@ static void InvCursor(InvCursorFN fn, int CurX, int CurY) {
case I_TRIGHT:
case I_BLEFT:
- if (!InvD[ino].resizable)
+ if (!g_InvD[g_ino].resizable)
restoreMain = true;
else if (ICursor != IC_UR) {
AlterCursor(IX_CURDU);
@@ -3465,7 +3454,7 @@ static void InvCursor(InvCursorFN fn, int CurX, int CurY) {
case I_TOP:
case I_BOTTOM:
- if (!InvD[ino].resizable) {
+ if (!g_InvD[g_ino].resizable) {
restoreMain = true;
break;
}
@@ -3477,7 +3466,7 @@ static void InvCursor(InvCursorFN fn, int CurX, int CurY) {
case I_LEFT:
case I_RIGHT:
- if (!InvD[ino].resizable)
+ if (!g_InvD[g_ino].resizable)
restoreMain = true;
else if (ICursor != IC_LR) {
AlterCursor(IX_CURLR);
@@ -3516,7 +3505,7 @@ static void InvCursor(InvCursorFN fn, int CurX, int CurY) {
extern void ConvAction(int index) {
- assert(ino == INV_CONV); // not conv. window!
+ assert(g_ino == INV_CONV); // not conv. window!
PMOVER pMover = TinselV2 ? GetMover(GetLeadId()) : NULL;
switch (index) {
@@ -3524,36 +3513,36 @@ extern void ConvAction(int index) {
return;
case INV_CLOSEICON:
- thisIcon = -1; // Postamble
+ g_thisIcon = -1; // Postamble
break;
case INV_OPENICON:
// Store the direction the lead character is facing in when the conversation starts
if (TinselV2)
- initialDirection = GetMoverDirection(pMover);
- thisIcon = -2; // Preamble
+ g_initialDirection = GetMoverDirection(pMover);
+ g_thisIcon = -2; // Preamble
break;
default:
- thisIcon = InvD[ino].contents[index];
+ g_thisIcon = g_InvD[g_ino].contents[index];
break;
}
if (!TinselV2)
- RunPolyTinselCode(thisConvPoly, CONVERSE, PLR_NOEVENT, true);
+ RunPolyTinselCode(g_thisConvPoly, CONVERSE, PLR_NOEVENT, true);
else {
// If the lead's direction has changed for any reason (such as having broken the
// fourth wall and talked to the screen), reset back to the original direction
DIRECTION currDirection = GetMoverDirection(pMover);
- if (currDirection != initialDirection) {
- SetMoverDirection(pMover, initialDirection);
+ if (currDirection != g_initialDirection) {
+ SetMoverDirection(pMover, g_initialDirection);
SetMoverStanding(pMover);
}
- if (thisConvPoly != NOPOLY)
- PolygonEvent(nullContext, thisConvPoly, CONVERSE, 0, false, 0);
+ if (g_thisConvPoly != NOPOLY)
+ PolygonEvent(nullContext, g_thisConvPoly, CONVERSE, 0, false, 0);
else
- ActorEvent(nullContext, thisConvActor, CONVERSE, false, 0);
+ ActorEvent(nullContext, g_thisConvActor, CONVERSE, false, 0);
}
}
@@ -3566,18 +3555,18 @@ extern void ConvAction(int index) {
* Note: ano may (will probably) be set when it's a polygon.
*/
extern void SetConvDetails(CONV_PARAM fn, HPOLYGON hPoly, int ano) {
- thisConvFn = fn;
- thisConvPoly = hPoly;
- thisConvActor = ano;
+ g_thisConvFn = fn;
+ g_thisConvPoly = hPoly;
+ g_thisConvActor = ano;
- bMoveOnUnHide = true;
+ g_bMoveOnUnHide = true;
// Get the Actor Tag's or Tagged Actor's label for the conversation window title
if (hPoly != NOPOLY) {
int x, y;
- GetTagTag(hPoly, &InvD[INV_CONV].hInvTitle, &x, &y);
+ GetTagTag(hPoly, &g_InvD[INV_CONV].hInvTitle, &x, &y);
} else {
- InvD[INV_CONV].hInvTitle = GetActorTagHandle(ano);
+ g_InvD[INV_CONV].hInvTitle = GetActorTagHandle(ano);
}
}
@@ -3590,27 +3579,27 @@ extern void PermaConvIcon(int icon, bool bEnd) {
int i;
// See if it's already there
- for (i = 0; i < numPermIcons; i++) {
- if (permIcons[i] == icon)
+ for (i = 0; i < g_numPermIcons; i++) {
+ if (g_permIcons[i] == icon)
break;
}
// Add it if it isn't already there
- if (i == numPermIcons) {
- assert(numPermIcons < MAX_PERMICONS);
+ if (i == g_numPermIcons) {
+ assert(g_numPermIcons < MAX_PERMICONS);
- if (bEnd || !numEndIcons) {
+ if (bEnd || !g_numEndIcons) {
// Add it at the end
- permIcons[numPermIcons++] = icon;
+ g_permIcons[g_numPermIcons++] = icon;
if (bEnd)
- numEndIcons++;
+ g_numEndIcons++;
} else {
// Insert before end icons
- memmove(&permIcons[numPermIcons-numEndIcons+1],
- &permIcons[numPermIcons-numEndIcons],
- numEndIcons * sizeof(int));
- permIcons[numPermIcons-numEndIcons] = icon;
- numPermIcons++;
+ memmove(&g_permIcons[g_numPermIcons-g_numEndIcons+1],
+ &g_permIcons[g_numPermIcons-g_numEndIcons],
+ g_numEndIcons * sizeof(int));
+ g_permIcons[g_numPermIcons-g_numEndIcons] = icon;
+ g_numPermIcons++;
}
}
}
@@ -3619,21 +3608,21 @@ extern void PermaConvIcon(int icon, bool bEnd) {
extern void convPos(int fn) {
if (fn == CONV_DEF)
- InvD[INV_CONV].inventoryY = 8;
+ g_InvD[INV_CONV].inventoryY = 8;
else if (fn == CONV_BOTTOM)
- InvD[INV_CONV].inventoryY = 150;
+ g_InvD[INV_CONV].inventoryY = 150;
}
extern void ConvPoly(HPOLYGON hPoly) {
- thisConvPoly = hPoly;
+ g_thisConvPoly = hPoly;
}
extern int GetIcon() {
- return thisIcon;
+ return g_thisIcon;
}
extern void CloseDownConv() {
- if (InventoryState == ACTIVE_INV && ino == INV_CONV) {
+ if (g_InventoryState == ACTIVE_INV && g_ino == INV_CONV) {
KillInventory();
}
}
@@ -3642,43 +3631,43 @@ extern void HideConversation(bool bHide) {
int aniX, aniY;
int i;
- if (InventoryState == ACTIVE_INV && ino == INV_CONV) {
+ if (g_InventoryState == ACTIVE_INV && g_ino == INV_CONV) {
if (bHide) {
// Move all the window and icons off-screen
- for (i = 0; objArray[i] && i < MAX_WCOMP; i++) {
- MultiAdjustXY(objArray[i], 2 * SCREEN_WIDTH, 0);
+ for (i = 0; g_objArray[i] && i < MAX_WCOMP; i++) {
+ MultiAdjustXY(g_objArray[i], 2 * SCREEN_WIDTH, 0);
}
- for (i = 0; iconArray[i] && i < MAX_ICONS; i++) {
- MultiAdjustXY(iconArray[i], 2 * SCREEN_WIDTH, 0);
+ for (i = 0; g_iconArray[i] && i < MAX_ICONS; i++) {
+ MultiAdjustXY(g_iconArray[i], 2 * SCREEN_WIDTH, 0);
}
// Window is hidden
- InventoryHidden = true;
+ g_InventoryHidden = true;
// Remove any labels
InvLabels(false, 0, 0);
} else {
// Window is not hidden
- InventoryHidden = false;
+ g_InventoryHidden = false;
- if (TinselV2 && ItemsChanged)
+ if (TinselV2 && g_ItemsChanged)
// Just rebuild the whole thing
ConstructInventory(FULL);
else {
// Move it all back on-screen
- for (i = 0; objArray[i] && i < MAX_WCOMP; i++) {
- MultiAdjustXY(objArray[i], -2 * SCREEN_WIDTH, 0);
+ for (i = 0; g_objArray[i] && i < MAX_WCOMP; i++) {
+ MultiAdjustXY(g_objArray[i], -2 * SCREEN_WIDTH, 0);
}
// Don't flash if items changed. If they have, will be redrawn anyway.
- if (TinselV2 || !ItemsChanged) {
- for (i = 0; iconArray[i] && i < MAX_ICONS; i++) {
- MultiAdjustXY(iconArray[i], -2*SCREEN_WIDTH, 0);
+ if (TinselV2 || !g_ItemsChanged) {
+ for (i = 0; g_iconArray[i] && i < MAX_ICONS; i++) {
+ MultiAdjustXY(g_iconArray[i], -2*SCREEN_WIDTH, 0);
}
}
}
- if (TinselV2 && bMoveOnUnHide) {
+ if (TinselV2 && g_bMoveOnUnHide) {
/*
* First time, position it appropriately
*/
@@ -3686,17 +3675,17 @@ extern void HideConversation(bool bHide) {
int x, y, deltay;
// Only do it once per conversation
- bMoveOnUnHide = false;
+ g_bMoveOnUnHide = false;
// Current center of the window
- left = MultiLeftmost(RectObject);
- center = (MultiRightmost(RectObject) + left) / 2;
+ left = MultiLeftmost(g_RectObject);
+ center = (MultiRightmost(g_RectObject) + left) / 2;
// Get the x-offset for the conversation window
- if (thisConvActor) {
+ if (g_thisConvActor) {
int Loffset, Toffset;
- GetActorMidTop(thisConvActor, &x, &y);
+ GetActorMidTop(g_thisConvActor, &x, &y);
PlayfieldGetPos(FIELD_WORLD, &Loffset, &Toffset);
x -= Loffset;
y -= Toffset;
@@ -3706,19 +3695,19 @@ extern void HideConversation(bool bHide) {
}
// Save old y-position
- deltay = InvD[INV_CONV].inventoryY;
+ deltay = g_InvD[INV_CONV].inventoryY;
- switch (thisConvFn) {
+ switch (g_thisConvFn) {
case CONV_TOP:
- InvD[INV_CONV].inventoryY = SysVar(SV_CONV_TOPY);
+ g_InvD[INV_CONV].inventoryY = SysVar(SV_CONV_TOPY);
break;
case CONV_BOTTOM:
- InvD[INV_CONV].inventoryY = SysVar(SV_CONV_BOTY);
+ g_InvD[INV_CONV].inventoryY = SysVar(SV_CONV_BOTY);
break;
case CONV_DEF:
- InvD[INV_CONV].inventoryY = y - SysVar(SV_CONV_ABOVE_Y);
+ g_InvD[INV_CONV].inventoryY = y - SysVar(SV_CONV_ABOVE_Y);
break;
default:
@@ -3726,34 +3715,34 @@ extern void HideConversation(bool bHide) {
}
// Calculate y change
- deltay = InvD[INV_CONV].inventoryY - deltay;
+ deltay = g_InvD[INV_CONV].inventoryY - deltay;
// Move it all
- for (i = 0; objArray[i] && i < MAX_WCOMP; i++) {
- MultiMoveRelXY(objArray[i], x - center, deltay);
+ for (i = 0; g_objArray[i] && i < MAX_WCOMP; i++) {
+ MultiMoveRelXY(g_objArray[i], x - center, deltay);
}
- for (i = 0; iconArray[i] && i < MAX_ICONS; i++) {
- MultiMoveRelXY(iconArray[i], x - center, deltay);
+ for (i = 0; g_iconArray[i] && i < MAX_ICONS; i++) {
+ MultiMoveRelXY(g_iconArray[i], x - center, deltay);
}
- InvD[INV_CONV].inventoryX += x - center;
+ g_InvD[INV_CONV].inventoryX += x - center;
/*
* Now positioned as worked out
* - but it must be in a sensible place
*/
- if (MultiLeftmost(RectObject) < SysVar(SV_CONV_MINX))
- x = SysVar(SV_CONV_MINX) - MultiLeftmost(RectObject);
- else if (MultiRightmost(RectObject) > SCREEN_WIDTH - SysVar(SV_CONV_MINX))
- x = SCREEN_WIDTH - SysVar(SV_CONV_MINX) - MultiRightmost(RectObject);
+ if (MultiLeftmost(g_RectObject) < SysVar(SV_CONV_MINX))
+ x = SysVar(SV_CONV_MINX) - MultiLeftmost(g_RectObject);
+ else if (MultiRightmost(g_RectObject) > SCREEN_WIDTH - SysVar(SV_CONV_MINX))
+ x = SCREEN_WIDTH - SysVar(SV_CONV_MINX) - MultiRightmost(g_RectObject);
else
x = 0;
- if (thisConvFn == CONV_DEF && MultiHighest(RectObject) < SysVar(SV_CONV_MINY)
- && thisConvActor) {
+ if (g_thisConvFn == CONV_DEF && MultiHighest(g_RectObject) < SysVar(SV_CONV_MINY)
+ && g_thisConvActor) {
int Loffset, Toffset;
PlayfieldGetPos(FIELD_WORLD, &Loffset, &Toffset);
- y = GetActorBottom(thisConvActor) - MultiHighest(RectObject) +
+ y = GetActorBottom(g_thisConvActor) - MultiHighest(g_RectObject) +
SysVar(SV_CONV_BELOW_Y);
y -= Toffset;
}
@@ -3761,28 +3750,28 @@ extern void HideConversation(bool bHide) {
y = 0;
if (x || y) {
- for (i = 0; objArray[i] && i < MAX_WCOMP; i++) {
- MultiMoveRelXY(objArray[i], x, y);
+ for (i = 0; g_objArray[i] && i < MAX_WCOMP; i++) {
+ MultiMoveRelXY(g_objArray[i], x, y);
}
- for (i = 0; iconArray[i] && i < MAX_ICONS; i++) {
- MultiMoveRelXY(iconArray[i], x, y);
+ for (i = 0; g_iconArray[i] && i < MAX_ICONS; i++) {
+ MultiMoveRelXY(g_iconArray[i], x, y);
}
- InvD[INV_CONV].inventoryX += x;
- InvD[INV_CONV].inventoryY += y;
+ g_InvD[INV_CONV].inventoryX += x;
+ g_InvD[INV_CONV].inventoryY += y;
}
/*
* Oh shit! We might have gone off the bottom
*/
- if (MultiLowest(RectObject) > SCREEN_BOX_HEIGHT2 - SysVar(SV_CONV_MINY)) {
- y = (SCREEN_BOX_HEIGHT2 - SysVar(SV_CONV_MINY)) - MultiLowest(RectObject);
- for (i = 0; objArray[i] && i < MAX_WCOMP; i++) {
- MultiMoveRelXY(objArray[i], 0, y);
+ if (MultiLowest(g_RectObject) > SCREEN_BOX_HEIGHT2 - SysVar(SV_CONV_MINY)) {
+ y = (SCREEN_BOX_HEIGHT2 - SysVar(SV_CONV_MINY)) - MultiLowest(g_RectObject);
+ for (i = 0; g_objArray[i] && i < MAX_WCOMP; i++) {
+ MultiMoveRelXY(g_objArray[i], 0, y);
}
- for (i = 0; iconArray[i] && i < MAX_ICONS; i++) {
- MultiMoveRelXY(iconArray[i], 0, y);
+ for (i = 0; g_iconArray[i] && i < MAX_ICONS; i++) {
+ MultiMoveRelXY(g_iconArray[i], 0, y);
}
- InvD[INV_CONV].inventoryY += y;
+ g_InvD[INV_CONV].inventoryY += y;
}
}
@@ -3793,7 +3782,7 @@ extern void HideConversation(bool bHide) {
}
extern bool ConvIsHidden() {
- return InventoryHidden;
+ return g_InventoryHidden;
}
@@ -3808,8 +3797,8 @@ extern void PopUpInventory(int invno) {
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) {
- bReOpenMenu = false; // Better safe than sorry...
+ if (g_InventoryState == IDLE_INV) {
+ g_bReOpenMenu = false; // Better safe than sorry...
DisableTags(); // Tags disabled during inventory
if (TinselV2)
@@ -3821,25 +3810,25 @@ extern void PopUpInventory(int invno) {
_vm->_pcmMusic->dim(false);
// Start conversation with permanent contents
- memset(InvD[INV_CONV].contents, 0, MAX_ININV*sizeof(int));
- memcpy(InvD[INV_CONV].contents, permIcons, numPermIcons*sizeof(int));
- InvD[INV_CONV].NoofItems = numPermIcons;
+ memset(g_InvD[INV_CONV].contents, 0, MAX_ININV*sizeof(int));
+ memcpy(g_InvD[INV_CONV].contents, g_permIcons, g_numPermIcons*sizeof(int));
+ g_InvD[INV_CONV].NoofItems = g_numPermIcons;
if (TinselV2)
- InvD[INV_CONV].NoofHicons = numPermIcons;
+ g_InvD[INV_CONV].NoofHicons = g_numPermIcons;
else
- thisIcon = 0;
+ g_thisIcon = 0;
} else if (invno == INV_CONF) { // Configuration window?
cd.selBox = NOBOX;
cd.pointBox = NOBOX;
}
- ino = invno; // The open inventory
+ g_ino = invno; // The open inventory
- ItemsChanged = false; // Nothing changed
- InvDragging = ID_NONE; // Not dragging
- InventoryState = ACTIVE_INV; // Inventory actiive
- InventoryHidden = false; // Not hidden
- InventoryMaximised = InvD[ino].bMax;
+ g_ItemsChanged = false; // Nothing changed
+ g_InvDragging = ID_NONE; // Not dragging
+ g_InventoryState = ACTIVE_INV; // Inventory actiive
+ g_InventoryHidden = false; // Not hidden
+ g_InventoryMaximised = g_InvD[g_ino].bMax;
if (invno != INV_CONF) // Configuration window?
ConstructInventory(FULL); // Draw it up
else {
@@ -3849,10 +3838,10 @@ extern void PopUpInventory(int invno) {
}
static void SetMenuGlobals(CONFINIT *ci) {
- InvD[INV_CONF].MinHicons = InvD[INV_CONF].MaxHicons = InvD[INV_CONF].NoofHicons = ci->h;
- InvD[INV_CONF].MaxVicons = InvD[INV_CONF].MinVicons = InvD[INV_CONF].NoofVicons = ci->v;
- InvD[INV_CONF].inventoryX = ci->x;
- InvD[INV_CONF].inventoryY = ci->y;
+ g_InvD[INV_CONF].MinHicons = g_InvD[INV_CONF].MaxHicons = g_InvD[INV_CONF].NoofHicons = ci->h;
+ g_InvD[INV_CONF].MaxVicons = g_InvD[INV_CONF].MinVicons = g_InvD[INV_CONF].NoofVicons = ci->v;
+ g_InvD[INV_CONF].inventoryX = ci->x;
+ g_InvD[INV_CONF].inventoryY = ci->y;
cd.bExtraWin = ci->bExtraWin;
cd.box = ci->Box;
cd.NumBoxes = ci->NumBoxes;
@@ -3860,9 +3849,9 @@ static void SetMenuGlobals(CONFINIT *ci) {
if (TinselV2) {
if ((ci->ixHeading != NO_HEADING) && SysString(ci->ixHeading))
- InvD[INV_MENU].hInvTitle = SysString(ci->ixHeading);
+ g_InvD[INV_MENU].hInvTitle = SysString(ci->ixHeading);
else
- InvD[INV_MENU].hInvTitle = NO_HEADING;
+ g_InvD[INV_MENU].hInvTitle = NO_HEADING;
}
}
@@ -3876,11 +3865,11 @@ extern void OpenMenu(CONFTYPE menuType) {
if (TinselV0)
return;
- if (InventoryState != IDLE_INV)
+ if (g_InventoryState != IDLE_INV)
return;
- InvD[INV_CONF].resizable = false;
- InvD[INV_CONF].bMoveable = false;
+ g_InvD[INV_CONF].resizable = false;
+ g_InvD[INV_CONF].bMoveable = false;
switch (menuType) {
case MAIN_MENU:
@@ -3915,7 +3904,7 @@ extern void OpenMenu(CONFTYPE menuType) {
case SOUND_MENU:
if (TinselV2)
- displayedLanguage = TextLanguage();
+ g_displayedLanguage = TextLanguage();
#if 1
// FIXME: Hack to setup CONFBOX pointer to data in the global Config object
if (TinselV2) {
@@ -4003,16 +3992,16 @@ extern void OpenMenu(CONFTYPE menuType) {
case TOP_WINDOW:
SetMenuGlobals(&ciTopWin);
- ino = INV_CONF;
+ g_ino = INV_CONF;
ConstructInventory(CONF); // Draw it up
- InventoryState = BOGUS_INV;
+ g_InventoryState = BOGUS_INV;
return;
default:
return;
}
- if (HeldItem != INV_NOICON)
+ if (g_heldItem != INV_NOICON)
DelAuxCursor(); // no longer aux cursor
PopUpInventory(INV_CONF);
@@ -4045,38 +4034,38 @@ extern void OpenMenu(CONFTYPE menuType) {
* Close down an inventory window.
*/
extern void KillInventory() {
- if (objArray[0] != NULL) {
+ if (g_objArray[0] != NULL) {
DumpObjArray();
DumpDobjArray();
DumpIconArray();
}
- if (InventoryState == ACTIVE_INV) {
+ if (g_InventoryState == ACTIVE_INV) {
EnableTags();
if (TinselV2)
EnablePointing();
- InvD[ino].bMax = InventoryMaximised;
+ g_InvD[g_ino].bMax = g_InventoryMaximised;
UnHideCursorTrails();
_vm->divertKeyInput(NULL);
}
- InventoryState = IDLE_INV;
+ g_InventoryState = IDLE_INV;
- if (bReOpenMenu) {
- bReOpenMenu = false;
+ if (g_bReOpenMenu) {
+ g_bReOpenMenu = false;
OpenMenu(MAIN_MENU);
// Write config changes
_vm->_config->writeToDisk();
- } else if (ino == INV_CONF)
+ } else if (g_ino == INV_CONF)
InventoryIconCursor(false);
if (TinselV2)
// Pump up the volume
- if (ino == INV_CONV)
+ if (g_ino == INV_CONV)
_vm->_pcmMusic->unDim(false);
g_system->setFeatureState(OSystem::kFeatureVirtualKeyboard, false); // Hide VK after save dialog closes
@@ -4084,15 +4073,15 @@ extern void KillInventory() {
extern void CloseInventory() {
// If not active, ignore this
- if (InventoryState != ACTIVE_INV)
+ if (g_InventoryState != ACTIVE_INV)
return;
// If hidden, a conversation action is still underway - ignore this
- if (InventoryHidden)
+ if (g_InventoryHidden)
return;
// If conversation, this is a closeing event
- if (ino == INV_CONV)
+ if (g_ino == INV_CONV)
ConvAction(INV_CLOSEICON);
KillInventory();
@@ -4117,13 +4106,13 @@ extern void InventoryProcess(CORO_PARAM, const void *) {
CORO_BEGIN_CODE(_ctx);
if (NumberOfLanguages() <= 1)
- bNoLanguage = true;
+ g_bNoLanguage = true;
while (1) {
CORO_SLEEP(1); // allow scheduling
- if (objArray[0] != NULL) {
- if (ItemsChanged && ino != INV_CONF && !InventoryHidden) {
+ if (g_objArray[0] != NULL) {
+ if (g_ItemsChanged && g_ino != INV_CONF && !g_InventoryHidden) {
FillInInventory();
// Needed when clicking on scroll bar.
@@ -4131,15 +4120,15 @@ extern void InventoryProcess(CORO_PARAM, const void *) {
GetCursorXY(&curX, &curY, false);
InvCursor(IC_AREA, curX, curY);
- ItemsChanged = false;
+ g_ItemsChanged = false;
}
- if (ino != INV_CONF) {
+ if (g_ino != INV_CONF) {
for (int i = 0; i < MAX_ICONS; i++) {
- if (iconArray[i] != NULL)
- StepAnimScript(&iconAnims[i]);
+ if (g_iconArray[i] != NULL)
+ StepAnimScript(&g_iconAnims[i]);
}
}
- if (InvDragging == ID_MDCONT) {
+ if (g_InvDragging == ID_MDCONT) {
// Mixing desk control
int sval, index, *pival;
@@ -4263,12 +4252,12 @@ static int NearestSlideY(int fity) {
int i = 0;
do {
- thisDist = ABS(slideStuff[i].y - fity);
+ thisDist = ABS(g_slideStuff[i].y - fity);
if (thisDist < nearDist) {
nearDist = thisDist;
nearI = i;
}
- } while (slideStuff[++i].n != -1);
+ } while (g_slideStuff[++i].n != -1);
return nearI;
}
@@ -4281,44 +4270,44 @@ static void SlideSlider(int y, SSFN fn) {
int gotoY, ati;
// Only do this if there's a slider
- if (!SlideObject)
+ if (!g_SlideObject)
return;
switch (fn) {
case S_START: // Start of a drag on the slider
- newY = sliderYpos;
- lasti = NearestSlideY(sliderYpos);
+ newY = g_sliderYpos;
+ lasti = NearestSlideY(g_sliderYpos);
break;
case S_SLIDE: // Y-movement during drag
newY = newY + y; // New y-position
- if (newY < sliderYmin)
- gotoY = sliderYmin; // Above top limit
- else if (newY > sliderYmax)
- gotoY = sliderYmax; // Below bottom limit
+ if (newY < g_sliderYmin)
+ gotoY = g_sliderYmin; // Above top limit
+ else if (newY > g_sliderYmax)
+ gotoY = g_sliderYmax; // Below bottom limit
else
gotoY = newY; // Hunky-Dory
// Move slider to new position
- MultiMoveRelXY(SlideObject, 0, gotoY - sliderYpos);
- sliderYpos = gotoY;
+ MultiMoveRelXY(g_SlideObject, 0, gotoY - g_sliderYpos);
+ g_sliderYpos = gotoY;
// Re-draw icons if necessary
- ati = NearestSlideY(sliderYpos);
+ ati = NearestSlideY(g_sliderYpos);
if (ati != lasti) {
- InvD[ino].FirstDisp = slideStuff[ati].n;
- assert(InvD[ino].FirstDisp >= 0); // negative first displayed
- ItemsChanged = true;
+ g_InvD[g_ino].FirstDisp = g_slideStuff[ati].n;
+ assert(g_InvD[g_ino].FirstDisp >= 0); // negative first displayed
+ g_ItemsChanged = true;
lasti = ati;
}
break;
case S_END: // End of a drag on the slider
// Draw icons from new start icon
- ati = NearestSlideY(sliderYpos);
- InvD[ino].FirstDisp = slideStuff[ati].n;
- ItemsChanged = true;
+ ati = NearestSlideY(g_sliderYpos);
+ g_InvD[g_ino].FirstDisp = g_slideStuff[ati].n;
+ g_ItemsChanged = true;
break;
default:
@@ -4336,38 +4325,38 @@ static void SlideCSlider(int y, SSFN fn) {
int fc;
// Only do this if there's a slider
- if (!SlideObject)
+ if (!g_SlideObject)
return;
switch (fn) {
case S_START: // Start of a drag on the slider
- newY = sliderYpos;
+ newY = g_sliderYpos;
break;
case S_SLIDE: // Y-movement during drag
newY = newY + y; // New y-position
- if (newY < sliderYmin)
- gotoY = sliderYmin; // Above top limit
- else if (newY > sliderYmax)
- gotoY = sliderYmax; // Below bottom limit
+ if (newY < g_sliderYmin)
+ gotoY = g_sliderYmin; // Above top limit
+ else if (newY > g_sliderYmax)
+ gotoY = g_sliderYmax; // Below bottom limit
else
gotoY = newY; // Hunky-Dory
// Move slider to new position
if (TinselV2)
- MultiMoveRelXY(SlideObject, 0, gotoY - sliderYpos);
- sliderYpos = gotoY;
+ MultiMoveRelXY(g_SlideObject, 0, gotoY - g_sliderYpos);
+ g_sliderYpos = gotoY;
fc = cd.extraBase;
if ((cd.box == saveBox || cd.box == loadBox))
- FirstFile((sliderYpos - sliderYmin) * (MAX_SAVED_FILES - NUM_RGROUP_BOXES) /
- (sliderYmax - sliderYmin));
+ FirstFile((g_sliderYpos - g_sliderYmin) * (MAX_SAVED_FILES - NUM_RGROUP_BOXES) /
+ (g_sliderYmax - g_sliderYmin));
else if (cd.box == hopperBox1)
- FirstScene((sliderYpos - sliderYmin) * (numScenes - NUM_RGROUP_BOXES) / sliderRange);
+ FirstScene((g_sliderYpos - g_sliderYmin) * (g_numScenes - NUM_RGROUP_BOXES) / sliderRange);
else if (cd.box == hopperBox2)
- FirstEntry((sliderYpos - sliderYmin) * (numEntries - NUM_RGROUP_BOXES) / sliderRange);
+ FirstEntry((g_sliderYpos - g_sliderYmin) * (g_numEntries - NUM_RGROUP_BOXES) / sliderRange);
// If extraBase has changed...
if (fc != cd.extraBase) {
@@ -4409,16 +4398,16 @@ static void SlideMSlider(int x, SSFN fn) {
// Work out the indices
index = cd.selBox & ~IS_MASK;
- for (i = 0; i < numMdSlides; i++)
- if (mdSlides[i].num == index)
+ for (i = 0; i < g_numMdSlides; i++)
+ if (g_mdSlides[i].num == index)
break;
- assert(i < numMdSlides);
+ assert(i < g_numMdSlides);
switch (fn) {
case S_START: // Start of a drag on the slider
// can use index as a throw-away value
- GetAniPosition(mdSlides[i].obj, &newX, &index);
- lX = sX = newX;
+ GetAniPosition(g_mdSlides[i].obj, &newX, &index);
+ g_lX = g_sX = newX;
break;
case S_SLIDE: // X-movement during drag
@@ -4427,19 +4416,19 @@ static void SlideMSlider(int x, SSFN fn) {
newX = newX + x; // New x-position
- if (newX < mdSlides[i].min)
- gotoX = mdSlides[i].min; // Below bottom limit
- else if (newX > mdSlides[i].max)
- gotoX = mdSlides[i].max; // Above top limit
+ if (newX < g_mdSlides[i].min)
+ gotoX = g_mdSlides[i].min; // Below bottom limit
+ else if (newX > g_mdSlides[i].max)
+ gotoX = g_mdSlides[i].max; // Above top limit
else
gotoX = newX; // Hunky-Dory
// Move slider to new position
- MultiMoveRelXY(mdSlides[i].obj, gotoX - sX, 0);
- sX = gotoX;
+ MultiMoveRelXY(g_mdSlides[i].obj, gotoX - g_sX, 0);
+ g_sX = gotoX;
- if (lX != sX) {
- *cd.box[index].ival = (sX - mdSlides[i].min)*cd.box[index].w/SLIDE_RANGE;
+ if (g_lX != g_sX) {
+ *cd.box[index].ival = (g_sX - g_mdSlides[i].min)*cd.box[index].w/SLIDE_RANGE;
if (cd.box[index].boxFunc == MUSICVOL)
SetMidiVolume(*cd.box[index].ival);
#ifdef MAC_OPTIONS
@@ -4449,14 +4438,14 @@ static void SlideMSlider(int x, SSFN fn) {
if (cd.box[index].boxFunc == SAMPVOL)
SetSampleVolume(*cd.box[index].ival);
#endif
- lX = sX;
+ g_lX = g_sX;
}
break;
case S_TIMEUP:
case S_TIMEDN:
gotoX = SLIDE_RANGE*(*cd.box[index].ival)/cd.box[index].w;
- MultiSetAniX(mdSlides[i].obj, mdSlides[i].min+gotoX);
+ MultiSetAniX(g_mdSlides[i].obj, g_mdSlides[i].min+gotoX);
if (cd.box[index].boxFunc == MUSICVOL)
SetMidiVolume(*cd.box[index].ival);
@@ -4471,7 +4460,7 @@ static void SlideMSlider(int x, SSFN fn) {
case S_END: // End of a drag on the slider
AddBoxes(false); // Might change position slightly
- if (ino == INV_CONF && cd.box == subtitlesBox)
+ if (g_ino == INV_CONF && cd.box == subtitlesBox)
Select(_vm->_config->_language, false);
break;
}
@@ -4481,23 +4470,23 @@ static void SlideMSlider(int x, SSFN fn) {
* Called from ChangeingSize() during re-sizing.
*/
static void GettingTaller() {
- if (SuppV) {
- Ychange += SuppV;
- if (Ycompensate == 'T')
- InvD[ino].inventoryY += SuppV;
- SuppV = 0;
+ if (g_SuppV) {
+ g_Ychange += g_SuppV;
+ if (g_Ycompensate == 'T')
+ g_InvD[g_ino].inventoryY += g_SuppV;
+ g_SuppV = 0;
}
- while (Ychange > (ITEM_HEIGHT+1) && InvD[ino].NoofVicons < InvD[ino].MaxVicons) {
- Ychange -= (ITEM_HEIGHT+1);
- InvD[ino].NoofVicons++;
- if (Ycompensate == 'T')
- InvD[ino].inventoryY -= (ITEM_HEIGHT+1);
+ while (g_Ychange > (ITEM_HEIGHT+1) && g_InvD[g_ino].NoofVicons < g_InvD[g_ino].MaxVicons) {
+ g_Ychange -= (ITEM_HEIGHT+1);
+ g_InvD[g_ino].NoofVicons++;
+ if (g_Ycompensate == 'T')
+ g_InvD[g_ino].inventoryY -= (ITEM_HEIGHT+1);
}
- if (InvD[ino].NoofVicons < InvD[ino].MaxVicons) {
- SuppV = Ychange;
- Ychange = 0;
- if (Ycompensate == 'T')
- InvD[ino].inventoryY -= SuppV;
+ if (g_InvD[g_ino].NoofVicons < g_InvD[g_ino].MaxVicons) {
+ g_SuppV = g_Ychange;
+ g_Ychange = 0;
+ if (g_Ycompensate == 'T')
+ g_InvD[g_ino].inventoryY -= g_SuppV;
}
}
@@ -4505,73 +4494,73 @@ static void GettingTaller() {
* Called from ChangeingSize() during re-sizing.
*/
static void GettingShorter() {
- int StartNvi = InvD[ino].NoofVicons;
- int StartUv = SuppV;
+ int StartNvi = g_InvD[g_ino].NoofVicons;
+ int StartUv = g_SuppV;
- if (SuppV) {
- Ychange += (SuppV - (ITEM_HEIGHT+1));
- InvD[ino].NoofVicons++;
- SuppV = 0;
+ if (g_SuppV) {
+ g_Ychange += (g_SuppV - (ITEM_HEIGHT+1));
+ g_InvD[g_ino].NoofVicons++;
+ g_SuppV = 0;
}
- while (Ychange < -(ITEM_HEIGHT+1) && InvD[ino].NoofVicons > InvD[ino].MinVicons) {
- Ychange += (ITEM_HEIGHT+1);
- InvD[ino].NoofVicons--;
+ while (g_Ychange < -(ITEM_HEIGHT+1) && g_InvD[g_ino].NoofVicons > g_InvD[g_ino].MinVicons) {
+ g_Ychange += (ITEM_HEIGHT+1);
+ g_InvD[g_ino].NoofVicons--;
}
- if (InvD[ino].NoofVicons > InvD[ino].MinVicons && Ychange) {
- SuppV = (ITEM_HEIGHT+1) + Ychange;
- InvD[ino].NoofVicons--;
- Ychange = 0;
+ if (g_InvD[g_ino].NoofVicons > g_InvD[g_ino].MinVicons && g_Ychange) {
+ g_SuppV = (ITEM_HEIGHT+1) + g_Ychange;
+ g_InvD[g_ino].NoofVicons--;
+ g_Ychange = 0;
}
- if (Ycompensate == 'T')
- InvD[ino].inventoryY += (ITEM_HEIGHT+1)*(StartNvi - InvD[ino].NoofVicons) - (SuppV - StartUv);
+ if (g_Ycompensate == 'T')
+ g_InvD[g_ino].inventoryY += (ITEM_HEIGHT+1)*(StartNvi - g_InvD[g_ino].NoofVicons) - (g_SuppV - StartUv);
}
/**
* Called from ChangeingSize() during re-sizing.
*/
static void GettingWider() {
- int StartNhi = InvD[ino].NoofHicons;
- int StartUh = SuppH;
+ int StartNhi = g_InvD[g_ino].NoofHicons;
+ int StartUh = g_SuppH;
- if (SuppH) {
- Xchange += SuppH;
- SuppH = 0;
+ if (g_SuppH) {
+ g_Xchange += g_SuppH;
+ g_SuppH = 0;
}
- while (Xchange > (ITEM_WIDTH+1) && InvD[ino].NoofHicons < InvD[ino].MaxHicons) {
- Xchange -= (ITEM_WIDTH+1);
- InvD[ino].NoofHicons++;
+ while (g_Xchange > (ITEM_WIDTH+1) && g_InvD[g_ino].NoofHicons < g_InvD[g_ino].MaxHicons) {
+ g_Xchange -= (ITEM_WIDTH+1);
+ g_InvD[g_ino].NoofHicons++;
}
- if (InvD[ino].NoofHicons < InvD[ino].MaxHicons) {
- SuppH = Xchange;
- Xchange = 0;
+ if (g_InvD[g_ino].NoofHicons < g_InvD[g_ino].MaxHicons) {
+ g_SuppH = g_Xchange;
+ g_Xchange = 0;
}
- if (Xcompensate == 'L')
- InvD[ino].inventoryX += (ITEM_WIDTH+1)*(StartNhi - InvD[ino].NoofHicons) - (SuppH - StartUh);
+ if (g_Xcompensate == 'L')
+ g_InvD[g_ino].inventoryX += (ITEM_WIDTH+1)*(StartNhi - g_InvD[g_ino].NoofHicons) - (g_SuppH - StartUh);
}
/**
* Called from ChangeingSize() during re-sizing.
*/
static void GettingNarrower() {
- int StartNhi = InvD[ino].NoofHicons;
- int StartUh = SuppH;
+ int StartNhi = g_InvD[g_ino].NoofHicons;
+ int StartUh = g_SuppH;
- if (SuppH) {
- Xchange += (SuppH - (ITEM_WIDTH+1));
- InvD[ino].NoofHicons++;
- SuppH = 0;
+ if (g_SuppH) {
+ g_Xchange += (g_SuppH - (ITEM_WIDTH+1));
+ g_InvD[g_ino].NoofHicons++;
+ g_SuppH = 0;
}
- while (Xchange < -(ITEM_WIDTH+1) && InvD[ino].NoofHicons > InvD[ino].MinHicons) {
- Xchange += (ITEM_WIDTH+1);
- InvD[ino].NoofHicons--;
+ while (g_Xchange < -(ITEM_WIDTH+1) && g_InvD[g_ino].NoofHicons > g_InvD[g_ino].MinHicons) {
+ g_Xchange += (ITEM_WIDTH+1);
+ g_InvD[g_ino].NoofHicons--;
}
- if (InvD[ino].NoofHicons > InvD[ino].MinHicons && Xchange) {
- SuppH = (ITEM_WIDTH+1) + Xchange;
- InvD[ino].NoofHicons--;
- Xchange = 0;
+ if (g_InvD[g_ino].NoofHicons > g_InvD[g_ino].MinHicons && g_Xchange) {
+ g_SuppH = (ITEM_WIDTH+1) + g_Xchange;
+ g_InvD[g_ino].NoofHicons--;
+ g_Xchange = 0;
}
- if (Xcompensate == 'L')
- InvD[ino].inventoryX += (ITEM_WIDTH+1)*(StartNhi - InvD[ino].NoofHicons) - (SuppH - StartUh);
+ if (g_Xcompensate == 'L')
+ g_InvD[g_ino].inventoryX += (ITEM_WIDTH+1)*(StartNhi - g_InvD[g_ino].NoofHicons) - (g_SuppH - StartUh);
}
@@ -4580,15 +4569,15 @@ static void GettingNarrower() {
*/
static void ChangeingSize() {
/* Make it taller or shorter if necessary. */
- if (Ychange > 0)
+ if (g_Ychange > 0)
GettingTaller();
- else if (Ychange < 0)
+ else if (g_Ychange < 0)
GettingShorter();
/* Make it wider or narrower if necessary. */
- if (Xchange > 0)
+ if (g_Xchange > 0)
GettingWider();
- else if (Xchange < 0)
+ else if (g_Xchange < 0)
GettingNarrower();
ConstructInventory(EMPTY);
@@ -4601,29 +4590,29 @@ extern void Xmovement(int x) {
int aniX, aniY;
int i;
- if (x && objArray[0] != NULL) {
- switch (InvDragging) {
+ if (x && g_objArray[0] != NULL) {
+ switch (g_InvDragging) {
case ID_MOVE:
- GetAniPosition(objArray[0], &InvD[ino].inventoryX, &aniY);
- InvD[ino].inventoryX +=x;
- MultiSetAniX(objArray[0], InvD[ino].inventoryX);
- for (i = 1; objArray[i] && i < MAX_WCOMP; i++)
- MultiMoveRelXY(objArray[i], x, 0);
- for (i = 0; iconArray[i] && i < MAX_ICONS; i++)
- MultiMoveRelXY(iconArray[i], x, 0);
+ GetAniPosition(g_objArray[0], &g_InvD[g_ino].inventoryX, &aniY);
+ g_InvD[g_ino].inventoryX +=x;
+ MultiSetAniX(g_objArray[0], g_InvD[g_ino].inventoryX);
+ for (i = 1; g_objArray[i] && i < MAX_WCOMP; i++)
+ MultiMoveRelXY(g_objArray[i], x, 0);
+ for (i = 0; g_iconArray[i] && i < MAX_ICONS; i++)
+ MultiMoveRelXY(g_iconArray[i], x, 0);
break;
case ID_LEFT:
case ID_TLEFT:
case ID_BLEFT:
- Xchange -= x;
+ g_Xchange -= x;
ChangeingSize();
break;
case ID_RIGHT:
case ID_TRIGHT:
case ID_BRIGHT:
- Xchange += x;
+ g_Xchange += x;
ChangeingSize();
break;
@@ -4649,16 +4638,16 @@ extern void Ymovement(int y) {
int aniX, aniY;
int i;
- if (y && objArray[0] != NULL) {
- switch (InvDragging) {
+ if (y && g_objArray[0] != NULL) {
+ switch (g_InvDragging) {
case ID_MOVE:
- GetAniPosition(objArray[0], &aniX, &InvD[ino].inventoryY);
- InvD[ino].inventoryY +=y;
- MultiSetAniY(objArray[0], InvD[ino].inventoryY);
- for (i = 1; objArray[i] && i < MAX_WCOMP; i++)
- MultiMoveRelXY(objArray[i], 0, y);
- for (i = 0; iconArray[i] && i < MAX_ICONS; i++)
- MultiMoveRelXY(iconArray[i], 0, y);
+ GetAniPosition(g_objArray[0], &aniX, &g_InvD[g_ino].inventoryY);
+ g_InvD[g_ino].inventoryY +=y;
+ MultiSetAniY(g_objArray[0], g_InvD[g_ino].inventoryY);
+ for (i = 1; g_objArray[i] && i < MAX_WCOMP; i++)
+ MultiMoveRelXY(g_objArray[i], 0, y);
+ for (i = 0; g_iconArray[i] && i < MAX_ICONS; i++)
+ MultiMoveRelXY(g_iconArray[i], 0, y);
break;
case ID_SLIDE:
@@ -4672,14 +4661,14 @@ extern void Ymovement(int y) {
case ID_BOTTOM:
case ID_BLEFT:
case ID_BRIGHT:
- Ychange += y;
+ g_Ychange += y;
ChangeingSize();
break;
case ID_TOP:
case ID_TLEFT:
case ID_TRIGHT:
- Ychange -= y;
+ g_Ychange -= y;
ChangeingSize();
break;
@@ -4705,16 +4694,16 @@ static void InvDragStart() {
/*
* Do something different for Save/Restore screens
*/
- if (ino == INV_CONF) {
+ if (g_ino == INV_CONF) {
int whichbox;
whichbox = WhichMenuBox(curX, curY, true);
if (whichbox == IB_SLIDE) {
- InvDragging = ID_CSLIDE;
+ g_InvDragging = ID_CSLIDE;
SlideCSlider(0, S_START);
} else if (whichbox > 0 && (whichbox & IS_MASK)) {
- InvDragging = ID_MDCONT; // Mixing desk control
+ g_InvDragging = ID_MDCONT; // Mixing desk control
cd.selBox = whichbox;
SlideMSlider(0, S_START);
}
@@ -4726,85 +4715,85 @@ static void InvDragStart() {
*/
switch (InvArea(curX, curY)) {
case I_HEADER:
- if (InvD[ino].bMoveable) {
- InvDragging = ID_MOVE;
+ if (g_InvD[g_ino].bMoveable) {
+ g_InvDragging = ID_MOVE;
}
break;
case I_SLIDE:
- InvDragging = ID_SLIDE;
+ g_InvDragging = ID_SLIDE;
SlideSlider(0, S_START);
break;
case I_BOTTOM:
- if (InvD[ino].resizable) {
- Ychange = 0;
- InvDragging = ID_BOTTOM;
- Ycompensate = 'B';
+ if (g_InvD[g_ino].resizable) {
+ g_Ychange = 0;
+ g_InvDragging = ID_BOTTOM;
+ g_Ycompensate = 'B';
}
break;
case I_TOP:
- if (InvD[ino].resizable) {
- Ychange = 0;
- InvDragging = ID_TOP;
- Ycompensate = 'T';
+ if (g_InvD[g_ino].resizable) {
+ g_Ychange = 0;
+ g_InvDragging = ID_TOP;
+ g_Ycompensate = 'T';
}
break;
case I_LEFT:
- if (InvD[ino].resizable) {
- Xchange = 0;
- InvDragging = ID_LEFT;
- Xcompensate = 'L';
+ if (g_InvD[g_ino].resizable) {
+ g_Xchange = 0;
+ g_InvDragging = ID_LEFT;
+ g_Xcompensate = 'L';
}
break;
case I_RIGHT:
- if (InvD[ino].resizable) {
- Xchange = 0;
- InvDragging = ID_RIGHT;
- Xcompensate = 'R';
+ if (g_InvD[g_ino].resizable) {
+ g_Xchange = 0;
+ g_InvDragging = ID_RIGHT;
+ g_Xcompensate = 'R';
}
break;
case I_TLEFT:
- if (InvD[ino].resizable) {
- Ychange = 0;
- Ycompensate = 'T';
- Xchange = 0;
- Xcompensate = 'L';
- InvDragging = ID_TLEFT;
+ if (g_InvD[g_ino].resizable) {
+ g_Ychange = 0;
+ g_Ycompensate = 'T';
+ g_Xchange = 0;
+ g_Xcompensate = 'L';
+ g_InvDragging = ID_TLEFT;
}
break;
case I_TRIGHT:
- if (InvD[ino].resizable) {
- Ychange = 0;
- Ycompensate = 'T';
- Xchange = 0;
- Xcompensate = 'R';
- InvDragging = ID_TRIGHT;
+ if (g_InvD[g_ino].resizable) {
+ g_Ychange = 0;
+ g_Ycompensate = 'T';
+ g_Xchange = 0;
+ g_Xcompensate = 'R';
+ g_InvDragging = ID_TRIGHT;
}
break;
case I_BLEFT:
- if (InvD[ino].resizable) {
- Ychange = 0;
- Ycompensate = 'B';
- Xchange = 0;
- Xcompensate = 'L';
- InvDragging = ID_BLEFT;
+ if (g_InvD[g_ino].resizable) {
+ g_Ychange = 0;
+ g_Ycompensate = 'B';
+ g_Xchange = 0;
+ g_Xcompensate = 'L';
+ g_InvDragging = ID_BLEFT;
}
break;
case I_BRIGHT:
- if (InvD[ino].resizable) {
- Ychange = 0;
- Ycompensate = 'B';
- Xchange = 0;
- Xcompensate = 'R';
- InvDragging = ID_BRIGHT;
+ if (g_InvD[g_ino].resizable) {
+ g_Ychange = 0;
+ g_Ycompensate = 'B';
+ g_Xchange = 0;
+ g_Xcompensate = 'R';
+ g_InvDragging = ID_BRIGHT;
}
break;
}
@@ -4818,14 +4807,14 @@ static void InvDragEnd() {
GetCursorXY(&curX, &curY, false);
- if (InvDragging != ID_NONE) {
- if (InvDragging == ID_SLIDE) {
+ if (g_InvDragging != ID_NONE) {
+ if (g_InvDragging == ID_SLIDE) {
SlideSlider(0, S_END);
- } else if (InvDragging == ID_CSLIDE) {
+ } else if (g_InvDragging == ID_CSLIDE) {
; // No action
- } else if (InvDragging == ID_MDCONT) {
+ } else if (g_InvDragging == ID_MDCONT) {
SlideMSlider(0, S_END);
- } else if (InvDragging == ID_MOVE) {
+ } else if (g_InvDragging == ID_MOVE) {
; // No action
} else {
// Were re-sizing. Redraw the whole thing.
@@ -4834,21 +4823,21 @@ static void InvDragEnd() {
ConstructInventory(FULL);
// If this was the maximised, it no longer is!
- if (InventoryMaximised) {
- InventoryMaximised = false;
- InvD[ino].otherX = InvD[ino].inventoryX;
- InvD[ino].otherY = InvD[ino].inventoryY;
+ if (g_InventoryMaximised) {
+ g_InventoryMaximised = false;
+ g_InvD[g_ino].otherX = g_InvD[g_ino].inventoryX;
+ g_InvD[g_ino].otherY = g_InvD[g_ino].inventoryY;
}
}
- InvDragging = ID_NONE;
+ g_InvDragging = ID_NONE;
ProcessedProvisional();
}
// Cursor could well now be inappropriate
InvCursor(IC_AREA, curX, curY);
- Xchange = Ychange = 0; // Probably no need, but does no harm!
+ g_Xchange = g_Ychange = 0; // Probably no need, but does no harm!
}
static void MenuPageDown() {
@@ -4860,7 +4849,7 @@ static void MenuPageDown() {
Select(cd.selBox, true);
}
} else if (cd.box == hopperBox1) {
- if (cd.extraBase < numScenes - NUM_RGROUP_BOXES) {
+ if (cd.extraBase < g_numScenes - NUM_RGROUP_BOXES) {
FirstScene(cd.extraBase + (NUM_RGROUP_BOXES - 1));
AddBoxes(true);
if (cd.selBox)
@@ -4868,7 +4857,7 @@ static void MenuPageDown() {
Select(cd.selBox, true);
}
} else if (cd.box == hopperBox2) {
- if (cd.extraBase < numEntries - NUM_RGROUP_BOXES) {
+ if (cd.extraBase < g_numEntries - NUM_RGROUP_BOXES) {
FirstEntry(cd.extraBase+(NUM_RGROUP_BOXES - 1));
AddBoxes(true);
if (cd.selBox)
@@ -5010,7 +4999,7 @@ static void ConfActionSpecial(int i) {
Select(cd.selBox, true);
}
} else if (cd.box == hopperBox1) {
- if (cd.extraBase < numScenes - NUM_RGROUP_BOXES) {
+ if (cd.extraBase < g_numScenes - NUM_RGROUP_BOXES) {
FirstScene(cd.extraBase + 1);
AddBoxes(true);
if (cd.selBox)
@@ -5018,7 +5007,7 @@ static void ConfActionSpecial(int i) {
Select(cd.selBox, true);
}
} else if (cd.box == hopperBox2) {
- if (cd.extraBase < numEntries - NUM_RGROUP_BOXES) {
+ if (cd.extraBase < g_numEntries - NUM_RGROUP_BOXES) {
FirstEntry(cd.extraBase + 1);
AddBoxes(true);
if (cd.selBox)
@@ -5045,25 +5034,25 @@ static void InvPutDown(int index) {
int hiIndex; // Current position of held item (if in)
// Find where the held item is positioned in this inventory (if it is)
- for (hiIndex = 0; hiIndex < InvD[ino].NoofItems; hiIndex++)
- if (InvD[ino].contents[hiIndex] == HeldItem)
+ for (hiIndex = 0; hiIndex < g_InvD[g_ino].NoofItems; hiIndex++)
+ if (g_InvD[g_ino].contents[hiIndex] == g_heldItem)
break;
// If drop position would leave a gap, move it up
- if (index >= InvD[ino].NoofItems) {
- if (hiIndex == InvD[ino].NoofItems) // Not in, add it
- index = InvD[ino].NoofItems;
+ if (index >= g_InvD[g_ino].NoofItems) {
+ if (hiIndex == g_InvD[g_ino].NoofItems) // Not in, add it
+ index = g_InvD[g_ino].NoofItems;
else
- index = InvD[ino].NoofItems - 1;
+ index = g_InvD[g_ino].NoofItems - 1;
}
- if (hiIndex == InvD[ino].NoofItems) { // Not in, add it
- if (InvD[ino].NoofItems < InvD[ino].MaxInvObj) {
- InvD[ino].NoofItems++;
+ if (hiIndex == g_InvD[g_ino].NoofItems) { // Not in, add it
+ if (g_InvD[g_ino].NoofItems < g_InvD[g_ino].MaxInvObj) {
+ g_InvD[g_ino].NoofItems++;
// Don't leave it in the other inventory!
- if (InventoryPos(HeldItem) != INV_HELDNOTIN)
- RemFromInventory(ino == INV_1 ? INV_2 : INV_1, HeldItem);
+ if (InventoryPos(g_heldItem) != INV_HELDNOTIN)
+ RemFromInventory(g_ino == INV_1 ? INV_2 : INV_1, g_heldItem);
} else {
// No room at the inn!
return;
@@ -5072,17 +5061,17 @@ static void InvPutDown(int index) {
// Position it in the inventory
if (index < hiIndex) {
- memmove(&InvD[ino].contents[index + 1], &InvD[ino].contents[index], (hiIndex-index)*sizeof(int));
- InvD[ino].contents[index] = HeldItem;
+ memmove(&g_InvD[g_ino].contents[index + 1], &g_InvD[g_ino].contents[index], (hiIndex-index)*sizeof(int));
+ g_InvD[g_ino].contents[index] = g_heldItem;
} else if (index > hiIndex) {
- memmove(&InvD[ino].contents[hiIndex], &InvD[ino].contents[hiIndex+1], (index-hiIndex)*sizeof(int));
- InvD[ino].contents[index] = HeldItem;
+ memmove(&g_InvD[g_ino].contents[hiIndex], &g_InvD[g_ino].contents[hiIndex+1], (index-hiIndex)*sizeof(int));
+ g_InvD[g_ino].contents[index] = g_heldItem;
} else {
- InvD[ino].contents[index] = HeldItem;
+ g_InvD[g_ino].contents[index] = g_heldItem;
}
- HeldItem = INV_NOICON;
- ItemsChanged = true;
+ g_heldItem = INV_NOICON;
+ g_ItemsChanged = true;
DelAuxCursor();
RestoreMainCursor();
GetCursorXY(&aniX, &aniY, false);
@@ -5116,26 +5105,26 @@ static void InvPickup(int index) {
return;
// If not holding anything
- if (HeldItem == INV_NOICON && InvD[ino].contents[index] &&
- (!TinselV2 || InvD[ino].contents[index] != HeldItem)) {
+ if (g_heldItem == INV_NOICON && g_InvD[g_ino].contents[index] &&
+ (!TinselV2 || g_InvD[g_ino].contents[index] != g_heldItem)) {
// Pick-up
- invObj = GetInvObject(InvD[ino].contents[index]);
- thisIcon = InvD[ino].contents[index];
+ invObj = GetInvObject(g_InvD[g_ino].contents[index]);
+ g_thisIcon = g_InvD[g_ino].contents[index];
if (TinselV2)
InvTinselEvent(invObj, PICKUP, INV_PICKUP, index);
else if (invObj->hScript)
InvTinselEvent(invObj, WALKTO, INV_PICKUP, index);
- } else if (HeldItem != INV_NOICON) {
+ } else if (g_heldItem != INV_NOICON) {
// Put-down
- invObj = GetInvObject(HeldItem);
+ invObj = GetInvObject(g_heldItem);
// If DROPCODE set, send event, otherwise it's a putdown
if (invObj->attribute & IO_DROPCODE && invObj->hScript)
InvTinselEvent(invObj, PUTDOWN, INV_PICKUP, index);
- else if (!(invObj->attribute & IO_ONLYINV1 && ino != INV_1)
- && !(invObj->attribute & IO_ONLYINV2 && ino != INV_2)) {
+ else if (!(invObj->attribute & IO_ONLYINV1 && g_ino != INV_1)
+ && !(invObj->attribute & IO_ONLYINV2 && g_ino != INV_2)) {
if (TinselV2)
InvPutDown(index);
else
@@ -5152,7 +5141,7 @@ static void InvWalkTo(const Common::Point &coOrds) {
switch (InvArea(coOrds.x, coOrds.y)) {
case I_NOTIN:
- if (ino == INV_CONV)
+ if (g_ino == INV_CONV)
ConvAction(INV_CLOSEICON);
if ((cd.box == hopperBox1) || (cd.box == hopperBox2))
FreeSceneHopper();
@@ -5160,43 +5149,43 @@ static void InvWalkTo(const Common::Point &coOrds) {
break;
case I_SLIDE_UP:
- if (InvD[ino].NoofVicons == 1)
- InvD[ino].FirstDisp -= InvD[ino].NoofHicons;
- for (i = 1; i < InvD[ino].NoofVicons; i++)
- InvD[ino].FirstDisp -= InvD[ino].NoofHicons;
- if (InvD[ino].FirstDisp < 0)
- InvD[ino].FirstDisp = 0;
- ItemsChanged = true;
+ if (g_InvD[g_ino].NoofVicons == 1)
+ g_InvD[g_ino].FirstDisp -= g_InvD[g_ino].NoofHicons;
+ for (i = 1; i < g_InvD[g_ino].NoofVicons; i++)
+ g_InvD[g_ino].FirstDisp -= g_InvD[g_ino].NoofHicons;
+ if (g_InvD[g_ino].FirstDisp < 0)
+ g_InvD[g_ino].FirstDisp = 0;
+ g_ItemsChanged = true;
break;
case I_UP:
- InvD[ino].FirstDisp -= InvD[ino].NoofHicons;
- if (InvD[ino].FirstDisp < 0)
- InvD[ino].FirstDisp = 0;
- ItemsChanged = true;
+ g_InvD[g_ino].FirstDisp -= g_InvD[g_ino].NoofHicons;
+ if (g_InvD[g_ino].FirstDisp < 0)
+ g_InvD[g_ino].FirstDisp = 0;
+ g_ItemsChanged = true;
break;
case I_SLIDE_DOWN:
- if (InvD[ino].NoofVicons == 1)
- if (InvD[ino].FirstDisp + InvD[ino].NoofHicons*InvD[ino].NoofVicons < InvD[ino].NoofItems)
- InvD[ino].FirstDisp += InvD[ino].NoofHicons;
- for (i = 1; i < InvD[ino].NoofVicons; i++) {
- if (InvD[ino].FirstDisp + InvD[ino].NoofHicons*InvD[ino].NoofVicons < InvD[ino].NoofItems)
- InvD[ino].FirstDisp += InvD[ino].NoofHicons;
+ if (g_InvD[g_ino].NoofVicons == 1)
+ if (g_InvD[g_ino].FirstDisp + g_InvD[g_ino].NoofHicons*g_InvD[g_ino].NoofVicons < g_InvD[g_ino].NoofItems)
+ g_InvD[g_ino].FirstDisp += g_InvD[g_ino].NoofHicons;
+ for (i = 1; i < g_InvD[g_ino].NoofVicons; i++) {
+ if (g_InvD[g_ino].FirstDisp + g_InvD[g_ino].NoofHicons*g_InvD[g_ino].NoofVicons < g_InvD[g_ino].NoofItems)
+ g_InvD[g_ino].FirstDisp += g_InvD[g_ino].NoofHicons;
}
- ItemsChanged = true;
+ g_ItemsChanged = true;
break;
case I_DOWN:
- if (InvD[ino].FirstDisp + InvD[ino].NoofHicons*InvD[ino].NoofVicons < InvD[ino].NoofItems) {
- InvD[ino].FirstDisp += InvD[ino].NoofHicons;
- ItemsChanged = true;
+ if (g_InvD[g_ino].FirstDisp + g_InvD[g_ino].NoofHicons*g_InvD[g_ino].NoofVicons < g_InvD[g_ino].NoofItems) {
+ g_InvD[g_ino].FirstDisp += g_InvD[g_ino].NoofHicons;
+ g_ItemsChanged = true;
}
break;
case I_BODY:
- if (ino == INV_CONF) {
- if (!InventoryHidden)
+ if (g_ino == INV_CONF) {
+ if (!g_InventoryHidden)
MenuAction(WhichMenuBox(coOrds.x, coOrds.y, false), false);
} else {
Common::Point pt = coOrds;
@@ -5204,8 +5193,8 @@ 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 &&
- (ino == INV_1 || ino == INV_2)) {
+ if (i == INV_NOICON && g_heldItem != INV_NOICON &&
+ (g_ino == INV_1 || g_ino == INV_2)) {
pt.x += 1; // 1 to the right
i = InvItem(pt, false);
if (i == INV_NOICON) {
@@ -5219,7 +5208,7 @@ static void InvWalkTo(const Common::Point &coOrds) {
}
}
- if (ino == INV_CONV) {
+ if (g_ino == INV_CONV) {
ConvAction(i);
} else
InvPickup(i);
@@ -5238,19 +5227,19 @@ static void InvAction() {
switch (InvArea(aniX, aniY)) {
case I_BODY:
- if (ino == INV_CONF) {
- if (!InventoryHidden)
+ if (g_ino == INV_CONF) {
+ if (!g_InventoryHidden)
MenuAction(WhichMenuBox(aniX, aniY, false), true);
- } else if (ino == INV_CONV) {
+ } else if (g_ino == INV_CONV) {
index = InvItem(&aniX, &aniY, false);
ConvAction(index);
} else {
index = InvItem(&aniX, &aniY, false);
if (index != INV_NOICON) {
- if (InvD[ino].contents[index] && InvD[ino].contents[index] != HeldItem) {
- invObj = GetInvObject(InvD[ino].contents[index]);
+ if (g_InvD[g_ino].contents[index] && g_InvD[g_ino].contents[index] != g_heldItem) {
+ invObj = GetInvObject(g_InvD[g_ino].contents[index]);
if (TinselV2)
- thisIcon = InvD[ino].contents[index];
+ g_thisIcon = g_InvD[g_ino].contents[index];
if (TinselV2 || (invObj->hScript))
InvTinselEvent(invObj, ACTION, INV_ACTION, index);
}
@@ -5259,33 +5248,33 @@ static void InvAction() {
break;
case I_HEADER: // Maximise/unmaximise inventory
- if (!InvD[ino].resizable)
+ if (!g_InvD[g_ino].resizable)
break;
- if (!InventoryMaximised) {
- InvD[ino].sNoofHicons = InvD[ino].NoofHicons;
- InvD[ino].sNoofVicons = InvD[ino].NoofVicons;
- InvD[ino].NoofHicons = InvD[ino].MaxHicons;
- InvD[ino].NoofVicons = InvD[ino].MaxVicons;
- InventoryMaximised = true;
-
- i = InvD[ino].inventoryX;
- InvD[ino].inventoryX = InvD[ino].otherX;
- InvD[ino].otherX = i;
- i = InvD[ino].inventoryY;
- InvD[ino].inventoryY = InvD[ino].otherY;
- InvD[ino].otherY = i;
+ if (!g_InventoryMaximised) {
+ g_InvD[g_ino].sNoofHicons = g_InvD[g_ino].NoofHicons;
+ g_InvD[g_ino].sNoofVicons = g_InvD[g_ino].NoofVicons;
+ g_InvD[g_ino].NoofHicons = g_InvD[g_ino].MaxHicons;
+ g_InvD[g_ino].NoofVicons = g_InvD[g_ino].MaxVicons;
+ g_InventoryMaximised = true;
+
+ i = g_InvD[g_ino].inventoryX;
+ g_InvD[g_ino].inventoryX = g_InvD[g_ino].otherX;
+ g_InvD[g_ino].otherX = i;
+ i = g_InvD[g_ino].inventoryY;
+ g_InvD[g_ino].inventoryY = g_InvD[g_ino].otherY;
+ g_InvD[g_ino].otherY = i;
} else {
- InvD[ino].NoofHicons = InvD[ino].sNoofHicons;
- InvD[ino].NoofVicons = InvD[ino].sNoofVicons;
- InventoryMaximised = false;
-
- i = InvD[ino].inventoryX;
- InvD[ino].inventoryX = InvD[ino].otherX;
- InvD[ino].otherX = i;
- i = InvD[ino].inventoryY;
- InvD[ino].inventoryY = InvD[ino].otherY;
- InvD[ino].otherY = i;
+ g_InvD[g_ino].NoofHicons = g_InvD[g_ino].sNoofHicons;
+ g_InvD[g_ino].NoofVicons = g_InvD[g_ino].sNoofVicons;
+ g_InventoryMaximised = false;
+
+ i = g_InvD[g_ino].inventoryX;
+ g_InvD[g_ino].inventoryX = g_InvD[g_ino].otherX;
+ g_InvD[g_ino].otherX = i;
+ i = g_InvD[g_ino].inventoryY;
+ g_InvD[g_ino].inventoryY = g_InvD[g_ino].otherY;
+ g_InvD[g_ino].otherY = i;
}
// Delete current, and re-draw
@@ -5295,15 +5284,15 @@ static void InvAction() {
break;
case I_UP:
- InvD[ino].FirstDisp -= InvD[ino].NoofHicons;
- if (InvD[ino].FirstDisp < 0)
- InvD[ino].FirstDisp = 0;
- ItemsChanged = true;
+ g_InvD[g_ino].FirstDisp -= g_InvD[g_ino].NoofHicons;
+ if (g_InvD[g_ino].FirstDisp < 0)
+ g_InvD[g_ino].FirstDisp = 0;
+ g_ItemsChanged = true;
break;
case I_DOWN:
- if (InvD[ino].FirstDisp + InvD[ino].NoofHicons*InvD[ino].NoofVicons < InvD[ino].NoofItems) {
- InvD[ino].FirstDisp += InvD[ino].NoofHicons;
- ItemsChanged = true;
+ if (g_InvD[g_ino].FirstDisp + g_InvD[g_ino].NoofHicons*g_InvD[g_ino].NoofVicons < g_InvD[g_ino].NoofItems) {
+ g_InvD[g_ino].FirstDisp += g_InvD[g_ino].NoofHicons;
+ g_ItemsChanged = true;
}
break;
}
@@ -5319,8 +5308,8 @@ static void InvLook(const Common::Point &coOrds) {
case I_BODY:
index = InvItem(pt, false);
if (index != INV_NOICON) {
- if (InvD[ino].contents[index] && InvD[ino].contents[index] != HeldItem) {
- invObj = GetInvObject(InvD[ino].contents[index]);
+ if (g_InvD[g_ino].contents[index] && g_InvD[g_ino].contents[index] != g_heldItem) {
+ invObj = GetInvObject(g_InvD[g_ino].contents[index]);
if (invObj->hScript)
InvTinselEvent(invObj, LOOK, INV_LOOK, index);
}
@@ -5328,7 +5317,7 @@ static void InvLook(const Common::Point &coOrds) {
break;
case I_NOTIN:
- if (ino == INV_CONV)
+ if (g_ino == INV_CONV)
ConvAction(INV_CLOSEICON);
KillInventory();
break;
@@ -5341,7 +5330,7 @@ static void InvLook(const Common::Point &coOrds) {
/**************************************************************************/
extern void EventToInventory(PLR_EVENT pEvent, const Common::Point &coOrds) {
- if (InventoryHidden)
+ if (g_InventoryHidden)
return;
switch (pEvent) {
@@ -5364,7 +5353,7 @@ extern void EventToInventory(PLR_EVENT pEvent, const Common::Point &coOrds) {
break;
case PLR_ACTION: // PLR_DLEFT
- if (InvDragging != ID_MDCONT)
+ if (g_InvDragging != ID_MDCONT)
InvDragEnd();
InvAction();
break;
@@ -5380,7 +5369,7 @@ extern void EventToInventory(PLR_EVENT pEvent, const Common::Point &coOrds) {
case PLR_ESCAPE:
if (MenuActive()) {
if (cd.box != optionBox && cd.box != hopperBox1 && cd.box != hopperBox2)
- bReOpenMenu = true;
+ g_bReOpenMenu = true;
if ((cd.box == hopperBox1) || (cd.box == hopperBox2))
FreeSceneHopper();
}
@@ -5388,42 +5377,42 @@ extern void EventToInventory(PLR_EVENT pEvent, const Common::Point &coOrds) {
break;
case PLR_PGDN:
- if (ino == INV_MENU) {
+ if (g_ino == INV_MENU) {
// Only act if load or save screen
MenuPageDown();
} else {
// This code is a copy of the IB_SLIDE_DOWN case in InvWalkTo
// TODO: So share this duplicate code
- if (InvD[ino].NoofVicons == 1)
- if (InvD[ino].FirstDisp + InvD[ino].NoofHicons*InvD[ino].NoofVicons < InvD[ino].NoofItems)
- InvD[ino].FirstDisp += InvD[ino].NoofHicons;
- for (int i = 1; i < InvD[ino].NoofVicons; i++) {
- if (InvD[ino].FirstDisp + InvD[ino].NoofHicons*InvD[ino].NoofVicons < InvD[ino].NoofItems)
- InvD[ino].FirstDisp += InvD[ino].NoofHicons;
+ if (g_InvD[g_ino].NoofVicons == 1)
+ if (g_InvD[g_ino].FirstDisp + g_InvD[g_ino].NoofHicons*g_InvD[g_ino].NoofVicons < g_InvD[g_ino].NoofItems)
+ g_InvD[g_ino].FirstDisp += g_InvD[g_ino].NoofHicons;
+ for (int i = 1; i < g_InvD[g_ino].NoofVicons; i++) {
+ if (g_InvD[g_ino].FirstDisp + g_InvD[g_ino].NoofHicons*g_InvD[g_ino].NoofVicons < g_InvD[g_ino].NoofItems)
+ g_InvD[g_ino].FirstDisp += g_InvD[g_ino].NoofHicons;
}
- ItemsChanged = true;
+ g_ItemsChanged = true;
}
break;
case PLR_PGUP:
- if (ino == INV_MENU) {
+ if (g_ino == INV_MENU) {
// Only act if load or save screen
MenuPageUp();
} else {
// This code is a copy of the I_SLIDE_UP case in InvWalkTo
// TODO: So share this duplicate code
- if (InvD[ino].NoofVicons == 1)
- InvD[ino].FirstDisp -= InvD[ino].NoofHicons;
- for (int i = 1; i < InvD[ino].NoofVicons; i++)
- InvD[ino].FirstDisp -= InvD[ino].NoofHicons;
- if (InvD[ino].FirstDisp < 0)
- InvD[ino].FirstDisp = 0;
- ItemsChanged = true;
+ if (g_InvD[g_ino].NoofVicons == 1)
+ g_InvD[g_ino].FirstDisp -= g_InvD[g_ino].NoofHicons;
+ for (int i = 1; i < g_InvD[g_ino].NoofVicons; i++)
+ g_InvD[g_ino].FirstDisp -= g_InvD[g_ino].NoofHicons;
+ if (g_InvD[g_ino].FirstDisp < 0)
+ g_InvD[g_ino].FirstDisp = 0;
+ g_ItemsChanged = true;
}
break;
case PLR_HOME:
- if (ino == INV_MENU) {
+ if (g_ino == INV_MENU) {
// Only act if load or save screen
if (cd.box == loadBox || cd.box == saveBox)
FirstFile(0);
@@ -5438,19 +5427,19 @@ extern void EventToInventory(PLR_EVENT pEvent, const Common::Point &coOrds) {
cd.selBox = 0;
Select(cd.selBox, true);
} else {
- InvD[ino].FirstDisp = 0;
- ItemsChanged = true;
+ g_InvD[g_ino].FirstDisp = 0;
+ g_ItemsChanged = true;
}
break;
case PLR_END:
- if (ino == INV_MENU) {
+ if (g_ino == INV_MENU) {
if (cd.box == loadBox || cd.box == saveBox)
FirstFile(MAX_SAVED_FILES); // Will get reduced to appropriate value
else if (cd.box == hopperBox1)
- FirstScene(numScenes); // Will get reduced to appropriate value
+ FirstScene(g_numScenes); // Will get reduced to appropriate value
else if (cd.box == hopperBox2)
- FirstEntry(numEntries); // Will get reduced to appropriate value
+ FirstEntry(g_numEntries); // Will get reduced to appropriate value
else
break;
@@ -5458,10 +5447,10 @@ extern void EventToInventory(PLR_EVENT pEvent, const Common::Point &coOrds) {
cd.selBox = 0;
Select(cd.selBox, true);
} else {
- InvD[ino].FirstDisp = InvD[ino].NoofItems - InvD[ino].NoofHicons*InvD[ino].NoofVicons;
- if (InvD[ino].FirstDisp < 0)
- InvD[ino].FirstDisp = 0;
- ItemsChanged = true;
+ g_InvD[g_ino].FirstDisp = g_InvD[g_ino].NoofItems - g_InvD[g_ino].NoofHicons*g_InvD[g_ino].NoofVicons;
+ if (g_InvD[g_ino].FirstDisp < 0)
+ g_InvD[g_ino].FirstDisp = 0;
+ g_ItemsChanged = true;
}
break;
default:
@@ -5483,8 +5472,8 @@ extern void SetObjectFilm(int object, SCNHANDLE hFilm) {
invObj = GetInvObject(object);
invObj->hIconFilm = hFilm;
- if (HeldItem != object)
- ItemsChanged = true;
+ if (g_heldItem != object)
+ g_ItemsChanged = true;
}
/**
@@ -5492,34 +5481,34 @@ extern void SetObjectFilm(int object, SCNHANDLE hFilm) {
*/
extern void syncInvInfo(Common::Serializer &s) {
for (int i = 0; i < NUM_INV; i++) {
- s.syncAsSint32LE(InvD[i].MinHicons);
- s.syncAsSint32LE(InvD[i].MinVicons);
- s.syncAsSint32LE(InvD[i].MaxHicons);
- s.syncAsSint32LE(InvD[i].MaxVicons);
- s.syncAsSint32LE(InvD[i].NoofHicons);
- s.syncAsSint32LE(InvD[i].NoofVicons);
+ s.syncAsSint32LE(g_InvD[i].MinHicons);
+ s.syncAsSint32LE(g_InvD[i].MinVicons);
+ s.syncAsSint32LE(g_InvD[i].MaxHicons);
+ s.syncAsSint32LE(g_InvD[i].MaxVicons);
+ s.syncAsSint32LE(g_InvD[i].NoofHicons);
+ s.syncAsSint32LE(g_InvD[i].NoofVicons);
for (int j = 0; j < MAX_ININV; j++) {
- s.syncAsSint32LE(InvD[i].contents[j]);
+ s.syncAsSint32LE(g_InvD[i].contents[j]);
}
- s.syncAsSint32LE(InvD[i].NoofItems);
- s.syncAsSint32LE(InvD[i].FirstDisp);
- s.syncAsSint32LE(InvD[i].inventoryX);
- s.syncAsSint32LE(InvD[i].inventoryY);
- s.syncAsSint32LE(InvD[i].otherX);
- s.syncAsSint32LE(InvD[i].otherY);
- s.syncAsSint32LE(InvD[i].MaxInvObj);
- s.syncAsSint32LE(InvD[i].hInvTitle);
- s.syncAsSint32LE(InvD[i].resizable);
- s.syncAsSint32LE(InvD[i].bMoveable);
- s.syncAsSint32LE(InvD[i].sNoofHicons);
- s.syncAsSint32LE(InvD[i].sNoofVicons);
- s.syncAsSint32LE(InvD[i].bMax);
+ s.syncAsSint32LE(g_InvD[i].NoofItems);
+ s.syncAsSint32LE(g_InvD[i].FirstDisp);
+ s.syncAsSint32LE(g_InvD[i].inventoryX);
+ s.syncAsSint32LE(g_InvD[i].inventoryY);
+ s.syncAsSint32LE(g_InvD[i].otherX);
+ s.syncAsSint32LE(g_InvD[i].otherY);
+ s.syncAsSint32LE(g_InvD[i].MaxInvObj);
+ s.syncAsSint32LE(g_InvD[i].hInvTitle);
+ s.syncAsSint32LE(g_InvD[i].resizable);
+ s.syncAsSint32LE(g_InvD[i].bMoveable);
+ s.syncAsSint32LE(g_InvD[i].sNoofHicons);
+ s.syncAsSint32LE(g_InvD[i].sNoofVicons);
+ s.syncAsSint32LE(g_InvD[i].bMax);
}
if (TinselV2) {
- for (int i = 0; i < numObjects; ++i)
- s.syncAsUint32LE(invFilms[i]);
- s.syncAsUint32LE(heldFilm);
+ for (int i = 0; i < g_numObjects; ++i)
+ s.syncAsUint32LE(g_invFilms[i]);
+ s.syncAsUint32LE(g_heldFilm);
}
}
@@ -5533,18 +5522,18 @@ extern void syncInvInfo(Common::Serializer &s) {
*/
// Note: the SCHANDLE type here has been changed to a void*
extern void RegisterIcons(void *cptr, int num) {
- numObjects = num;
- invObjects = (INV_OBJECT *) cptr;
+ g_numObjects = num;
+ g_invObjects = (INV_OBJECT *) cptr;
if (TinselV0) {
// In Tinsel 0, the INV_OBJECT structure doesn't have an attributes field, so we
// need to 'unpack' the source structures into the standard Tinsel v1/v2 format
- MEM_NODE *node = MemoryAllocFixed(numObjects * sizeof(INV_OBJECT));
+ MEM_NODE *node = MemoryAllocFixed(g_numObjects * sizeof(INV_OBJECT));
assert(node);
- invObjects = (INV_OBJECT *)MemoryDeref(node);
- assert(invObjects);
+ g_invObjects = (INV_OBJECT *)MemoryDeref(node);
+ assert(g_invObjects);
byte *srcP = (byte *)cptr;
- INV_OBJECT *destP = (INV_OBJECT *)invObjects;
+ INV_OBJECT *destP = (INV_OBJECT *)g_invObjects;
for (int i = 0; i < num; ++i, ++destP, srcP += 12) {
memmove(destP, srcP, 12);
@@ -5552,12 +5541,12 @@ extern void RegisterIcons(void *cptr, int num) {
}
} else if (TinselV1Mac) {
// Macintosh version has BE encoded resources, so the values need to be byte swapped
- MEM_NODE *node = MemoryAllocFixed(numObjects * sizeof(INV_OBJECT));
+ MEM_NODE *node = MemoryAllocFixed(g_numObjects * sizeof(INV_OBJECT));
assert(node);
- invObjects = (INV_OBJECT *)MemoryDeref(node);
- assert(invObjects);
+ g_invObjects = (INV_OBJECT *)MemoryDeref(node);
+ assert(g_invObjects);
INV_OBJECT *srcP = (INV_OBJECT *)cptr;
- INV_OBJECT *destP = (INV_OBJECT *)invObjects;
+ INV_OBJECT *destP = (INV_OBJECT *)g_invObjects;
for (int i = 0; i < num; ++i, ++destP, ++srcP) {
destP->id = FROM_BE_32(srcP->id);
@@ -5566,14 +5555,14 @@ extern void RegisterIcons(void *cptr, int num) {
destP->attribute = FROM_BE_32(srcP->attribute);
}
} else if (TinselV2) {
- if (invFilms == NULL) {
+ if (g_invFilms == NULL) {
// First time - allocate memory
- MEM_NODE *node = MemoryAllocFixed(numObjects * sizeof(SCNHANDLE));
+ MEM_NODE *node = MemoryAllocFixed(g_numObjects * sizeof(SCNHANDLE));
assert(node);
- invFilms = (SCNHANDLE *)MemoryDeref(node);
- if (invFilms == NULL)
+ g_invFilms = (SCNHANDLE *)MemoryDeref(node);
+ if (g_invFilms == NULL)
error(NO_MEM, "inventory scripts");
- memset(invFilms, 0, numObjects * sizeof(SCNHANDLE));
+ memset(g_invFilms, 0, g_numObjects * sizeof(SCNHANDLE));
}
@@ -5581,11 +5570,11 @@ extern void RegisterIcons(void *cptr, int num) {
// and store all the films separately
int i;
INV_OBJECT *pio;
- for (i = 0, pio = invObjects; i < numObjects; i++, pio++) {
+ for (i = 0, pio = g_invObjects; i < g_numObjects; i++, pio++) {
if (pio->attribute & PERMACONV)
PermaConvIcon(pio->id, pio->attribute & CONVENDITEM);
- invFilms[i] = pio->hIconFilm;
+ g_invFilms[i] = pio->hIconFilm;
}
}
}
@@ -5599,7 +5588,7 @@ extern void setInvWinParts(SCNHANDLE hf) {
const FILM *pfilm;
#endif
- hWinParts = hf;
+ g_hWinParts = hf;
#ifdef DEBUG
pfilm = (const FILM *)LockMem(hf);
@@ -5616,7 +5605,7 @@ extern void setFlagFilms(SCNHANDLE hf) {
const FILM *pfilm;
#endif
- flagFilm = hf;
+ g_flagFilm = hf;
#ifdef DEBUG
pfilm = (const FILM *)LockMem(hf);
@@ -5628,7 +5617,7 @@ extern void setFlagFilms(SCNHANDLE hf) {
* Called from Glitter function 'DecCStrings()'
*/
extern void setConfigStrings(SCNHANDLE *tp) {
- memcpy(configStrings, tp, sizeof(configStrings));
+ memcpy(g_configStrings, tp, sizeof(g_configStrings));
}
/**
@@ -5652,36 +5641,36 @@ extern void idec_inv(int num, SCNHANDLE text, int MaxContents,
if (StartHeight > MaxHeight)
StartHeight = MaxHeight;
- InventoryState = IDLE_INV;
+ g_InventoryState = IDLE_INV;
- InvD[num].MaxHicons = MaxWidth;
- InvD[num].MinHicons = MinWidth;
- InvD[num].MaxVicons = MaxHeight;
- InvD[num].MinVicons = MinHeight;
+ g_InvD[num].MaxHicons = MaxWidth;
+ g_InvD[num].MinHicons = MinWidth;
+ g_InvD[num].MaxVicons = MaxHeight;
+ g_InvD[num].MinVicons = MinHeight;
- InvD[num].NoofHicons = StartWidth;
- InvD[num].NoofVicons = StartHeight;
+ g_InvD[num].NoofHicons = StartWidth;
+ g_InvD[num].NoofVicons = StartHeight;
- memset(InvD[num].contents, 0, sizeof(InvD[num].contents));
- InvD[num].NoofItems = 0;
+ memset(g_InvD[num].contents, 0, sizeof(g_InvD[num].contents));
+ g_InvD[num].NoofItems = 0;
- InvD[num].FirstDisp = 0;
+ g_InvD[num].FirstDisp = 0;
- InvD[num].inventoryX = startx;
- InvD[num].inventoryY = starty;
- InvD[num].otherX = 21;
- InvD[num].otherY = 15;
+ g_InvD[num].inventoryX = startx;
+ g_InvD[num].inventoryY = starty;
+ g_InvD[num].otherX = 21;
+ g_InvD[num].otherY = 15;
- InvD[num].MaxInvObj = MaxContents;
+ g_InvD[num].MaxInvObj = MaxContents;
- InvD[num].hInvTitle = text;
+ g_InvD[num].hInvTitle = text;
if (MaxWidth != MinWidth && MaxHeight != MinHeight)
- InvD[num].resizable = true;
+ g_InvD[num].resizable = true;
- InvD[num].bMoveable = moveable;
+ g_InvD[num].bMoveable = moveable;
- InvD[num].bMax = false;
+ g_InvD[num].bMax = false;
}
/**
@@ -5729,7 +5718,7 @@ extern void idec_inv2(SCNHANDLE text, int MaxContents,
extern int InvGetLimit(int invno) {
assert(invno == INV_1 || invno == INV_2); // only INV_1 and INV_2 supported
- return InvD[invno].MaxInvObj;
+ return g_InvD[invno].MaxInvObj;
}
/**
@@ -5737,12 +5726,12 @@ extern int InvGetLimit(int invno) {
*/
extern void InvSetLimit(int invno, int MaxContents) {
assert(invno == INV_1 || invno == INV_2); // only INV_1 and INV_2 supported
- assert(MaxContents >= InvD[invno].NoofItems); // can't reduce maximum contents below current contents
+ assert(MaxContents >= g_InvD[invno].NoofItems); // can't reduce maximum contents below current contents
if (MaxContents > MAX_ININV)
MaxContents = MAX_ININV; // Max contents
- InvD[invno].MaxInvObj = MaxContents;
+ g_InvD[invno].MaxInvObj = MaxContents;
}
/**
@@ -5757,34 +5746,34 @@ extern void InvSetSize(int invno, int MinWidth, int MinHeight,
if (StartHeight > MaxHeight)
StartHeight = MaxHeight;
- InvD[invno].MaxHicons = MaxWidth;
- InvD[invno].MinHicons = MinWidth;
- InvD[invno].MaxVicons = MaxHeight;
- InvD[invno].MinVicons = MinHeight;
+ g_InvD[invno].MaxHicons = MaxWidth;
+ g_InvD[invno].MinHicons = MinWidth;
+ g_InvD[invno].MaxVicons = MaxHeight;
+ g_InvD[invno].MinVicons = MinHeight;
- InvD[invno].NoofHicons = StartWidth;
- InvD[invno].NoofVicons = StartHeight;
+ g_InvD[invno].NoofHicons = StartWidth;
+ g_InvD[invno].NoofVicons = StartHeight;
if (MaxWidth != MinWidth && MaxHeight != MinHeight)
- InvD[invno].resizable = true;
+ g_InvD[invno].resizable = true;
else
- InvD[invno].resizable = false;
+ g_InvD[invno].resizable = false;
- InvD[invno].bMax = false;
+ g_InvD[invno].bMax = false;
}
/**************************************************************************/
extern bool IsTopWindow() {
- return (InventoryState == BOGUS_INV);
+ return (g_InventoryState == BOGUS_INV);
}
extern bool MenuActive() {
- return (InventoryState == ACTIVE_INV && ino == INV_CONF);
+ return (g_InventoryState == ACTIVE_INV && g_ino == INV_CONF);
}
extern bool IsConvWindow() {
- return (InventoryState == ACTIVE_INV && ino == INV_CONV);
+ return (g_InventoryState == ACTIVE_INV && g_ino == INV_CONV);
}
} // End of namespace Tinsel
diff --git a/engines/tinsel/drives.cpp b/engines/tinsel/drives.cpp
index 5977d3b718..d815fd165d 100644
--- a/engines/tinsel/drives.cpp
+++ b/engines/tinsel/drives.cpp
@@ -32,13 +32,13 @@ namespace Tinsel {
// FIXME: Avoid non-const global vars
-char currentCD = '1';
+char g_currentCD = '1';
-static bool bChangingCD = false;
-static char nextCD = '\0';
+static bool g_bChangingCD = false;
+static char g_nextCD = '\0';
-static uint32 lastTime = 0;
-extern LANGUAGE sampleLanguage;
+static uint32 g_lastTime = 0;
+extern LANGUAGE g_sampleLanguage;
void CdCD(CORO_PARAM) {
@@ -47,7 +47,7 @@ void CdCD(CORO_PARAM) {
CORO_BEGIN_CODE(_ctx);
- while (bChangingCD) {
+ while (g_bChangingCD) {
if (g_scheduler->getCurrentProcess()) {
// FIXME: CdCD gets passed a nullContext in RegisterGlobals() and
// PrimeSceneHopper(), because I didn't know how to get a proper
@@ -66,13 +66,13 @@ void CdCD(CORO_PARAM) {
int GetCurrentCD() {
// count from 1
- return (currentCD - '1' + 1);
+ return (g_currentCD - '1' + 1);
}
static const uint32 cdFlags[] = { fCd1, fCd2, fCd3, fCd4, fCd5, fCd6, fCd7, fCd8 };
void SetCD(int flags) {
- if (flags & cdFlags[currentCD - '1'])
+ if (flags & cdFlags[g_currentCD - '1'])
return;
error("SetCD() problem");
@@ -82,7 +82,7 @@ int GetCD(int flags) {
int i;
char cd = '\0';
- if (flags & cdFlags[currentCD - '1'])
+ if (flags & cdFlags[g_currentCD - '1'])
return GetCurrentCD();
for (i = 0; i < 8; i++) {
@@ -93,19 +93,19 @@ int GetCD(int flags) {
}
assert(i != 8);
- nextCD = cd;
+ g_nextCD = cd;
return cd;
}
void DoCdChange() {
- if (bChangingCD && (g_system->getMillis() > (lastTime + 1000))) {
- lastTime = g_system->getMillis();
+ if (g_bChangingCD && (g_system->getMillis() > (g_lastTime + 1000))) {
+ g_lastTime = g_system->getMillis();
_vm->_sound->closeSampleStream();
// Use the filesize of the sample file to determine, for Discworld 2, which CD it is
if (TinselV2) {
TinselFile f;
- if (!f.open(_vm->getSampleFile(sampleLanguage)))
+ if (!f.open(_vm->getSampleFile(g_sampleLanguage)))
// No CD present
return;
@@ -113,28 +113,28 @@ void DoCdChange() {
f.close();
- if (currentCD != sampleCdNumber)
+ if (g_currentCD != sampleCdNumber)
return;
}
_vm->_sound->openSampleFiles();
ChangeLanguage(TextLanguage());
- bChangingCD = false;
+ g_bChangingCD = false;
}
}
void SetNextCD(int cdNumber) {
assert(cdNumber == 1 || cdNumber == 2);
- nextCD = (char)(cdNumber + '1' - 1);
+ g_nextCD = (char)(cdNumber + '1' - 1);
}
bool GotoCD() {
// WORKAROUND: Somehow, CdDoChange() is called twice... Hopefully, this guard helps
- if (currentCD == nextCD)
+ if (g_currentCD == g_nextCD)
return false;
- currentCD = nextCD;
+ g_currentCD = g_nextCD;
/* if (bNoCD) {
strcpy(cdDirectory, hdDirectory);
@@ -142,7 +142,7 @@ bool GotoCD() {
strcat(cdDirectory, cdLastBit);
}
*/
- bChangingCD = true;
+ g_bChangingCD = true;
return true;
}
diff --git a/engines/tinsel/events.cpp b/engines/tinsel/events.cpp
index e701ddca99..74454c5f2a 100644
--- a/engines/tinsel/events.cpp
+++ b/engines/tinsel/events.cpp
@@ -54,37 +54,37 @@ extern HPOLYGON GetTaggedPoly();
//----------------- EXTERNAL GLOBAL DATA ---------------------
-extern bool bEnableMenu;
+extern bool g_bEnableMenu;
//----------------- LOCAL GLOBAL DATA --------------------
// FIXME: Avoid non-const global vars
-static uint32 lastUserEvent = 0; // Time it hapenned
-static int leftEvents = 0; // Single or double, left or right. Or escape key.
-static int escEvents = 1; // Escape key
-static int userEvents = 0; // Whenever a button or a key comes in
+static uint32 g_lastUserEvent = 0; // Time it hapenned
+static int g_leftEvents = 0; // Single or double, left or right. Or escape key.
+static int g_escEvents = 1; // Escape key
+static int g_userEvents = 0; // Whenever a button or a key comes in
-static int eCount = 0;
+static int g_eCount = 0;
-static int controlState;
-static bool bStartOff;
+static int g_controlState;
+static bool g_bStartOff;
-static int controlX, controlY;
-static bool bProvNotProcessed = false;
+static int g_controlX, g_controlY;
+static bool g_bProvNotProcessed = false;
/**
* Gets called before each schedule, only 1 user action per schedule
* is allowed.
*/
void ResetEcount() {
- eCount = 0;
+ g_eCount = 0;
}
void IncUserEvents() {
- userEvents++;
- lastUserEvent = DwGetCurrentTime();
+ g_userEvents++;
+ g_lastUserEvent = DwGetCurrentTime();
}
/**
@@ -104,7 +104,7 @@ void AllowDclick(CORO_PARAM, PLR_EVENT be) {
FreeToken(TOKEN_LEFT_BUT);
// Prevent activation of 2 events on the same tick
- if (++eCount != 1)
+ if (++g_eCount != 1)
CORO_KILL_SELF();
break;
@@ -125,17 +125,17 @@ void ControlOn() {
return;
}
- bEnableMenu = false;
+ g_bEnableMenu = false;
- if (controlState == CONTROL_OFF) {
+ if (g_controlState == CONTROL_OFF) {
// Control is on
- controlState = CONTROL_ON;
+ g_controlState = CONTROL_ON;
// Restore cursor to where it was
- if (bStartOff == true)
- bStartOff = false;
+ if (g_bStartOff == true)
+ g_bStartOff = false;
else
- SetCursorXY(controlX, controlY);
+ SetCursorXY(g_controlX, g_controlY);
// Re-instate cursor
UnHideCursor();
@@ -155,14 +155,14 @@ void ControlOff() {
return;
}
- bEnableMenu = false;
+ g_bEnableMenu = false;
- if (controlState == CONTROL_ON) {
+ if (g_controlState == CONTROL_ON) {
// Control is off
- controlState = CONTROL_OFF;
+ g_controlState = CONTROL_OFF;
// Store cursor position
- GetCursorXY(&controlX, &controlY, true);
+ GetCursorXY(&g_controlX, &g_controlY, true);
// Blank out cursor
DwHideCursor();
@@ -181,10 +181,10 @@ void ControlStartOff() {
return;
}
- bEnableMenu = false;
+ g_bEnableMenu = false;
// Control is off
- controlState = CONTROL_OFF;
+ g_controlState = CONTROL_OFF;
// Blank out cursor
DwHideCursor();
@@ -192,7 +192,7 @@ void ControlStartOff() {
// Switch off tags
DisableTags();
- bStartOff = true;
+ g_bStartOff = true;
}
/**
@@ -211,7 +211,7 @@ bool GetControl(int param) {
}
bool GetControl() {
- if (controlState == CONTROL_ON) {
+ if (g_controlState == CONTROL_ON) {
ControlOff();
return true;
} else
@@ -220,7 +220,7 @@ bool GetControl() {
bool ControlIsOn() {
if (TinselV2)
- return (controlState == CONTROL_ON);
+ return (g_controlState == CONTROL_ON);
return TestToken(TOKEN_CONTROL);
}
@@ -289,7 +289,7 @@ static void ProcessUserEvent(TINSEL_EVENT uEvent, const Common::Point &coOrds, P
HPOLYGON hPoly;
// Prevent activation of 2 events on the same tick
- if (++eCount != 1)
+ if (++g_eCount != 1)
return;
if ((actor = GetTaggedActor()) != 0) {
@@ -395,19 +395,19 @@ void PlayerEvent(PLR_EVENT pEvent, const Common::Point &coOrds) {
static uint32 lastRealAction = 0; // FIXME: Avoid non-const global vars
// This stuff to allow F1 key during startup.
- if (bEnableMenu && pEvent == PLR_MENU)
+ if (g_bEnableMenu && pEvent == PLR_MENU)
Control(CONTROL_ON);
else
IncUserEvents();
if (pEvent == PLR_ESCAPE) {
- ++escEvents;
- ++leftEvents; // Yes, I do mean this
+ ++g_escEvents;
+ ++g_leftEvents; // Yes, I do mean this
} else if ((pEvent == PLR_PROV_WALKTO)
|| (pEvent == PLR_WALKTO)
|| (pEvent == PLR_LOOK)
|| (pEvent == PLR_ACTION)) {
- ++leftEvents;
+ ++g_leftEvents;
}
// Only allow events if player control is on
@@ -484,18 +484,18 @@ void PlayerEvent(PLR_EVENT pEvent, const Common::Point &coOrds) {
* For ESCapable Glitter sequences
*/
int GetEscEvents() {
- return escEvents;
+ return g_escEvents;
}
/**
* For cutting short talk()s etc.
*/
int GetLeftEvents() {
- return leftEvents;
+ return g_leftEvents;
}
bool LeftEventChange(int myleftEvent) {
- if (leftEvents != myleftEvent) {
+ if (g_leftEvents != myleftEvent) {
ProcessedProvisional();
return true;
} else
@@ -506,15 +506,15 @@ bool LeftEventChange(int myleftEvent) {
* For waitkey() Glitter function
*/
int getUserEvents() {
- return userEvents;
+ return g_userEvents;
}
uint32 getUserEventTime() {
- return DwGetCurrentTime() - lastUserEvent;
+ return DwGetCurrentTime() - g_lastUserEvent;
}
void resetUserEventTime() {
- lastUserEvent = DwGetCurrentTime();
+ g_lastUserEvent = DwGetCurrentTime();
}
struct PTP_INIT {
@@ -655,18 +655,18 @@ void effRunPolyTinselCode(HPOLYGON hPoly, TINSEL_EVENT event, int actor) {
* subsequent 'real' event.
*/
void ProcessedProvisional() {
- bProvNotProcessed = false;
+ g_bProvNotProcessed = false;
}
/**
* Resets the bProvNotProcessed flag
*/
void ProvNotProcessed() {
- bProvNotProcessed = true;
+ g_bProvNotProcessed = true;
}
bool GetProvNotProcessed() {
- return bProvNotProcessed;
+ return g_bProvNotProcessed;
}
} // End of namespace Tinsel
diff --git a/engines/tinsel/font.cpp b/engines/tinsel/font.cpp
index e857dca509..54aa7cc15f 100644
--- a/engines/tinsel/font.cpp
+++ b/engines/tinsel/font.cpp
@@ -34,38 +34,38 @@ namespace Tinsel {
// FIXME: Avoid non-const global vars
-static char tBuffer[TBUFSZ];
+static char g_tBuffer[TBUFSZ];
-static SCNHANDLE hTagFont = 0, hTalkFont = 0;
-static SCNHANDLE hRegularTalkFont = 0, hRegularTagFont = 0;
+static SCNHANDLE g_hTagFont = 0, g_hTalkFont = 0;
+static SCNHANDLE g_hRegularTalkFont = 0, g_hRegularTagFont = 0;
/**
* Return address of tBuffer
*/
char *TextBufferAddr() {
- return tBuffer;
+ return g_tBuffer;
}
/**
* Return hTagFont handle.
*/
SCNHANDLE GetTagFontHandle() {
- return hTagFont;
+ return g_hTagFont;
}
/**
* Return hTalkFont handle.
*/
SCNHANDLE GetTalkFontHandle() {
- return hTalkFont;
+ return g_hTalkFont;
}
/**
* Called from dec_tagfont() Glitter function. Store the tag font handle.
*/
void SetTagFontHandle(SCNHANDLE hFont) {
- hTagFont = hRegularTagFont = hFont; // Store the font handle
+ g_hTagFont = g_hRegularTagFont = hFont; // Store the font handle
}
/**
@@ -73,20 +73,20 @@ void SetTagFontHandle(SCNHANDLE hFont) {
* Store the talk font handle.
*/
void SetTalkFontHandle(SCNHANDLE hFont) {
- hTalkFont = hRegularTalkFont = hFont; // Store the font handle
+ g_hTalkFont = g_hRegularTalkFont = hFont; // Store the font handle
}
void SetTempTagFontHandle(SCNHANDLE hFont) {
- hTagFont = hFont;
+ g_hTagFont = hFont;
}
void SetTempTalkFontHandle(SCNHANDLE hFont) {
- hTalkFont = hFont;
+ g_hTalkFont = hFont;
}
void ResetFontHandles() {
- hTagFont = hRegularTagFont;
- hTalkFont = hRegularTalkFont;
+ g_hTagFont = g_hRegularTagFont;
+ g_hTalkFont = g_hRegularTalkFont;
}
@@ -98,17 +98,17 @@ void FettleFontPal(SCNHANDLE fontPal) {
IMAGE *pImg;
assert(fontPal);
- assert(hTagFont); // Tag font not declared
- assert(hTalkFont); // Talk font not declared
+ assert(g_hTagFont); // Tag font not declared
+ assert(g_hTalkFont); // Talk font not declared
- pFont = (const FONT *)LockMem(hTagFont);
+ pFont = (const FONT *)LockMem(g_hTagFont);
pImg = (IMAGE *)LockMem(FROM_LE_32(pFont->fontInit.hObjImg)); // get image for char 0
if (!TinselV2)
pImg->hImgPal = TO_LE_32(fontPal);
else
pImg->hImgPal = 0;
- pFont = (const FONT *)LockMem(hTalkFont);
+ pFont = (const FONT *)LockMem(g_hTalkFont);
pImg = (IMAGE *)LockMem(FROM_LE_32(pFont->fontInit.hObjImg)); // get image for char 0
if (!TinselV2)
pImg->hImgPal = TO_LE_32(fontPal);
diff --git a/engines/tinsel/graphics.cpp b/engines/tinsel/graphics.cpp
index 545310185c..9b06b1a501 100644
--- a/engines/tinsel/graphics.cpp
+++ b/engines/tinsel/graphics.cpp
@@ -40,7 +40,7 @@ namespace Tinsel {
#define CHAR_WIDTH 4
#define CHAR_HEIGHT 4
-extern uint8 transPalette[MAX_COLORS];
+extern uint8 g_transPalette[MAX_COLORS];
//----------------- SUPPORT FUNCTIONS ---------------------
@@ -67,7 +67,7 @@ uint8* psxPJCRLEUnwinder(uint16 imageWidth, uint16 imageHeight, uint8 *srcIdx) {
// Calculate needed index numbers, align width and height not next multiple of four
imageWidth = (imageWidth % 4) ? ((imageWidth / 4) + 1) * 4 : imageWidth;
imageHeight = (imageHeight % 4) ? ((imageHeight / 4) + 1) * 4 : imageHeight;
- destinationBuffer = (uint8*)malloc((imageWidth * imageHeight) / 8);
+ destinationBuffer = (uint8 *)malloc((imageWidth * imageHeight) / 8);
dstIdx = destinationBuffer;
remainingBlocks = (imageWidth * imageHeight) / 16;
@@ -559,7 +559,7 @@ static void WrtTrans(DRAWOBJECT *pObj, uint8 *destP, bool applyClipping) {
// Loop through any remaining lines
while (pObj->height > 0) {
for (int i = 0; i < pObj->width; ++i, ++destP)
- *destP = transPalette[*destP];
+ *destP = g_transPalette[*destP];
--pObj->height;
destP += lineOffset;
diff --git a/engines/tinsel/handle.cpp b/engines/tinsel/handle.cpp
index eeb83b1f98..e31b2141f5 100644
--- a/engines/tinsel/handle.cpp
+++ b/engines/tinsel/handle.cpp
@@ -69,17 +69,17 @@ enum {
// FIXME: Avoid non-const global vars
// handle table gets loaded from index file at runtime
-static MEMHANDLE *handleTable = 0;
+static MEMHANDLE *g_handleTable = 0;
// number of handles in the handle table
-static uint numHandles = 0;
+static uint g_numHandles = 0;
-static uint32 cdPlayHandle = (uint32)-1;
+static uint32 g_cdPlayHandle = (uint32)-1;
-static SCNHANDLE cdBaseHandle = 0, cdTopHandle = 0;
-static Common::File *cdGraphStream = 0;
+static SCNHANDLE g_cdBaseHandle = 0, g_cdTopHandle = 0;
+static Common::File *g_cdGraphStream = 0;
-static char szCdPlayFile[100];
+static char g_szCdPlayFile[100];
//----------------- FORWARD REFERENCES --------------------
@@ -110,24 +110,24 @@ void SetupHandleTable() {
}
// calc number of handles
- numHandles = len / RECORD_SIZE;
+ g_numHandles = len / RECORD_SIZE;
// allocate memory for the index file
- handleTable = (MEMHANDLE *)calloc(numHandles, sizeof(struct MEMHANDLE));
+ g_handleTable = (MEMHANDLE *)calloc(g_numHandles, sizeof(struct MEMHANDLE));
// make sure memory allocated
- assert(handleTable);
+ assert(g_handleTable);
// load data
- for (i = 0; i < numHandles; i++) {
- f.read(handleTable[i].szName, 12);
- handleTable[i].filesize = f.readUint32();
+ for (i = 0; i < g_numHandles; i++) {
+ f.read(g_handleTable[i].szName, 12);
+ g_handleTable[i].filesize = f.readUint32();
// The pointer should always be NULL. We don't
// need to read that from the file.
- handleTable[i]._node = NULL;
+ g_handleTable[i]._node = NULL;
f.seek(4, SEEK_CUR);
// For Discworld 2, read in the flags2 field
- handleTable[i].flags2 = t2Flag ? f.readUint32() : 0;
+ g_handleTable[i].flags2 = t2Flag ? f.readUint32() : 0;
}
if (f.eos() || f.err()) {
@@ -145,7 +145,7 @@ void SetupHandleTable() {
}
// allocate memory nodes and load all permanent graphics
- for (i = 0, pH = handleTable; i < numHandles; i++, pH++) {
+ for (i = 0, pH = g_handleTable; i < g_numHandles; i++, pH++) {
if (pH->filesize & fPreload) {
// allocate a fixed memory node for permanent files
pH->_node = MemoryAllocFixed((pH->filesize & FSIZE_MASK));
@@ -172,24 +172,24 @@ void SetupHandleTable() {
}
void FreeHandleTable() {
- free(handleTable);
- handleTable = NULL;
+ free(g_handleTable);
+ g_handleTable = NULL;
- delete cdGraphStream;
- cdGraphStream = NULL;
+ delete g_cdGraphStream;
+ g_cdGraphStream = NULL;
}
/**
* Loads a memory block as a file.
*/
void OpenCDGraphFile() {
- delete cdGraphStream;
+ delete g_cdGraphStream;
// As the theory goes, the right CD will be in there!
- cdGraphStream = new Common::File;
- if (!cdGraphStream->open(szCdPlayFile))
- error(CANNOT_FIND_FILE, szCdPlayFile);
+ g_cdGraphStream = new Common::File;
+ if (!g_cdGraphStream->open(g_szCdPlayFile))
+ error(CANNOT_FIND_FILE, g_szCdPlayFile);
}
void LoadCDGraphData(MEMHANDLE *pH) {
@@ -210,15 +210,15 @@ void LoadCDGraphData(MEMHANDLE *pH) {
assert(addr);
// Move to correct place in file and load the required data
- assert(cdGraphStream);
- cdGraphStream->seek(cdBaseHandle & OFFSETMASK, SEEK_SET);
- bytes = cdGraphStream->read(addr, (cdTopHandle - cdBaseHandle) & OFFSETMASK);
+ assert(g_cdGraphStream);
+ g_cdGraphStream->seek(g_cdBaseHandle & OFFSETMASK, SEEK_SET);
+ bytes = g_cdGraphStream->read(addr, (g_cdTopHandle - g_cdBaseHandle) & OFFSETMASK);
// New code to try and handle CD read failures 24/2/97
- while (bytes != ((cdTopHandle - cdBaseHandle) & OFFSETMASK) && retries++ < MAX_READ_RETRIES) {
+ while (bytes != ((g_cdTopHandle - g_cdBaseHandle) & OFFSETMASK) && retries++ < MAX_READ_RETRIES) {
// Try again
- cdGraphStream->seek(cdBaseHandle & OFFSETMASK, SEEK_SET);
- bytes = cdGraphStream->read(addr, (cdTopHandle - cdBaseHandle) & OFFSETMASK);
+ g_cdGraphStream->seek(g_cdBaseHandle & OFFSETMASK, SEEK_SET);
+ bytes = g_cdGraphStream->read(addr, (g_cdTopHandle - g_cdBaseHandle) & OFFSETMASK);
}
// discardable - unlock the memory
@@ -230,7 +230,7 @@ void LoadCDGraphData(MEMHANDLE *pH) {
// clear the loading flag
// pH->filesize &= ~fLoading;
- if (bytes != ((cdTopHandle - cdBaseHandle) & OFFSETMASK))
+ if (bytes != ((g_cdTopHandle - g_cdBaseHandle) & OFFSETMASK))
// file is corrupt
error(FILE_READ_ERROR, "CD play file");
}
@@ -245,22 +245,22 @@ void LoadCDGraphData(MEMHANDLE *pH) {
void LoadExtraGraphData(SCNHANDLE start, SCNHANDLE next) {
OpenCDGraphFile();
- MemoryDiscard((handleTable + cdPlayHandle)->_node); // Free it
+ MemoryDiscard((g_handleTable + g_cdPlayHandle)->_node); // Free it
// It must always be the same
- assert(cdPlayHandle == (start >> SCNHANDLE_SHIFT));
- assert(cdPlayHandle == (next >> SCNHANDLE_SHIFT));
+ assert(g_cdPlayHandle == (start >> SCNHANDLE_SHIFT));
+ assert(g_cdPlayHandle == (next >> SCNHANDLE_SHIFT));
- cdBaseHandle = start;
- cdTopHandle = next;
+ g_cdBaseHandle = start;
+ g_cdTopHandle = next;
}
void SetCdPlaySceneDetails(int fileNum, const char *fileName) {
- strcpy(szCdPlayFile, fileName);
+ strcpy(g_szCdPlayFile, fileName);
}
void SetCdPlayHandle(int fileNum) {
- cdPlayHandle = fileNum;
+ g_cdPlayHandle = fileNum;
}
@@ -323,26 +323,26 @@ byte *LockMem(SCNHANDLE offset) {
MEMHANDLE *pH; // points to table entry
// range check the memory handle
- assert(handle < numHandles);
+ assert(handle < g_numHandles);
#ifdef DEBUG
if (handle != s_lockedScene)
warning(" Calling LockMem(0x%x), handle %d differs from active scene %d", offset, handle, s_lockedScene);
#endif
- pH = handleTable + handle;
+ pH = g_handleTable + handle;
if (pH->filesize & fPreload) {
// permanent files are already loaded, nothing to be done
- } else if (handle == cdPlayHandle) {
+ } else if (handle == g_cdPlayHandle) {
// Must be in currently loaded/loadable range
- if (offset < cdBaseHandle || offset >= cdTopHandle)
+ if (offset < g_cdBaseHandle || offset >= g_cdTopHandle)
error("Overlapping (in time) CD-plays");
// May have been discarded, if so, we have to reload
if (!MemoryDeref(pH->_node)) {
// Data was discarded, we have to reload
- MemoryReAlloc(pH->_node, cdTopHandle - cdBaseHandle);
+ MemoryReAlloc(pH->_node, g_cdTopHandle - g_cdBaseHandle);
LoadCDGraphData(pH);
@@ -353,7 +353,7 @@ byte *LockMem(SCNHANDLE offset) {
// make sure address is valid
assert(pH->filesize & fLoaded);
- offset -= cdBaseHandle;
+ offset -= g_cdBaseHandle;
} else {
if (!MemoryDeref(pH->_node)) {
// Data was discarded, we have to reload
@@ -387,9 +387,9 @@ void LockScene(SCNHANDLE offset) {
#endif
// range check the memory handle
- assert(handle < numHandles);
+ assert(handle < g_numHandles);
- pH = handleTable + handle;
+ pH = g_handleTable + handle;
if ((pH->filesize & fPreload) == 0) {
// Ensure the scene handle is allocated.
@@ -414,9 +414,9 @@ void UnlockScene(SCNHANDLE offset) {
MEMHANDLE *pH; // points to table entry
// range check the memory handle
- assert(handle < numHandles);
+ assert(handle < g_numHandles);
- pH = handleTable + handle;
+ pH = g_handleTable + handle;
if ((pH->filesize & fPreload) == 0) {
// unlock the scene data
@@ -441,9 +441,9 @@ bool ValidHandle(SCNHANDLE offset) {
MEMHANDLE *pH; // points to table entry
// range check the memory handle
- assert(handle < numHandles);
+ assert(handle < g_numHandles);
- pH = handleTable + handle;
+ pH = g_handleTable + handle;
return (pH->filesize & FSIZE_MASK) != 8;
}
@@ -458,7 +458,7 @@ void TouchMem(SCNHANDLE offset) {
uint32 handle = offset >> SCNHANDLE_SHIFT; // calc memory handle to use
if (offset != 0) {
- pH = handleTable + handle;
+ pH = g_handleTable + handle;
// update the LRU time whether its loaded or not!
if (pH->_node)
@@ -474,9 +474,9 @@ bool IsCdPlayHandle(SCNHANDLE offset) {
uint32 handle = offset >> SCNHANDLE_SHIFT; // calc memory handle to use
// range check the memory handle
- assert(handle < numHandles);
+ assert(handle < g_numHandles);
- return (handle == cdPlayHandle);
+ return (handle == g_cdPlayHandle);
}
/**
@@ -486,9 +486,9 @@ int CdNumber(SCNHANDLE offset) {
uint handle = offset >> SCNHANDLE_SHIFT; // calc memory handle to use
// range check the memory handle
- assert(handle < numHandles);
+ assert(handle < g_numHandles);
- MEMHANDLE *pH = handleTable + handle;
+ MEMHANDLE *pH = g_handleTable + handle;
if (!TinselV2)
return 1;
diff --git a/engines/tinsel/heapmem.cpp b/engines/tinsel/heapmem.cpp
index 026dc9457e..597cc69e66 100644
--- a/engines/tinsel/heapmem.cpp
+++ b/engines/tinsel/heapmem.cpp
@@ -58,16 +58,16 @@ static const uint32 MemoryPoolSize[3] = {5 * 1024 * 1024, 5 * 1024 * 1024, 10 *
// list of all memory nodes
-MEM_NODE mnodeList[NUM_MNODES];
+MEM_NODE g_mnodeList[NUM_MNODES];
// pointer to the linked list of free mnodes
-static MEM_NODE *pFreeMemNodes;
+static MEM_NODE *g_pFreeMemNodes;
// list of all fixed memory nodes
-MEM_NODE s_fixedMnodesList[5];
+MEM_NODE g_s_fixedMnodesList[5];
// the mnode heap sentinel
-static MEM_NODE heapSentinel;
+static MEM_NODE g_heapSentinel;
//
static MEM_NODE *AllocMemNode();
@@ -80,7 +80,7 @@ static void MemoryStats() {
int lockedSize = 0;
int totalSize = 0;
- const MEM_NODE *pHeap = &heapSentinel;
+ const MEM_NODE *pHeap = &g_heapSentinel;
MEM_NODE *pCur;
for (pCur = pHeap->pNext; pCur != pHeap; pCur = pCur->pNext) {
@@ -104,43 +104,43 @@ static void MemoryStats() {
*/
void MemoryInit() {
// place first node on free list
- pFreeMemNodes = mnodeList;
+ g_pFreeMemNodes = g_mnodeList;
// link all other objects after first
- memset(mnodeList, 0, sizeof(mnodeList));
+ memset(g_mnodeList, 0, sizeof(g_mnodeList));
for (int i = 1; i < NUM_MNODES; i++) {
- mnodeList[i - 1].pNext = mnodeList + i;
+ g_mnodeList[i - 1].pNext = g_mnodeList + i;
}
// null the last mnode
- mnodeList[NUM_MNODES - 1].pNext = NULL;
+ g_mnodeList[NUM_MNODES - 1].pNext = NULL;
// clear list of fixed memory nodes
- memset(s_fixedMnodesList, 0, sizeof(s_fixedMnodesList));
+ memset(g_s_fixedMnodesList, 0, sizeof(g_s_fixedMnodesList));
// set cyclic links to the sentinel
- heapSentinel.pPrev = &heapSentinel;
- heapSentinel.pNext = &heapSentinel;
+ g_heapSentinel.pPrev = &g_heapSentinel;
+ g_heapSentinel.pNext = &g_heapSentinel;
// flag sentinel as locked
- heapSentinel.flags = DWM_LOCKED | DWM_SENTINEL;
+ g_heapSentinel.flags = DWM_LOCKED | DWM_SENTINEL;
// store the current heap size in the sentinel
uint32 size = MemoryPoolSize[0];
if (TinselVersion == TINSEL_V1) size = MemoryPoolSize[1];
else if (TinselVersion == TINSEL_V2) size = MemoryPoolSize[2];
- heapSentinel.size = size;
+ g_heapSentinel.size = size;
}
/**
* Deinitializes the memory manager.
*/
void MemoryDeinit() {
- const MEM_NODE *pHeap = &heapSentinel;
+ const MEM_NODE *pHeap = &g_heapSentinel;
MEM_NODE *pCur;
- pCur = s_fixedMnodesList;
- for (int i = 0; i < ARRAYSIZE(s_fixedMnodesList); ++i, ++pCur) {
+ pCur = g_s_fixedMnodesList;
+ for (int i = 0; i < ARRAYSIZE(g_s_fixedMnodesList); ++i, ++pCur) {
free(pCur->pBaseAddr);
pCur->pBaseAddr = 0;
}
@@ -157,13 +157,13 @@ void MemoryDeinit() {
*/
static MEM_NODE *AllocMemNode() {
// get the first free mnode
- MEM_NODE *pMemNode = pFreeMemNodes;
+ MEM_NODE *pMemNode = g_pFreeMemNodes;
// make sure a mnode is available
assert(pMemNode); // Out of memory nodes
// the next free mnode
- pFreeMemNodes = pMemNode->pNext;
+ g_pFreeMemNodes = pMemNode->pNext;
// wipe out the mnode
memset(pMemNode, 0, sizeof(MEM_NODE));
@@ -178,13 +178,13 @@ static MEM_NODE *AllocMemNode() {
*/
void FreeMemNode(MEM_NODE *pMemNode) {
// validate mnode pointer
- assert(pMemNode >= mnodeList && pMemNode <= mnodeList + NUM_MNODES - 1);
+ assert(pMemNode >= g_mnodeList && pMemNode <= g_mnodeList + NUM_MNODES - 1);
// place free list in mnode next
- pMemNode->pNext = pFreeMemNodes;
+ pMemNode->pNext = g_pFreeMemNodes;
// add mnode to top of free list
- pFreeMemNodes = pMemNode;
+ g_pFreeMemNodes = pMemNode;
}
@@ -194,11 +194,11 @@ void FreeMemNode(MEM_NODE *pMemNode) {
* @return true if any blocks were discarded, false otherwise
*/
static bool HeapCompact(long size) {
- const MEM_NODE *pHeap = &heapSentinel;
+ const MEM_NODE *pHeap = &g_heapSentinel;
MEM_NODE *pCur, *pOldest;
uint32 oldest; // time of the oldest discardable block
- while (heapSentinel.size < size) {
+ while (g_heapSentinel.size < size) {
// find the oldest discardable block
oldest = DwGetCurrentTime();
@@ -231,11 +231,11 @@ static bool HeapCompact(long size) {
* @param size Number of bytes to allocate
*/
static MEM_NODE *MemoryAlloc(long size) {
- MEM_NODE *pHeap = &heapSentinel;
+ MEM_NODE *pHeap = &g_heapSentinel;
#ifdef SCUMM_NEED_ALIGNMENT
- const int alignPadding = sizeof(void*) - 1;
- size = (size + alignPadding) & ~alignPadding; //round up to nearest multiple of sizeof(void*), this ensures the addresses that are returned are alignment-safe.
+ const int alignPadding = sizeof(void *) - 1;
+ size = (size + alignPadding) & ~alignPadding; //round up to nearest multiple of sizeof(void *), this ensures the addresses that are returned are alignment-safe.
#endif
// compact the heap to make up room for 'size' bytes, if necessary
@@ -255,7 +255,7 @@ static MEM_NODE *MemoryAlloc(long size) {
assert(pNode->pBaseAddr);
// Subtract size of new block from total
- heapSentinel.size -= size;
+ g_heapSentinel.size -= size;
#ifdef DEBUG
MemoryStats();
@@ -282,7 +282,7 @@ static MEM_NODE *MemoryAlloc(long size) {
* by using MemoryReAlloc().
*/
MEM_NODE *MemoryNoAlloc() {
- MEM_NODE *pHeap = &heapSentinel;
+ MEM_NODE *pHeap = &g_heapSentinel;
// chain a discarded node onto the end of the heap
MEM_NODE *pNode = AllocMemNode();
@@ -310,13 +310,13 @@ MEM_NODE *MemoryNoAlloc() {
MEM_NODE *MemoryAllocFixed(long size) {
#ifdef SCUMM_NEED_ALIGNMENT
- const int alignPadding = sizeof(void*) - 1;
- size = (size + alignPadding) & ~alignPadding; //round up to nearest multiple of sizeof(void*), this ensures the addresses that are returned are alignment-safe.
+ const int alignPadding = sizeof(void *) - 1;
+ size = (size + alignPadding) & ~alignPadding; //round up to nearest multiple of sizeof(void *), this ensures the addresses that are returned are alignment-safe.
#endif
// Search for a free entry in s_fixedMnodesList
- MEM_NODE *pNode = s_fixedMnodesList;
- for (int i = 0; i < ARRAYSIZE(s_fixedMnodesList); ++i, ++pNode) {
+ MEM_NODE *pNode = g_s_fixedMnodesList;
+ for (int i = 0; i < ARRAYSIZE(g_s_fixedMnodesList); ++i, ++pNode) {
if (!pNode->pBaseAddr) {
pNode->pNext = 0;
pNode->pPrev = 0;
@@ -326,7 +326,7 @@ MEM_NODE *MemoryAllocFixed(long size) {
pNode->flags = DWM_USED;
// Subtract size of new block from total
- heapSentinel.size -= size;
+ g_heapSentinel.size -= size;
return pNode;
}
@@ -342,7 +342,7 @@ MEM_NODE *MemoryAllocFixed(long size) {
*/
void MemoryDiscard(MEM_NODE *pMemNode) {
// validate mnode pointer
- assert(pMemNode >= mnodeList && pMemNode <= mnodeList + NUM_MNODES - 1);
+ assert(pMemNode >= g_mnodeList && pMemNode <= g_mnodeList + NUM_MNODES - 1);
// object must be in use and locked
assert((pMemNode->flags & (DWM_USED | DWM_LOCKED)) == DWM_USED);
@@ -351,7 +351,7 @@ void MemoryDiscard(MEM_NODE *pMemNode) {
if ((pMemNode->flags & DWM_DISCARDED) == 0) {
// free memory
free(pMemNode->pBaseAddr);
- heapSentinel.size += pMemNode->size;
+ g_heapSentinel.size += pMemNode->size;
#ifdef DEBUG
MemoryStats();
@@ -416,7 +416,7 @@ void MemoryReAlloc(MEM_NODE *pMemNode, long size) {
MEM_NODE *pNew;
// validate mnode pointer
- assert(pMemNode >= mnodeList && pMemNode <= mnodeList + NUM_MNODES - 1);
+ assert(pMemNode >= g_mnodeList && pMemNode <= g_mnodeList + NUM_MNODES - 1);
// align the size to machine boundary requirements
size = (size + sizeof(void *) - 1) & ~(sizeof(void *) - 1);
diff --git a/engines/tinsel/mareels.cpp b/engines/tinsel/mareels.cpp
index bd267a2c65..7dd905d0f2 100644
--- a/engines/tinsel/mareels.cpp
+++ b/engines/tinsel/mareels.cpp
@@ -48,9 +48,9 @@ struct SCIdataStruct {
// FIXME: Avoid non-const global vars
-static SCIdataStruct SCIdata[MAX_SCRENTRIES];
+static SCIdataStruct g_SCIdata[MAX_SCRENTRIES];
-static int scrEntries = 0;
+static int g_scrEntries = 0;
/**
* Sets an actor's walk reels
@@ -131,16 +131,16 @@ void SetScalingReels(int actor, int scale, int direction,
assert(!(scale == 1 && direction == D_UP) &&
!(scale == NUM_MAINSCALES && direction == D_DOWN)); // illegal direction from scale
- assert(scrEntries < MAX_SCRENTRIES); // Scaling reels limit reached!
+ assert(g_scrEntries < MAX_SCRENTRIES); // Scaling reels limit reached!
- SCIdata[scrEntries].actor = actor;
- SCIdata[scrEntries].scale = scale;
- SCIdata[scrEntries].direction = direction;
- SCIdata[scrEntries].reels[LEFTREEL] = left;
- SCIdata[scrEntries].reels[RIGHTREEL] = right;
- SCIdata[scrEntries].reels[FORWARD] = forward;
- SCIdata[scrEntries].reels[AWAY] = away;
- scrEntries++;
+ g_SCIdata[g_scrEntries].actor = actor;
+ g_SCIdata[g_scrEntries].scale = scale;
+ g_SCIdata[g_scrEntries].direction = direction;
+ g_SCIdata[g_scrEntries].reels[LEFTREEL] = left;
+ g_SCIdata[g_scrEntries].reels[RIGHTREEL] = right;
+ g_SCIdata[g_scrEntries].reels[FORWARD] = forward;
+ g_SCIdata[g_scrEntries].reels[AWAY] = away;
+ g_scrEntries++;
}
/**
@@ -155,12 +155,12 @@ SCNHANDLE ScalingReel(int ano, int scale1, int scale2, DIRECTION reel) {
else
d = D_UP;
- for (int i = 0; i < scrEntries; i++) {
- if (SCIdata[i].actor == ano && SCIdata[i].scale == scale1 && SCIdata[i].direction == d) {
- if (SCIdata[i].reels[reel] == TF_NONE)
+ for (int i = 0; i < g_scrEntries; i++) {
+ if (g_SCIdata[i].actor == ano && g_SCIdata[i].scale == scale1 && g_SCIdata[i].direction == d) {
+ if (g_SCIdata[i].reels[reel] == TF_NONE)
return 0;
else
- return SCIdata[i].reels[reel];
+ return g_SCIdata[i].reels[reel];
}
}
return 0;
@@ -170,8 +170,8 @@ SCNHANDLE ScalingReel(int ano, int scale1, int scale2, DIRECTION reel) {
* RebootScalingReels
*/
void RebootScalingReels() {
- scrEntries = 0;
- memset(SCIdata, 0, sizeof(SCIdata));
+ g_scrEntries = 0;
+ memset(g_SCIdata, 0, sizeof(g_SCIdata));
}
/**
diff --git a/engines/tinsel/move.cpp b/engines/tinsel/move.cpp
index e20f28d528..bb49e59fe7 100644
--- a/engines/tinsel/move.cpp
+++ b/engines/tinsel/move.cpp
@@ -77,14 +77,14 @@ HPOLYGON InitExtraBlock(PMOVER ca, PMOVER ta);
// FIXME: Avoid non-const global vars
#if SLOW_RINCE_DOWN
-static int Interlude = 0; // For slowing down walking, for testing
-static int BogusVar = 0; // For slowing down walking, for testing
+static int g_Interlude = 0; // For slowing down walking, for testing
+static int g_BogusVar = 0; // For slowing down walking, for testing
#endif
-static int32 DefaultRefer = 0;
-static int lastLeadXdest = 0, lastLeadYdest = 0;
+static int32 g_DefaultRefer = 0;
+static int g_lastLeadXdest = 0, g_lastLeadYdest = 0;
-static int hSlowVar = 0; // used by MoveActor()
+static int g_hSlowVar = 0; // used by MoveActor()
//----------------- FORWARD REFERENCES --------------------
@@ -101,9 +101,9 @@ static void NewCoOrdinates(int fromx, int fromy, int *targetX, int *targetY,
*/
void AddInterlude(int n) {
- Interlude += n;
- if (Interlude < 0)
- Interlude = 0;
+ g_Interlude += n;
+ if (g_Interlude < 0)
+ g_Interlude = 0;
}
#endif
@@ -251,7 +251,7 @@ static int ClickedOnNothing(int clickX, int clickY, int *ptgtX, int *ptgtY) {
PlayfieldGetPos(FIELD_WORLD, &Loffset, &Toffset);
- switch (DefaultRefer) {
+ switch (g_DefaultRefer) {
case REF_DEFAULT:
// Try searching down and up (onscreen).
for (i = clickY+1; i < SCREEN_HEIGHT+Toffset; i++)
@@ -1353,15 +1353,15 @@ int SetActorDest(PMOVER pMover, int clickX, int clickY, bool igPath, SCNHANDLE h
targetY = clickY;
if (pMover->actorID == GetLeadId()) {
- lastLeadXdest = targetX;
- lastLeadYdest = targetY;
+ g_lastLeadXdest = targetX;
+ g_lastLeadYdest = targetY;
}
} else {
int wodResult = WorkOutDestination(clickX, clickY, &targetX, &targetY);
if (pMover->actorID == GetLeadId()) {
- lastLeadXdest = targetX;
- lastLeadYdest = targetY;
+ g_lastLeadXdest = targetX;
+ g_lastLeadYdest = targetY;
}
if (wodResult == ALL_SORTED) {
@@ -1613,17 +1613,17 @@ void MoveActor(PMOVER pMover) {
}
#if SLOW_RINCE_DOWN
-/**/ if (BogusVar++ < Interlude) // Temporary slow-down-the-action code
+/**/ if (g_BogusVar++ < g_Interlude) // Temporary slow-down-the-action code
/**/ return; //
-/**/ BogusVar = 0; //
+/**/ g_BogusVar = 0; //
#endif
if (!TinselV2) {
// During swalk()s, movement while hidden may be slowed down.
if (pMover->bHidden) {
- if (++hSlowVar < pMover->SlowFactor)
+ if (++g_hSlowVar < pMover->SlowFactor)
return;
- hSlowVar = 0;
+ g_hSlowVar = 0;
}
}
@@ -1705,15 +1705,15 @@ void MoveActor(PMOVER pMover) {
* Store the default refer type for the current scene.
*/
void SetDefaultRefer(int32 defRefer) {
- DefaultRefer = defRefer;
+ g_DefaultRefer = defRefer;
}
int GetLastLeadXdest() {
- return lastLeadXdest;
+ return g_lastLeadXdest;
}
int GetLastLeadYdest() {
- return lastLeadYdest;
+ return g_lastLeadYdest;
}
diff --git a/engines/tinsel/music.cpp b/engines/tinsel/music.cpp
index f552c49491..781a378f13 100644
--- a/engines/tinsel/music.cpp
+++ b/engines/tinsel/music.cpp
@@ -64,13 +64,13 @@ struct SOUND_BUFFER {
// FIXME: Avoid non-const global vars
// MIDI buffer
-static SOUND_BUFFER midiBuffer = { 0, 0 };
+static SOUND_BUFFER g_midiBuffer = { 0, 0 };
-static SCNHANDLE currentMidi = 0;
-static bool currentLoop = false;
+static SCNHANDLE g_currentMidi = 0;
+static bool g_currentLoop = false;
// We allocate 155 entries because that's the maximum, used in the SCN version
-static SCNHANDLE midiOffsets[155];
+static SCNHANDLE g_midiOffsets[155];
static const int enhancedAudioGRAVersion[] = {
1, 2, 1, 1, 3, 3, 4, 4, 5, 6, // 1-10
@@ -110,16 +110,16 @@ static const int enhancedAudioSCNVersion[] = {
};
int GetTrackNumber(SCNHANDLE hMidi) {
- for (int i = 0; i < ARRAYSIZE(midiOffsets); i++)
- if (midiOffsets[i] == hMidi)
+ for (int i = 0; i < ARRAYSIZE(g_midiOffsets); i++)
+ if (g_midiOffsets[i] == hMidi)
return i;
return -1;
}
SCNHANDLE GetTrackOffset(int trackNumber) {
- assert(trackNumber < ARRAYSIZE(midiOffsets));
- return midiOffsets[trackNumber];
+ assert(trackNumber < ARRAYSIZE(g_midiOffsets));
+ return g_midiOffsets[trackNumber];
}
/**
@@ -128,8 +128,8 @@ SCNHANDLE GetTrackOffset(int trackNumber) {
* @param bLoop Whether to loop the sequence
*/
bool PlayMidiSequence(uint32 dwFileOffset, bool bLoop) {
- currentMidi = dwFileOffset;
- currentLoop = bLoop;
+ g_currentMidi = dwFileOffset;
+ g_currentLoop = bLoop;
// Tinsel V1 PSX uses a different music format, so i
// disable it here.
@@ -166,8 +166,8 @@ bool PlayMidiSequence(uint32 dwFileOffset, bool bLoop) {
StopMidi();
// StopMidi resets these fields, so set them again
- currentMidi = dwFileOffset;
- currentLoop = bLoop;
+ g_currentMidi = dwFileOffset;
+ g_currentLoop = bLoop;
// try to play track, but don't fall back to a true CD
g_system->getAudioCDManager()->play(track, bLoop ? -1 : 1, 0, 0, true);
@@ -203,13 +203,13 @@ bool PlayMidiSequence(uint32 dwFileOffset, bool bLoop) {
dwSeqLen = midiStream.readUint32LE();
// make sure buffer is large enough for this sequence
- assert(dwSeqLen > 0 && dwSeqLen <= midiBuffer.size);
+ assert(dwSeqLen > 0 && dwSeqLen <= g_midiBuffer.size);
// stop any currently playing tune
_vm->_midiMusic->stop();
// read the sequence
- if (midiStream.read(midiBuffer.pDat, dwSeqLen) != dwSeqLen)
+ if (midiStream.read(g_midiBuffer.pDat, dwSeqLen) != dwSeqLen)
error(FILE_IS_CORRUPT, MIDI_FILE);
midiStream.close();
@@ -231,14 +231,14 @@ bool PlayMidiSequence(uint32 dwFileOffset, bool bLoop) {
_vm->_midiMusic->send(0x7F07B0 | 13);
}
- _vm->_midiMusic->playXMIDI(midiBuffer.pDat, dwSeqLen, bLoop);
+ _vm->_midiMusic->playXMIDI(g_midiBuffer.pDat, dwSeqLen, bLoop);
// Store the length
//dwLastSeqLen = dwSeqLen;
} else {
// dwFileOffset == dwLastMidiIndex
_vm->_midiMusic->stop();
- _vm->_midiMusic->playXMIDI(midiBuffer.pDat, dwSeqLen, bLoop);
+ _vm->_midiMusic->playXMIDI(g_midiBuffer.pDat, dwSeqLen, bLoop);
}
return true;
@@ -259,8 +259,8 @@ bool MidiPlaying() {
* Stops any currently playing midi.
*/
bool StopMidi() {
- currentMidi = 0;
- currentLoop = false;
+ g_currentMidi = 0;
+ g_currentLoop = false;
if (_vm->getFeatures() & GF_ENHANCED_AUDIO_SUPPORT) {
g_system->getAudioCDManager()->stop();
@@ -295,8 +295,8 @@ void SetMidiVolume(int vol) {
_vm->_midiMusic->setVolume(vol);
} else if (vol != 0 && priorVolMusic == 0) {
// Perhaps restart last midi sequence
- if (currentLoop)
- PlayMidiSequence(currentMidi, true);
+ if (g_currentLoop)
+ PlayMidiSequence(g_currentMidi, true);
_vm->_midiMusic->setVolume(vol);
} else if (vol != 0 && priorVolMusic != 0) {
@@ -318,7 +318,7 @@ void OpenMidiFiles() {
if ((_vm->getFeatures() & GF_DEMO) || (TinselVersion == TINSEL_V2) || TinselV1PSX)
return;
- if (midiBuffer.pDat)
+ if (g_midiBuffer.pDat)
// already allocated
return;
@@ -327,15 +327,15 @@ void OpenMidiFiles() {
error(CANNOT_FIND_FILE, MIDI_FILE);
// gen length of the largest sequence
- midiBuffer.size = midiStream.readUint32LE();
+ g_midiBuffer.size = midiStream.readUint32LE();
if (midiStream.eos() || midiStream.err())
error(FILE_IS_CORRUPT, MIDI_FILE);
- if (midiBuffer.size) {
+ if (g_midiBuffer.size) {
// allocate a buffer big enough for the largest MIDI sequence
- if ((midiBuffer.pDat = (uint8 *)malloc(midiBuffer.size)) != NULL) {
+ if ((g_midiBuffer.pDat = (uint8 *)malloc(g_midiBuffer.size)) != NULL) {
// clear out the buffer
- memset(midiBuffer.pDat, 0, midiBuffer.size);
+ memset(g_midiBuffer.pDat, 0, g_midiBuffer.size);
// VMM_lock(midiBuffer.pDat, midiBuffer.size);
} else {
//mSeqHandle = NULL;
@@ -352,15 +352,15 @@ void OpenMidiFiles() {
uint32 songLength = 0;
// Init
- for (int i = 0; i < ARRAYSIZE(midiOffsets); i++)
- midiOffsets[i] = 0;
+ for (int i = 0; i < ARRAYSIZE(g_midiOffsets); i++)
+ g_midiOffsets[i] = 0;
while (!midiStream.eos() && !midiStream.err()) {
if (curOffset + (4 * curTrack) >= (uint32)midiStream.size())
break;
- assert(curTrack < ARRAYSIZE(midiOffsets));
- midiOffsets[curTrack] = curOffset + (4 * curTrack);
+ assert(curTrack < ARRAYSIZE(g_midiOffsets));
+ g_midiOffsets[curTrack] = curOffset + (4 * curTrack);
//debug("%d: %d", curTrack, midiOffsets[curTrack]);
songLength = midiStream.readUint32LE();
@@ -374,8 +374,8 @@ void OpenMidiFiles() {
}
void DeleteMidiBuffer() {
- free(midiBuffer.pDat);
- midiBuffer.pDat = NULL;
+ free(g_midiBuffer.pDat);
+ g_midiBuffer.pDat = NULL;
}
MidiMusicPlayer::MidiMusicPlayer() {
@@ -860,22 +860,22 @@ void PCMMusicPlayer::stop() {
}
void CurrentMidiFacts(SCNHANDLE *pMidi, bool *pLoop) {
- *pMidi = currentMidi;
- *pLoop = currentLoop;
+ *pMidi = g_currentMidi;
+ *pLoop = g_currentLoop;
}
void RestoreMidiFacts(SCNHANDLE Midi, bool Loop) {
StopMidi();
- currentMidi = Midi;
- currentLoop = Loop;
+ g_currentMidi = Midi;
+ g_currentLoop = Loop;
if (_vm->_config->_musicVolume != 0 && Loop) {
bool mute = false;
if (ConfMan.hasKey("mute"))
mute = ConfMan.getBool("mute");
- PlayMidiSequence(currentMidi, true);
+ PlayMidiSequence(g_currentMidi, true);
SetMidiVolume(mute ? 0 : _vm->_config->_musicVolume);
}
}
diff --git a/engines/tinsel/palette.cpp b/engines/tinsel/palette.cpp
index f2437bd17e..e6c9467fab 100644
--- a/engines/tinsel/palette.cpp
+++ b/engines/tinsel/palette.cpp
@@ -54,33 +54,33 @@ struct VIDEO_DAC_Q {
// FIXME: Avoid non-const global vars
/** palette allocator data */
-static PALQ palAllocData[NUM_PALETTES];
+static PALQ g_palAllocData[NUM_PALETTES];
/** video DAC transfer Q length */
#define VDACQLENGTH (NUM_PALETTES+2)
/** video DAC transfer Q */
-static VIDEO_DAC_Q vidDACdata[VDACQLENGTH];
+static VIDEO_DAC_Q g_vidDACdata[VDACQLENGTH];
/** video DAC transfer Q head pointer */
-static VIDEO_DAC_Q *pDAChead;
+static VIDEO_DAC_Q *g_pDAChead;
/** color index of the 4 colors used for the translucent palette */
#define COL_HILIGHT TBLUE1
/** the translucent palette lookup table */
-uint8 transPalette[MAX_COLORS]; // used in graphics.cpp
+uint8 g_transPalette[MAX_COLORS]; // used in graphics.cpp
-uint8 ghostPalette[MAX_COLORS];
+uint8 g_ghostPalette[MAX_COLORS];
-static int translucentIndex = 228;
+static int g_translucentIndex = 228;
-static int talkIndex = 233;
+static int g_talkIndex = 233;
-static COLORREF talkColRef;
+static COLORREF g_talkColRef;
-static COLORREF tagColRef;
+static COLORREF g_tagColRef;
#ifdef DEBUG
@@ -131,11 +131,11 @@ void psxPaletteMapper(PALQ *originalPal, uint8 *psxClut, byte *mapperTable) {
*/
void PalettesToVideoDAC() {
PALQ *pPalQ; // palette Q iterator
- VIDEO_DAC_Q *pDACtail = vidDACdata; // set tail pointer
+ VIDEO_DAC_Q *pDACtail = g_vidDACdata; // set tail pointer
byte pal[768];
// while Q is not empty
- while (pDAChead != pDACtail) {
+ while (g_pDAChead != pDACtail) {
const PALETTE *pPalette; // pointer to hardware palette
const COLORREF *pColors; // pointer to list of RGB triples
@@ -179,10 +179,10 @@ void PalettesToVideoDAC() {
}
// reset video DAC transfer Q head pointer
- pDAChead = vidDACdata;
+ g_pDAChead = g_vidDACdata;
// clear all palette moved bits
- for (pPalQ = palAllocData; pPalQ < palAllocData + NUM_PALETTES; pPalQ++)
+ for (pPalQ = g_palAllocData; pPalQ < g_palAllocData + NUM_PALETTES; pPalQ++)
pPalQ->posInDAC &= ~PALETTE_MOVED;
}
@@ -196,10 +196,10 @@ void ResetPalAllocator() {
#endif
// wipe out the palette allocator data
- memset(palAllocData, 0, sizeof(palAllocData));
+ memset(g_palAllocData, 0, sizeof(g_palAllocData));
// reset video DAC transfer Q head pointer
- pDAChead = vidDACdata;
+ g_pDAChead = g_vidDACdata;
}
#ifdef DEBUG
@@ -220,19 +220,19 @@ void PaletteStats() {
*/
void UpdateDACqueueHandle(int posInDAC, int numColors, SCNHANDLE hPalette) {
// check Q overflow
- assert(pDAChead < vidDACdata + VDACQLENGTH);
+ assert(g_pDAChead < g_vidDACdata + VDACQLENGTH);
- pDAChead->destDACindex = posInDAC & ~PALETTE_MOVED; // set index in video DAC
- pDAChead->numColors = numColors; // set number of colors
- pDAChead->pal.hRGBarray = hPalette; // set handle of palette
- pDAChead->bHandle = true; // we are using a palette handle
+ g_pDAChead->destDACindex = posInDAC & ~PALETTE_MOVED; // set index in video DAC
+ g_pDAChead->numColors = numColors; // set number of colors
+ g_pDAChead->pal.hRGBarray = hPalette; // set handle of palette
+ g_pDAChead->bHandle = true; // we are using a palette handle
// update head pointer
- ++pDAChead;
+ ++g_pDAChead;
#ifdef DEBUG
- if ((pDAChead-vidDACdata) > maxDACQ)
- maxDACQ = pDAChead-vidDACdata;
+ if ((g_pDAChead-g_vidDACdata) > maxDACQ)
+ maxDACQ = g_pDAChead-g_vidDACdata;
#endif
}
@@ -244,22 +244,22 @@ void UpdateDACqueueHandle(int posInDAC, int numColors, SCNHANDLE hPalette) {
*/
void UpdateDACqueue(int posInDAC, int numColors, COLORREF *pColors) {
// check Q overflow
- assert(pDAChead < vidDACdata + NUM_PALETTES);
+ assert(g_pDAChead < g_vidDACdata + NUM_PALETTES);
- pDAChead->destDACindex = posInDAC & ~PALETTE_MOVED; // set index in video DAC
- pDAChead->numColors = numColors; // set number of colors
+ g_pDAChead->destDACindex = posInDAC & ~PALETTE_MOVED; // set index in video DAC
+ g_pDAChead->numColors = numColors; // set number of colors
if (numColors == 1)
- pDAChead->pal.singleRGB = *pColors; // set single color of which the "palette" consists
+ g_pDAChead->pal.singleRGB = *pColors; // set single color of which the "palette" consists
else
- pDAChead->pal.pRGBarray = pColors; // set addr of palette
- pDAChead->bHandle = false; // we are not using a palette handle
+ g_pDAChead->pal.pRGBarray = pColors; // set addr of palette
+ g_pDAChead->bHandle = false; // we are not using a palette handle
// update head pointer
- ++pDAChead;
+ ++g_pDAChead;
#ifdef DEBUG
- if ((pDAChead-vidDACdata) > maxDACQ)
- maxDACQ = pDAChead-vidDACdata;
+ if ((g_pDAChead-g_vidDACdata) > maxDACQ)
+ maxDACQ = g_pDAChead-g_vidDACdata;
#endif
}
@@ -271,19 +271,19 @@ void UpdateDACqueue(int posInDAC, int numColors, COLORREF *pColors) {
*/
void UpdateDACqueue(int posInDAC, COLORREF color) {
// check Q overflow
- assert(pDAChead < vidDACdata + NUM_PALETTES);
+ assert(g_pDAChead < g_vidDACdata + NUM_PALETTES);
- pDAChead->destDACindex = posInDAC & ~PALETTE_MOVED; // set index in video DAC
- pDAChead->numColors = 1; // set number of colors
- pDAChead->pal.singleRGB = color; // set single color of which the "palette" consists
- pDAChead->bHandle = false; // we are not using a palette handle
+ g_pDAChead->destDACindex = posInDAC & ~PALETTE_MOVED; // set index in video DAC
+ g_pDAChead->numColors = 1; // set number of colors
+ g_pDAChead->pal.singleRGB = color; // set single color of which the "palette" consists
+ g_pDAChead->bHandle = false; // we are not using a palette handle
// update head pointer
- ++pDAChead;
+ ++g_pDAChead;
#ifdef DEBUG
- if ((pDAChead-vidDACdata) > maxDACQ)
- maxDACQ = pDAChead-vidDACdata;
+ if ((g_pDAChead-g_vidDACdata) > maxDACQ)
+ maxDACQ = g_pDAChead-g_vidDACdata;
#endif
}
@@ -301,7 +301,7 @@ PALQ *AllocPalette(SCNHANDLE hNewPal) {
pNewPal = (PALETTE *)LockMem(hNewPal);
// search all structs in palette allocator - see if palette already allocated
- for (p = palAllocData; p < palAllocData + NUM_PALETTES; p++) {
+ for (p = g_palAllocData; p < g_palAllocData + NUM_PALETTES; p++) {
if (p->hPal == hNewPal) {
// found the desired palette in palette allocator
p->objCount++; // update number of objects using palette
@@ -312,7 +312,7 @@ PALQ *AllocPalette(SCNHANDLE hNewPal) {
// search all structs in palette allocator - find a free slot
iDAC = FGND_DAC_INDEX; // init DAC index to first available foreground color
- for (p = palAllocData; p < palAllocData + NUM_PALETTES; p++) {
+ for (p = g_palAllocData; p < g_palAllocData + NUM_PALETTES; p++) {
if (p->hPal == 0) {
// found a free slot in palette allocator
p->objCount = 1; // init number of objects using palette
@@ -337,7 +337,7 @@ PALQ *AllocPalette(SCNHANDLE hNewPal) {
UpdateDACqueueHandle(p->posInDAC, p->numColors, p->hPal);
// move all palettes after this one down (if necessary)
- for (pPrev = p, pNxtPal = pPrev + 1; pNxtPal < palAllocData + NUM_PALETTES; pNxtPal++) {
+ for (pPrev = p, pNxtPal = pPrev + 1; pNxtPal < g_palAllocData + NUM_PALETTES; pNxtPal++) {
if (pNxtPal->hPal != 0) {
// palette slot is in use
if (pNxtPal->posInDAC >= pPrev->posInDAC + pPrev->numColors)
@@ -381,7 +381,7 @@ PALQ *AllocPalette(SCNHANDLE hNewPal) {
*/
void FreePalette(PALQ *pFreePal) {
// validate palette Q pointer
- assert(pFreePal >= palAllocData && pFreePal <= palAllocData + NUM_PALETTES - 1);
+ assert(pFreePal >= g_palAllocData && pFreePal <= g_palAllocData + NUM_PALETTES - 1);
// reduce the palettes object reference count
pFreePal->objCount--;
@@ -408,7 +408,7 @@ PALQ *FindPalette(SCNHANDLE hSrchPal) {
PALQ *pPal; // palette allocator iterator
// search all structs in palette allocator
- for (pPal = palAllocData; pPal < palAllocData + NUM_PALETTES; pPal++) {
+ for (pPal = g_palAllocData; pPal < g_palAllocData + NUM_PALETTES; pPal++) {
if (pPal->hPal == hSrchPal)
// found palette in palette allocator
return pPal;
@@ -428,7 +428,7 @@ void SwapPalette(PALQ *pPalQ, SCNHANDLE hNewPal) {
PALETTE *pNewPal = (PALETTE *)LockMem(hNewPal);
// validate palette Q pointer
- assert(pPalQ >= palAllocData && pPalQ <= palAllocData + NUM_PALETTES - 1);
+ assert(pPalQ >= g_palAllocData && pPalQ <= g_palAllocData + NUM_PALETTES - 1);
if (pPalQ->numColors >= (int)FROM_LE_32(pNewPal->numColors)) {
// new palette will fit the slot
@@ -455,7 +455,7 @@ void SwapPalette(PALQ *pPalQ, SCNHANDLE hNewPal) {
PALQ *pNxtPalQ; // next palette queue position
- for (pNxtPalQ = pPalQ + 1; pNxtPalQ < palAllocData + NUM_PALETTES; pNxtPalQ++) {
+ for (pNxtPalQ = pPalQ + 1; pNxtPalQ < g_palAllocData + NUM_PALETTES; pNxtPalQ++) {
if (pNxtPalQ->posInDAC >= pPalQ->posInDAC + pPalQ->numColors)
// no need to move palettes down
break;
@@ -482,14 +482,14 @@ void SwapPalette(PALQ *pPalQ, SCNHANDLE hNewPal) {
PALQ *GetNextPalette(PALQ *pStrtPal) {
if (pStrtPal == NULL) {
// start of palette iteration - return 1st palette
- return (palAllocData[0].objCount) ? palAllocData : NULL;
+ return (g_palAllocData[0].objCount) ? g_palAllocData : NULL;
}
// validate palette Q pointer
- assert(pStrtPal >= palAllocData && pStrtPal <= palAllocData + NUM_PALETTES - 1);
+ assert(pStrtPal >= g_palAllocData && pStrtPal <= g_palAllocData + NUM_PALETTES - 1);
// return next active palette in list
- while (++pStrtPal < palAllocData + NUM_PALETTES) {
+ while (++pStrtPal < g_palAllocData + NUM_PALETTES) {
if (pStrtPal->objCount)
// active palette found
return pStrtPal;
@@ -515,7 +515,7 @@ void SetBgndColor(COLORREF color) {
*/
void FadingPalette(PALQ *pPalQ, bool bFading) {
// validate palette Q pointer
- assert(pPalQ >= palAllocData && pPalQ <= palAllocData + NUM_PALETTES - 1);
+ assert(pPalQ >= g_palAllocData && pPalQ <= g_palAllocData + NUM_PALETTES - 1);
// validate that this is a change
assert(pPalQ->bFading != bFading);
@@ -530,7 +530,7 @@ void FadingPalette(PALQ *pPalQ, bool bFading) {
void NoFadingPalettes() {
PALQ *pPalQ;
- for (pPalQ = palAllocData; pPalQ <= palAllocData + NUM_PALETTES - 1; pPalQ++) {
+ for (pPalQ = g_palAllocData; pPalQ <= g_palAllocData + NUM_PALETTES - 1; pPalQ++) {
pPalQ->bFading = false;
}
}
@@ -544,7 +544,7 @@ void CreateTranslucentPalette(SCNHANDLE hPalette) {
PALETTE *pPal = (PALETTE *)LockMem(hPalette);
// leave background color alone
- transPalette[0] = 0;
+ g_transPalette[0] = 0;
for (uint i = 0; i < FROM_LE_32(pPal->numColors); i++) {
// get the RGB color model values
@@ -558,7 +558,7 @@ void CreateTranslucentPalette(SCNHANDLE hPalette) {
// map the Value field to one of the 4 colors reserved for the translucent palette
val /= 63;
- transPalette[i + 1] = (uint8)((val == 0) ? 0 : val +
+ g_transPalette[i + 1] = (uint8)((val == 0) ? 0 : val +
(TinselV2 ? TranslucentColor() : COL_HILIGHT) - 1);
}
}
@@ -572,7 +572,7 @@ void CreateGhostPalette(SCNHANDLE hPalette) {
int i;
// leave background color alone
- ghostPalette[0] = 0;
+ g_ghostPalette[0] = 0;
for (i = 0; i < (int)FROM_LE_32(pPal->numColors); i++) {
// get the RGB color model values
@@ -587,7 +587,7 @@ void CreateGhostPalette(SCNHANDLE hPalette) {
// map the Value field to one of the 4 colors reserved for the translucent palette
val /= 64;
assert(/*val >= 0 &&*/ val <= 3);
- ghostPalette[i + 1] = (uint8)(val + SysVar(ISV_GHOST_BASE));
+ g_ghostPalette[i + 1] = (uint8)(val + SysVar(ISV_GHOST_BASE));
}
}
@@ -648,41 +648,41 @@ void DimPartPalette(SCNHANDLE hDimPal, int startColor, int length, int brightnes
}
int TranslucentColor() {
- return translucentIndex;
+ return g_translucentIndex;
}
int HighlightColor() {
- UpdateDACqueue(talkIndex, (COLORREF)SysVar(SYS_HighlightRGB));
+ UpdateDACqueue(g_talkIndex, (COLORREF)SysVar(SYS_HighlightRGB));
- return talkIndex;
+ return g_talkIndex;
}
int TalkColor() {
- return TinselV2 ? talkIndex : TALKFONT_COL;
+ return TinselV2 ? g_talkIndex : TALKFONT_COL;
}
void SetTalkColorRef(COLORREF colRef) {
- talkColRef = colRef;
+ g_talkColRef = colRef;
}
COLORREF GetTalkColorRef() {
- return talkColRef;
+ return g_talkColRef;
}
void SetTagColorRef(COLORREF colRef) {
- tagColRef = colRef;
+ g_tagColRef = colRef;
}
COLORREF GetTagColorRef() {
- return tagColRef;
+ return g_tagColRef;
}
void SetTranslucencyOffset(int offset) {
- translucentIndex = offset;
+ g_translucentIndex = offset;
}
void SetTalkTextOffset(int offset) {
- talkIndex = offset;
+ g_talkIndex = offset;
}
} // End of namespace Tinsel
diff --git a/engines/tinsel/pcode.cpp b/engines/tinsel/pcode.cpp
index 2ab1e653d4..145a6a8e5d 100644
--- a/engines/tinsel/pcode.cpp
+++ b/engines/tinsel/pcode.cpp
@@ -100,19 +100,19 @@ enum OPCODE {
#define OPMASK 0x3F ///< mask to isolate the opcode
-bool bNoPause = false;
+bool g_bNoPause = false;
//----------------- LOCAL GLOBAL DATA --------------------
// FIXME: Avoid non-const global vars
-static int32 *pGlobals = 0; // global vars
+static int32 *g_pGlobals = 0; // global vars
-static int numGlobals = 0; // How many global variables to save/restore
+static int g_numGlobals = 0; // How many global variables to save/restore
-static INT_CONTEXT *icList = 0;
+static INT_CONTEXT *g_icList = 0;
-static uint32 hMasterScript;
+static uint32 g_hMasterScript;
//----------------- SCRIPT BUGS WORKAROUNDS --------------
@@ -227,7 +227,7 @@ void LockCode(INT_CONTEXT *ic) {
if (ic->GSort == GS_MASTER) {
if (TinselV2)
// Get the srcipt handle from a specific global chunk
- ic->code = (byte *)LockMem(hMasterScript);
+ ic->code = (byte *)LockMem(g_hMasterScript);
else
ic->code = (byte *)FindChunk(MASTER_SCNHANDLE, CHUNK_PCODE);
} else
@@ -241,7 +241,7 @@ static INT_CONTEXT *AllocateInterpretContext(GSORT gsort) {
INT_CONTEXT *pic;
int i;
- for (i = 0, pic = icList; i < NUM_INTERPRET; i++, pic++) {
+ for (i = 0, pic = g_icList; i < NUM_INTERPRET; i++, pic++) {
if (pic->GSort == GS_NONE) {
pic->pProc = g_scheduler->getCurrentProcess();
pic->GSort = gsort;
@@ -264,8 +264,8 @@ static void FreeWaitCheck(PINT_CONTEXT pic, bool bVoluntary) {
// Is this waiting for something?
if (pic->waitNumber1) {
for (i = 0; i < NUM_INTERPRET; i++) {
- if ((icList + i)->waitNumber2 == pic->waitNumber1) {
- (icList + i)->waitNumber2 = 0;
+ if ((g_icList + i)->waitNumber2 == pic->waitNumber1) {
+ (g_icList + i)->waitNumber2 = 0;
break;
}
}
@@ -274,10 +274,10 @@ static void FreeWaitCheck(PINT_CONTEXT pic, bool bVoluntary) {
// Is someone waiting for this?
if (pic->waitNumber2) {
for (i = 0; i < NUM_INTERPRET; i++) {
- if ((icList + i)->waitNumber1 == pic->waitNumber2) {
- (icList + i)->waitNumber1 = 0;
- (icList + i)->resumeCode = bVoluntary ? RES_FINISHED : RES_CUTSHORT;
- g_scheduler->reschedule((icList + i)->pProc);
+ if ((g_icList + i)->waitNumber1 == pic->waitNumber2) {
+ (g_icList + i)->waitNumber1 = 0;
+ (g_icList + i)->resumeCode = bVoluntary ? RES_FINISHED : RES_CUTSHORT;
+ g_scheduler->reschedule((g_icList + i)->pProc);
break;
}
}
@@ -305,7 +305,7 @@ void FreeInterpretContextPr(PROCESS *pProc) {
INT_CONTEXT *pic;
int i;
- for (i = 0, pic = icList; i < NUM_INTERPRET; i++, pic++) {
+ for (i = 0, pic = g_icList; i < NUM_INTERPRET; i++, pic++) {
if (pic->GSort != GS_NONE && pic->pProc == pProc) {
FreeWaitCheck(pic, false);
if (TinselV2)
@@ -323,7 +323,7 @@ void FreeMostInterpretContexts() {
INT_CONTEXT *pic;
int i;
- for (i = 0, pic = icList; i < NUM_INTERPRET; i++, pic++) {
+ for (i = 0, pic = g_icList; i < NUM_INTERPRET; i++, pic++) {
if ((pic->GSort != GS_MASTER) && (pic->GSort != GS_GPROCESS)) {
memset(pic, 0, sizeof(INT_CONTEXT));
pic->GSort = GS_NONE;
@@ -338,7 +338,7 @@ void FreeMasterInterpretContext() {
INT_CONTEXT *pic;
int i;
- for (i = 0, pic = icList; i < NUM_INTERPRET; i++, pic++) {
+ for (i = 0, pic = g_icList; i < NUM_INTERPRET; i++, pic++) {
if ((pic->GSort == GS_MASTER) || (pic->GSort == GS_GPROCESS)) {
memset(pic, 0, sizeof(INT_CONTEXT));
pic->GSort = GS_NONE;
@@ -405,30 +405,30 @@ INT_CONTEXT *RestoreInterpretContext(INT_CONTEXT *ric) {
* Allocates enough RAM to hold the global Glitter variables.
*/
void RegisterGlobals(int num) {
- if (pGlobals == NULL) {
- numGlobals = num;
+ if (g_pGlobals == NULL) {
+ g_numGlobals = num;
- hMasterScript = !TinselV2 ? 0 :
+ g_hMasterScript = !TinselV2 ? 0 :
READ_LE_UINT32(FindChunk(MASTER_SCNHANDLE, CHUNK_MASTER_SCRIPT));
// Allocate RAM for pGlobals and make sure it's allocated
- pGlobals = (int32 *)calloc(numGlobals, sizeof(int32));
- if (pGlobals == NULL) {
+ g_pGlobals = (int32 *)calloc(g_numGlobals, sizeof(int32));
+ if (g_pGlobals == NULL) {
error("Cannot allocate memory for global data");
}
// Allocate RAM for interpret contexts and make sure it's allocated
- icList = (INT_CONTEXT *)calloc(NUM_INTERPRET, sizeof(INT_CONTEXT));
- if (icList == NULL) {
+ g_icList = (INT_CONTEXT *)calloc(NUM_INTERPRET, sizeof(INT_CONTEXT));
+ if (g_icList == NULL) {
error("Cannot allocate memory for interpret contexts");
}
g_scheduler->setResourceCallback(FreeInterpretContextPr);
} else {
// Check size is still the same
- assert(numGlobals == num);
+ assert(g_numGlobals == num);
- memset(pGlobals, 0, numGlobals * sizeof(int32));
- memset(icList, 0, NUM_INTERPRET * sizeof(INT_CONTEXT));
+ memset(g_pGlobals, 0, g_numGlobals * sizeof(int32));
+ memset(g_icList, 0, NUM_INTERPRET * sizeof(INT_CONTEXT));
}
if (TinselV2) {
@@ -444,7 +444,7 @@ void RegisterGlobals(int num) {
error(FILE_IS_CORRUPT, GLOBALS_FILENAME);
for (int i = 0; i < length; ++i)
- pGlobals[i] = f.readSint32LE();
+ g_pGlobals[i] = f.readSint32LE();
if (f.eos() || f.err())
error(FILE_IS_CORRUPT, GLOBALS_FILENAME);
@@ -454,19 +454,19 @@ void RegisterGlobals(int num) {
}
void FreeGlobals() {
- free(pGlobals);
- pGlobals = NULL;
+ free(g_pGlobals);
+ g_pGlobals = NULL;
- free(icList);
- icList = NULL;
+ free(g_icList);
+ g_icList = NULL;
}
/**
* (Un)serialize the global data for save/restore game.
*/
void syncGlobInfo(Common::Serializer &s) {
- for (int i = 0; i < numGlobals; i++) {
- s.syncAsSint32LE(pGlobals[i]);
+ for (int i = 0; i < g_numGlobals; i++) {
+ s.syncAsSint32LE(g_pGlobals[i]);
}
}
@@ -502,7 +502,7 @@ void INT_CONTEXT::syncWithSerializer(Common::Serializer &s) {
* Return pointer to and size of global data for save/restore game.
*/
void SaveInterpretContexts(INT_CONTEXT *sICInfo) {
- memcpy(sICInfo, icList, NUM_INTERPRET * sizeof(INT_CONTEXT));
+ memcpy(sICInfo, g_icList, NUM_INTERPRET * sizeof(INT_CONTEXT));
}
/**
@@ -633,8 +633,8 @@ void Interpret(CORO_PARAM, INT_CONTEXT *ic) {
case OP_GLOAD: // loads global variable onto stack
tmp = Fetch(opcode, ic->code, wkEntry, ip);
- assert(0 <= tmp && tmp < numGlobals);
- ic->stack[++ic->sp] = pGlobals[tmp];
+ assert(0 <= tmp && tmp < g_numGlobals);
+ ic->stack[++ic->sp] = g_pGlobals[tmp];
break;
case OP_STORE: // pops stack and stores in local variable
@@ -645,8 +645,8 @@ void Interpret(CORO_PARAM, INT_CONTEXT *ic) {
case OP_GSTORE: // pops stack and stores in global variable
tmp = Fetch(opcode, ic->code, wkEntry, ip);
- assert(0 <= tmp && tmp < numGlobals);
- pGlobals[tmp] = ic->stack[ic->sp--];
+ assert(0 <= tmp && tmp < g_numGlobals);
+ g_pGlobals[tmp] = ic->stack[ic->sp--];
break;
case OP_CALL: // procedure call
@@ -809,7 +809,7 @@ void Interpret(CORO_PARAM, INT_CONTEXT *ic) {
break;
case OP_ESCON:
- bNoPause = true;
+ g_bNoPause = true;
ic->escOn = true;
ic->myEscape = GetEscEvents();
break;
@@ -856,8 +856,8 @@ static uint32 UniqueWaitNumber() {
retval = (uint32)-1;
for (i = 0; i < NUM_INTERPRET; i++) {
- if ((icList+i)->waitNumber1 == retval
- || (icList+i)->waitNumber2 == retval)
+ if ((g_icList+i)->waitNumber1 == retval
+ || (g_icList+i)->waitNumber2 == retval)
break;
}
@@ -887,7 +887,7 @@ void WaitInterpret(CORO_PARAM, PPROCESS pWaitProc, bool *result) {
CORO_BEGIN_CODE(_ctx);
- for (i = 0, _ctx->picWaiter = icList; i < NUM_INTERPRET; i++, _ctx->picWaiter++) {
+ for (i = 0, _ctx->picWaiter = g_icList; i < NUM_INTERPRET; i++, _ctx->picWaiter++) {
if (_ctx->picWaiter->GSort != GS_NONE && _ctx->picWaiter->pProc == currentProcess) {
break;
}
@@ -896,7 +896,7 @@ void WaitInterpret(CORO_PARAM, PPROCESS pWaitProc, bool *result) {
/*
* Find the interpret context of the process we're waiting for
*/
- for (i = 0, _ctx->picWaitee = icList; i < NUM_INTERPRET; i++, _ctx->picWaitee++) {
+ for (i = 0, _ctx->picWaitee = g_icList; i < NUM_INTERPRET; i++, _ctx->picWaitee++) {
if (_ctx->picWaitee->GSort != GS_NONE && _ctx->picWaitee->pProc == pWaitProc) {
break;
}
@@ -931,11 +931,11 @@ void CheckOutWaiters() {
// Check all waited for have someone waiting
for (i = 0; i < NUM_INTERPRET; i++) {
// If someone is supposedly waiting for this one
- if ((icList + i)->GSort != GS_NONE && (icList + i)->waitNumber2) {
+ if ((g_icList + i)->GSort != GS_NONE && (g_icList + i)->waitNumber2) {
// Someone really must be waiting for this one
for (j = 0; j < NUM_INTERPRET; j++) {
- if ((icList + j)->GSort != GS_NONE
- && (icList + j)->waitNumber1 == (icList + i)->waitNumber2) {
+ if ((g_icList + j)->GSort != GS_NONE
+ && (g_icList + j)->waitNumber1 == (g_icList + i)->waitNumber2) {
break;
}
}
@@ -946,11 +946,11 @@ void CheckOutWaiters() {
// Check waiting for someone to wait for
for (i = 0; i < NUM_INTERPRET; i++) {
// If someone is supposedly waiting for this one
- if ((icList + i)->GSort != GS_NONE && (icList + i)->waitNumber1) {
+ if ((g_icList + i)->GSort != GS_NONE && (g_icList + i)->waitNumber1) {
// Someone really must be waiting for this one
for (j = 0; j < NUM_INTERPRET; j++) {
- if ((icList + j)->GSort != GS_NONE
- && (icList + j)->waitNumber2 == (icList + i)->waitNumber1) {
+ if ((g_icList + j)->GSort != GS_NONE
+ && (g_icList + j)->waitNumber2 == (g_icList + i)->waitNumber1) {
break;
}
}
diff --git a/engines/tinsel/pdisplay.cpp b/engines/tinsel/pdisplay.cpp
index 7439c6f77d..9a9e6ab00f 100644
--- a/engines/tinsel/pdisplay.cpp
+++ b/engines/tinsel/pdisplay.cpp
@@ -50,7 +50,7 @@ namespace Tinsel {
#ifdef DEBUG
//extern int Overrun; // The overrun counter, in DOS_DW.C
-extern int newestString; // The overrun counter, in STRRES.C
+extern int g_newestString; // The overrun counter, in STRRES.C
#endif
@@ -73,17 +73,17 @@ enum HotSpotTag {
// FIXME: Avoid non-const global vars
-static bool DispPath = false;
-static bool bShowString = false;
+static bool g_DispPath = false;
+static bool g_bShowString = false;
-static int TaggedActor = 0;
-static HPOLYGON hTaggedPolygon = NOPOLY;
+static int g_TaggedActor = 0;
+static HPOLYGON g_hTaggedPolygon = NOPOLY;
-static bool bTagsActive = true;
+static bool g_bTagsActive = true;
-static bool bPointingActive = true;
+static bool g_bPointingActive = true;
-static char tagBuffer[64];
+static char g_tagBuffer[64];
#ifdef DEBUG
/**
@@ -158,7 +158,7 @@ void CursorPositionProcess(CORO_PARAM, const void *) {
sprintf(PositionString, "%d %d", aniX + Loffset, aniY + Toffset);
_ctx->cpText = ObjectTextOut(GetPlayfieldList(FIELD_STATUS), PositionString,
0, CPOSX, POSY, GetTagFontHandle(), TXT_CENTER);
- if (DispPath) {
+ if (g_DispPath) {
HPOLYGON hp = InPolygon(aniX + Loffset, aniY + Toffset, PATH);
if (hp == NOPOLY)
sprintf(PositionString, "No path");
@@ -226,18 +226,18 @@ void CursorPositionProcess(CORO_PARAM, const void *) {
/*-------------*\
| String number |
\*-------------*/
- if (bShowString && newestString != _ctx->prevString) {
+ if (g_bShowString && g_newestString != _ctx->prevString) {
// kill current text objects
if (_ctx->spText) {
MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), _ctx->spText);
}
- sprintf(PositionString, "String: %d", newestString);
+ sprintf(PositionString, "String: %d", g_newestString);
_ctx->spText = ObjectTextOut(GetPlayfieldList(FIELD_STATUS), PositionString,
0, SPOSX, POSY+10, GetTalkFontHandle(), TXT_CENTER);
// update previous value
- _ctx->prevString = newestString;
+ _ctx->prevString = g_newestString;
}
// update previous playfield position
@@ -257,7 +257,7 @@ void DisablePointing() {
int i;
HPOLYGON hPoly; // Polygon handle
- bPointingActive = false;
+ g_bPointingActive = false;
for (i = 0; i < MAX_POLY; i++) {
hPoly = GetPolyHandle(i);
@@ -284,7 +284,7 @@ void DisablePointing() {
* EnablePointing()
*/
void EnablePointing() {
- bPointingActive = true;
+ g_bPointingActive = true;
}
/**
@@ -292,7 +292,7 @@ void EnablePointing() {
* (if one is). Tag process asks us for this information, as does ProcessUserEvent().
*/
static void SaveTaggedActor(int ano) {
- TaggedActor = ano;
+ g_TaggedActor = ano;
}
/**
@@ -300,7 +300,7 @@ static void SaveTaggedActor(int ano) {
* (if one is). Tag process asks us for this information, as does ProcessUserEvent().
*/
int GetTaggedActor() {
- return TaggedActor;
+ return g_TaggedActor;
}
/**
@@ -308,11 +308,11 @@ int GetTaggedActor() {
* (if one is). Tag process asks us for this information, as does ProcessUserEvent().
*/
static void SaveTaggedPoly(HPOLYGON hp) {
- hTaggedPolygon = hp;
+ g_hTaggedPolygon = hp;
}
HPOLYGON GetTaggedPoly() {
- return hTaggedPolygon;
+ return g_hTaggedPolygon;
}
/**
@@ -405,11 +405,11 @@ static bool ActorTag(int curX, int curY, HotSpotTag *pTag, OBJECT **ppText) {
if (ActorTagIsWanted(actor)) {
GetActorTagPos(actor, &tagX, &tagY, false);
- LoadStringRes(GetActorTagHandle(actor), tagBuffer, sizeof(tagBuffer));
+ LoadStringRes(GetActorTagHandle(actor), g_tagBuffer, sizeof(g_tagBuffer));
// May have buggered cursor
EndCursorFollowed();
- *ppText = ObjectTextOut(GetPlayfieldList(FIELD_STATUS), tagBuffer,
+ *ppText = ObjectTextOut(GetPlayfieldList(FIELD_STATUS), g_tagBuffer,
0, tagX, tagY, GetTagFontHandle(), TXT_CENTER, 0);
assert(*ppText);
MultiSetZPosition(*ppText, Z_TAG_TEXT);
@@ -653,7 +653,7 @@ void TagProcess(CORO_PARAM, const void *) {
SaveTaggedPoly(NOPOLY); // No tagged polygon yet
while (1) {
- if (bTagsActive) {
+ if (g_bTagsActive) {
int curX, curY; // cursor position
while (!GetCursorXYNoWait(&curX, &curY, true))
CORO_SLEEP(1);
@@ -804,7 +804,7 @@ void PointProcess(CORO_PARAM, const void *) {
// allow re-scheduling
do {
CORO_SLEEP(1);
- } while (!bPointingActive);
+ } while (!g_bPointingActive);
} else {
// allow re-scheduling
CORO_SLEEP(1);
@@ -815,15 +815,15 @@ void PointProcess(CORO_PARAM, const void *) {
}
void DisableTags() {
- bTagsActive = false;
+ g_bTagsActive = false;
}
void EnableTags() {
- bTagsActive = true;
+ g_bTagsActive = true;
}
bool DisableTagsIfEnabled() {
- if (bTagsActive) {
+ if (g_bTagsActive) {
DisableTags();
return true;
} else
@@ -836,12 +836,12 @@ bool DisableTagsIfEnabled() {
* cursor is in.
*/
void TogglePathDisplay() {
- DispPath ^= 1; // Toggle path display (XOR with true)
+ g_DispPath ^= 1; // Toggle path display (XOR with true)
}
void setshowstring() {
- bShowString = true;
+ g_bShowString = true;
}
} // End of namespace Tinsel
diff --git a/engines/tinsel/play.cpp b/engines/tinsel/play.cpp
index 71e07721a6..40729d9f3a 100644
--- a/engines/tinsel/play.cpp
+++ b/engines/tinsel/play.cpp
@@ -62,10 +62,10 @@ struct PPINIT {
// FIXME: Avoid non-const global vars
-static SOUNDREELS soundReels[MAX_SOUNDREELS];
-static int soundReelNumbers[MAX_SOUNDREELS];
+static SOUNDREELS g_soundReels[MAX_SOUNDREELS];
+static int g_soundReelNumbers[MAX_SOUNDREELS];
-static int soundReelWait;
+static int g_soundReelWait;
//-------------------- METHODS ----------------------
@@ -148,31 +148,31 @@ static int RegisterSoundReel(SCNHANDLE hFilm, int column, int actorCol) {
for (i = 0; i < MAX_SOUNDREELS; i++) {
// Should assert this doesn't happen, but let's be tolerant
- if (soundReels[i].hFilm == hFilm && soundReels[i].column == column)
+ if (g_soundReels[i].hFilm == hFilm && g_soundReels[i].column == column)
break;
- if (!soundReels[i].hFilm) {
- soundReels[i].hFilm = hFilm;
- soundReels[i].column = column;
- soundReels[i].actorCol = actorCol;
+ if (!g_soundReels[i].hFilm) {
+ g_soundReels[i].hFilm = hFilm;
+ g_soundReels[i].column = column;
+ g_soundReels[i].actorCol = actorCol;
break;
}
}
- soundReelNumbers[i]++;
+ g_soundReelNumbers[i]++;
return i;
}
void NoSoundReels() {
- memset(soundReels, 0, sizeof(soundReels));
- soundReelWait = 0;
+ memset(g_soundReels, 0, sizeof(g_soundReels));
+ g_soundReelWait = 0;
}
static void DeRegisterSoundReel(SCNHANDLE hFilm, int column) {
for (int i = 0; i < MAX_SOUNDREELS; i++) {
// Should assert this doesn't happen, but let's be tolerant
- if (soundReels[i].hFilm == hFilm && soundReels[i].column == column) {
- soundReels[i].hFilm = 0;
+ if (g_soundReels[i].hFilm == hFilm && g_soundReels[i].column == column) {
+ g_soundReels[i].hFilm = 0;
break;
}
}
@@ -180,15 +180,15 @@ static void DeRegisterSoundReel(SCNHANDLE hFilm, int column) {
void SaveSoundReels(PSOUNDREELS psr) {
for (int i = 0; i < MAX_SOUNDREELS; i++) {
- if (IsCdPlayHandle(soundReels[i].hFilm))
- soundReels[i].hFilm = 0;
+ if (IsCdPlayHandle(g_soundReels[i].hFilm))
+ g_soundReels[i].hFilm = 0;
}
- memcpy(psr, soundReels, sizeof(soundReels));
+ memcpy(psr, g_soundReels, sizeof(g_soundReels));
}
void RestoreSoundReels(PSOUNDREELS psr) {
- memcpy(soundReels, psr, sizeof(soundReels));
+ memcpy(g_soundReels, psr, sizeof(g_soundReels));
}
static uint32 GetZfactor(int actorID, PMOVER pMover, bool bNewMover) {
@@ -245,7 +245,7 @@ static void SoundReel(CORO_PARAM, SCNHANDLE hFilm, int column, int speed,
_ctx->bFinished = false;
_ctx->bLooped = false;
_ctx->myId = RegisterSoundReel(hFilm, column, actorCol);
- _ctx->myNum = soundReelNumbers[_ctx->myId];
+ _ctx->myNum = g_soundReelNumbers[_ctx->myId];
do {
pFilm = (FILM *)LockMem(hFilm);
@@ -366,10 +366,10 @@ static void SoundReel(CORO_PARAM, SCNHANDLE hFilm, int column, int speed,
_ctx->bFinished = true;
}
- } while (!_ctx->bFinished && _ctx->myNum == soundReelNumbers[_ctx->myId]);
+ } while (!_ctx->bFinished && _ctx->myNum == g_soundReelNumbers[_ctx->myId]);
// De-register - if not been replaced
- if (_ctx->myNum == soundReelNumbers[_ctx->myId])
+ if (_ctx->myNum == g_soundReelNumbers[_ctx->myId])
DeRegisterSoundReel(hFilm, column);
CORO_END_CODE;
@@ -384,17 +384,17 @@ static void ResSoundReel(CORO_PARAM, const void *param) {
CORO_BEGIN_CODE(_ctx);
- CORO_INVOKE_ARGS(SoundReel, (CORO_SUBCTX, soundReels[i].hFilm, soundReels[i].column,
- -1, 0, soundReels[i].actorCol));
+ CORO_INVOKE_ARGS(SoundReel, (CORO_SUBCTX, g_soundReels[i].hFilm, g_soundReels[i].column,
+ -1, 0, g_soundReels[i].actorCol));
CORO_KILL_SELF();
CORO_END_CODE;
}
static void SoundReelWaitCheck() {
- if (--soundReelWait == 0) {
+ if (--g_soundReelWait == 0) {
for (int i = 0; i < MAX_SOUNDREELS; i++) {
- if (soundReels[i].hFilm) {
+ if (g_soundReels[i].hFilm) {
g_scheduler->createProcess(PID_REEL, ResSoundReel, &i, sizeof(i));
}
}
@@ -1162,7 +1162,7 @@ void RestoreActorReels(SCNHANDLE hFilm, int actor, int x, int y) {
// Start display process for the reel
g_scheduler->createProcess(PID_REEL, PlayProcess, &ppi, sizeof(ppi));
- soundReelWait++;
+ g_soundReelWait++;
}
}
}
diff --git a/engines/tinsel/rince.cpp b/engines/tinsel/rince.cpp
index ca196aac92..bb0aeabd2f 100644
--- a/engines/tinsel/rince.cpp
+++ b/engines/tinsel/rince.cpp
@@ -51,7 +51,7 @@ namespace Tinsel {
//----------------- LOCAL GLOBAL DATA --------------------
-static MOVER Movers[MAX_MOVERS]; // FIXME: Avoid non-const global vars
+static MOVER g_Movers[MAX_MOVERS]; // FIXME: Avoid non-const global vars
//----------------- FUNCTIONS ----------------------------
@@ -115,7 +115,7 @@ void MoverBrightness(PMOVER pMover, int brightness) {
* RebootMovers
*/
void RebootMovers() {
- memset(Movers, 0, sizeof(Movers));
+ memset(g_Movers, 0, sizeof(g_Movers));
}
/**
@@ -127,11 +127,11 @@ PMOVER GetMover(int ano) {
// Slot 0 is reserved for lead actor
if (ano == GetLeadId() || ano == LEAD_ACTOR)
- return &Movers[0];
+ return &g_Movers[0];
for (i = 1; i < MAX_MOVERS; i++)
- if (Movers[i].actorID == ano)
- return &Movers[i];
+ if (g_Movers[i].actorID == ano)
+ return &g_Movers[i];
return NULL;
}
@@ -144,25 +144,25 @@ PMOVER RegisterMover(int ano) {
// Slot 0 is reserved for lead actor
if (ano == GetLeadId() || ano == LEAD_ACTOR) {
- Movers[0].actorToken = TOKEN_LEAD;
- Movers[0].actorID = GetLeadId();
- return &Movers[0];
+ g_Movers[0].actorToken = TOKEN_LEAD;
+ g_Movers[0].actorID = GetLeadId();
+ return &g_Movers[0];
}
// Check it hasn't already been declared
for (i = 1; i < MAX_MOVERS; i++) {
- if (Movers[i].actorID == ano) {
+ if (g_Movers[i].actorID == ano) {
// Actor is already a moving actor
- return &Movers[i];
+ return &g_Movers[i];
}
}
// Find an empty slot
for (i = 1; i < MAX_MOVERS; i++)
- if (!Movers[i].actorID) {
- Movers[i].actorToken = TOKEN_LEAD + i;
- Movers[i].actorID = ano;
- return &Movers[i];
+ if (!g_Movers[i].actorID) {
+ g_Movers[i].actorToken = TOKEN_LEAD + i;
+ g_Movers[i].actorID = ano;
+ return &g_Movers[i];
}
error("Too many moving actors");
@@ -176,8 +176,8 @@ PMOVER RegisterMover(int ano) {
PMOVER GetLiveMover(int index) {
assert(index >= 0 && index < MAX_MOVERS); // out of range
- if (Movers[index].bActive)
- return &Movers[index];
+ if (g_Movers[index].bActive)
+ return &g_Movers[index];
else
return NULL;
}
@@ -185,13 +185,13 @@ PMOVER GetLiveMover(int index) {
bool IsMAinEffectPoly(int index) {
assert(index >= 0 && index < MAX_MOVERS); // out of range
- return Movers[index].bInEffect;
+ return g_Movers[index].bInEffect;
}
void SetMoverInEffect(int index, bool tf) {
assert(index >= 0 && index < MAX_MOVERS); // out of range
- Movers[index].bInEffect = tf;
+ g_Movers[index].bInEffect = tf;
}
/**
@@ -392,7 +392,7 @@ static void InitMover(PMOVER pMover) {
*/
void DropMovers() {
for (int i = 0; i < MAX_MOVERS; i++)
- InitMover(&Movers[i]);
+ InitMover(&g_Movers[i]);
}
@@ -880,30 +880,30 @@ 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] ||
- (TinselV2 && (Movers[i].actorObj == NULL)) ||
- (!TinselV2 && !Movers[i].bActive))
+ if (pMover == &g_Movers[i] ||
+ (TinselV2 && (g_Movers[i].actorObj == NULL)) ||
+ (!TinselV2 && !g_Movers[i].bActive))
continue;
// At around the same height?
- GetMoverPosition(&Movers[i], &taX, &taY);
- if (Movers[i].hFnpath != NOPOLY)
+ GetMoverPosition(&g_Movers[i], &taX, &taY);
+ if (g_Movers[i].hFnpath != NOPOLY)
continue;
if (ABS(y - taY) > 2) // 2 was 8
continue;
// To the left?
- taL = GetMoverLeft(&Movers[i]);
+ taL = GetMoverLeft(&g_Movers[i]);
if (caR <= taL)
continue;
// To the right?
- taR = GetMoverRight(&Movers[i]);
+ taR = GetMoverRight(&g_Movers[i]);
if (caL >= taR)
continue;
- return &Movers[i];
+ return &g_Movers[i];
}
return NULL;
}
@@ -913,33 +913,33 @@ PMOVER InMoverBlock(PMOVER pMover, int x, int y) {
*/
void SaveMovers(SAVED_MOVER *sMoverInfo) {
for (int i = 0; i < MAX_MOVERS; i++) {
- sMoverInfo[i].bActive = !TinselV2 ? Movers[i].bActive : Movers[i].actorObj != NULL;
- sMoverInfo[i].actorID = Movers[i].actorID;
- sMoverInfo[i].objX = Movers[i].objX;
- sMoverInfo[i].objY = Movers[i].objY;
- sMoverInfo[i].hLastfilm = Movers[i].hLastFilm;
+ sMoverInfo[i].bActive = !TinselV2 ? g_Movers[i].bActive : g_Movers[i].actorObj != NULL;
+ sMoverInfo[i].actorID = g_Movers[i].actorID;
+ sMoverInfo[i].objX = g_Movers[i].objX;
+ sMoverInfo[i].objY = g_Movers[i].objY;
+ sMoverInfo[i].hLastfilm = g_Movers[i].hLastFilm;
if (TinselV2) {
- sMoverInfo[i].bHidden = Movers[i].bHidden;
- sMoverInfo[i].brightness = Movers[i].brightness;
- sMoverInfo[i].startColor = Movers[i].startColor;
- sMoverInfo[i].paletteLength = Movers[i].paletteLength;
+ sMoverInfo[i].bHidden = g_Movers[i].bHidden;
+ sMoverInfo[i].brightness = g_Movers[i].brightness;
+ sMoverInfo[i].startColor = g_Movers[i].startColor;
+ sMoverInfo[i].paletteLength = g_Movers[i].paletteLength;
}
- memcpy(sMoverInfo[i].walkReels, Movers[i].walkReels, TOTAL_SCALES * 4 * sizeof(SCNHANDLE));
- memcpy(sMoverInfo[i].standReels, Movers[i].standReels, TOTAL_SCALES * 4 * sizeof(SCNHANDLE));
- memcpy(sMoverInfo[i].talkReels, Movers[i].talkReels, TOTAL_SCALES * 4 * sizeof(SCNHANDLE));
+ memcpy(sMoverInfo[i].walkReels, g_Movers[i].walkReels, TOTAL_SCALES * 4 * sizeof(SCNHANDLE));
+ memcpy(sMoverInfo[i].standReels, g_Movers[i].standReels, TOTAL_SCALES * 4 * sizeof(SCNHANDLE));
+ memcpy(sMoverInfo[i].talkReels, g_Movers[i].talkReels, TOTAL_SCALES * 4 * sizeof(SCNHANDLE));
}
}
void RestoreAuxScales(SAVED_MOVER *sMoverInfo) {
for (int i = 0; i < MAX_MOVERS; i++) {
if (TinselV2)
- Movers[i].actorID = sMoverInfo[i].actorID;
+ g_Movers[i].actorID = sMoverInfo[i].actorID;
- memcpy(Movers[i].walkReels, sMoverInfo[i].walkReels, TOTAL_SCALES * 4 * sizeof(SCNHANDLE));
- memcpy(Movers[i].standReels, sMoverInfo[i].standReels, TOTAL_SCALES * 4 * sizeof(SCNHANDLE));
- memcpy(Movers[i].talkReels, sMoverInfo[i].talkReels, TOTAL_SCALES * 4 * sizeof(SCNHANDLE));
+ memcpy(g_Movers[i].walkReels, sMoverInfo[i].walkReels, TOTAL_SCALES * 4 * sizeof(SCNHANDLE));
+ memcpy(g_Movers[i].standReels, sMoverInfo[i].standReels, TOTAL_SCALES * 4 * sizeof(SCNHANDLE));
+ memcpy(g_Movers[i].talkReels, sMoverInfo[i].talkReels, TOTAL_SCALES * 4 * sizeof(SCNHANDLE));
}
}
@@ -950,10 +950,10 @@ PMOVER NextMover(PMOVER pMover) {
if (pMover == NULL)
next = 0;
else
- next = pMover - Movers + 1;
+ next = pMover - g_Movers + 1;
- if (Movers[next].actorID)
- return &Movers[next];
+ if (g_Movers[next].actorID)
+ return &g_Movers[next];
else
return NULL;
}
diff --git a/engines/tinsel/saveload.cpp b/engines/tinsel/saveload.cpp
index 8664cd5f15..0a552c8c2b 100644
--- a/engines/tinsel/saveload.cpp
+++ b/engines/tinsel/saveload.cpp
@@ -22,6 +22,7 @@
*/
#include "tinsel/actors.h"
+#include "tinsel/config.h"
#include "tinsel/dialogs.h"
#include "tinsel/drives.h"
#include "tinsel/dw.h"
@@ -67,9 +68,9 @@ namespace Tinsel {
//----------------- GLOBAL GLOBAL DATA --------------------
-int thingHeld = 0;
-int restoreCD = 0;
-SRSTATE SRstate = SR_IDLE;
+int g_thingHeld = 0;
+int g_restoreCD = 0;
+SRSTATE g_SRstate = SR_IDLE;
//----------------- EXTERN FUNCTIONS --------------------
@@ -82,9 +83,9 @@ extern void syncGlobInfo(Common::Serializer &s);
// in POLYGONS.C
extern void syncPolyInfo(Common::Serializer &s);
-extern int sceneCtr;
+extern int g_sceneCtr;
-extern bool ASceneIsSaved;
+extern bool g_ASceneIsSaved;
//----------------- LOCAL DEFINES --------------------
@@ -94,12 +95,14 @@ struct SaveGameHeader {
uint32 ver;
char desc[SG_DESC_LEN];
TimeDate dateTime;
+ bool scnFlag;
+ byte language;
};
enum {
DW1_SAVEGAME_ID = 0x44575399, // = 'DWSc' = "DiscWorld 1 ScummVM"
DW2_SAVEGAME_ID = 0x44573253, // = 'DW2S' = "DiscWorld 2 ScummVM"
- SAVEGAME_HEADER_SIZE = 4 + 4 + 4 + SG_DESC_LEN + 7
+ SAVEGAME_HEADER_SIZE = 4 + 4 + 4 + SG_DESC_LEN + 7 + 1 + 1
};
#define SAVEGAME_ID (TinselV2 ? (uint32)DW2_SAVEGAME_ID : (uint32)DW1_SAVEGAME_ID)
@@ -120,21 +123,23 @@ struct SFILES {
// FIXME: Avoid non-const global vars
-static int numSfiles = 0;
-static SFILES savedFiles[MAX_SAVED_FILES];
+static int g_numSfiles = 0;
+static SFILES g_savedFiles[MAX_SAVED_FILES];
-static bool NeedLoad = true;
+static bool g_NeedLoad = true;
-static SAVED_DATA *srsd = 0;
-static int RestoreGameNumber = 0;
-static char *SaveSceneName = 0;
-static const char *SaveSceneDesc = 0;
-static int *SaveSceneSsCount = 0;
-static SAVED_DATA *SaveSceneSsData = 0; // points to 'SAVED_DATA ssdata[MAX_NEST]'
+static SAVED_DATA *g_srsd = 0;
+static int g_RestoreGameNumber = 0;
+static char *g_SaveSceneName = 0;
+static const char *g_SaveSceneDesc = 0;
+static int *g_SaveSceneSsCount = 0;
+static SAVED_DATA *g_SaveSceneSsData = 0; // points to 'SAVED_DATA ssdata[MAX_NEST]'
//------------- SAVE/LOAD SUPPORT METHODS ----------------
-void setNeedLoad() { NeedLoad = true; }
+void setNeedLoad() {
+ g_NeedLoad = true;
+}
static void syncTime(Common::Serializer &s, TimeDate &t) {
s.syncAsUint16LE(t.tm_year);
@@ -166,6 +171,21 @@ static bool syncSaveGameHeader(Common::Serializer &s, SaveGameHeader &hdr) {
// Perform sanity check
if (tmp < 0 || !correctID || hdr.ver > CURRENT_VER || hdr.size > 1024)
return false;
+
+ if (tmp > 0) {
+ // If there's header space left, handling syncing the Scn flag and game language
+ s.syncAsByte(hdr.scnFlag);
+ s.syncAsByte(hdr.language);
+ tmp -= 2;
+
+ if (_vm && s.isLoading()) {
+ // If the engine is loaded, ensure the Scn/Gra usage is correct, and it's the correct language
+ if ((hdr.scnFlag != ((_vm->getFeatures() & GF_SCNFILES) != 0)) ||
+ (hdr.language != _vm->_config->_language))
+ return false;
+ }
+ }
+
// Skip over any extra bytes
s.skip(tmp);
return true;
@@ -327,18 +347,18 @@ static int cmpTimeDate(const TimeDate &a, const TimeDate &b) {
int getList(Common::SaveFileManager *saveFileMan, const Common::String &target) {
// No change since last call?
// TODO/FIXME: Just always reload this data? Be careful about slow downs!!!
- if (!NeedLoad)
- return numSfiles;
+ if (!g_NeedLoad)
+ return g_numSfiles;
int i;
const Common::String pattern = target + ".???";
Common::StringArray files = saveFileMan->listSavefiles(pattern);
- numSfiles = 0;
+ g_numSfiles = 0;
for (Common::StringArray::const_iterator file = files.begin(); file != files.end(); ++file) {
- if (numSfiles >= MAX_SAVED_FILES)
+ if (g_numSfiles >= MAX_SAVED_FILES)
break;
const Common::String &fname = *file;
@@ -358,46 +378,46 @@ int getList(Common::SaveFileManager *saveFileMan, const Common::String &target)
// "incompatible version".
}
- i = numSfiles;
+ i = g_numSfiles;
#ifndef DISABLE_SAVEGAME_SORTING
- for (i = 0; i < numSfiles; i++) {
- if (cmpTimeDate(hdr.dateTime, savedFiles[i].dateTime) > 0) {
- Common::copy_backward(&savedFiles[i], &savedFiles[numSfiles], &savedFiles[numSfiles + 1]);
+ for (i = 0; i < g_numSfiles; i++) {
+ if (cmpTimeDate(hdr.dateTime, g_savedFiles[i].dateTime) > 0) {
+ Common::copy_backward(&g_savedFiles[i], &g_savedFiles[g_numSfiles], &g_savedFiles[g_numSfiles + 1]);
break;
}
}
#endif
- Common::strlcpy(savedFiles[i].name, fname.c_str(), FNAMELEN);
- Common::strlcpy(savedFiles[i].desc, hdr.desc, SG_DESC_LEN);
- savedFiles[i].dateTime = hdr.dateTime;
+ Common::strlcpy(g_savedFiles[i].name, fname.c_str(), FNAMELEN);
+ Common::strlcpy(g_savedFiles[i].desc, hdr.desc, SG_DESC_LEN);
+ g_savedFiles[i].dateTime = hdr.dateTime;
- ++numSfiles;
+ ++g_numSfiles;
}
// Next getList() needn't do its stuff again
- NeedLoad = false;
+ g_NeedLoad = false;
- return numSfiles;
+ return g_numSfiles;
}
int getList() {
// No change since last call?
// TODO/FIXME: Just always reload this data? Be careful about slow downs!!!
- if (!NeedLoad)
- return numSfiles;
+ if (!g_NeedLoad)
+ return g_numSfiles;
return getList(_vm->getSaveFileMan(), _vm->getTargetName());
}
char *ListEntry(int i, letype which) {
if (i == -1)
- i = numSfiles;
+ i = g_numSfiles;
assert(i >= 0);
- if (i < numSfiles)
- return which == LE_NAME ? savedFiles[i].name : savedFiles[i].desc;
+ if (i < g_numSfiles)
+ return which == LE_NAME ? g_savedFiles[i].name : g_savedFiles[i].desc;
else
return NULL;
}
@@ -407,14 +427,14 @@ static void DoSync(Common::Serializer &s) {
if (TinselV2) {
if (s.isSaving())
- restoreCD = GetCurrentCD();
- s.syncAsSint16LE(restoreCD);
+ g_restoreCD = GetCurrentCD();
+ s.syncAsSint16LE(g_restoreCD);
}
if (TinselV2 && s.isLoading())
HoldItem(INV_NOICON);
- syncSavedData(s, *srsd);
+ syncSavedData(s, *g_srsd);
syncGlobInfo(s); // Glitter globals
syncInvInfo(s); // Inventory data
@@ -424,7 +444,7 @@ static void DoSync(Common::Serializer &s) {
s.syncAsSint32LE(sg);
if (s.isLoading()) {
if (TinselV2)
- thingHeld = sg;
+ g_thingHeld = sg;
else
HoldItem(sg);
}
@@ -434,17 +454,17 @@ static void DoSync(Common::Serializer &s) {
syncPolyInfo(s); // Dead polygon data
syncSCdata(s); // Hook Scene and delayed scene
- s.syncAsSint32LE(*SaveSceneSsCount);
+ s.syncAsSint32LE(*g_SaveSceneSsCount);
- if (*SaveSceneSsCount != 0) {
- SAVED_DATA *sdPtr = SaveSceneSsData;
- for (int i = 0; i < *SaveSceneSsCount; ++i, ++sdPtr)
+ if (*g_SaveSceneSsCount != 0) {
+ SAVED_DATA *sdPtr = g_SaveSceneSsData;
+ for (int i = 0; i < *g_SaveSceneSsCount; ++i, ++sdPtr)
syncSavedData(s, *sdPtr);
// Flag that there is a saved scene to return to. Note that in this context 'saved scene'
// is a stored scene to return to from another scene, such as from the Summoning Book close-up
// in Discworld 1 to whatever scene Rincewind was in prior to that
- ASceneIsSaved = true;
+ g_ASceneIsSaved = true;
}
if (!TinselV2)
@@ -455,7 +475,7 @@ static void DoSync(Common::Serializer &s) {
* DoRestore
*/
static bool DoRestore() {
- Common::InSaveFile *f = _vm->getSaveFileMan()->openForLoading(savedFiles[RestoreGameNumber].name);
+ Common::InSaveFile *f = _vm->getSaveFileMan()->openForLoading(g_savedFiles[g_RestoreGameNumber].name);
if (f == NULL) {
return false;
@@ -489,8 +509,8 @@ static bool DoRestore() {
static void SaveFailure(Common::OutSaveFile *f) {
if (f) {
delete f;
- _vm->getSaveFileMan()->removeSavefile(SaveSceneName);
- SaveSceneName = NULL; // Invalidate save name
+ _vm->getSaveFileMan()->removeSavefile(g_SaveSceneName);
+ g_SaveSceneName = NULL; // Invalidate save name
}
GUI::MessageDialog dialog(_("Failed to save game state to file."));
dialog.runModal();
@@ -504,9 +524,9 @@ static void DoSave() {
char tmpName[FNAMELEN];
// Next getList() must do its stuff again
- NeedLoad = true;
+ g_NeedLoad = true;
- if (SaveSceneName == NULL) {
+ if (g_SaveSceneName == NULL) {
// Generate a new unique save name
int i;
int ano = 1; // Allocated number
@@ -515,23 +535,23 @@ static void DoSave() {
Common::String fname = _vm->getSavegameFilename(ano);
strcpy(tmpName, fname.c_str());
- for (i = 0; i < numSfiles; i++)
- if (!strcmp(savedFiles[i].name, tmpName))
+ for (i = 0; i < g_numSfiles; i++)
+ if (!strcmp(g_savedFiles[i].name, tmpName))
break;
- if (i == numSfiles)
+ if (i == g_numSfiles)
break;
ano++;
}
- SaveSceneName = tmpName;
+ g_SaveSceneName = tmpName;
}
- if (SaveSceneDesc[0] == 0)
- SaveSceneDesc = "unnamed";
+ if (g_SaveSceneDesc[0] == 0)
+ g_SaveSceneDesc = "unnamed";
- f = _vm->getSaveFileMan()->openForSaving(SaveSceneName);
+ f = _vm->getSaveFileMan()->openForSaving(g_SaveSceneName);
Common::Serializer s(0, f);
if (f == NULL) {
@@ -544,9 +564,12 @@ static void DoSave() {
hdr.id = SAVEGAME_ID;
hdr.size = SAVEGAME_HEADER_SIZE;
hdr.ver = CURRENT_VER;
- memcpy(hdr.desc, SaveSceneDesc, SG_DESC_LEN);
+ memcpy(hdr.desc, g_SaveSceneDesc, SG_DESC_LEN);
hdr.desc[SG_DESC_LEN - 1] = 0;
g_system->getTimeAndDate(hdr.dateTime);
+ hdr.scnFlag = _vm->getFeatures() & GF_SCNFILES;
+ hdr.language = _vm->_config->_language;
+
if (!syncSaveGameHeader(s, hdr) || f->err()) {
SaveFailure(f);
return;
@@ -563,28 +586,29 @@ static void DoSave() {
f->finalize();
delete f;
- SaveSceneName = NULL; // Invalidate save name
+ g_SaveSceneName = NULL; // Invalidate save name
}
/**
* ProcessSRQueue
*/
void ProcessSRQueue() {
- switch (SRstate) {
+ switch (g_SRstate) {
case SR_DORESTORE:
// If a load has been done directly from title screens, set a larger value for scene ctr so the
// code used to skip the title screens in Discworld 1 gets properly disabled
- if (sceneCtr < 10) sceneCtr = 10;
+ if (g_sceneCtr < 10)
+ g_sceneCtr = 10;
if (DoRestore()) {
- DoRestoreScene(srsd, false);
+ DoRestoreScene(g_srsd, false);
}
- SRstate = SR_IDLE;
+ g_SRstate = SR_IDLE;
break;
case SR_DOSAVE:
DoSave();
- SRstate = SR_IDLE;
+ g_SRstate = SR_IDLE;
break;
default:
break;
@@ -593,14 +617,14 @@ void ProcessSRQueue() {
void RequestSaveGame(char *name, char *desc, SAVED_DATA *sd, int *pSsCount, SAVED_DATA *pSsData) {
- assert(SRstate == SR_IDLE);
-
- SaveSceneName = name;
- SaveSceneDesc = desc;
- SaveSceneSsCount = pSsCount;
- SaveSceneSsData = pSsData;
- srsd = sd;
- SRstate = SR_DOSAVE;
+ assert(g_SRstate == SR_IDLE);
+
+ g_SaveSceneName = name;
+ g_SaveSceneDesc = desc;
+ g_SaveSceneSsCount = pSsCount;
+ g_SaveSceneSsData = pSsData;
+ g_srsd = sd;
+ g_SRstate = SR_DOSAVE;
}
void RequestRestoreGame(int num, SAVED_DATA *sd, int *pSsCount, SAVED_DATA *pSsData) {
@@ -609,17 +633,17 @@ void RequestRestoreGame(int num, SAVED_DATA *sd, int *pSsCount, SAVED_DATA *pSsD
return;
else if (num == -2) {
// From CD change for restore
- num = RestoreGameNumber;
+ num = g_RestoreGameNumber;
}
}
assert(num >= 0);
- RestoreGameNumber = num;
- SaveSceneSsCount = pSsCount;
- SaveSceneSsData = pSsData;
- srsd = sd;
- SRstate = SR_DORESTORE;
+ g_RestoreGameNumber = num;
+ g_SaveSceneSsCount = pSsCount;
+ g_SaveSceneSsData = pSsData;
+ g_srsd = sd;
+ g_SRstate = SR_DORESTORE;
}
/**
diff --git a/engines/tinsel/savescn.cpp b/engines/tinsel/savescn.cpp
index 39a8033d45..1b06e3929c 100644
--- a/engines/tinsel/savescn.cpp
+++ b/engines/tinsel/savescn.cpp
@@ -75,29 +75,29 @@ enum {
//----------------- EXTERNAL GLOBAL DATA --------------------
-extern int thingHeld;
-extern int restoreCD;
-extern SRSTATE SRstate;
+extern int g_thingHeld;
+extern int g_restoreCD;
+extern SRSTATE g_SRstate;
//----------------- LOCAL GLOBAL DATA --------------------
// FIXME: Avoid non-const global vars
-bool ASceneIsSaved = false;
+bool g_ASceneIsSaved = false;
-static int savedSceneCount = 0;
+static int g_savedSceneCount = 0;
-static bool bNotDoneYet = false;
+static bool g_bNotDoneYet = false;
//static SAVED_DATA ssData[MAX_NEST];
-static SAVED_DATA *ssData = NULL;
-static SAVED_DATA sgData;
+static SAVED_DATA *g_ssData = NULL;
+static SAVED_DATA g_sgData;
-static SAVED_DATA *rsd = 0;
+static SAVED_DATA *g_rsd = 0;
-static int RestoreSceneCount = 0;
+static int g_RestoreSceneCount = 0;
-static bool bNoFade = false;
+static bool g_bNoFade = false;
//----------------- FORWARD REFERENCES --------------------
@@ -133,7 +133,7 @@ void DoSaveScene(SAVED_DATA *sd) {
CurrentMidiFacts(&sd->SavedMidi, &sd->SavedLoop);
}
- ASceneIsSaved = true;
+ g_ASceneIsSaved = true;
}
/**
@@ -142,29 +142,29 @@ void DoSaveScene(SAVED_DATA *sd) {
* @param bFadeOut Flag to perform a fade out
*/
void DoRestoreScene(SAVED_DATA *sd, bool bFadeOut) {
- rsd = sd;
+ g_rsd = sd;
if (bFadeOut)
- RestoreSceneCount = RS_COUNT + COUNTOUT_COUNT; // Set restore scene count
+ g_RestoreSceneCount = RS_COUNT + COUNTOUT_COUNT; // Set restore scene count
else
- RestoreSceneCount = RS_COUNT; // Set restore scene count
+ g_RestoreSceneCount = RS_COUNT; // Set restore scene count
}
void InitializeSaveScenes() {
- if (ssData == NULL) {
- ssData = (SAVED_DATA *)calloc(MAX_NEST, sizeof(SAVED_DATA));
- if (ssData == NULL) {
+ if (g_ssData == NULL) {
+ g_ssData = (SAVED_DATA *)calloc(MAX_NEST, sizeof(SAVED_DATA));
+ if (g_ssData == NULL) {
error("Cannot allocate memory for scene changes");
}
} else {
// Re-initialize - no scenes saved
- savedSceneCount = 0;
+ g_savedSceneCount = 0;
}
}
void FreeSaveScenes() {
- free(ssData);
- ssData = NULL;
+ free(g_ssData);
+ g_ssData = NULL;
}
/**
@@ -212,29 +212,29 @@ static void SortMAProcess(CORO_PARAM, const void *) {
_ctx->viaActor = SysVar(ISV_DIVERT_ACTOR);
SetSysVar(ISV_DIVERT_ACTOR, 0);
- RestoreAuxScales(rsd->SavedMoverInfo);
+ RestoreAuxScales(g_rsd->SavedMoverInfo);
for (_ctx->i = 0; _ctx->i < MAX_MOVERS; _ctx->i++) {
- if (rsd->SavedMoverInfo[_ctx->i].bActive) {
- CORO_INVOKE_ARGS(Stand, (CORO_SUBCTX, rsd->SavedMoverInfo[_ctx->i].actorID,
- rsd->SavedMoverInfo[_ctx->i].objX, rsd->SavedMoverInfo[_ctx->i].objY,
- rsd->SavedMoverInfo[_ctx->i].hLastfilm));
+ if (g_rsd->SavedMoverInfo[_ctx->i].bActive) {
+ CORO_INVOKE_ARGS(Stand, (CORO_SUBCTX, g_rsd->SavedMoverInfo[_ctx->i].actorID,
+ g_rsd->SavedMoverInfo[_ctx->i].objX, g_rsd->SavedMoverInfo[_ctx->i].objY,
+ g_rsd->SavedMoverInfo[_ctx->i].hLastfilm));
- if (rsd->SavedMoverInfo[_ctx->i].bHidden)
- HideMover(GetMover(rsd->SavedMoverInfo[_ctx->i].actorID));
+ if (g_rsd->SavedMoverInfo[_ctx->i].bHidden)
+ HideMover(GetMover(g_rsd->SavedMoverInfo[_ctx->i].actorID));
}
- ActorPalette(rsd->SavedMoverInfo[_ctx->i].actorID,
- rsd->SavedMoverInfo[_ctx->i].startColor, rsd->SavedMoverInfo[_ctx->i].paletteLength);
+ ActorPalette(g_rsd->SavedMoverInfo[_ctx->i].actorID,
+ g_rsd->SavedMoverInfo[_ctx->i].startColor, g_rsd->SavedMoverInfo[_ctx->i].paletteLength);
- if (rsd->SavedMoverInfo[_ctx->i].brightness != BOGUS_BRIGHTNESS)
- ActorBrightness(rsd->SavedMoverInfo[_ctx->i].actorID, rsd->SavedMoverInfo[_ctx->i].brightness);
+ if (g_rsd->SavedMoverInfo[_ctx->i].brightness != BOGUS_BRIGHTNESS)
+ ActorBrightness(g_rsd->SavedMoverInfo[_ctx->i].actorID, g_rsd->SavedMoverInfo[_ctx->i].brightness);
}
// Restore via actor
SetSysVar(ISV_DIVERT_ACTOR, _ctx->viaActor);
- bNotDoneYet = false;
+ g_bNotDoneYet = false;
CORO_END_CODE;
}
@@ -244,49 +244,49 @@ static void SortMAProcess(CORO_PARAM, const void *) {
void ResumeInterprets() {
// Master script only affected on restore game, not restore scene
- if (!TinselV2 && (rsd == &sgData)) {
+ if (!TinselV2 && (g_rsd == &g_sgData)) {
g_scheduler->killMatchingProcess(PID_MASTER_SCR, -1);
FreeMasterInterpretContext();
}
for (int i = 0; i < NUM_INTERPRET; i++) {
- switch (rsd->SavedICInfo[i].GSort) {
+ switch (g_rsd->SavedICInfo[i].GSort) {
case GS_NONE:
break;
case GS_INVENTORY:
- if (rsd->SavedICInfo[i].event != POINTED) {
- RestoreProcess(&rsd->SavedICInfo[i]);
+ if (g_rsd->SavedICInfo[i].event != POINTED) {
+ RestoreProcess(&g_rsd->SavedICInfo[i]);
}
break;
case GS_MASTER:
// Master script only affected on restore game, not restore scene
- if (rsd == &sgData)
- RestoreMasterProcess(&rsd->SavedICInfo[i]);
+ if (g_rsd == &g_sgData)
+ RestoreMasterProcess(&g_rsd->SavedICInfo[i]);
break;
case GS_PROCESS:
// Tinsel 2 process
- RestoreSceneProcess(&rsd->SavedICInfo[i]);
+ RestoreSceneProcess(&g_rsd->SavedICInfo[i]);
break;
case GS_GPROCESS:
// Tinsel 2 Global processes only affected on restore game, not restore scene
- if (rsd == &sgData)
- RestoreGlobalProcess(&rsd->SavedICInfo[i]);
+ if (g_rsd == &g_sgData)
+ RestoreGlobalProcess(&g_rsd->SavedICInfo[i]);
break;
case GS_ACTOR:
if (TinselV2)
- RestoreProcess(&rsd->SavedICInfo[i]);
+ RestoreProcess(&g_rsd->SavedICInfo[i]);
else
- RestoreActorProcess(rsd->SavedICInfo[i].idActor, &rsd->SavedICInfo[i], rsd == &sgData);
+ RestoreActorProcess(g_rsd->SavedICInfo[i].idActor, &g_rsd->SavedICInfo[i], g_rsd == &g_sgData);
break;
case GS_POLYGON:
case GS_SCENE:
- RestoreProcess(&rsd->SavedICInfo[i]);
+ RestoreProcess(&g_rsd->SavedICInfo[i]);
break;
default:
@@ -313,7 +313,7 @@ static int DoRestoreSceneFrame(SAVED_DATA *sd, int n) {
if (TinselV2) {
// Master script only affected on restore game, not restore scene
- if (sd == &sgData) {
+ if (sd == &g_sgData) {
g_scheduler->killMatchingProcess(PID_MASTER_SCR);
KillGlobalProcesses();
FreeMasterInterpretContext();
@@ -322,12 +322,12 @@ static int DoRestoreSceneFrame(SAVED_DATA *sd, int n) {
RestorePolygonStuff(sd->SavedPolygonStuff);
// Abandon temporarily if different CD
- if (sd == &sgData && restoreCD != GetCurrentCD()) {
- SRstate = SR_IDLE;
+ if (sd == &g_sgData && g_restoreCD != GetCurrentCD()) {
+ g_SRstate = SR_IDLE;
EndScene();
- SetNextCD(restoreCD);
- CDChangeForRestore(restoreCD);
+ SetNextCD(g_restoreCD);
+ CDChangeForRestore(g_restoreCD);
return 0;
}
@@ -338,8 +338,8 @@ static int DoRestoreSceneFrame(SAVED_DATA *sd, int n) {
// Start up the scene
StartNewScene(sd->SavedSceneHandle, NO_ENTRY_NUM);
- SetDoFadeIn(!bNoFade);
- bNoFade = false;
+ SetDoFadeIn(!g_bNoFade);
+ g_bNoFade = false;
StartupBackground(nullContext, sd->SavedBgroundHandle);
if (TinselV2) {
@@ -355,7 +355,7 @@ static int DoRestoreSceneFrame(SAVED_DATA *sd, int n) {
if (TinselV2) {
// create process to sort out the moving actors
g_scheduler->createProcess(PID_MOVER, SortMAProcess, NULL, 0);
- bNotDoneYet = true;
+ g_bNotDoneYet = true;
RestoreActorZ(sd->savedActorZ);
RestoreZpositions(sd->zPositions);
@@ -374,11 +374,11 @@ static int DoRestoreSceneFrame(SAVED_DATA *sd, int n) {
case 1:
if (TinselV2) {
- if (bNotDoneYet)
+ if (g_bNotDoneYet)
return n;
- if (sd == &sgData)
- HoldItem(thingHeld, true);
+ if (sd == &g_sgData)
+ HoldItem(g_thingHeld, true);
if (sd->bTinselDim)
_vm->_pcmMusic->dim(true);
_vm->_pcmMusic->restoreThatTune(sd->SavedTune);
@@ -406,7 +406,7 @@ static int DoRestoreSceneFrame(SAVED_DATA *sd, int n) {
void RestoreGame(int num) {
KillInventory();
- RequestRestoreGame(num, &sgData, &savedSceneCount, ssData);
+ RequestRestoreGame(num, &g_sgData, &g_savedSceneCount, g_ssData);
// Actual restoring is performed by ProcessSRQueue
}
@@ -418,9 +418,9 @@ void RestoreGame(int num) {
*/
void SaveGame(char *name, char *desc) {
// Get current scene data
- DoSaveScene(&sgData);
+ DoSaveScene(&g_sgData);
- RequestSaveGame(name, desc, &sgData, &savedSceneCount, ssData);
+ RequestSaveGame(name, desc, &g_sgData, &g_savedSceneCount, g_ssData);
// Actual saving is performed by ProcessSRQueue
}
@@ -429,11 +429,11 @@ void SaveGame(char *name, char *desc) {
//---------------------------------------------------------------------------------
bool IsRestoringScene() {
- if (RestoreSceneCount) {
- RestoreSceneCount = DoRestoreSceneFrame(rsd, RestoreSceneCount);
+ if (g_RestoreSceneCount) {
+ g_RestoreSceneCount = DoRestoreSceneFrame(g_rsd, g_RestoreSceneCount);
}
- return RestoreSceneCount ? true : false;
+ return g_RestoreSceneCount ? true : false;
}
/**
@@ -441,13 +441,13 @@ bool IsRestoringScene() {
*/
void TinselRestoreScene(bool bFade) {
// only called by restore_scene PCODE
- if (RestoreSceneCount == 0) {
- assert(savedSceneCount >= 1); // No saved scene to restore
+ if (g_RestoreSceneCount == 0) {
+ assert(g_savedSceneCount >= 1); // No saved scene to restore
- if (ASceneIsSaved)
- DoRestoreScene(&ssData[--savedSceneCount], bFade);
+ if (g_ASceneIsSaved)
+ DoRestoreScene(&g_ssData[--g_savedSceneCount], bFade);
if (!bFade)
- bNoFade = true;
+ g_bNoFade = true;
}
}
@@ -461,14 +461,14 @@ void TinselSaveScene(CORO_PARAM) {
CORO_BEGIN_CODE(_ctx);
- assert(savedSceneCount < MAX_NEST); // nesting limit reached
+ assert(g_savedSceneCount < MAX_NEST); // nesting limit reached
// Don't save the same thing multiple times!
// FIXME/TODO: Maybe this can be changed to an assert?
- if (savedSceneCount && ssData[savedSceneCount-1].SavedSceneHandle == GetSceneHandle())
+ if (g_savedSceneCount && g_ssData[g_savedSceneCount-1].SavedSceneHandle == GetSceneHandle())
CORO_KILL_SELF();
- DoSaveScene(&ssData[savedSceneCount++]);
+ DoSaveScene(&g_ssData[g_savedSceneCount++]);
CORO_END_CODE;
}
diff --git a/engines/tinsel/scene.cpp b/engines/tinsel/scene.cpp
index 89b0da7d65..f635ce13a3 100644
--- a/engines/tinsel/scene.cpp
+++ b/engines/tinsel/scene.cpp
@@ -107,15 +107,15 @@ struct ENTRANCE_STRUC {
// FIXME: Avoid non-const global vars
#ifdef DEBUG
-static bool ShowPosition = false; // Set when showpos() has been called
+static bool g_ShowPosition = false; // Set when showpos() has been called
#endif
-int sceneCtr = 0;
-static int initialMyEscape;
+int g_sceneCtr = 0;
+static int g_initialMyEscape;
-static SCNHANDLE SceneHandle = 0; // Current scene handle - stored in case of Save_Scene()
+static SCNHANDLE g_SceneHandle = 0; // Current scene handle - stored in case of Save_Scene()
-SCENE_STRUC tempStruc;
+SCENE_STRUC g_tempStruc;
struct TP_INIT {
SCNHANDLE hTinselCode; // Code
@@ -128,18 +128,18 @@ const SCENE_STRUC *GetSceneStruc(const byte *pStruc) {
// Copy appropriate fields into tempStruc, and return a pointer to it
const byte *p = pStruc;
- memset(&tempStruc, 0, sizeof(SCENE_STRUC));
-
- tempStruc.numEntrance = READ_UINT32(p); p += sizeof(uint32);
- tempStruc.numPoly = READ_UINT32(p); p += sizeof(uint32);
- tempStruc.numTaggedActor = READ_UINT32(p); p += sizeof(uint32);
- tempStruc.defRefer = READ_UINT32(p); p += sizeof(uint32);
- tempStruc.hSceneScript = READ_UINT32(p); p += sizeof(uint32);
- tempStruc.hEntrance = READ_UINT32(p); p += sizeof(uint32);
- tempStruc.hPoly = READ_UINT32(p); p += sizeof(uint32);
- tempStruc.hTaggedActor = READ_UINT32(p); p += sizeof(uint32);
-
- return &tempStruc;
+ memset(&g_tempStruc, 0, sizeof(SCENE_STRUC));
+
+ g_tempStruc.numEntrance = READ_UINT32(p); p += sizeof(uint32);
+ g_tempStruc.numPoly = READ_UINT32(p); p += sizeof(uint32);
+ g_tempStruc.numTaggedActor = READ_UINT32(p); p += sizeof(uint32);
+ g_tempStruc.defRefer = READ_UINT32(p); p += sizeof(uint32);
+ g_tempStruc.hSceneScript = READ_UINT32(p); p += sizeof(uint32);
+ g_tempStruc.hEntrance = READ_UINT32(p); p += sizeof(uint32);
+ g_tempStruc.hPoly = READ_UINT32(p); p += sizeof(uint32);
+ g_tempStruc.hTaggedActor = READ_UINT32(p); p += sizeof(uint32);
+
+ return &g_tempStruc;
}
@@ -157,8 +157,8 @@ static void SceneTinselProcess(CORO_PARAM, const void *param) {
CORO_BEGIN_CODE(_ctx);
// The following myEscape value setting is used for enabling title screen skipping in DW1
- if (TinselV1 && (sceneCtr == 1)) initialMyEscape = GetEscEvents();
- _ctx->myEscape = (TinselV1 && (sceneCtr < 4)) ? initialMyEscape : 0;
+ if (TinselV1 && (g_sceneCtr == 1)) g_initialMyEscape = GetEscEvents();
+ _ctx->myEscape = (TinselV1 && (g_sceneCtr < 4)) ? g_initialMyEscape : 0;
// get the stuff copied to process when it was created
_ctx->pInit = (const TP_INIT *)param;
@@ -184,8 +184,8 @@ static void SceneTinselProcess(CORO_PARAM, const void *param) {
void SendSceneTinselProcess(TINSEL_EVENT event) {
SCENE_STRUC *ss;
- if (SceneHandle != (SCNHANDLE)NULL) {
- ss = (SCENE_STRUC *) FindChunk(SceneHandle, CHUNK_SCENE);
+ if (g_SceneHandle != (SCNHANDLE)NULL) {
+ ss = (SCENE_STRUC *) FindChunk(g_SceneHandle, CHUNK_SCENE);
if (ss->hSceneScript) {
TP_INIT init;
@@ -214,9 +214,9 @@ static void LoadScene(SCNHANDLE scene, int entry) {
const ENTRANCE_STRUC *es;
// Scene handle
- SceneHandle = scene; // Save scene handle in case of Save_Scene()
- LockMem(SceneHandle); // Make sure scene is loaded
- LockScene(SceneHandle); // Prevent current scene from being discarded
+ g_SceneHandle = scene; // Save scene handle in case of Save_Scene()
+ LockMem(g_SceneHandle); // Make sure scene is loaded
+ LockScene(g_SceneHandle); // Prevent current scene from being discarded
if (TinselV2) {
// CdPlay() stuff
@@ -307,9 +307,9 @@ static void LoadScene(SCNHANDLE scene, int entry) {
* Wrap up the last scene.
*/
void EndScene() {
- if (SceneHandle != 0) {
- UnlockScene(SceneHandle);
- SceneHandle = 0;
+ if (g_SceneHandle != 0) {
+ UnlockScene(g_SceneHandle);
+ g_SceneHandle = 0;
}
KillInventory(); // Close down any open inventory
@@ -409,7 +409,7 @@ void PrimeScene() {
g_scheduler->createProcess(PID_SCROLL, EffectPolyProcess, NULL, 0);
#ifdef DEBUG
- if (ShowPosition)
+ if (g_ShowPosition)
g_scheduler->createProcess(PID_POSITION, CursorPositionProcess, NULL, 0);
#endif
@@ -445,7 +445,7 @@ void StartNewScene(SCNHANDLE scene, int entry) {
*/
void setshowpos() {
- ShowPosition = true;
+ g_ShowPosition = true;
}
#endif
@@ -454,7 +454,7 @@ void setshowpos() {
*/
SCNHANDLE GetSceneHandle() {
- return SceneHandle;
+ return g_SceneHandle;
}
/**
diff --git a/engines/tinsel/sched.cpp b/engines/tinsel/sched.cpp
index d6cd806eb2..343758d924 100644
--- a/engines/tinsel/sched.cpp
+++ b/engines/tinsel/sched.cpp
@@ -47,11 +47,11 @@ struct PROCESS_STRUC {
// FIXME: Avoid non-const global vars
-static uint32 numSceneProcess;
-static SCNHANDLE hSceneProcess;
+static uint32 g_numSceneProcess;
+static SCNHANDLE g_hSceneProcess;
-static uint32 numGlobalProcess;
-static PROCESS_STRUC *pGlobalProcess;
+static uint32 g_numGlobalProcess;
+static PROCESS_STRUC *g_pGlobalProcess;
//--------------------- FUNCTIONS ------------------------
@@ -574,8 +574,8 @@ void RestoreSceneProcess(INT_CONTEXT *pic) {
uint32 i;
PROCESS_STRUC *pStruc;
- pStruc = (PROCESS_STRUC *)LockMem(hSceneProcess);
- for (i = 0; i < numSceneProcess; i++) {
+ pStruc = (PROCESS_STRUC *)LockMem(g_hSceneProcess);
+ for (i = 0; i < g_numSceneProcess; i++) {
if (FROM_LE_32(pStruc[i].hProcessCode) == pic->hCode) {
g_scheduler->createProcess(PID_PROCESS + i, RestoredProcessProcess,
&pic, sizeof(pic));
@@ -583,7 +583,7 @@ void RestoreSceneProcess(INT_CONTEXT *pic) {
}
}
- assert(i < numSceneProcess);
+ assert(i < g_numSceneProcess);
}
/**
@@ -602,8 +602,8 @@ void SceneProcessEvent(CORO_PARAM, uint32 procID, TINSEL_EVENT event, bool bWait
CORO_BEGIN_CODE(_ctx);
- _ctx->pStruc = (PROCESS_STRUC *)LockMem(hSceneProcess);
- for (i = 0; i < numSceneProcess; i++) {
+ _ctx->pStruc = (PROCESS_STRUC *)LockMem(g_hSceneProcess);
+ for (i = 0; i < g_numSceneProcess; i++) {
if (FROM_LE_32(_ctx->pStruc[i].processId) == procID) {
assert(_ctx->pStruc[i].hProcessCode); // Must have some code to run
@@ -624,7 +624,7 @@ void SceneProcessEvent(CORO_PARAM, uint32 procID, TINSEL_EVENT event, bool bWait
}
}
- if (i == numSceneProcess)
+ if (i == g_numSceneProcess)
return;
if (bWait) {
@@ -641,8 +641,8 @@ void KillSceneProcess(uint32 procID) {
uint32 i; // Loop counter
PROCESS_STRUC *pStruc;
- pStruc = (PROCESS_STRUC *) LockMem(hSceneProcess);
- for (i = 0; i < numSceneProcess; i++) {
+ pStruc = (PROCESS_STRUC *) LockMem(g_hSceneProcess);
+ for (i = 0; i < g_numSceneProcess; i++) {
if (FROM_LE_32(pStruc[i].processId) == procID) {
g_scheduler->killMatchingProcess(PID_PROCESS + i, -1);
break;
@@ -654,8 +654,8 @@ void KillSceneProcess(uint32 procID) {
* Register the scene processes in a scene.
*/
void SceneProcesses(uint32 numProcess, SCNHANDLE hProcess) {
- numSceneProcess = numProcess;
- hSceneProcess = hProcess;
+ g_numSceneProcess = numProcess;
+ g_hSceneProcess = hProcess;
}
@@ -669,15 +669,15 @@ void SceneProcesses(uint32 numProcess, SCNHANDLE hProcess) {
void RestoreGlobalProcess(INT_CONTEXT *pic) {
uint32 i; // Loop counter
- for (i = 0; i < numGlobalProcess; i++) {
- if (pGlobalProcess[i].hProcessCode == pic->hCode) {
+ for (i = 0; i < g_numGlobalProcess; i++) {
+ if (g_pGlobalProcess[i].hProcessCode == pic->hCode) {
g_scheduler->createProcess(PID_GPROCESS + i, RestoredProcessProcess,
&pic, sizeof(pic));
break;
}
}
- assert(i < numGlobalProcess);
+ assert(i < g_numGlobalProcess);
}
/**
@@ -685,7 +685,7 @@ void RestoreGlobalProcess(INT_CONTEXT *pic) {
*/
void KillGlobalProcesses() {
- for (uint32 i = 0; i < numGlobalProcess; ++i) {
+ for (uint32 i = 0; i < g_numGlobalProcess; ++i) {
g_scheduler->killMatchingProcess(PID_GPROCESS + i, -1);
}
}
@@ -706,12 +706,12 @@ bool GlobalProcessEvent(CORO_PARAM, uint32 procID, TINSEL_EVENT event, bool bWai
uint32 i; // Loop counter
_ctx->pProc = NULL;
- for (i = 0; i < numGlobalProcess; ++i) {
- if (pGlobalProcess[i].processId == procID) {
- assert(pGlobalProcess[i].hProcessCode); // Must have some code to run
+ for (i = 0; i < g_numGlobalProcess; ++i) {
+ if (g_pGlobalProcess[i].processId == procID) {
+ assert(g_pGlobalProcess[i].hProcessCode); // Must have some code to run
_ctx->pic = InitInterpretContext(GS_GPROCESS,
- pGlobalProcess[i].hProcessCode,
+ g_pGlobalProcess[i].hProcessCode,
event,
NOPOLY, // No polygon
0, // No actor
@@ -728,7 +728,7 @@ bool GlobalProcessEvent(CORO_PARAM, uint32 procID, TINSEL_EVENT event, bool bWai
}
}
- if ((i == numGlobalProcess) || (_ctx->pic == NULL))
+ if ((i == g_numGlobalProcess) || (_ctx->pic == NULL))
result = false;
else if (bWait)
CORO_INVOKE_ARGS_V(WaitInterpret, false, (CORO_SUBCTX, _ctx->pProc, &result));
@@ -743,8 +743,8 @@ bool GlobalProcessEvent(CORO_PARAM, uint32 procID, TINSEL_EVENT event, bool bWai
void xKillGlobalProcess(uint32 procID) {
uint32 i; // Loop counter
- for (i = 0; i < numGlobalProcess; ++i) {
- if (pGlobalProcess[i].processId == procID) {
+ for (i = 0; i < g_numGlobalProcess; ++i) {
+ if (g_pGlobalProcess[i].processId == procID) {
g_scheduler->killMatchingProcess(PID_GPROCESS + i, -1);
break;
}
@@ -755,13 +755,13 @@ void xKillGlobalProcess(uint32 procID) {
* Register the global processes list
*/
void GlobalProcesses(uint32 numProcess, byte *pProcess) {
- pGlobalProcess = new PROCESS_STRUC[numProcess];
- numGlobalProcess = numProcess;
+ g_pGlobalProcess = new PROCESS_STRUC[numProcess];
+ g_numGlobalProcess = numProcess;
byte *p = pProcess;
for (uint i = 0; i < numProcess; ++i, p += 8) {
- pGlobalProcess[i].processId = READ_LE_UINT32(p);
- pGlobalProcess[i].hProcessCode = READ_LE_UINT32(p + 4);
+ g_pGlobalProcess[i].processId = READ_LE_UINT32(p);
+ g_pGlobalProcess[i].hProcessCode = READ_LE_UINT32(p + 4);
}
}
@@ -769,9 +769,9 @@ void GlobalProcesses(uint32 numProcess, byte *pProcess) {
* Frees the global processes list
*/
void FreeGlobalProcesses() {
- delete[] pGlobalProcess;
- pGlobalProcess = 0;
- numGlobalProcess = 0;
+ delete[] g_pGlobalProcess;
+ g_pGlobalProcess = 0;
+ g_numGlobalProcess = 0;
}
} // End of namespace Tinsel
diff --git a/engines/tinsel/scroll.cpp b/engines/tinsel/scroll.cpp
index d75e649be3..0a6a281d35 100644
--- a/engines/tinsel/scroll.cpp
+++ b/engines/tinsel/scroll.cpp
@@ -49,14 +49,14 @@ namespace Tinsel {
// FIXME: Avoid non-const global vars
-static int LeftScroll = 0, DownScroll = 0; // Number of iterations outstanding
+static int g_LeftScroll = 0, g_DownScroll = 0; // Number of iterations outstanding
-static int scrollActor = 0;
-static PMOVER pScrollMover = 0;
-static int oldx = 0, oldy = 0;
+static int g_scrollActor = 0;
+static PMOVER g_pScrollMover = 0;
+static int g_oldx = 0, g_oldy = 0;
/** Boundaries and numbers of boundaries */
-static SCROLLDATA sd = {
+static SCROLLDATA g_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}
@@ -77,28 +77,28 @@ static SCROLLDATA sd = {
0
};
-static int ImageH = 0, ImageW = 0;
+static int g_ImageH = 0, g_ImageW = 0;
-static bool ScrollCursor = 0; // If a TAG or EXIT polygon is clicked on,
+static bool g_ScrollCursor = 0; // If a TAG or EXIT polygon is clicked on,
// the cursor is kept over that polygon
// whilst scrolling
-static int scrollPixelsX = SCROLLPIXELS;
-static int scrollPixelsY = SCROLLPIXELS;
+static int g_scrollPixelsX = SCROLLPIXELS;
+static int g_scrollPixelsY = SCROLLPIXELS;
/**
* Reset the ScrollCursor flag
*/
void DontScrollCursor() {
- ScrollCursor = false;
+ g_ScrollCursor = false;
}
/**
* Set the ScrollCursor flag
*/
void DoScrollCursor() {
- ScrollCursor = true;
+ g_ScrollCursor = true;
}
/**
@@ -107,20 +107,20 @@ void DoScrollCursor() {
void SetNoScroll(int x1, int y1, int x2, int y2) {
if (x1 == x2) {
/* Vertical line */
- assert(sd.NumNoH < MAX_HNOSCROLL);
+ assert(g_sd.NumNoH < MAX_HNOSCROLL);
- sd.NoHScroll[sd.NumNoH].ln = x1; // X pos of vertical line
- sd.NoHScroll[sd.NumNoH].c1 = y1;
- sd.NoHScroll[sd.NumNoH].c2 = y2;
- sd.NumNoH++;
+ g_sd.NoHScroll[g_sd.NumNoH].ln = x1; // X pos of vertical line
+ g_sd.NoHScroll[g_sd.NumNoH].c1 = y1;
+ g_sd.NoHScroll[g_sd.NumNoH].c2 = y2;
+ g_sd.NumNoH++;
} else if (y1 == y2) {
/* Horizontal line */
- assert(sd.NumNoV < MAX_VNOSCROLL);
+ assert(g_sd.NumNoV < MAX_VNOSCROLL);
- sd.NoVScroll[sd.NumNoV].ln = y1; // Y pos of horizontal line
- sd.NoVScroll[sd.NumNoV].c1 = x1;
- sd.NoVScroll[sd.NumNoV].c2 = x2;
- sd.NumNoV++;
+ g_sd.NoVScroll[g_sd.NumNoV].ln = y1; // Y pos of horizontal line
+ g_sd.NoVScroll[g_sd.NumNoV].c1 = x1;
+ g_sd.NoVScroll[g_sd.NumNoV].c2 = x2;
+ g_sd.NumNoV++;
} else {
/* No-scroll lines must be horizontal or vertical */
}
@@ -144,21 +144,21 @@ static void NeedScroll(int direction) {
BottomLine = Toffset + (SCREEN_HEIGHT - 1);
RightCol = Loffset + (SCREEN_WIDTH - 1);
- for (i = 0; i < sd.NumNoH; i++) {
- if (RightCol >= sd.NoHScroll[i].ln - 1 && RightCol <= sd.NoHScroll[i].ln + 1 &&
- ((sd.NoHScroll[i].c1 >= Toffset && sd.NoHScroll[i].c1 <= BottomLine) ||
- (sd.NoHScroll[i].c2 >= Toffset && sd.NoHScroll[i].c2 <= BottomLine) ||
- (sd.NoHScroll[i].c1 < Toffset && sd.NoHScroll[i].c2 > BottomLine)))
+ for (i = 0; i < g_sd.NumNoH; i++) {
+ if (RightCol >= g_sd.NoHScroll[i].ln - 1 && RightCol <= g_sd.NoHScroll[i].ln + 1 &&
+ ((g_sd.NoHScroll[i].c1 >= Toffset && g_sd.NoHScroll[i].c1 <= BottomLine) ||
+ (g_sd.NoHScroll[i].c2 >= Toffset && g_sd.NoHScroll[i].c2 <= BottomLine) ||
+ (g_sd.NoHScroll[i].c1 < Toffset && g_sd.NoHScroll[i].c2 > BottomLine)))
return;
}
- if (LeftScroll <= 0) {
+ if (g_LeftScroll <= 0) {
if (TinselV2) {
- scrollPixelsX = sd.xSpeed;
- LeftScroll += sd.xDistance;
+ g_scrollPixelsX = g_sd.xSpeed;
+ g_LeftScroll += g_sd.xDistance;
} else {
- scrollPixelsX = SCROLLPIXELS;
- LeftScroll = RLSCROLL;
+ g_scrollPixelsX = SCROLLPIXELS;
+ g_LeftScroll = RLSCROLL;
}
}
break;
@@ -167,21 +167,21 @@ static void NeedScroll(int direction) {
BottomLine = Toffset + (SCREEN_HEIGHT - 1);
- for (i = 0; i < sd.NumNoH; i++) {
- if (Loffset >= sd.NoHScroll[i].ln - 1 && Loffset <= sd.NoHScroll[i].ln + 1 &&
- ((sd.NoHScroll[i].c1 >= Toffset && sd.NoHScroll[i].c1 <= BottomLine) ||
- (sd.NoHScroll[i].c2 >= Toffset && sd.NoHScroll[i].c2 <= BottomLine) ||
- (sd.NoHScroll[i].c1 < Toffset && sd.NoHScroll[i].c2 > BottomLine)))
+ for (i = 0; i < g_sd.NumNoH; i++) {
+ if (Loffset >= g_sd.NoHScroll[i].ln - 1 && Loffset <= g_sd.NoHScroll[i].ln + 1 &&
+ ((g_sd.NoHScroll[i].c1 >= Toffset && g_sd.NoHScroll[i].c1 <= BottomLine) ||
+ (g_sd.NoHScroll[i].c2 >= Toffset && g_sd.NoHScroll[i].c2 <= BottomLine) ||
+ (g_sd.NoHScroll[i].c1 < Toffset && g_sd.NoHScroll[i].c2 > BottomLine)))
return;
}
- if (LeftScroll >= 0) {
+ if (g_LeftScroll >= 0) {
if (TinselV2) {
- scrollPixelsX = sd.xSpeed;
- LeftScroll -= sd.xDistance;
+ g_scrollPixelsX = g_sd.xSpeed;
+ g_LeftScroll -= g_sd.xDistance;
} else {
- scrollPixelsX = SCROLLPIXELS;
- LeftScroll = -RLSCROLL;
+ g_scrollPixelsX = SCROLLPIXELS;
+ g_LeftScroll = -RLSCROLL;
}
}
break;
@@ -191,21 +191,21 @@ static void NeedScroll(int direction) {
BottomLine = Toffset + (SCREEN_HEIGHT - 1);
RightCol = Loffset + (SCREEN_WIDTH - 1);
- for (i = 0; i < sd.NumNoV; i++) {
- if ((BottomLine >= sd.NoVScroll[i].ln - 1 && BottomLine <= sd.NoVScroll[i].ln + 1) &&
- ((sd.NoVScroll[i].c1 >= Loffset && sd.NoVScroll[i].c1 <= RightCol) ||
- (sd.NoVScroll[i].c2 >= Loffset && sd.NoVScroll[i].c2 <= RightCol) ||
- (sd.NoVScroll[i].c1 < Loffset && sd.NoVScroll[i].c2 > RightCol)))
+ for (i = 0; i < g_sd.NumNoV; i++) {
+ if ((BottomLine >= g_sd.NoVScroll[i].ln - 1 && BottomLine <= g_sd.NoVScroll[i].ln + 1) &&
+ ((g_sd.NoVScroll[i].c1 >= Loffset && g_sd.NoVScroll[i].c1 <= RightCol) ||
+ (g_sd.NoVScroll[i].c2 >= Loffset && g_sd.NoVScroll[i].c2 <= RightCol) ||
+ (g_sd.NoVScroll[i].c1 < Loffset && g_sd.NoVScroll[i].c2 > RightCol)))
return;
}
- if (DownScroll <= 0) {
+ if (g_DownScroll <= 0) {
if (TinselV2) {
- scrollPixelsY = sd.ySpeed;
- DownScroll += sd.yDistance;
+ g_scrollPixelsY = g_sd.ySpeed;
+ g_DownScroll += g_sd.yDistance;
} else {
- scrollPixelsY = SCROLLPIXELS;
- DownScroll = UDSCROLL;
+ g_scrollPixelsY = SCROLLPIXELS;
+ g_DownScroll = UDSCROLL;
}
}
break;
@@ -214,21 +214,21 @@ static void NeedScroll(int direction) {
RightCol = Loffset + (SCREEN_WIDTH - 1);
- for (i = 0; i < sd.NumNoV; i++) {
- if (Toffset >= sd.NoVScroll[i].ln - 1 && Toffset <= sd.NoVScroll[i].ln + 1 &&
- ((sd.NoVScroll[i].c1 >= Loffset && sd.NoVScroll[i].c1 <= RightCol) ||
- (sd.NoVScroll[i].c2 >= Loffset && sd.NoVScroll[i].c2 <= RightCol) ||
- (sd.NoVScroll[i].c1 < Loffset && sd.NoVScroll[i].c2 > RightCol)))
+ for (i = 0; i < g_sd.NumNoV; i++) {
+ if (Toffset >= g_sd.NoVScroll[i].ln - 1 && Toffset <= g_sd.NoVScroll[i].ln + 1 &&
+ ((g_sd.NoVScroll[i].c1 >= Loffset && g_sd.NoVScroll[i].c1 <= RightCol) ||
+ (g_sd.NoVScroll[i].c2 >= Loffset && g_sd.NoVScroll[i].c2 <= RightCol) ||
+ (g_sd.NoVScroll[i].c1 < Loffset && g_sd.NoVScroll[i].c2 > RightCol)))
return;
}
- if (DownScroll >= 0) {
+ if (g_DownScroll >= 0) {
if (TinselV2) {
- scrollPixelsY = sd.ySpeed;
- DownScroll -= sd.yDistance;
+ g_scrollPixelsY = g_sd.ySpeed;
+ g_DownScroll -= g_sd.yDistance;
} else {
- scrollPixelsY = SCROLLPIXELS;
- DownScroll = -UDSCROLL;
+ g_scrollPixelsY = SCROLLPIXELS;
+ g_DownScroll = -UDSCROLL;
}
}
break;
@@ -249,39 +249,39 @@ static void ScrollImage() {
/*
* Keeping cursor on a tag?
*/
- if (ScrollCursor) {
+ if (g_ScrollCursor) {
GetCursorXYNoWait(&curX, &curY, true);
if (InPolygon(curX, curY, TAG) != NOPOLY || InPolygon(curX, curY, EXIT) != NOPOLY) {
OldLoffset = Loffset;
OldToffset = Toffset;
} else
- ScrollCursor = false;
+ g_ScrollCursor = false;
}
/*
* Horizontal scrolling
*/
- if (LeftScroll > 0) {
- LeftScroll -= scrollPixelsX;
- if (LeftScroll < 0) {
- Loffset += LeftScroll;
- LeftScroll = 0;
+ if (g_LeftScroll > 0) {
+ g_LeftScroll -= g_scrollPixelsX;
+ if (g_LeftScroll < 0) {
+ Loffset += g_LeftScroll;
+ g_LeftScroll = 0;
}
- Loffset += scrollPixelsX; // Move right
- if (Loffset > ImageW - SCREEN_WIDTH)
- Loffset = ImageW - SCREEN_WIDTH;// Now at extreme right
+ Loffset += g_scrollPixelsX; // Move right
+ if (Loffset > g_ImageW - SCREEN_WIDTH)
+ Loffset = g_ImageW - SCREEN_WIDTH;// Now at extreme right
/*** New feature to prop up rickety scroll boundaries ***/
if (TinselV2 && SysVar(SV_MaximumXoffset) && (Loffset > SysVar(SV_MaximumXoffset)))
Loffset = SysVar(SV_MaximumXoffset);
- } else if (LeftScroll < 0) {
- LeftScroll += scrollPixelsX;
- if (LeftScroll > 0) {
- Loffset += LeftScroll;
- LeftScroll = 0;
+ } else if (g_LeftScroll < 0) {
+ g_LeftScroll += g_scrollPixelsX;
+ if (g_LeftScroll > 0) {
+ Loffset += g_LeftScroll;
+ g_LeftScroll = 0;
}
- Loffset -= scrollPixelsX; // Move left
+ Loffset -= g_scrollPixelsX; // Move left
if (Loffset < 0)
Loffset = 0; // Now at extreme left
@@ -293,28 +293,28 @@ static void ScrollImage() {
/*
* Vertical scrolling
*/
- if (DownScroll > 0) {
- DownScroll -= scrollPixelsY;
- if (DownScroll < 0) {
- Toffset += DownScroll;
- DownScroll = 0;
+ if (g_DownScroll > 0) {
+ g_DownScroll -= g_scrollPixelsY;
+ if (g_DownScroll < 0) {
+ Toffset += g_DownScroll;
+ g_DownScroll = 0;
}
- Toffset += scrollPixelsY; // Move down
+ Toffset += g_scrollPixelsY; // Move down
- if (Toffset > ImageH - SCREEN_HEIGHT)
- Toffset = ImageH - SCREEN_HEIGHT;// Now at extreme bottom
+ if (Toffset > g_ImageH - SCREEN_HEIGHT)
+ Toffset = g_ImageH - SCREEN_HEIGHT;// Now at extreme bottom
/*** New feature to prop up rickety scroll boundaries ***/
if (TinselV2 && SysVar(SV_MaximumYoffset) && Toffset > SysVar(SV_MaximumYoffset))
Toffset = SysVar(SV_MaximumYoffset);
- } else if (DownScroll < 0) {
- DownScroll += scrollPixelsY;
- if (DownScroll > 0) {
- Toffset += DownScroll;
- DownScroll = 0;
+ } else if (g_DownScroll < 0) {
+ g_DownScroll += g_scrollPixelsY;
+ if (g_DownScroll > 0) {
+ Toffset += g_DownScroll;
+ g_DownScroll = 0;
}
- Toffset -= scrollPixelsY; // Move up
+ Toffset -= g_scrollPixelsY; // Move up
if (Toffset < 0)
Toffset = 0; // Now at extreme top
@@ -327,7 +327,7 @@ static void ScrollImage() {
/*
* Move cursor if keeping cursor on a tag.
*/
- if (ScrollCursor)
+ if (g_ScrollCursor)
AdjustCursorXY(OldLoffset - Loffset, OldToffset - Toffset);
PlayfieldSetPos(FIELD_WORLD, Loffset, Toffset);
@@ -345,12 +345,12 @@ static void MonitorScroll() {
/*
* Only do it if the actor is there and is visible
*/
- if (!pScrollMover || MoverHidden(pScrollMover) || !MoverIs(pScrollMover))
+ if (!g_pScrollMover || MoverHidden(g_pScrollMover) || !MoverIs(g_pScrollMover))
return;
- GetActorPos(scrollActor, &newx, &newy);
+ GetActorPos(g_scrollActor, &newx, &newy);
- if (oldx == newx && oldy == newy)
+ if (g_oldx == newx && g_oldy == newy)
return;
PlayfieldGetPos(FIELD_WORLD, &Loffset, &Toffset);
@@ -358,49 +358,49 @@ static void MonitorScroll() {
/*
* Approaching right side or left side of the screen?
*/
- if (newx > Loffset+SCREEN_WIDTH - RLDISTANCE && Loffset < ImageW - SCREEN_WIDTH) {
- if (newx > oldx)
+ if (newx > Loffset+SCREEN_WIDTH - RLDISTANCE && Loffset < g_ImageW - SCREEN_WIDTH) {
+ if (newx > g_oldx)
NeedScroll(LEFT);
} else if (newx < Loffset + RLDISTANCE && Loffset) {
- if (newx < oldx)
+ if (newx < g_oldx)
NeedScroll(RIGHT);
}
/*
* Approaching bottom or top of the screen?
*/
- if (newy > Toffset+SCREEN_HEIGHT-DDISTANCE && Toffset < ImageH-SCREEN_HEIGHT) {
- if (newy > oldy)
+ if (newy > Toffset+SCREEN_HEIGHT-DDISTANCE && Toffset < g_ImageH-SCREEN_HEIGHT) {
+ if (newy > g_oldy)
NeedScroll(UP);
- } else if (Toffset && newy < Toffset + UDISTANCE + GetActorBottom(scrollActor) - GetActorTop(scrollActor)) {
- if (newy < oldy)
+ } else if (Toffset && newy < Toffset + UDISTANCE + GetActorBottom(g_scrollActor) - GetActorTop(g_scrollActor)) {
+ if (newy < g_oldy)
NeedScroll(DOWN);
}
- oldx = newx;
- oldy = newy;
+ g_oldx = newx;
+ g_oldy = newy;
}
static void RestoreScrollDefaults() {
- sd.xTrigger = SysVar(SV_SCROLL_XTRIGGER);
- sd.xDistance = SysVar(SV_SCROLL_XDISTANCE);
- sd.xSpeed = SysVar(SV_SCROLL_XSPEED);
- sd.yTriggerTop = SysVar(SV_SCROLL_YTRIGGERTOP);
- sd.yTriggerBottom= SysVar(SV_SCROLL_YTRIGGERBOT);
- sd.yDistance = SysVar(SV_SCROLL_YDISTANCE);
- sd.ySpeed = SysVar(SV_SCROLL_YSPEED);
+ g_sd.xTrigger = SysVar(SV_SCROLL_XTRIGGER);
+ g_sd.xDistance = SysVar(SV_SCROLL_XDISTANCE);
+ g_sd.xSpeed = SysVar(SV_SCROLL_XSPEED);
+ g_sd.yTriggerTop = SysVar(SV_SCROLL_YTRIGGERTOP);
+ g_sd.yTriggerBottom= SysVar(SV_SCROLL_YTRIGGERBOT);
+ g_sd.yDistance = SysVar(SV_SCROLL_YDISTANCE);
+ g_sd.ySpeed = SysVar(SV_SCROLL_YSPEED);
}
/**
* Does the obvious - called at the end of a scene.
*/
void DropScroll() {
- sd.NumNoH = sd.NumNoV = 0;
+ g_sd.NumNoH = g_sd.NumNoV = 0;
if (TinselV2) {
- LeftScroll = DownScroll = 0; // No iterations outstanding
- oldx = oldy = 0;
- scrollPixelsX = sd.xSpeed;
- scrollPixelsY = sd.ySpeed;
+ g_LeftScroll = g_DownScroll = 0; // No iterations outstanding
+ g_oldx = g_oldy = 0;
+ g_scrollPixelsX = g_sd.xSpeed;
+ g_scrollPixelsY = g_sd.ySpeed;
RestoreScrollDefaults();
}
}
@@ -420,28 +420,28 @@ void ScrollProcess(CORO_PARAM, const void *) {
while (!GetBgObject())
CORO_SLEEP(1);
- ImageH = BgHeight(); // Dimensions
- ImageW = BgWidth(); // of this scene.
+ g_ImageH = BgHeight(); // Dimensions
+ g_ImageW = BgWidth(); // of this scene.
// Give up if there'll be no purpose in this process
- if (ImageW == SCREEN_WIDTH && ImageH == SCREEN_HEIGHT)
+ if (g_ImageW == SCREEN_WIDTH && g_ImageH == SCREEN_HEIGHT)
CORO_KILL_SELF();
if (!TinselV2) {
- LeftScroll = DownScroll = 0; // No iterations outstanding
- oldx = oldy = 0;
- scrollPixelsX = scrollPixelsY = SCROLLPIXELS;
+ g_LeftScroll = g_DownScroll = 0; // No iterations outstanding
+ g_oldx = g_oldy = 0;
+ g_scrollPixelsX = g_scrollPixelsY = SCROLLPIXELS;
}
- if (!scrollActor)
- scrollActor = GetLeadId();
+ if (!g_scrollActor)
+ g_scrollActor = GetLeadId();
- pScrollMover = GetMover(scrollActor);
+ g_pScrollMover = GetMover(g_scrollActor);
while (1) {
MonitorScroll(); // Set scroll requirement
- if (LeftScroll || DownScroll) // Scroll if required
+ if (g_LeftScroll || g_DownScroll) // Scroll if required
ScrollImage();
CORO_SLEEP(1); // allow re-scheduling
@@ -454,11 +454,11 @@ void ScrollProcess(CORO_PARAM, const void *) {
* Change which actor the camera is following.
*/
void ScrollFocus(int ano) {
- if (scrollActor != ano) {
- oldx = oldy = 0;
- scrollActor = ano;
+ if (g_scrollActor != ano) {
+ g_oldx = g_oldy = 0;
+ g_scrollActor = ano;
- pScrollMover = ano ? GetMover(scrollActor) : NULL;
+ g_pScrollMover = ano ? GetMover(g_scrollActor) : NULL;
}
}
@@ -466,7 +466,7 @@ void ScrollFocus(int ano) {
* Returns the actor which the camera is following
*/
int GetScrollFocus() {
- return scrollActor;
+ return g_scrollActor;
}
@@ -476,29 +476,29 @@ int GetScrollFocus() {
void ScrollTo(int x, int y, int xIter, int yIter) {
int Loffset, Toffset; // for background offsets
- scrollPixelsX = xIter != 0 ? xIter : (TinselV2 ? sd.xSpeed : SCROLLPIXELS);
- scrollPixelsY = yIter != 0 ? yIter : (TinselV2 ? sd.ySpeed : SCROLLPIXELS);
+ g_scrollPixelsX = xIter != 0 ? xIter : (TinselV2 ? g_sd.xSpeed : SCROLLPIXELS);
+ g_scrollPixelsY = yIter != 0 ? yIter : (TinselV2 ? g_sd.ySpeed : SCROLLPIXELS);
PlayfieldGetPos(FIELD_WORLD, &Loffset, &Toffset); // get background offsets
- LeftScroll = x - Loffset;
- DownScroll = y - Toffset;
+ g_LeftScroll = x - Loffset;
+ g_DownScroll = y - Toffset;
}
/**
* Kill of any current scroll.
*/
void KillScroll() {
- LeftScroll = DownScroll = 0;
+ g_LeftScroll = g_DownScroll = 0;
}
void GetNoScrollData(SCROLLDATA *ssd) {
- memcpy(ssd, &sd, sizeof(SCROLLDATA));
+ memcpy(ssd, &g_sd, sizeof(SCROLLDATA));
}
void RestoreNoScrollData(SCROLLDATA *ssd) {
- memcpy(&sd, ssd, sizeof(SCROLLDATA));
+ memcpy(&g_sd, ssd, sizeof(SCROLLDATA));
}
/**
@@ -512,24 +512,24 @@ void SetScrollParameters(int xTrigger, int xDistance, int xSpeed, int yTriggerTo
RestoreScrollDefaults();
} else {
if (xTrigger)
- sd.xTrigger = xTrigger;
+ g_sd.xTrigger = xTrigger;
if (xDistance)
- sd.xDistance = xDistance;
+ g_sd.xDistance = xDistance;
if (xSpeed)
- sd.xSpeed = xSpeed;
+ g_sd.xSpeed = xSpeed;
if (yTriggerTop)
- sd.yTriggerTop = yTriggerTop;
+ g_sd.yTriggerTop = yTriggerTop;
if (yTriggerBottom)
- sd.yTriggerBottom = yTriggerBottom;
+ g_sd.yTriggerBottom = yTriggerBottom;
if (yDistance)
- sd.yDistance = yDistance;
+ g_sd.yDistance = yDistance;
if (ySpeed)
- sd.ySpeed = ySpeed;
+ g_sd.ySpeed = ySpeed;
}
}
bool IsScrolling() {
- return (LeftScroll || DownScroll);
+ return (g_LeftScroll || g_DownScroll);
}
} // End of namespace Tinsel
diff --git a/engines/tinsel/scroll.h b/engines/tinsel/scroll.h
index 62562b20b2..bcdc15cda6 100644
--- a/engines/tinsel/scroll.h
+++ b/engines/tinsel/scroll.h
@@ -28,9 +28,9 @@ namespace Tinsel {
#define SCROLLPIXELS 8 // Number of pixels to scroll per iteration
// Distance from edge that triggers a scroll
-#define RLDISTANCE (TinselV2 ? sd.xTrigger : 50)
-#define UDISTANCE (TinselV2 ? sd.yTriggerTop : 20)
-#define DDISTANCE (TinselV2 ? sd.yTriggerBottom : 20)
+#define RLDISTANCE (TinselV2 ? g_sd.xTrigger : 50)
+#define UDISTANCE (TinselV2 ? g_sd.yTriggerTop : 20)
+#define DDISTANCE (TinselV2 ? g_sd.yTriggerBottom : 20)
// Number of iterations to make
#define RLSCROLL 160 // 20*8 = 160 = half a screen
diff --git a/engines/tinsel/sound.cpp b/engines/tinsel/sound.cpp
index 130928d885..f575b03270 100644
--- a/engines/tinsel/sound.cpp
+++ b/engines/tinsel/sound.cpp
@@ -49,7 +49,7 @@
namespace Tinsel {
-extern LANGUAGE sampleLanguage;
+extern LANGUAGE g_sampleLanguage;
//--------------------------- General data ----------------------------------
@@ -99,12 +99,12 @@ bool SoundManager::playSample(int id, Audio::Mixer::SoundType type, Audio::Sound
// move to correct position in the sample file
_sampleStream.seek(dwSampleIndex);
if (_sampleStream.eos() || _sampleStream.err() || (uint32)_sampleStream.pos() != dwSampleIndex)
- error(FILE_IS_CORRUPT, _vm->getSampleFile(sampleLanguage));
+ error(FILE_IS_CORRUPT, _vm->getSampleFile(g_sampleLanguage));
// read the length of the sample
uint32 sampleLen = _sampleStream.readUint32();
if (_sampleStream.eos() || _sampleStream.err())
- error(FILE_IS_CORRUPT, _vm->getSampleFile(sampleLanguage));
+ error(FILE_IS_CORRUPT, _vm->getSampleFile(g_sampleLanguage));
if (TinselV1PSX) {
// Read the stream and create a XA ADPCM audio stream
@@ -124,7 +124,7 @@ bool SoundManager::playSample(int id, Audio::Mixer::SoundType type, Audio::Sound
// read all of the sample
if (_sampleStream.read(sampleBuf, sampleLen) != sampleLen)
- error(FILE_IS_CORRUPT, _vm->getSampleFile(sampleLanguage));
+ error(FILE_IS_CORRUPT, _vm->getSampleFile(g_sampleLanguage));
// FIXME: Should set this in a different place ;)
_vm->_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, _vm->_config->_soundVolume);
@@ -254,12 +254,12 @@ bool SoundManager::playSample(int id, int sub, bool bLooped, int x, int y, int p
// move to correct position in the sample file
_sampleStream.seek(dwSampleIndex);
if (_sampleStream.eos() || _sampleStream.err() || (uint32)_sampleStream.pos() != dwSampleIndex)
- error(FILE_IS_CORRUPT, _vm->getSampleFile(sampleLanguage));
+ error(FILE_IS_CORRUPT, _vm->getSampleFile(g_sampleLanguage));
// read the length of the sample
uint32 sampleLen = _sampleStream.readUint32();
if (_sampleStream.eos() || _sampleStream.err())
- error(FILE_IS_CORRUPT, _vm->getSampleFile(sampleLanguage));
+ error(FILE_IS_CORRUPT, _vm->getSampleFile(g_sampleLanguage));
if (sampleLen & 0x80000000) {
// Has sub samples
@@ -273,11 +273,11 @@ bool SoundManager::playSample(int id, int sub, bool bLooped, int x, int y, int p
sampleLen = _sampleStream.readUint32();
_sampleStream.skip(sampleLen);
if (_sampleStream.eos() || _sampleStream.err())
- error(FILE_IS_CORRUPT, _vm->getSampleFile(sampleLanguage));
+ error(FILE_IS_CORRUPT, _vm->getSampleFile(g_sampleLanguage));
}
sampleLen = _sampleStream.readUint32();
if (_sampleStream.eos() || _sampleStream.err())
- error(FILE_IS_CORRUPT, _vm->getSampleFile(sampleLanguage));
+ error(FILE_IS_CORRUPT, _vm->getSampleFile(g_sampleLanguage));
}
debugC(DEBUG_DETAILED, kTinselDebugSound, "Playing sound %d.%d, %d bytes at %d (pan %d)", id, sub, sampleLen,
@@ -289,7 +289,7 @@ bool SoundManager::playSample(int id, int sub, bool bLooped, int x, int y, int p
// read all of the sample
if (_sampleStream.read(sampleBuf, sampleLen) != sampleLen)
- error(FILE_IS_CORRUPT, _vm->getSampleFile(sampleLanguage));
+ error(FILE_IS_CORRUPT, _vm->getSampleFile(g_sampleLanguage));
Common::MemoryReadStream *compressedStream =
new Common::MemoryReadStream(sampleBuf, sampleLen, DisposeAfterUse::YES);
@@ -481,7 +481,7 @@ void SoundManager::openSampleFiles() {
return;
// open sample index file in binary mode
- if (f.open(_vm->getSampleIndex(sampleLanguage))) {
+ if (f.open(_vm->getSampleIndex(g_sampleLanguage))) {
// get length of index file
f.seek(0, SEEK_END); // move to end of file
_sampleIndexLen = f.pos(); // get file pointer
@@ -502,7 +502,7 @@ void SoundManager::openSampleFiles() {
// load data
if (f.read(_sampleIndex, _sampleIndexLen) != (uint32)_sampleIndexLen)
// file must be corrupt if we get to here
- error(FILE_IS_CORRUPT, _vm->getSampleFile(sampleLanguage));
+ error(FILE_IS_CORRUPT, _vm->getSampleFile(g_sampleLanguage));
// close the file
f.close();
@@ -542,28 +542,28 @@ void SoundManager::openSampleFiles() {
_sampleIndex[0] = 0;
} else {
char buf[50];
- sprintf(buf, CANNOT_FIND_FILE, _vm->getSampleIndex(sampleLanguage));
+ sprintf(buf, CANNOT_FIND_FILE, _vm->getSampleIndex(g_sampleLanguage));
GUI::MessageDialog dialog(buf, "OK");
dialog.runModal();
- error(CANNOT_FIND_FILE, _vm->getSampleIndex(sampleLanguage));
+ error(CANNOT_FIND_FILE, _vm->getSampleIndex(g_sampleLanguage));
}
// open sample file in binary mode
- if (!_sampleStream.open(_vm->getSampleFile(sampleLanguage))) {
+ if (!_sampleStream.open(_vm->getSampleFile(g_sampleLanguage))) {
char buf[50];
- sprintf(buf, CANNOT_FIND_FILE, _vm->getSampleFile(sampleLanguage));
+ sprintf(buf, CANNOT_FIND_FILE, _vm->getSampleFile(g_sampleLanguage));
GUI::MessageDialog dialog(buf, "OK");
dialog.runModal();
- error(CANNOT_FIND_FILE, _vm->getSampleFile(sampleLanguage));
+ error(CANNOT_FIND_FILE, _vm->getSampleFile(g_sampleLanguage));
}
/*
// gen length of the largest sample
sampleBuffer.size = _sampleStream.readUint32LE();
if (_sampleStream.eos() || _sampleStream.err())
- error(FILE_IS_CORRUPT, _vm->getSampleFile(sampleLanguage));
+ error(FILE_IS_CORRUPT, _vm->getSampleFile(g_sampleLanguage));
*/
}
diff --git a/engines/tinsel/strres.cpp b/engines/tinsel/strres.cpp
index f3a7278993..5a29a4d2cd 100644
--- a/engines/tinsel/strres.cpp
+++ b/engines/tinsel/strres.cpp
@@ -38,11 +38,11 @@ namespace Tinsel {
#ifdef DEBUG
// Diagnostic number
-int newestString;
+int g_newestString;
#endif
// buffer for resource strings
-static uint8 *textBuffer = 0;
+static uint8 *g_textBuffer = 0;
static struct {
bool bPresent;
@@ -50,7 +50,7 @@ static struct {
SCNHANDLE hDescription;
SCNHANDLE hFlagFilm;
-} languages[NUM_LANGUAGES] = {
+} g_languages[NUM_LANGUAGES] = {
{ false, "English", 0, 0 },
{ false, "French", 0, 0 },
@@ -65,9 +65,9 @@ static struct {
// Set if we're handling 2-byte characters.
-bool bMultiByte = false;
+bool g_bMultiByte = false;
-LANGUAGE textLanguage, sampleLanguage = TXT_ENGLISH;
+LANGUAGE g_textLanguage, g_sampleLanguage = TXT_ENGLISH;
//----------------- LOCAL DEFINES ----------------------------
@@ -85,12 +85,12 @@ void ChangeLanguage(LANGUAGE newLang) {
TinselFile f;
uint32 textLen = 0; // length of buffer
- textLanguage = newLang;
- sampleLanguage = newLang;
+ g_textLanguage = newLang;
+ g_sampleLanguage = newLang;
// free the previous buffer
- free(textBuffer);
- textBuffer = NULL;
+ free(g_textBuffer);
+ g_textBuffer = NULL;
// Try and open the specified language file. If it fails, and the language
// isn't English, try falling back on opening 'english.txt' - some foreign
@@ -116,22 +116,22 @@ void ChangeLanguage(LANGUAGE newLang) {
if (textLen == CHUNK_STRING || textLen == CHUNK_MBSTRING) {
// the file is uncompressed
- bMultiByte = (textLen == CHUNK_MBSTRING);
+ g_bMultiByte = (textLen == CHUNK_MBSTRING);
// get length of uncompressed file
textLen = f.size();
f.seek(0, SEEK_SET); // Set to beginning of file
- if (textBuffer == NULL) {
+ if (g_textBuffer == NULL) {
// allocate a text buffer for the strings
- textBuffer = (uint8 *)malloc(textLen);
+ g_textBuffer = (uint8 *)malloc(textLen);
// make sure memory allocated
- assert(textBuffer);
+ assert(g_textBuffer);
}
// load data
- if (f.read(textBuffer, textLen) != textLen)
+ if (f.read(g_textBuffer, textLen) != textLen)
// file must be corrupt if we get to here
error(FILE_IS_CORRUPT, _vm->getTextFile(newLang));
@@ -147,7 +147,7 @@ void ChangeLanguage(LANGUAGE newLang) {
*/
static byte *FindStringBase(int id) {
// base of string resource table
- byte *pText = textBuffer;
+ byte *pText = g_textBuffer;
// For Tinsel 0, Ids are decremented by 1
if (TinselV0)
@@ -353,8 +353,8 @@ int SubStringCount(int id) {
void FreeTextBuffer() {
- free(textBuffer);
- textBuffer = NULL;
+ free(g_textBuffer);
+ g_textBuffer = NULL;
}
/**
@@ -364,29 +364,29 @@ void FreeTextBuffer() {
void LanguageFacts(int language, SCNHANDLE hDescription, SCNHANDLE hFlagFilm) {
assert(language >= 0 && language < NUM_LANGUAGES);
- languages[language].hDescription = hDescription;
- languages[language].hFlagFilm = hFlagFilm;
+ g_languages[language].hDescription = hDescription;
+ g_languages[language].hFlagFilm = hFlagFilm;
}
/**
* Gets the current subtitles language
*/
LANGUAGE TextLanguage() {
- return textLanguage;
+ return g_textLanguage;
}
/**
* Gets the current voice language
*/
LANGUAGE SampleLanguage() {
- return sampleLanguage;
+ return g_sampleLanguage;
}
int NumberOfLanguages() {
int i, count;
for (i = 0, count = 0; i < NUM_LANGUAGES; i++) {
- if (languages[i].bPresent)
+ if (g_languages[i].bPresent)
count++;
}
return count;
@@ -396,12 +396,12 @@ LANGUAGE NextLanguage(LANGUAGE thisOne) {
int i;
for (i = thisOne+1; i < NUM_LANGUAGES; i++) {
- if (languages[i].bPresent)
+ if (g_languages[i].bPresent)
return (LANGUAGE)i;
}
for (i = 0; i < thisOne; i++) {
- if (languages[i].bPresent)
+ if (g_languages[i].bPresent)
return (LANGUAGE)i;
}
@@ -413,12 +413,12 @@ LANGUAGE PrevLanguage(LANGUAGE thisOne) {
int i;
for (i = thisOne-1; i >= 0; i--) {
- if (languages[i].bPresent)
+ if (g_languages[i].bPresent)
return (LANGUAGE)i;
}
for (i = NUM_LANGUAGES-1; i > thisOne; i--) {
- if (languages[i].bPresent)
+ if (g_languages[i].bPresent)
return (LANGUAGE)i;
}
@@ -427,11 +427,11 @@ LANGUAGE PrevLanguage(LANGUAGE thisOne) {
}
SCNHANDLE LanguageDesc(LANGUAGE thisOne) {
- return languages[thisOne].hDescription;
+ return g_languages[thisOne].hDescription;
}
SCNHANDLE LanguageFlag(LANGUAGE thisOne) {
- return languages[thisOne].hFlagFilm;
+ return g_languages[thisOne].hFlagFilm;
}
} // End of namespace Tinsel
diff --git a/engines/tinsel/strres.h b/engines/tinsel/strres.h
index f6e86951b6..772896c81f 100644
--- a/engines/tinsel/strres.h
+++ b/engines/tinsel/strres.h
@@ -35,7 +35,7 @@ namespace Tinsel {
#define MAX_STRRES_SIZE 300000 // maximum size of string resource file
// Set if we're handling 2-byte characters.
-extern bool bMultiByte;
+extern bool g_bMultiByte;
/*----------------------------------------------------------------------*\
|* Function Prototypes *|
diff --git a/engines/tinsel/sysvar.cpp b/engines/tinsel/sysvar.cpp
index 88053f15c6..6ef4f165ab 100644
--- a/engines/tinsel/sysvar.cpp
+++ b/engines/tinsel/sysvar.cpp
@@ -43,7 +43,7 @@ extern int NewestSavedGame();
// FIXME: Avoid non-const global vars
-static int systemVars[SV_TOPVALID] = {
+static int g_systemVars[SV_TOPVALID] = {
INV_1, // Default inventory
@@ -105,7 +105,7 @@ static int systemVars[SV_TOPVALID] = {
0 // ISV_GHOST_COLOR
};
-static SCNHANDLE systemStrings[SS_MAX_VALID]; // FIXME: Avoid non-const global vars
+static SCNHANDLE g_systemStrings[SS_MAX_VALID]; // FIXME: Avoid non-const global vars
//static bool bFlagNoBlocking = false;
@@ -116,8 +116,8 @@ static SCNHANDLE systemStrings[SS_MAX_VALID]; // FIXME: Avoid non-const global v
*/
void InitSysVars() {
- systemVars[SV_SCROLL_XDISTANCE] = SCREEN_WIDTH / 2;
- systemVars[SV_SCROLL_YDISTANCE] = SCREEN_BOX_HEIGHT1 / 2;
+ g_systemVars[SV_SCROLL_XDISTANCE] = SCREEN_WIDTH / 2;
+ g_systemVars[SV_SCROLL_YDISTANCE] = SCREEN_BOX_HEIGHT1 / 2;
}
/**
@@ -138,7 +138,7 @@ void SetSysVar(int varId, int newValue) {
error("SetSystemVar(): read only identifier");
default:
- systemVars[varId] = newValue;
+ g_systemVars[varId] = newValue;
}
}
@@ -167,28 +167,28 @@ int SysVar(int varId) {
//return bDebuggingAllowed;
default:
- return systemVars[varId];
+ return g_systemVars[varId];
}
}
void SaveSysVars(int *pSv) {
- memcpy(pSv, systemVars, sizeof(systemVars));
+ memcpy(pSv, g_systemVars, sizeof(g_systemVars));
}
void RestoreSysVars(int *pSv) {
- memcpy(systemVars, pSv, sizeof(systemVars));
+ memcpy(g_systemVars, pSv, sizeof(g_systemVars));
}
void SetSysString(int number, SCNHANDLE hString) {
assert(number >= 0 && number < SS_MAX_VALID);
- systemStrings[number] = hString;
+ g_systemStrings[number] = hString;
}
SCNHANDLE SysString(int number) {
assert(number >= 0 && number < SS_MAX_VALID);
- return systemStrings[number];
+ return g_systemStrings[number];
}
/**
diff --git a/engines/tinsel/text.cpp b/engines/tinsel/text.cpp
index ecb1e153f3..5eb092d00d 100644
--- a/engines/tinsel/text.cpp
+++ b/engines/tinsel/text.cpp
@@ -25,7 +25,7 @@
#include "tinsel/graphics.h" // object plotting
#include "tinsel/handle.h"
#include "tinsel/sched.h" // process scheduler defines
-#include "tinsel/strres.h" // bMultiByte
+#include "tinsel/strres.h" // g_bMultiByte
#include "tinsel/text.h" // text defines
namespace Tinsel {
@@ -42,7 +42,7 @@ int StringLengthPix(char *szStr, const FONT *pFont) {
// while not end of string or end of line
for (strLen = 0; (c = *szStr) != EOS_CHAR && c != LF_CHAR; szStr++) {
- if (bMultiByte) {
+ if (g_bMultiByte) {
if (c & 0x80)
c = ((c & ~0x80) << 8) + *++szStr;
}
@@ -136,7 +136,7 @@ OBJECT *ObjectTextOut(OBJECT **pList, char *szStr, int color,
// repeat until end of string or end of line
while ((c = *szStr) != EOS_CHAR && c != LF_CHAR) {
- if (bMultiByte) {
+ if (g_bMultiByte) {
if (c & 0x80)
c = ((c & ~0x80) << 8) + *++szStr;
}
@@ -265,7 +265,7 @@ bool IsCharImage(SCNHANDLE hFont, char 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))
+ if (g_bMultiByte && (c2 & 0x80))
return false;
// get font pointer
diff --git a/engines/tinsel/timers.cpp b/engines/tinsel/timers.cpp
index 1c3ff9b260..d3a7446565 100644
--- a/engines/tinsel/timers.cpp
+++ b/engines/tinsel/timers.cpp
@@ -49,7 +49,7 @@ struct TIMER {
//----------------- LOCAL GLOBAL DATA --------------------
-static TIMER timers[MAX_TIMERS]; // FIXME: Avoid non-const global vars
+static TIMER g_timers[MAX_TIMERS]; // FIXME: Avoid non-const global vars
//--------------------------------------------------------
@@ -72,7 +72,7 @@ uint32 DwGetCurrentTime() {
*/
void RebootTimers() {
- memset(timers, 0, sizeof(timers));
+ memset(g_timers, 0, sizeof(g_timers));
}
/**
@@ -80,11 +80,11 @@ void RebootTimers() {
*/
void syncTimerInfo(Common::Serializer &s) {
for (int i = 0; i < MAX_TIMERS; i++) {
- s.syncAsSint32LE(timers[i].tno);
- s.syncAsSint32LE(timers[i].ticks);
- s.syncAsSint32LE(timers[i].secs);
- s.syncAsSint32LE(timers[i].delta);
- s.syncAsSint32LE(timers[i].frame);
+ s.syncAsSint32LE(g_timers[i].tno);
+ s.syncAsSint32LE(g_timers[i].ticks);
+ s.syncAsSint32LE(g_timers[i].secs);
+ s.syncAsSint32LE(g_timers[i].delta);
+ s.syncAsSint32LE(g_timers[i].frame);
}
}
@@ -95,8 +95,8 @@ void syncTimerInfo(Common::Serializer &s) {
*/
static TIMER *findTimer(int num) {
for (int i = 0; i < MAX_TIMERS; i++) {
- if (timers[i].tno == num)
- return &timers[i];
+ if (g_timers[i].tno == num)
+ return &g_timers[i];
}
return NULL;
}
@@ -109,9 +109,9 @@ static TIMER *allocateTimer(int num) {
assert(!findTimer(num)); // Allocating already existant timer
for (int i = 0; i < MAX_TIMERS; i++) {
- if (!timers[i].tno) {
- timers[i].tno = num;
- return &timers[i];
+ if (!g_timers[i].tno) {
+ g_timers[i].tno = num;
+ return &g_timers[i];
}
}
@@ -123,23 +123,23 @@ static TIMER *allocateTimer(int num) {
*/
void FettleTimers() {
for (int i = 0; i < MAX_TIMERS; i++) {
- if (!timers[i].tno)
+ if (!g_timers[i].tno)
continue;
- timers[i].ticks += timers[i].delta; // Update tick value
+ g_timers[i].ticks += g_timers[i].delta; // Update tick value
- if (timers[i].frame) {
- if (timers[i].ticks < 0)
- timers[i].ticks = 0; // Have reached zero
+ if (g_timers[i].frame) {
+ if (g_timers[i].ticks < 0)
+ g_timers[i].ticks = 0; // Have reached zero
} else {
- if (timers[i].ticks < 0) {
- timers[i].ticks = ONE_SECOND;
- timers[i].secs--;
- if (timers[i].secs < 0)
- timers[i].secs = 0; // Have reached zero
- } else if (timers[i].ticks == ONE_SECOND) {
- timers[i].ticks = 0;
- timers[i].secs++; // Another second has passed
+ if (g_timers[i].ticks < 0) {
+ g_timers[i].ticks = ONE_SECOND;
+ g_timers[i].secs--;
+ if (g_timers[i].secs < 0)
+ g_timers[i].secs = 0; // Have reached zero
+ } else if (g_timers[i].ticks == ONE_SECOND) {
+ g_timers[i].ticks = 0;
+ g_timers[i].secs++; // Another second has passed
}
}
}
diff --git a/engines/tinsel/tinlib.cpp b/engines/tinsel/tinlib.cpp
index 7fbec69cbf..c652abca25 100644
--- a/engines/tinsel/tinlib.cpp
+++ b/engines/tinsel/tinlib.cpp
@@ -74,11 +74,11 @@ namespace Tinsel {
//----------------- EXTERNAL GLOBAL DATA --------------------
// In DOS_DW.C
-extern bool bRestart; // restart flag - set to restart the game
-extern bool bHasRestarted; // Set after a restart
+extern bool g_bRestart; // restart flag - set to restart the game
+extern bool g_bHasRestarted; // Set after a restart
// In PCODE.CPP
-extern bool bNoPause;
+extern bool g_bNoPause;
// In DOS_MAIN.C
// TODO/FIXME: From dos_main.c: "Only used on PSX so far"
@@ -100,7 +100,7 @@ extern int NewestSavedGame();
// in SCENE.CPP
extern void setshowpos();
-extern int sceneCtr;
+extern int g_sceneCtr;
// in TINSEL.CPP
extern void SetCdChangeScene(SCNHANDLE hScene);
@@ -122,10 +122,10 @@ SCNHANDLE GetSceneHandle();
// FIXME: Avoid non-const global vars
-bool bEnableMenu;
+bool g_bEnableMenu;
-static bool bInstantScroll = false;
-static bool bEscapedCdPlay = false;
+static bool g_bInstantScroll = false;
+static bool g_bEscapedCdPlay = false;
//----------------- LOCAL DEFINES --------------------
@@ -298,13 +298,13 @@ static const MASTER_LIB_CODES DW2_CODES[] = {
// as it was at control(off).
// They are global so that MoveCursor(..) has a net effect if it
// precedes control(on).
-static int controlX = 0, controlY = 0;
+static int g_controlX = 0, g_controlY = 0;
-static int offtype = 0; // used by Control()
-static uint32 lastValue = 0; // used by RandomFn()
-static int scrollNumber = 0; // used by scroll()
+static int g_offtype = 0; // used by Control()
+static uint32 g_lastValue = 0; // used by RandomFn()
+static int g_scrollNumber = 0; // used by scroll()
-static bool bNotPointedRunning = false; // Used in Printobj and PrintObjPointed
+static bool g_bNotPointedRunning = false; // Used in Printobj and PrintObjPointed
//----------------- FORWARD REFERENCES --------------------
@@ -404,7 +404,7 @@ static void ScrollMonitorProcess(CORO_PARAM, const void *param) {
CORO_SLEEP(1);
// give up if have been superseded
- if (psm->thisScroll != scrollNumber)
+ if (psm->thisScroll != g_scrollNumber)
break;
// If ESCAPE is pressed...
@@ -706,7 +706,7 @@ static void CDload(SCNHANDLE start, SCNHANDLE next, int myEscape) {
if (TinselV2) {
if (myEscape && myEscape != GetEscEvents()) {
- bEscapedCdPlay = true;
+ g_bEscapedCdPlay = true;
return;
}
@@ -754,14 +754,14 @@ void Control(int param) {
}
// Tinsel 1 handling code
- bEnableMenu = false;
+ g_bEnableMenu = false;
switch (param) {
case CONTROL_STARTOFF:
GetControlToken(); // Take control
DisableTags(); // Switch off tags
DwHideCursor(); // Blank out cursor
- offtype = param;
+ g_offtype = param;
break;
case CONTROL_OFF:
@@ -771,17 +771,17 @@ void Control(int param) {
GetControlToken(); // Take control
DisableTags(); // Switch off tags
- GetCursorXYNoWait(&controlX, &controlY, true); // Store cursor position
+ GetCursorXYNoWait(&g_controlX, &g_controlY, true); // Store cursor position
// There may be a button timing out
GetToken(TOKEN_LEFT_BUT);
FreeToken(TOKEN_LEFT_BUT);
}
- if (offtype == CONTROL_STARTOFF)
- GetCursorXYNoWait(&controlX, &controlY, true); // Store cursor position
+ if (g_offtype == CONTROL_STARTOFF)
+ GetCursorXYNoWait(&g_controlX, &g_controlY, true); // Store cursor position
- offtype = param;
+ g_offtype = param;
if (param == CONTROL_OFF)
DwHideCursor(); // Blank out cursor
@@ -794,8 +794,8 @@ void Control(int param) {
break;
case CONTROL_ON:
- if (offtype != CONTROL_OFFV2 && offtype != CONTROL_STARTOFF)
- SetCursorXY(controlX, controlY);// ... where it was
+ if (g_offtype != CONTROL_OFFV2 && g_offtype != CONTROL_STARTOFF)
+ SetCursorXY(g_controlX, g_controlY);// ... where it was
FreeControlToken(); // Release control
@@ -1092,7 +1092,7 @@ static void DropEverything() {
* EnableMenu
*/
static void EnableMenu() {
- bEnableMenu = true;
+ g_bEnableMenu = true;
}
/**
@@ -1212,7 +1212,7 @@ static void HailScene(SCNHANDLE scene) {
* Returns TRUE if the game has been restarted, FALSE if not.
*/
static bool HasRestarted() {
- return bHasRestarted;
+ return g_bHasRestarted;
}
/**
@@ -1308,7 +1308,7 @@ static int IdleTime() {
* Set flag if InstantScroll(on), reset if InstantScroll(off)
*/
void InstantScroll(int onoff) {
- bInstantScroll = (onoff != 0);
+ g_bInstantScroll = (onoff != 0);
}
/**
@@ -1419,8 +1419,8 @@ static int LToffset(int lort) {
static void MoveCursor(int x, int y) {
SetCursorXY(x, y);
- controlX = x; // Save these values so that
- controlY = y; // control(on) doesn't undo this
+ g_controlX = x; // Save these values so that
+ g_controlY = y; // control(on) doesn't undo this
}
/**
@@ -1465,7 +1465,7 @@ void NewScene(CORO_PARAM, SCNHANDLE scene, int entrance, int transition) {
GetControl(CONTROL_STARTOFF);
if (TinselV1)
- ++sceneCtr;
+ ++g_sceneCtr;
// Prevent code subsequent to this call running before scene changes
if (g_scheduler->getCurrentPID() != PID_MASTER_SCR)
@@ -1541,8 +1541,8 @@ static void Play(CORO_PARAM, SCNHANDLE hFilm, int x, int y, int compit, int acto
// Don't do CDPlay() for now if already escaped
- if (bEscapedCdPlay) {
- bEscapedCdPlay = false;
+ if (g_bEscapedCdPlay) {
+ g_bEscapedCdPlay = false;
return;
}
@@ -1583,8 +1583,8 @@ static void Play(CORO_PARAM, SCNHANDLE hFilm, int x, int y, bool bComplete, int
assert(hFilm != 0);
// Don't do CdPlay() for now if already escaped
- if (bEscapedCdPlay) {
- bEscapedCdPlay = false;
+ if (g_bEscapedCdPlay) {
+ g_bEscapedCdPlay = false;
return;
}
@@ -2068,11 +2068,11 @@ static void PrintObj(CORO_PARAM, const SCNHANDLE hText, const INV_OBJECT *pinvo,
_ctx->myEscape = myEscape;
if (hText == (SCNHANDLE)-1) { // 'OFF'
- bNotPointedRunning = true;
+ g_bNotPointedRunning = true;
return;
}
if (hText == (SCNHANDLE)-2) { // 'ON'
- bNotPointedRunning = false;
+ g_bNotPointedRunning = false;
return;
}
@@ -2092,10 +2092,10 @@ static void PrintObj(CORO_PARAM, const SCNHANDLE hText, const INV_OBJECT *pinvo,
* POINT/other event PrintObj() arbitration...
*/
if (event != POINTED) {
- bNotPointedRunning = true; // Get POINTED text to die
+ g_bNotPointedRunning = true; // Get POINTED text to die
CORO_SLEEP(1); // Give it chance to
} else if (!TinselV2)
- bNotPointedRunning = false; // There may have been an OFF without an ON
+ g_bNotPointedRunning = false; // There may have been an OFF without an ON
// Make multi-ones escape
if (TinselV2 && (SubStringCount(hText) > 1) && !_ctx->myEscape)
@@ -2163,12 +2163,12 @@ static void PrintObj(CORO_PARAM, const SCNHANDLE hText, const INV_OBJECT *pinvo,
break;
// Give way to non-POINTED-generated text
- if (bNotPointedRunning) {
+ if (g_bNotPointedRunning) {
// Delete the text, and wait for the all-clear
MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), _ctx->pText);
_ctx->pText = NULL;
- while (bNotPointedRunning)
+ while (g_bNotPointedRunning)
CORO_SLEEP(1);
GetCursorXY(&x, &y, false);
@@ -2262,7 +2262,7 @@ static void PrintObj(CORO_PARAM, const SCNHANDLE hText, const INV_OBJECT *pinvo,
// Let POINTED text back in if this is the last
if (event != POINTED)
- bNotPointedRunning = false;
+ g_bNotPointedRunning = false;
CORO_END_CODE;
}
@@ -2281,11 +2281,11 @@ static void PrintObjPointed(CORO_PARAM, const SCNHANDLE text, const INV_OBJECT *
break;
// Give way to non-POINTED-generated text
- if (bNotPointedRunning) {
+ if (g_bNotPointedRunning) {
// Delete the text, and wait for the all-clear
MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), pText);
pText = NULL;
- while (bNotPointedRunning)
+ while (g_bNotPointedRunning)
CORO_SLEEP(1);
GetCursorXY(&x, &y, false);
@@ -2372,7 +2372,7 @@ static void PrintObjNonPointed(CORO_PARAM, const SCNHANDLE text, const OBJECT *p
}
} while (1);
- bNotPointedRunning = false; // Let POINTED text back in
+ g_bNotPointedRunning = false; // Let POINTED text back in
if (_ctx->took_control)
Control(CONTROL_ON); // Free control if we took it
@@ -2425,9 +2425,9 @@ static int RandomFn(int n1, int n2, int norpt) {
do {
value = n1 + _vm->getRandomNumber(n2 - n1);
- } while ((lastValue == value) && (norpt == RAND_NORPT) && (++i <= 10));
+ } while ((g_lastValue == value) && (norpt == RAND_NORPT) && (++i <= 10));
- lastValue = value;
+ g_lastValue = value;
return value;
}
@@ -2446,8 +2446,8 @@ void FnRestartGame() {
StopMidi();
StopSample();
- bRestart = true;
- sceneCtr = 0;
+ g_bRestart = true;
+ g_sceneCtr = 0;
}
/**
@@ -2554,15 +2554,15 @@ static void Scroll(CORO_PARAM, EXTREME extreme, int xp, int yp, int xIter, int y
CORO_BEGIN_CODE(_ctx);
- ++scrollNumber;
+ ++g_scrollNumber;
_ctx->x = xp;
_ctx->y = yp;
- if ((TinselV2 && bInstantScroll) || (escOn && myEscape != GetEscEvents())) {
+ if ((TinselV2 && g_bInstantScroll) || (escOn && myEscape != GetEscEvents())) {
// Instant completion!
Offset(extreme, _ctx->x, _ctx->y);
} else {
- _ctx->thisScroll = scrollNumber;
+ _ctx->thisScroll = g_scrollNumber;
if (TinselV2)
DecodeExtreme(extreme, &_ctx->x, &_ctx->y);
@@ -2581,7 +2581,7 @@ static void Scroll(CORO_PARAM, EXTREME extreme, int xp, int yp, int xIter, int y
}
// give up if have been superseded
- if (_ctx->thisScroll != scrollNumber)
+ if (_ctx->thisScroll != g_scrollNumber)
CORO_KILL_SELF();
PlayfieldGetPos(FIELD_WORLD, &Loffset, &Toffset);
@@ -2592,7 +2592,7 @@ static void Scroll(CORO_PARAM, EXTREME extreme, int xp, int yp, int xIter, int y
// Scroll is escapable even though we're not waiting for it
sm.x = _ctx->x;
sm.y = _ctx->y;
- sm.thisScroll = scrollNumber;
+ sm.thisScroll = g_scrollNumber;
sm.myEscape = myEscape;
g_scheduler->createProcess(PID_TCODE, ScrollMonitorProcess, &sm, sizeof(sm));
}
@@ -3410,8 +3410,8 @@ static void TalkOrSay(CORO_PARAM, SPEECH_TYPE speechType, SCNHANDLE hText, int x
if (TinselV2 && _ctx->bSample) {
// Kick off the sample now (perhaps with a delay)
- if (bNoPause)
- bNoPause = false;
+ if (g_bNoPause)
+ g_bNoPause = false;
else if (!IsDemo)
CORO_SLEEP(SysVar(SV_SPEECHDELAY));
@@ -4899,7 +4899,7 @@ int CallLibraryRoutine(CORO_PARAM, int operand, int32 *pp, const INT_CONTEXT *pi
case NOPAUSE:
// DW2 only
- bNoPause = true;
+ g_bNoPause = true;
return 0;
case NOSCROLL:
diff --git a/engines/tinsel/tinsel.cpp b/engines/tinsel/tinsel.cpp
index cd0f9b9fa4..65900cc7f3 100644
--- a/engines/tinsel/tinsel.cpp
+++ b/engines/tinsel/tinsel.cpp
@@ -66,7 +66,7 @@ namespace Tinsel {
// In BG.CPP
extern void SetDoFadeIn(bool tf);
extern void DropBackground();
-extern const BACKGND *pCurBgnd;
+extern const BACKGND *g_pCurBgnd;
// In CURSOR.CPP
extern void CursorProcess(CORO_PARAM, const void *);
@@ -85,16 +85,16 @@ void SetNewScene(SCNHANDLE scene, int entrance, int transition);
// FIXME: Avoid non-const global vars
-bool bRestart = false;
-bool bHasRestarted = false;
-bool loadingFromGMM = false;
+bool g_bRestart = false;
+bool g_bHasRestarted = false;
+bool g_loadingFromGMM = false;
-static bool bCuttingScene = false;
+static bool g_bCuttingScene = false;
-static bool bChangingForRestore = false;
+static bool g_bChangingForRestore = false;
#ifdef DEBUG
-bool bFast; // set to make it go ludicrously fast
+bool g_bFast; // set to make it go ludicrously fast
#endif
//----------------- LOCAL GLOBAL DATA --------------------
@@ -105,14 +105,14 @@ struct Scene {
int trans; // Transition - not yet used
};
-static Scene NextScene = { 0, 0, 0 };
-static Scene HookScene = { 0, 0, 0 };
-static Scene DelayedScene = { 0, 0, 0 };
+static Scene g_NextScene = { 0, 0, 0 };
+static Scene g_HookScene = { 0, 0, 0 };
+static Scene g_DelayedScene = { 0, 0, 0 };
-static PROCESS *pMouseProcess = 0;
-static PROCESS *pKeyboardProcess = 0;
+static PROCESS *g_pMouseProcess = 0;
+static PROCESS *g_pKeyboardProcess = 0;
-static SCNHANDLE hCdChangeScene;
+static SCNHANDLE g_hCdChangeScene;
//----------------- LOCAL PROCEDURES --------------------
@@ -457,49 +457,49 @@ static void MasterScriptProcess(CORO_PARAM, const void *) {
* Store the facts pertaining to a scene change.
*/
void SetNewScene(SCNHANDLE scene, int entrance, int transition) {
- if (!bCuttingScene && TinselV2)
+ if (!g_bCuttingScene && TinselV2)
WrapScene();
// If we're loading from the GMM, load the scene as a delayed one
- if (loadingFromGMM) {
- DelayedScene.scene = scene;
- DelayedScene.entry = entrance;
- DelayedScene.trans = transition;
- loadingFromGMM = false;
+ if (g_loadingFromGMM) {
+ g_DelayedScene.scene = scene;
+ g_DelayedScene.entry = entrance;
+ g_DelayedScene.trans = transition;
+ g_loadingFromGMM = false;
return;
}
// If CD change will be required, stick in the scene change scene
if (CdNumber(scene) != GetCurrentCD()) {
// This scene gets delayed
- DelayedScene.scene = scene;
- DelayedScene.entry = entrance;
- DelayedScene.trans = transition;
+ g_DelayedScene.scene = scene;
+ g_DelayedScene.entry = entrance;
+ g_DelayedScene.trans = transition;
- NextScene.scene = hCdChangeScene;
- NextScene.entry = CdNumber(scene) - '0';
- NextScene.trans = TRANS_FADE;
+ g_NextScene.scene = g_hCdChangeScene;
+ g_NextScene.entry = CdNumber(scene) - '0';
+ g_NextScene.trans = TRANS_FADE;
return;
}
- if (HookScene.scene == 0 || bCuttingScene) {
+ if (g_HookScene.scene == 0 || g_bCuttingScene) {
// This scene comes next
- NextScene.scene = scene;
- NextScene.entry = entrance;
- NextScene.trans = transition;
+ g_NextScene.scene = scene;
+ g_NextScene.entry = entrance;
+ g_NextScene.trans = transition;
} else {
// This scene gets delayed
- DelayedScene.scene = scene;
- DelayedScene.entry = entrance;
- DelayedScene.trans = transition;
+ g_DelayedScene.scene = scene;
+ g_DelayedScene.entry = entrance;
+ g_DelayedScene.trans = transition;
// The hooked scene comes next
- NextScene.scene = HookScene.scene;
- NextScene.entry = HookScene.entry;
- NextScene.trans = HookScene.trans;
+ g_NextScene.scene = g_HookScene.scene;
+ g_NextScene.entry = g_HookScene.entry;
+ g_NextScene.trans = g_HookScene.trans;
- HookScene.scene = 0;
+ g_HookScene.scene = 0;
}
// Workaround for "Missing Red Dragon in square" bug in Discworld 1 PSX, act IV.
@@ -509,10 +509,10 @@ void SetNewScene(SCNHANDLE scene, int entrance, int transition) {
// I'm forcing the load of the right scene by checking that the player has (or has not) the
// right items: player must have Mambo the swamp dragon, and mustn't have fireworks (used on
// the swamp dragon previously to "load it up").
- if (TinselV1PSX && NextScene.scene == 0x1800000 && NextScene.entry == 2) {
+ if (TinselV1PSX && g_NextScene.scene == 0x1800000 && g_NextScene.entry == 2) {
if ((IsInInventory(261, INV_1) || IsInInventory(261, INV_2)) &&
(!IsInInventory(232, INV_1) && !IsInInventory(232, INV_2)))
- NextScene.entry = 1;
+ g_NextScene.entry = 1;
}
}
@@ -520,72 +520,72 @@ void SetNewScene(SCNHANDLE scene, int entrance, int transition) {
* Store a scene as hooked
*/
void SetHookScene(SCNHANDLE scene, int entrance, int transition) {
- assert(HookScene.scene == 0); // scene already hooked
+ assert(g_HookScene.scene == 0); // scene already hooked
- HookScene.scene = scene;
- HookScene.entry = entrance;
- HookScene.trans = transition;
+ g_HookScene.scene = scene;
+ g_HookScene.entry = entrance;
+ g_HookScene.trans = transition;
}
/**
* Hooked scene is over, trigger a change to the delayed scene
*/
void UnHookScene() {
- assert(DelayedScene.scene != 0); // no scene delayed
+ assert(g_DelayedScene.scene != 0); // no scene delayed
// The delayed scene can go now
- NextScene.scene = DelayedScene.scene;
- NextScene.entry = DelayedScene.entry;
- NextScene.trans = DelayedScene.trans;
+ g_NextScene.scene = g_DelayedScene.scene;
+ g_NextScene.entry = g_DelayedScene.entry;
+ g_NextScene.trans = g_DelayedScene.trans;
- DelayedScene.scene = 0;
+ g_DelayedScene.scene = 0;
}
void SuspendHook() {
- bCuttingScene = true;
+ g_bCuttingScene = true;
}
void CdHasChanged() {
- if (bChangingForRestore) {
- bChangingForRestore = false;
+ if (g_bChangingForRestore) {
+ g_bChangingForRestore = false;
RestoreGame(-2);
} else {
- assert(DelayedScene.scene != 0);
+ assert(g_DelayedScene.scene != 0);
WrapScene();
// The delayed scene can go now
- NextScene.scene = DelayedScene.scene;
- NextScene.entry = DelayedScene.entry;
- NextScene.trans = DelayedScene.trans;
+ g_NextScene.scene = g_DelayedScene.scene;
+ g_NextScene.entry = g_DelayedScene.entry;
+ g_NextScene.trans = g_DelayedScene.trans;
- DelayedScene.scene = 0;
+ g_DelayedScene.scene = 0;
}
}
void SetCdChangeScene(SCNHANDLE hScene) {
- hCdChangeScene = hScene;
+ g_hCdChangeScene = hScene;
}
void CDChangeForRestore(int cdNumber) {
- NextScene.scene = hCdChangeScene;
- NextScene.entry = cdNumber;
- NextScene.trans = TRANS_FADE;
- bChangingForRestore = true;
+ g_NextScene.scene = g_hCdChangeScene;
+ g_NextScene.entry = cdNumber;
+ g_NextScene.trans = TRANS_FADE;
+ g_bChangingForRestore = true;
}
void UnSuspendHook() {
- bCuttingScene = false;
+ g_bCuttingScene = false;
}
void syncSCdata(Common::Serializer &s) {
- s.syncAsUint32LE(HookScene.scene);
- s.syncAsSint32LE(HookScene.entry);
- s.syncAsSint32LE(HookScene.trans);
+ s.syncAsUint32LE(g_HookScene.scene);
+ s.syncAsSint32LE(g_HookScene.entry);
+ s.syncAsSint32LE(g_HookScene.trans);
- s.syncAsUint32LE(DelayedScene.scene);
- s.syncAsSint32LE(DelayedScene.entry);
- s.syncAsSint32LE(DelayedScene.trans);
+ s.syncAsUint32LE(g_DelayedScene.scene);
+ s.syncAsSint32LE(g_DelayedScene.entry);
+ s.syncAsSint32LE(g_DelayedScene.trans);
}
@@ -640,16 +640,16 @@ bool ChangeScene(bool bReset) {
// Prevent attempt to fade-out when restarting game
if (bReset) {
CountOut = 1; // immediate start of first scene again
- DelayedScene.scene = HookScene.scene = 0;
+ g_DelayedScene.scene = g_HookScene.scene = 0;
return false;
}
if (IsRestoringScene())
return true;
- if (NextScene.scene != 0) {
+ if (g_NextScene.scene != 0) {
if (!CountOut) {
- switch (NextScene.trans) {
+ switch (g_NextScene.trans) {
case TRANS_CUT:
CountOut = 1;
break;
@@ -667,10 +667,10 @@ bool ChangeScene(bool bReset) {
if (!TinselV2)
ClearScreen();
- StartNewScene(NextScene.scene, NextScene.entry);
- NextScene.scene = 0;
+ StartNewScene(g_NextScene.scene, g_NextScene.entry);
+ g_NextScene.scene = 0;
- switch (NextScene.trans) {
+ switch (g_NextScene.trans) {
case TRANS_CUT:
SetDoFadeIn(false);
break;
@@ -691,7 +691,7 @@ bool ChangeScene(bool bReset) {
* CuttingScene
*/
void CuttingScene(bool bCutting) {
- bCuttingScene = bCutting;
+ g_bCuttingScene = bCutting;
if (!bCutting)
WrapScene();
@@ -927,7 +927,7 @@ Common::Error TinselEngine::run() {
RebootTimers();
RebootScalingReels();
- DelayedScene.scene = HookScene.scene = 0;
+ g_DelayedScene.scene = g_HookScene.scene = 0;
#endif
// Load in text strings
@@ -957,7 +957,7 @@ Common::Error TinselEngine::run() {
if (ConfMan.hasKey("save_slot")) {
if (loadGameState(ConfMan.getInt("save_slot")).getCode() == Common::kNoError)
- loadingFromGMM = true;
+ g_loadingFromGMM = true;
}
// Foreground loop
@@ -973,10 +973,10 @@ Common::Error TinselEngine::run() {
NextGameCycle();
}
- if (bRestart) {
+ if (g_bRestart) {
RestartGame();
- bRestart = false;
- bHasRestarted = true; // Set restarted flag
+ g_bRestart = false;
+ g_bHasRestarted = true; // Set restarted flag
}
// Save/Restore scene file transfers
@@ -986,7 +986,7 @@ Common::Error TinselEngine::run() {
_bmv->FettleBMV();
#ifdef DEBUG
- if (bFast)
+ if (g_bFast)
continue; // run flat-out
#endif
// Loop processing events while there are any pending
@@ -1005,7 +1005,7 @@ Common::Error TinselEngine::run() {
_vm->_config->writeToDisk();
EndScene();
- pCurBgnd = NULL;
+ g_pCurBgnd = NULL;
return Common::kNoError;
}
@@ -1106,7 +1106,7 @@ void TinselEngine::RestartGame() {
RebootTimers();
RebootScalingReels();
- DelayedScene.scene = HookScene.scene = 0;
+ g_DelayedScene.scene = g_HookScene.scene = 0;
// remove keyboard, mouse and joystick drivers
ChopDrivers();
@@ -1135,8 +1135,8 @@ void TinselEngine::RestartDrivers() {
_scheduler->reset();
// init the event handlers
- pMouseProcess = _scheduler->createProcess(PID_MOUSE, MouseProcess, NULL, 0);
- pKeyboardProcess = _scheduler->createProcess(PID_KEYBOARD, KeyboardProcess, NULL, 0);
+ g_pMouseProcess = _scheduler->createProcess(PID_MOUSE, MouseProcess, NULL, 0);
+ g_pKeyboardProcess = _scheduler->createProcess(PID_KEYBOARD, KeyboardProcess, NULL, 0);
// open MIDI files
OpenMidiFiles();
@@ -1164,8 +1164,8 @@ void TinselEngine::ChopDrivers() {
DeleteMidiBuffer();
// remove event drivers
- _scheduler->killProcess(pMouseProcess);
- _scheduler->killProcess(pKeyboardProcess);
+ _scheduler->killProcess(g_pMouseProcess);
+ _scheduler->killProcess(g_pKeyboardProcess);
}
/**
diff --git a/engines/tinsel/token.cpp b/engines/tinsel/token.cpp
index c7490a100b..c26fa40466 100644
--- a/engines/tinsel/token.cpp
+++ b/engines/tinsel/token.cpp
@@ -34,7 +34,7 @@ struct Token {
PROCESS *proc;
};
-static Token tokens[NUMTOKENS]; // FIXME: Avoid non-const global vars
+static Token g_tokens[NUMTOKENS]; // FIXME: Avoid non-const global vars
/**
@@ -44,8 +44,8 @@ static void TerminateProcess(PROCESS *tProc) {
// Release tokens held by the process
for (int i = 0; i < NUMTOKENS; i++) {
- if (tokens[i].proc == tProc) {
- tokens[i].proc = NULL;
+ if (g_tokens[i].proc == tProc) {
+ g_tokens[i].proc = NULL;
}
}
@@ -59,8 +59,8 @@ static void TerminateProcess(PROCESS *tProc) {
void GetControlToken() {
const int which = TOKEN_CONTROL;
- if (tokens[which].proc == NULL) {
- tokens[which].proc = g_scheduler->getCurrentProcess();
+ if (g_tokens[which].proc == NULL) {
+ g_tokens[which].proc = g_scheduler->getCurrentProcess();
}
}
@@ -69,7 +69,7 @@ void GetControlToken() {
*/
void FreeControlToken() {
// Allow anyone to free TOKEN_CONTROL
- tokens[TOKEN_CONTROL].proc = NULL;
+ g_tokens[TOKEN_CONTROL].proc = NULL;
}
@@ -84,12 +84,12 @@ void FreeControlToken() {
void GetToken(int which) {
assert(TOKEN_LEAD <= which && which < NUMTOKENS);
- if (tokens[which].proc != NULL) {
- assert(tokens[which].proc != g_scheduler->getCurrentProcess());
- TerminateProcess(tokens[which].proc);
+ if (g_tokens[which].proc != NULL) {
+ assert(g_tokens[which].proc != g_scheduler->getCurrentProcess());
+ TerminateProcess(g_tokens[which].proc);
}
- tokens[which].proc = g_scheduler->getCurrentProcess();
+ g_tokens[which].proc = g_scheduler->getCurrentProcess();
}
/**
@@ -99,9 +99,9 @@ void GetToken(int which) {
void FreeToken(int which) {
assert(TOKEN_LEAD <= which && which < NUMTOKENS);
- assert(tokens[which].proc == g_scheduler->getCurrentProcess()); // we'd have been killed if some other proc had taken this token
+ assert(g_tokens[which].proc == g_scheduler->getCurrentProcess()); // we'd have been killed if some other proc had taken this token
- tokens[which].proc = NULL;
+ g_tokens[which].proc = NULL;
}
/**
@@ -111,7 +111,7 @@ bool TestToken(int which) {
if (which < 0 || which >= NUMTOKENS)
return false;
- return (tokens[which].proc == NULL);
+ return (g_tokens[which].proc == NULL);
}
/**
@@ -119,7 +119,7 @@ bool TestToken(int which) {
*/
void FreeAllTokens() {
for (int i = 0; i < NUMTOKENS; i++) {
- tokens[i].proc = NULL;
+ g_tokens[i].proc = NULL;
}
}
diff --git a/engines/toltecs/menu.cpp b/engines/toltecs/menu.cpp
index 00a0372e99..172ec0a565 100644
--- a/engines/toltecs/menu.cpp
+++ b/engines/toltecs/menu.cpp
@@ -118,7 +118,7 @@ void MenuSystem::handleEvents() {
Common::Event event;
Common::EventManager *eventMan = _vm->_system->getEventManager();
while (eventMan->pollEvent(event)) {
- switch (event.type) {
+ switch (event.type) {
case Common::EVENT_KEYDOWN:
handleKeyDown(event.kbd);
break;
@@ -406,7 +406,7 @@ void MenuSystem::clickItem(ItemID id) {
}
void MenuSystem::restoreRect(int x, int y, int w, int h) {
- byte *src = (byte*)_background->getBasePtr(x, y);
+ byte *src = (byte *)_background->getBasePtr(x, y);
byte *dst = _vm->_screen->_frontScreen + x + y * 640;
while (h--) {
memcpy(dst, src, w);
@@ -416,7 +416,7 @@ void MenuSystem::restoreRect(int x, int y, int w, int h) {
}
void MenuSystem::shadeRect(int x, int y, int w, int h, byte color1, byte color2) {
- byte *src = (byte*)_background->getBasePtr(x, y);
+ byte *src = (byte *)_background->getBasePtr(x, y);
for (int xc = 0; xc < w; xc++) {
src[xc] = color2;
src[xc + h * 640] = color1;
diff --git a/engines/toltecs/movie.cpp b/engines/toltecs/movie.cpp
index 054683b63e..76d42ebf0a 100644
--- a/engines/toltecs/movie.cpp
+++ b/engines/toltecs/movie.cpp
@@ -215,7 +215,7 @@ void MoviePlayer::fetchAudioChunks() {
byte chunkType = _vm->_arc->readByte();
uint32 chunkSize = _vm->_arc->readUint32LE();
if (chunkType == 4) {
- byte *chunkBuffer = (byte*)malloc(chunkSize);
+ byte *chunkBuffer = (byte *)malloc(chunkSize);
_vm->_arc->read(chunkBuffer, chunkSize);
_audioStream->queueBuffer(chunkBuffer, chunkSize, DisposeAfterUse::YES, Audio::FLAG_UNSIGNED);
chunkBuffer = NULL;
@@ -268,7 +268,7 @@ bool MoviePlayer::handleInput() {
Common::Event event;
Common::EventManager *eventMan = g_system->getEventManager();
while (eventMan->pollEvent(event)) {
- switch (event.type) {
+ switch (event.type) {
case Common::EVENT_KEYDOWN:
if (event.kbd.keycode == Common::KEYCODE_ESCAPE)
return false;
@@ -279,7 +279,6 @@ bool MoviePlayer::handleInput() {
case Common::EVENT_QUIT:
_vm->quitGame();
return false;
- break;
default:
break;
}
diff --git a/engines/toltecs/resource.h b/engines/toltecs/resource.h
index 7f4694f0f6..3fed2e11ca 100644
--- a/engines/toltecs/resource.h
+++ b/engines/toltecs/resource.h
@@ -71,7 +71,7 @@ public:
void purgeCache();
protected:
- typedef Common::HashMap<uint, Resource*> ResourceMap;
+ typedef Common::HashMap<uint, Resource *> ResourceMap;
ToltecsEngine *_vm;
diff --git a/engines/toltecs/screen.cpp b/engines/toltecs/screen.cpp
index d66ed18d8c..b781490b69 100644
--- a/engines/toltecs/screen.cpp
+++ b/engines/toltecs/screen.cpp
@@ -658,7 +658,7 @@ void Screen::drawSurface(int16 x, int16 y, Graphics::Surface *surface) {
int16 skipX = 0;
int16 width = surface->w;
int16 height = surface->h;
- byte *surfacePixels = (byte*)surface->getBasePtr(0, 0);
+ byte *surfacePixels = (byte *)surface->getBasePtr(0, 0);
byte *frontScreen;
// Not on screen, skip
diff --git a/engines/toltecs/script.cpp b/engines/toltecs/script.cpp
index e5fc865f5b..9683831980 100644
--- a/engines/toltecs/script.cpp
+++ b/engines/toltecs/script.cpp
@@ -490,57 +490,57 @@ void ScriptInterpreter::execScriptFunction(uint16 index) {
VarType ScriptInterpreter::getGameVarType(uint variable) {
switch (variable) {
- case 0: return vtByte;
- case 1: return vtWord;
- case 2: return vtWord;
- case 3: return vtByte;
- case 4: return vtWord;
- case 5: return vtWord;
- case 6: return vtWord;
- case 7: return vtWord;
- case 8: return vtWord;
- case 9: return vtWord;
- case 10: return vtWord;
- case 11: return vtWord;
- case 12: return vtByte;
- case 13: return vtWord;
- case 14: return vtWord;
- case 15: return vtWord;
- case 16: return vtWord;
- case 17: return vtWord;
- case 18: return vtWord;
- case 19: return vtWord;
- case 20: return vtWord;
- case 21: return vtWord;
- default:
- error("Invalid game variable");
+ case 0: return vtByte;
+ case 1: return vtWord;
+ case 2: return vtWord;
+ case 3: return vtByte;
+ case 4: return vtWord;
+ case 5: return vtWord;
+ case 6: return vtWord;
+ case 7: return vtWord;
+ case 8: return vtWord;
+ case 9: return vtWord;
+ case 10: return vtWord;
+ case 11: return vtWord;
+ case 12: return vtByte;
+ case 13: return vtWord;
+ case 14: return vtWord;
+ case 15: return vtWord;
+ case 16: return vtWord;
+ case 17: return vtWord;
+ case 18: return vtWord;
+ case 19: return vtWord;
+ case 20: return vtWord;
+ case 21: return vtWord;
+ default:
+ error("Invalid game variable");
}
}
const char *getVarName(uint variable) {
switch (variable) {
- case 0: return "mouseDisabled";
- case 1: return "mouseY";
- case 2: return "mouseX";
- case 3: return "mouseButton";
- case 4: return "verbLineY";
- case 5: return "verbLineX";
- case 6: return "verbLineWidth";
- case 7: return "verbLineCount";
- case 8: return "verbLineNum";
- case 9: return "talkTextItemNum";
- case 10: return "talkTextY";
- case 11: return "talkTextX";
- case 12: return "talkTextFontColor";
- case 13: return "cameraY";
- case 14: return "cameraX";
- case 15: return "walkSpeedY";
- case 16: return "walkSpeedX";
- case 17: return "flag01";
- case 18: return "sceneResIndex";
- case 19: return "guiHeight";
- case 20: return "sceneHeight";
- case 21: return "sceneWidth";
+ case 0: return "mouseDisabled";
+ case 1: return "mouseY";
+ case 2: return "mouseX";
+ case 3: return "mouseButton";
+ case 4: return "verbLineY";
+ case 5: return "verbLineX";
+ case 6: return "verbLineWidth";
+ case 7: return "verbLineCount";
+ case 8: return "verbLineNum";
+ case 9: return "talkTextItemNum";
+ case 10: return "talkTextY";
+ case 11: return "talkTextX";
+ case 12: return "talkTextFontColor";
+ case 13: return "cameraY";
+ case 14: return "cameraX";
+ case 15: return "walkSpeedY";
+ case 16: return "walkSpeedX";
+ case 17: return "flag01";
+ case 18: return "sceneResIndex";
+ case 19: return "guiHeight";
+ case 20: return "sceneHeight";
+ case 21: return "sceneWidth";
}
return "(invalid)";
}
@@ -549,31 +549,31 @@ int16 ScriptInterpreter::getGameVar(uint variable) {
debug(0, "ScriptInterpreter::getGameVar(%d{%s})", variable, getVarName(variable));
switch (variable) {
- case 0: return _vm->_mouseDisabled;
- case 1: return _vm->_mouseY;
- case 2: return _vm->_mouseX;
- case 3: return _vm->_mouseButton;
- case 4: return _vm->_screen->_verbLineY;
- case 5: return _vm->_screen->_verbLineX;
- case 6: return _vm->_screen->_verbLineWidth;
- case 7: return _vm->_screen->_verbLineCount;
- case 8: return _vm->_screen->_verbLineNum;
- case 9: return _vm->_screen->_talkTextItemNum;
- case 10: return _vm->_screen->_talkTextY;
- case 11: return _vm->_screen->_talkTextX;
- case 12: return _vm->_screen->_talkTextFontColor;
- case 13: return _vm->_cameraY;
- case 14: return _vm->_cameraX;
- case 15: return _vm->_walkSpeedY;
- case 16: return _vm->_walkSpeedX;
- case 17: return _vm->_flag01;
- case 18: return _vm->_sceneResIndex;
- case 19: return _vm->_guiHeight;
- case 20: return _vm->_sceneHeight;
- case 21: return _vm->_sceneWidth;
- default:
- warning("Getting unimplemented game variable %s (%d)", getVarName(variable), variable);
- return 0;
+ case 0: return _vm->_mouseDisabled;
+ case 1: return _vm->_mouseY;
+ case 2: return _vm->_mouseX;
+ case 3: return _vm->_mouseButton;
+ case 4: return _vm->_screen->_verbLineY;
+ case 5: return _vm->_screen->_verbLineX;
+ case 6: return _vm->_screen->_verbLineWidth;
+ case 7: return _vm->_screen->_verbLineCount;
+ case 8: return _vm->_screen->_verbLineNum;
+ case 9: return _vm->_screen->_talkTextItemNum;
+ case 10: return _vm->_screen->_talkTextY;
+ case 11: return _vm->_screen->_talkTextX;
+ case 12: return _vm->_screen->_talkTextFontColor;
+ case 13: return _vm->_cameraY;
+ case 14: return _vm->_cameraX;
+ case 15: return _vm->_walkSpeedY;
+ case 16: return _vm->_walkSpeedX;
+ case 17: return _vm->_flag01;
+ case 18: return _vm->_sceneResIndex;
+ case 19: return _vm->_guiHeight;
+ case 20: return _vm->_sceneHeight;
+ case 21: return _vm->_sceneWidth;
+ default:
+ warning("Getting unimplemented game variable %s (%d)", getVarName(variable), variable);
+ return 0;
}
}
@@ -581,72 +581,72 @@ void ScriptInterpreter::setGameVar(uint variable, int16 value) {
debug(0, "ScriptInterpreter::setGameVar(%d{%s}, %d)", variable, getVarName(variable), value);
switch (variable) {
- case 0:
- _vm->_mouseDisabled = value;
- CursorMan.showMouse(value == 0);
- break;
- case 3:
- _vm->_mouseButton = value;
- break;
- case 4:
- _vm->_screen->_verbLineY = value;
- break;
- case 5:
- _vm->_screen->_verbLineX = value;
- break;
- case 6:
- _vm->_screen->_verbLineWidth = value;
- break;
- case 7:
- _vm->_screen->_verbLineCount = value;
- break;
- case 8:
- _vm->_screen->_verbLineNum = value;
- break;
- case 9:
- _vm->_screen->_talkTextItemNum = value;
- break;
- case 10:
- _vm->_screen->_talkTextY = value;
- break;
- case 11:
- _vm->_screen->_talkTextX = value;
- break;
- case 12:
- _vm->_screen->_talkTextFontColor = value;
- break;
- case 13:
- _vm->_cameraY = value;
- break;
- case 14:
- _vm->_cameraX = value;
- break;
- case 15:
- _vm->_walkSpeedY = value;
- break;
- case 16:
- _vm->_walkSpeedX = value;
- break;
- case 17:
- _vm->_flag01 = value != 0;
- break;
- case 18:
- _vm->_sceneResIndex = value;
- break;
- case 19:
- _vm->_guiHeight = value;
- break;
- case 20:
- _vm->_sceneHeight = value;
- break;
- case 21:
- _vm->_sceneWidth = value;
- break;
- case 1:
- case 2:
- default:
- warning("Setting unimplemented game variable %s (%d) to %d", getVarName(variable), variable, value);
- break;
+ case 0:
+ _vm->_mouseDisabled = value;
+ CursorMan.showMouse(value == 0);
+ break;
+ case 3:
+ _vm->_mouseButton = value;
+ break;
+ case 4:
+ _vm->_screen->_verbLineY = value;
+ break;
+ case 5:
+ _vm->_screen->_verbLineX = value;
+ break;
+ case 6:
+ _vm->_screen->_verbLineWidth = value;
+ break;
+ case 7:
+ _vm->_screen->_verbLineCount = value;
+ break;
+ case 8:
+ _vm->_screen->_verbLineNum = value;
+ break;
+ case 9:
+ _vm->_screen->_talkTextItemNum = value;
+ break;
+ case 10:
+ _vm->_screen->_talkTextY = value;
+ break;
+ case 11:
+ _vm->_screen->_talkTextX = value;
+ break;
+ case 12:
+ _vm->_screen->_talkTextFontColor = value;
+ break;
+ case 13:
+ _vm->_cameraY = value;
+ break;
+ case 14:
+ _vm->_cameraX = value;
+ break;
+ case 15:
+ _vm->_walkSpeedY = value;
+ break;
+ case 16:
+ _vm->_walkSpeedX = value;
+ break;
+ case 17:
+ _vm->_flag01 = value != 0;
+ break;
+ case 18:
+ _vm->_sceneResIndex = value;
+ break;
+ case 19:
+ _vm->_guiHeight = value;
+ break;
+ case 20:
+ _vm->_sceneHeight = value;
+ break;
+ case 21:
+ _vm->_sceneWidth = value;
+ break;
+ case 1:
+ case 2:
+ default:
+ warning("Setting unimplemented game variable %s (%d) to %d", getVarName(variable), variable, value);
+ break;
}
}
@@ -786,7 +786,7 @@ void ScriptInterpreter::sfGetRandomNumber() {
}
void ScriptInterpreter::sfDrawGuiTextMulti() {
- _vm->_screen->drawGuiTextMulti((byte*)localPtr(arg16(3)));
+ _vm->_screen->drawGuiTextMulti((byte *)localPtr(arg16(3)));
}
void ScriptInterpreter::sfUpdateVerbLine() {
@@ -907,11 +907,11 @@ void ScriptInterpreter::sfDrawGuiImage() {
}
void ScriptInterpreter::sfAddAnimatedSpriteNoLoop() {
- _vm->_screen->addAnimatedSprite(arg16(5), arg16(3), arg16(7), (byte*)localPtr(0), (int16*)localPtr(arg16(9)), false, 2);
+ _vm->_screen->addAnimatedSprite(arg16(5), arg16(3), arg16(7), (byte *)localPtr(0), (int16 *)localPtr(arg16(9)), false, 2);
}
void ScriptInterpreter::sfAddAnimatedSprite() {
- _vm->_screen->addAnimatedSprite(arg16(5), arg16(3), arg16(7), (byte*)localPtr(0), (int16*)localPtr(arg16(9)), true, 2);
+ _vm->_screen->addAnimatedSprite(arg16(5), arg16(3), arg16(7), (byte *)localPtr(0), (int16 *)localPtr(arg16(9)), true, 2);
}
void ScriptInterpreter::sfAddStaticSprite() {
@@ -919,11 +919,11 @@ void ScriptInterpreter::sfAddStaticSprite() {
}
void ScriptInterpreter::sfAddAnimatedSpriteScaled() {
- _vm->_screen->addAnimatedSprite(arg16(5), arg16(3), arg16(7), (byte*)localPtr(0), (int16*)localPtr(arg16(9)), true, 1);
+ _vm->_screen->addAnimatedSprite(arg16(5), arg16(3), arg16(7), (byte *)localPtr(0), (int16 *)localPtr(arg16(9)), true, 1);
}
void ScriptInterpreter::sfFindPath() {
- _vm->_segmap->findPath((int16*)(getSlotData(arg16(13)) + arg16(11)), arg16(9), arg16(7), arg16(5), arg16(3));
+ _vm->_segmap->findPath((int16 *)(getSlotData(arg16(13)) + arg16(11)), arg16(9), arg16(7), arg16(5), arg16(3));
}
void ScriptInterpreter::sfWalk() {
diff --git a/engines/toltecs/script.h b/engines/toltecs/script.h
index 1a5a9c90ad..0c1898c525 100644
--- a/engines/toltecs/script.h
+++ b/engines/toltecs/script.h
@@ -77,7 +77,7 @@ protected:
};
ToltecsEngine *_vm;
- Common::Array<const ScriptFunction*> _scriptFuncs;
+ Common::Array<const ScriptFunction *> _scriptFuncs;
Common::Array<const char *> _scriptFuncNames;
byte *_stack;
diff --git a/engines/toltecs/segmap.cpp b/engines/toltecs/segmap.cpp
index 10e5f56096..f7d806c67b 100644
--- a/engines/toltecs/segmap.cpp
+++ b/engines/toltecs/segmap.cpp
@@ -269,7 +269,7 @@ struct LineData {
};
void plotProc(int x, int y, int color, void *data) {
- LineData *ld = (LineData*)data;
+ LineData *ld = (LineData *)data;
ld->surf[x + y * ld->pitch] = color;
}
@@ -373,7 +373,7 @@ void SegmentMap::loadSegmapMaskRectSurface(byte *maskData, SegmapMaskRect &maskR
maskRect.surface->create(maskRect.width, maskRect.height, Graphics::PixelFormat::createFormatCLUT8());
byte *backScreen = _vm->_screen->_backScreen + maskRect.x + (maskRect.y * _vm->_sceneWidth);
- byte *dest = (byte*)maskRect.surface->getBasePtr(0, 0);
+ byte *dest = (byte *)maskRect.surface->getBasePtr(0, 0);
for (int16 h = 0; h < maskRect.height; h++) {
int16 w = maskRect.width;
diff --git a/engines/toon/audio.cpp b/engines/toon/audio.cpp
index b9adfa7eeb..77822ab078 100644
--- a/engines/toon/audio.cpp
+++ b/engines/toon/audio.cpp
@@ -514,7 +514,7 @@ Common::SeekableReadStream *AudioStreamPackage::getStream(int32 id, bool ownMemo
int32 size = 0;
getInfo(id, &offset, &size);
if (ownMemory) {
- byte *memory = (byte*)malloc(size);
+ byte *memory = (byte *)malloc(size);
_file->seek(offset);
_file->read(memory, size);
return new Common::MemoryReadStream(memory, size, DisposeAfterUse::YES);
diff --git a/engines/toon/character.cpp b/engines/toon/character.cpp
index 715bd33433..0e5189957b 100644
--- a/engines/toon/character.cpp
+++ b/engines/toon/character.cpp
@@ -997,7 +997,7 @@ bool Character::loadShadowAnimation(const Common::String &animName) {
void Character::plotPath(Graphics::Surface& surface) {
for (int i = 0; i < _currentPathNodeCount; i++) {
- *(byte*)surface.getBasePtr(_currentPathX[i], _currentPathY[i]) = ( i < _currentPathNode);
+ *(byte *)surface.getBasePtr(_currentPathX[i], _currentPathY[i]) = ( i < _currentPathNode);
}
}
diff --git a/engines/toon/detection.cpp b/engines/toon/detection.cpp
index 6a76ade90a..8234934972 100644
--- a/engines/toon/detection.cpp
+++ b/engines/toon/detection.cpp
@@ -79,6 +79,15 @@ static const ADGameDescription gameDescriptions[] = {
{
"toon", "",
{
+ {"local.pak", 0, "48ec60709bebbdeff791d55ee18ec910", 3417846},
+ {"arcaddbl.svl", 0, "1d1b96e317e03ffd3874a8ebe59556f3", 6246232},
+ {"study.svl", 0, "d4aff126ee27be3c3d25e2996369d7cb", 2324368},
+ },
+ Common::RU_RUS, Common::kPlatformPC, ADGF_NO_FLAGS, GUIO0()
+ },
+ {
+ "toon", "",
+ {
{"local.pak", 0, "bf5da4c03f78ffbd643f12122319366e", 3250841},
{"wacexdbl.emc", 0, "cfbc2156a31b294b038204888407ebc8", 6974},
{"generic.svl", 0, "5eb99850ada22f0b8cf6392262d4dd07", 9404599},
diff --git a/engines/toon/script_func.h b/engines/toon/script_func.h
index ef1cb59f47..e22c4b34fa 100644
--- a/engines/toon/script_func.h
+++ b/engines/toon/script_func.h
@@ -39,7 +39,7 @@ public:
Common::Array<const OpcodeV2 *> _opcodes;
ToonEngine *_vm;
-#define SYSFUNC(x) int32 x(EMCState*)
+#define SYSFUNC(x) int32 x(EMCState *)
SYSFUNC(sys_Cmd_Dummy);
SYSFUNC(sys_Cmd_Change_Actor_X_And_Y);
SYSFUNC(sys_Cmd_Init_Talking_Character);
diff --git a/engines/toon/toon.cpp b/engines/toon/toon.cpp
index 99932362af..657e18635f 100644
--- a/engines/toon/toon.cpp
+++ b/engines/toon/toon.cpp
@@ -4666,11 +4666,11 @@ void ToonEngine::addDirtyRect( int32 left, int32 top, int32 right, int32 bottom
top = MIN<int32>(MAX<int32>(top, 0), TOON_BACKBUFFER_HEIGHT);
bottom = MIN<int32>(MAX<int32>(bottom, 0), TOON_BACKBUFFER_HEIGHT);
- Common::Rect rect(left, top, right, bottom);
-
if (bottom - top <= 0 || right - left <= 0)
return;
+ Common::Rect rect(left, top, right, bottom);
+
for (uint32 i = 0; i < _dirtyRects.size(); i++) {
if (_dirtyRects[i].contains(rect))
return;
diff --git a/engines/touche/saveload.cpp b/engines/touche/saveload.cpp
index 7732c6deb9..a054299ecd 100644
--- a/engines/touche/saveload.cpp
+++ b/engines/touche/saveload.cpp
@@ -60,7 +60,7 @@ static void saveOrLoadPtr(Common::ReadStream &stream, int16 *&p, int16 *base) {
p = base + offset;
}
-template <class S>
+template<class S>
static void saveOrLoad(S &s, Common::Rect &r) {
saveOrLoad(s, r.left);
saveOrLoad(s, r.top);
@@ -68,13 +68,13 @@ static void saveOrLoad(S &s, Common::Rect &r) {
saveOrLoad(s, r.bottom);
}
-template <class S>
+template<class S>
static void saveOrLoad(S &s, SequenceEntry &seq) {
saveOrLoad(s, seq.sprNum);
saveOrLoad(s, seq.seqNum);
}
-template <class S>
+template<class S>
static void saveOrLoad(S &s, KeyChar &key) {
saveOrLoad(s, key.num);
saveOrLoad(s, key.flags);
@@ -134,14 +134,14 @@ static void saveOrLoad(S &s, KeyChar &key) {
}
}
-template <class S>
+template<class S>
static void saveOrLoad(S &s, TalkEntry &entry) {
saveOrLoad(s, entry.otherKeyChar);
saveOrLoad(s, entry.talkingKeyChar);
saveOrLoad(s, entry.num);
}
-template <class S>
+template<class S>
static void saveOrLoad(S &s, ProgramHitBoxData &data) {
saveOrLoad(s, data.item);
saveOrLoad(s, data.talk);
@@ -156,14 +156,14 @@ static void saveOrLoad(S &s, ProgramHitBoxData &data) {
}
}
-template <class S>
+template<class S>
static void saveOrLoad(S &s, Area &area) {
saveOrLoad(s, area.r);
saveOrLoad(s, area.srcX);
saveOrLoad(s, area.srcY);
}
-template <class S>
+template<class S>
static void saveOrLoad(S &s, ProgramBackgroundData &data) {
saveOrLoad(s, data.area);
saveOrLoad(s, data.type);
@@ -172,7 +172,7 @@ static void saveOrLoad(S &s, ProgramBackgroundData &data) {
saveOrLoad(s, data.scaleDiv);
}
-template <class S>
+template<class S>
static void saveOrLoad(S &s, ProgramAreaData &data) {
saveOrLoad(s, data.area);
saveOrLoad(s, data.id);
@@ -181,7 +181,7 @@ static void saveOrLoad(S &s, ProgramAreaData &data) {
saveOrLoad(s, data.animNext);
}
-template <class S>
+template<class S>
static void saveOrLoad(S &s, ProgramWalkData &data) {
saveOrLoad(s, data.point1);
saveOrLoad(s, data.point2);
@@ -190,7 +190,7 @@ static void saveOrLoad(S &s, ProgramWalkData &data) {
saveOrLoad(s, data.area2);
}
-template <class S>
+template<class S>
static void saveOrLoad(S &s, ProgramPointData &data) {
saveOrLoad(s, data.x);
saveOrLoad(s, data.y);
@@ -198,7 +198,7 @@ static void saveOrLoad(S &s, ProgramPointData &data) {
saveOrLoad(s, data.order);
}
-template <class A>
+template<class A>
static void saveOrLoadCommonArray(Common::WriteStream &stream, A &array) {
uint count = array.size();
assert(count < 0xFFFF);
@@ -208,7 +208,7 @@ static void saveOrLoadCommonArray(Common::WriteStream &stream, A &array) {
}
}
-template <class A>
+template<class A>
static void saveOrLoadCommonArray(Common::ReadStream &stream, A &array) {
uint count = stream.readUint16LE();
if (count == array.size()) {
@@ -218,7 +218,7 @@ static void saveOrLoadCommonArray(Common::ReadStream &stream, A &array) {
}
}
-template <class S, class A>
+template<class S, class A>
static void saveOrLoadStaticArray(S &s, A &array, uint count) {
for (uint i = 0; i < count; ++i) {
saveOrLoad(s, array[i]);
diff --git a/engines/touche/staticres.cpp b/engines/touche/staticres.cpp
index f7b1482f80..f35845e881 100644
--- a/engines/touche/staticres.cpp
+++ b/engines/touche/staticres.cpp
@@ -887,6 +887,8 @@ const uint8 Graphics::_freGerFontData[] = {
};
// spanish charset differs from original executable, see tracker item #2040311.
+// We remap missing accented upper case letters from CP850 to their unaccented
+// ASCII variants. Specifically, 0xB5 -> A, 0xD6 -> I, 0xE0 -> O, 0xE9 -> U.
const uint16 Graphics::_spaFontOffs[] = {
0x0000, 0x0007, 0x0024, 0x0043, 0x0072, 0x00AD, 0x00E0, 0x0113, 0x0124, 0x0141,
0x015E, 0x0191, 0x01C4, 0x01E3, 0x01F8, 0x0215, 0x0232, 0x0269, 0x0286, 0x02BD,
@@ -907,7 +909,8 @@ const uint16 Graphics::_spaFontOffs[] = {
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0703, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x1954
+ 0x0000, 0x0000, 0x0627, 0x1954, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x097D
};
const int Graphics::_spaFontSize = ARRAYSIZE(Graphics::_spaFontOffs);
diff --git a/engines/touche/touche.cpp b/engines/touche/touche.cpp
index 81d6adf581..4b989963f6 100644
--- a/engines/touche/touche.cpp
+++ b/engines/touche/touche.cpp
@@ -81,6 +81,7 @@ ToucheEngine::ToucheEngine(OSystem *system, Common::Language language)
DebugMan.addDebugChannel(kDebugResource, "Resource", "Resource debug level");
DebugMan.addDebugChannel(kDebugOpcodes, "Opcodes", "Opcodes debug level");
DebugMan.addDebugChannel(kDebugMenu, "Menu", "Menu debug level");
+ DebugMan.addDebugChannel(kDebugCharset, "Charset", "Charset debug level");
_console = new ToucheConsole(this);
}
@@ -1260,6 +1261,13 @@ const char *ToucheEngine::getString(int num) const {
int ToucheEngine::getStringWidth(int num) const {
const char *str = getString(num);
+ if (DebugMan.isDebugChannelEnabled(kDebugCharset)) {
+ debug("stringwidth: %s", str);
+ debugN("raw:");
+ const char *p = str;
+ while (*p) debugN(" %02X", (unsigned char)*p++);
+ debugN("\n");
+ }
return Graphics::getStringWidth16(str);
}
diff --git a/engines/touche/touche.h b/engines/touche/touche.h
index cbb3fec7aa..949727b665 100644
--- a/engines/touche/touche.h
+++ b/engines/touche/touche.h
@@ -277,7 +277,8 @@ enum {
kDebugGraphics = 1 << 1,
kDebugResource = 1 << 2,
kDebugOpcodes = 1 << 3,
- kDebugMenu = 1 << 4
+ kDebugMenu = 1 << 4,
+ kDebugCharset = 1 << 5
};
enum ResourceType {
diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp
index fdd9feac03..c2ce426052 100644
--- a/engines/tsage/core.cpp
+++ b/engines/tsage/core.cpp
@@ -1301,6 +1301,13 @@ bool ScenePalette::loadPalette(int paletteNum) {
return true;
}
+/**
+ * Loads a palette from the passed raw data block
+ */
+void ScenePalette::loadPalette(const byte *pSrc, int start, int count) {
+ Common::copy(pSrc, pSrc + count * 3, &_palette[start * 3]);
+}
+
void ScenePalette::refresh() {
// Set indexes for standard colors to closest color in the palette
_colors.background = indexOf(255, 255, 255); // White background
@@ -2702,6 +2709,20 @@ void BackgroundSceneObject::draw() {
g_globals->_sceneManager._scene->_backSurface.copyFrom(frame, destRect, priorityRegion);
}
+void BackgroundSceneObject::setup2(int visage, int stripFrameNum, int frameNum, int posX, int posY, int priority, int32 arg10) {
+ warning("TODO: Implement properly BackgroundSceneObject::setup2()");
+ postInit();
+ setVisage(visage);
+ setStrip(stripFrameNum);
+ setFrame(frameNum);
+ setPosition(Common::Point(posX, posY), 0);
+ fixPriority(priority);
+}
+
+void BackgroundSceneObject::proc27() {
+ warning("STUB: BackgroundSceneObject::proc27()");
+}
+
/*--------------------------------------------------------------------------*/
void SceneObjectList::draw() {
@@ -4086,7 +4107,8 @@ void SceneHandler::process(Event &event) {
// Check for displaying right-click dialog
if ((event.eventType == EVENT_BUTTON_DOWN) && (event.btnState == BTNSHIFT_RIGHT) &&
- g_globals->_player._uiEnabled) {
+ g_globals->_player._uiEnabled &&
+ ((g_vm->getGameID() != GType_Ringworld2) || (R2_GLOBALS._sceneManager._sceneNumber != 1330))) {
g_globals->_game->rightClick();
event.handled = true;
diff --git a/engines/tsage/core.h b/engines/tsage/core.h
index 846dd3532c..45bb3506d5 100644
--- a/engines/tsage/core.h
+++ b/engines/tsage/core.h
@@ -372,6 +372,8 @@ public:
~ScenePalette();
bool loadPalette(int paletteNum);
+ void loadPalette(const byte *pSrc, int start, int count);
+ void replace(const ScenePalette *src) { loadPalette(src->_palette, 0, 256); }
void refresh();
void setPalette(int index, int count);
void getEntry(int index, uint *r, uint *g, uint *b);
@@ -516,8 +518,8 @@ private:
int getNewFrame();
void animEnded();
- int changeFrame();
public:
+ int changeFrame();
uint32 _updateStartFrame;
uint32 _walkStartFrame;
Common::Point _field2E;
@@ -608,6 +610,8 @@ public:
virtual Common::String getClassName() { return "BackgroundSceneObject"; }
virtual void postInit(SceneObjectList *OwnerList = NULL);
virtual void draw();
+ void setup2(int visage, int stripFrameNum, int frameNum, int posX, int posY, int priority, int32 arg10);
+ void proc27();
};
class SceneText : public SceneObject {
diff --git a/engines/tsage/detection.cpp b/engines/tsage/detection.cpp
index 12add10c58..0c458f5c35 100644
--- a/engines/tsage/detection.cpp
+++ b/engines/tsage/detection.cpp
@@ -74,7 +74,6 @@ enum {
class TSageMetaEngine : public AdvancedMetaEngine {
public:
TSageMetaEngine() : AdvancedMetaEngine(TsAGE::gameDescriptions, sizeof(TsAGE::tSageGameDescription), tSageGameTitles) {
- _md5Bytes = 5000;
_singleid = "tsage";
_guioptions = GUIO1(GUIO_NOSPEECH);
}
diff --git a/engines/tsage/detection_tables.h b/engines/tsage/detection_tables.h
index 0f6d8c9d7d..d538cbacbf 100644
--- a/engines/tsage/detection_tables.h
+++ b/engines/tsage/detection_tables.h
@@ -140,7 +140,23 @@ static const tSageGameDescription gameDescriptions[] = {
GType_BlueForce,
GF_CD | GF_ALT_REGIONS
},
-
+#if 0
+ // Blue Force Spanish doesn't yet work
+ // Blue Force Spanish CD
+ {
+ {
+ "blueforce",
+ "CD",
+ AD_ENTRY1s("blue.rlb", "5b2b35c51b62e82d82b0791540bfae2d", 10082565),
+ Common::ES_ESP,
+ Common::kPlatformPC,
+ ADGF_CD | ADGF_TESTING,
+ GUIO2(GUIO_NOSPEECH, GUIO_NOSFX)
+ },
+ GType_BlueForce,
+ GF_CD | GF_ALT_REGIONS
+ },
+#endif
// Return to Ringworld
{
{
diff --git a/engines/tsage/events.h b/engines/tsage/events.h
index dcff1b45b8..cf2d1a34ed 100644
--- a/engines/tsage/events.h
+++ b/engines/tsage/events.h
@@ -87,21 +87,27 @@ enum CursorType {
// Ringworld 2 objects
R2_OPTO_DISK = 1, R2_READER = 2, R2_NEGATOR_GUN = 3, R2_STEPPING_DISKS = 4,
- R2_ATTRACTOR_UNIT = 5, R2_SENSOR_PROBE = 6,
- R2_7 = 7, R2_8 = 8, R2_9 = 9, R2_10 = 10, R2_11 = 11, R2_12 = 12, R2_13 = 13, R2_OPTICAL_FIBRE = 14,
- R2_CLAMP = 15, R2_16 = 16, R2_17 = 17, R2_18 = 18, R2_19 = 19, R2_20 = 20, R2_21 = 21,
- R2_22 = 22, R2_23 = 23, R2_24 = 24, R2_25 = 25, R2_26 = 26, R2_27 = 27, R2_28 = 28,
- R2_29 = 29, R2_30 = 30, R2_31 = 31, R2_32 = 32, R2_33 = 33, R2_34 = 34, R2_35 = 35,
- R2_36 = 36, R2_37 = 37, R2_38 = 38, R2_39 = 39, R2_40 = 40, R2_41 = 41, R2_42 = 42,
- R2_43 = 43, R2_44 = 44, R2_45 = 45, R2_46 = 46, R2_47 = 47, R2_48 = 48, R2_49 = 49,
- R2_50 = 50, R2_51 = 51, R2_52 = 52,
- R2_LAST_INVENT = 53,
+ R2_ATTRACTOR_UNIT = 5, R2_SENSOR_PROBE = 6, R2_SONIC_STUNNER = 7,
+ R2_CABLE_HARNESS = 8, R2_COM_SCANNER = 9, R2_SPENT_POWER_CAPSULE = 10,
+ R2_CHARGED_POWER_CAPSULE = 11, R2_AEROSOL = 12, R2_REMOTE_CONTROL = 13,
+ R2_OPTICAL_FIBRE = 14, R2_CLAMP = 15, R2_ATTRACTOR_CABLE_HARNESS = 16,
+ R2_FUEL_CELL = 17, R2_GYROSCOPE = 18, R2_AIRBAG = 19, R2_REBREATHER_TANK = 20,
+ R2_RESERVE_REBREATHER_TANK = 21, R2_GUIDANCE_MODULE = 22, R2_THRUSTER_VALVE = 23,
+ R2_BALLOON_BACKPACK = 24, R2_RADAR_MECHANISM = 25, R2_JOYSTICK = 26,
+ R2_IGNITOR = 27, R2_DIAGNOSTICS_DISPLAY = 28, R2_GLASS_DOME = 29, R2_WICK_LAMP = 30,
+ R2_SCRITH_KEY = 31, R2_TANNER_MASK = 32, R2_PURE_GRAIN_ALCOHOL = 33, R2_SAPPHIRE_BLUE = 34,
+ R2_ANCIENT_SCROLLS = 35, R2_FLUTE = 36, R2_GUNPOWDER = 37, R2_NONAME = 38,
+ R2_COM_SCANNER_2 = 39, R2_SUPERCONDUCTOR_WIRE = 40, R2_PILLOW = 41, R2_FOOD_TRAY = 42,
+ R2_LASER_HACKSAW = 43, R2_PHOTON_STUNNER = 44, R2_BATTERY = 45, R2_SOAKED_FACEMASK = 46,
+ R2_LIGHT_BULB = 47, R2_ALCOHOL_LAMP = 48, R2_ALCOHOL_LAMP_2 = 49, R2_ALCOHOL_LAMP_3 = 50,
+ R2_BROKEN_DISPLAY = 51, R2_TOOLBOX = 52, R2_LAST_INVENT = 53,
// Ringworld 2 cursors
R2CURSORS_START = 0x8000, EXITCURSOR_N = 0x8007, EXITCURSOR_S = 0x8008, EXITCURSOR_W = 0x8009,
EXITCURSOR_E = 0x800A, EXITCURSOR_LEFT_HAND = 0x800B, CURSOR_INVALID = 0x800C,
EXITCURSOR_NE = 0x800D, EXITCURSOR_SE = 0x800E, EXITCURSOR_SW = 0x800F, EXITCURSOR_NW = 0x8010,
SHADECURSOR_UP = 0x8011, SHADECURSOR_DOWN = 0x8012, SHADECURSOR_HAND = 0x8013,
+ R2_CURSOR_20 = 0x8014, R2_CURSOR_21 = 0x8015, R2_CURSOR_22 = 0x8016, R2_CURSOR_23 = 0x8017,
// Cursors
CURSOR_WALK = 0x100, CURSOR_LOOK = 0x200, CURSOR_700 = 700, CURSOR_USE = 0x400, CURSOR_TALK = 0x800,
@@ -143,7 +149,7 @@ public:
Common::EventType type() { return _event.type; }
uint32 getFrameNumber() const { return _frameNumber; }
void delay(int numFrames);
- bool isInventoryIcon() const { return _currentCursor < 256; }
+ bool isInventoryIcon() const { return (_currentCursor >= 0) && (_currentCursor < 256); }
void proc1() { warning("TODO: EventsClass::proc1"); }
virtual void listenerSynchronize(Serializer &s);
diff --git a/engines/tsage/globals.cpp b/engines/tsage/globals.cpp
index bae933a2c5..b4c3127ea8 100644
--- a/engines/tsage/globals.cpp
+++ b/engines/tsage/globals.cpp
@@ -375,32 +375,97 @@ void Ringworld2Globals::reset() {
T2_GLOBALS._uiElements._active = false;
// Reset fields
+ Common::fill(&_v1000[0], &_v1000[0x1000], 0);
+ _v1000Flag = false;
+ _v5589E.set(0, 0, 0, 0);
_v558B6.set(0, 0, 0, 0);
_v558C2 = 0;
_v5657C = 0;
+ _v565E1 = 0;
+ _v565E3 = 0;
+ _v565E5 = 0;
+ _v565E7 = 0;
+ _v565E9 = -5;
+ _v565EB = 26;
_v565F5 = 0;
+ _v565F6 = 0;
+ _v565FA = 0;
_v565AE = 0;
- for (int i = 0; i < 14; i++)
- _v56605[i] = 0;
+ _v56605[0] = 0;
+ _v56605[1] = 3;
+ _v56605[2] = 5;
+ _v56605[3] = 1;
+ _v56605[4] = 2;
+ _v56605[5] = 5;
+ _v56605[6] = 9;
+ _v56605[7] = 14;
+ _v56605[8] = 15;
+ _v56605[9] = 18;
+ _v56605[10] = 20;
+ _v56605[11] = 25;
+ _v56605[12] = 27;
+ _v56605[13] = 31;
+
+ for (int i = 0; i < 18; i++) {
+ _v56613[(i * 4) ] = 1;
+ _v56613[(i * 4) + 2] = 0;
+ _v56613[(i * 4) + 3] = 0;
+ }
+ _v56613[( 0 * 4) + 1] = 1;
+ _v56613[( 1 * 4) + 1] = 2;
+ _v56613[( 2 * 4) + 1] = 2;
+ _v56613[( 3 * 4) + 1] = 3;
+ _v56613[( 4 * 4) + 1] = 2;
+ _v56613[( 5 * 4) + 1] = 2;
+ _v56613[( 6 * 4) + 1] = 3;
+ _v56613[( 7 * 4) + 1] = 1;
+ _v56613[( 8 * 4) + 1] = 1;
+ _v56613[( 9 * 4) + 1] = 3;
+ _v56613[(10 * 4) + 1] = 3;
+ _v56613[(11 * 4) + 1] = 1;
+ _v56613[(12 * 4) + 1] = 2;
+ _v56613[(13 * 4) + 1] = 3;
+ _v56613[(14 * 4) + 1] = 2;
+ _v56613[(15 * 4) + 1] = 3;
+ _v56613[(16 * 4) + 1] = 1;
+ _v56613[(17 * 4) + 1] = 1;
+
_v566A6 = 3800;
- _v566A8 = 0;
+ _v566A3 = 2;
+ _v566A4 = 1;
+ _v566A5 = 0;
+ _v566A8 = 5;
_v566A9 = 0;
_v566AA = 0;
for (int i = 0; i < 1000; i++)
_v566AB[i] = 0;
- _v56A93 = 0;
- _v56A99 = 0;
+ _v56A93 = -1;
+ _v56A99 = 5;
+ _scene1925CurrLevel = 0; //_v56A9C
_v56A9E = 0;
_v56AA0 = 0;
_v56AA1 = 0;
+ _v56AA2 = 60;
+ _v56AA4 = 660;
+ _v56AA6 = 1;
+ _v56AA7 = 1;
+ _v56AA8 = 1;
_v56AAB = 0;
+ _scene180Mode = -1;
+ _v57709 = 0;
+ _v5780C = 0;
+ _v5780E = 0;
+ _v57810 = 0;
_v57C2C = 0;
- _v58CE2 = 0;
- Common::fill(&_v565F1[0], &_v565F1[MAX_CHARACTERS], 0);
+ _v565EC[0] = 0;
+ _v565EC[1] = 27;
+ _v565EC[2] = 27;
+ _v565EC[3] = 4;
+ _v565EC[4] = 4;
+ Common::fill(&_v565F1[0], &_v565F1[MAX_CHARACTERS], 1);
_speechSubtitles = SPEECH_VOICE | SPEECH_TEXT;
_insetUp = 0;
-
- Common::fill(&_v565F1[0], &_v565F1[MAX_CHARACTERS], 0);
+ _frameEdgeColour = 2;
Common::fill(&_stripManager_lookupList[0], &_stripManager_lookupList[12], 0);
_stripManager_lookupList[0] = 1;
_stripManager_lookupList[1] = 1;
@@ -424,28 +489,53 @@ void Ringworld2Globals::synchronize(Serializer &s) {
TsAGE2Globals::synchronize(s);
int i;
+ _v5589E.synchronize(s);
_v558B6.synchronize(s);
s.syncAsSint16LE(_v558C2);
s.syncAsSint16LE(_v5657C);
+ s.syncAsSint16LE(_v565E1);
+ s.syncAsSint16LE(_v565E3);
+ s.syncAsSint16LE(_v565E5);
+ s.syncAsSint16LE(_v565E7);
+ s.syncAsSint16LE(_v565E9);
+ s.syncAsSint16LE(_v565EB);
s.syncAsSint16LE(_v565F5);
+ s.syncAsSint16LE(_v565F6);
+ s.syncAsSint16LE(_v565FA);
+ s.syncAsSint16LE(_v566A3);
s.syncAsSint16LE(_v566A6);
s.syncAsSint16LE(_v56A93);
+ s.syncAsSint16LE(_scene1925CurrLevel); // _v56A9C
s.syncAsSint16LE(_v56A9E);
+ s.syncAsSint16LE(_v56AA2);
+ s.syncAsSint16LE(_v56AA4);
s.syncAsSint16LE(_v56AAB);
+ s.syncAsSint16LE(_scene180Mode);
+ s.syncAsSint16LE(_v57709);
+ s.syncAsSint16LE(_v5780C);
+ s.syncAsSint16LE(_v5780E);
+ s.syncAsSint16LE(_v57810);
s.syncAsSint16LE(_v57C2C);
- s.syncAsSint16LE(_v58CE2);
s.syncAsSint16LE(_speechSubtitles);
+ for (i = 0; i < 5; i++)
+ s.syncAsByte(_v565EC[i]);
+
for (i = 0; i < MAX_CHARACTERS; ++i)
- s.syncAsSint16LE(_v565F1[i]);
+ s.syncAsByte(_v565F1[i]);
s.syncAsByte(_v565AE);
+ s.syncAsByte(_v566A4);
+ s.syncAsByte(_v566A5);
s.syncAsByte(_v566A8);
s.syncAsByte(_v566A9);
s.syncAsByte(_v566AA);
s.syncAsByte(_v56AA0);
s.syncAsByte(_v56AA1);
+ s.syncAsByte(_v56AA6);
+ s.syncAsByte(_v56AA7);
+ s.syncAsByte(_v56AA8);
for (i = 0; i < 14; ++i)
s.syncAsByte(_v56605[i]);
@@ -456,6 +546,7 @@ void Ringworld2Globals::synchronize(Serializer &s) {
s.syncAsByte(_stripManager_lookupList[i]);
s.syncAsSint16LE(_insetUp);
+ s.syncAsByte(_frameEdgeColour);
}
} // end of namespace Ringworld2
diff --git a/engines/tsage/globals.h b/engines/tsage/globals.h
index 23bb79b50f..d80e4d9859 100644
--- a/engines/tsage/globals.h
+++ b/engines/tsage/globals.h
@@ -242,33 +242,66 @@ namespace Ringworld2 {
#define SPEECH_TEXT 1
#define SPEECH_VOICE 2
+#define k5A78C 15
+#define k5A78D 16
+#define k5A790 18
+#define k5A791 17
+
class Ringworld2Globals: public TsAGE2Globals {
public:
ASoundExt _sound1, _sound2, _sound3, _sound4;
PlayStream _playStream;
StripProxy _stripProxy;
+ bool _v1000Flag;
+ byte _v1000[0x1000];
+ byte _palIndexList[10][256];
int _insetUp;
+ int _frameEdgeColour; // _v421e
+ Rect _v5589E;
Rect _v558B6;
int _v558C2;
+ int _v565E1;
+ int _v565E3;
+ int _v565E5;
+ int _v565E7;
+ int _v565E9;
+ int _v565EB;
int _v565F5;
+ int _v565F6;
+ int _v565FA;
int _v5657C;
byte _v565AE;
byte _v56605[14];
+ int _v56613[76];
+ byte _v566A4;
+ byte _v566A5;
int _v566A6;
+ byte _v566A3;
byte _v566A8;
byte _v566A9;
byte _v566AA;
byte _v566AB[1000];
int _v56A93;
byte _v56A99;
+ int _scene1925CurrLevel; //_v56A9C
int _v56A9E;
byte _v56AA0;
byte _v56AA1;
+ int _v56AA2;
+ int _v56AA4;
+ byte _v56AA6;
+ byte _v56AA7;
+ byte _v56AA8;
int _v56AAB;
+ int _scene180Mode; // _v575f7
+ int _v57709;
+ int _v5780C;
+ int _v5780E;
+ int _v57810;
int _v57C2C;
- int _v58CE2;
int _speechSubtitles;
- int _v565F1[4];
+ byte _v565EC[5];
+ byte _v565F1[4];
byte _stripManager_lookupList[12];
virtual void reset();
diff --git a/engines/tsage/graphics.cpp b/engines/tsage/graphics.cpp
index 8436afe2e8..acb615abae 100644
--- a/engines/tsage/graphics.cpp
+++ b/engines/tsage/graphics.cpp
@@ -259,6 +259,12 @@ void GfxSurface::updateScreen() {
for (Common::List<Rect>::iterator i = _dirtyRects.begin(); i != _dirtyRects.end(); ++i) {
Rect r = *i;
+ // Make sure that there is something to update. If not, skip this
+ // rectangle. An example case is the speedbike closeup at the beginning
+ // of Ringworld (third screen).
+ if (r.isEmpty())
+ continue;
+
const byte *srcP = (const byte *)_customSurface->getBasePtr(r.left, r.top);
g_system->copyRectToScreen(srcP, _customSurface->pitch, r.left, r.top,
r.width(), r.height());
@@ -434,7 +440,7 @@ bool GfxSurface::displayText(const Common::String &msg, const Common::Point &pt)
// Display the text
gfxManager._font.writeLines(msg.c_str(), textRect, ALIGN_LEFT);
- // Write for a mouse or keypress
+ // Wait for a mouse or keypress
Event event;
while (!g_globals->_events.getEvent(event, EVENT_BUTTON_DOWN | EVENT_KEYPRESS) && !g_vm->shouldQuit())
;
@@ -596,7 +602,7 @@ void GfxSurface::copyFrom(GfxSurface &src, Rect srcBounds, Rect destBounds, Regi
destBounds.bottom = destSurface.h;
if (destBounds.isValidRect() && !((destBounds.right < 0) || (destBounds.bottom < 0)
- || (destBounds.left >= SCREEN_WIDTH) || (destBounds.top >= SCREEN_HEIGHT))) {
+ || (destBounds.left >= destSurface.w) || (destBounds.top >= destSurface.h))) {
// Register the affected area as dirty
addDirtyRect(destBounds);
@@ -1302,20 +1308,14 @@ int GfxManager::getAngle(const Common::Point &p1, const Common::Point &p2) {
}
}
-
void GfxManager::copyFrom(GfxSurface &src, Rect destBounds, Region *priorityRegion) {
- if (&_surface == &(GLOBALS._screenSurface))
- _surface.setBounds(Rect(0, 0, _bounds.width(), _bounds.height()));
- else
- _surface.setBounds(_bounds);
+ _surface.setBounds(_bounds);
_surface.copyFrom(src, destBounds, priorityRegion);
}
+
void GfxManager::copyFrom(GfxSurface &src, int destX, int destY) {
- if (&_surface == &(GLOBALS._screenSurface))
- _surface.setBounds(Rect(0, 0, _bounds.width(), _bounds.height()));
- else
- _surface.setBounds(_bounds);
+ _surface.setBounds(_bounds);
_surface.copyFrom(src, destX, destY);
}
diff --git a/engines/tsage/resources.cpp b/engines/tsage/resources.cpp
index 824f20e9b2..f6f870be20 100644
--- a/engines/tsage/resources.cpp
+++ b/engines/tsage/resources.cpp
@@ -135,7 +135,7 @@ uint16 BitReader::readToken() {
/*-------------------------------------------------------------------------*/
TLib::TLib(MemoryManager &memManager, const Common::String &filename) :
- _memoryManager(memManager) {
+ _filename(filename), _memoryManager(memManager) {
// If the resource strings list isn't yet loaded, load them
if (_resStrings.size() == 0) {
@@ -158,25 +158,35 @@ TLib::~TLib() {
_resStrings.clear();
}
+/**
+ * Load a section index from the given position in the file
+ */
void TLib::loadSection(uint32 fileOffset) {
_resources.clear();
_file.seek(fileOffset);
_sections.fileOffset = fileOffset;
- if (_file.readUint32BE() != 0x544D492D)
+ loadSection(_file, _resources);
+}
+
+/**
+ * Inner logic for decoding a section index into a passed resource list object
+ */
+void TLib::loadSection(Common::File &f, ResourceList &resources) {
+ if (f.readUint32BE() != 0x544D492D)
error("Data block is not valid Rlb data");
- /*uint8 unknown1 = */_file.readByte();
- uint16 numEntries = _file.readByte();
+ /*uint8 unknown1 = */f.readByte();
+ uint16 numEntries = f.readByte();
for (uint i = 0; i < numEntries; ++i) {
- uint16 id = _file.readUint16LE();
- uint16 size = _file.readUint16LE();
- uint16 uncSize = _file.readUint16LE();
- uint8 sizeHi = _file.readByte();
- uint8 type = _file.readByte() >> 5;
+ uint16 id = f.readUint16LE();
+ uint16 size = f.readUint16LE();
+ uint16 uncSize = f.readUint16LE();
+ uint8 sizeHi = f.readByte();
+ uint8 type = f.readByte() >> 5;
assert(type <= 1);
- uint32 offset = _file.readUint32LE();
+ uint32 offset = f.readUint32LE();
ResourceEntry re;
re.id = id;
@@ -185,7 +195,7 @@ void TLib::loadSection(uint32 fileOffset) {
re.size = ((sizeHi & 0xF) << 16) | size;
re.uncompressedSize = ((sizeHi & 0xF0) << 12) | uncSize;
- _resources.push_back(re);
+ resources.push_back(re);
}
}
@@ -443,6 +453,36 @@ bool TLib::getMessage(int resNum, int lineNum, Common::String &result, bool supp
/*--------------------------------------------------------------------------*/
+/**
+ * Open up the main resource file and get an entry from the root section
+ */
+bool TLib::getSectionEntry(Common::File &f, ResourceType resType, int rlbNum, int resNum,
+ ResourceEntry &resEntry) {
+ // Try and open the resource file
+ if (!f.open(_filename))
+ return false;
+
+ // Load the root section index
+ ResourceList resList;
+ loadSection(f, resList);
+
+ // Loop through the index for the desired entry
+ ResourceList::iterator iter;
+ for (iter = _resources.begin(); iter != _resources.end(); ++iter) {
+ ResourceEntry &re = *iter;
+ if (re.id == resNum) {
+ // Found it, so exit
+ resEntry = re;
+ return true;
+ }
+ }
+
+ // No matching entry found
+ return false;
+}
+
+/*--------------------------------------------------------------------------*/
+
ResourceManager::~ResourceManager() {
for (uint idx = 0; idx < _libList.size(); ++idx)
delete _libList[idx];
diff --git a/engines/tsage/resources.h b/engines/tsage/resources.h
index 0410fa3f42..2b5561b184 100644
--- a/engines/tsage/resources.h
+++ b/engines/tsage/resources.h
@@ -145,10 +145,12 @@ private:
MemoryManager &_memoryManager;
private:
Common::File _file;
+ Common::String _filename;
ResourceList _resources;
SectionList _sections;
void loadSection(uint32 fileOffset);
+ void loadSection(Common::File &f, ResourceList &resources);
void loadIndex();
public:
TLib(MemoryManager &memManager, const Common::String &filename);
@@ -159,6 +161,8 @@ public:
bool getPalette(int paletteNum, byte *palData, uint *startNum, uint *numEntries);
byte *getSubResource(int resNum, int rlbNum, int index, uint *size, bool suppressErrors = false);
bool getMessage(int resNum, int lineNum, Common::String &result, bool suppressErrors = false);
+
+ bool getSectionEntry(Common::File &f, ResourceType resType, int rlbNum, int resNum, ResourceEntry &resEntry);
};
class ResourceManager {
@@ -174,6 +178,7 @@ public:
void getPalette(int paletteNum, byte *palData, uint *startNum, uint *numEntries, bool suppressErrors = false);
byte *getSubResource(int resNum, int rlbNum, int index, uint *size, bool suppressErrors = false);
Common::String getMessage(int resNum, int lineNum, bool suppressErrors = false);
+ TLib &first() { return **_libList.begin(); }
};
diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp
index 157f222012..89cf831088 100644
--- a/engines/tsage/ringworld2/ringworld2_logic.cpp
+++ b/engines/tsage/ringworld2/ringworld2_logic.cpp
@@ -36,6 +36,8 @@ namespace TsAGE {
namespace Ringworld2 {
Scene *Ringworld2Game::createScene(int sceneNumber) {
+ warning("Switching to scene %d", sceneNumber);
+
switch (sceneNumber) {
/* Scene group #0 */
case 50:
@@ -51,17 +53,20 @@ Scene *Ringworld2Game::createScene(int sceneNumber) {
// Empty Bedroom #1
return new Scene150();
case 160:
- error("Missing scene %d from group 0", sceneNumber);
+ // Credits
+ return new Scene160();
case 175:
// Empty Bedroom #2
return new Scene175();
case 180:
- error("Missing scene %d from group 0", sceneNumber);
+ // Title Screen
+ return new Scene180();
case 200:
// Deck #2 - By Lift
return new Scene200();
case 205:
- error("Missing scene %d from group 0", sceneNumber);
+ // Star-field Credits
+ return new Scene205();
case 250:
// Lift
return new Scene250();
@@ -75,10 +80,15 @@ Scene *Ringworld2Game::createScene(int sceneNumber) {
// Science Lab
return new Scene400();
case 500:
+ // Lander Bay 2 Storage
+ return new Scene500();
case 525:
+ // Cutscene - Walking in hall
+ return new Scene525();
case 600:
+ return new Scene600();
case 700:
- error("Missing scene %d from group 0", sceneNumber);
+ return new Scene700();
case 800:
// Sick bay
return new Scene800();
@@ -89,7 +99,7 @@ Scene *Ringworld2Game::createScene(int sceneNumber) {
// Deck #5 - By Lift
return new Scene850();
case 900:
- error("Missing scene %d from group 0", sceneNumber);
+ return new Scene900();
/* Scene group #1 */
//
case 1000:
@@ -100,25 +110,50 @@ Scene *Ringworld2Game::createScene(int sceneNumber) {
case 1020:
return new Scene1020();
case 1100:
+ return new Scene1100();
case 1200:
+ return new Scene1200();
+ case 1337:
case 1330:
+ // Card Game
+ return new Scene1337();
case 1500:
+ // Cutscene: Ship landing
+ return new Scene1500();
case 1525:
+ // Cutscene - Ship
+ return new Scene1525();
case 1530:
+ // Cutscene - Elevator
+ return new Scene1530();
case 1550:
+ return new Scene1550();
case 1575:
+ return new Scene1575();
case 1580:
+ // Inside wreck
+ return new Scene1580();
case 1625:
+ // Miranda being questioned
+ return new Scene1625();
case 1700:
+ return new Scene1700();
case 1750:
+ return new Scene1750();
case 1800:
+ return new Scene1800();
case 1850:
+ return new Scene1850();
case 1875:
+ return new Scene1875();
case 1900:
+ return new Scene1900();
case 1925:
+ return new Scene1925();
case 1945:
+ return new Scene1945();
case 1950:
- error("Missing scene %d from group 1", sceneNumber);
+ return new Scene1950();
/* Scene group #2 */
//
case 2000:
@@ -231,7 +266,7 @@ Scene *Ringworld2Game::createScene(int sceneNumber) {
case 3400:
return new Scene3400();
case 3500:
- error("Missing scene %d from group 3", sceneNumber);
+ return new Scene3500();
case 3600:
return new Scene3600();
case 3700:
@@ -269,7 +304,7 @@ SceneExt::SceneExt(): Scene() {
_stripManager._onBegin = SceneExt::startStrip;
_stripManager._onEnd = SceneExt::endStrip;
- for (int i = 0; i < 44; i++)
+ for (int i = 0; i < 256; i++)
_field312[i] = 0;
_field372 = _field37A = 0;
_savedPlayerEnabled = false;
@@ -288,6 +323,19 @@ void SceneExt::postInit(SceneObjectList *OwnerList) {
_action = NULL;
_field12 = 0;
_sceneMode = 0;
+
+ int prevScene = R2_GLOBALS._sceneManager._previousScene;
+ int sceneNumber = R2_GLOBALS._sceneManager._sceneNumber;
+ if (((prevScene == -1) && (sceneNumber != 180) && (sceneNumber != 205) && (sceneNumber != 50))
+ || (sceneNumber == 50)
+ || ((prevScene == 205) && (sceneNumber == 100))
+ || ((prevScene == 180) && (sceneNumber == 100))) {
+ static_cast<SceneHandlerExt *>(R2_GLOBALS._sceneHandler)->setupPaletteMaps();
+ R2_GLOBALS._uiElements._active = true;
+ R2_GLOBALS._uiElements.show();
+ } else {
+ R2_GLOBALS._uiElements.updateInventory();
+ }
}
void SceneExt::remove() {
@@ -330,7 +378,7 @@ void SceneExt::loadScene(int sceneNum) {
(sceneNumber == 50) || ((prevScene == 205) && (sceneNumber == 100)) ||
((prevScene == 180) && (sceneNumber == 100))) {
// TODO: sub_17875
- R2_GLOBALS._v58CE2 = 1;
+ R2_GLOBALS._uiElements._active = true;
R2_GLOBALS._uiElements.show();
} else {
// Update the user interface
@@ -341,6 +389,7 @@ void SceneExt::loadScene(int sceneNum) {
bool SceneExt::display(CursorType action, Event &event) {
switch (action) {
case CURSOR_CROSSHAIRS:
+ case CURSOR_WALK:
return false;
case CURSOR_LOOK:
SceneItem::display2(1, R2_GLOBALS._randomSource.getRandomNumber(4));
@@ -357,7 +406,7 @@ bool SceneExt::display(CursorType action, Event &event) {
else
SceneItem::display2(5, 0);
break;
- case R2_7:
+ case R2_SONIC_STUNNER:
if ((R2_GLOBALS._v565F1[1] == 2) || ((R2_GLOBALS._v565F1[1] == 1) &&
(R2_GLOBALS._v565F1[2] == 2) && (R2_GLOBALS._sceneManager._previousScene == 300))) {
R2_GLOBALS._sound4.stop();
@@ -370,13 +419,13 @@ bool SceneExt::display(CursorType action, Event &event) {
R2_GLOBALS._sound4.play(45);
break;
- case R2_9:
- case R2_39:
+ case R2_COM_SCANNER:
+ case R2_COM_SCANNER_2:
R2_GLOBALS._sound3.play(44);
SceneItem::display2(2, action);
R2_GLOBALS._sound3.stop();
break;
- case R2_44:
+ case R2_PHOTON_STUNNER:
R2_GLOBALS._sound3.play(99);
SceneItem::display2(2, action);
break;
@@ -477,6 +526,37 @@ void SceneExt::saveCharacter(int characterIndex) {
R2_GLOBALS._player._characterFrame[characterIndex] = R2_GLOBALS._player._frame;
}
+void SceneExt::scalePalette(int RFactor, int GFactor, int BFactor) {
+ byte *tmpPal = R2_GLOBALS._scenePalette._palette;
+ byte newR, newG, newB;
+ int tmp, varC, varD = 0;
+
+ for (int i = 0; i < 256; i++) {
+ newR = (RFactor * tmpPal[(3 * i)]) / 100;
+ newG = (GFactor * tmpPal[(3 * i) + 1]) / 100;
+ newB = (BFactor * tmpPal[(3 * i) + 2]) / 100;
+
+ varC = 769;
+ for (int j = 255; j >= 0; j--) {
+ tmp = abs(tmpPal[(3 * j)] - newR);
+ if (tmp >= varC)
+ continue;
+
+ tmp += abs(tmpPal[(3 * j) + 1] - newG);
+ if (tmp >= varC)
+ continue;
+
+ tmp += abs(tmpPal[(3 * j) + 2] - newB);
+ if (tmp >= varC)
+ continue;
+
+ varC = tmp;
+ varD = j;
+ }
+ this->_field312[i] = varD;
+ }
+}
+
/*--------------------------------------------------------------------------*/
void SceneHandlerExt::postInit(SceneObjectList *OwnerList) {
@@ -484,7 +564,7 @@ void SceneHandlerExt::postInit(SceneObjectList *OwnerList) {
}
void SceneHandlerExt::process(Event &event) {
- if (T2_GLOBALS._uiElements._active) {
+ if (T2_GLOBALS._uiElements._active && R2_GLOBALS._player._uiEnabled) {
T2_GLOBALS._uiElements.process(event);
if (event.handled)
return;
@@ -503,6 +583,96 @@ void SceneHandlerExt::process(Event &event) {
SceneHandler::process(event);
}
+void SceneHandlerExt::setupPaletteMaps() {
+ byte *palP = &R2_GLOBALS._scenePalette._palette[0];
+
+ if (!R2_GLOBALS._v1000Flag) {
+ R2_GLOBALS._v1000Flag = true;
+
+ for (int idx = 0; idx < 10; ++idx) {
+ for (int palIndex = 0; palIndex < 224; ++palIndex) {
+ int r, g, b;
+
+ // Get adjusted RGB values
+ switch (idx) {
+ case 7:
+ r = palP[palIndex * 3] * 85 / 100;
+ g = palP[palIndex * 3 + 1] * 7 / 10;
+ b = palP[palIndex * 3 + 2] * 7 / 10;
+ break;
+ case 8:
+ r = palP[palIndex * 3] * 7 / 10;
+ g = palP[palIndex * 3 + 1] * 85 / 100;
+ b = palP[palIndex * 3 + 2] * 7 / 10;
+ break;
+ case 9:
+ r = palP[palIndex * 3] * 8 / 10;
+ g = palP[palIndex * 3 + 1] * 5 / 10;
+ b = palP[palIndex * 3 + 2] * 9 / 10;
+ break;
+ default:
+ r = palP[palIndex * 3] * (10 - idx) / 10;
+ g = palP[palIndex * 3 + 1] * (10 - idx) / 12;
+ b = palP[palIndex * 3 + 2] * (10 - idx) / 10;
+ break;
+ }
+
+ // Scan for the palette index with the closest matching colour
+ int threshold = 769;
+ int foundIndex = -1;
+ for (int pIndex2 = 223; pIndex2 >= 0; --pIndex2) {
+ int diffSum = ABS(palP[pIndex2 * 3] - r);
+ if (diffSum >= threshold)
+ continue;
+
+ diffSum += ABS(palP[pIndex2 * 3 + 1] - g);
+ if (diffSum >= threshold)
+ continue;
+
+ diffSum += ABS(palP[pIndex2 * 3 + 2] - b);
+ if (diffSum >= threshold)
+ continue;
+
+ threshold = diffSum;
+ foundIndex = pIndex2;
+ }
+
+ R2_GLOBALS._palIndexList[idx][palIndex] = foundIndex;
+ }
+ }
+ }
+
+ for (int palIndex = 0; palIndex < 224; ++palIndex) {
+ int r = palP[palIndex * 3] >> 2;
+ int g = palP[palIndex * 3 + 1] >> 2;
+ int b = palP[palIndex * 3 + 2] >> 2;
+
+ int idx = (((r << 4) | g) << 4) | b;
+ R2_GLOBALS._v1000[idx] = palIndex;
+ }
+
+ int vdx = 0;
+ int idx = 0;
+ int palIndex = 224;
+
+ for (int vIndex = 0; vIndex < 4096; ++vIndex) {
+ int v = R2_GLOBALS._v1000[vIndex];
+ if (!v) {
+ R2_GLOBALS._v1000[vIndex] = idx;
+ } else {
+ idx = v;
+ }
+
+ if (!palIndex) {
+ vdx = palIndex;
+ } else {
+ int idxTemp = palIndex;
+ palIndex = (palIndex + vdx) / 2;
+ vdx = idxTemp;
+ }
+ }
+}
+
/*--------------------------------------------------------------------------*/
DisplayHotspot::DisplayHotspot(int regionId, ...) {
@@ -688,52 +858,52 @@ void Ringworld2InvObjectList::reset() {
setObjectScene(R2_STEPPING_DISKS, 100);
setObjectScene(R2_ATTRACTOR_UNIT, 400);
setObjectScene(R2_SENSOR_PROBE, 400);
- setObjectScene(R2_7, 500);
- setObjectScene(R2_8, 700);
- setObjectScene(R2_9, 800);
- setObjectScene(R2_10, 100);
- setObjectScene(R2_11, 400);
- setObjectScene(R2_12, 500);
- setObjectScene(R2_13, 1550);
+ setObjectScene(R2_SONIC_STUNNER, 500);
+ setObjectScene(R2_CABLE_HARNESS, 700);
+ setObjectScene(R2_COM_SCANNER, 800);
+ setObjectScene(R2_SPENT_POWER_CAPSULE, 100);
+ setObjectScene(R2_CHARGED_POWER_CAPSULE, 400);
+ setObjectScene(R2_AEROSOL, 500);
+ setObjectScene(R2_REMOTE_CONTROL, 1550);
setObjectScene(R2_OPTICAL_FIBRE, 850);
setObjectScene(R2_CLAMP, 850);
- setObjectScene(R2_16, 0);
- setObjectScene(R2_17, 1550);
- setObjectScene(R2_18, 1550);
- setObjectScene(R2_19, 1550);
- setObjectScene(R2_20, 500);
- setObjectScene(R2_21, 500);
- setObjectScene(R2_22, 1550);
- setObjectScene(R2_23, 1580);
- setObjectScene(R2_24, 9999);
- setObjectScene(R2_25, 1550);
- setObjectScene(R2_26, 1550);
- setObjectScene(R2_27, 1580);
- setObjectScene(R2_28, 1550);
- setObjectScene(R2_29, 2525);
- setObjectScene(R2_30, 2440);
- setObjectScene(R2_31, 2455);
- setObjectScene(R2_32, 2535);
- setObjectScene(R2_33, 2530);
- setObjectScene(R2_34, 1950);
- setObjectScene(R2_35, 1950);
- setObjectScene(R2_36, 9999);
- setObjectScene(R2_37, 2430);
- setObjectScene(R2_38, 9999);
- setObjectScene(R2_39, 2);
- setObjectScene(R2_40, 9999);
- setObjectScene(R2_41, 3150);
- setObjectScene(R2_42, 0);
- setObjectScene(R2_43, 3260);
- setObjectScene(R2_44, 2);
- setObjectScene(R2_45, 1550);
- setObjectScene(R2_46, 0);
- setObjectScene(R2_47, 3150);
- setObjectScene(R2_48, 2435);
- setObjectScene(R2_49, 2440);
- setObjectScene(R2_50, 2435);
- setObjectScene(R2_51, 1580);
- setObjectScene(R2_52, 3260);
+ setObjectScene(R2_ATTRACTOR_CABLE_HARNESS, 0);
+ setObjectScene(R2_FUEL_CELL, 1550);
+ setObjectScene(R2_GYROSCOPE, 1550);
+ setObjectScene(R2_AIRBAG, 1550);
+ setObjectScene(R2_REBREATHER_TANK, 500);
+ setObjectScene(R2_RESERVE_REBREATHER_TANK, 500);
+ setObjectScene(R2_GUIDANCE_MODULE, 1550);
+ setObjectScene(R2_THRUSTER_VALVE, 1580);
+ setObjectScene(R2_BALLOON_BACKPACK, 9999);
+ setObjectScene(R2_RADAR_MECHANISM, 1550);
+ setObjectScene(R2_JOYSTICK, 1550);
+ setObjectScene(R2_IGNITOR, 1580);
+ setObjectScene(R2_DIAGNOSTICS_DISPLAY, 1550);
+ setObjectScene(R2_GLASS_DOME, 2525);
+ setObjectScene(R2_WICK_LAMP, 2440);
+ setObjectScene(R2_SCRITH_KEY, 2455);
+ setObjectScene(R2_TANNER_MASK, 2535);
+ setObjectScene(R2_PURE_GRAIN_ALCOHOL, 2530);
+ setObjectScene(R2_SAPPHIRE_BLUE, 1950);
+ setObjectScene(R2_ANCIENT_SCROLLS, 1950);
+ setObjectScene(R2_FLUTE, 9999);
+ setObjectScene(R2_GUNPOWDER, 2430);
+ setObjectScene(R2_NONAME, 9999);
+ setObjectScene(R2_COM_SCANNER_2, 2);
+ setObjectScene(R2_SUPERCONDUCTOR_WIRE, 9999);
+ setObjectScene(R2_PILLOW, 3150);
+ setObjectScene(R2_FOOD_TRAY, 0);
+ setObjectScene(R2_LASER_HACKSAW, 3260);
+ setObjectScene(R2_PHOTON_STUNNER, 2);
+ setObjectScene(R2_BATTERY, 1550);
+ setObjectScene(R2_SOAKED_FACEMASK, 0);
+ setObjectScene(R2_LIGHT_BULB, 3150);
+ setObjectScene(R2_ALCOHOL_LAMP, 2435);
+ setObjectScene(R2_ALCOHOL_LAMP_2, 2440);
+ setObjectScene(R2_ALCOHOL_LAMP_3, 2435);
+ setObjectScene(R2_BROKEN_DISPLAY, 1580);
+ setObjectScene(R2_TOOLBOX, 3260);
}
void Ringworld2InvObjectList::setObjectScene(int objectNum, int sceneNumber) {
@@ -1048,6 +1218,464 @@ void SceneExit::process(Event &event) {
}
}
+/*--------------------------------------------------------------------------*/
+
+void SceneAreaObject::remove() {
+ _object1.remove();
+ SceneArea::remove();
+ --R2_GLOBALS._insetUp;
+}
+
+void SceneAreaObject::process(Event &event) {
+ if (_insetCount == R2_GLOBALS._insetUp) {
+ CursorType cursor = R2_GLOBALS._events.getCursor();
+
+ if (_bounds.contains(event.mousePos)) {
+ // Cursor moving in bounded area
+ if (cursor == _cursorNum) {
+ R2_GLOBALS._events.setCursor(_savedCursorNum);
+ }
+ } else if (event.mousePos.y < 168) {
+ if (_cursorNum != cursor)
+ // Cursor moved outside bounded area
+ R2_GLOBALS._events.setCursor(_savedCursorNum);
+
+ if (event.eventType == EVENT_BUTTON_DOWN) {
+ R2_GLOBALS._events.setCursor(_savedCursorNum);
+ event.handled = true;
+ }
+ }
+ }
+}
+
+void SceneAreaObject::setDetails(int visage, int strip, int frameNumber, const Common::Point &pt) {
+ _object1.postInit();
+ _object1.setup(visage, strip, frameNumber);
+ _object1.setPosition(pt);
+ _object1.fixPriority(250);
+
+ _cursorNum = CURSOR_INVALID;
+ Scene500 *scene = (Scene500 *)R2_GLOBALS._sceneManager._scene;
+ scene->_sceneAreas.push_front(this);
+
+ _insetCount = ++R2_GLOBALS._insetUp;
+}
+
+void SceneAreaObject::setDetails(int resNum, int lookLineNum, int talkLineNum, int useLineNum) {
+ ((SceneHotspot *)(this))->setDetails(resNum, lookLineNum, talkLineNum, useLineNum,
+ 2, (SceneItem *)NULL);
+}
+
+/*****************************************************************************/
+
+UnkObject1200::UnkObject1200() {
+ _field16 = _field3A = NULL;
+ _field12 = _field14 = 0;
+ _field26 = _field28 = _field2A = _field2C = _field2E = _field30 = 0;
+ _field32 = _field34 = _field36 = _field38 = _field3E = _field40 = 0;
+}
+
+void UnkObject1200::synchronize(Serializer &s) {
+ SavedObject::synchronize(s);
+
+ _rect1.synchronize(s);
+ _rect2.synchronize(s);
+
+ // FIXME: syncrhonize _field16 and _field3A
+
+ s.syncAsSint16LE(_field12);
+ s.syncAsSint16LE(_field14);
+ s.syncAsSint16LE(_field26);
+ s.syncAsSint16LE(_field28);
+ s.syncAsSint16LE(_field2A);
+ s.syncAsSint16LE(_field2C);
+ s.syncAsSint16LE(_field2E);
+ s.syncAsSint16LE(_field30);
+ s.syncAsSint16LE(_field32);
+ s.syncAsSint16LE(_field34);
+ s.syncAsSint16LE(_field36);
+ s.syncAsSint16LE(_field38);
+ s.syncAsSint16LE(_field3E);
+ s.syncAsSint16LE(_field40);
+}
+
+void UnkObject1200::sub51AE9(int arg1) {
+ warning("STUB: UnkObject1200::sub51AE9()");
+}
+
+int UnkObject1200::sub51AF8(Common::Point pt) {
+ if (!_rect1.contains(pt))
+ return -1;
+
+ int tmp1 = (pt.x - _rect1.left + _field2E) / _field2A;
+ int tmp2 = (pt.y - _rect1.top + _field30) / _field2C;
+
+ if ((tmp1 >= 0) && (tmp2 >= 0) && (_field26 > tmp1) && (_field28 > tmp2))
+ return _field16[(((_field26 * tmp2) + tmp1)* 2)];
+
+ return -1;
+}
+
+bool UnkObject1200::sub51AFD(Common::Point pt) {
+ int retval = false;
+
+ _field2E = pt.x;
+ _field30 = pt.y;
+
+ if (_field2E < _rect2.top) {
+ _field2E = _rect2.top;
+ retval = true;
+ }
+
+ if (_field30 < _rect2.left) {
+ _field30 = _rect2.left;
+ retval = true;
+ }
+
+ if (_field2E + _rect1.width() > _rect2.right) {
+ _field2E = _rect2.right - _rect1.width();
+ retval = true;
+ }
+
+ if (_field30 + _rect1.height() > _rect2.bottom) {
+ _field30 = _rect2.bottom - _rect1.height();
+ retval = true;
+ }
+
+ return retval;
+}
+
+void UnkObject1200::sub51B02() {
+ warning("STUB: UnkObject1200::sub51B02()");
+}
+
+void UnkObject1200::sub9EDE8(Rect rect) {
+ _rect1 = rect;
+ warning("FIXME: UnkObject1200::sub9EDE8()");
+// _rect1.clip(g_globals->gfxManager()._bounds);
+}
+
+int UnkObject1200::sub9EE22(int &arg1, int &arg2) {
+ arg1 /= _field2A;
+ arg2 /= _field2C;
+
+ if ((arg1 >= 0) && (arg2 >= 0) && (_field26 > arg1) && (_field28 > arg2)) {
+ return _field16[(((_field26 * arg2) + arg1) * 2)];
+ }
+
+ return -1;
+}
+
+void Scene1200::sub9DAD6(int indx) {
+ _object1.sub9EE22(R2_GLOBALS._v56AA2, R2_GLOBALS._v56AA4);
+
+ switch (indx) {
+ case 0:
+ if ( ((_object1.sub51AF8(Common::Point(200, 50)) > 36) || (_object1.sub51AF8(Common::Point(200, 88)) > 36))
+ && ( ((R2_GLOBALS._v56AA2 == 3) && (R2_GLOBALS._v56AA4 == 33) && (_field418 != 4))
+ || ((R2_GLOBALS._v56AA2 == 13) && (R2_GLOBALS._v56AA4 == 21) && (_field418 != 2))
+ || ((R2_GLOBALS._v56AA2 == 29) && (R2_GLOBALS._v56AA4 == 17) && (_field418 != 1))
+ || ((R2_GLOBALS._v56AA2 == 33) && (R2_GLOBALS._v56AA4 == 41)) )
+ ) {
+ R2_GLOBALS._player.disableControl();
+ _sceneMode = 1200;
+ setAction(&_sequenceManager, this, 1200, &_actor1, NULL);
+ } else if (_object1.sub51AF8(Common::Point(200, 69)) == 36) {
+ switch (_field412 - 1) {
+ case 0:
+ if (R2_GLOBALS._player._visage == 3155)
+ _sceneMode = 15;
+ else
+ _sceneMode = 10;
+ break;
+ case 1:
+ if (R2_GLOBALS._player._visage == 3156)
+ _sceneMode = 76;
+ else
+ _sceneMode = 75;
+ break;
+ case 2:
+ if (R2_GLOBALS._player._visage == 3156)
+ _sceneMode = 101;
+ else
+ _sceneMode = 100;
+ break;
+ case 3:
+ if (R2_GLOBALS._player._visage == 3156)
+ _sceneMode = 111;
+ else
+ _sceneMode = 110;
+ break;
+ default:
+ break;
+ }
+ R2_GLOBALS._player.disableControl();
+ _field412 = 1;
+ signal();
+ }
+ break;
+ case 1:
+ if ( ((_object1.sub51AF8(Common::Point(120, 50)) > 36) || (_object1.sub51AF8(Common::Point(120, 88)) > 36))
+ && ( ((R2_GLOBALS._v56AA2 == 7) && (R2_GLOBALS._v56AA4 == 33) && (_field418 != 4))
+ || ((R2_GLOBALS._v56AA2 == 17) && (R2_GLOBALS._v56AA4 == 21) && (_field418 != 2))
+ || ((R2_GLOBALS._v56AA2 == 33) && (R2_GLOBALS._v56AA4 == 17) && (_field418 != 1))
+ || ((R2_GLOBALS._v56AA2 == 5) && (R2_GLOBALS._v56AA4 == 5)) )
+ ) {
+ R2_GLOBALS._player.disableControl();
+ _sceneMode = 1201;
+ setAction(&_sequenceManager, this, 1201, &_actor1, NULL);
+ } else if (_object1.sub51AF8(Common::Point(120, 69)) == 36) {
+ switch (_field412 - 1) {
+ case 0:
+ if (R2_GLOBALS._player._visage == 3156)
+ _sceneMode = 56;
+ else
+ _sceneMode = 55;
+ break;
+ case 1:
+ if (R2_GLOBALS._player._visage == 3155)
+ _sceneMode = 25;
+ else
+ _sceneMode = 20;
+ break;
+ case 2:
+ if (R2_GLOBALS._player._visage == 3156)
+ _sceneMode = 91;
+ else
+ _sceneMode = 90;
+ break;
+ case 3:
+ if (R2_GLOBALS._player._visage == 3156)
+ _sceneMode = 121;
+ else
+ _sceneMode = 120;
+ break;
+ default:
+ break;
+ }
+ R2_GLOBALS._player.disableControl();
+ _field412 = 2;
+ signal();
+ }
+ break;
+ case 2:
+ if ( ((_object1.sub51AF8(Common::Point(140, 110)) > 36) || (_object1.sub51AF8(Common::Point(178, 110)) > 36))
+ && ( ((R2_GLOBALS._v56AA2 == 17) && (R2_GLOBALS._v56AA4 == 5) && (_field418 != 3))
+ || ((R2_GLOBALS._v56AA2 == 41) && (R2_GLOBALS._v56AA4 == 21)) )
+ ) {
+ R2_GLOBALS._player.disableControl();
+ _sceneMode = 1203;
+ setAction(&_sequenceManager, this, 1203, &_actor1, NULL);
+ } else if (_object1.sub51AF8(Common::Point(160, 110)) == 36) {
+ switch (_field412 - 1) {
+ case 0:
+ if (R2_GLOBALS._player._visage == 3156)
+ _sceneMode = 51;
+ else
+ _sceneMode = 50;
+ break;
+ case 1:
+ if (R2_GLOBALS._player._visage == 3156)
+ _sceneMode = 81;
+ else
+ _sceneMode = 80;
+ break;
+ case 2:
+ if (R2_GLOBALS._player._visage == 3155)
+ _sceneMode = 35;
+ else
+ _sceneMode = 30;
+ break;
+ case 3:
+ if (R2_GLOBALS._player._visage == 3156)
+ _sceneMode = 116;
+ else
+ _sceneMode = 115;
+ break;
+ default:
+ break;
+ }
+ R2_GLOBALS._player.disableControl();
+ _field412 = 3;
+ signal();
+ }
+ break;
+ case 3:
+ if ( ((_object1.sub51AF8(Common::Point(140, 30)) > 36) || (_object1.sub51AF8(Common::Point(178, 30)) > 36))
+ && ( ((R2_GLOBALS._v56AA2 == 17) && (R2_GLOBALS._v56AA4 == 9) && (_field418 != 3))
+ || ((R2_GLOBALS._v56AA2 == 35) && (R2_GLOBALS._v56AA4 == 17)) )
+ ) {
+ R2_GLOBALS._player.disableControl();
+ _sceneMode = 1202;
+ setAction(&_sequenceManager, this, 1202, &_actor1, NULL);
+ } else if (_object1.sub51AF8(Common::Point(160, 30)) == 36) {
+ switch (_field412 - 1) {
+ case 0:
+ if (R2_GLOBALS._player._visage == 3156)
+ _sceneMode = 61;
+ else
+ _sceneMode = 60;
+ break;
+ case 1:
+ if (R2_GLOBALS._player._visage == 3156)
+ _sceneMode = 71;
+ else
+ _sceneMode = 70;
+ break;
+ case 2:
+ if (R2_GLOBALS._player._visage == 3156)
+ _sceneMode = 96;
+ else
+ _sceneMode = 95;
+ break;
+ case 3:
+ if (R2_GLOBALS._player._visage == 3155)
+ _sceneMode = 45;
+ else
+ _sceneMode = 40;
+ break;
+ default:
+ _sceneMode = 1;
+ R2_GLOBALS._player.setup(3156, 4, 6);
+ break;
+ }
+ R2_GLOBALS._player.disableControl();
+ _field412 = 4;
+ signal();
+ }
+ break;
+ default:
+ break;
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+AnimationPlayer::AnimationPlayer(): EventHandler() {
+ _endAction = NULL;
+
+ _fieldA = NULL;
+ _field16 = NULL;
+
+ _screenBounds = R2_GLOBALS._gfxManagerInstance._bounds;
+ _rect1 = R2_GLOBALS._gfxManagerInstance._bounds;
+ _field3C = 0;
+ _field3A = 1;
+ _field5A = 0;
+ _field58 = 0;
+ _endAction = NULL;
+}
+
+AnimationPlayer::~AnimationPlayer() {
+ if (!method3())
+ method4();
+}
+
+void AnimationPlayer::synchronize(Serializer &s) {
+ EventHandler::synchronize(s);
+ warning("TODO AnimationPlayer::load");
+}
+
+void AnimationPlayer::remove() {
+ if (_endAction)
+ _endAction->signal();
+
+ _endAction = NULL;
+}
+
+void AnimationPlayer::process(Event &event) {
+ if ((event.eventType == EVENT_KEYPRESS) && (event.kbd.keycode == Common::KEYCODE_ESCAPE) &&
+ (_field3A)) {
+ _field90C = _field576;
+ }
+}
+
+void AnimationPlayer::dispatch() {
+ uint32 gameFrame = R2_GLOBALS._events.getFrameNumber();
+ uint32 gameDiff = (gameFrame > _gameFrame) ? gameFrame - _gameFrame : _gameFrame - gameFrame;
+
+ if (gameDiff >= _field910) {
+ drawFrame(_field904 % _field57C);
+ ++_field904;
+ _field90C = _field904 / _field57C;
+
+ if (_field90C == _field90E)
+ method2();
+
+ _field908 = _field904;
+ _gameFrame = gameFrame;
+ }
+}
+
+bool AnimationPlayer::load(int rlbNum, Action *endAction) {
+ ResourceEntry resEntry;
+ if (!g_resourceManager->first().getSectionEntry(_resourceFile, RES_IMAGE, rlbNum, 0, resEntry)) {
+ warning("Couldn't find resource index");
+ // TODO: Complete animation loading
+ }
+
+ _resourceFile.close();
+ return false;
+}
+
+void AnimationPlayer::drawFrame(int frameIndex) {
+ uint32 v = READ_LE_UINT32(_dataP);
+warning("v = %d", v);
+//TODO
+
+ // End check
+ if (_field56 == 42) {
+ _screenBounds.expandPanes();
+
+ R2_GLOBALS._sceneObjects->draw();
+ } else {
+ if (R2_GLOBALS._sceneManager._hasPalette) {
+ R2_GLOBALS._sceneManager._hasPalette = false;
+ R2_GLOBALS._scenePalette.refresh();
+ }
+ }
+}
+
+void AnimationPlayer::method2() {
+
+}
+
+bool AnimationPlayer::method3() {
+ return (_field90C >= _field576);
+}
+
+void AnimationPlayer::method4() {
+ if (_field38) {
+ switch (_field3C) {
+ case 0:
+ R2_GLOBALS._scenePalette.replace(&_palette);
+ changePane();
+ R2_GLOBALS._sceneManager._hasPalette = true;
+ break;
+ case 2:
+ proc14();
+ break;
+ default:
+ changePane();
+ break;
+ }
+ }
+
+// TODO
+}
+
+/*--------------------------------------------------------------------------*/
+
+AnimationPlayerExt::AnimationPlayerExt(): AnimationPlayer() {
+ _v = 0;
+ _field3A = 0;
+}
+
+void AnimationPlayerExt::synchronize(Serializer &s) {
+ AnimationPlayer::synchronize(s);
+ s.syncAsSint16LE(_v);
+}
+
} // End of namespace Ringworld2
} // End of namespace TsAGE
diff --git a/engines/tsage/ringworld2/ringworld2_logic.h b/engines/tsage/ringworld2/ringworld2_logic.h
index 4805de48bb..98fcaae981 100644
--- a/engines/tsage/ringworld2/ringworld2_logic.h
+++ b/engines/tsage/ringworld2/ringworld2_logic.h
@@ -79,7 +79,7 @@ private:
static void startStrip();
static void endStrip();
public:
- byte _field312[44];
+ byte _field312[256];
int _field372;
bool _savedPlayerEnabled;
bool _savedUiEnabled;
@@ -102,16 +102,20 @@ public:
virtual void loadScene(int sceneNum);
virtual void refreshBackground(int xAmount, int yAmount);
virtual void saveCharacter(int characterIndex);
+ virtual void restore() {}
bool display(CursorType action, Event &event);
void fadeOut();
void clearScreen();
+ void scalePalette(int RFactor, int GFactor, int BFactor);
};
class SceneHandlerExt: public SceneHandler {
public:
virtual void postInit(SceneObjectList *OwnerList = NULL);
virtual void process(Event &event);
+
+ void setupPaletteMaps();
};
@@ -264,6 +268,7 @@ public:
int _state;
SceneActorExt() { _state = 0; }
+
virtual Common::String getClassName() { return "SceneActorExt"; }
virtual void synchronize(Serializer &s) {
SceneActor::synchronize(s);
@@ -271,6 +276,108 @@ public:
}
};
+class SceneAreaObject: public SceneArea {
+ class Object1: public SceneActor {
+ public:
+ };
+public:
+ Object1 _object1;
+ int _insetCount;
+
+ virtual void remove();
+ virtual void process(Event &event);
+ void setDetails(int visage, int strip, int frameNumber, const Common::Point &pt);
+ void setDetails(int resNum, int lookLineNum, int talkLineNum, int useLineNum);
+};
+
+class UnkObject1200 : public SavedObject {
+public:
+ Rect _rect1;
+ Rect _rect2;
+
+ int *_field16;
+ int *_field3A;
+
+ int _field12;
+ int _field14;
+ int _field26;
+ int _field28;
+ int _field2A;
+ int _field2C;
+ int _field2E;
+ int _field30;
+ int _field32;
+ int _field34;
+ int _field36;
+ int _field38;
+ int _field3E;
+ int _field40;
+
+ UnkObject1200();
+ void synchronize(Serializer &s);
+
+ void sub51AE9(int arg1);
+ int sub51AF8(Common::Point pt);
+ bool sub51AFD(Common::Point pt);
+ void sub51B02();
+ void sub9EDE8(Rect rect);
+ int sub9EE22(int &arg1, int &arg2);
+ virtual Common::String getClassName() { return "UnkObject1200"; }
+};
+
+class AnimationPlayer: public EventHandler {
+public:
+ Common::File _resourceFile;
+ void *_fieldA;
+ void *_field16;
+
+ byte *_dataP;
+ Rect _rect1, _screenBounds;
+ int _field38;
+ int _field3A, _field3C;
+ int _field56;
+ int _field58, _field5A;
+ ScenePalette _palette;
+ byte _palData[256 * 3];
+ Action *_endAction;
+ int _field576;
+ int _field57C;
+ int _palStart, _palSize;
+ int _field904;
+ int _field908;
+ int _field90C;
+ int _field90E;
+ uint _field910;
+ uint32 _gameFrame;
+public:
+ AnimationPlayer();
+ ~AnimationPlayer();
+
+ virtual void synchronize(Serializer &s);
+ virtual void remove();
+ virtual void process(Event &event);
+ virtual void dispatch();
+ virtual void flipPane() {}
+ virtual void changePane() {}
+ virtual void proc14() {}
+
+ bool load(int rlbNum, Action *endAction = NULL);
+ void drawFrame(int frameIndex);
+ void method2();
+ bool method3();
+ void method4();
+ void method5() {}
+};
+
+class AnimationPlayerExt: public AnimationPlayer {
+public:
+ int _v;
+public:
+ AnimationPlayerExt();
+
+ virtual void synchronize(Serializer &s);
+};
+
} // End of namespace Ringworld2
} // End of namespace TsAGE
diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.cpp b/engines/tsage/ringworld2/ringworld2_scenes0.cpp
index 597156fd03..dab9afb269 100644
--- a/engines/tsage/ringworld2/ringworld2_scenes0.cpp
+++ b/engines/tsage/ringworld2/ringworld2_scenes0.cpp
@@ -23,6 +23,7 @@
#include "tsage/scenes.h"
#include "tsage/tsage.h"
#include "tsage/staticres.h"
+#include "tsage/ringworld2/ringworld2_dialogs.h"
#include "tsage/ringworld2/ringworld2_scenes0.h"
#include "tsage/ringworld2/ringworld2_speakers.h"
@@ -50,7 +51,7 @@ void Scene50::postInit(SceneObjectList *OwnerList) {
SceneExt::postInit(OwnerList);
loadScene(110);
- R2_GLOBALS._v58CE2 = 0;
+ R2_GLOBALS._uiElements._active = false;
R2_GLOBALS._scenePalette.loadPalette(0);
R2_GLOBALS._sound2.play(10);
@@ -1032,6 +1033,7 @@ void Scene125::consoleAction(int id) {
_sceneMode = 10;
_palette.loadPalette(161);
+ R2_GLOBALS._scenePalette.addFader(_palette._palette, 256, 5, this);
break;
case 24:
_icon4.setIcon(25);
@@ -1290,6 +1292,692 @@ void Scene150::signal() {
}
/*--------------------------------------------------------------------------
+ * Scene 160 - Credits
+ *
+ *--------------------------------------------------------------------------*/
+
+void Scene160::Action1::signal() {
+ Scene160 *scene = (Scene160 *)R2_GLOBALS._sceneManager._scene;
+ bool breakFlag;
+ SynchronizedList<SceneText *>::iterator i;
+ SceneText *topItem;
+
+ switch (_actionIndex) {
+ case 0:
+ scene->_yChange = 1;
+ scene->_lineNum = 0;
+ ++_actionIndex;
+ // Deliberate fall-through
+
+ case 1:
+ setDelay(5);
+ breakFlag = true;
+ do {
+ if (!scene->_lineNum || ((scene->_lineNum != -1) &&
+ (((*scene->_creditsList.reverse_begin())->_position.y < 164) || !breakFlag))) {
+ breakFlag = true;
+ Common::String msg = g_resourceManager->getMessage(160, scene->_lineNum++);
+
+ if (*msg.c_str() == '^') {
+ scene->_lineNum = -1;
+ } else {
+ if (msg.size() == 0)
+ msg = " ";
+
+ SceneText *sceneText = new SceneText();
+ sceneText->_fontNumber = 50;
+
+ switch (*msg.c_str()) {
+ case '$': {
+ // Centered text
+ msg.deleteChar(0);
+ int width = R2_GLOBALS.gfxManager()._font.getStringWidth(msg.c_str());
+
+ sceneText->_textMode = ALIGN_CENTER;
+ sceneText->setPosition(Common::Point(160 - (width / 2), 175));
+ sceneText->_width = 320;
+ break;
+ }
+
+ case '%': {
+ // Text for position name
+ msg.deleteChar(0);
+ int width = R2_GLOBALS.gfxManager()._font.getStringWidth(msg.c_str());
+
+ sceneText->_textMode = ALIGN_RIGHT;
+ sceneText->setPosition(Common::Point(151 - width, 175));
+ sceneText->_width = 320;
+ breakFlag = false;
+ break;
+ }
+
+ case '@':
+ // Text for who was in the position
+ msg.deleteChar(0);
+ sceneText->_textMode = ALIGN_LEFT;
+ sceneText->_position = Common::Point(167, 175);
+ sceneText->_width = 153;
+ break;
+
+ default:
+ sceneText->_width = 151;
+ sceneText->setPosition(Common::Point(151, 175));
+ sceneText->_textMode = ALIGN_RIGHT;
+ break;
+ }
+
+ sceneText->_color1 = 191;
+ sceneText->_color2 = 191;
+ sceneText->_color3 = 191;
+ sceneText->setup(msg);
+ sceneText->_flags |= OBJFLAG_CLONED;
+ sceneText->fixPriority(5);
+
+ scene->_creditsList.push_back(sceneText);
+ }
+ }
+
+ } while (!breakFlag);
+
+ // Move all the active credits
+ for (i = scene->_creditsList.begin(); i != scene->_creditsList.end(); ++i) {
+ SceneObject *item = *i;
+ item->setPosition(Common::Point(item->_position.x, item->_position.y - scene->_yChange));
+ }
+
+ topItem = *scene->_creditsList.begin();
+ if (topItem->_position.y < 25) {
+ // Credit has reached the top, so remove it
+ topItem->remove();
+ scene->_creditsList.remove(topItem);
+
+ if (scene->_creditsList.size() == 0) {
+ // No more items left
+ setDelay(10);
+ ++_actionIndex;
+ }
+ }
+ break;
+
+ case 2:
+ HelpDialog::show();
+ setDelay(4);
+ break;
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+Scene160::Scene160(): SceneExt() {
+ _frameNumber = _yChange = 0;
+ _lineNum = 0;
+}
+
+void Scene160::postInit(SceneObjectList *OwnerList) {
+ SceneExt::postInit();
+ loadScene(4001);
+
+ R2_GLOBALS._player._uiEnabled = false;
+ R2_GLOBALS._player.enableControl();
+ R2_GLOBALS._player._canWalk = false;
+
+ R2_GLOBALS._uiElements.hide();
+ R2_GLOBALS._interfaceY = SCREEN_HEIGHT;
+
+ _lineNum = 0;
+ _frameNumber = R2_GLOBALS._events.getFrameNumber();
+
+ _sound1.play(337);
+ setAction(&_action1);
+}
+
+void Scene160::synchronize(Serializer &s) {
+ SceneExt::synchronize(s);
+ s.syncAsSint16LE(_frameNumber);
+ s.syncAsSint16LE(_yChange);
+ s.syncAsSint16LE(_lineNum);
+}
+
+void Scene160::remove() {
+ // Clear the credit list
+ SynchronizedList<SceneText *>::iterator i;
+ for (i = _creditsList.begin(); i != _creditsList.end(); ++i) {
+ SceneText *item = *i;
+
+ item->remove();
+ }
+ _creditsList.clear();
+
+ _sound1.fadeOut(NULL);
+ SceneExt::remove();
+}
+
+void Scene160::process(Event &event) {
+ if ((event.eventType == EVENT_KEYPRESS) && (event.kbd.keycode == Common::KEYCODE_ESCAPE)) {
+ event.handled = true;
+ HelpDialog::show();
+ }
+
+ if (!event.handled)
+ SceneExt::process(event);
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 180 - Title Screen
+ *
+ *--------------------------------------------------------------------------*/
+
+void Scene180::Action1::signal() {
+ Scene180 *scene = (Scene180 *)R2_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0:
+ case 1:
+ case 2:
+ scene->_object5.setStrip((_actionIndex == 1) ? 1 : 2);
+ scene->_object5.setFrame(1);
+ scene->_object5.animate(ANIM_MODE_5, this);
+ break;
+ case 4:
+ scene->_object5.setStrip(3);
+ scene->_object5.setFrame(1);
+ scene->_object5.animate(ANIM_MODE_5, this);
+ _actionIndex = 0;
+ break;
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+Scene180::Scene180(): SceneExt(), _webbsterSpeaker(27) {
+ _field412 = 0;
+ _frameInc = 0;
+ _frameNumber = R2_GLOBALS._events.getFrameNumber();
+ _field480 = 1;
+ _field482 = -1;
+ _fontNumber = R2_GLOBALS.gfxManager()._font._fontNumber;
+
+ GfxFont font;
+ font.setFontNumber(7);
+ _fontHeight = font.getHeight() + 1;
+
+ _sceneMode = (R2_GLOBALS._sceneManager._previousScene == 205) ? 10 : 0;
+ _gameTextSpeaker._displayMode = 9;
+}
+
+void Scene180::postInit(SceneObjectList *OwnerList) {
+ loadScene(9999);
+ SceneExt::postInit();
+
+ R2_GLOBALS._uiElements._active = true;
+ R2_GLOBALS._player.disableControl();
+
+ _stripManager.addSpeaker(&_gameTextSpeaker);
+ _stripManager.addSpeaker(&_webbsterSpeaker);
+ _stripManager.addSpeaker(&_tealSpeaker);
+ _stripManager.addSpeaker(&_dutyOfficerSpeaker);
+
+ signal();
+}
+
+void Scene180::remove() {
+ _stripManager._field2E8 = -1;
+// _stripManager._field2EA = -1;
+ SceneExt::remove();
+
+ R2_GLOBALS._events.setCursor(CURSOR_WALK);
+ // word_575F7 = 0;
+ R2_GLOBALS._playStream.stop();
+ R2_GLOBALS._sound2.fadeOut2(NULL);
+ R2_GLOBALS._sound1.fadeOut2(NULL);
+}
+
+void Scene180::synchronize(Serializer &s) {
+ SceneExt::synchronize(s);
+
+ s.syncAsSint16LE(_frameNumber);
+ s.syncAsSint16LE(_field412);
+ s.syncAsSint16LE(_field480);
+ s.syncAsSint16LE(_field482);
+ s.syncAsSint16LE(_frameInc);
+ s.syncAsSint16LE(_fontNumber);
+ s.syncAsSint16LE(_fontHeight);
+}
+
+void Scene180::signal() {
+ R2_GLOBALS._playStream.stop();
+
+ switch (_sceneMode++) {
+ case 0:
+ setFrameInc(6);
+ break;
+
+ case 1:
+ _field412 = 1;
+ R2_GLOBALS._sceneManager._hasPalette = true;
+ _animationPlayer._field3C = 2;
+ _animationPlayer._v = 1;
+ _animationPlayer._field56 = 1;
+ R2_GLOBALS._scene180Mode = 1;
+
+ _animationPlayer.load(1, NULL);
+ R2_GLOBALS._scenePalette.loadPalette(_animationPlayer._palData, 0, 256);
+
+ R2_GLOBALS._sound1.play(1);
+ break;
+
+ case 2:
+ R2_GLOBALS._scene180Mode = 1;
+ R2_GLOBALS._paneRefreshFlag[0] = 3;
+
+ if (R2_GLOBALS._sound1.isPlaying()) {
+ setFrameInc(1);
+ } else {
+ setFrameInc(180);
+ }
+ break;
+
+ case 3:
+ R2_GLOBALS._scene180Mode = 1;
+
+ if (R2_GLOBALS._sound1.isPlaying())
+ _sceneMode = 3;
+
+ setFrameInc(1);
+ break;
+
+ case 4:
+ case 8:
+ case 30:
+ case 43:
+ case 47:
+ _field412 = 0;
+ _palette.loadPalette(0);
+ _palette.loadPalette(9998);
+ R2_GLOBALS._scenePalette.addFader(_palette._palette, 256, 8, this);
+ break;
+
+ case 5:
+ _animationPlayer._field3C = 2;
+ _animationPlayer._v = 1;
+ _animationPlayer._field56 = 1;
+ R2_GLOBALS._scene180Mode = 2;
+ _animationPlayer.load(2);
+
+ _field412 = 1;
+ R2_GLOBALS._scenePalette.addFader(_animationPlayer._palData, 256, 6, NULL);
+ R2_GLOBALS._sound1.play(2);
+ break;
+
+ case 6:
+ R2_GLOBALS._scene180Mode = 2;
+ R2_GLOBALS._paneRefreshFlag[0] = 3;
+
+ if (R2_GLOBALS._sound1.isPlaying()) {
+ setFrameInc(1);
+ } else {
+ setFrameInc(180);
+ }
+ break;
+
+ case 7:
+ R2_GLOBALS._scene180Mode = 2;
+ if (R2_GLOBALS._sound1.isPaused())
+ _sceneMode = 7;
+ setFrameInc(1);
+ break;
+
+ case 9:
+ R2_GLOBALS._sound1.play(3);
+ setFrameInc(2);
+ break;
+
+ case 10:
+ loadScene(4002);
+ R2_GLOBALS._scenePalette.loadPalette(0);
+ setFrameInc(6);
+ break;
+
+ case 11:
+ _field412 = 1;
+ _object4.postInit();
+ _object5.postInit();
+ setAction(&_sequenceManager, this, 4000, &_object4, &_object5, NULL);
+ break;
+
+ case 12:
+ case 14:
+ case 16:
+ case 18:
+ case 20:
+ case 22:
+ case 24:
+ case 26:
+ case 46:
+ setFrameInc((R2_GLOBALS._speechSubtitles & 1) ? 1 : 18);
+ break;
+
+ case 13:
+ setAction(&_sequenceManager, this, 4001, &_object4, &_object5, NULL);
+ break;
+
+ case 15:
+ setAction(&_sequenceManager, this, 4002, &_object4, &_object5, NULL);
+ break;
+
+ case 17:
+ setAction(&_sequenceManager, this, 4003, &_object4, &_object5, NULL);
+ break;
+
+ case 19:
+ setAction(&_sequenceManager, this, 4004, &_object4, &_object5, NULL);
+ break;
+
+ case 21:
+ setAction(&_sequenceManager, this, 4005, &_object4, &_object5, NULL);
+ break;
+
+ case 23:
+ setAction(&_sequenceManager, this, 4006, &_object4, &_object5, NULL);
+ break;
+
+ case 25:
+ setAction(&_sequenceManager, this, 4007, &_object4, &_object5, NULL);
+ break;
+
+ case 27:
+ _field412 = 0;
+ _object4.remove();
+ _object5.remove();
+ setFrameInc(2);
+ break;
+
+ case 28:
+ _field412 = 0;
+ _palette.loadPalette(0);
+ _palette.loadPalette(9998);
+ R2_GLOBALS._scenePalette.addFader(_palette._palette, 256, 100, this);
+ break;
+
+ case 29:
+ _field412 = 1;
+ _animationPlayer._field3C = 0;
+ _animationPlayer._v = 1;
+ _animationPlayer._field56 = 42;
+ R2_GLOBALS._scene180Mode = 3;
+ _animationPlayer.load(3);
+ break;
+
+ case 31:
+ R2_GLOBALS._sound2.play(7);
+
+ _object4.postInit();
+ _object4.setVisage(76);
+ _object4.setStrip(1);
+ _object4.setFrame(1);
+ _object4.setPosition(Common::Point(288, 143));
+ _object4.fixPriority(210);
+
+ loadScene(75);
+
+ R2_GLOBALS._scenePalette.loadPalette(0);
+ R2_GLOBALS._scenePalette.loadPalette(75);
+
+ if (R2_GLOBALS._sceneManager._hasPalette)
+ R2_GLOBALS._scenePalette.refresh();
+ setFrameInc(6);
+ break;
+
+ case 32:
+ _field412 = 1;
+
+ _object2.postInit();
+ _object2.setPosition(Common::Point(161, 97));
+ _object2.hide();
+
+ _object3.postInit();
+ _object3.setPosition(Common::Point(60, 96));
+ _object3.hide();
+ R2_GLOBALS._scenePalette.addFader(_palette._palette, 256, 11, this);
+ break;
+
+ case 33:
+ _object2.hide();
+
+ _object3.setup(76, 4, 1);
+ _object3.setFrame(_object3.getFrameCount());
+
+ _object5.postInit();
+ _object5.setup(75, 1, 1);
+ _object5.setPosition(Common::Point(221, 125));
+ _object5.fixPriority(210);
+ _object5.setAction(&_action1);
+ R2_GLOBALS._scenePalette.addFader(_palette._palette, 256, 12, this);
+ break;
+
+ case 34:
+ _object2.hide();
+ _object3.hide();
+
+ _object1.postInit();
+ _object1.setup(76, 2, 1);
+ _object1.setPosition(Common::Point(287, 135));
+ _object1.fixPriority(200);
+
+ _sound1.play(19);
+ R2_GLOBALS._scenePalette.addFader(_palette._palette, 256, 5, this);
+ break;
+
+ case 35:
+ R2_GLOBALS._scenePalette.addFader(_palette._palette, 256, 13, this);
+ break;
+
+ case 36:
+ _object2.remove();
+ _sound1.play(19);
+
+ R2_GLOBALS._scenePalette.addFader(_palette._palette, 256, 6, this);
+ break;
+
+ case 37:
+ _field412 = 0;
+ _object1.remove();
+ _palette.loadPalette(9998);
+ R2_GLOBALS._scenePalette.addFader(_palette._palette, 256, 8, this);
+ break;
+
+ case 38:
+ _object4.remove();
+ _object5.setAction(NULL);
+ _object5.remove();
+
+ R2_GLOBALS._sound2.fadeOut2(NULL);
+ R2_GLOBALS._sound1.fadeOut2(NULL);
+ break;
+
+ case 39:
+ R2_GLOBALS._sound1.changeSound(8);
+ setFrameInc(1);
+ break;
+
+ case 40:
+ _animationPlayer._field3C = 2;
+ _animationPlayer._field56 = 1;
+ R2_GLOBALS._scene180Mode = 4;
+ if (_animationPlayer.load(4)) {
+ _animationPlayer.dispatch();
+ R2_GLOBALS._scenePalette.addFader(_animationPlayer._palData, 256, 8, this);
+ } else {
+ _sceneMode = 43;
+ setFrameInc(1);
+ }
+ break;
+
+ case 41:
+ _field412 = 1;
+ _animationPlayer._v = 1;
+ break;
+
+ case 42:
+ R2_GLOBALS._scene180Mode = 4;
+ R2_GLOBALS._paneRefreshFlag[0] = 3;
+ setFrameInc(1);
+ break;
+
+ case 44:
+ loadScene(9997);
+ R2_GLOBALS._scenePalette.loadPalette(9997);
+ if (R2_GLOBALS._sceneManager._hasPalette)
+ R2_GLOBALS._scenePalette.refresh();
+
+ setFrameInc(6);
+ break;
+
+ case 45:
+ R2_GLOBALS._scenePalette.addFader(_animationPlayer._palData, 256, 28, this);
+ break;
+
+ case 48:
+ _field412 = 1;
+ _animationPlayer._field3C = 2;
+ _animationPlayer._v = 1;
+ _animationPlayer._field56 = 1;
+ R2_GLOBALS._scene180Mode = 15;
+ _animationPlayer.load(15, NULL);
+
+ R2_GLOBALS._sound1.play(9);
+ R2_GLOBALS._scenePalette.addFader(_animationPlayer._palData, 256, 6, NULL);
+ break;
+
+ case 49:
+ R2_GLOBALS._scene180Mode = 15;
+ R2_GLOBALS._paneRefreshFlag[0] = 3;
+ setFrameInc(1);
+ break;
+
+ case 50:
+ R2_GLOBALS._scene180Mode = 0;
+ _field412 = 0;
+ R2_GLOBALS._sceneManager.changeScene(100);
+ break;
+ }
+}
+
+void Scene180::setFrameInc(int v) {
+ _frameInc = v;
+ _frameNumber = R2_GLOBALS._events.getFrameNumber();
+}
+
+void Scene180::process(Event &event) {
+ if ((event.eventType == EVENT_KEYPRESS) && (event.kbd.keycode == Common::KEYCODE_ESCAPE)) {
+ event.handled = 1;
+ if (!_field412) {
+ if (R2_GLOBALS._scenePalette._listeners.size() == 0) {
+ HelpDialog::show();
+ }
+ }
+ }
+
+ if (!event.handled)
+ SceneExt::process(event);
+}
+
+void Scene180::dispatch() {
+ if (_frameInc) {
+ uint32 gameFrame = R2_GLOBALS._events.getFrameNumber();
+
+ if (gameFrame >= (uint32)_frameNumber) {
+ _frameInc -= gameFrame - _frameNumber;
+ _frameNumber = gameFrame;
+
+ if (_frameInc <= 0) {
+ _frameInc = 0;
+ signal();
+ }
+ }
+ }
+
+ if (_animationPlayer._v) {
+ if (_animationPlayer.method3()) {
+ _animationPlayer._v = 0;
+ _animationPlayer.method4();
+ _animationPlayer.remove();
+
+ signal();
+ } else {
+ _animationPlayer.dispatch();
+ }
+ }
+
+ Scene::dispatch();
+}
+
+void Scene180::restore() {
+ R2_GLOBALS._gfxColors.background = 0;
+ R2_GLOBALS._gfxColors.foreground = 0xff;
+ R2_GLOBALS._fontColors.background = 0;
+ R2_GLOBALS._fontColors.foreground = 0xff;
+
+ switch (R2_GLOBALS._scene180Mode) {
+ case 0:
+ R2_GLOBALS._events.setCursor(SHADECURSOR_HAND);
+
+ R2_GLOBALS._gfxColors.foreground = 4;
+ R2_GLOBALS._gfxColors.background = 3;
+ R2_GLOBALS._fontColors.background = 3;
+ R2_GLOBALS._frameEdgeColour = 3;
+ break;
+
+ case 1:
+ R2_GLOBALS._events.setCursor(R2_CURSOR_20);
+
+ R2_GLOBALS._gfxColors.foreground = 25;
+ R2_GLOBALS._gfxColors.background = 43;
+ R2_GLOBALS._fontColors.background = 48;
+ R2_GLOBALS._frameEdgeColour = 48;
+ break;
+
+ case 2:
+ R2_GLOBALS._events.setCursor(R2_CURSOR_21);
+
+ R2_GLOBALS._gfxColors.foreground = 106;
+ R2_GLOBALS._gfxColors.background = 136;
+ R2_GLOBALS._fontColors.background = 48;
+ R2_GLOBALS._fontColors.foreground = 253;
+ R2_GLOBALS._frameEdgeColour = 48;
+ break;
+
+ case 3:
+ R2_GLOBALS._events.setCursor(R2_CURSOR_22);
+
+ R2_GLOBALS._gfxColors.foreground = 84;
+ R2_GLOBALS._gfxColors.background = 118;
+ R2_GLOBALS._fontColors.background = 47;
+ R2_GLOBALS._frameEdgeColour = 48;
+ break;
+
+ case 14:
+ R2_GLOBALS._events.setCursor(R2_CURSOR_23);
+
+ R2_GLOBALS._fontColors.background = 38;
+ R2_GLOBALS._fontColors.foreground = 38;
+ R2_GLOBALS._gfxColors.foreground = 192;
+ R2_GLOBALS._gfxColors.background = 30;
+ R2_GLOBALS._frameEdgeColour = 48;
+ break;
+
+ default:
+ R2_GLOBALS._gfxColors.background = 0;
+ R2_GLOBALS._gfxColors.foreground = 59;
+ R2_GLOBALS._fontColors.background = 4;
+ R2_GLOBALS._fontColors.foreground = 15;
+
+ R2_GLOBALS._events.setCursor(CURSOR_ARROW);
+ break;
+ }
+}
+
+/*--------------------------------------------------------------------------
* Scene 200 - Ship Corridor
*
*--------------------------------------------------------------------------*/
@@ -1444,6 +2132,363 @@ void Scene200::signal() {
}
/*--------------------------------------------------------------------------
+ * Scene 205 - Star-field Credits
+ *
+ *--------------------------------------------------------------------------*/
+
+void Scene205::Action1::signal() {
+ Scene205 *scene = (Scene205 *)R2_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0:
+ setDelay(2);
+ break;
+
+ case 1:
+ scene->_yp = 100 - (scene->_fontHeight * 3 / 2);
+ scene->handleText();
+
+ for (int idx = 1; idx <= 2; ++idx) {
+ ++scene->_textIndex;
+ scene->_yp += scene->_fontHeight;
+ scene->handleText();
+ }
+ setDelay(240);
+ break;
+
+ case 2:
+ case 4:
+ case 6:
+ case 8:
+ case 10:
+ case 12:
+ case 14:
+ case 16:
+ case 18:
+ case 20:
+ textLoop();
+ setDelay(120);
+ break;
+
+ case 3:
+ scene->_textIndex = 1;
+ scene->_yp = 100 - ((scene->_fontHeight * 2) / 2);
+ scene->handleText();
+
+ ++scene->_textIndex;
+ scene->_yp += scene->_fontHeight;
+ scene->handleText();
+ setDelay(240);
+ break;
+
+ case 5:
+ scene->_textIndex = 1;
+ scene->_yp = 100 - ((scene->_fontHeight * 7) / 2);
+ scene->handleText();
+
+ for (int idx = 1; idx <= 6; ++idx) {
+ ++scene->_textIndex;
+ scene->_yp += scene->_fontHeight;
+ scene->handleText();
+ }
+
+ setDelay(480);
+ break;
+
+ case 7:
+ scene->_textIndex = 1;
+ scene->_yp = 100 - ((scene->_fontHeight * 6) / 2);
+ scene->handleText();
+
+ for (int idx = 1; idx <= 5; ++idx) {
+ ++scene->_textIndex;
+ scene->_yp += scene->_fontHeight;
+ scene->handleText();
+ }
+
+ setDelay(300);
+ break;
+
+ case 9:
+ scene->_textIndex = 1;
+ scene->_yp = 100 - ((scene->_fontHeight * 8) / 2);
+ scene->handleText();
+
+ for (int idx = 1; idx <= 7; ++idx) {
+ ++scene->_textIndex;
+ scene->_yp += scene->_fontHeight;
+ scene->handleText();
+ }
+
+ setDelay(480);
+ break;
+
+ case 11:
+ scene->_textIndex = 1;
+ scene->_yp = 100 - ((scene->_fontHeight * 3) / 2);
+ scene->handleText();
+
+ for (int idx = 1; idx <= 2; ++idx) {
+ ++scene->_textIndex;
+ scene->_yp += scene->_fontHeight;
+ scene->handleText();
+ }
+
+ setDelay(240);
+ break;
+
+ case 13:
+ scene->_textIndex = 1;
+ scene->_yp = 100 - ((scene->_fontHeight * 3) / 2);
+ scene->handleText();
+
+ for (int idx = 1; idx <= 2; ++idx) {
+ ++scene->_textIndex;
+ scene->_yp += scene->_fontHeight;
+ scene->handleText();
+ }
+
+ setDelay(240);
+ break;
+
+ case 15:
+ scene->_textIndex = 1;
+ scene->_yp = 100 - ((scene->_fontHeight * 5) / 2);
+ scene->handleText();
+
+ for (int idx = 1; idx <= 4; ++idx) {
+ ++scene->_textIndex;
+ scene->_yp += scene->_fontHeight;
+ scene->handleText();
+ }
+
+ setDelay(240);
+ break;
+
+ case 17:
+ scene->_textIndex = 1;
+ scene->_yp = 100 - ((scene->_fontHeight * 5) / 2);
+ scene->handleText();
+
+ for (int idx = 1; idx <= 4; ++idx) {
+ ++scene->_textIndex;
+ scene->_yp += scene->_fontHeight;
+ scene->handleText();
+ }
+
+ setDelay(360);
+ break;
+
+ case 19:
+ scene->_textIndex = 1;
+ scene->_yp = 100 - ((scene->_fontHeight * 3) / 2);
+ scene->handleText();
+
+ for (int idx = 1; idx <= 2; ++idx) {
+ ++scene->_textIndex;
+ scene->_yp += scene->_fontHeight;
+ scene->handleText();
+ }
+
+ setDelay(480);
+ break;
+
+ case 21:
+ R2_GLOBALS._sceneManager.changeScene(R2_GLOBALS._sceneManager._previousScene);
+
+ default:
+ break;
+ }
+}
+
+void Scene205::Action1::textLoop() {
+ Scene205 *scene = (Scene205 *)R2_GLOBALS._sceneManager._scene;
+
+ for (int idx = 1; idx <= 14; ++idx) {
+ if (R2_GLOBALS._sceneObjects->contains(&scene->_textList[idx])) {
+ scene->_textList[idx].remove();
+ }
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+Scene205::Object::Object(): SceneObject() {
+ _x100 = _y100 = 0;
+}
+
+void Scene205::Object::synchronize(Serializer &s) {
+ EventHandler::synchronize(s);
+
+ s.syncAsSint32LE(_x100);
+ s.syncAsSint32LE(_y100);
+}
+
+/*--------------------------------------------------------------------------*/
+
+Scene205::Scene205(): SceneExt() {
+ _yp = 0;
+ _textIndex = 1;
+ _lineNum = -1;
+
+ GfxFont font;
+ font.setFontNumber(4);
+ _fontHeight = font.getHeight();
+}
+
+void Scene205::postInit(SceneObjectList *OwnerList) {
+ SceneExt::postInit();
+ loadScene(4000);
+ R2_GLOBALS._player._uiEnabled = false;
+
+ R2_GLOBALS._sound1.play(337);
+ R2_GLOBALS._scenePalette.loadPalette(0);
+ R2_GLOBALS._player.disableControl();
+
+ setup();
+ setAction(&_action1);
+}
+
+void Scene205::synchronize(Serializer &s) {
+ SceneExt::synchronize(s);
+
+ for (int idx = 0; idx < 3; ++idx)
+ SYNC_POINTER(_objList1[idx]);
+ for (int idx = 0; idx < 3; ++idx)
+ SYNC_POINTER(_objList2[idx]);
+ for (int idx = 0; idx < 4; ++idx)
+ SYNC_POINTER(_objList3[idx]);
+
+ s.syncAsSint16LE(_textIndex);
+ s.syncAsSint16LE(_lineNum);
+ s.syncAsSint16BE(_yp);
+}
+
+void Scene205::remove() {
+ R2_GLOBALS._sound1.fadeOut2(NULL);
+ SceneExt::remove();
+}
+
+void Scene205::process(Event &event) {
+ if ((event.eventType == EVENT_KEYPRESS) && (event.kbd.keycode == Common::KEYCODE_ESCAPE)) {
+ event.handled = true;
+ R2_GLOBALS._sceneManager.changeScene(R2_GLOBALS._sceneManager._previousScene);
+ } else {
+ Scene::process(event);
+ }
+}
+
+void Scene205::dispatch() {
+ processList(_objList3, 4, Common::Rect(0, 0, 319, 200), 1, 1, 160, 100);
+ processList(_objList2, 3, Common::Rect(0, 0, 319, 200), 2, 2, 160, 100);
+ processList(_objList1, 3, Common::Rect(0, 0, 319, 200), 4, 3, 160, 100);
+
+ Scene::dispatch();
+}
+
+void Scene205::setup() {
+ const Common::Point pointList1[3] = { Common::Point(2, 50), Common::Point(100, 28), Common::Point(53, 15) };
+ const Common::Point pointList2[3] = { Common::Point(289, 192), Common::Point(125, 60), Common::Point(130, 40) };
+ const Common::Point pointList3[4] = {
+ Common::Point(140, 149), Common::Point(91, 166), Common::Point(299, 46), Common::Point(314, 10)
+ };
+
+ // Set up the first object list
+ for (int idx = 0; idx < 3; ++idx) {
+ Object *obj = new Object();
+ _objList1[idx] = obj;
+
+ obj->postInit();
+ obj->_flags |= OBJFLAG_CLONED;
+ obj->setVisage(205);
+ obj->_strip = 1;
+ obj->_frame = 1;
+ obj->setPosition(pointList1[idx]);
+ obj->_x100 = obj->_position.x * 100;
+ obj->_y100 = obj->_position.y * 100;
+ obj->fixPriority(12);
+ }
+
+ // Setup the second object list
+ for (int idx = 0; idx < 3; ++idx) {
+ Object *obj = new Object();
+ _objList2[idx] = obj;
+
+ obj->postInit();
+ obj->_flags |= OBJFLAG_CLONED;
+ obj->setVisage(205);
+ obj->_strip = 1;
+ obj->_frame = 2;
+ obj->setPosition(pointList2[idx]);
+ obj->_x100 = obj->_position.x * 100;
+ obj->_y100 = obj->_position.y * 100;
+ obj->fixPriority(11);
+ }
+
+ // Setup the third object list
+ for (int idx = 0; idx < 4; ++idx) {
+ Object *obj = new Object();
+ _objList3[idx] = obj;
+
+ obj->postInit();
+ obj->_flags |= OBJFLAG_CLONED;
+ obj->setVisage(205);
+ obj->_strip = 1;
+ obj->_frame = 3;
+ obj->setPosition(pointList3[idx]);
+ obj->_x100 = obj->_position.x * 100;
+ obj->_y100 = obj->_position.y * 100;
+ obj->fixPriority(10);
+ }
+}
+
+/**
+ * Handles moving a group of stars in the scene background
+ */
+void Scene205::processList(Object **ObjList, int count, const Common::Rect &bounds,
+ int xMultiply, int yMultiply, int xCenter, int yCenter) {
+ for (int idx = 0; idx < count; ++idx) {
+ Object *obj = ObjList[idx];
+ Common::Point pt(obj->_position.x - xCenter, obj->_position.y - yCenter);
+
+ if ((obj->_position.x <= 319) && (obj->_position.x >= 0) &&
+ (obj->_position.y <= 199) && (obj->_position.y >= 0)) {
+ if (!pt.x && !pt.y) {
+ pt.x = pt.y = 1;
+ }
+
+ pt.x *= xMultiply;
+ pt.y *= yMultiply;
+ obj->_x100 += pt.x;
+ obj->_y100 += pt.y;
+ } else {
+ obj->_x100 = (bounds.left + R2_GLOBALS._randomSource.getRandomNumber(bounds.right)) * 100;
+ obj->_y100 = (bounds.top + R2_GLOBALS._randomSource.getRandomNumber(bounds.bottom)) * 100;
+ }
+
+ obj->setPosition(Common::Point(obj->_x100 / 100, obj->_y100 / 100));
+ }
+}
+
+void Scene205::handleText() {
+ _message = g_resourceManager->getMessage(205, ++_lineNum);
+
+ _textList[_textIndex]._fontNumber = 4;
+ _textList[_textIndex]._color1 = 0;
+ _textList[_textIndex]._color2 = 10;
+ _textList[_textIndex]._color3 = 7;
+ _textList[_textIndex]._width = 400;
+ _textList[_textIndex].setup(_message);
+ _textList[_textIndex].fixPriority(199);
+
+ GfxFont font;
+ font.setFontNumber(4);
+ int width = font.getStringWidth(_message.c_str());
+
+ _textList[_textIndex].setPosition(Common::Point(160 - (width / 2), _yp));
+}
+
+/*--------------------------------------------------------------------------
* Scene 250 - Lift
*
*--------------------------------------------------------------------------*/
@@ -3750,6 +4795,1485 @@ void Scene400::dispatch() {
}
/*--------------------------------------------------------------------------
+ * Scene 500 - Lander Bay 2 Storage
+ *
+ *--------------------------------------------------------------------------*/
+
+bool Scene500::ControlPanel::startAction(CursorType action, Event &event) {
+ Scene500 *scene = (Scene500 *)R2_GLOBALS._sceneManager._scene;
+
+ if ((action == CURSOR_USE) && (R2_GLOBALS._player._characterIndex == R2_QUINN)) {
+ R2_GLOBALS._player.disableControl();
+
+ if (R2_GLOBALS.getFlag(26)) {
+ scene->_stripNumber = 1104;
+ scene->_sceneMode = 524;
+ scene->setAction(&scene->_sequenceManager1, scene, 524, &R2_GLOBALS._player, NULL);
+ } else {
+ scene->_sceneMode = 510;
+ scene->setAction(&scene->_sequenceManager1, scene, 510, &R2_GLOBALS._player, NULL);
+ }
+ return true;
+ } else {
+ return SceneHotspot::startAction(action, event);
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+bool Scene500::Object2::startAction(CursorType action, Event &event) {
+ Scene500 *scene = (Scene500 *)R2_GLOBALS._sceneManager._scene;
+
+ if (action == CURSOR_TALK) {
+ R2_GLOBALS._player.disableControl();
+ if (R2_GLOBALS._player._characterIndex == 1) {
+ scene->_stripNumber = R2_GLOBALS.getFlag(26) ? 1101 : 1103;
+ } else {
+ scene->_stripNumber = R2_GLOBALS.getFlag(26) ? 1102 : 1105;
+ }
+
+ scene->setAction(&scene->_sequenceManager1, scene, 524, &R2_GLOBALS._player, NULL);
+ return true;
+ } else {
+ return SceneActor::startAction(action, event);
+ }
+}
+
+bool Scene500::Object3::startAction(CursorType action, Event &event) {
+ Scene500 *scene = (Scene500 *)R2_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(500, R2_GLOBALS.getFlag(28) ? 28 : _strip + 25);
+ return true;
+
+ case CURSOR_USE:
+ if (R2_GLOBALS._player._characterIndex == R2_QUINN) {
+ if ((_strip != 3) && (_strip != 7))
+ SceneItem::display2(500, _strip);
+ else if (R2_GLOBALS.getFlag(26)) {
+ R2_GLOBALS._player.disableControl();
+ scene->_stripNumber = 1103;
+ scene->_sceneMode = 524;
+ scene->setAction(&scene->_sequenceManager1, scene, 524, &R2_GLOBALS._player, NULL);
+ } else if (!R2_GLOBALS.getFlag(28))
+ SceneItem::display2(500, 41);
+ else if (!R2_GLOBALS.getFlag(40))
+ SceneItem::display2(500, 40);
+ else {
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 512;
+ scene->setAction(&scene->_sequenceManager1, scene, 524, &R2_GLOBALS._player, &scene->_object3, NULL);
+ R2_GLOBALS.setFlag(26);
+ }
+ } else {
+ SceneItem::display2(500, 42);
+ }
+ return true;
+
+ case R2_REBREATHER_TANK:
+ if (!R2_GLOBALS.getFlag(25))
+ SceneItem::display2(500, 10);
+ else if (_strip != 3)
+ SceneItem::display2(500, _strip + 25);
+ else {
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 515;
+ scene->setAction(&scene->_sequenceManager1, scene, 515, &R2_GLOBALS._player, &scene->_object3, NULL);
+ R2_GLOBALS.setFlag(28);
+ }
+ return true;
+
+ case R2_RESERVE_REBREATHER_TANK:
+ SceneItem::display2(500, 53);
+ return true;
+
+ default:
+ if (action < R2_LAST_INVENT) {
+ SceneItem::display2(500, action);
+ return true;
+ } else {
+ return SceneActor::startAction(action, event);
+ }
+ }
+}
+
+bool Scene500::Doorway::startAction(CursorType action, Event &event) {
+ Scene500 *scene = (Scene500 *)R2_GLOBALS._sceneManager._scene;
+
+ if ((action == CURSOR_USE) && (R2_GLOBALS._player._characterIndex == R2_QUINN)) {
+ R2_GLOBALS._player.disableControl();
+
+ if (R2_GLOBALS.getFlag(26)) {
+ scene->_stripNumber = 1104;
+ scene->_sceneMode = 524;
+ scene->setAction(&scene->_sequenceManager1, scene, 524, &R2_GLOBALS._player, NULL);
+ } else {
+ scene->_sceneMode = 500;
+ scene->setAction(&scene->_sequenceManager1, scene, 500, &R2_GLOBALS._player, NULL);
+ }
+
+ return true;
+ } else {
+ return SceneActor::startAction(action, event);
+ }
+}
+
+bool Scene500::OxygenTanks::startAction(CursorType action, Event &event) {
+ Scene500 *scene = (Scene500 *)R2_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(500, R2_INVENTORY.getObjectScene(R2_REBREATHER_TANK) ? 50 : 49);
+ return true;
+
+ case CURSOR_USE:
+ if (R2_GLOBALS._player._characterIndex != R2_QUINN) {
+ SceneItem::display2(500, 52);
+ return true;
+ } else if ((R2_INVENTORY.getObjectScene(R2_REBREATHER_TANK) != 1) &&
+ (R2_GLOBALS._player._characterIndex != R2_SEEKER) && !R2_GLOBALS.getFlag(28)) {
+ R2_GLOBALS._player.disableControl();
+
+ if (_position.y == 120) {
+ scene->_sceneMode = 513;
+ scene->setAction(&scene->_sequenceManager1, scene, scene->_sceneMode, &R2_GLOBALS._player,
+ &scene->_tanks1, NULL);
+ } else {
+ scene->_sceneMode = 514;
+ scene->setAction(&scene->_sequenceManager1, scene, scene->_sceneMode, &R2_GLOBALS._player,
+ &scene->_tanks2, NULL);
+ }
+ return true;
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ return SceneActor::startAction(action, event);
+}
+
+bool Scene500::AirLock::startAction(CursorType action, Event &event) {
+ Scene500 *scene = (Scene500 *)R2_GLOBALS._sceneManager._scene;
+
+ if ((action == CURSOR_USE) && R2_GLOBALS.getFlag(26)) {
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = (R2_GLOBALS._player._characterIndex == R2_QUINN) ? 521 : 522;
+ scene->setAction(&scene->_sequenceManager1, scene, scene->_sceneMode, &R2_GLOBALS._player,
+ &scene->_object2, &scene->_airLock, NULL);
+ return true;
+ } else {
+ return SceneActor::startAction(action, event);
+ }
+}
+
+bool Scene500::Aerosol::startAction(CursorType action, Event &event) {
+ Scene500 *scene = (Scene500 *)R2_GLOBALS._sceneManager._scene;
+
+ if (action == CURSOR_USE) {
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 503;
+ scene->setAction(&scene->_sequenceManager1, scene, 503, &R2_GLOBALS._player, this, NULL);
+ return true;
+ } else {
+ return SceneActor::startAction(action, event);
+ }
+}
+
+bool Scene500::SonicStunner::startAction(CursorType action, Event &event) {
+ Scene500 *scene = (Scene500 *)R2_GLOBALS._sceneManager._scene;
+
+ if ((action == CURSOR_USE) && (R2_GLOBALS._player._characterIndex == R2_QUINN)) {
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = R2_GLOBALS.getFlag(26) ? 520 : 502;
+ scene->setAction(&scene->_sequenceManager1, scene, scene->_sceneMode, &R2_GLOBALS._player, NULL);
+ return true;
+ } else {
+ return SceneActor::startAction(action, event);
+ }
+}
+
+bool Scene500::Locker1::startAction(CursorType action, Event &event) {
+ Scene500 *scene = (Scene500 *)R2_GLOBALS._sceneManager._scene;
+
+ if ((action == CURSOR_USE) && (R2_GLOBALS._player._characterIndex == R2_QUINN)) {
+ R2_GLOBALS._player.disableControl();
+
+ if (R2_GLOBALS.getFlag(11))
+ scene->_sceneMode = R2_GLOBALS.getFlag(26) ? 517 : 505;
+ else
+ scene->_sceneMode = R2_GLOBALS.getFlag(26) ? 516 : 504;
+
+ scene->setAction(&scene->_sequenceManager1, scene, scene->_sceneMode, &R2_GLOBALS._player, this, NULL);
+ return true;
+ } else {
+ return SceneActor::startAction(action, event);
+ }
+}
+
+bool Scene500::Locker2::startAction(CursorType action, Event &event) {
+ Scene500 *scene = (Scene500 *)R2_GLOBALS._sceneManager._scene;
+
+ if ((action == CURSOR_USE) && (R2_GLOBALS._player._characterIndex == R2_QUINN)) {
+ R2_GLOBALS._player.disableControl();
+
+ if (R2_GLOBALS.getFlag(12))
+ scene->_sceneMode = R2_GLOBALS.getFlag(26) ? 519 : 507;
+ else
+ scene->_sceneMode = R2_GLOBALS.getFlag(26) ? 518 : 506;
+
+ scene->setAction(&scene->_sequenceManager1, scene, scene->_sceneMode, &R2_GLOBALS._player, this, NULL);
+ return true;
+ } else {
+ return SceneActor::startAction(action, event);
+ }
+}
+
+bool Scene500::Object::startAction(CursorType action, Event &event) {
+ if (action == CURSOR_USE) {
+ return false;
+ } else {
+ return SceneActor::startAction(action, event);
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+void Scene500::postInit(SceneObjectList *OwnerList) {
+ SceneExt::postInit();
+ loadScene(500);
+
+ Common::fill(&_buffer[0], &_buffer[2710], 0);
+ _stripManager.setColors(60, 255);
+ _stripManager.setFontNumber(50);
+ _stripManager.addSpeaker(&_seekerSpeaker);
+ _stripManager.addSpeaker(&_quinnSpeaker);
+
+ if (R2_GLOBALS.getFlag(25)) {
+ R2_GLOBALS._player._characterScene[R2_SEEKER] = 500;
+
+ if (R2_GLOBALS._player._characterIndex == R2_QUINN) {
+ R2_GLOBALS._walkRegions.disableRegion(1);
+
+ _object2.postInit();
+ _object2._effect = 1;
+ _object2.setup(1505, 1, 1);
+ _object2._moveDiff.x = 5;
+ _object2.setPosition(Common::Point(42, 151));
+ _object2.setDetails(500, 34, 35, 36, 1, (SceneItem *)NULL);
+ } else if (R2_GLOBALS._player._characterScene[R2_QUINN] == 500) {
+ _object2.postInit();
+ _object2._effect = 1;
+ _object2.setup(R2_GLOBALS.getFlag(26) ? 1500 : 10, 1, 1);
+ _object2.setPosition(Common::Point(42, 151));
+
+ R2_GLOBALS._walkRegions.disableRegion(1);
+ R2_GLOBALS._walkRegions.disableRegion(2);
+ R2_GLOBALS._walkRegions.disableRegion(3);
+
+ _object2.setDetails(500, 37, 38, -1, 1, (SceneItem *)NULL);
+ }
+ }
+
+ if ((R2_INVENTORY.getObjectScene(R2_REBREATHER_TANK) != 500) && R2_GLOBALS.getFlag(27)) {
+ _tanks1.postInit();
+ _tanks1.setup(502, 7, 1);
+ _tanks1.setPosition(Common::Point(281, 120));
+ _tanks1.setDetails(500, -1, -1, -1, 1, (SceneItem *)NULL);
+ } else {
+ if (R2_INVENTORY.getObjectScene(R2_REBREATHER_TANK) == 500) {
+ _tanks1.postInit();
+ _tanks1.setup(502, 7, 1);
+ _tanks1.setPosition(Common::Point(281, 120));
+ _tanks1.setDetails(500, -1, -1, -1, 1, (SceneItem *)NULL);
+ }
+
+ _tanks2.postInit();
+ _tanks2.setup(502, 7, 1);
+ _tanks2.setPosition(Common::Point(286, 121));
+ _tanks2.setDetails(500, -1, -1, -1, 1, (SceneItem *)NULL);
+ }
+
+ _doorway.postInit();
+ _doorway.setup(501, 1, 1);
+ _doorway.setPosition(Common::Point(132, 85));
+ _doorway.setDetails(500, 15, -1, 17, 1, (SceneItem *)NULL);
+
+ _airLock.postInit();
+ _airLock.setup(501, 2, 1);
+ _airLock.setPosition(Common::Point(41, 121));
+
+ if (!R2_GLOBALS.getFlag(25))
+ _airLock.setDetails(500, 6, -1, 10, 1, (SceneItem *)NULL);
+ else if ((R2_GLOBALS._player._characterScene[R2_QUINN] != 500) ||
+ (R2_GLOBALS._player._characterScene[R2_SEEKER] != 500))
+ _airLock.setDetails(500, 6, -1, 40, 1, (SceneItem *)NULL);
+ else
+ _airLock.setDetails(500, 6, -1, 9, 1, (SceneItem *)NULL);
+
+ _locker1.postInit();
+ _locker1.setup(500, 3, R2_GLOBALS.getFlag(11) ? 6 : 1);
+ _locker1.setPosition(Common::Point(220, 82));
+ _locker1.setDetails(500, 27, -1, -1, 1, (SceneItem *)NULL);
+
+ _locker2.postInit();
+ _locker2.setup(500, 4, R2_GLOBALS.getFlag(12) ? 6 : 1);
+ _locker2.setPosition(Common::Point(291, 98));
+ _locker2.fixPriority(121);
+ _locker2.setDetails(500, 27, -1, -1, 1, (SceneItem *)NULL);
+
+ if (R2_INVENTORY.getObjectScene(R2_AEROSOL) == 500) {
+ _aerosol.postInit();
+ _aerosol.setup(500, 5, 2);
+ _aerosol.setPosition(Common::Point(286, 91));
+ _aerosol.fixPriority(120);
+ _aerosol.setDetails(500, 24, 25, 26, 1, (SceneItem *)NULL);
+ }
+
+ if (R2_INVENTORY.getObjectScene(R2_SONIC_STUNNER) == 500) {
+ _sonicStunner.postInit();
+ _sonicStunner.setup(500, 5, 1);
+ _sonicStunner.setPosition(Common::Point(214, 76));
+ _sonicStunner.setDetails(500, 21, 22, 23, 1, (SceneItem *)NULL);
+ }
+
+ _object1.postInit();
+ _object1._effect = 1;
+ _object1.setup(502, 1, 1);
+ _object1.setPosition(Common::Point(258, 99));
+ _object1.fixPriority(50);
+
+ _object8.postInit();
+ _object8.setPosition(Common::Point(250, 111));
+
+ if (!R2_GLOBALS.getFlag(35)) {
+ _object8.setup(501, 3, 1);
+ } else {
+ _object8.setup(500, 8, 7);
+
+ _object3.postInit();
+ _object3._effect = 1;
+ _object3.setPosition(Common::Point(247, 52));
+ _object3.setDetails(500, -1, -1, -1, 2, (SceneItem *)NULL);
+
+ if (!R2_GLOBALS.getFlag(26)) {
+ if (R2_GLOBALS.getFlag(28))
+ _object3.setup(502, 7, 2);
+ else
+ _object3.setup(502, R2_GLOBALS._v566A3 + 2, 7);
+ }
+ }
+
+ R2_GLOBALS._player.postInit();
+ R2_GLOBALS._player.setVisage(10);
+ R2_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+ if (R2_GLOBALS._player._characterIndex == R2_SEEKER)
+ R2_GLOBALS._player._moveDiff.x = 5;
+
+ _controlPanel.setDetails(Rect(175, 62, 191, 80), 500, 31, 32, 33, 1, (SceneItem *)NULL);
+ _item2.setDetails(Rect(13, 58, 70, 118), 500, 12, -1, -1, 1, (SceneItem *)NULL);
+ _background.setDetails(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), 500, 0, -1, -1, 1, (SceneItem *)NULL);
+
+ if ((R2_GLOBALS._player._characterIndex == R2_QUINN) && (R2_GLOBALS._sceneManager._previousScene == 700)) {
+ R2_GLOBALS._player.disableControl();
+ _sceneMode = 501;
+ setAction(&_sequenceManager1, this, 501, &R2_GLOBALS._player, &_doorway, NULL);
+ } else {
+ if (R2_GLOBALS._player._characterIndex != R2_QUINN) {
+ R2_GLOBALS._player.setup(1505, 6, 1);
+ } else {
+ R2_GLOBALS._player.setup(R2_GLOBALS.getFlag(26) ? 1500 : 10, 6, 1);
+ }
+
+ R2_GLOBALS._player.setPosition(Common::Point(123, 135));
+ R2_GLOBALS._player.enableControl();
+ }
+}
+
+void Scene500::synchronize(Serializer &s) {
+ SceneExt::synchronize(s);
+ s.syncAsSint16LE(_stripNumber);
+}
+
+void Scene500::signal() {
+ switch (_sceneMode) {
+ case 3:
+ R2_GLOBALS._player.enableControl();
+ break;
+ case 5:
+ _sceneMode = 12;
+ _sound1.play(127);
+ _object1.animate(ANIM_MODE_6, this);
+
+ R2_GLOBALS.clearFlag(35);
+ _object3.remove();
+ R2_GLOBALS._player.enableControl();
+ break;
+ case 6:
+ _sceneMode = 11;
+ _sound1.play(127);
+ _object1.animate(ANIM_MODE_5, this);
+
+ R2_GLOBALS.clearFlag(35);
+ _object3.remove();
+ R2_GLOBALS._player.enableControl();
+ break;
+ case 7:
+ _sound1.play(126);
+ _object8.animate(ANIM_MODE_6, this);
+
+ R2_GLOBALS.clearFlag(35);
+ _object3.remove();
+ R2_GLOBALS._player.enableControl();
+ break;
+ case 500:
+ R2_GLOBALS._sceneManager.changeScene(700);
+ break;
+ case 501:
+ if (R2_GLOBALS._player._characterScene[R2_QUINN] == 500) {
+ _stripNumber = 1100;
+ _sceneMode = 523;
+ setAction(&_sequenceManager1, this, 523, &R2_GLOBALS._player, NULL);
+ } else {
+ R2_GLOBALS._player.enableControl();
+ }
+ break;
+ case 502:
+ case 520:
+ R2_INVENTORY.setObjectScene(R2_SONIC_STUNNER, 1);
+ _sonicStunner.remove();
+ R2_GLOBALS._player.enableControl();
+ break;
+ case 503:
+ R2_INVENTORY.setObjectScene(R2_AEROSOL, 1);
+ _aerosol.remove();
+ R2_GLOBALS._player.enableControl();
+ break;
+ case 504:
+ case 516:
+ R2_GLOBALS.setFlag(11);
+ R2_GLOBALS._player.enableControl();
+ break;
+ case 505:
+ case 517:
+ R2_GLOBALS.clearFlag(11);
+ R2_GLOBALS._player.enableControl();
+ break;
+ case 506:
+ case 518:
+ R2_GLOBALS.setFlag(11);
+ R2_GLOBALS._player.enableControl();
+ break;
+ case 507:
+ case 519:
+ R2_GLOBALS.clearFlag(12);
+ R2_GLOBALS._player.enableControl();
+ break;
+ case 509:
+ R2_GLOBALS.clearFlag(35);
+ _object3.remove();
+ R2_GLOBALS._player.enableControl();
+ break;
+ case 510:
+ R2_GLOBALS._player.enableControl();
+ _area1.setDetails(500, 6, 1, Common::Point(160, 120));
+ R2_GLOBALS._player.enableControl();
+ break;
+ case 513:
+ R2_INVENTORY.setObjectScene(R2_REBREATHER_TANK, 1);
+ _tanks1.remove();
+ R2_GLOBALS._player.enableControl();
+ break;
+ case 514:
+ R2_INVENTORY.setObjectScene(R2_REBREATHER_TANK, 1);
+ R2_GLOBALS.setFlag(27);
+ _tanks2.remove();
+ R2_GLOBALS._player.enableControl();
+ break;
+ case 515:
+ R2_INVENTORY.setObjectScene(R2_REBREATHER_TANK, 0);
+ R2_GLOBALS.setFlag(28);
+ R2_GLOBALS._player.enableControl();
+ break;
+ case 521:
+ case 522:
+ R2_GLOBALS._sceneManager.changeScene(525);
+ break;
+ case 523:
+ case 524:
+ R2_GLOBALS._events.setCursor(CURSOR_ARROW);
+ _sceneMode = 8;
+ _stripManager.start(_stripNumber, this);
+ break;
+ default:
+ R2_GLOBALS._player.enableControl();
+ break;
+ }
+}
+
+
+/*--------------------------------------------------------------------------
+ * Scene 525 - Cutscene - Walking in hall
+ *
+ *--------------------------------------------------------------------------*/
+void Scene525::postInit(SceneObjectList *OwnerList) {
+ loadScene(525);
+ R2_GLOBALS._uiElements._active = false;
+ SceneExt::postInit();
+
+ R2_GLOBALS._sound1.play(105);
+
+ _actor1.postInit();
+ _actor1._effect = 1;
+
+ R2_GLOBALS._player.postInit();
+ R2_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+ R2_GLOBALS._player.disableControl();
+
+ setAction(&_sequenceManager, this, 525, &R2_GLOBALS._player, &_actor1, NULL);
+}
+
+void Scene525::signal() {
+ R2_GLOBALS._sceneManager.changeScene(1525);
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 600 -
+ *
+ *--------------------------------------------------------------------------*/
+Scene600::Scene600() {
+ _field412 = 0;
+ for (int i = 0; i < 256; i++)
+ _fieldAD2[i] = 0;
+}
+
+void Scene600::synchronize(Serializer &s) {
+ SceneExt::synchronize(s);
+
+ s.syncAsSint16LE(_field412);
+ for (int i = 0; i < 256; i++)
+ s.syncAsByte(_fieldAD2[i]);
+}
+
+bool Scene600::Item1::startAction(CursorType action, Event &event) {
+ if ((action != R2_NEGATOR_GUN) || (!R2_GLOBALS.getFlag(5)) || (R2_GLOBALS.getFlag(8)))
+ return SceneHotspot::startAction(action, event);
+
+ SceneItem::display(600, 32, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ return true;
+}
+
+bool Scene600::Item4::startAction(CursorType action, Event &event) {
+ if ((action != R2_NEGATOR_GUN) || (!R2_GLOBALS.getFlag(1)))
+ return SceneHotspot::startAction(action, event);
+
+ if ((R2_GLOBALS.getFlag(5)) && (!R2_GLOBALS.getFlag(8))) {
+ SceneItem::display(600, 32, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ return true;
+ }
+
+ if (R2_GLOBALS.getFlag(5)) {
+ SceneItem::display(600, 30, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ return true;
+ }
+
+ if ((!R2_GLOBALS.getFlag(8)) || (R2_GLOBALS.getFlag(9)))
+ return SceneHotspot::startAction(action, event);
+
+ R2_GLOBALS._player.disableControl();
+
+ Scene600 *scene = (Scene600 *)R2_GLOBALS._sceneManager._scene;
+
+ scene->_object1.setup2(603, 3, 1, 239, 54, 10, 0);
+ scene->_actor3.postInit();
+ scene->_actor2.postInit();
+
+ scene->_sceneMode = 612;
+ setAction(&scene->_sequenceManager1, this, 612, &scene->_actor3, &scene->_actor2, &R2_GLOBALS._player, NULL);
+ return true;
+}
+
+void Scene600::Actor4::signal() {
+ Common::Point pt(36, 177 + R2_GLOBALS._randomSource.getRandomNumber(5));
+ NpcMover *mover = new NpcMover();
+ addMover(mover, &pt, this);
+}
+
+bool Scene600::Actor4::startAction(CursorType action, Event &event) {
+ if ((action >= CURSOR_WALK) && (action < R2CURSORS_START))
+ // Only action cursors
+ return SceneActor::startAction(action, event);
+
+ return false;
+}
+
+void Scene600::Actor4::draw() {
+ warning("TODO: Actor4::draw()");
+ SceneActor::draw();
+}
+
+bool Scene600::Actor5::startAction(CursorType action, Event &event) {
+ if ((action < CURSOR_WALK) && (action >= R2CURSORS_START))
+ return false;
+
+ if (action != CURSOR_USE)
+ return SceneActor::startAction(action, event);
+
+ Scene600 *scene = (Scene600 *)R2_GLOBALS._sceneManager._scene;
+
+ if ((R2_INVENTORY.getObjectScene(R2_CLAMP) == 600) && (!R2_GLOBALS.getFlag(6))) {
+ R2_GLOBALS._player.disableControl();
+ scene->_actor6.setDetails(600, 11, -1, -1, 3, (SceneItem *) NULL);
+ R2_GLOBALS.setFlag(6);
+ scene->_sceneMode = 609;
+ scene->setAction(&scene->_sequenceManager1, scene, 609, &R2_GLOBALS._player, &scene->_actor5, &scene->_actor6, &scene->_actor1, NULL);
+ return true;
+ }
+
+ if (_frame != 1)
+ return false;
+
+ if (!R2_GLOBALS.getFlag(6)) {
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 616;
+ scene->setAction(&scene->_sequenceManager1, scene, 616, &R2_GLOBALS._player, &scene->_actor5, &scene->_actor6, NULL);
+ return true;
+ }
+
+ if ((R2_GLOBALS.getFlag(9)) && (R2_INVENTORY.getObjectScene(R2_COM_SCANNER) == 600))
+ SceneItem::display(600, 31, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ else {
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 601;
+ scene->setAction(&scene->_sequenceManager1, scene, 601, &R2_GLOBALS._player, &scene->_actor5, NULL);
+ }
+ return true;
+}
+
+bool Scene600::Actor6::startAction(CursorType action, Event &event) {
+ Scene600 *scene = (Scene600 *)R2_GLOBALS._sceneManager._scene;
+
+ if ((action < CURSOR_WALK) && (action >= R2CURSORS_START)) {
+ switch (action) {
+ case R2_COM_SCANNER:
+ if (R2_GLOBALS.getFlag(6)) {
+ if (R2_GLOBALS.getFlag(8)) {
+ SceneItem::display(600, 29, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ return true;
+ } else {
+ R2_GLOBALS._player.disableControl();
+ scene->_actor8.postInit();
+ scene->_actor8.setDetails(600, 20, -1, -1, 4, &scene->_actor6);
+ scene->_sceneMode = 607;
+ scene->setAction(&scene->_sequenceManager1, scene, 607, &R2_GLOBALS._player, &scene->_actor8, NULL);
+ return true;
+ }
+ } else {
+ return SceneActor::startAction(action, event);
+ }
+ break;
+ case R2_AEROSOL:
+ if (R2_GLOBALS.getFlag(5)) {
+ SceneItem::display(600, 28, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ return true;
+ } else {
+ R2_GLOBALS._player.disableControl();
+ scene->_actor7.postInit();
+ scene->_actor7.setDetails(600, 27, -1, -1, 5, &scene->_actor6);
+
+ scene->_actor4.postInit();
+ scene->_actor4.setup(601, 3, 1);
+ scene->_actor4._effect = 3;
+ scene->_actor4._moveDiff = Common::Point(1, 1);
+ scene->_actor4._moveRate = 2;
+ scene->_actor4._numFrames = 3;
+ scene->_actor4.setDetails(600, 24, 25, 26, 5, &scene->_actor7);
+
+ scene->_sceneMode = 605;
+
+ scene->setAction(&scene->_sequenceManager1, scene, 605, &R2_GLOBALS._player, &scene->_actor7, &scene->_actor4, &scene->_actor5, NULL);
+ return true;
+ }
+ break;
+ case R2_CLAMP:
+ if (R2_GLOBALS.getFlag(5)) {
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 606;
+ scene->setAction(&scene->_sequenceManager1, scene, 606, &R2_GLOBALS._player, &scene->_actor6, NULL);
+ return true;
+ } else {
+ return SceneActor::startAction(action, event);
+ }
+ break;
+ default:
+ return false;
+ break;
+ }
+ } else if (action != CURSOR_USE) {
+ if (R2_GLOBALS.getFlag(5)) {
+ return SceneActor::startAction(action, event);
+ } else {
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 610;
+ scene->setAction(&scene->_sequenceManager1, scene, 610, &scene->_actor1, &R2_GLOBALS._player, NULL);
+ return true;
+ }
+ } else
+ return SceneActor::startAction(action, event);
+}
+
+bool Scene600::Actor7::startAction(CursorType action, Event &event) {
+ Scene600 *scene = (Scene600 *)R2_GLOBALS._sceneManager._scene;
+
+ if ((action < CURSOR_WALK) && (action >= R2CURSORS_START)) {
+ return false;
+ } else if (action == CURSOR_USE) {
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 614;
+ scene->setAction(&scene->_sequenceManager1, scene, 614, &R2_GLOBALS._player, &scene->_actor7, NULL);
+ return true;
+ } else {
+ return SceneActor::startAction(action, event);
+ }
+}
+
+bool Scene600::Actor8::startAction(CursorType action, Event &event) {
+ Scene600 *scene = (Scene600 *)R2_GLOBALS._sceneManager._scene;
+
+ if ((action == CURSOR_USE) && (R2_INVENTORY.getObjectScene(9) == 600)) {
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 615;
+ scene->setAction(&scene->_sequenceManager1, scene, 615, &R2_GLOBALS._player, &scene->_actor8, NULL);
+ } else if ((action == R2_SONIC_STUNNER) && (R2_INVENTORY.getObjectScene(9) == 600) && (R2_GLOBALS._v565F1[1] == 2) && (!R2_GLOBALS.getFlag(8))){
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 608;
+ scene->setAction(&scene->_sequenceManager1, scene, 608, &R2_GLOBALS._player, &scene->_actor4, NULL);
+ } else {
+ return SceneActor::startAction(action, event);
+ }
+
+ return true;
+}
+
+void Scene600::postInit(SceneObjectList *OwnerList) {
+ loadScene(600);
+ SceneExt::postInit();
+ R2_GLOBALS.setFlag(39);
+ R2_GLOBALS._walkRegions.enableRegion(3);
+ _field412 = 0;
+
+ warning("FIXME: loop to initialize _fieldAD2[]");
+
+ _actor5.postInit();
+ _actor5.setVisage(600);
+ _actor5.setPosition(Common::Point(29, 147));
+ _actor5.fixPriority(10);
+ _actor5.setDetails(300, 3, -1, -1, 1, (SceneItem *) NULL);
+
+ _actor6.postInit();
+ _actor6.setPosition(Common::Point(246, 41));
+
+ if (R2_INVENTORY.getObjectScene(9) == 600) {
+ _actor8.postInit();
+ _actor8.setup(602, 5, 1);
+ _actor8.setPosition(Common::Point(246, 41));
+ _actor8.setDetails(600, 20, -1, -1, 1, (SceneItem *) NULL);
+ switch (R2_GLOBALS._v565F1[1] - 2) {
+ case 0:
+ R2_GLOBALS._sound4.play(45);
+ break;
+ case 1:
+ R2_GLOBALS._sound4.play(4);
+ break;
+ case 2:
+ R2_GLOBALS._sound4.play(5);
+ break;
+ case 3:
+ R2_GLOBALS._sound4.play(6);
+ break;
+ default:
+ break;
+ }
+ }
+
+ if (R2_GLOBALS.getFlag(6)) {
+ _actor6.setup(602, 7, 1);
+ _actor6.setDetails(600, 11, -1, -1, 1, (SceneItem *) NULL);
+ } else {
+ _actor6.setup(600, 2, 1);
+ _actor6.setDetails(600, 10, -1, -1, 1, (SceneItem *) NULL);
+
+ _actor1.postInit();
+ _actor1.setup(600, 3, 5);
+ _actor1.setPosition(Common::Point(223, 51));
+ _actor1.fixPriority(200);
+ }
+
+ if (! R2_GLOBALS.getFlag(9))
+ _object1.setup2(603, 1, 1, 244, 50, 10, 0);
+
+ if (R2_GLOBALS.getFlag(5)) {
+ if (R2_INVENTORY.getObjectScene(12) == 600) {
+ _actor7.postInit();
+ _actor7.setup(602, 2, 2);
+ _actor7.setPosition(Common::Point(189, 95));
+ _actor7.setDetails(600, 27, -1, -1, 1, (SceneItem *) NULL);
+ }
+
+ if (R2_GLOBALS.getFlag(8)) {
+ if (R2_GLOBALS.getFlag(9)) {
+ _actor2.postInit();
+ _actor2.setup(603, 2, 1);
+ _actor2.setPosition(Common::Point(233, 45));
+ _actor2.animate(ANIM_MODE_2, NULL);_actor2.fixPriority(11);
+ }
+ } else {
+ _actor4.postInit();
+ _actor4.setup(601, 1, 1);
+ _actor4.setPosition(Common::Point(180, 110));
+ _actor4._moveDiff = Common::Point(1, 1);
+ _actor4._moveRate = 2;
+ _actor4._numFrames = 3;
+ _actor4.animate(ANIM_MODE_2, NULL);
+ _actor4.fixPriority(130);
+ _actor4._effect = 3;
+ _actor4.setDetails(600, 24, 25, 26, 1, (SceneItem *) NULL);
+ _actor4.signal();
+ }
+ }
+
+ R2_GLOBALS._player.postInit();
+ R2_GLOBALS._player.setVisage(10);
+ R2_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+ R2_GLOBALS._player.disableControl();
+
+ _item2.setDetails(12, 600, 17, -1, 19);
+ _item3.setDetails(11, 600, 14, -1, -1);
+
+ if (R2_GLOBALS.getFlag(9)) {
+ _item1.setDetails(Rect(159, 3, 315, 95), 600, 7, -1, -1, 1, NULL);
+ } else {
+ _item4.setDetails(Rect(173, 15, 315, 45), 600, 21, -1, 23, 1, NULL);
+ _item1.setDetails(Rect(159, 3, 315, 95), 600, 6, -1, -1, 1, NULL);
+ }
+ _item5.setDetails(Rect(0, 0, 320, 200), 600, 0, -1, -1, 1, NULL);
+
+ _sceneMode = 600;
+ if (R2_GLOBALS._sceneManager._previousScene == 700) {
+ if (R2_GLOBALS.getFlag(6)) {
+ setAction(&_sequenceManager1, this, 600, &R2_GLOBALS._player, &_actor5, NULL);
+ } else if (R2_GLOBALS.getFlag(5)) {
+ setAction(&_sequenceManager1, this, 603, &R2_GLOBALS._player, &_actor5, &_actor6, &_actor1, NULL);
+ } else {
+ setAction(&_sequenceManager1, this, 602, &R2_GLOBALS._player, &_actor5, &_actor6, &_actor1, NULL);
+ }
+ } else if (R2_GLOBALS.getFlag(5)) {
+ R2_GLOBALS._player.setPosition(Common::Point(50, 140));
+ R2_GLOBALS._player.setStrip(3);
+ _actor6.setFrame(_actor6.getFrameCount());
+ signal();
+ } else {
+ _actor5.setFrame(7);
+ _actor6.setFrame(7);
+ R2_GLOBALS._player.setPosition(Common::Point(28, 140));
+ R2_GLOBALS._player.setStrip(5);
+ signal();
+ }
+}
+
+void Scene600::remove() {
+ if (R2_INVENTORY.getObjectScene(9) == 600)
+ R2_GLOBALS._sound4.fadeOut2(NULL);
+ SceneExt::remove();
+}
+
+void Scene600::signal() {
+ switch (_sceneMode) {
+ case 601:
+ // No break on purpose
+ case 613:
+ // No break on purpose
+ case 616:
+ R2_GLOBALS._sceneManager.changeScene(700);
+ break;
+ case 605:
+ R2_GLOBALS._player.enableControl();
+ R2_GLOBALS._walkRegions.enableRegion(6);
+ R2_GLOBALS._walkRegions.enableRegion(7);
+ R2_GLOBALS._walkRegions.enableRegion(9);
+ R2_GLOBALS._walkRegions.enableRegion(10);
+
+ R2_INVENTORY.setObjectScene(12, 600);
+ R2_GLOBALS.setFlag(5);
+
+ _actor4._effect = 3;
+ _actor4.signal();
+ break;
+ case 606:
+ R2_INVENTORY.setObjectScene(15, 600);
+ R2_GLOBALS._player.enableControl();
+ break;
+ case 607:
+ R2_INVENTORY.setObjectScene(9, 600);
+ R2_GLOBALS._player.enableControl();
+ break;
+ case 608:
+ R2_GLOBALS.setFlag(8);
+ _actor4.remove();
+ R2_GLOBALS._walkRegions.disableRegion(6);
+ R2_GLOBALS._walkRegions.disableRegion(9);
+ R2_GLOBALS._walkRegions.disableRegion(10);
+ R2_GLOBALS._player.enableControl();
+ break;
+ case 612:
+ R2_GLOBALS.setFlag(9);
+ _actor3.remove();
+ R2_GLOBALS._sceneItems.remove(&_item4);
+ _actor2.setDetails(600, 21, -1, 23, 4, &_item4);
+ _item1.setDetails(600, 7, -1, -1, 3, (SceneItem *) NULL);
+ R2_GLOBALS._player.enableControl(CURSOR_USE);
+ break;
+ case 614:
+ R2_GLOBALS._player.enableControl();
+ _actor7.remove();
+ R2_INVENTORY.setObjectScene(12, 1);
+ R2_GLOBALS._walkRegions.disableRegion(7);
+ break;
+ case 615:
+ _actor8.remove();
+ R2_INVENTORY.setObjectScene(9, 1);
+ R2_GLOBALS._player.enableControl();
+ break;
+ default:
+ _field412 = 0;
+ _sceneMode = 0;
+ R2_GLOBALS._player.enableControl();
+ break;
+ }
+}
+
+void Scene600::process(Event &event) {
+ if ((!R2_GLOBALS._player._canWalk) && (!R2_GLOBALS.getFlag(6)) && (event.eventType == EVENT_BUTTON_DOWN) && (R2_GLOBALS._events.getCursor() == R2_NEGATOR_GUN)) {
+ if (!_actor5.contains(event.mousePos) || (_actor5._frame <= 1)) {
+ if (R2_GLOBALS.getFlag(5)) {
+ _field412 += 10;
+ } else {
+ R2_GLOBALS._player.disableControl();
+ _sceneMode = 604;
+ setAction(&_sequenceManager1, this, 604, &_actor1, &R2_GLOBALS._player, NULL);
+ event.handled = true;
+ }
+ } else {
+ R2_GLOBALS._player.disableControl();
+ _sceneMode = 613;
+ setAction(&_sequenceManager1, this, 613, &R2_GLOBALS._player, &_actor6, NULL);
+ event.handled = true;
+ }
+ } else if ((!R2_GLOBALS.getFlag(6)) && (R2_GLOBALS._player._mover) && (_field412 < 10)){
+ _field412 += 10;
+ }
+
+ Scene::process(event);
+}
+
+void Scene600::dispatch() {
+ if ((_field412 != 0) && (_sceneMode != 600) && (_sceneMode != 603) && (_sceneMode != 602)) {
+ if ( ((_actor6._strip == 4) && (_actor6._frame > 1))
+ || (_sceneMode == 601)
+ || ((_sceneMode == 616) && (_actor5._frame > 1)) )
+ _field412 = 0;
+ else {
+ _field412--;
+ if (_field412 % 10 == 0) {
+ _actor1.setAction(&_sequenceManager2, NULL, 611, &_actor1, NULL);
+ }
+ if ((_field412 == 0) && (R2_GLOBALS._player._mover))
+ _field412 = 10;
+ }
+ }
+
+ if (_actor1._frame == 2)
+ _aSound1.play(40);
+
+ Scene::dispatch();
+ if ((_actor4._strip == 3) && (_actor4._frame == 3)) {
+ _actor1.setStrip(4);
+ _actor1.setFrame(1);
+ }
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 700 -
+ *
+ *--------------------------------------------------------------------------*/
+Scene700::Scene700() {
+ _rotation = NULL;
+}
+
+void Scene700::synchronize(Serializer &s) {
+ SceneExt::synchronize(s);
+ SYNC_POINTER(_rotation);
+}
+
+bool Scene700::Item11::startAction(CursorType action, Event &event) {
+ if ((action == CURSOR_USE) && (R2_GLOBALS._player._position.x < 100))
+ return false;
+
+ return NamedHotspot::startAction(action, event);
+}
+
+bool Scene700::Item12::startAction(CursorType action, Event &event) {
+ Scene700 *scene = (Scene700 *)R2_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case R2_CABLE_HARNESS:
+ R2_GLOBALS._player.disableControl();
+ scene->_actor5.postInit();
+ scene->_actor5.setup(701, 3, 2);
+ scene->_actor5.setPosition(Common::Point(243, 98));
+ scene->_actor5.setDetails(700, 37, -1, -1, 2, (SceneItem *) NULL);
+ scene->_actor5.hide();
+ scene->_sceneMode = 20;
+ break;
+ case R2_ATTRACTOR_CABLE_HARNESS:
+ R2_GLOBALS._player.disableControl();
+ scene->_actor5.postInit();
+ scene->_actor5.setup(701, 2, 8);
+ scene->_actor5.setPosition(Common::Point(243, 98));
+ scene->_actor5.setDetails(700, 38, -1, -1, 2, (SceneItem *) NULL);
+ scene->_actor5.hide();
+ scene->_sceneMode = 21;
+ break;
+ default:
+ return NamedHotspot::startAction(action, event);
+ break;
+ }
+
+ scene->setAction(&scene->_sequenceManager, this, 707, &R2_GLOBALS._player, &scene->_actor5, NULL);
+ return true;
+}
+
+bool Scene700::Actor2::startAction(CursorType action, Event &event) {
+ Scene700 *scene = (Scene700 *)R2_GLOBALS._sceneManager._scene;
+
+ if (action != CURSOR_USE)
+ return SceneActor::startAction(action, event);
+
+ if (R2_GLOBALS._player._position.y <= 100)
+ return false;
+
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 701;
+ scene->setAction(&scene->_sequenceManager, scene, 701, &R2_GLOBALS._player, this, NULL);
+
+ return true;
+}
+
+bool Scene700::Actor3::startAction(CursorType action, Event &event) {
+ Scene700 *scene = (Scene700 *)R2_GLOBALS._sceneManager._scene;
+
+ if (action != CURSOR_USE)
+ return SceneActor::startAction(action, event);
+
+ if (R2_GLOBALS._player._position.y <= 100)
+ return false;
+
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 702;
+ scene->setAction(&scene->_sequenceManager, scene, 702, &R2_GLOBALS._player, this, NULL);
+
+ return true;
+}
+
+bool Scene700::Actor4::startAction(CursorType action, Event &event) {
+ Scene700 *scene = (Scene700 *)R2_GLOBALS._sceneManager._scene;
+
+ if (action != CURSOR_USE)
+ return SceneActor::startAction(action, event);
+
+ if (R2_GLOBALS._player._position.y <= 100)
+ return false;
+
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 704;
+ scene->setAction(&scene->_sequenceManager, scene, 704, &R2_GLOBALS._player, this, NULL);
+
+ return true;
+}
+
+bool Scene700::Actor5::startAction(CursorType action, Event &event) {
+ Scene700 *scene = (Scene700 *)R2_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_USE:
+ switch (R2_INVENTORY.getObjectScene(R2_CABLE_HARNESS)) {
+ case 0:
+ if ((_strip == 2) && (_frame == 1)) {
+ R2_GLOBALS._player.disableControl();
+ if (R2_GLOBALS._player._position.x <= 100) {
+ scene->_sceneMode = 710;
+ scene->setAction(&scene->_sequenceManager, scene, 710, &R2_GLOBALS._player, this, NULL);
+ } else {
+ scene->_sceneMode = 709;
+ scene->setAction(&scene->_sequenceManager, scene, 709, &R2_GLOBALS._player, this, NULL);
+ }
+ } else {
+ return SceneActor::startAction(action, event);
+ }
+ break;
+ case 700: {
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 10;
+ Common::Point pt(_position.x - 12, _position.y + 1);
+ PlayerMover *mover = new PlayerMover();
+ R2_GLOBALS._player.addMover(mover, &pt, scene);
+ }
+ break;
+ default:
+ break;
+ }
+ break;
+ case R2_ATTRACTOR_UNIT:
+ R2_GLOBALS._player.disableControl();
+ if (R2_INVENTORY.getObjectScene(R2_CABLE_HARNESS) == 700) {
+ scene->_sceneMode = 706;
+ scene->setAction(&scene->_sequenceManager, scene, 706, &R2_GLOBALS._player, &scene->_actor5, NULL);
+ } else {
+ scene->_sceneMode = 15;
+ Common::Point pt(_position.x - 12, _position.y + 1);
+ PlayerMover *mover = new PlayerMover();
+ R2_GLOBALS._player.addMover(mover, &pt, scene);
+ }
+ break;
+ default:
+ return SceneActor::startAction(action, event);
+ break;
+ }
+
+ return true;
+}
+
+bool Scene700::Actor6::startAction(CursorType action, Event &event) {
+ Scene700 *scene = (Scene700 *)R2_GLOBALS._sceneManager._scene;
+
+ if ((action != CURSOR_USE) || (R2_GLOBALS._player._position.y >= 100))
+ return SceneActor::startAction(action, event);
+
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 1;
+ Common::Point pt(_position.x, 69);
+ NpcMover *mover = new NpcMover();
+ R2_GLOBALS._player.addMover(mover, &pt, scene);
+
+ return true;
+}
+
+void Scene700::postInit(SceneObjectList *OwnerList) {
+ if (R2_GLOBALS._sceneManager._previousScene == 900)
+ g_globals->gfxManager()._bounds.moveTo(Common::Point(160, 0));
+
+ loadScene(700);
+ R2_GLOBALS._v558B6.set(60, 0, 260, 200);
+ SceneExt::postInit();
+
+ _rotation = R2_GLOBALS._scenePalette.addRotation(237, 246, -1);
+ _rotation->setDelay(5);
+ _rotation->_countdown = 1;
+
+ _actor2.postInit();
+ _actor2.setVisage(700);
+ _actor2.setPosition(Common::Point(21, 128));
+ _actor2.fixPriority(10);
+ _actor2.setDetails(700, 3, -1, -1, 1, (SceneItem *) NULL);
+
+ _actor3.postInit();
+ _actor3.setup(700, 2, 1);
+ _actor3.setPosition(Common::Point(217, 120));
+ _actor3.fixPriority(10);
+ _actor3.setDetails(700, 15, -1, -1, 1, (SceneItem *) NULL);
+
+ _actor1.postInit();
+ _actor1.setup(700, 4, 1);
+ _actor1.setPosition(Common::Point(355 - ((R2_GLOBALS._v565E3 * 8) / 5), ((R2_GLOBALS._v565E1 + 20 ) / 5) - 12));
+ _actor1.fixPriority(10);
+ _actor1.setDetails(700, 12, -1, 14, 1, (SceneItem *) NULL);
+
+ _actor6.postInit();
+ _actor6.setup(700, 8, 1);
+ _actor6.setPosition(Common::Point(85, 53));
+ _actor6.setDetails(700, 33, -1, 35, 1, (SceneItem *) NULL);
+
+ _actor7.postInit();
+ _actor7.setup(700, 8, 1);
+ _actor7.setPosition(Common::Point(164, 53));
+ _actor7.setDetails(700, 33, -1, 35, 1, (SceneItem *) NULL);
+
+ _actor8.postInit();
+ _actor8.setup(700, 8, 1);
+ _actor8.setPosition(Common::Point(243, 53));
+ _actor8.setDetails(700, 33, -1, 35, 1, (SceneItem *) NULL);
+
+ _actor9.postInit();
+ _actor9.setup(700, 8, 1);
+ _actor9.setPosition(Common::Point(324, 53));
+ _actor9.setDetails(700, 33, -1, 35, 1, (SceneItem *) NULL);
+
+ if ((R2_INVENTORY.getObjectScene(R2_CABLE_HARNESS) != 1) && (R2_INVENTORY.getObjectScene(R2_ATTRACTOR_CABLE_HARNESS) != 1)) {
+ _actor5.postInit();
+ _actor5.fixPriority(10);
+ switch (R2_INVENTORY.getObjectScene(R2_ATTRACTOR_CABLE_HARNESS)) {
+ case 0:
+ switch (R2_INVENTORY.getObjectScene(R2_CABLE_HARNESS)) {
+ case 0:
+ _actor5.setup(701, 3, 2);
+ _actor5.setPosition(Common::Point(243, 98));
+ _actor5.setDetails(700, 37, -1, -1, 1, (SceneItem *) NULL);
+ break;
+ case 700:
+ _actor5.setup(701, 3, 1);
+ _actor5.setPosition(Common::Point(356 - (R2_GLOBALS._v565EB * 8), 148 - (((R2_GLOBALS._v565E9 + 10) / 5) * 4)));
+ _actor5.setDetails(700, 37, -1, -1, 1, (SceneItem *) NULL);
+ break;
+ default:
+ break;
+ }
+ break;
+ case 700:
+ switch (R2_INVENTORY.getObjectScene(R2_CABLE_HARNESS)) {
+ case 0:
+ if ((R2_GLOBALS._v565E5 != 0) && (R2_GLOBALS._v565E1 == 20) && (R2_GLOBALS._v565E3 == 70))
+ _actor5.setup(701, 2, 1);
+ else
+ _actor5.setup(701, 2, 8);
+ _actor5.setPosition(Common::Point(243, 98));
+ _actor5.fixPriority(77);
+ _actor5.setDetails(700, 38, -1, -1, 1, (SceneItem *) NULL);
+ break;
+ case 700:
+ _actor5.setup(701, 1, 8);
+ if (R2_GLOBALS._v565E7 == 0) {
+ _actor5.setPosition(Common::Point(356 - (R2_GLOBALS._v565EB * 8), 148 - (((R2_GLOBALS._v565E9 + 10) / 5) * 4)));
+ } else {
+ _actor5.setup(701, 1, 1);
+ _actor5.setPosition(Common::Point(_actor1._position.x + 1, _actor1._position.y + 120));
+ }
+ _actor5.setDetails(700, 38, -1, -1, 1, (SceneItem *) NULL);
+ break;
+ default:
+ break;
+ }
+ default:
+ break;
+ }
+ }
+
+ _actor4.postInit();
+ _actor4.setup(700, 3, 1);
+ _actor4.setPosition(Common::Point(454, 117));
+ _actor4.setDetails(700, 27, -1, -1, 1, (SceneItem *) NULL);
+
+ _item12.setDetails(Rect(234, 90, 252, 110), 700, 39, -1, -1, 1, NULL);
+ _item6.setDetails(Rect(91, 158, 385, 167), 700, 6, -1, 8, 1, NULL);
+ _item2.setDetails(Rect(47, 115, 149, 124), 700, 40, -1, 41, 1, NULL);
+ _item3.setDetails(Rect(151, 108, 187, 124), 700, 40, -1, 41, 1, NULL);
+ _item4.setDetails(Rect(247, 108, 275, 124), 700, 40, -1, 41, 1, NULL);
+ _item5.setDetails(Rect(300, 105, 321, 124), 700, 40, -1, 41, 1, NULL);
+ _item7.setDetails(Rect(255, 74, 368, 115), 700, 9, -1, 11, 1, NULL);
+ _item8.setDetails(Rect(69, 74, 182, 115), 700, 9, -1, 11, 1, NULL);
+ _item9.setDetails(Rect(370, 58, 475, 103), 700, 18, -1, -1, 1, NULL);
+ _item10.setDetails(Rect(17, 11, 393, 31), 700, 24, -1, -1, 1, NULL);
+ _item11.setDetails(Rect(42, 32, 368, 66), 700, 30, -1, 32, 1, NULL);
+ _item1.setDetails(Rect(0, 0, 480, 200), 700, 0, -1, -1, 1, NULL);
+
+ R2_GLOBALS._player.postInit();
+ R2_GLOBALS._player.setVisage(11);
+ R2_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+ R2_GLOBALS._player._moveDiff.x = 2;
+ R2_GLOBALS._player.disableControl();
+
+ R2_GLOBALS._sound1.play(34);
+
+ _sceneMode = 700;
+
+ switch (R2_GLOBALS._sceneManager._previousScene) {
+ case 250:
+ setAction(&_sequenceManager, this, 700, &R2_GLOBALS._player, &_actor2, NULL);
+ break;
+ case 500:
+ setAction(&_sequenceManager, this, 703, &R2_GLOBALS._player, &_actor3, NULL);
+ break;
+ case 600: {
+ _sceneMode = 4;
+ _actor7.setFrame(5);
+ R2_GLOBALS._player.setPosition(Common::Point(164, 74));
+ R2_GLOBALS._player.setStrip2(3);
+ Common::Point pt(164, 69);
+ NpcMover *mover = new NpcMover();
+ R2_GLOBALS._player.addMover(mover, &pt, this);
+ }
+ break;
+ case 900:
+ setAction(&_sequenceManager, this, 705, &R2_GLOBALS._player, &_actor4, NULL);
+ break;
+ default:
+ if (R2_GLOBALS.getFlag(41))
+ R2_GLOBALS._player.setPosition(Common::Point(107, 67));
+ else
+ R2_GLOBALS._player.setPosition(Common::Point(60, 140));
+ R2_GLOBALS._player.setStrip(3);
+ R2_GLOBALS._player.enableControl(CURSOR_ARROW);
+ break;
+ }
+}
+
+void Scene700::remove() {
+ R2_GLOBALS._sound1.play(10);
+// CHECKME: Present in the original... But it crashes badly.
+// The instruction was removed as it's not used in other scene coded the same way
+// and reversed by dreammaster. A double check is required in order to verify it doesn't hide
+// a memory leak
+// _rotation->remove();
+ SceneExt::remove();
+}
+
+void Scene700::signal() {
+ switch (_sceneMode) {
+ case 1:
+ _sceneMode = 2;
+ R2_GLOBALS._player.setStrip(4);
+ if (R2_GLOBALS._player._position.x != 164) {
+ SceneItem::display(700, 36, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ R2_GLOBALS._player.enableControl();
+ } else {
+ R2_GLOBALS._sound2.play(19);
+ _actor7.animate(ANIM_MODE_5, this);
+ }
+ break;
+ case 2: {
+ _sceneMode = 3;
+ R2_GLOBALS._player.setStrip2(4);
+ Common::Point pt(R2_GLOBALS._player._position.x, R2_GLOBALS._player._position.y + 5);
+ NpcMover *mover = new NpcMover();
+ R2_GLOBALS._player.addMover(mover, &pt, this);
+ }
+ break;
+ case 3:
+ R2_INVENTORY.setObjectScene(5, 600);
+ R2_INVENTORY.setObjectScene(16, 700);
+ R2_GLOBALS._player.enableControl();
+ break;
+ case 4:
+ _sceneMode = 5;
+ R2_GLOBALS._player.setStrip2(-1);
+ R2_GLOBALS._player.setObjectWrapper(new SceneObjectWrapper());
+ R2_GLOBALS._sound2.play(19);
+ _actor7.animate(ANIM_MODE_6, this);
+ R2_GLOBALS._player.setStrip(3);
+ R2_GLOBALS.setFlag(41);
+ break;
+ case 10:
+ _sceneMode = 11;
+ R2_GLOBALS._player.setup(16, 7, 1);
+ R2_GLOBALS._player.changeZoom(50);
+ R2_GLOBALS._player.animate(ANIM_MODE_5, this);
+ break;
+ case 11:
+ _sceneMode = 12;
+ _actor5.remove();
+ R2_GLOBALS._player.animate(ANIM_MODE_6, this);
+ break;
+ case 12:
+ R2_GLOBALS._player.setVisage(11);
+ R2_GLOBALS._player.changeZoom(100);
+ R2_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+ R2_GLOBALS._player.setObjectWrapper(new SceneObjectWrapper());
+ R2_GLOBALS._player._strip = 7;
+ if (R2_INVENTORY.getObjectScene(R2_ATTRACTOR_UNIT) == 0) {
+ R2_INVENTORY.setObjectScene(R2_ATTRACTOR_CABLE_HARNESS, 1);
+ R2_INVENTORY.setObjectScene(R2_CABLE_HARNESS, 0);
+ } else {
+ R2_INVENTORY.setObjectScene(R2_CABLE_HARNESS, 1);
+ }
+ R2_GLOBALS._player.enableControl();
+ break;
+ case 15:
+ _sceneMode = 16;
+ R2_GLOBALS._player.setup(16, 7, 1);
+ R2_GLOBALS._player.changeZoom(50);
+ R2_GLOBALS._player.animate(ANIM_MODE_5, this);
+ break;
+ case 16:
+ _sceneMode = 17;
+ _actor5.setup(701, 1, 8);
+ _actor5.setDetails(700, 38, -1, -1, 3, (SceneItem *) NULL);
+ if ((R2_GLOBALS._v565E5 != 0) && (_actor5._position.x == _actor1._position.x + 1) && (_actor5._position.x == 148 - (((R2_GLOBALS._v565E1 + 10) / 5) * 4))) {
+ _actor5.animate(ANIM_MODE_6, NULL);
+ Common::Point pt(_actor5._position.x, _actor1._position.y + 120);
+ NpcMover *mover = new NpcMover();
+ _actor5.addMover(mover, &pt, NULL);
+ R2_GLOBALS._v565E7 = 1;
+ }
+ R2_GLOBALS._player.animate(ANIM_MODE_6, this);
+ break;
+ case 17:
+ R2_INVENTORY.setObjectScene(R2_ATTRACTOR_UNIT, 0);
+ R2_INVENTORY.setObjectScene(R2_ATTRACTOR_CABLE_HARNESS, 700);
+ R2_GLOBALS._player.setVisage(11);
+ R2_GLOBALS._player.changeZoom(100);
+ R2_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+ R2_GLOBALS._player.setObjectWrapper(new SceneObjectWrapper());
+ R2_GLOBALS._player._strip = 7;
+ R2_GLOBALS._player.enableControl();
+ break;
+ case 20:
+ R2_INVENTORY.setObjectScene(R2_CABLE_HARNESS, 0);
+ R2_GLOBALS._player.enableControl();
+ break;
+ case 21:
+ _actor5.fixPriority(77);
+ if ((R2_GLOBALS._v565E5 != 0) && (R2_GLOBALS._v565E1 == 20) && (R2_GLOBALS._v565E3 == 70))
+ _actor5.animate(ANIM_MODE_6, NULL);
+
+ R2_INVENTORY.setObjectScene(R2_ATTRACTOR_CABLE_HARNESS, 700);
+ R2_GLOBALS._player.enableControl();
+ break;
+ case 701:
+ R2_GLOBALS._sceneManager.changeScene(250);
+ break;
+ case 702:
+ R2_GLOBALS._sceneManager.changeScene(500);
+ break;
+ case 704:
+ R2_GLOBALS._sceneManager.changeScene(900);
+ break;
+ case 706:
+ _actor5.setDetails(700, 38, -1, -1, 3, (SceneItem *) NULL);
+ _actor5.fixPriority(77);
+ if ((R2_GLOBALS._v565E5 != 0) && (R2_GLOBALS._v565E1 == 20) && (R2_GLOBALS._v565E3 == 70))
+ _actor5.animate(ANIM_MODE_6, NULL);
+ R2_INVENTORY.setObjectScene(R2_ATTRACTOR_UNIT, 0);
+ R2_INVENTORY.setObjectScene(R2_ATTRACTOR_CABLE_HARNESS, 700);
+ R2_GLOBALS._player.enableControl();
+ break;
+ case 709:
+ R2_GLOBALS.setFlag(41);
+ R2_GLOBALS._player.enableControl();
+ break;
+ case 710:
+ R2_GLOBALS.clearFlag(41);
+ R2_GLOBALS._player.enableControl();
+ break;
+ case 5:
+ // No break on purpose
+ default:
+ R2_GLOBALS._player.enableControl();
+ break;
+ }
+}
+
+/*--------------------------------------------------------------------------
* Scene 800 - Sick Bay
*
*--------------------------------------------------------------------------*/
@@ -3938,7 +6462,7 @@ void Scene800::postInit(SceneObjectList *OwnerList) {
_cabinet.setPosition(Common::Point(169, 79));
_cabinet.setDetails(800, 41, -1, -1, 1, (SceneItem *)NULL);
- if (R2_INVENTORY.getObjectScene(R2_9) == 800) {
+ if (R2_INVENTORY.getObjectScene(R2_COM_SCANNER) == 800) {
_comScanner.postInit();
_comScanner.setup(801, 2, 1);
_comScanner.setPosition(Common::Point(174, 73));
@@ -4024,7 +6548,7 @@ void Scene800::signal() {
case 811:
R2_GLOBALS._player.enableControl();
_comScanner.remove();
- R2_INVENTORY.setObjectScene(R2_9, 1);
+ R2_INVENTORY.setObjectScene(R2_COM_SCANNER, 1);
break;
default:
R2_GLOBALS._player.enableControl();
@@ -4580,6 +7104,373 @@ void Scene850::signal() {
}
}
+/*--------------------------------------------------------------------------
+ * Scene 900 -
+ *
+ *--------------------------------------------------------------------------*/
+Scene900::Actor4::Actor4() {
+ _fieldA4 = 0;
+}
+
+void Scene900::Actor4::synchronize(Serializer &s) {
+ SceneActor::synchronize(s);
+
+ s.syncAsSint16LE(_fieldA4);
+}
+
+void Scene900::Actor4::sub96135(int arg1) {
+ _fieldA4 = arg1;
+ setDetails(900, -1, -1, -1, 2, (SceneItem *) NULL);
+}
+
+Scene900::Scene900() {
+ _field412 = 0;
+ _field414 = 0;
+ _field416 = 0;
+}
+
+void Scene900::synchronize(Serializer &s) {
+ SceneExt::synchronize(s);
+
+ s.syncAsSint16LE(_field412);
+ s.syncAsSint16LE(_field414);
+ s.syncAsSint16LE(_field416);
+}
+
+bool Scene900::Actor4::startAction(CursorType action, Event &event) {
+ Scene900 *scene = (Scene900 *)R2_GLOBALS._sceneManager._scene;
+
+ if (action == CURSOR_USE) {
+ R2_GLOBALS._sound2.play(14);
+ switch (_fieldA4) {
+ case 2:
+ if (scene->_field412 == 1) {
+ scene->_sceneMode = 2;
+ scene->signal();
+ } else if (scene->_field412 == 2) {
+ if (R2_GLOBALS._v565E5 == 0) {
+ scene->_aSound1.play(30);
+ setup(900, 3, 11);
+ R2_GLOBALS._v565E5 = 1;
+ if ((R2_INVENTORY.getObjectScene(R2_CABLE_HARNESS) == 0) && (R2_INVENTORY.getObjectScene(R2_ATTRACTOR_CABLE_HARNESS == 700)) && (R2_GLOBALS._v565E1 == 20) && (R2_GLOBALS._v565E3 == 70) && (scene->_actor2._animateMode != ANIM_MODE_6)) {
+ scene->_actor2.animate(ANIM_MODE_6, NULL);
+ } else {
+ if (((scene->_actor3._percent * 49) / 100) + scene->_actor3._position.x == scene->_actor2._position.x) {
+ if (scene->_actor2._position.x == 166 - (R2_GLOBALS._v565E3 / 15)) {
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 4;
+ scene->_actor2._moveDiff.y = (scene->_actor2._position.y - (scene->_actor3._position.y + ((scene->_actor3._percent * 3) / 10) - 2)) / 9;
+ Common::Point pt(scene->_actor3._position.x + ((scene->_actor3._percent * 49) / 100), scene->_actor3._position.y + ((scene->_actor3._percent * 3) / 10) - 2);
+ NpcMover *mover = new NpcMover();
+ scene->_actor2.addMover(mover, &pt, this);
+ scene->_actor2.animate(ANIM_MODE_6, NULL);
+ }
+ }
+ }
+ } else {
+ scene->_aSound1.play(53);
+ setup(900, 3, 9);
+ R2_GLOBALS._v565E5 = 0;
+
+ if ((R2_INVENTORY.getObjectScene(R2_CABLE_HARNESS) == 0) && (R2_INVENTORY.getObjectScene(R2_ATTRACTOR_CABLE_HARNESS) == 700) && (scene->_actor2._frame < 8) && (scene->_actor2._animateMode != ANIM_MODE_5)) {
+ scene->_actor2.animate(ANIM_MODE_5, NULL);
+ } else if ((R2_INVENTORY.getObjectScene(R2_CABLE_HARNESS) == 700) && (R2_INVENTORY.getObjectScene(R2_ATTRACTOR_CABLE_HARNESS) == 700) && (scene->_actor2._frame < 8)) {
+ R2_GLOBALS._v565E7 = 0;
+ if (scene->_actor2._animateMode != 5) {
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 5;
+ scene->_actor2.animate(ANIM_MODE_5, NULL);
+ scene->_actor2._moveDiff.y = (166 - scene->_actor2._position.y) / 9;
+ Common::Point pt(scene->_actor2._position.x, 166 - (R2_GLOBALS._v565E3 / 15));
+ NpcMover *mover = new NpcMover();
+ scene->_actor2.addMover(mover, &pt, this);
+ }
+ }
+ }
+ }
+ return true;
+ break;
+ case 3:
+ if (scene->_field412 == 1) {
+ scene->_sceneMode = 3;
+ scene->signal();
+ }
+ return true;
+ break;
+ case 4:
+ if ((scene->_field416 == 0) && (scene->_field414 == 0) && (R2_GLOBALS._v565E3 != 0)) {
+ scene->_aSound1.play(38);
+ scene->_field416 = -5;
+ }
+ return true;
+ break;
+ case 5:
+ if ((scene->_field416 == 0) && (scene->_field414 == 0) && (R2_GLOBALS._v565E3 < 135)) {
+ scene->_aSound1.play(38);
+ scene->_field416 = 5;
+ }
+ return true;
+ break;
+ case 6:
+ if ((scene->_field416 == 0) && (scene->_field414 == 0) && (R2_GLOBALS._v565E1 > -10)) {
+ scene->_aSound1.play(38);
+ scene->_field414 = -5;
+ }
+ return true;
+ break;
+ case 7:
+ if ((scene->_field416 == 0) && (scene->_field414 == 0) && (R2_GLOBALS._v565E1 < 20)) {
+ scene->_aSound1.play(38);
+ scene->_field414 = 5;
+ }
+ return true;
+ break;
+ case 8:
+ SceneItem::display(5, 11, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ return true;
+ break;
+ case 9:
+ SceneItem::display(5, 12, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ return true;
+ break;
+ default:
+ if (scene->_field412 == 1) {
+ R2_GLOBALS._player.disableControl();
+ scene->_actor5.remove();
+ scene->_actor6.remove();
+ scene->_actor7.remove();
+ scene->_actor8.remove();
+ scene->_actor9.remove();
+ scene->_actor10.remove();
+ R2_GLOBALS._sound2.play(37);
+ scene->_sceneMode = 901;
+ scene->setAction(&scene->_sequenceManager1, scene, 901, &scene->_actor1, this ,NULL);
+ } else if ((scene->_field412 == 2) || (scene->_field412 == 3)) {
+ scene->_sceneMode = 1;
+ scene->signal();
+ }
+
+ return true;
+ break;
+ }
+ } else if (action == CURSOR_LOOK) {
+ if ((_fieldA4 == 2) && (scene->_field412 == 2))
+ SceneItem::display(900, 21, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ else
+ SceneItem::display(900, _fieldA4, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ return true;
+ } else {
+ return SceneActor::startAction(action, event);
+ }
+}
+
+void Scene900::postInit(SceneObjectList *OwnerList) {
+ g_globals->gfxManager()._bounds.moveTo(Common::Point(0, 0));
+ loadScene(900);
+ SceneExt::postInit();
+ R2_GLOBALS._sound1.play(34);
+
+ R2_GLOBALS._player.postInit();
+ R2_GLOBALS._player.hide();
+ R2_GLOBALS._player.disableControl();
+
+ _actor1.postInit();
+ _actor1.setDetails(900, 3, -1, -1, 1, (SceneItem *) NULL);
+
+ _field414 = 0;
+ _field416 = 0;
+
+ _actor3.postInit();
+ _actor3.fixPriority(1);
+ // useless, the original use it for debugging purposes: strcpy(_actor3._actorName, "Crane");
+ _actor3.setup(900, 1, 2);
+ _actor3.setPosition(Common::Point(89, 0));
+ _actor3._effect = 1;
+ _actor3.setDetails(900, 6, -1, 8, 1, (SceneItem *) NULL);
+
+ if ((R2_INVENTORY.getObjectScene(R2_CABLE_HARNESS) != 1) && (R2_INVENTORY.getObjectScene(R2_ATTRACTOR_CABLE_HARNESS) != 1)) {
+ _actor2.postInit();
+ _actor2.setPosition(Common::Point(0, 0));
+ _actor2.fixPriority(1);
+
+ if (R2_INVENTORY.getObjectScene(R2_CABLE_HARNESS) == 0) {
+ if (R2_INVENTORY.getObjectScene(R2_ATTRACTOR_CABLE_HARNESS) != 700) {
+ _actor2.setup(901, 3, 2);
+ } else if ((R2_GLOBALS._v565E5 != 0) && (R2_GLOBALS._v565E1 == 20) && (R2_GLOBALS._v565E3 == 70)) {
+ _actor2.setup(901, 2, 1);
+ } else {
+ _actor2.setup(901, 2, 8);
+ }
+ _actor2.setPosition(Common::Point(171, 145));
+ _actor2.setDetails(700, -1, -1, -1, 1, (SceneItem *) NULL);
+ } else {
+ _actor2.setDetails(700, -1, -1, -1, 1, (SceneItem *) NULL);
+ if (R2_GLOBALS._v565E7 == 0) {
+ _actor2.setup(901, 1, 8);
+ // Original set two times the same values: skipped
+ _actor2.setPosition(Common::Point((((100 - ((R2_GLOBALS._v565EB * 350) / 100)) * 49) / 100) + ((R2_GLOBALS._v565E9 * _actor3._percent * 6) / 100) + 89, 166 - (R2_GLOBALS._v565EB / 3)));
+ _actor2.changeZoom(((100 - ((R2_GLOBALS._v565EB * 350) / 100) + 52) / 10) * 10);
+ }
+ }
+ }
+ _item1.setDetails(Rect(0, 0, 320, 200), 900, 0, -1, -1, 1, NULL);
+ _sceneMode = 900;
+ setAction(&_sequenceManager1, this, 900, &_actor1, NULL);
+}
+
+void Scene900::remove() {
+ if (_sceneMode != 901)
+ R2_GLOBALS._sound1.play(10);
+
+ SceneExt::remove();
+}
+
+void Scene900::signal() {
+ switch (_sceneMode) {
+ case 1:
+ _field412 = 1;
+ R2_GLOBALS._sound2.play(37);
+
+ _actor5.remove();
+ _actor6.remove();
+ _actor7.remove();
+ _actor8.remove();
+ _actor9.remove();
+ _actor10.remove();
+
+ _actor5.sub96135(2);
+ _actor5.setup(900, 2, 1);
+ _actor5.setPosition(Common::Point(36, 166));
+
+ _actor6.sub96135(3);
+ _actor6.setup(900, 2, 5);
+ _actor6.setPosition(Common::Point(117, 166));
+ break;
+ case 2:
+ _field412 = 2;
+
+ _actor5.remove();
+ _actor6.remove();
+
+ _actor5.sub96135(2);
+ if (R2_GLOBALS._v565E5 == 0)
+ _actor5.setup(900, 3, 9);
+ else
+ _actor5.setup(900, 3, 11);
+ _actor5.setPosition(Common::Point(36, 166));
+
+ _actor7.sub96135(5);
+ _actor7.setup(900, 3, 3);
+ _actor7.setPosition(Common::Point(76, 134));
+
+ _actor8.sub96135(4);
+ _actor8.setup(900, 3, 7);
+ _actor8.setPosition(Common::Point(76, 156));
+
+ _actor9.sub96135(6);
+ _actor9.setup(900, 3, 1);
+ _actor9.setPosition(Common::Point(55, 144));
+
+ _actor10.sub96135(7);
+ _actor10.setup(900, 3, 5);
+ _actor10.setPosition(Common::Point(99, 144));
+
+ break;
+ case 3:
+ _field412 = 3;
+
+ _actor5.remove();
+ _actor6.remove();
+ _actor7.remove();
+ _actor8.remove();
+ _actor9.remove();
+ _actor10.remove();
+
+ _actor5.sub96135(8);
+ _actor5.setup(900, 4, 1);
+ _actor5.setPosition(Common::Point(36, 166));
+
+ _actor6.sub96135(9);
+ _actor6.setup(900, 4, 5);
+ _actor6.setPosition(Common::Point(117, 166));
+ break;
+ case 4:
+ _sceneMode = 0;
+ R2_GLOBALS._player.enableControl();
+ R2_GLOBALS._player._canWalk = false;
+ R2_GLOBALS._v565E7 = 1;
+ break;
+ case 900:
+ R2_GLOBALS._player.enableControl(CURSOR_USE);
+ R2_GLOBALS._player._canWalk = false;
+
+ _actor1.setup(900, 1, 1);
+
+ _actor4.sub96135(1);
+ _actor4.setup(900, 1, 3);
+ _actor4.setPosition(Common::Point(77, 168));
+
+ _sceneMode = 1;
+ signal();
+ break;
+ case 901:
+ R2_GLOBALS._sceneManager.changeScene(700);
+ break;
+ case 5:
+ _sceneMode = 0;
+ // No break on purpose
+ default:
+ R2_GLOBALS._player.enableControl();
+ R2_GLOBALS._player._canWalk = false;
+ break;
+ }
+}
+
+void Scene900::dispatch() {
+ if (_field416 != 0) {
+ if (_field416 < 0) {
+ R2_GLOBALS._v565E3--;
+ ++_field416;
+ } else {
+ ++R2_GLOBALS._v565E3;
+ _field416--;
+ }
+ }
+
+ if (_field414 != 0) {
+ R2_GLOBALS._v565E1--;
+ ++_field414;
+ } else {
+ ++R2_GLOBALS._v565E1;
+ _field414++;
+ }
+
+ if (R2_GLOBALS._sceneObjects->contains(&_actor2)) {
+ if ((R2_GLOBALS._v565E5 != 0) && (R2_INVENTORY.getObjectScene(R2_CABLE_HARNESS) == 0) && (R2_INVENTORY.getObjectScene(R2_ATTRACTOR_CABLE_HARNESS) == 700) && (R2_GLOBALS._v565E1 == 20) && (R2_GLOBALS._v565E3 == 70)) {
+ if ((_actor2._frame > 1) && (_actor2._animateMode != ANIM_MODE_6))
+ _actor2.animate(ANIM_MODE_6, NULL);
+ } else {
+ if ((_actor2._frame < 8) && (_actor2._animateMode != ANIM_MODE_5) && (R2_GLOBALS._v565E7 == 0) && (R2_INVENTORY.getObjectScene(R2_CABLE_HARNESS) == 0) && (R2_INVENTORY.getObjectScene(R2_ATTRACTOR_CABLE_HARNESS) == 700) && (_sceneMode != 4))
+ _actor2.animate(ANIM_MODE_5, NULL);
+ }
+ }
+
+ _actor3.changeZoom(100 - ((R2_GLOBALS._v565E3 * 70) / 100));
+ _actor3.setPosition(Common::Point(((_actor3._percent * R2_GLOBALS._v565E1 * 6) / 100) + 89, R2_GLOBALS._v565E3));
+
+ if ((R2_GLOBALS._sceneObjects->contains(&_actor2)) && (R2_GLOBALS._v565E7 != 0) && (!_actor2._mover) && (_actor2._animateMode == ANIM_MODE_NONE)) {
+ _actor2.setPosition(Common::Point(_actor3._position.x + ((_actor3._percent * 49) / 100), _actor3._position.y + ((_actor3._percent * 3) / 10)));
+ if (R2_GLOBALS._v565E3 >= 75) {
+ _actor2.setup(901, 1, 1);
+ _actor2.changeZoom(((_actor3._percent + 52) / 10) * 10);
+ } else {
+ _actor2.setup(901, 5, 1);
+ _actor2.changeZoom(((_actor3._percent / 10) * 10) + 30);
+ }
+ }
+ Scene::dispatch();
+}
+
} // End of namespace Ringworld2
} // End of namespace TsAGE
diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.h b/engines/tsage/ringworld2/ringworld2_scenes0.h
index ff5d5d63a4..d757080156 100644
--- a/engines/tsage/ringworld2/ringworld2_scenes0.h
+++ b/engines/tsage/ringworld2/ringworld2_scenes0.h
@@ -166,9 +166,66 @@ public:
virtual void signal();
};
+class Scene160: public SceneExt {
+ class Action1: public Action {
+ public:
+ void signal();
+ };
+public:
+ ASound _sound1;
+ Action1 _action1;
+ int _frameNumber, _yChange;
+ SceneObject _object1, _object2, _object3;
+ int _lineNum;
+ SynchronizedList<SceneText *> _creditsList;
+public:
+ Scene160();
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void synchronize(Serializer &s);
+ virtual void remove();
+ virtual void process(Event &event);
+};
+
class Scene175: public Scene150 {
};
+class Scene180: public SceneExt {
+ class Action1: public Action {
+ public:
+ void signal();
+ };
+private:
+ void setFrameInc(int v);
+public:
+ SpeakerWebbster _webbsterSpeaker;
+ SpeakerDutyOfficer _dutyOfficerSpeaker;
+ SpeakerTeal _tealSpeaker;
+ SpeakerGameText _gameTextSpeaker;
+ SceneActor _object1, _object2, _object3, _object4, _object5;
+ ScenePalette _palette;
+ SceneText _textList[20];
+ AnimationPlayerExt _animationPlayer;
+ SequenceManager _sequenceManager;
+ Action1 _action1;
+ ASoundExt _sound1;
+
+ int _frameNumber;
+ int _field412, _field480;
+ int _field482, _frameInc;
+ int _fontNumber, _fontHeight;
+ int _scene180Mode;
+public:
+ Scene180();
+
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void synchronize(Serializer &s);
+ virtual void remove();
+ virtual void signal();
+ virtual void process(Event &event);
+ virtual void dispatch();
+ virtual void restore();
+};
+
class Scene200: public SceneExt {
/* Objects */
class NorthDoor: public SceneActor {
@@ -206,6 +263,52 @@ public:
virtual void signal();
};
+class Scene205: public SceneExt {
+ /* Actions */
+ class Action1: public Action {
+ private:
+ void textLoop();
+ public:
+ virtual void signal();
+ };
+
+ /* Objects */
+ class Object: public SceneObject {
+ public:
+ int _x100, _y100;
+ public:
+ Object();
+
+ virtual void synchronize(Serializer &s);
+ };
+private:
+ void setup();
+ void processList(Object **ObjList, int count, const Common::Rect &bounds,
+ int xMultiply, int yMultiply, int xCenter, int yCenter);
+ void handleText();
+public:
+ AnimationPlayer _animationPlayer;
+ int _fontHeight;
+ SceneText _textList[15];
+ Object *_objList1[3];
+ Object *_objList2[3];
+ Object *_objList3[4];
+ ASound _sound1;
+ Action1 _action1;
+ int _yp;
+ int _textIndex, _lineNum;
+ Common::String _message;
+public:
+ Scene205();
+
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void synchronize(Serializer &s);
+ virtual void remove();
+ virtual void process(Event &event);
+ virtual void dispatch();
+};
+
+
class Scene250: public SceneExt {
class Button: public SceneActor {
public:
@@ -422,6 +525,220 @@ public:
virtual void dispatch();
};
+class Scene500: public SceneExt {
+ /* Items */
+ class ControlPanel: public SceneHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ /* Objects */
+ class Object2: public SceneActor {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Object3: public SceneActor {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Doorway: public SceneActor {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class OxygenTanks: public SceneActor {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class AirLock: public SceneActor {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Object8: public SceneActor {
+ // This classes uses a custom draw method
+ };
+ class Aerosol: public SceneActor {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class SonicStunner: public SceneActor {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Locker1: public SceneActor {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Locker2: public SceneActor {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Object: public SceneActor {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+public:
+ int _stripNumber;
+ byte _buffer[2710];
+ SpeakerSeeker _seekerSpeaker;
+ SpeakerQuinn _quinnSpeaker;
+ SceneHotspot _background, _item2;
+ ControlPanel _controlPanel;
+ SceneActor _object1;
+ Object2 _object2;
+ Object3 _object3;
+ Doorway _doorway;
+ OxygenTanks _tanks1, _tanks2;
+ AirLock _airLock;
+ Object8 _object8;
+ Aerosol _aerosol;
+ SonicStunner _sonicStunner;
+ Locker1 _locker1;
+ Locker2 _locker2;
+ SceneAreaObject _area1;
+ Object _obj1, _obj2, _obj3;
+ ASoundExt _sound1;
+ SequenceManager _sequenceManager1, _sequenceManager2;
+public:
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void synchronize(Serializer &s);
+ virtual void signal();
+};
+
+class Scene525: public SceneExt {
+public:
+ SceneActor _actor1;
+ SequenceManager _sequenceManager;
+
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void signal();
+
+};
+
+class Scene600 : public SceneExt {
+ class Item1 : public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Item4 : public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ class Actor4 : public SceneActor {
+ public:
+ virtual void signal();
+ virtual bool startAction(CursorType action, Event &event);
+ virtual void draw();
+ };
+ class Actor5 : public SceneActor {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Actor6 : public SceneActor {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Actor7 : public SceneActor {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Actor8 : public SceneActor {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+public:
+ int _field412;
+ Item1 _item1;
+ Item1 _item2;
+ Item1 _item3;
+ Item4 _item4;
+ Item1 _item5;
+ BackgroundSceneObject _object1;
+ SceneActor _actor1;
+ SceneActor _actor2;
+ SceneActor _actor3;
+ Actor4 _actor4;
+ Actor5 _actor5;
+ Actor6 _actor6;
+ Actor7 _actor7;
+ Actor8 _actor8;
+ ASoundExt _aSound1;
+ SequenceManager _sequenceManager1;
+ SequenceManager _sequenceManager2;
+ byte _fieldAD2[256];
+
+ Scene600();
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void remove();
+ virtual void signal();
+ virtual void process(Event &event);
+ virtual void dispatch();
+ virtual void synchronize(Serializer &s);
+};
+
+class Scene700: public SceneExt {
+ class Item11 : public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Item12 : public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ class Actor2 : public SceneActor {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Actor3 : public SceneActor {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Actor4 : public SceneActor {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Actor5 : public SceneActor {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Actor6 : public SceneActor {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+public:
+ NamedHotspot _item1;
+ NamedHotspot _item2;
+ NamedHotspot _item3;
+ NamedHotspot _item4;
+ NamedHotspot _item5;
+ NamedHotspot _item6;
+ NamedHotspot _item7;
+ NamedHotspot _item8;
+ NamedHotspot _item9;
+ NamedHotspot _item10;
+ Item11 _item11;
+ Item12 _item12;
+ SceneActor _actor1;
+ Actor2 _actor2;
+ Actor3 _actor3;
+ Actor4 _actor4;
+ Actor5 _actor5;
+ Actor6 _actor6;
+ Actor6 _actor7;
+ Actor6 _actor8;
+ Actor6 _actor9;
+ SequenceManager _sequenceManager;
+ PaletteRotation *_rotation;
+ int _field100E;
+
+ Scene700();
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void remove();
+ virtual void signal();
+ virtual void synchronize(Serializer &s);
+};
+
class Scene800: public SceneExt {
/* Items */
class Button: public NamedHotspot {
@@ -547,6 +864,42 @@ public:
virtual void signal();
};
+class Scene900 : public SceneExt {
+ class Actor4 : public SceneActor {
+ public:
+ int _fieldA4;
+
+ Actor4();
+ void sub96135(int arg1);
+ virtual void synchronize(Serializer &s);
+ virtual bool startAction(CursorType action, Event &event);
+ };
+public:
+ int _field412;
+ int _field414;
+ int _field416;
+ NamedHotspot _item1;
+ SceneActor _actor1;
+ SceneActor _actor2;
+ SceneActor _actor3;
+ Actor4 _actor4;
+ Actor4 _actor5;
+ Actor4 _actor6;
+ Actor4 _actor7;
+ Actor4 _actor8;
+ Actor4 _actor9;
+ Actor4 _actor10;
+ ASoundExt _aSound1;
+ SequenceManager _sequenceManager1;
+
+ Scene900();
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void remove();
+ virtual void signal();
+ virtual void dispatch();
+ virtual void synchronize(Serializer &s);
+};
+
} // End of namespace Ringworld2
} // End of namespace TsAGE
diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.cpp b/engines/tsage/ringworld2/ringworld2_scenes1.cpp
index 1949d19d80..23a9eb2590 100644
--- a/engines/tsage/ringworld2/ringworld2_scenes1.cpp
+++ b/engines/tsage/ringworld2/ringworld2_scenes1.cpp
@@ -37,7 +37,7 @@ void Scene1010::postInit(SceneObjectList *OwnerList) {
SceneExt::postInit();
loadScene(1010);
- R2_GLOBALS._v58CE2 = 0;
+ R2_GLOBALS._uiElements._active = false;
setZoomPercents(100, 1, 160, 100);
R2_GLOBALS._player.postInit();
R2_GLOBALS._player.setObjectWrapper(NULL);
@@ -100,7 +100,7 @@ void Scene1020::postInit(SceneObjectList *OwnerList) {
g_globals->gfxManager()._bounds.moveTo(Common::Point(160, 0));
R2_GLOBALS._v558B6.set(160, 0, 160, 161);
- R2_GLOBALS._v58CE2 = 0;
+ R2_GLOBALS._uiElements._active = false;
R2_GLOBALS._player.postInit();
if (R2_GLOBALS._sceneManager._previousScene == 1010) {
@@ -212,5 +212,14411 @@ void Scene1020::dispatch() {
Scene::dispatch();
}
+
+/*--------------------------------------------------------------------------
+ * Scene 1100 -
+ *
+ *--------------------------------------------------------------------------*/
+Scene1100::Scene1100() {
+ _field412 = 0;
+ _field414 = 0;
+}
+
+void Scene1100::synchronize(Serializer &s) {
+ SceneExt::synchronize(s);
+
+ s.syncAsSint16LE(_field412);
+ s.syncAsSint16LE(_field414);
+}
+
+bool Scene1100::Actor16::startAction(CursorType action, Event &event) {
+ Scene1100 *scene = (Scene1100 *)R2_GLOBALS._sceneManager._scene;
+
+ if (action != CURSOR_TALK)
+ return SceneActor::startAction(action, event);
+
+ if (R2_GLOBALS.getFlag(52)) {
+ R2_GLOBALS._player.disableControl();
+ if (R2_GLOBALS._player._characterIndex == 1)
+ scene->_field412 = 327;
+ else
+ scene->_field412 = 328;
+ scene->_sceneMode = 53;
+ scene->setAction(&scene->_sequenceManager1, scene, 1122, &R2_GLOBALS._player, NULL);
+ } else {
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 55;
+ if (R2_GLOBALS._v565AE >= 3) {
+ if (R2_GLOBALS._player._characterIndex == 1)
+ scene->_stripManager.start3(329, scene, R2_GLOBALS._stripManager_lookupList);
+ else
+ scene->_stripManager.start3(330, scene, R2_GLOBALS._stripManager_lookupList);
+ } else {
+ ++R2_GLOBALS._v565AE;
+ R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS);
+ if (R2_GLOBALS._player._characterIndex == 1)
+ scene->_stripManager.start3(304, scene, R2_GLOBALS._stripManager_lookupList);
+ else
+ scene->_stripManager.start3(308, scene, R2_GLOBALS._stripManager_lookupList);
+ }
+ }
+ return true;
+}
+
+bool Scene1100::Actor17::startAction(CursorType action, Event &event) {
+ Scene1100 *scene = (Scene1100 *)R2_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case R2_NEGATOR_GUN:
+ if (_visage == 1105) {
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 1114;
+ scene->setAction(&scene->_sequenceManager1, scene, 1114, &R2_GLOBALS._player, &scene->_actor17, NULL);
+ return true;
+ } else {
+ return SceneActor::startAction(action, event);
+ }
+ break;
+ case R2_SONIC_STUNNER:
+ // No break on purpose
+ case R2_PHOTON_STUNNER:
+ if (_visage == 1105) {
+ R2_GLOBALS._player.disableControl();
+ if (R2_GLOBALS._player._characterIndex == 1) {
+ scene->_sceneMode = 1112;
+ scene->setAction(&scene->_sequenceManager1, scene, 1112, &R2_GLOBALS._player, &scene->_actor17, NULL);
+ } else {
+ scene->_sceneMode = 1115;
+ scene->setAction(&scene->_sequenceManager1, scene, 1115, &R2_GLOBALS._player, &scene->_actor17, NULL);
+ }
+ return true;
+ } else if (_strip == 2) {
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 1113;
+ if (R2_GLOBALS._player._characterIndex == 1) {
+ scene->setAction(&scene->_sequenceManager1, scene, 1113, &R2_GLOBALS._player, &scene->_actor17, NULL);
+ } else {
+ scene->setAction(&scene->_sequenceManager1, scene, 1118, &R2_GLOBALS._player, &scene->_actor17, NULL);
+ }
+ return true;
+ } else {
+ return SceneActor::startAction(action, event);
+ }
+ break;
+ default:
+ return SceneActor::startAction(action, event);
+ break;
+ }
+}
+
+bool Scene1100::Actor18::startAction(CursorType action, Event &event) {
+ Scene1100 *scene = (Scene1100 *)R2_GLOBALS._sceneManager._scene;
+
+ if ((action == CURSOR_TALK) && (!R2_GLOBALS.getFlag(54)) && (R2_GLOBALS.getFlag(52))) {
+ scene->_field412 = 0;
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 53;
+ scene->setAction(&scene->_sequenceManager1, scene, 1122, &R2_GLOBALS._player, NULL);
+ return true;
+ }
+
+ return SceneActor::startAction(action, event);
+}
+
+void Scene1100::postInit(SceneObjectList *OwnerList) {
+ if ((R2_GLOBALS._sceneManager._previousScene == 300) || (R2_GLOBALS._sceneManager._previousScene == 1100))
+ loadScene(1150);
+ else
+ loadScene(1100);
+
+ if ((R2_GLOBALS._sceneManager._previousScene == 1000) && (!R2_GLOBALS.getFlag(44))) {
+ R2_GLOBALS._uiElements._active = false;
+ R2_GLOBALS._v5589E.left = 0;
+ R2_GLOBALS._v5589E.right = 200;
+ }
+
+ if (R2_GLOBALS._player._characterScene[1] == 1100)
+ R2_GLOBALS._sceneManager._previousScene = 1100;
+
+ if (R2_GLOBALS._sceneManager._previousScene == -1) {
+ R2_GLOBALS._uiElements._active = false;
+ R2_GLOBALS._v5589E.left = 0;
+ R2_GLOBALS._v5589E.right = 200;
+ }
+
+ SceneExt::postInit();
+
+ if (R2_GLOBALS._sceneManager._previousScene == -1)
+ R2_GLOBALS._sceneManager._previousScene = 1000;
+
+ _stripManager.setColors(60, 255);
+ _stripManager.setFontNumber(3);
+ _stripManager.addSpeaker(&_seekerSpeaker);
+ _stripManager.addSpeaker(&_quinnSpeaker);
+ _stripManager.addSpeaker(&_chiefSpeaker);
+
+ scalePalette(65, 65, 65);
+
+ _actor2.postInit();
+ _actor2.setup(1100, 1, 1);
+ _actor2.fixPriority(10);
+
+ R2_GLOBALS._scrollFollower = NULL;
+
+ _item3.setDetails(Rect(56, 47, 68, 83), 1100, 7, -1, -1, 1, NULL);
+ _item4.setDetails(Rect(167, 132, 183, 167), 1100, 7, -1, -1, 1, NULL);
+ _item5.setDetails(Rect(26, 112, 87, 145), 1100, 13, -1, -1, 1, NULL);
+ _item7.setDetails(Rect(4, 70, 79, 167), 1100, 16, -1, -1, 1, NULL);
+
+ R2_GLOBALS._sound1.stop();
+
+ if (R2_GLOBALS._sceneManager._previousScene == 300) {
+ if (R2_GLOBALS._player._characterIndex == 3)
+ R2_GLOBALS._player._characterIndex = R2_QUINN;
+ R2_GLOBALS._player._characterScene[1] = 1100;
+ R2_GLOBALS._player._characterScene[2] = 1100;
+ _actor2.setPosition(Common::Point(150, 30));
+ R2_GLOBALS._sound1.play(93);
+ R2_GLOBALS._player.postInit();
+ R2_GLOBALS._player.hide();
+ R2_GLOBALS._player.disableControl();
+
+ _actor16.postInit();
+ _actor16.hide();
+ if (R2_GLOBALS._player._characterIndex == 1)
+ _actor16.setDetails(9002, 0, 4, 3, 1, (SceneItem *) NULL);
+ else
+ _actor16.setDetails(9001, 0, 5, 3, 1, (SceneItem *) NULL);
+
+ _actor18.postInit();
+ _actor18.setup(1113, 3, 1);
+ _actor18.setPosition(Common::Point(181, 125));
+ _actor18.fixPriority(110);
+
+ if (R2_GLOBALS.getFlag(54))
+ _actor18.setDetails(1100, 4, -1, -1, 1, (SceneItem *) NULL);
+ else
+ _actor18.setDetails(1100, 3, -1, -1, 1, (SceneItem *) NULL);
+
+ _actor17.postInit();
+ _actor17.setup(1105, 3, 1);
+ _actor17.setPosition(Common::Point(312, 165));
+ _actor17._numFrames = 5;
+ _actor17.setDetails(1100, 22, 23, 24, 1, (SceneItem *) NULL);
+
+ _actor1.postInit();
+ _actor1.setup(1512, 1, 1);
+ _actor1.setPosition(Common::Point(187, -25));
+ _actor1.fixPriority(48);
+ _actor1._moveDiff.y = 1;
+ _actor1.setDetails(1100, 37, -1, -1, 1, (SceneItem *) NULL);
+
+ _sceneMode = 20;
+
+ setAction(&_sequenceManager1, this, 1, &R2_GLOBALS._player, NULL);
+ } else if (R2_GLOBALS._sceneManager._previousScene == 1000) {
+ _actor2.setPosition(Common::Point(50, 30));
+ _field414 = 0;
+ _palette1.loadPalette(1101);
+ R2_GLOBALS._player.postInit();
+ R2_GLOBALS._player.disableControl();
+ R2_GLOBALS._player._effect = 5;
+ R2_GLOBALS._player._field9C = _field312;
+ R2_GLOBALS._player.setup(1102, 3, 2);
+ R2_GLOBALS._player.setObjectWrapper(NULL);
+ R2_GLOBALS._player.setPosition(Common::Point(111,-20));
+ R2_GLOBALS._player.fixPriority(150);
+ R2_GLOBALS._player._moveRate = 30;
+ R2_GLOBALS._player._moveDiff = Common::Point(16, 2);
+
+ _object1.setup2(1104, 2, 1, 175, 125, 102, 1);
+ _object2.setup2(1102, 5, 1, 216, 167, 1, 0);
+
+ _actor12.postInit();
+ _actor12.setup(1113, 2, 1);
+ _actor12.setPosition(Common::Point(67, 151));
+ _actor12.fixPriority(255);
+
+ _actor3.postInit();
+ _actor3.setup(1102, 6, 1);
+ _actor3._moveRate = 30;
+ _actor3._moveDiff.x = 2;
+
+ _actor4.postInit();
+ _actor4.setup(1102, 6, 2);
+ _actor4._moveRate = 30;
+ _actor4._moveDiff.x = 2;
+ _actor4._effect = 5;
+ _actor4._field9C = _field312;
+
+ R2_GLOBALS._sound1.play(86);
+
+ _sceneMode = 0;
+
+ setAction(&_sequenceManager1, this, 1, &R2_GLOBALS._player, NULL);
+ } else {
+ _actor2.setPosition(Common::Point(180, 30));
+ if (R2_GLOBALS.getFlag(52))
+ R2_GLOBALS._sound1.play(98);
+ else
+ R2_GLOBALS._sound1.play(95);
+
+ R2_GLOBALS._player.postInit();
+ R2_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+
+ _actor16.postInit();
+
+ if (R2_GLOBALS.getFlag(52)) {
+ if (R2_GLOBALS._player._characterIndex == 1) {
+ R2_GLOBALS._player.setup(19, 7, 1);
+ _actor16.setup(29, 6, 1);
+ } else {
+ R2_GLOBALS._player.setup(29, 7, 1);
+ _actor16.setup(19, 6, 1);
+ }
+ R2_GLOBALS._player.setPosition(Common::Point(140, 124));
+ _actor16.setPosition(Common::Point(237, 134));
+ R2_GLOBALS._player.enableControl();
+ } else {
+ if (R2_GLOBALS._player._characterIndex == 1) {
+ R2_GLOBALS._player.setup(1107, 2, 1);
+ _actor16.setup(1107, 4, 1);
+ R2_GLOBALS._player.setPosition(Common::Point(247, 169));
+ _actor16.setPosition(Common::Point(213, 169));
+ } else {
+ R2_GLOBALS._player.setup(1107, 4, 1);
+ _actor16.setup(1107, 2, 1);
+ R2_GLOBALS._player.setPosition(Common::Point(213, 169));
+ _actor16.setPosition(Common::Point(247, 169));
+ }
+ R2_GLOBALS._player.enableControl();
+ R2_GLOBALS._player._canWalk = false;
+ }
+
+ if (R2_GLOBALS._player._characterIndex == 1)
+ _actor16.setDetails(9002, 0, 4, 3, 1, (SceneItem *) NULL);
+ else
+ _actor16.setDetails(9001, 0, 5, 3, 1, (SceneItem *) NULL);
+
+ _actor18.postInit();
+ _actor18.setup(1113, 3, 1);
+ _actor18.setPosition(Common::Point(181, 125));
+ _actor18.fixPriority(110);
+
+ if (R2_GLOBALS.getFlag(54))
+ _actor18.setDetails(1100, 4, -1, -1, 1, (SceneItem *) NULL);
+ else
+ _actor18.setDetails(1100, 3, -1, -1, 1, (SceneItem *) NULL);
+
+ if (!R2_GLOBALS.getFlag(52)) {
+ _actor17.postInit();
+ if (R2_GLOBALS.getFlag(53))
+ _actor17.setup(1106, 2, 4);
+ else
+ _actor17.setup(1105, 4, 4);
+
+ _actor17.setPosition(Common::Point(17, 54));
+ _actor17._numFrames = 5;
+
+ if (R2_GLOBALS.getFlag(53))
+ _actor17.setDetails(1100, 28, -1, -1, 1, (SceneItem *) NULL);
+ else
+ _actor17.setDetails(1100, 22, 23, 24, 1, (SceneItem *) NULL);
+
+ _actor17.fixPriority(200);
+ }
+ _actor1.postInit();
+ _actor1.setup(1512, 1, 1);
+ _actor1.setPosition(Common::Point(187, 45));
+ _actor1.fixPriority(48);
+ _actor1._moveDiff.y = 1;
+ _actor1.setDetails(1100, 37, -1, -1, 1, (SceneItem *) NULL);
+ }
+ _item6.setDetails(Rect(123, 69, 222, 105), 1100, 13, -1, -1, 1, NULL);
+ _item2.setDetails(Rect(0, 0, 480, 46), 1100, 0, -1, -1, 1, NULL);
+ _item1.setDetails(Rect(0, 0, 480, 200), 1100, 40, 41, 42, 1, NULL);
+}
+
+void Scene1100::remove() {
+ R2_GLOBALS._scrollFollower = &R2_GLOBALS._player;
+ if (_sceneMode > 20)
+ R2_GLOBALS._sound1.fadeOut2(NULL);
+ g_globals->gfxManager()._bounds.moveTo(Common::Point(0, 0));
+ R2_GLOBALS._uiElements._active = true;
+ SceneExt::remove();
+}
+
+void Scene1100::signal() {
+ switch (_sceneMode++) {
+ case 0:
+ _actor3.setPosition(Common::Point(350, 20));
+ setAction(&_sequenceManager1, this, 1, &R2_GLOBALS._player, NULL);
+ break;
+ case 1:{
+ Common::Point pt(-150, 20);
+ NpcMover *mover = new NpcMover();
+ _actor3.addMover(mover, &pt, this);
+ _actor4.setPosition(Common::Point(350, 55));
+
+ Common::Point pt2(-150, 55);
+ NpcMover *mover2 = new NpcMover();
+ _actor4.addMover(mover2, &pt2, NULL);
+ }
+ break;
+ case 2:
+ _actor3.remove();
+ _actor4.remove();
+ _actor5.postInit();
+ _actor6.postInit();
+ _actor7.postInit();
+ _actor8.postInit();
+ _actor9.postInit();
+ _actor10.postInit();
+ setAction(&_sequenceManager1, this, 1102, &_actor5, &_actor6, &_actor7, &_actor8, &_actor9, &_actor10, NULL);
+ break;
+ case 3: {
+ R2_GLOBALS._sound2.play(84);
+ R2_GLOBALS._player.setPosition(Common::Point(-50, 126));
+ Common::Point pt(350, 226);
+ NpcMover *mover = new NpcMover();
+ R2_GLOBALS._player.addMover(mover, &pt, this);
+ }
+ break;
+ case 4:
+ _actor18.postInit();
+ _actor18.show();
+ setAction(&_sequenceManager1, this, 1101, &_actor18, &_actor10, NULL);
+ break;
+ case 5:
+ _actor13.postInit();
+ _actor13._effect = 6;
+ _actor13.setup(1103, 3, 1);
+ _actor13._moveRate = 30;
+
+ _actor14.postInit();
+ _actor14._effect = 6;
+ _actor14.setup(1103, 4, 1);
+ _actor4._moveRate = 25;
+
+ _actor13.setAction(&_sequenceManager2, this, 1109, &_actor13, &_actor14, NULL);
+ break;
+ case 6: {
+ _actor13.remove();
+ _actor14.remove();
+ R2_GLOBALS._player.setPosition(Common::Point(-50, 136));
+ R2_GLOBALS._sound2.play(84);
+ Common::Point pt(350, 236);
+ NpcMover *mover = new NpcMover();
+ R2_GLOBALS._player.addMover(mover, &pt, this);
+ }
+ break;
+ case 7:
+ setAction(&_sequenceManager1, this, 1103, &_actor18, &_actor10);
+ break;
+ case 8:
+ R2_GLOBALS._player._effect = 0;
+ _actor11.postInit();
+ setAction(&_sequenceManager1, this, 1105, &R2_GLOBALS._player, &_actor10, &_actor11, &_actor18, NULL);
+ break;
+ case 9:
+ _object1.proc27();
+
+ _actor15.postInit();
+ _actor15.setup(1103, 2, 1);
+ _actor15._moveRate = 30;
+ _actor15.setAction(&_sequenceManager3, this, 1107, &_actor15, NULL);
+ break;
+ case 10:
+ _actor13.postInit();
+ _actor13.setup(1103, 1, 1);
+ _actor13._moveRate = 15;
+ _actor13.setAction(&_sequenceManager2, this, 1108, &_actor13, NULL);
+ break;
+ case 11: {
+ setAction(&_sequenceManager1, this, 1116, &_actor11, &_actor10, &_actor12, NULL);
+ R2_GLOBALS._player._effect = 5;
+ R2_GLOBALS._player.setup(1102, 3, 2);
+ R2_GLOBALS._player.setPosition(Common::Point(-50, 131));
+ R2_GLOBALS._sound2.play(84);
+ Common::Point pt(350, 231);
+ NpcMover *mover = new NpcMover();
+ R2_GLOBALS._player.addMover(mover, &pt, this);
+ }
+ break;
+ case 12:
+ // Really nothing
+ break;
+ case 13:
+ _actor17.postInit();
+ R2_GLOBALS._scrollFollower = &_actor17;
+
+ _actor11.setup(1100, 2, 1);
+ _actor11.setPosition(Common::Point(408, 121));
+
+ _actor10.setup(1100, 3, 5);
+ _actor10.setPosition(Common::Point(409, 121));
+
+ setAction(&_sequenceManager1, this, 1104, &_actor17, NULL);
+ break;
+ case 14:
+ setAction(&_sequenceManager1, this, 1100, &_actor11, &_actor10, NULL);
+ break;
+ case 15:
+ R2_GLOBALS._sceneManager.changeScene(1000);
+ break;
+ case 20: {
+ Common::Point pt(187, -13);
+ NpcMover *mover = new NpcMover();
+ _actor1.addMover(mover, &pt, this);
+ }
+ break;
+ case 21: {
+ R2_GLOBALS._sound2.play(92);
+ _actor17.animate(ANIM_MODE_5, NULL);
+ Common::Point pt(187, 45);
+ NpcMover *mover = new NpcMover();
+ _actor1.addMover(mover, &pt, this);
+ }
+ break;
+ case 22:
+ setAction(&_sequenceManager1, this, 1110, &_actor16, &R2_GLOBALS._player, NULL);
+ break;
+ case 23:
+ R2_GLOBALS._player.disableControl();
+ R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS);
+ _stripManager.start(312, this);
+ R2_GLOBALS._player.setAction(&_sequenceManager1, this, 1119, &R2_GLOBALS._player, NULL);
+ break;
+ case 24:
+ if (!_stripManager._endHandler)
+ R2_GLOBALS._player.disableControl();
+ break;
+ case 25:
+ R2_GLOBALS._player.disableControl();
+ _stripManager._lookupList[9] = 1;
+ _stripManager._lookupList[10] = 1;
+ _stripManager._lookupList[11] = 1;
+ R2_GLOBALS._sound1.play(95);
+ setAction(&_sequenceManager1, this, 1111, &_actor17, &R2_GLOBALS._player, &_actor16, NULL);
+ break;
+ case 26:
+ R2_GLOBALS._player.disableControl();
+ R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS);
+ _stripManager.start(302, this);
+ break;
+ case 27:
+ R2_GLOBALS._player.disableControl();
+ setAction(&_sequenceManager1, this, 1120, &_actor16, &R2_GLOBALS._player, NULL);
+ break;
+ case 28:
+ R2_GLOBALS._player.disableControl();
+ R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS);
+ _stripManager.start(303, this);
+ break;
+ case 51:
+ R2_GLOBALS.setFlag(53);
+ _actor17.setDetails(1100, 28, -1, -1, 3, (SceneItem *) NULL);
+ // No break on purpose
+ case 50:
+ // No break on purpose
+ case 29:
+ R2_GLOBALS._player.enableControl(CURSOR_USE);
+ break;
+ case 52:
+ R2_GLOBALS._sound1.play(98);
+ R2_GLOBALS.setFlag(52);
+ R2_GLOBALS._player.disableControl();
+ _sceneMode = 1116;
+ if (R2_GLOBALS._player._characterIndex == 1) {
+ setAction(&_sequenceManager1, this, 1116, &R2_GLOBALS._player, NULL);
+ _actor16.setAction(&_sequenceManager2, NULL, 1123, &_actor16, NULL);
+ } else {
+ setAction(&_sequenceManager1, this, 1124, &R2_GLOBALS._player, NULL);
+ _actor16.setAction(&_sequenceManager2, NULL, 1117, &_actor16, NULL);
+ }
+ break;
+ case 53:
+ _sceneMode = 54;
+ R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS);
+ if (_field412 == 0) {
+ R2_GLOBALS.setFlag(55);
+ if (R2_GLOBALS.getFlag(55)) {
+ if (R2_GLOBALS._player._characterIndex == 1)
+ _stripManager.start(318, this);
+ else
+ _stripManager.start(323, this);
+ } else {
+ // This part is totally useless as flag 55 has been set right before the check
+ if (R2_GLOBALS._player._characterIndex == 1)
+ _stripManager.start(317, this);
+ else
+ _stripManager.start(322, this);
+ }
+ } else {
+ _stripManager.start3(_field412, this, _stripManager._lookupList);
+ }
+ break;
+ case 54:
+ if (_stripManager._field2E8 == 1) {
+ R2_GLOBALS._player.disableControl();
+ _sceneMode = 1125;
+ setAction(&_sequenceManager1, this, 1125, &R2_GLOBALS._player, &_actor16, NULL);
+ } else
+ R2_GLOBALS._player.enableControl(CURSOR_TALK);
+ break;
+ case 55:
+ R2_GLOBALS._player.enableControl(CURSOR_TALK);
+ R2_GLOBALS._player._canWalk = false;
+ break;
+ case 99:
+ R2_GLOBALS._player._characterScene[1] = 300;
+ R2_GLOBALS._player._characterScene[2] = 300;
+ R2_GLOBALS._player._characterIndex = R2_QUINN;
+ R2_GLOBALS._sceneManager.changeScene(300);
+ break;
+ case 1112:
+ _sceneMode = 50;
+ R2_GLOBALS._player.disableControl();
+ R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS);
+ _stripManager.start3(313, this, _stripManager._lookupList);
+ break;
+ case 1113:
+ _sceneMode = 52;
+ R2_GLOBALS._player.disableControl();
+ R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS);
+ R2_GLOBALS._sound1.play(96);
+ _stripManager.start3(316, this, _stripManager._lookupList);
+ break;
+ case 1114:
+ _sceneMode = 51;
+ R2_GLOBALS._player.disableControl();
+ R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS);
+ _stripManager.start3(315, this, _stripManager._lookupList);
+ break;
+ case 1115:
+ _sceneMode = 50;
+ R2_GLOBALS._player.disableControl();
+ R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS);
+ _stripManager.start3(314, this, _stripManager._lookupList);
+ break;
+ case 1116:
+ R2_GLOBALS._player.enableControl(CURSOR_ARROW);
+ _stripManager._lookupList[9] = 1;
+ _stripManager._lookupList[10] = 1;
+ _stripManager._lookupList[11] = 1;
+ break;
+ case 1125: {
+ _sceneMode = 99;
+ R2_GLOBALS._sound2.play(100);
+ R2_GLOBALS._sound1.play(101);
+ Common::Point pt(187, -13);
+ NpcMover *mover = new NpcMover();
+ _actor1.addMover(mover, &pt, this);
+ }
+ break;
+ default:
+ R2_GLOBALS._player.enableControl();
+ R2_GLOBALS._player._canWalk = false;
+ break;
+ }
+}
+
+void Scene1100::dispatch() {
+ if ((g_globals->_sceneObjects->contains(&_actor10)) && (_actor10._visage == 1102) && (_actor10._strip == 4) && (_actor10._frame == 1) && (_actor10._flags & OBJFLAG_HIDING)) {
+ if (_field414 == 1) {
+ _field414 = 2;
+ R2_GLOBALS._scenePalette.refresh();
+ }
+ } else {
+ if (_field414 == 2)
+ R2_GLOBALS._scenePalette.refresh();
+ _field414 = 1;
+ }
+
+ Scene::dispatch();
+
+ if (R2_GLOBALS._player._bounds.contains(_actor13._position))
+ _actor13._shade = 3;
+ else
+ _actor13._shade = 0;
+
+ if (R2_GLOBALS._player._bounds.contains(_actor14._position))
+ _actor14._shade = 3;
+ else
+ _actor14._shade = 0;
+
+ if (R2_GLOBALS._player._bounds.contains(_actor15._position))
+ _actor15._shade = 3;
+ else
+ _actor15._shade = 0;
+}
+
+void Scene1100::saveCharacter(int characterIndex) {
+ if (R2_GLOBALS._player._characterIndex == 3)
+ R2_GLOBALS._sound1.fadeOut2(NULL);
+ SceneExt::saveCharacter(characterIndex);
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 1200 -
+ *
+ *--------------------------------------------------------------------------*/
+Scene1200::Scene1200() {
+ _field412 = 0;
+ _field414 = 0;
+ _field416 = 0;
+ _field418 = 0;
+ _field41A = 0;
+ _field41C = 1; //CHECKME: Only if fixup_flag == 6??
+}
+
+void Scene1200::synchronize(Serializer &s) {
+ SceneExt::synchronize(s);
+
+ s.syncAsSint16LE(_field412);
+ s.syncAsSint16LE(_field414);
+ s.syncAsSint16LE(_field416);
+ s.syncAsSint16LE(_field418);
+ s.syncAsSint16LE(_field41A);
+ s.syncAsSint16LE(_field41C);
+}
+
+Scene1200::Area1::Area1() {
+ _field20 = 0;
+}
+
+void Scene1200::Area1::synchronize(Serializer &s) {
+ SceneArea::synchronize(s);
+
+ s.syncAsByte(_field20);
+}
+
+void Scene1200::Area1::Actor3::init(int state) {
+ _state = state;
+
+ SceneActor::postInit();
+ setup(1003, 1, 1);
+ fixPriority(255);
+
+ switch (_state) {
+ case 1:
+ switch (R2_GLOBALS._v56AA6) {
+ case 1:
+ setFrame2(2);
+ setPosition(Common::Point(129, 101));
+ break;
+ case 2:
+ setFrame2(3);
+ setPosition(Common::Point(135, 95));
+ break;
+ default:
+ break;
+ }
+ case 2:
+ switch (R2_GLOBALS._v56AA7) {
+ case 1:
+ setFrame2(2);
+ setPosition(Common::Point(152, 101));
+ break;
+ case 2:
+ setFrame2(3);
+ setPosition(Common::Point(158, 122));
+ break;
+ case 3:
+ setFrame2(3);
+ setPosition(Common::Point(135, 122));
+ break;
+ default:
+ break;
+ }
+ case 3:
+ switch (R2_GLOBALS._v56AA8) {
+ case 1:
+ setFrame2(3);
+ setPosition(Common::Point(158, 95));
+ break;
+ case 2:
+ setFrame2(2);
+ setPosition(Common::Point(175, 101));
+ break;
+ default:
+ break;
+ }
+ default:
+ break;
+ }
+
+ setDetails(1200, 12, -1, -1, 2, (SceneItem *) NULL);
+}
+
+bool Scene1200::Area1::Actor3::startAction(CursorType action, Event &event) {
+ if (action != CURSOR_USE)
+ return SceneActor::startAction(action, event);
+
+ R2_GLOBALS._sound2.play(260);
+ switch (_state) {
+ case 1:
+ if (R2_GLOBALS._v56AA6 == 1) {
+ R2_GLOBALS._v56AA6 = 2;
+ setFrame2(3);
+ setPosition(Common::Point(135, 95));
+ } else {
+ R2_GLOBALS._v56AA6 = 1;
+ setFrame2(2);
+ setPosition(Common::Point(129, 101));
+ }
+ break;
+ case 2:
+ ++R2_GLOBALS._v56AA7;
+ if (R2_GLOBALS._v56AA7 == 4)
+ R2_GLOBALS._v56AA7 = 1;
+
+ switch (R2_GLOBALS._v56AA7) {
+ case 1:
+ setFrame2(1);
+ setPosition(Common::Point(152, 101));
+ break;
+ case 2:
+ setFrame2(3);
+ setPosition(Common::Point(158, 122));
+ break;
+ case 3:
+ setFrame2(3);
+ setPosition(Common::Point(135, 122));
+ break;
+ default:
+ break;
+ }
+ break;
+ case 3:
+ if (R2_GLOBALS._v56AA8 == 1) {
+ R2_GLOBALS._v56AA8 = 2;
+ setFrame2(2);
+ setPosition(Common::Point(175, 101));
+ } else {
+ R2_GLOBALS._v56AA8 = 1;
+ setFrame2(3);
+ setPosition(Common::Point(158, 95));
+ }
+ break;
+ default:
+ break;
+ }
+
+ Scene1200 *scene = (Scene1200 *)R2_GLOBALS._sceneManager._scene;
+ scene->_field418 = 0;
+
+ if ((R2_GLOBALS._v56AA6 == 1) && (R2_GLOBALS._v56AA7 == 1) && (R2_GLOBALS._v56AA8 == 1))
+ scene->_field418 = 1;
+ else if ((R2_GLOBALS._v56AA6 == 2) && (R2_GLOBALS._v56AA7 == 1) && (R2_GLOBALS._v56AA8 == 1))
+ scene->_field418 = 2;
+ else if ((R2_GLOBALS._v56AA6 == 2) && (R2_GLOBALS._v56AA7 == 1) && (R2_GLOBALS._v56AA8 == 2))
+ scene->_field418 = 3;
+ else if ((R2_GLOBALS._v56AA6 == 2) && (R2_GLOBALS._v56AA7 == 3) && (R2_GLOBALS._v56AA8 == 1))
+ scene->_field418 = 4;
+
+ return true;
+}
+
+void Scene1200::Area1::postInit(SceneObjectList *OwnerList) {
+ Scene1200 *scene = (Scene1200 *)R2_GLOBALS._sceneManager._scene;
+
+ scene->_field41A = 1;
+ R2_GLOBALS._events.setCursor(CURSOR_USE);
+ proc12(1003, 1, 1, 100, 40);
+ proc13(1200, 11, -1, -1);
+ R2_GLOBALS._sound2.play(259);
+ _actor3.init(1);
+ _actor4.init(2);
+ _actor5.init(3);
+
+ R2_GLOBALS._player._canWalk = false;
+}
+
+void Scene1200::Area1::remove() {
+ Scene1200 *scene = (Scene1200 *)R2_GLOBALS._sceneManager._scene;
+
+ scene->_field41A = 0;
+ warning("Unexpected _sceneAreas.remove() call");
+// scene->_sceneAreas.remove(&_actor3);
+// scene->_sceneAreas.remove(&_actor4);
+// scene->_sceneAreas.remove(&_actor5);
+ _actor3.remove();
+ _actor4.remove();
+ _actor5.remove();
+
+ // sub201EA
+ R2_GLOBALS._sceneItems.remove((SceneItem *)this);
+ _actor2.remove();
+ SceneArea::remove();
+ R2_GLOBALS._insetUp--;
+ //
+
+ R2_GLOBALS._player._canWalk = true;
+}
+
+void Scene1200::Area1::process(Event &event) {
+ if (_field20 != R2_GLOBALS._insetUp)
+ return;
+
+ CursorType cursor = R2_GLOBALS._events.getCursor();
+
+ if (_actor2._bounds.contains(event.mousePos.x + g_globals->gfxManager()._bounds.left , event.mousePos.y)) {
+ if (cursor == _cursorNum)
+ warning("TODO: _cursorState = ???");
+ R2_GLOBALS._events.setCursor(_savedCursorNum); //, _cursorState);
+ } else if (event.mousePos.y < 168) {
+ if (cursor != _cursorNum) {
+ _savedCursorNum = cursor;
+ warning("TODO: _cursorState = ???");
+ R2_GLOBALS._events.setCursor(CURSOR_INVALID);
+ }
+ if (event.eventType == EVENT_BUTTON_DOWN) {
+ event.handled = true;
+ warning("TODO: _cursorState = ???");
+ R2_GLOBALS._events.setCursor(_savedCursorNum); //, _cursorState);
+ remove();
+ }
+ }
+}
+
+void Scene1200::Area1::proc12(int visage, int stripFrameNum, int frameNum, int posX, int posY) {
+ Scene1200 *scene = (Scene1200 *)R2_GLOBALS._sceneManager._scene;
+
+ _actor2.postInit();
+ _actor2.setup(visage, stripFrameNum, frameNum);
+ _actor2.setPosition(Common::Point(posX, posY));
+ _actor2.fixPriority(250);
+ _cursorNum = CURSOR_INVALID;
+ scene->_sceneAreas.push_front(this);
+ ++R2_GLOBALS._insetUp;
+ _field20 = R2_GLOBALS._insetUp;
+}
+
+void Scene1200::Area1::proc13(int resNum, int lookLineNum, int talkLineNum, int useLineNum) {
+ _actor2.setDetails(resNum, lookLineNum, talkLineNum, useLineNum, 2, (SceneItem *) NULL);
+}
+
+void Scene1200::postInit(SceneObjectList *OwnerList) {
+ Rect tmpRect;
+
+ loadScene(1200);
+ SceneExt::postInit();
+
+ if (R2_GLOBALS._sceneManager._previousScene < 3200)
+ R2_GLOBALS._sound1.play(257);
+
+ _field412 = 1;
+ _field414 = 0;
+ _field416 = 0;
+ _field418 = 0;
+ _field41A = 0;
+ _field41C = 0;
+
+ if ((R2_GLOBALS._v56AA6 == 1) && (R2_GLOBALS._v56AA7 == 1) && (R2_GLOBALS._v56AA8 == 1))
+ _field418 = 1;
+ else if ((R2_GLOBALS._v56AA6 == 2) && (R2_GLOBALS._v56AA7 == 1) && (R2_GLOBALS._v56AA8 == 1))
+ _field418 = 2;
+ else if ((R2_GLOBALS._v56AA6 == 2) && (R2_GLOBALS._v56AA7 == 1) && (R2_GLOBALS._v56AA8 == 2))
+ _field418 = 3;
+ else if ((R2_GLOBALS._v56AA6 == 2) && (R2_GLOBALS._v56AA7 == 3) && (R2_GLOBALS._v56AA8 == 1))
+ _field418 = 4;
+
+ R2_GLOBALS._player.postInit();
+ R2_GLOBALS._player.disableControl();
+ R2_GLOBALS._player.setup(3156, 1, 6);
+ R2_GLOBALS._player.setPosition(Common::Point(160, 70));
+ R2_GLOBALS._player._numFrames = 10;
+ R2_GLOBALS._player._oldCharacterScene[3] = 1200;
+
+ _actor1.postInit();
+ _actor1.hide();
+
+ tmpRect.set(110, 20, 210, 120);
+ _object1.sub9EDE8(tmpRect);
+
+ _object1.sub51AE9(1);
+ _object1.sub51AFD(Common::Point(R2_GLOBALS._v56AA2, R2_GLOBALS._v56AA4));
+ warning("int unk = set_pane_p(_paneNumber);");
+ _object1.sub51B02();
+ warning("set_pane_p(unk);");
+
+ R2_GLOBALS._player.enableControl();
+ _item1.setDetails(Rect(0, 0, 320, 200), 1200, 0, 1, 2, 1, NULL);
+}
+
+void Scene1200::signal() {
+ switch (_sceneMode++) {
+ case 1:
+ // No break on purpose
+ case 1200:
+ // No break on purpose
+ case 1201:
+ // No break on purpose
+ case 1202:
+ // No break on purpose
+ case 1203:
+ R2_GLOBALS._player.enableControl();
+ warning("_eventManager.waitEvent()");
+ _sceneMode = 2;
+ break;
+ case 10:
+ _field416 = 1;
+ _field414 = 6;
+ R2_GLOBALS._player._numFrames = 5;
+ R2_GLOBALS._player.setStrip(1);
+ R2_GLOBALS._player.setFrame(5);
+ R2_GLOBALS._player.animate(ANIM_MODE_6, this);
+ break;
+ case 11:
+ // No break on purpose
+ case 21:
+ // No break on purpose
+ case 31:
+ // No break on purpose
+ case 41:
+ _field416 = 0;
+ break;
+ case 12:
+ _field414 = 14;
+ R2_GLOBALS._player._numFrames = 10;
+ R2_GLOBALS._player.setup(3155, 1, 4);
+ R2_GLOBALS._player.setPosition(Common::Point(160, 70));
+ R2_GLOBALS._player.animate(ANIM_MODE_2, NULL);
+ break;
+ case 13:
+ // No break on purpose
+ case 16:
+ // No break on purpose
+ case 23:
+ // No break on purpose
+ case 26:
+ // No break on purpose
+ case 33:
+ // No break on purpose
+ case 36:
+ // No break on purpose
+ case 43:
+ // No break on purpose
+ case 46:
+ R2_GLOBALS._player.setFrame(4);
+ _sceneMode = 1;
+ setAction(&_sequenceManager, this, 1, &R2_GLOBALS._player, NULL);
+ break;
+ case 15:
+ // No break on purpose
+ case 25:
+ // No break on purpose
+ case 35:
+ // No break on purpose
+ case 45:
+ _field414 = 20;
+ R2_GLOBALS._player.animate(ANIM_MODE_2, NULL);
+ break;
+ case 20:
+ _field416 = 1;
+ _field414 = 6;
+ R2_GLOBALS._player._numFrames = 5;
+ R2_GLOBALS._player.setStrip(2);
+ R2_GLOBALS._player.setFrame(5);
+ R2_GLOBALS._player.animate(ANIM_MODE_6, this);
+ break;
+ case 22:
+ _field414 = 14;
+ R2_GLOBALS._player._numFrames = 10;
+ R2_GLOBALS._player.setup(3155, 2, 4);
+ R2_GLOBALS._player.setPosition(Common::Point(160, 70));
+ R2_GLOBALS._player.animate(ANIM_MODE_2, NULL);
+ break;
+ case 30:
+ _field416 = 1;
+ _field414 = 6;
+ R2_GLOBALS._player._numFrames = 5;
+ R2_GLOBALS._player.setStrip(3);
+ R2_GLOBALS._player.setFrame(5);
+ R2_GLOBALS._player.animate(ANIM_MODE_6, this);
+ break;
+ case 32:
+ _field414 = 14;
+ R2_GLOBALS._player._numFrames = 10;
+ R2_GLOBALS._player.setup(3155, 3, 4);
+ R2_GLOBALS._player.setPosition(Common::Point(160, 70));
+ R2_GLOBALS._player.animate(ANIM_MODE_2, NULL);
+ break;
+ case 40:
+ _field416 = 1;
+ _field414 = 6;
+ R2_GLOBALS._player._numFrames = 5;
+ R2_GLOBALS._player.setStrip(4);
+ R2_GLOBALS._player.setFrame(5);
+ R2_GLOBALS._player.animate(ANIM_MODE_6, this);
+ break;
+ case 42:
+ _field414 = 14;
+ R2_GLOBALS._player._numFrames = 10;
+ R2_GLOBALS._player.setup(3155, 4, 4);
+ R2_GLOBALS._player.setPosition(Common::Point(160, 70));
+ R2_GLOBALS._player.animate(ANIM_MODE_2, NULL);
+ break;
+ case 50:
+ // No break on purpose
+ case 55:
+ // No break on purpose
+ case 60:
+ R2_GLOBALS._player.setup(3156, 5, 1);
+ R2_GLOBALS._player._numFrames = 5;
+ R2_GLOBALS._player.animate(ANIM_MODE_5, this);
+ break;
+ case 51:
+ // No break on purpose
+ case 56:
+ // No break on purpose
+ case 117:
+ R2_GLOBALS._player.setup(3157, 1, 1);
+ R2_GLOBALS._player.animate(ANIM_MODE_5, this);
+ break;
+ case 52:
+ // No break on purpose
+ case 82:
+ // No break on purpose
+ case 118:
+ R2_GLOBALS._player.setup(3156, 3, 6);
+ _sceneMode = 1;
+ setAction(&_sequenceManager, this, 1, &R2_GLOBALS._player, NULL);
+ break;
+ case 57:
+ // No break on purpose
+ case 91:
+ // No break on purpose
+ case 96:
+ R2_GLOBALS._player.setup(3157, 2, 1);
+ R2_GLOBALS._player.animate(ANIM_MODE_5, this);
+ break;
+ case 58:
+ // No break on purpose
+ case 92:
+ // No break on purpose
+ case 122:
+ R2_GLOBALS._player.setup(3156, 2, 6);
+ _sceneMode = 1;
+ setAction(&_sequenceManager, this, 1, &R2_GLOBALS._player, NULL);
+ break;
+ case 61:
+ R2_GLOBALS._player.setup(3157, 4, 5);
+ R2_GLOBALS._player.animate(ANIM_MODE_6, this);
+ break;
+ case 62:
+ // No break on purpose
+ case 72:
+ // No break on purpose
+ case 98:
+ R2_GLOBALS._player.setup(3156, 4, 6);
+ _sceneMode = 1;
+ setAction(&_sequenceManager, this, 1, &R2_GLOBALS._player, NULL);
+ break;
+ case 70:
+ // No break on purpose
+ case 75:
+ // No break on purpose
+ case 80:
+ R2_GLOBALS._player.setup(3156, 6, 1);
+ R2_GLOBALS._player._numFrames = 5;
+ R2_GLOBALS._player.animate(ANIM_MODE_5, this);
+ break;
+ case 71:
+ // No break on purpose
+ case 76:
+ // No break on purpose
+ case 97:
+ R2_GLOBALS._player.setup(3157, 3, 1);
+ R2_GLOBALS._player.animate(ANIM_MODE_5, this);
+ break;
+ case 77:
+ // No break on purpose
+ case 111:
+ // No break on purpose
+ case 116:
+ R2_GLOBALS._player.setup(3157, 3, 1);
+ R2_GLOBALS._player.animate(ANIM_MODE_5, this);
+ break;
+ case 78:
+ // No break on purpose
+ case 102:
+ // No break on purpose
+ case 112:
+ R2_GLOBALS._player.setup(3156, 1, 6);
+ _sceneMode = 1;
+ setAction(&_sequenceManager, this, 1, &R2_GLOBALS._player, NULL);
+ break;
+ case 81:
+ R2_GLOBALS._player.setup(3157, 2, 5);
+ R2_GLOBALS._player.animate(ANIM_MODE_6, this);
+ break;
+ case 90:
+ // No break on purpose
+ case 95:
+ // No break on purpose
+ case 100:
+ R2_GLOBALS._player.setup(3156, 7, 1);
+ R2_GLOBALS._player._numFrames = 5;
+ R2_GLOBALS._player.animate(ANIM_MODE_5, this);
+ break;
+ case 101:
+ R2_GLOBALS._player.setup(3157, 1, 5);
+ R2_GLOBALS._player.animate(ANIM_MODE_6, this);
+ break;
+ case 110:
+ // No break on purpose
+ case 115:
+ // No break on purpose
+ case 120:
+ R2_GLOBALS._player.setup(3156, 8, 1);
+ R2_GLOBALS._player._numFrames = 5;
+ R2_GLOBALS._player.animate(ANIM_MODE_5, this);
+ break;
+ case 121:
+ R2_GLOBALS._player.setup(3157, 3, 5);
+ R2_GLOBALS._player.animate(ANIM_MODE_6, this);
+ break;
+ default:
+ warning("_eventManager.waitEvent()");
+ _sceneMode = 2;
+ break;
+ }
+}
+
+void Scene1200::process(Event &event) {
+ if (_field414 != 0)
+ return;
+
+ Scene::process(event);
+
+ if (!R2_GLOBALS._player._canWalk)
+ return;
+
+ if (event.eventType == EVENT_BUTTON_DOWN) {
+ _object1.sub9EE22(R2_GLOBALS._v56AA2, R2_GLOBALS._v56AA4);
+ int unk = _object1.sub51AF8(event.mousePos);
+ switch (R2_GLOBALS._events.getCursor()) {
+ case CURSOR_ARROW:
+ event.handled = true;
+ if ((event.mousePos.x > 179) && (event.mousePos.x < 210) && (event.mousePos.y > 50) && (event.mousePos.y < 89))
+ sub9DAD6(1);
+
+ if ((event.mousePos.x > 109) && (event.mousePos.x < 140) && (event.mousePos.y > 50) && (event.mousePos.y < 89))
+ sub9DAD6(2);
+
+ if ((event.mousePos.x > 140) && (event.mousePos.x < 179) && (event.mousePos.y > 89) && (event.mousePos.y < 120))
+ sub9DAD6(3);
+
+ if ((event.mousePos.x > 140) && (event.mousePos.x < 179) && (event.mousePos.y > 19) && (event.mousePos.y < 50))
+ sub9DAD6(4);
+ break;
+ case CURSOR_USE:
+ if (unk > 36) {
+ if ( ((R2_GLOBALS._v56AA2 == 3) && (R2_GLOBALS._v56AA4 == 33))
+ || ((R2_GLOBALS._v56AA2 == 7) && (R2_GLOBALS._v56AA4 == 33))
+ || ((R2_GLOBALS._v56AA2 == 33) && (R2_GLOBALS._v56AA4 == 41))
+ || ((R2_GLOBALS._v56AA2 == 5) && (R2_GLOBALS._v56AA4 == 5))
+ || ((R2_GLOBALS._v56AA2 == 13) && (R2_GLOBALS._v56AA4 == 21))
+ || ((R2_GLOBALS._v56AA2 == 17) && (R2_GLOBALS._v56AA4 == 21))
+ || ((R2_GLOBALS._v56AA2 == 17) && (R2_GLOBALS._v56AA4 == 5))
+ || ((R2_GLOBALS._v56AA2 == 17) && (R2_GLOBALS._v56AA4 == 9))
+ || ((R2_GLOBALS._v56AA2 == 29) && (R2_GLOBALS._v56AA4 == 17))
+ || ((R2_GLOBALS._v56AA2 == 33) && (R2_GLOBALS._v56AA4 == 17))
+ || ((R2_GLOBALS._v56AA2 == 35) && (R2_GLOBALS._v56AA4 == 17))
+ || ((R2_GLOBALS._v56AA2 == 41) && (R2_GLOBALS._v56AA4 == 21)) ) {
+ _area1.postInit();
+ event.handled = true;
+ }
+ }
+
+ if ((unk == 1) || (unk == 4) || (unk == 11) || (unk == 14)) {
+ if ( ((R2_GLOBALS._v56AA2 == 3) && (R2_GLOBALS._v56AA4 == 9))
+ || ((R2_GLOBALS._v56AA2 == 11) && (R2_GLOBALS._v56AA4 == 27))
+ || ((R2_GLOBALS._v56AA2 == 17) && (R2_GLOBALS._v56AA4 == 7))
+ || ((R2_GLOBALS._v56AA2 == 17) && (R2_GLOBALS._v56AA4 == 27))
+ || ((R2_GLOBALS._v56AA2 == 17) && (R2_GLOBALS._v56AA4 == 33))
+ || (R2_GLOBALS._v56AA2 == 33) ) {
+ switch (R2_GLOBALS._v56AA2) {
+ case 3:
+ R2_GLOBALS._sceneManager.changeScene(3150);
+ break;
+ case 33:
+ if (R2_GLOBALS._v56AA1 >= 4)
+ R2_GLOBALS._sceneManager.changeScene(3250);
+ else
+ SceneItem::display(1200, 6, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999);
+ break;
+ default:
+ SceneItem::display(1200, 5, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999);
+ break;
+ }
+ event.handled = true;
+ }
+ }
+ break;
+ case CURSOR_LOOK:
+ if ((unk == 1) || (unk == 4) || (unk == 11) || (unk == 14)) {
+ event.handled = true;
+ switch (R2_GLOBALS._v56AA2) {
+ case 3:
+ SceneItem::display(1200, 8, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ break;
+ case 9:
+ R2_GLOBALS._sceneManager.changeScene(3240);
+ break;
+ case 11:
+ if (R2_GLOBALS._v56AA4 == 27)
+ R2_GLOBALS._sceneManager.changeScene(3210);
+ else
+ SceneItem::display(1200, 10, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ break;
+ case 17:
+ switch (R2_GLOBALS._v56AA4) {
+ case 5:
+ R2_GLOBALS._sceneManager.changeScene(3230);
+ break;
+ case 21:
+ R2_GLOBALS._sceneManager.changeScene(3220);
+ break;
+ case 33:
+ R2_GLOBALS._sceneManager.changeScene(3200);
+ break;
+ default:
+ SceneItem::display(1200, 10, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ break;
+ }
+ case 33:
+ R2_GLOBALS._sceneManager.changeScene(3245);
+ break;
+ default:
+ SceneItem::display(1200, 10, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ break;
+ }
+ }
+ if (unk > 36) {
+ event.handled = true;
+ SceneItem::display(1200, 9, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ }
+ break;
+ case CURSOR_TALK:
+ event.handled = true;
+ break;
+ default:
+ return;
+ }
+ } else if (event.eventType == EVENT_KEYPRESS) {
+ if (_field414 == 0) {
+ event.handled = false;
+ return;
+ }
+
+ switch (event.kbd.keycode) {
+ case Common::KEYCODE_1:
+ warning("FIXME: keycode = 0x4800");
+ sub9DAD6(4);
+ break;
+ case Common::KEYCODE_2:
+ warning("FIXME: keycode = 0x4B00");
+ sub9DAD6(2);
+ break;
+ case Common::KEYCODE_3:
+ warning("FIXME: keycode = 0x4D00");
+ sub9DAD6(1);
+ break;
+ case Common::KEYCODE_4:
+ warning("FIXME: keycode = 0x5000");
+ sub9DAD6(3);
+ break;
+ default:
+ event.handled = false;
+ return;
+ break;
+ }
+ } else {
+ return;
+ }
+}
+
+void Scene1200::dispatch() {
+ Rect tmpRect;
+ Scene::dispatch();
+ if (_field41C != 0) {
+ _object1.sub51AFD(Common::Point(R2_GLOBALS._v56AA2, R2_GLOBALS._v56AA4));
+ warning("int unk = set_pane_p(_paneNumber);");
+ _object1.sub51B02();
+ warning("_gfxManager.sub294AC(unk);");
+ warning("tmpRect.sub14DF3();");
+ _field41C = 0;
+ }
+
+ if (_field414 != 0) {
+ tmpRect.set(110, 20, 210, 120);
+ _field414--;
+ switch (_field412 - 1) {
+ case 0:
+ R2_GLOBALS._v56AA2 += 2;
+ break;
+ case 1:
+ R2_GLOBALS._v56AA2 -= 2;
+ break;
+ case 2:
+ R2_GLOBALS._v56AA4 += 2;
+ break;
+ case 3:
+ R2_GLOBALS._v56AA4 -= 2;
+ break;
+ default:
+ break;
+ }
+ _object1.sub51AFD(Common::Point(R2_GLOBALS._v56AA2, R2_GLOBALS._v56AA4));
+ warning("int unk = set_pane_p(_paneNumber);");
+ _object1.sub51B02();
+ warning("_gfxManager.sub294AC(unk);");
+ warning("tmpRect.sub14DF3();");
+
+ if (_field416 != 0) {
+ switch(_field412 - 1) {
+ case 0:
+ R2_GLOBALS._player.setPosition(Common::Point(R2_GLOBALS._player._position.x - 2, R2_GLOBALS._player._position.y));
+ break;
+ case 1:
+ R2_GLOBALS._player.setPosition(Common::Point(R2_GLOBALS._player._position.x + 2, R2_GLOBALS._player._position.y));
+ break;
+ case 2:
+ R2_GLOBALS._player.setPosition(Common::Point(R2_GLOBALS._player._position.x, R2_GLOBALS._player._position.y - 2));
+ break;
+ case 3:
+ R2_GLOBALS._player.setPosition(Common::Point(R2_GLOBALS._player._position.x, R2_GLOBALS._player._position.y + 2));
+ break;
+ default:
+ break;
+ }
+ }
+ if (_field414 == 0) {
+ if (_field416 == 0)
+ R2_GLOBALS._player.animate(ANIM_MODE_NONE, NULL);
+ signal();
+ }
+ }
+}
+
+void Scene1200::saveCharacter(int characterIndex) {
+ R2_GLOBALS._sound1.fadeOut2(NULL);
+ SceneExt::saveCharacter(characterIndex);
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 1337 - Card game
+ *
+ *--------------------------------------------------------------------------*/
+
+Scene1337::unkObj1337sub1::unkObj1337sub1() {
+ _field34 = 0;
+ _field36 = Common::Point(0, 0);
+}
+
+void Scene1337::unkObj1337sub1::synchronize(Serializer &s) {
+ warning("STUBBED: unkObj1337sub1::synchronize()");
+}
+
+Scene1337::unkObj1337_1::unkObj1337_1() {
+ _fieldB94 = Common::Point(0, 0);
+ _fieldB98 = Common::Point(0, 0);
+ _fieldB9C = Common::Point(0, 0);
+ _fieldBA0 = Common::Point(0, 0);
+ _fieldBA4 = 0;
+}
+
+void Scene1337::unkObj1337_1::synchronize(Serializer &s) {
+ warning("STUBBED: unkObj1337_1::synchronize()");
+}
+
+Scene1337::Scene1337() {
+ _autoplay = false;
+ _field3E24 = 0;
+ _field3E26 = 0;
+
+ for (int i = 0; i < 100; i++)
+ _field3E28[i] = 0;
+
+ _field423C = 0;
+ _field423E = 0;
+ _field4240 = 0;
+ _field4242 = 0;
+ _field4244 = 0;
+ _field4246 = 0;
+ _field4248 = 0;
+ _field424A = 0;
+ _field424C = 0;
+ _field424E = 0;
+}
+
+void Scene1337::synchronize(Serializer &s) {
+ warning("STUBBED: Scene1337::synchronize()");
+}
+
+void Scene1337::Action1337::subD18B5(int resNum, int stripNum, int frameNum) {
+ warning("STUBBED: Action1337::subD18B5()");
+}
+
+void Scene1337::Action1337::skipFrames(int32 skipCount) {
+ uint32 firstFrameNumber = g_globals->_events.getFrameNumber();
+ uint32 tmpFrameNumber = firstFrameNumber;
+
+ while (tmpFrameNumber < firstFrameNumber + skipCount)
+ tmpFrameNumber = g_globals->_events.getFrameNumber();
+
+ warning("_eventManager.waitEvent(-1)");
+}
+
+void Scene1337::Action1::signal() {
+ Scene1337 *scene = (Scene1337 *)R2_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 1: {
+ scene->actionDisplay(1331, 6, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ R2_GLOBALS._sceneObjects->draw();
+ scene->actionDisplay(1331, 7, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ scene->actionDisplay(1331, 8, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+
+ scene->_arrunkObj1337[1]._arr2[0]._field34 = 2;
+ scene->_arrunkObj1337[1]._arr2[0]._object1.postInit();
+ scene->_arrunkObj1337[1]._arr2[0]._object1.setVisage(1332);
+ scene->_arrunkObj1337[1]._arr2[0]._object1.setPosition(scene->_arrunkObj1337[1]._arr2[0]._field36, 0);
+ scene->_arrunkObj1337[1]._arr2[0]._object1.setStrip(2);
+ scene->_arrunkObj1337[1]._arr2[0]._object1.setFrame(scene->_arrunkObj1337[1]._arr2[0]._field34);
+ scene->_arrunkObj1337[1]._arr2[0]._object1.fixPriority(170);
+ scene->setAnimationInfo(&scene->_arrunkObj1337[1]._arr2[0]);
+
+ scene->_arrunkObj1337[1]._arr2[1]._field34 = 3;
+ scene->_arrunkObj1337[1]._arr2[1]._object1.postInit();
+ scene->_arrunkObj1337[1]._arr2[1]._object1.setVisage(1332);
+ scene->_arrunkObj1337[1]._arr2[1]._object1.setPosition(scene->_arrunkObj1337[1]._arr2[1]._field36, 0);
+ scene->_arrunkObj1337[1]._arr2[1]._object1.setStrip(2);
+ scene->_arrunkObj1337[1]._arr2[1]._object1.setFrame(scene->_arrunkObj1337[1]._arr2[1]._field34);
+ scene->_arrunkObj1337[1]._arr2[1]._object1.fixPriority(170);
+ scene->setAnimationInfo(&scene->_arrunkObj1337[1]._arr2[1]);
+
+ scene->_arrunkObj1337[2]._arr2[0]._field34 = 4;
+ scene->_arrunkObj1337[2]._arr2[0]._object1.postInit();
+ scene->_arrunkObj1337[2]._arr2[0]._object1.setVisage(1332);
+ scene->_arrunkObj1337[2]._arr2[0]._object1.setPosition(scene->_arrunkObj1337[2]._arr2[0]._field36, 0);
+ scene->_arrunkObj1337[2]._arr2[0]._object1.setStrip(2);
+ scene->_arrunkObj1337[2]._arr2[0]._object1.setFrame(scene->_arrunkObj1337[2]._arr2[0]._field34);
+ scene->_arrunkObj1337[2]._arr2[0]._object1.fixPriority(170);
+ scene->setAnimationInfo(&scene->_arrunkObj1337[2]._arr2[0]);
+
+ scene->_arrunkObj1337[3]._arr2[0]._field34 = 5;
+ scene->_arrunkObj1337[3]._arr2[0]._object1.postInit();
+ scene->_arrunkObj1337[3]._arr2[0]._object1.setVisage(1332);
+ scene->_arrunkObj1337[3]._arr2[0]._object1.setPosition(scene->_arrunkObj1337[3]._arr2[0]._field36, 0);
+ scene->_arrunkObj1337[3]._arr2[0]._object1.setStrip(2);
+ scene->_arrunkObj1337[3]._arr2[0]._object1.setFrame(scene->_arrunkObj1337[3]._arr2[0]._field34);
+ scene->_arrunkObj1337[3]._arr2[0]._object1.fixPriority(170);
+ scene->setAnimationInfo(&scene->_arrunkObj1337[3]._arr2[0]);
+
+ scene->_arrunkObj1337[3]._arr2[1]._field34 = 6;
+ scene->_arrunkObj1337[3]._arr2[1]._object1.postInit();
+ scene->_arrunkObj1337[3]._arr2[1]._object1.setVisage(1332);
+ scene->_arrunkObj1337[3]._arr2[1]._object1.setPosition(scene->_arrunkObj1337[3]._arr2[1]._field36, 0);
+ scene->_arrunkObj1337[3]._arr2[1]._object1.setStrip(2);
+ scene->_arrunkObj1337[3]._arr2[1]._object1.setFrame(scene->_arrunkObj1337[3]._arr2[1]._field34);
+ scene->_arrunkObj1337[3]._arr2[1]._object1.fixPriority(170);
+ scene->setAnimationInfo(&scene->_arrunkObj1337[3]._arr2[1]);
+
+ scene->_arrunkObj1337[3]._arr2[2]._field34 = 7;
+ scene->_arrunkObj1337[3]._arr2[2]._object1.postInit();
+ scene->_arrunkObj1337[3]._arr2[2]._object1.setVisage(1332);
+ scene->_arrunkObj1337[3]._arr2[2]._object1.setPosition(scene->_arrunkObj1337[3]._arr2[2]._field36, 0);
+ scene->_arrunkObj1337[3]._arr2[2]._object1.setStrip(2);
+ scene->_arrunkObj1337[3]._arr2[2]._object1.setFrame(scene->_arrunkObj1337[3]._arr2[2]._field34);
+ scene->_arrunkObj1337[3]._arr2[2]._object1.fixPriority(170);
+ scene->setAnimationInfo(&scene->_arrunkObj1337[3]._arr2[2]);
+
+ scene->_arrunkObj1337[0]._arr2[0]._field34 = 8;
+ scene->_arrunkObj1337[0]._arr2[0]._object1.postInit();
+ scene->_arrunkObj1337[0]._arr2[0]._object1.setVisage(1332);
+ scene->_arrunkObj1337[0]._arr2[0]._object1.setPosition(scene->_arrunkObj1337[0]._arr2[0]._field36, 0);
+ scene->_arrunkObj1337[0]._arr2[0]._object1.setStrip(2);
+ scene->_arrunkObj1337[0]._arr2[0]._object1.setFrame(scene->_arrunkObj1337[0]._arr2[0]._field34);
+ scene->_arrunkObj1337[0]._arr2[0]._object1.fixPriority(170);
+ scene->setAnimationInfo(&scene->_arrunkObj1337[0]._arr2[0]);
+
+ scene->_arrunkObj1337[0]._arr2[1]._field34 = 9;
+ scene->_arrunkObj1337[0]._arr2[1]._object1.postInit();
+ scene->_arrunkObj1337[0]._arr2[1]._object1.setVisage(1332);
+ scene->_arrunkObj1337[0]._arr2[1]._object1.setPosition(scene->_arrunkObj1337[0]._arr2[1]._field36, 0);
+ scene->_arrunkObj1337[0]._arr2[1]._object1.setStrip(2);
+ scene->_arrunkObj1337[0]._arr2[1]._object1.setFrame(scene->_arrunkObj1337[0]._arr2[1]._field34);
+ scene->_arrunkObj1337[0]._arr2[1]._object1.fixPriority(170);
+ scene->setAnimationInfo(&scene->_arrunkObj1337[0]._arr2[1]);
+
+ R2_GLOBALS._sceneObjects->draw();
+
+ skipFrames(60);
+ scene->actionDisplay(1331, 9, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+
+ scene->_arrunkObj1337[2]._arr2[1]._field34 = 2;
+ scene->_arrunkObj1337[2]._arr2[1]._object1.postInit();
+ scene->_arrunkObj1337[2]._arr2[1]._object1.setVisage(1332);
+ scene->_arrunkObj1337[2]._arr2[1]._object1.setPosition(scene->_arrunkObj1337[2]._arr2[1]._field36, 0);
+ scene->_arrunkObj1337[2]._arr2[1]._object1.setStrip(2);
+ scene->_arrunkObj1337[2]._arr2[1]._object1.setFrame(scene->_arrunkObj1337[2]._arr2[1]._field34);
+ scene->_arrunkObj1337[2]._arr2[1]._object1.fixPriority(170);
+ scene->setAnimationInfo(&scene->_arrunkObj1337[2]._arr2[1]);
+
+ scene->_arrunkObj1337[2]._arr2[2]._field34 = 3;
+ scene->_arrunkObj1337[2]._arr2[2]._object1.postInit();
+ scene->_arrunkObj1337[2]._arr2[2]._object1.setVisage(1332);
+ scene->_arrunkObj1337[2]._arr2[2]._object1.setPosition(scene->_arrunkObj1337[2]._arr2[2]._field36, 0);
+ scene->_arrunkObj1337[2]._arr2[2]._object1.setStrip(2);
+ scene->_arrunkObj1337[2]._arr2[2]._object1.setFrame(scene->_arrunkObj1337[2]._arr2[2]._field34);
+ scene->_arrunkObj1337[2]._arr2[2]._object1.fixPriority(170);
+ scene->setAnimationInfo(&scene->_arrunkObj1337[2]._arr2[2]);
+
+ scene->_arrunkObj1337[2]._arr2[3]._field34 = 5;
+ scene->_arrunkObj1337[2]._arr2[3]._object1.postInit();
+ scene->_arrunkObj1337[2]._arr2[3]._object1.setVisage(1332);
+ scene->_arrunkObj1337[2]._arr2[3]._object1.setPosition(scene->_arrunkObj1337[2]._arr2[3]._field36, 0);
+ scene->_arrunkObj1337[2]._arr2[3]._object1.setStrip(2);
+ scene->_arrunkObj1337[2]._arr2[3]._object1.setFrame(scene->_arrunkObj1337[2]._arr2[3]._field34);
+ scene->_arrunkObj1337[2]._arr2[3]._object1.fixPriority(170);
+ scene->setAnimationInfo(&scene->_arrunkObj1337[2]._arr2[3]);
+
+ scene->_arrunkObj1337[2]._arr2[4]._field34 = 6;
+ scene->_arrunkObj1337[2]._arr2[4]._object1.postInit();
+ scene->_arrunkObj1337[2]._arr2[4]._object1.setVisage(1332);
+ scene->_arrunkObj1337[2]._arr2[4]._object1.setPosition(scene->_arrunkObj1337[2]._arr2[4]._field36, 0);
+ scene->_arrunkObj1337[2]._arr2[4]._object1.setStrip(2);
+ scene->_arrunkObj1337[2]._arr2[4]._object1.setFrame(scene->_arrunkObj1337[2]._arr2[4]._field34);
+ scene->_arrunkObj1337[2]._arr2[4]._object1.fixPriority(170);
+ scene->setAnimationInfo(&scene->_arrunkObj1337[2]._arr2[4]);
+
+ scene->_arrunkObj1337[2]._arr2[5]._field34 = 7;
+ scene->_arrunkObj1337[2]._arr2[5]._object1.postInit();
+ scene->_arrunkObj1337[2]._arr2[5]._object1.setVisage(1332);
+ scene->_arrunkObj1337[2]._arr2[5]._object1.setPosition(scene->_arrunkObj1337[2]._arr2[5]._field36, 0);
+ scene->_arrunkObj1337[2]._arr2[5]._object1.setStrip(2);
+ scene->_arrunkObj1337[2]._arr2[5]._object1.setFrame(scene->_arrunkObj1337[2]._arr2[5]._field34);
+ scene->_arrunkObj1337[2]._arr2[5]._object1.fixPriority(170);
+ scene->setAnimationInfo(&scene->_arrunkObj1337[2]._arr2[5]);
+
+ scene->_arrunkObj1337[2]._arr2[6]._field34 = 8;
+ scene->_arrunkObj1337[2]._arr2[6]._object1.postInit();
+ scene->_arrunkObj1337[2]._arr2[6]._object1.setVisage(1332);
+ scene->_arrunkObj1337[2]._arr2[6]._object1.setPosition(scene->_arrunkObj1337[2]._arr2[6]._field36, 0);
+ scene->_arrunkObj1337[2]._arr2[6]._object1.setStrip(2);
+ scene->_arrunkObj1337[2]._arr2[6]._object1.setFrame(scene->_arrunkObj1337[2]._arr2[6]._field34);
+ scene->_arrunkObj1337[2]._arr2[6]._object1.fixPriority(170);
+ scene->setAnimationInfo(&scene->_arrunkObj1337[2]._arr2[6]);
+
+ scene->_arrunkObj1337[2]._arr2[7]._field34 = 9;
+ scene->_arrunkObj1337[2]._arr2[7]._object1.postInit();
+ scene->_arrunkObj1337[2]._arr2[7]._object1.setVisage(1332);
+ scene->_arrunkObj1337[2]._arr2[7]._object1.setPosition(scene->_arrunkObj1337[2]._arr2[7]._field36, 0);
+ scene->_arrunkObj1337[2]._arr2[7]._object1.setStrip(2);
+ scene->_arrunkObj1337[2]._arr2[7]._object1.setFrame(scene->_arrunkObj1337[2]._arr2[7]._field34);
+ scene->_arrunkObj1337[2]._arr2[7]._object1.fixPriority(170);
+ scene->setAnimationInfo(&scene->_arrunkObj1337[2]._arr2[7]);
+
+ scene->_aSound1.play(62);
+
+ R2_GLOBALS._sceneObjects->draw();
+
+ skipFrames(120);
+ scene->_arrunkObj1337[2]._arr2[0]._object1.remove();
+ scene->_arrunkObj1337[2]._arr2[1]._object1.remove();
+ scene->_arrunkObj1337[2]._arr2[2]._object1.remove();
+ scene->_arrunkObj1337[2]._arr2[3]._object1.remove();
+ scene->_arrunkObj1337[2]._arr2[4]._object1.remove();
+ scene->_arrunkObj1337[2]._arr2[5]._object1.remove();
+ scene->_arrunkObj1337[2]._arr2[6]._object1.remove();
+ scene->_arrunkObj1337[2]._arr2[7]._object1.remove();
+
+ scene->_arrunkObj1337[1]._arr2[0]._object1.remove();
+ scene->_arrunkObj1337[1]._arr2[1]._object1.remove();
+
+ scene->_arrunkObj1337[3]._arr2[0]._object1.remove();
+ scene->_arrunkObj1337[3]._arr2[1]._object1.remove();
+ scene->_arrunkObj1337[3]._arr2[2]._object1.remove();
+
+ scene->_arrunkObj1337[0]._arr2[0]._object1.remove();
+ scene->_arrunkObj1337[0]._arr2[1]._object1.remove();
+
+ scene->_background2.setup2(1332, 5, 1, 165, 95, 110, 1);
+
+ scene->_arrunkObj1337[1]._arr1[0]._object1.postInit();
+ scene->_arrunkObj1337[1]._arr1[0]._object1.setVisage(1332);
+ scene->_arrunkObj1337[1]._arr1[0]._object1.setPosition(scene->_arrunkObj1337[1]._arr1[0]._field36, 0);
+ scene->_arrunkObj1337[1]._arr1[0]._object1.setStrip(1);
+ scene->_arrunkObj1337[1]._arr1[0]._object1.setFrame(4);
+ scene->_arrunkObj1337[1]._arr1[0]._object1.fixPriority(170);
+
+ scene->_arrunkObj1337[1]._arr1[1]._object1.postInit();
+ scene->_arrunkObj1337[1]._arr1[1]._object1.setVisage(1332);
+ scene->_arrunkObj1337[1]._arr1[1]._object1.setPosition(scene->_arrunkObj1337[1]._arr1[1]._field36, 0);
+ scene->_arrunkObj1337[1]._arr1[1]._object1.setStrip(1);
+ scene->_arrunkObj1337[1]._arr1[1]._object1.setFrame(4);
+ scene->_arrunkObj1337[1]._arr1[1]._object1.fixPriority(170);
+
+ scene->_arrunkObj1337[1]._arr1[2]._object1.postInit();
+ scene->_arrunkObj1337[1]._arr1[2]._object1.setVisage(1332);
+ scene->_arrunkObj1337[1]._arr1[2]._object1.setPosition(scene->_arrunkObj1337[1]._arr1[2]._field36, 0);
+ scene->_arrunkObj1337[1]._arr1[2]._object1.setStrip(1);
+ scene->_arrunkObj1337[1]._arr1[2]._object1.setFrame(4);
+ scene->_arrunkObj1337[1]._arr1[2]._object1.fixPriority(170);
+
+ scene->_arrunkObj1337[2]._arr1[0]._field34 = 30;
+ scene->_arrunkObj1337[2]._arr1[0]._object1.postInit();
+ scene->_arrunkObj1337[2]._arr1[0]._object1.setVisage(1332);
+ scene->_arrunkObj1337[2]._arr1[0]._object1.setPosition(scene->_arrunkObj1337[2]._arr1[0]._field36, 0);
+ scene->_arrunkObj1337[2]._arr1[0]._object1.setStrip(1);
+ scene->_arrunkObj1337[2]._arr1[0]._object1.setFrame(2);
+ scene->_arrunkObj1337[2]._arr1[0]._object1.fixPriority(170);
+ scene->setAnimationInfo(&scene->_arrunkObj1337[2]._arr1[0]);
+
+ scene->_arrunkObj1337[2]._arr1[1]._field34 = 16;
+ scene->_arrunkObj1337[2]._arr1[1]._object1.postInit();
+ scene->_arrunkObj1337[2]._arr1[1]._object1.setVisage(1332);
+ scene->_arrunkObj1337[2]._arr1[1]._object1.setPosition(scene->_arrunkObj1337[2]._arr1[1]._field36, 0);
+ scene->_arrunkObj1337[2]._arr1[1]._object1.setStrip(1);
+ scene->_arrunkObj1337[2]._arr1[1]._object1.setFrame(2);
+ scene->_arrunkObj1337[2]._arr1[1]._object1.fixPriority(170);
+ scene->setAnimationInfo(&scene->_arrunkObj1337[2]._arr1[1]);
+
+ scene->_arrunkObj1337[2]._arr1[2]._field34 = 1;
+ scene->_arrunkObj1337[2]._arr1[2]._object1.postInit();
+ scene->_arrunkObj1337[2]._arr1[2]._object1.setVisage(1332);
+ scene->_arrunkObj1337[2]._arr1[2]._object1.setPosition(scene->_arrunkObj1337[2]._arr1[2]._field36, 0);
+ scene->_arrunkObj1337[2]._arr1[2]._object1.setStrip(1);
+ scene->_arrunkObj1337[2]._arr1[2]._object1.setFrame(2);
+ scene->_arrunkObj1337[2]._arr1[2]._object1.fixPriority(170);
+ scene->setAnimationInfo(&scene->_arrunkObj1337[2]._arr1[2]);
+
+ scene->_arrunkObj1337[3]._arr1[0]._object1.postInit();
+ scene->_arrunkObj1337[3]._arr1[0]._object1.setVisage(1332);
+ scene->_arrunkObj1337[3]._arr1[0]._object1.setPosition(scene->_arrunkObj1337[3]._arr1[0]._field36, 0);
+ scene->_arrunkObj1337[3]._arr1[0]._object1.setStrip(1);
+ scene->_arrunkObj1337[3]._arr1[0]._object1.setFrame(3);
+ scene->_arrunkObj1337[3]._arr1[0]._object1.fixPriority(170);
+
+ scene->_arrunkObj1337[3]._arr1[1]._object1.postInit();
+ scene->_arrunkObj1337[3]._arr1[1]._object1.setVisage(1332);
+ scene->_arrunkObj1337[3]._arr1[1]._object1.setPosition(scene->_arrunkObj1337[3]._arr1[1]._field36, 0);
+ scene->_arrunkObj1337[3]._arr1[1]._object1.setStrip(1);
+ scene->_arrunkObj1337[3]._arr1[1]._object1.setFrame(3);
+ scene->_arrunkObj1337[3]._arr1[1]._object1.fixPriority(170);
+
+ scene->_arrunkObj1337[3]._arr1[2]._object1.postInit();
+ scene->_arrunkObj1337[3]._arr1[2]._object1.setVisage(1332);
+ scene->_arrunkObj1337[3]._arr1[2]._object1.setPosition(scene->_arrunkObj1337[3]._arr1[2]._field36, 0);
+ scene->_arrunkObj1337[3]._arr1[2]._object1.setStrip(1);
+ scene->_arrunkObj1337[3]._arr1[2]._object1.setFrame(3);
+ scene->_arrunkObj1337[3]._arr1[2]._object1.fixPriority(170);
+
+ scene->_arrunkObj1337[0]._arr1[0]._object1.postInit();
+ scene->_arrunkObj1337[0]._arr1[0]._object1.setVisage(1332);
+ scene->_arrunkObj1337[0]._arr1[0]._object1.setPosition(scene->_arrunkObj1337[0]._arr1[0]._field36, 0);
+ scene->_arrunkObj1337[0]._arr1[0]._object1.setStrip(1);
+ scene->_arrunkObj1337[0]._arr1[0]._object1.setFrame(2);
+ scene->_arrunkObj1337[0]._arr1[0]._object1.fixPriority(170);
+
+ scene->_arrunkObj1337[0]._arr1[1]._object1.postInit();
+ scene->_arrunkObj1337[0]._arr1[1]._object1.setVisage(1332);
+ scene->_arrunkObj1337[0]._arr1[1]._object1.setPosition(scene->_arrunkObj1337[0]._arr1[1]._field36, 0);
+ scene->_arrunkObj1337[0]._arr1[1]._object1.setStrip(1);
+ scene->_arrunkObj1337[0]._arr1[1]._object1.setFrame(2);
+ scene->_arrunkObj1337[0]._arr1[1]._object1.fixPriority(170);
+
+ scene->_arrunkObj1337[0]._arr1[2]._object1.postInit();
+ scene->_arrunkObj1337[0]._arr1[2]._object1.setVisage(1332);
+ scene->_arrunkObj1337[0]._arr1[2]._object1.setPosition(scene->_arrunkObj1337[0]._arr1[2]._field36, 0);
+ scene->_arrunkObj1337[0]._arr1[2]._object1.setStrip(1);
+ scene->_arrunkObj1337[0]._arr1[2]._object1.setFrame(2);
+ scene->_arrunkObj1337[0]._arr1[2]._object1.fixPriority(170);
+
+ R2_GLOBALS._sceneObjects->draw();
+
+ scene->actionDisplay(1331, 10, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ scene->_item2._object1.setPosition(Common::Point(162, 95), 0);
+ scene->_item2._object1.show();
+ scene->_aSound2.play(61);
+
+ Common::Point pt(91, 174);
+ NpcMover *mover = new NpcMover();
+ scene->_item2._object1.addMover(mover, &pt, this);
+ }
+ break;
+ case 2: {
+ scene->_arrunkObj1337[2]._arr1[3]._field34 = 2;
+ scene->_arrunkObj1337[2]._arr1[3]._object1.postInit();
+ scene->_arrunkObj1337[2]._arr1[3]._object1.setVisage(1332);
+ scene->_arrunkObj1337[2]._arr1[3]._object1.setPosition(scene->_arrunkObj1337[2]._arr1[3]._field36, 0);
+ scene->_arrunkObj1337[2]._arr1[3]._object1.setStrip(1);
+ scene->_arrunkObj1337[2]._arr1[3]._object1.setFrame(2);
+ scene->_arrunkObj1337[2]._arr1[3]._object1.fixPriority(170);
+
+ scene->_item2._object1.hide();
+ scene->setAnimationInfo(&scene->_arrunkObj1337[2]._arr1[3]);
+
+ R2_GLOBALS._sceneObjects->draw();
+
+ skipFrames(60);
+ scene->actionDisplay(1331, 11, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ scene->actionDisplay(1331, 12, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+
+ scene->_arrunkObj1337[2]._arr2[1]._field34 = 1;
+ scene->_arrunkObj1337[2]._arr2[1]._object1.postInit();
+ scene->_arrunkObj1337[2]._arr2[1]._object1.setVisage(1332);
+ scene->_arrunkObj1337[2]._arr2[1]._object1.setPosition(scene->_arrunkObj1337[2]._arr2[1]._field36, 0);
+ scene->_arrunkObj1337[2]._arr2[1]._object1.hide();
+
+ scene->_item2._object1.setStrip(scene->_arrunkObj1337[2]._arr1[2]._object1._strip);
+ scene->_item2._object1.setFrame(scene->_arrunkObj1337[2]._arr1[2]._object1._frame);
+ scene->_item2._object1.animate(ANIM_MODE_NONE, NULL);
+
+ scene->_arrunkObj1337[2]._arr1[2]._field34 = 0;
+ scene->_arrunkObj1337[2]._arr1[2]._object1.remove();
+
+ scene->_item2._object1.setPosition(scene->_arrunkObj1337[2]._arr1[2]._field36, 0);
+ scene->_item2._object1.show();
+
+ NpcMover *mover = new NpcMover();
+ scene->_item2._object1.addMover(mover, &scene->_arrunkObj1337[2]._arr2[1]._field36, this);
+ }
+ break;
+ case 3: {
+ scene->_item2._object1.hide();
+ scene->setAnimationInfo(&scene->_arrunkObj1337[2]._arr2[1]);
+ scene->_aSound1.play(59);
+
+ R2_GLOBALS._sceneObjects->draw();
+
+ skipFrames(60);
+ scene->actionDisplay(1331, 13, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+
+ scene->_arrunkObj1337[2]._arr2[1]._field34 = scene->_arrunkObj1337[2]._arr1[3]._field34;
+
+ scene->_item2._object1.setStrip(scene->_arrunkObj1337[2]._arr1[3]._object1._strip);
+ scene->_item2._object1.setFrame(scene->_arrunkObj1337[2]._arr1[3]._object1._frame);
+
+ scene->_arrunkObj1337[2]._arr1[3]._field34 = 0;
+ scene->_arrunkObj1337[2]._arr1[3]._object1.remove();
+
+ scene->_item2._object1.setPosition(scene->_arrunkObj1337[2]._arr1[3]._field36, 0);
+ scene->_item2._object1.show();
+
+ NpcMover *mover = new NpcMover();
+ scene->_item2._object1.addMover(mover, &scene->_arrunkObj1337[2]._arr2[1]._field36, this);
+ }
+ break;
+ case 4: {
+ scene->_item2._object1.hide();
+ scene->setAnimationInfo(&scene->_arrunkObj1337[2]._arr2[1]);
+ scene->_aSound1.play(59);
+
+ scene->_item7._field34 = 1;
+ scene->_item7._object1.hide();
+
+ scene->_item2._object1.setStrip(5);
+ scene->_item2._object1.setFrame(1);
+ scene->_item2._object1.animate(ANIM_MODE_2, NULL);
+ scene->_item2._object1.setPosition(scene->_arrunkObj1337[2]._arr2[1]._field36, 0);
+ scene->_item2._object1.show();
+
+ NpcMover *mover = new NpcMover();
+ scene->_item2._object1.addMover(mover, &scene->_item7._field36, this);
+ }
+ break;
+ case 5: {
+ scene->_item2._object1.hide();
+
+ scene->_item7._object1.postInit();
+ scene->_item7._object1.setVisage(1332);
+ scene->_item7._object1.setPosition(scene->_item7._field36, 0);
+ scene->setAnimationInfo(&scene->_item7);
+ scene->_aSound2.play(61);
+
+ R2_GLOBALS._sceneObjects->draw();
+
+ skipFrames(60);
+ scene->actionDisplay(1331, 14, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+
+ scene->_arrunkObj1337[2]._arr3[0]._object1.postInit();
+ scene->_arrunkObj1337[2]._arr3[0]._object1.setVisage(1332);
+ scene->_arrunkObj1337[2]._arr3[0]._object1.setPosition(scene->_arrunkObj1337[2]._arr3[0]._field36, 0);
+ scene->_arrunkObj1337[2]._arr3[0]._object1.hide();
+
+ scene->_arrunkObj1337[3]._arr1[2]._field34 = 0;
+ scene->_arrunkObj1337[3]._arr1[2].remove();
+
+ scene->_item2._object1.setPosition(scene->_arrunkObj1337[3]._arr1[2]._field36, 0);
+ scene->_item2._object1.show();
+
+ NpcMover *mover = new NpcMover();
+ scene->_item2._object1.addMover(mover, &scene->_arrunkObj1337[2]._arr3[0]._field36, this);
+ }
+ break;
+ case 6: {
+ scene->_item2._object1.hide();
+ scene->_arrunkObj1337[2]._arr3[0]._field34 = 21;
+ scene->setAnimationInfo(&scene->_arrunkObj1337[2]._arr3[0]);
+ scene->_aSound1.play(57);
+
+ R2_GLOBALS._sceneObjects->draw();
+
+ skipFrames(60);
+ scene->actionDisplay(1331, 15, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+
+ int tmpVal = 15;
+ int i = -1;
+
+ for (i = 0; i <= 7; i++) {
+ tmpVal += 29;
+
+ scene->_arrObject1[i].postInit();
+ scene->_arrObject1[i].setVisage(1332);
+ scene->_arrObject1[i].setPosition(Common::Point(tmpVal, 90), 0);
+ scene->_arrObject1[i].setStrip(3);
+ scene->_arrObject1[i].fixPriority(190);
+
+ scene->_arrObject2[i].postInit();
+ scene->_arrObject2[i].setVisage(1332);
+ scene->_arrObject2[i].setPosition(Common::Point(tmpVal, 90), 0);
+ scene->_arrObject2[i].setStrip(7);
+ scene->_arrObject2[i].setFrame(1);
+ scene->_arrObject2[i].fixPriority(180);
+ }
+
+ scene->_arrObject1[0].setFrame(1);
+ scene->_arrObject1[1].setFrame(3);
+ scene->_arrObject1[2].setFrame(6);
+ scene->_arrObject1[3].setFrame(8);
+ scene->_arrObject1[4].setFrame(9);
+ scene->_arrObject1[5].setFrame(10);
+ scene->_arrObject1[6].setFrame(11);
+ scene->_arrObject1[7].setFrame(12);
+
+ R2_GLOBALS._sceneObjects->draw();
+
+ skipFrames(240);
+
+ scene->_arrObject1[0].remove();
+ scene->_arrObject1[1].remove();
+ scene->_arrObject1[2].remove();
+ scene->_arrObject1[3].remove();
+ scene->_arrObject1[4].remove();
+ scene->_arrObject1[5].remove();
+ scene->_arrObject1[6].remove();
+ scene->_arrObject1[7].remove();
+
+ scene->_arrObject2[0].remove();
+ scene->_arrObject2[1].remove();
+ scene->_arrObject2[2].remove();
+ scene->_arrObject2[3].remove();
+ scene->_arrObject2[4].remove();
+ scene->_arrObject2[5].remove();
+ scene->_arrObject2[6].remove();
+ scene->_arrObject2[7].remove();
+
+ scene->_item7._field34 = scene->_arrunkObj1337[2]._arr3[0]._field34;
+
+ scene->_arrunkObj1337[2]._arr3[0]._field34 = 0;
+ scene->_arrunkObj1337[2]._arr3[0]._object1.remove();
+
+ scene->_item2._object1.setPosition(scene->_arrunkObj1337[2]._arr3[0]._field36, 0);
+ scene->_item2._object1.show();
+
+ NpcMover *mover = new NpcMover();
+ scene->_item2._object1.addMover(mover, &scene->_item7._field36, this);
+ }
+ break;
+ case 7: {
+ scene->_item2._object1.hide();
+ scene->setAnimationInfo(&scene->_item7);
+ scene->_aSound2.play(61);
+
+ R2_GLOBALS._sceneObjects->draw();
+
+ scene->_arrunkObj1337[2]._arr3[0]._object1.postInit();
+ scene->_arrunkObj1337[2]._arr3[0]._object1.setVisage(1332);
+ scene->_arrunkObj1337[2]._arr3[0]._object1.setPosition(scene->_arrunkObj1337[2]._arr3[0]._field36, 0);
+ scene->_arrunkObj1337[2]._arr3[0]._object1.hide();
+
+ scene->_arrunkObj1337[3]._arr1[1]._field34 = 0;
+ scene->_arrunkObj1337[3]._arr1[1].remove();
+
+ scene->_item2._object1.setPosition(scene->_arrunkObj1337[3]._arr1[1]._field36, 0);
+ scene->_item2._object1.show();
+
+ NpcMover *mover = new NpcMover();
+ scene->_item2._object1.addMover(mover, &scene->_arrunkObj1337[2]._arr3[0]._field36, this);
+ }
+ break;
+ case 8: {
+ scene->_item2._object1.hide();
+ scene->_arrunkObj1337[2]._arr3[0]._field34 = 14;
+ scene->setAnimationInfo(&scene->_arrunkObj1337[2]._arr3[0]);
+ scene->_aSound1.play(57);
+
+ R2_GLOBALS._sceneObjects->draw();
+
+ scene->actionDisplay(1331, 16, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ int tmpVal = 72;
+ int i = -1;
+
+ for (i = 0; i <= 3; i++) {
+ tmpVal += 29;
+ scene->_arrObject1[i].postInit();
+ scene->_arrObject1[i].setVisage(1332);
+ scene->_arrObject1[i].setPosition(Common::Point(tmpVal, 71), 0);
+ scene->_arrObject1[i].setStrip(3);
+ scene->_arrObject1[i].fixPriority(190);
+
+ scene->_arrObject2[i].postInit();
+ scene->_arrObject2[i].setVisage(1332);
+ scene->_arrObject2[i].setPosition(Common::Point(tmpVal, 71), 0);
+ scene->_arrObject2[i].setStrip(7);
+ scene->_arrObject2[i].setFrame(1);
+ scene->_arrObject2[i].fixPriority(180);
+ }
+
+ scene->_arrObject1[0].setFrame(2);
+ scene->_arrObject1[1].setFrame(5);
+ scene->_arrObject1[2].setFrame(7);
+ scene->_arrObject1[3].setFrame(15);
+
+ R2_GLOBALS._sceneObjects->draw();
+
+ skipFrames(240);
+ scene->actionDisplay(1331, 17, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+
+ tmpVal = 72;
+ for (i = 4; i <= 7; i++) {
+ tmpVal += 29;
+
+ scene->_arrObject1[i].postInit();
+ scene->_arrObject1[i].setVisage(1332);
+ scene->_arrObject1[i].setPosition(Common::Point(tmpVal, 100), 0);
+ scene->_arrObject1[i].setStrip(4);
+ scene->_arrObject1[i].fixPriority(190);
+
+ scene->_arrObject2[i].postInit();
+ scene->_arrObject2[i].setVisage(1332);
+ scene->_arrObject2[i].setPosition(Common::Point(tmpVal, 100), 0);
+ scene->_arrObject2[i].setStrip(7);
+ scene->_arrObject2[i].setFrame(1);
+ scene->_arrObject2[i].fixPriority(180);
+ }
+
+ scene->_arrObject1[4].setFrame(1);
+ scene->_arrObject1[5].setFrame(5);
+ scene->_arrObject1[6].setFrame(7);
+ scene->_arrObject1[7].setFrame(3);
+
+ R2_GLOBALS._sceneObjects->draw();
+
+ skipFrames(240);
+
+ scene->_arrObject1[0].remove();
+ scene->_arrObject1[1].remove();
+ scene->_arrObject1[2].remove();
+ scene->_arrObject1[3].remove();
+ scene->_arrObject1[4].remove();
+ scene->_arrObject1[5].remove();
+ scene->_arrObject1[6].remove();
+ scene->_arrObject1[7].remove();
+
+ scene->_arrObject2[0].remove();
+ scene->_arrObject2[1].remove();
+ scene->_arrObject2[2].remove();
+ scene->_arrObject2[3].remove();
+ scene->_arrObject2[4].remove();
+ scene->_arrObject2[5].remove();
+ scene->_arrObject2[6].remove();
+ scene->_arrObject2[7].remove();
+
+ scene->_item7._field34 = scene->_arrunkObj1337[2]._arr1[0]._field34;
+
+ scene->_item2._object1.setStrip(scene->_arrunkObj1337[2]._arr1[0]._object1._strip);
+ scene->_item2._object1.setFrame(scene->_arrunkObj1337[2]._arr1[0]._object1._frame);
+ scene->_item2._object1.animate(ANIM_MODE_NONE, NULL);
+
+ scene->_arrunkObj1337[2]._arr1[0]._field34 = 0;
+ scene->_arrunkObj1337[2]._arr1[0]._object1.remove();
+
+ scene->_item2._object1.setPosition(scene->_arrunkObj1337[2]._arr1[0]._field36, 0);
+ scene->_item2._object1.show();
+
+ NpcMover *mover = new NpcMover();
+ scene->_item2._object1.addMover(mover, &scene->_arrunkObj1337[2]._arr3[0]._field36, this);
+ }
+ break;
+ case 9: {
+ scene->_aSound1.play(58);
+ scene->_arrunkObj1337[2]._arr3[0]._field34 = 0;
+ scene->_arrunkObj1337[2]._arr3[0].remove();
+ scene->_item2._object1.setStrip(5);
+ scene->_item2._object1.setFrame(1);
+ scene->_item2._object1.animate(ANIM_MODE_2, NULL);
+ scene->_item2._object1.setPosition(scene->_arrunkObj1337[2]._arr3[0]._field36, 0);
+ scene->_item2._object1.show();
+
+ NpcMover *mover = new NpcMover();
+ scene->_item2._object1.addMover(mover, &scene->_item7._field36, this);
+ }
+ break;
+ case 10: {
+ scene->_item2._object1.hide();
+ scene->setAnimationInfo(&scene->_item7);
+ scene->_aSound2.play(61);
+
+ R2_GLOBALS._sceneObjects->draw();
+ scene->actionDisplay(1331, 18, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+
+ scene->_arrObject1[0].postInit();
+ scene->_arrObject1[0].setVisage(1332);
+ scene->_arrObject1[0].setPosition(Common::Point(131, 71), 0);
+ scene->_arrObject1[0].fixPriority(190);
+ scene->_arrObject1[0].setStrip(3);
+ scene->_arrObject1[0].setFrame(4);
+
+ scene->_arrObject2[0].postInit();
+ scene->_arrObject2[0].setVisage(1332);
+ scene->_arrObject2[0].setPosition(Common::Point(131, 71), 0);
+ scene->_arrObject2[0].setStrip(7);
+ scene->_arrObject2[0].setFrame(1);
+ scene->_arrObject2[0].fixPriority(180);
+
+ scene->_arrObject1[1].postInit();
+ scene->_arrObject1[1].setVisage(1332);
+ scene->_arrObject1[1].setPosition(Common::Point(160, 71), 0);
+ scene->_arrObject1[1].fixPriority(190);
+ scene->_arrObject1[1].setStrip(3);
+ scene->_arrObject1[1].setFrame(16);
+
+ scene->_arrObject2[1].postInit();
+ scene->_arrObject2[1].setVisage(1332);
+ scene->_arrObject2[1].setPosition(Common::Point(160, 71), 0);
+ scene->_arrObject2[1].setStrip(7);
+ scene->_arrObject2[1].setFrame(1);
+ scene->_arrObject2[1].fixPriority(180);
+
+ scene->_arrObject1[2].postInit();
+ scene->_arrObject1[2].setVisage(1332);
+ scene->_arrObject1[2].setPosition(Common::Point(131, 100), 0);
+ scene->_arrObject1[2].fixPriority(190);
+ scene->_arrObject1[2].setStrip(4);
+ scene->_arrObject1[2].setFrame(4);
+
+ scene->_arrObject2[2].postInit();
+ scene->_arrObject2[2].setVisage(1332);
+ scene->_arrObject2[2].setPosition(Common::Point(131, 100), 0);
+ scene->_arrObject2[2].setStrip(7);
+ scene->_arrObject2[2].setFrame(1);
+ scene->_arrObject2[2].fixPriority(180);
+
+ scene->_arrObject1[3].postInit();
+ scene->_arrObject1[3].setVisage(1332);
+ scene->_arrObject1[3].setPosition(Common::Point(160, 100), 0);
+ scene->_arrObject1[3].fixPriority(190);
+ scene->_arrObject1[3].setStrip(4);
+ scene->_arrObject1[3].setFrame(2);
+
+ scene->_arrObject2[3].postInit();
+ scene->_arrObject2[3].setVisage(1332);
+ scene->_arrObject2[3].setPosition(Common::Point(160, 100), 0);
+ scene->_arrObject2[3].setStrip(7);
+ scene->_arrObject2[3].setFrame(1);
+ scene->_arrObject2[3].fixPriority(180);
+
+ R2_GLOBALS._sceneObjects->draw();
+
+ skipFrames(240);
+
+ scene->_arrObject1[0].remove();
+ scene->_arrObject1[1].remove();
+ scene->_arrObject1[2].remove();
+ scene->_arrObject1[3].remove();
+
+ scene->_arrObject2[0].remove();
+ scene->_arrObject2[1].remove();
+ scene->_arrObject2[2].remove();
+ scene->_arrObject2[3].remove();
+
+ scene->_object1.setFrame(1);
+ scene->_object1.show();
+ scene->_object1.animate(ANIM_MODE_2, NULL);
+
+ R2_GLOBALS._sceneObjects->draw();
+
+ scene->actionDisplay(1331, 19, 159, 10, 1, 220, 0, 7, 0, 154, 154);
+
+ scene->_object1.hide();
+
+ scene->actionDisplay(1331, 20, 159, 10, 1, 220, 0, 7, 0, 154, 154);
+ scene->actionDisplay(1331, 21, 159, 10, 1, 220, 0, 7, 0, 154, 154);
+
+ scene->_item7._field34 = scene->_arrunkObj1337[2]._arr1[1]._field34;
+
+ scene->_item2._object1.setStrip(scene->_arrunkObj1337[2]._arr1[1]._object1._strip);
+ scene->_item2._object1.setFrame(scene->_arrunkObj1337[2]._arr1[1]._object1._frame);
+ scene->_item2._object1.animate(ANIM_MODE_NONE, NULL);
+
+ scene->_arrunkObj1337[2]._arr1[1]._field34 = 0;
+ scene->_arrunkObj1337[2]._arr1[1]._object1.remove();
+
+ scene->_item2._object1.setPosition(scene->_arrunkObj1337[2]._arr1[1]._field36, 0);
+ scene->_item2._object1.show();
+
+ NpcMover *mover = new NpcMover();
+ scene->_item2._object1.addMover(mover, &scene->_item7._field36, this);
+ }
+ break;
+ case 11: {
+ scene->_item2._object1.hide();
+ scene->setAnimationInfo(&scene->_item7);
+ scene->_aSound2.play(61);
+ scene->_item2._object1.setStrip(5);
+ scene->_item2._object1.setFrame(1);
+ scene->_item2._object1.animate(ANIM_MODE_2, NULL);
+
+ R2_GLOBALS._sceneObjects->draw();
+
+ scene->actionDisplay(1331, 22, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+
+ int i = -1;
+ for (i = 0; i <= 3; i ++) {
+ scene->_arrunkObj1337[3]._arr1[i]._field34 = 0;
+ scene->_arrunkObj1337[3]._arr1[i]._object1.remove();
+
+ scene->_arrunkObj1337[2]._arr1[i]._field34 = 0;
+ scene->_arrunkObj1337[2]._arr1[i]._object1.remove();
+
+ scene->_arrunkObj1337[0]._arr1[i]._field34 = 0;
+ scene->_arrunkObj1337[0]._arr1[i]._object1.remove();
+
+ scene->_arrunkObj1337[1]._arr1[i]._field34 = 0;
+ scene->_arrunkObj1337[1]._arr1[i]._object1.remove();
+ }
+
+ for (i = 0; i <= 7; i++) {
+ scene->_arrunkObj1337[3]._arr2[i]._field34 = 0;
+ scene->_arrunkObj1337[3]._arr2[i]._object1.remove();
+
+ scene->_arrunkObj1337[2]._arr2[i]._field34 = 0;
+ scene->_arrunkObj1337[2]._arr2[i]._object1.remove();
+
+ scene->_arrunkObj1337[0]._arr2[i]._field34 = 0;
+ scene->_arrunkObj1337[0]._arr2[i]._object1.remove();
+
+ scene->_arrunkObj1337[1]._arr2[i]._field34 = 0;
+ scene->_arrunkObj1337[1]._arr2[i]._object1.remove();
+ }
+
+ scene->_arrunkObj1337[2]._arr3[0]._field34 = 0;
+ scene->_arrunkObj1337[2]._arr3[0]._object1.remove();
+
+ scene->_item7._field34 = 0;
+ scene->_item7._object1.remove();
+
+ scene->_background2.remove();
+ }
+ // No break on purpose
+ case 0:
+ R2_GLOBALS._sceneObjects->draw();
+ signal();
+ break;
+ case 12:
+ scene->suggestInstructions();
+ remove();
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene1337::Action2::signal() {
+ Scene1337 *scene = (Scene1337 *)R2_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0:
+ scene->_item3._object1.postInit();
+ scene->_item3._object1.setVisage(1332);
+ scene->_item3._object1.setStrip(8);
+ scene->_item3._object1.setFrame(1);
+ scene->_item3._object1.fixPriority(300);
+ scene->_item3._object1.setPosition(Common::Point(156, 108));
+
+ scene->_item7._object1.remove();
+ scene->_item7._field34 = 0;
+
+ scene->_aSound1.play(60);
+ scene->_item3._object1.animate(ANIM_MODE_5, this);
+ break;
+ case 1:
+ scene->_item3._object1.setFrame(1);
+
+ scene->_aSound1.play(60);
+ scene->_item3._object1.animate(ANIM_MODE_5, this);
+ break;
+ case 2: {
+ Common::Point pt(156, 108);
+ NpcMover *mover = new NpcMover();
+ scene->_item3._object1.addMover(mover, &pt, this);
+ }
+ break;
+ case 3:
+ scene->_item3._object1.remove();
+ scene->_background2.setup2(1332, 5, 1, 162, 95, 110, 1);
+ scene->_field423C = 1;
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene1337::Action3::signal() {
+ Scene1337 *scene = (Scene1337 *)R2_GLOBALS._sceneManager._scene;
+
+ scene->_item2._object1.setPosition(Common::Point(162, 95), 0);
+
+ switch (_actionIndex++) {
+ case 0: {
+ scene->_item2._object1._moveDiff = Common::Point(30, 30);
+ scene->_item2._object1.setVisage(1332);
+ scene->_item2._object1.setStrip(5);
+ scene->_item2._object1.setFrame(1);
+ scene->_item2._object1.fixPriority(400);
+ scene->_item2._object1.animate(ANIM_MODE_2, NULL);
+ scene->_aSound2.play(61);
+
+ Common::Point pt(283, 146);
+ NpcMover *mover = new NpcMover();
+ scene->_item2._object1.addMover(mover, &pt, this);
+
+ scene->_item2._object1.show();
+ scene->_arrunkObj1337[1]._arr1[0]._field34 = scene->_field3E28[scene->_field3E24];
+ }
+ break;
+ case 1: {
+ scene->_arrunkObj1337[1]._arr1[0]._object1.postInit();
+ scene->_arrunkObj1337[1]._arr1[0]._object1._moveDiff = Common::Point(30, 30);
+ scene->_arrunkObj1337[1]._arr1[0]._object1.setVisage(1332);
+ scene->_arrunkObj1337[1]._arr1[0]._object1.setPosition(scene->_arrunkObj1337[1]._arr1[0]._field36, 0);
+ scene->_arrunkObj1337[1]._arr1[0]._object1.setStrip(1);
+ scene->_arrunkObj1337[1]._arr1[0]._object1.setFrame(4);
+ scene->_arrunkObj1337[1]._arr1[0]._object1.fixPriority(170);
+ scene->_aSound2.play(61);
+
+ Common::Point pt(10, 174);
+ NpcMover *mover = new NpcMover();
+ scene->_item2._object1.addMover(mover, &pt, this);
+
+ scene->_arrunkObj1337[2]._arr1[0]._field34 = scene->_field3E28[scene->_field3E24];
+ }
+ break;
+ case 2: {
+ scene->_arrunkObj1337[2]._arr1[0]._object1.postInit();
+ scene->_arrunkObj1337[2]._arr1[0]._object1._moveDiff = Common::Point(30, 30);
+ scene->_arrunkObj1337[2]._arr1[0]._object1.setVisage(1332);
+ scene->_arrunkObj1337[2]._arr1[0]._object1.setPosition(scene->_arrunkObj1337[2]._arr1[0]._field36, 0);
+ scene->_arrunkObj1337[2]._arr1[0]._object1.fixPriority(170);
+ if (scene->_arrunkObj1337[2]._arr1[0]._field34 > 9) {
+ if (scene->_arrunkObj1337[2]._arr1[0]._field34 > 25) {
+ scene->_arrunkObj1337[2]._arr1[0]._object1.setStrip(4);
+ scene->_arrunkObj1337[2]._arr1[0]._object1.setFrame(scene->_arrunkObj1337[2]._arr1[0]._field34 - 25);
+ } else {
+ scene->_arrunkObj1337[2]._arr1[0]._object1.setStrip(3);
+ scene->_arrunkObj1337[2]._arr1[0]._object1.setFrame(scene->_arrunkObj1337[2]._arr1[0]._field34 - 9);
+ }
+ } else {
+ scene->_arrunkObj1337[2]._arr1[0]._object1.setStrip(2);
+ scene->_arrunkObj1337[2]._arr1[0]._object1.setFrame(scene->_arrunkObj1337[2]._arr1[0]._field34);
+ }
+ scene->_aSound2.play(61);
+
+ Common::Point pt(14, 14);
+ NpcMover *mover = new NpcMover();
+ scene->_item2._object1.addMover(mover, &pt, this);
+
+ scene->_arrunkObj1337[3]._arr1[0]._field34 = scene->_field3E28[scene->_field3E24];
+ }
+ break;
+ case 3: {
+ scene->_arrunkObj1337[3]._arr1[0]._object1.postInit();
+ scene->_arrunkObj1337[3]._arr1[0]._object1._moveDiff = Common::Point(30, 30);
+ scene->_arrunkObj1337[3]._arr1[0]._object1.setVisage(1332);
+ scene->_arrunkObj1337[3]._arr1[0]._object1.setPosition(scene->_arrunkObj1337[3]._arr1[0]._field36, 0);
+ scene->_arrunkObj1337[3]._arr1[0]._object1.setStrip(1);
+ scene->_arrunkObj1337[3]._arr1[0]._object1.setFrame(3);
+ scene->_arrunkObj1337[3]._arr1[0]._object1.fixPriority(170);
+ scene->_aSound2.play(61);
+
+ Common::Point pt(280, 5);
+ NpcMover *mover = new NpcMover();
+ scene->_item2._object1.addMover(mover, &pt, this);
+
+ scene->_arrunkObj1337[0]._arr1[0]._field34 = scene->_field3E28[scene->_field3E24];
+ }
+ break;
+ case 4: {
+ scene->_arrunkObj1337[0]._arr1[0]._object1.postInit();
+ scene->_arrunkObj1337[0]._arr1[0]._object1._moveDiff = Common::Point(30,30);
+ scene->_arrunkObj1337[0]._arr1[0]._object1.setVisage(1332);
+ scene->_arrunkObj1337[0]._arr1[0]._object1.setPosition(scene->_arrunkObj1337[0]._arr1[0]._field36, 0);
+ scene->_arrunkObj1337[0]._arr1[0]._object1.setStrip(5);
+ scene->_arrunkObj1337[0]._arr1[0]._object1.setFrame(1);
+ scene->_arrunkObj1337[0]._arr1[0]._object1.fixPriority(170);
+ scene->_aSound2.play(61);
+
+ Common::Point pt(283, 124);
+ NpcMover *mover = new NpcMover();
+ scene->_item2._object1.addMover(mover, &pt, this);
+
+ scene->_arrunkObj1337[1]._arr1[1]._field34 = scene->_field3E28[scene->_field3E24];
+ }
+ break;
+ case 5: {
+ scene->_arrunkObj1337[1]._arr1[1]._object1.postInit();
+ scene->_arrunkObj1337[1]._arr1[1]._object1._moveDiff = Common::Point(30, 30);
+ scene->_arrunkObj1337[1]._arr1[1]._object1.setVisage(1332);
+ scene->_arrunkObj1337[1]._arr1[1]._object1.setPosition(scene->_arrunkObj1337[1]._arr1[1]._field36, 0);
+ scene->_arrunkObj1337[1]._arr1[1]._object1.setStrip(1);
+ scene->_arrunkObj1337[1]._arr1[1]._object1.setFrame(4);
+ scene->_arrunkObj1337[1]._arr1[1]._object1.fixPriority(170);
+ scene->_aSound2.play(61);
+
+ Common::Point pt(37, 174);
+ NpcMover *mover = new NpcMover();
+ scene->_item2._object1.addMover(mover, &pt, this);
+
+ scene->_arrunkObj1337[2]._arr1[1]._field34 = scene->_field3E28[scene->_field3E24];
+ }
+ break;
+ case 6: {
+ scene->_arrunkObj1337[2]._arr1[1]._object1.postInit();
+ scene->_arrunkObj1337[2]._arr1[1]._object1._moveDiff = Common::Point(30, 30);
+ scene->_arrunkObj1337[2]._arr1[1]._object1.setVisage(1332);
+ scene->_arrunkObj1337[2]._arr1[1]._object1.setPosition(scene->_arrunkObj1337[2]._arr1[1]._field36, 0);
+ scene->_arrunkObj1337[2]._arr1[1]._object1.fixPriority(170);
+
+ if (scene->_arrunkObj1337[2]._arr1[1]._field34 > 9) {
+ if (scene->_arrunkObj1337[2]._arr1[1]._field34 > 25) {
+ scene->_arrunkObj1337[2]._arr1[1]._object1.setStrip(4);
+ scene->_arrunkObj1337[2]._arr1[1]._object1.setFrame(scene->_arrunkObj1337[2]._arr1[1]._field34 - 25);
+ } else {
+ scene->_arrunkObj1337[2]._arr1[1]._object1.setStrip(3);
+ scene->_arrunkObj1337[2]._arr1[1]._object1.setFrame(scene->_arrunkObj1337[2]._arr1[1]._field34 - 9);
+ }
+ } else {
+ scene->_arrunkObj1337[2]._arr1[1]._object1.setStrip(2);
+ scene->_arrunkObj1337[2]._arr1[1]._object1.setFrame(scene->_arrunkObj1337[2]._arr1[1]._field34);
+ }
+
+ scene->_aSound2.play(61);
+
+ Common::Point pt(14, 36);
+ NpcMover *mover = new NpcMover();
+ scene->_item2._object1.addMover(mover, &pt, this);
+
+ scene->_arrunkObj1337[3]._arr1[1]._field34 = scene->_field3E28[scene->_field3E24];
+ }
+ break;
+ case 7: {
+ scene->_arrunkObj1337[3]._arr1[1]._object1.postInit();
+ scene->_arrunkObj1337[3]._arr1[1]._object1._moveDiff = Common::Point(30, 30);
+ scene->_arrunkObj1337[3]._arr1[1]._object1.setVisage(1332);
+ scene->_arrunkObj1337[3]._arr1[1]._object1.setPosition(scene->_arrunkObj1337[3]._arr1[1]._field36);
+ scene->_arrunkObj1337[3]._arr1[1]._object1.setStrip(1);
+ scene->_arrunkObj1337[3]._arr1[1]._object1.setFrame(3);
+ scene->_arrunkObj1337[3]._arr1[1]._object1.fixPriority(170);
+ scene->_aSound2.play(61);
+
+ Common::Point pt(253, 5);
+ NpcMover *mover = new NpcMover();
+ scene->_item2._object1.addMover(mover, &pt, this);
+
+ scene->_arrunkObj1337[0]._arr1[1]._field34 = scene->_field3E28[scene->_field3E24];
+ }
+ break;
+ case 8: {
+ scene->_arrunkObj1337[0]._arr1[1]._object1.postInit();
+ scene->_arrunkObj1337[0]._arr1[1]._object1._moveDiff = Common::Point(30, 30);
+ scene->_arrunkObj1337[0]._arr1[1]._object1.setVisage(1332);
+ scene->_arrunkObj1337[0]._arr1[1]._object1.setPosition(scene->_arrunkObj1337[0]._arr1[1]._field36, 0);
+ scene->_arrunkObj1337[0]._arr1[1]._object1.setStrip(5);
+ scene->_arrunkObj1337[0]._arr1[1]._object1.setFrame(1);
+ scene->_arrunkObj1337[0]._arr1[1]._object1.fixPriority(170);
+ scene->_aSound2.play(61);
+
+ Common::Point pt(283, 102);
+ NpcMover *mover = new NpcMover();
+ scene->_item2._object1.addMover(mover, &pt, this);
+
+ scene->_arrunkObj1337[1]._arr1[2]._field34 = scene->_field3E28[scene->_field3E24];
+ }
+ break;
+ case 9: {
+ scene->_arrunkObj1337[1]._arr1[2]._object1.postInit();
+ scene->_arrunkObj1337[1]._arr1[2]._object1._moveDiff = Common::Point(30, 30);
+ scene->_arrunkObj1337[1]._arr1[2]._object1.setVisage(1332);
+ scene->_arrunkObj1337[1]._arr1[2]._object1.setPosition(scene->_arrunkObj1337[1]._arr1[2]._field36, 0);
+ scene->_arrunkObj1337[1]._arr1[2]._object1.setStrip(1);
+ scene->_arrunkObj1337[1]._arr1[2]._object1.setFrame(4);
+ scene->_arrunkObj1337[1]._arr1[2]._object1.fixPriority(170);
+ scene->_aSound2.play(61);
+
+ Common::Point pt(64, 174);
+ NpcMover *mover = new NpcMover();
+ scene->_item2._object1.addMover(mover, &pt, this);
+
+ scene->_arrunkObj1337[2]._arr1[2]._field34 = scene->_field3E28[scene->_field3E24];
+ }
+ break;
+ case 10: {
+ scene->_arrunkObj1337[2]._arr1[2]._object1.postInit();
+ scene->_arrunkObj1337[2]._arr1[2]._object1._moveDiff = Common::Point(30, 30);
+ scene->_arrunkObj1337[2]._arr1[2]._object1.setVisage(1332);
+ scene->_arrunkObj1337[2]._arr1[2]._object1.setPosition(scene->_arrunkObj1337[2]._arr1[2]._field36, 0);
+ scene->_arrunkObj1337[2]._arr1[2]._object1.fixPriority(170);
+
+ if (scene->_arrunkObj1337[2]._arr1[2]._field34 > 9) {
+ if (scene->_arrunkObj1337[2]._arr1[2]._field34 > 25) {
+ scene->_arrunkObj1337[2]._arr1[2]._object1.setStrip(4);
+ scene->_arrunkObj1337[2]._arr1[2]._object1.setFrame(scene->_arrunkObj1337[2]._arr1[2]._field34 - 25);
+ } else {
+ scene->_arrunkObj1337[2]._arr1[2]._object1.setStrip(3);
+ scene->_arrunkObj1337[2]._arr1[2]._object1.setFrame(scene->_arrunkObj1337[2]._arr1[2]._field34 - 9);
+ }
+ } else {
+ scene->_arrunkObj1337[2]._arr1[2]._object1.setStrip(2);
+ scene->_arrunkObj1337[2]._arr1[2]._object1.setFrame(scene->_arrunkObj1337[2]._arr1[2]._field34);
+ }
+
+ scene->_aSound2.play(61);
+
+ Common::Point pt(14, 58);
+ NpcMover *mover = new NpcMover();
+ scene->_item2._object1.addMover(mover, &pt, this);
+
+ scene->_arrunkObj1337[3]._arr1[2]._field34 = scene->_field3E28[scene->_field3E24];
+ }
+ break;
+ case 11: {
+ scene->_arrunkObj1337[3]._arr1[2]._object1.postInit();
+ scene->_arrunkObj1337[3]._arr1[2]._object1._moveDiff = Common::Point(30, 30);
+ scene->_arrunkObj1337[3]._arr1[2]._object1.setVisage(1332);
+ scene->_arrunkObj1337[3]._arr1[2]._object1.setPosition(scene->_arrunkObj1337[3]._arr1[2]._field36, 0);
+ scene->_arrunkObj1337[3]._arr1[2]._object1.setStrip(1);
+ scene->_arrunkObj1337[3]._arr1[2]._object1.setFrame(3);
+ scene->_arrunkObj1337[3]._arr1[2]._object1.fixPriority(170);
+ scene->_aSound2.play(61);
+
+ Common::Point pt(226, 5);
+ NpcMover *mover = new NpcMover();
+ scene->_item2._object1.addMover(mover, &pt, this);
+
+ scene->_arrunkObj1337[0]._arr1[2]._field34 = scene->_field3E28[scene->_field3E24];
+ }
+ break;
+ case 12:
+ scene->_arrunkObj1337[0]._arr1[2]._object1.postInit();
+ scene->_arrunkObj1337[0]._arr1[2]._object1._moveDiff = Common::Point(30, 30);
+ scene->_arrunkObj1337[0]._arr1[2]._object1.setVisage(1332);
+ scene->_arrunkObj1337[0]._arr1[2]._object1.setPosition(scene->_arrunkObj1337[0]._arr1[2]._field36, 0);
+ scene->_arrunkObj1337[0]._arr1[2]._object1.setStrip(5);
+ scene->_arrunkObj1337[0]._arr1[2]._object1.setFrame(1);
+ scene->_arrunkObj1337[0]._arr1[2]._object1.fixPriority(170);
+ scene->_arrunkObj1337[0]._arr1[2]._object1.hide();
+ default:
+ break;
+ }
+
+ if (_actionIndex > 12) {
+ scene->_field423E = 0;
+ R2_GLOBALS._sceneObjects->draw();
+ scene->actionDisplay(1330, 0, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ scene->subC20F9();
+ } else if (_actionIndex >= 1) {
+ scene->_field3E28[scene->_field3E24] = 0;
+ scene->_field3E24--;
+ }
+}
+
+void Scene1337::Action4::signal() {
+ Scene1337 *scene = (Scene1337 *)R2_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0:
+ if ((scene->_arrunkObj1337[scene->_field423E]._arr1[0]._field34 == 0) && (scene->subC264B(scene->_arrunkObj1337[scene->_field423E]._arr3[0]._field34))) {
+ if (scene->_field3E24 < 0)
+ scene->subC264B(scene->_arrunkObj1337[scene->_field423E]._arr3[0]._field34);
+ scene->_item2._object1.setPosition(Common::Point(162, 95), 0);
+ scene->_item2._object1.show();
+ scene->_aSound2.play(61);
+
+ NpcMover *mover = new NpcMover();
+ scene->_item2._object1.addMover(mover, &scene->_arrunkObj1337[scene->_field423E]._fieldB94, this);
+
+ scene->_arrunkObj1337[scene->_field423E]._arr1[0]._field34 = scene->_field3E28[scene->_field3E24];
+ scene->_field3E28[scene->_field3E24] = 0;
+ scene->_field3E24--;
+
+ if (scene->_field3E24 < 0)
+ scene->_background2.remove();
+ } else {
+ // Self call, forcing next actionIndex
+ signal();
+ }
+ break;
+ case 1:
+ if ( ( scene->_item2._object1._position.x == scene->_arrunkObj1337[scene->_field423E]._fieldB94.x)
+ && ( scene->_item2._object1._position.y == scene->_arrunkObj1337[scene->_field423E]._fieldB94.y) ) {
+ scene->_arrunkObj1337[scene->_field423E]._arr1[0]._object1.postInit();
+ scene->_arrunkObj1337[scene->_field423E]._arr1[0]._object1._moveDiff = Common::Point(30, 30);
+ scene->_arrunkObj1337[scene->_field423E]._arr1[0]._object1.setVisage(1332);
+ scene->_arrunkObj1337[scene->_field423E]._arr1[0]._object1.setPosition(scene->_arrunkObj1337[scene->_field423E]._arr1[0]._field36, 0);
+ scene->_arrunkObj1337[scene->_field423E]._arr1[0]._object1.setStrip(1);
+ scene->_arrunkObj1337[scene->_field423E]._arr1[0]._object1.setFrame(scene->_arrunkObj1337[scene->_field423E]._fieldBA4);
+ scene->_arrunkObj1337[scene->_field423E]._arr1[0]._object1.fixPriority(170);
+ }
+
+ if ((scene->_field4248 == 1) || (scene->_field423E == 2))
+ scene->setAnimationInfo(&scene->_arrunkObj1337[scene->_field423E]._arr1[0]);
+
+ scene->_item2._object1.hide();
+ if ((scene->_arrunkObj1337[scene->_field423E]._arr1[0]._field34 == 0) && (scene->subC264B(scene->_arrunkObj1337[scene->_field423E]._arr3[0]._field34 == 0))) {
+ if (scene->_field3E24 < 0)
+ scene->shuffleCards();
+ scene->_item2._object1.setPosition(Common::Point(162, 95));
+ scene->_item2._object1.show();
+
+ scene->_aSound2.play(61);
+
+ NpcMover *mover = new NpcMover();
+ scene->_item2._object1.addMover(mover, &scene->_arrunkObj1337[scene->_field423E]._fieldB98, this);
+
+ scene->_arrunkObj1337[scene->_field423E]._arr1[1]._field34 = scene->_field3E28[scene->_field3E24];
+ scene->_field3E28[scene->_field3E24] = 0;
+ scene->_field3E24--;
+ if (scene->_field3E24 < 0)
+ scene->_background2.remove();
+ } else
+ signal();
+ break;
+ case 2:
+ if ( ( scene->_item2._object1._position.x == scene->_arrunkObj1337[scene->_field423E]._fieldB98.x)
+ && ( scene->_item2._object1._position.y == scene->_arrunkObj1337[scene->_field423E]._fieldB98.y) ) {
+ scene->_arrunkObj1337[scene->_field423E]._arr1[1]._object1.postInit();
+ scene->_arrunkObj1337[scene->_field423E]._arr1[1]._object1._moveDiff = Common::Point(30, 30);
+ scene->_arrunkObj1337[scene->_field423E]._arr1[1]._object1.setVisage(1332);
+ scene->_arrunkObj1337[scene->_field423E]._arr1[1]._object1.setPosition(scene->_arrunkObj1337[scene->_field423E]._arr1[1]._field36, 0);
+ scene->_arrunkObj1337[scene->_field423E]._arr1[1]._object1.setStrip(1);
+ scene->_arrunkObj1337[scene->_field423E]._arr1[1]._object1.setFrame(scene->_arrunkObj1337[scene->_field423E]._fieldBA4);
+ scene->_arrunkObj1337[scene->_field423E]._arr1[1]._object1.fixPriority(170);
+ }
+
+ if ((scene->_field4248 == 1) || (scene->_field423E == 2))
+ scene->setAnimationInfo(&scene->_arrunkObj1337[scene->_field423E]._arr1[1]);
+
+ scene->_item2._object1.hide();
+ if ((scene->_arrunkObj1337[scene->_field423E]._arr1[2]._field34 == 0) && (scene->subC264B(scene->_arrunkObj1337[scene->_field423E]._arr3[0]._field34 == 0))) {
+ if (scene->_field3E24 < 0)
+ scene->shuffleCards();
+ scene->_item2._object1.setPosition(Common::Point(162, 95));
+ scene->_item2._object1.show();
+
+ scene->_aSound2.play(61);
+
+ NpcMover *mover = new NpcMover();
+ scene->_item2._object1.addMover(mover, &scene->_arrunkObj1337[scene->_field423E]._fieldB9C, this);
+
+ scene->_arrunkObj1337[scene->_field423E]._arr1[2]._field34 = scene->_field3E28[scene->_field3E24];
+ scene->_field3E28[scene->_field3E24] = 0;
+ scene->_field3E24--;
+ if (scene->_field3E24 < 0)
+ scene->_background2.remove();
+ } else
+ signal();
+ break;
+ case 3:
+ if ( ( scene->_item2._object1._position.x == scene->_arrunkObj1337[scene->_field423E]._fieldB9C.x)
+ && ( scene->_item2._object1._position.y == scene->_arrunkObj1337[scene->_field423E]._fieldB9C.y) ) {
+ scene->_arrunkObj1337[scene->_field423E]._arr1[2]._object1.postInit();
+ scene->_arrunkObj1337[scene->_field423E]._arr1[2]._object1._moveDiff = Common::Point(30, 30);
+ scene->_arrunkObj1337[scene->_field423E]._arr1[2]._object1.setVisage(1332);
+ scene->_arrunkObj1337[scene->_field423E]._arr1[2]._object1.setPosition(scene->_arrunkObj1337[scene->_field423E]._arr1[2]._field36, 0);
+ scene->_arrunkObj1337[scene->_field423E]._arr1[2]._object1.setStrip(1);
+ scene->_arrunkObj1337[scene->_field423E]._arr1[2]._object1.setFrame(scene->_arrunkObj1337[scene->_field423E]._fieldBA4);
+ scene->_arrunkObj1337[scene->_field423E]._arr1[2]._object1.fixPriority(170);
+ }
+
+ if ((scene->_field4248 == 1) || (scene->_field423E == 2))
+ scene->setAnimationInfo(&scene->_arrunkObj1337[scene->_field423E]._arr1[2]);
+
+ scene->_item2._object1.hide();
+ if ((scene->_arrunkObj1337[scene->_field423E]._arr1[3]._field34 == 0) && (scene->subC264B(scene->_arrunkObj1337[scene->_field423E]._arr3[0]._field34 == 0))) {
+ if (scene->_field3E24 < 0)
+ scene->shuffleCards();
+ scene->_item2._object1.setPosition(Common::Point(162, 95));
+ scene->_item2._object1.show();
+
+ scene->_aSound2.play(61);
+
+ NpcMover *mover = new NpcMover();
+ scene->_item2._object1.addMover(mover, &scene->_arrunkObj1337[scene->_field423E]._fieldBA0, this);
+
+ scene->_arrunkObj1337[scene->_field423E]._arr1[3]._field34 = scene->_field3E28[scene->_field3E24];
+ scene->_field3E28[scene->_field3E24] = 0;
+ scene->_field3E24--;
+ if (scene->_field3E24 < 0)
+ scene->_background2.remove();
+ } else
+ signal();
+ break;
+ case 4:
+ if ( ( scene->_item2._object1._position.x == scene->_arrunkObj1337[scene->_field423E]._fieldBA0.x)
+ && ( scene->_item2._object1._position.y == scene->_arrunkObj1337[scene->_field423E]._fieldBA0.y) ) {
+ scene->_arrunkObj1337[scene->_field423E]._arr1[3]._object1.postInit();
+ scene->_arrunkObj1337[scene->_field423E]._arr1[3]._object1._moveDiff = Common::Point(30, 30);
+ scene->_arrunkObj1337[scene->_field423E]._arr1[3]._object1.setVisage(1332);
+ scene->_arrunkObj1337[scene->_field423E]._arr1[3]._object1.setPosition(scene->_arrunkObj1337[scene->_field423E]._arr1[3]._field36, 0);
+ scene->_arrunkObj1337[scene->_field423E]._arr1[3]._object1.setStrip(1);
+ scene->_arrunkObj1337[scene->_field423E]._arr1[3]._object1.setFrame(scene->_arrunkObj1337[scene->_field423E]._fieldBA4);
+ scene->_arrunkObj1337[scene->_field423E]._arr1[3]._object1.fixPriority(170);
+ }
+
+ if ((scene->_field4248 == 1) || (scene->_field423E == 2))
+ scene->setAnimationInfo(&scene->_arrunkObj1337[scene->_field423E]._arr1[3]);
+
+ scene->_item2._object1.hide();
+ switch (scene->_field423E) {
+ case 0:
+ scene->subCF979();
+ break;
+ case 1:
+ scene->subCF31D();
+ break;
+ case 2:
+ scene->subD0281();
+ break;
+ case 3:
+ scene->subC2C2F();
+ break;
+ default:
+ break;
+ }
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene1337::Action5::signal() {
+ Scene1337 *scene = (Scene1337 *)R2_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0: {
+ scene->_field3E28[scene->_field3E26] = scene->_field3EF0->_field34;
+ scene->_field3E26--;
+ if (!g_globals->_sceneObjects->contains(&scene->_item7._object1)) {
+ scene->_item7._object1.postInit();
+ scene->_item7._object1.hide();
+ scene->_item7._object1.setVisage(1332);
+ scene->_item7._object1.setPosition(scene->_item7._field36, 0);
+ scene->_item7._object1.fixPriority(170);
+ }
+
+ scene->_item7._field34 = scene->_field3EF0->_field34;
+ scene->_field3EF0->_field34 = 0;
+ scene->_field3EF0->_object1.remove();
+
+ if (scene->_field3EF0 == &scene->_item6) {
+ subD18B5(5, 1, 4);
+ scene->subC4CEC();
+ }
+ scene->_item2._object1.setPosition(scene->_field3EF0->_field36, 0);
+ scene->_item2._object1.show();
+ Common::Point pt(128, 95);
+ NpcMover *mover = new NpcMover();
+ scene->_item2._object1.addMover(mover, &pt, this);
+ }
+ break;
+ case 1:
+ scene->_item2._object1.hide();
+ scene->setAnimationInfo(&scene->_item7);
+ scene->_aSound2.play(61);
+ scene->subC20F9();
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene1337::Action6::signal() {
+ Scene1337 *scene = (Scene1337 *)R2_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0: {
+ scene->_field3EF4->_field34 = 1;
+ scene->_field3EF4->_object1.postInit();
+ scene->_field3EF4->_object1.hide();
+ scene->_field3EF4->_object1.setVisage(1332);
+ scene->_field3EF4->_object1.setPosition(scene->_field3EF4->_field36);
+ scene->_field3EF4->_object1.fixPriority(170);
+
+ scene->_field3EF0->_field34 = 0;
+ scene->_field3EF0->_object1.remove();
+
+ scene->_item2._object1.setPosition(scene->_field3EF0->_field36);
+ scene->_item2._object1.show();
+
+ NpcMover *mover = new NpcMover();
+ scene->_item2._object1.addMover(mover, &scene->_field3EF4->_field36, this);
+ }
+ break;
+ case 1:
+ scene->_item2._object1.hide();
+ scene->setAnimationInfo(scene->_field3EF4);
+ scene->_aSound1.play(59);
+ if (scene->_field3EF0 == &scene->_item6) {
+ subD18B5(5, 1, 4);
+ scene->subC4CEC();
+ }
+ scene->subC20F9();
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene1337::Action7::signal() {
+ Scene1337 *scene = (Scene1337 *)R2_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0: {
+ scene->_field3EF4->_field34 = scene->_field3EF0->_field34;
+
+ scene->_field3EF0->_field34 = 0;
+ scene->_field3EF0->_object1.remove();
+
+ scene->_item2._object1.setPosition(scene->_field3EF0->_field36, 0);
+ scene->_item2._object1.show();
+ NpcMover *mover = new NpcMover();
+ scene->_item2._object1.addMover(mover, &scene->_field3EF4->_field36, this);
+ }
+ break;
+ case 1:
+ if (scene->_field3EF0 == &scene->_item6) {
+ subD18B5(5, 1, 4);
+ scene->subC4CEC();
+ }
+ scene->setAnimationInfo(scene->_field3EF4);
+ scene->_aSound1.play(59);
+ scene->_item5._field34 = 1;
+ scene->_item5._field36.x = scene->_field3EF4->_field36.x;
+ scene->_item5._field36.y = scene->_field3EF4->_field36.y;
+ scene->_item5._object1.postInit();
+ scene->_item5._object1.hide();
+ scene->_item5._object1._flags = 0x200;
+
+ scene->subC4A39(&scene->_item5);
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene1337::Action8::signal() {
+ Scene1337 *scene = (Scene1337 *)R2_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0: {
+ scene->_field3E28[scene->_field3E26] = scene->_field3EF4->_field34;
+ scene->_field3E26--;
+
+ scene->_field3EF4->_field34 = scene->_field3EF0->_field34;
+ scene->_field3EF0->_object1.remove();
+
+ scene->_item2._object1.setPosition(scene->_field3EF0->_field36, 0);
+ scene->_item2._object1.show();
+
+ NpcMover *mover = new NpcMover();
+ scene->_item2._object1.addMover(mover, &scene->_field3EF4->_field36, this);
+ }
+ break;
+ case 1:
+ scene->_item2._object1.hide();
+
+ if (scene->_field3EF0 == &scene->_item6) {
+ subD18B5(5, 1, 4);
+ scene->subC4CEC();
+ }
+ scene->setAnimationInfo(scene->_field3EF4);
+ scene->_aSound1.play(58);
+ scene->subC4A39(scene->_field3EF4);
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene1337::Action9::signal() {
+ Scene1337 *scene = (Scene1337 *)R2_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0: {
+ scene->_field3EF4->_field34 = scene->_field3EF0->_field34;
+ scene->_field3EF4->_object1.postInit();
+ scene->_field3EF4->_object1.hide();
+ scene->_field3EF4->_object1.setVisage(1332);
+ scene->_field3EF4->_object1.setPosition(scene->_field3EF4->_field36, 0);
+ scene->_field3EF4->_object1.fixPriority(170);
+
+ scene->_field3EF0->_field34 = 0;
+ scene->_field3EF0->_object1.remove();
+
+ scene->_item2._object1.setPosition(scene->_field3EF0->_field36, 0);
+ scene->_item2._object1.show();
+
+ NpcMover *mover = new NpcMover();
+ scene->_item2._object1.addMover(mover, &scene->_field3EF4->_field36, this);
+ }
+ break;
+ case 1:
+ scene->_item2._object1.hide();
+ scene->setAnimationInfo(scene->_field3EF4);
+ scene->_aSound1.play(57);
+
+ if (scene->_field3EF0 == &scene->_item6) {
+ subD18B5(5, 1, 4);
+ scene->subC4CEC();
+ }
+
+ scene->subC20F9();
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene1337::Action10::signal() {
+ Scene1337 *scene = (Scene1337 *)R2_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0: {
+ scene->_field3EF8->_object1.postInit();
+ scene->_field3EF8->_object1.hide();
+ scene->_field3EF8->_object1.setVisage(1332);
+ scene->_field3EF8->_object1.setPosition(scene->_field3EF8->_field36, 0);
+ scene->_field3EF8->_object1.fixPriority(170);
+ scene->_field3EF8->_field34 = scene->_field3EF0->_field34;
+
+ scene->_field3EF0->_field34 = 0;
+ scene->_field3EF0->_object1.remove();
+
+ if (scene->_field3EF0 == &scene->_item6) {
+ subD18B5(5, 1, 4);
+ scene->subC4CEC();
+ }
+
+ scene->_item2._object1.setPosition(scene->_field3EF0->_field36, 0);
+ scene->_item2._object1.show();
+ NpcMover *mover = new NpcMover();
+ scene->_item2._object1.addMover(mover, &scene->_field3EF8->_field36, this);
+ }
+ break;
+ case 1: {
+ scene->_item2._object1.hide();
+ scene->setAnimationInfo(scene->_field3EF8);
+ scene->_aSound1.play(57);
+
+ bool found = false;
+ int indexFound = -1;
+
+ switch (scene->_field4240) {
+ case 0:
+ for (indexFound = 0; indexFound < 3; indexFound++) {
+ if (scene->_arrunkObj1337[0]._arr1[indexFound]._field34 == 29) {
+ found = true;
+ break;
+ }
+ }
+ break;
+ case 1:
+ for (indexFound = 0; indexFound < 3; indexFound++) {
+ if (scene->_arrunkObj1337[1]._arr1[indexFound]._field34 == 29) {
+ found = true;
+ break;
+ }
+ }
+ break;
+ case 2:
+ for (indexFound = 0; indexFound < 3; indexFound++) {
+ if (scene->_arrunkObj1337[2]._arr1[indexFound]._field34 == 29) {
+ found = true;
+ break;
+ }
+ }
+ break;
+ case 3:
+ for (indexFound = 0; indexFound < 3; indexFound++) {
+ if (scene->_arrunkObj1337[3]._arr1[indexFound]._field34 == 29) {
+ found = true;
+ break;
+ }
+ }
+ break;
+ default:
+ break;
+ }
+
+ bool found2 = false;
+
+ if (found) {
+ switch (scene->_field4240) {
+ case 0:
+ scene->subC51A0(&scene->_arrunkObj1337[0]._arr1[indexFound], scene->_field3EF8);
+ found2 = true;
+ break;
+ case 1:
+ scene->subC51A0(&scene->_arrunkObj1337[1]._arr1[indexFound], scene->_field3EF8);
+ found2 = true;
+ break;
+ case 2:
+ scene->subC4CD2();
+ if (MessageDialog::show(USE_INTERCEPTOR, NO_MSG, YES_MSG) == 0)
+ scene->subC4CEC();
+ else {
+ scene->subC51A0(&scene->_arrunkObj1337[2]._arr1[indexFound], scene->_field3EF8);
+ found2 = true;
+ }
+ break;
+ case 3:
+ scene->subC51A0(&scene->_arrunkObj1337[3]._arr1[indexFound], scene->_field3EF8);
+ found2 = true;
+ break;
+ default:
+ break;
+ }
+ }
+
+ if (!found2)
+ break;
+
+ if (scene->_field4240 == 2) {
+ int j = 0;
+ for (int i = 0; i <= 7; i++) {
+ if (scene->_arrunkObj1337[2]._arr2[i]._field34 != 0)
+ ++j;
+ }
+
+ if (j <= 1) {
+ for (int i = 0; i <= 7; i++) {
+ if (scene->_arrunkObj1337[2]._arr2[i]._field34 != 0) {
+ scene->_field3EF4 = &scene->_arrunkObj1337[2]._arr2[i];
+ break;
+ }
+ }
+ } else {
+ scene->subC4CD2();
+
+ found2 = false;
+ while (!found2) {
+ scene->actionDisplay(1330, 130, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+
+ // Wait for a mouse or keypress
+ Event event;
+ while (!g_globals->_events.getEvent(event, EVENT_BUTTON_DOWN | EVENT_KEYPRESS) && !g_vm->shouldQuit()) {
+ g_globals->_scenePalette.signalListeners();
+ R2_GLOBALS._sceneObjects->draw();
+ g_globals->_events.delay(g_globals->_sceneHandler->_delayTicks);
+ }
+
+ scene->_item6._field36 = event.mousePos;
+
+ for (int i = 0; i <= 7; i++) {
+ if ((scene->subC2BF8(&scene->_arrunkObj1337[2]._arr2[i], scene->_item6._field36) != 0) && (scene->_arrunkObj1337[2]._arr2[i]._field34 != 0)) {
+ scene->_field3EF4 = &scene->_arrunkObj1337[2]._arr2[0];
+ found2 = true;
+ break;
+ }
+ }
+ }
+ scene->subC4CEC();
+ }
+ }
+
+ scene->_field3E28[scene->_field3E26] = scene->_field3EF4->_field34;
+ scene->_field3E26--;
+ scene->_field3EF4->_field34 = 0;
+ scene->_field3EF4->_object1.remove();
+
+ scene->_item2._object1.setPosition(scene->_field3EF4->_field36, 0);
+ scene->_item2._object1.show();
+
+ NpcMover *mover = new NpcMover();
+ scene->_item2._object1.addMover(mover, &scene->_field3EF8->_field36, this);
+ }
+ break;
+ case 2:
+ scene->_item2._object1.hide();
+ scene->subC4A39(scene->_field3EF8);
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene1337::Action11::signal() {
+ Scene1337 *scene = (Scene1337 *)R2_GLOBALS._sceneManager._scene;
+
+ bool noAction = true;
+
+ switch (_actionIndex++) {
+ case 0: {
+ scene->_field3EF4->_object1.postInit();
+ scene->_field3EF4->_object1.hide();
+ scene->_field3EF4->_object1.setVisage(1332);
+ scene->_field3EF4->_object1.setPosition(scene->_field3EF4->_field36, 0);
+ scene->_field3EF4->_object1.fixPriority(170);
+ scene->_field3EF4->_field34 = 25;
+
+ if (scene->_field4240 == 2) {
+ scene->_item2._object1.setPosition(scene->_field3EF4->_field36, 0);
+ subD18B5(5, 1, 4);
+ } else {
+ scene->_field3EF0->_field34 = 0;
+ scene->_field3EF0->_object1.remove();
+ scene->_item2._object1.setPosition(scene->_field3EF0->_field36, 0);
+ }
+ scene->_item2._object1.show();
+
+ NpcMover *mover = new NpcMover();
+ scene->_item2._object1.addMover(mover, &scene->_field3EF4->_field36, this);
+ }
+ break;
+ case 1: {
+ scene->_item2._object1.hide();
+ scene->setAnimationInfo(scene->_field3EF4);
+ scene->_aSound1.play(57);
+
+ bool found = false;
+ int i = -1;
+
+ switch (scene->_field4242) {
+ case 0:
+ for (i = 0; i <= 3; i++) {
+ if (scene->_arrunkObj1337[0]._arr1[i]._field34 == 27) {
+ found = true;
+ break;
+ }
+ }
+
+ if ((found) && (scene->subC3E92(scene->_field4240) != -1)) {
+ scene->_field3EF0 = &scene->_arrunkObj1337[0]._arr1[i];
+ scene->_field3EF4 = &scene->_arrunkObj1337[0]._arr4[0];
+ if (scene->_field4240 != 0) {
+ int tmpVal = scene->subC3E92(scene->_field4240);
+ scene->_field3EF8 = &scene->_arrunkObj1337[scene->_field4240]._arr1[tmpVal];
+ }
+ scene->_item1.setAction(&scene->_action12);
+ noAction = false;
+ }
+ break;
+ case 1:
+ for (i = 0; i <= 3; i++) {
+ if (scene->_arrunkObj1337[1]._arr1[i]._field34 == 27) {
+ found = true;
+ break;
+ }
+ }
+
+ if ((found) && (scene->subC3E92(scene->_field4240) != -1)) {
+ scene->_field3EF0 = &scene->_arrunkObj1337[1]._arr1[i];
+ scene->_field3EF4 = &scene->_arrunkObj1337[1]._arr4[0];
+ if (scene->_field4240 != 1) {
+ int tmpVal = scene->subC3E92(scene->_field4240);
+ scene->_field3EF8 = &scene->_arrunkObj1337[scene->_field4240]._arr1[tmpVal];
+ }
+ scene->_item1.setAction(&scene->_action12);
+ noAction = false;
+ }
+ break;
+ case 2:
+ for (i = 0; i <= 3; i++) {
+ if (scene->_arrunkObj1337[2]._arr1[i]._field34 == 27) {
+ found = true;
+ break;
+ }
+ }
+
+ if ((found) && (scene->subC3E92(scene->_field4240) != -1)) {
+ scene->subC4CD2();
+ if (MessageDialog::show(USE_DOUBLE_AGENT, NO_MSG, YES_MSG) == 0)
+ scene->subC4CEC();
+ else {
+ scene->subC4CEC();
+ scene->_field3EF0 = &scene->_arrunkObj1337[2]._arr1[i];
+ scene->_field3EF4 = &scene->_arrunkObj1337[2]._arr4[0];
+ if (scene->_field4240 != 2) {
+ int tmpVal = scene->subC3E92(scene->_field4240);
+ scene->_field3EF8 = &scene->_arrunkObj1337[scene->_field4240]._arr1[tmpVal];
+ }
+ scene->_item1.setAction(&scene->_action12);
+ noAction = false;
+ }
+ }
+ break;
+ case 3:
+ for (i = 0; i <= 3; i++) {
+ if (scene->_arrunkObj1337[3]._arr1[i]._field34 == 27) {
+ found = true;
+ break;
+ }
+ }
+
+ if ((found) && (scene->subC3E92(scene->_field4240) != -1)) {
+ scene->_field3EF0 = &scene->_arrunkObj1337[3]._arr1[i];
+ scene->_field3EF4 = &scene->_arrunkObj1337[3]._arr4[0];
+ if (scene->_field4240 != 3) {
+ int tmpVal = scene->subC3E92(scene->_field4240);
+ scene->_field3EF8 = &scene->_arrunkObj1337[scene->_field4240]._arr1[tmpVal];
+ }
+ scene->_item1.setAction(&scene->_action12);
+ noAction = false;
+ }
+ break;
+ default:
+ break;
+ }
+
+ if (!noAction)
+ return;
+
+ if (scene->_field4240 == 2) {
+ int count = 0;
+ if (scene->_field4242 != 2) {
+ for (i = 0; i <= 3; i++) {
+ if (scene->_arrunkObj1337[scene->_field4242]._arr1[i]._field34 == 0)
+ ++count;
+ }
+ }
+
+ if (count > 1) {
+ scene->subC4CD2();
+
+ found = false;
+ while (!found) {
+ switch (scene->_field4242) {
+ case 0:
+ scene->actionDisplay(1330, 131, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ case 1:
+ scene->actionDisplay(1330, 132, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ case 3:
+ scene->actionDisplay(1330, 133, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ default:
+ break;
+ }
+
+ Event event;
+ while (!g_globals->_events.getEvent(event, EVENT_BUTTON_DOWN | EVENT_KEYPRESS) && !g_vm->shouldQuit()) {
+ g_globals->_scenePalette.signalListeners();
+ R2_GLOBALS._sceneObjects->draw();
+ g_globals->_events.delay(g_globals->_sceneHandler->_delayTicks);
+ }
+
+ scene->_item6._field36 = event.mousePos;
+
+ found = false;
+
+ if (scene->_field4242 != 2) {
+ for (i = 0; i <= 3; i++) {
+ if ((scene->subC2BF8(&scene->_arrunkObj1337[scene->_field4242]._arr1[i], scene->_item6._field36) != 0) && (scene->_arrunkObj1337[scene->_field4242]._arr1[i]._field34 != 0)) {
+ scene->_field3EF8 = &scene->_arrunkObj1337[scene->_field4242]._arr1[i];
+ found = true;
+ break;
+ }
+ }
+ }
+ } // while
+ scene->_field4246 = 1;
+ scene->subC4CEC();
+ } else {
+ if (scene->_field4242 != 2) {
+ int tmpVal = scene->subC3E92(scene->_field4242);
+ scene->_field3EF8 = &scene->_arrunkObj1337[scene->_field4242]._arr1[tmpVal];
+ }
+ }
+ }
+
+ scene->_field3EF0->_object1.postInit();
+ scene->_field3EF0->_object1.hide();
+ scene->_field3EF0->_object1.setVisage(1332);
+ scene->_field3EF0->_object1.setPosition(scene->_field3EF0->_field36, 0);
+ scene->_field3EF0->_object1.fixPriority(170);
+ scene->_field3EF0->_object1.setStrip2(1);
+ scene->_field3EF0->_field34 = scene->_field3EF8->_field34;
+
+ scene->_field3EF8->_field34 = 0;
+ scene->_field3EF8->_object1.remove();
+
+ scene->_item2._object1.setPosition(scene->_field3EF8->_field36, 0);
+ scene->_item2._object1.show();
+
+ NpcMover *mover = new NpcMover();
+ scene->_item2._object1.addMover(mover, &scene->_field3EF0->_field36, this);
+ }
+ break;
+ case 2:
+ scene->_item2._object1.hide();
+ switch (scene->_field4240) {
+ case 0:
+ scene->_field3EF0->_object1.setFrame(2);
+ scene->_field3EF0->_object1.show();
+ scene->_field423E--;
+ scene->_field4244 = 0;
+ break;
+ case 1:
+ scene->_field3EF0->_object1.setFrame(4);
+ scene->_field3EF0->_object1.show();
+ scene->_field423E--;
+ scene->_field4244 = 0;
+ break;
+ case 3:
+ scene->_field3EF0->_object1.setFrame(3);
+ scene->_field3EF0->_object1.show();
+ scene->_field423E--;
+ scene->_field4244 = 0;
+ break;
+ default:
+ scene->setAnimationInfo(scene->_field3EF0);
+ break;
+ }
+
+ scene->subC4A39(scene->_field3EF4);
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene1337::Action12::signal() {
+ Scene1337 *scene = (Scene1337 *)R2_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0:
+ signal();
+ break;
+ case 1: {
+ scene->_field3E28[scene->_field3E26] = scene->_field3EF4->_field34;
+ scene->_field3EF4->_field34 = scene->_field3EF0->_field34;
+ scene->_field3EF0->_field34 = 0;
+ scene->_field3EF0->_object1.remove();
+ scene->_item2._object1.setPosition(scene->_field3EF0->_field36, 0);
+ scene->_item2._object1.show();
+
+ NpcMover *mover = new NpcMover();
+ scene->_item2._object1.addMover(mover, &scene->_field3EF4->_field36, this);
+ }
+ break;
+ case 2:
+ scene->_item2._object1.hide();
+ scene->setAnimationInfo(scene->_field3EF4);
+ scene->_aSound1.play(58);
+ if (scene->_field4242 == 2) {
+ int count = 0;
+ int i = -1;
+ switch (scene->_field4240) {
+ case 0:
+ for (i = 0; i <= 3; i++) {
+ if (scene->_arrunkObj1337[0]._arr1[i]._field34 != 0)
+ ++count;
+ }
+ break;
+ case 1:
+ for (i = 0; i <= 3; i++) {
+ if (scene->_arrunkObj1337[3]._arr1[i]._field34 != 0)
+ ++count;
+ }
+ break;
+ case 3:
+ for (i = 0; i <= 3; i++) {
+ if (scene->_arrunkObj1337[3]._arr1[i]._field34 != 0)
+ ++count;
+ }
+ break;
+ default:
+ break;
+ }
+
+ if (count > 1) {
+ scene->subC4CD2();
+
+ bool found = false;
+
+ while (!found) {
+ switch (scene->_field4240) {
+ case 0:
+ scene->actionDisplay(1330, 131, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ case 1:
+ scene->actionDisplay(1330, 132, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ case 3:
+ scene->actionDisplay(1330, 133, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ default:
+ break;
+ }
+
+ Event event;
+ while (!g_globals->_events.getEvent(event, EVENT_BUTTON_DOWN | EVENT_KEYPRESS) && !g_vm->shouldQuit()) {
+ g_globals->_scenePalette.signalListeners();
+ R2_GLOBALS._sceneObjects->draw();
+ g_globals->_events.delay(g_globals->_sceneHandler->_delayTicks);
+ }
+
+ scene->_item6._field36 = event.mousePos;
+
+ if (scene->_field4240 == 0) {
+ for (i = 0; i <= 3; i++) {
+ if ((scene->subC2BF8(&scene->_arrunkObj1337[0]._arr1[i], scene->_item6._field36) != 0) && (scene->_arrunkObj1337[0]._arr1[i]._field34 != 0)) {
+ found = true;
+ scene->_field3EF8 = &scene->_arrunkObj1337[0]._arr1[i];
+ break;
+ }
+ }
+ }
+
+ if (scene->_field4240 == 3) {
+ for (i = 0; i <= 3; i++) {
+ if ((scene->subC2BF8(&scene->_arrunkObj1337[3]._arr1[i], scene->_item6._field36) != 0) && (scene->_arrunkObj1337[3]._arr1[i]._field34 != 0)) {
+ found = true;
+ scene->_field3EF8 = &scene->_arrunkObj1337[3]._arr1[i];
+ break;
+ }
+ }
+ }
+
+ if (scene->_field4240 == 1) {
+ for (i = 0; i <= 3; i++) {
+ if ((scene->subC2BF8(&scene->_arrunkObj1337[1]._arr1[i], scene->_item6._field36) != 0) && (scene->_arrunkObj1337[1]._arr1[i]._field34 != 0)) {
+ found = true;
+ scene->_field3EF8 = &scene->_arrunkObj1337[1]._arr1[i];
+ break;
+ }
+ }
+ }
+ }
+ scene->subC4CEC();
+ } else {
+ if (scene->_field4240 != 1) {
+ switch (scene->_field4240) {
+ case 0:
+ scene->_field3EF8 = &scene->_arrunkObj1337[0]._arr1[scene->subC3E92(0)];
+ break;
+ case 3:
+ scene->_field3EF8 = &scene->_arrunkObj1337[3]._arr1[scene->subC3E92(3)];
+ break;
+ default:
+ break;
+ }
+ } else {
+ scene->_field3EF8 = &scene->_arrunkObj1337[1]._arr1[scene->subC3E92(1)];
+ }
+ }
+
+ scene->_field3EF0->_object1.postInit();
+ scene->_field3EF0->_object1.hide();
+ scene->_field3EF0->_object1.setVisage(1332);
+ scene->_field3EF0->_object1.setPosition(scene->_field3EF0->_field36);
+ scene->_field3EF0->_object1.fixPriority(170);
+ scene->_field3EF0->_object1.setStrip2(1);
+ scene->_field3EF0->_field34 = scene->_field3EF8->_field34;
+
+ scene->_field3EF8->_field34 = 0;
+ scene->_field3EF8->_object1.remove();
+
+ scene->_item2._object1.setPosition(scene->_field3EF8->_field36);
+ scene->_item2._object1.show();
+ scene->_aSound1.play(57);
+
+ NpcMover *mover = new NpcMover();
+ scene->_item2._object1.addMover(mover, &scene->_field3EF0->_field36, this);
+ }
+ break;
+ case 3:
+ scene->_item2._object1.hide();
+ switch (scene->_field4242) {
+ case 0:
+ scene->_field3EF0->_object1.setFrame2(2);
+ scene->_field3EF0->_object1.show();
+ break;
+ case 1:
+ scene->_field3EF0->_object1.setFrame2(4);
+ scene->_field3EF0->_object1.show();
+ break;
+ case 3:
+ scene->_field3EF0->_object1.setFrame2(3);
+ scene->_field3EF0->_object1.show();
+ break;
+ default:
+ scene->setAnimationInfo(scene->_field3EF0);
+ break;
+ }
+ scene->subC4A39(scene->_field3EF4);
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene1337::Action13::signal() {
+ Scene1337 *scene = (Scene1337 *)R2_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0: {
+ scene->_field3E28[scene->_field3E26] = scene->_field3EF4->_field34;
+ scene->_field3E26--;
+
+ scene->_field3EF4->_field34 = scene->_field3EF0->_field34;
+
+ scene->_field3EF0->_field34 = 0;
+ scene->_field3EF0->_object1.remove();
+
+ scene->_item2._object1.setPosition(scene->_field3EF0->_field36, 0);
+ scene->_item2._object1.show();
+
+ NpcMover *mover = new NpcMover();
+ scene->_item2._object1.addMover(mover, &scene->_field3EF4->_field36, this);
+ }
+ break;
+ case 1:
+ scene->_item2._object1.hide();
+ scene->setAnimationInfo(scene->_field3EF4);
+ scene->_aSound1.play(58);
+ signal();
+ break;
+ case 2:
+ scene->subC4A39(scene->_field3EF4);
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene1337::postInit(SceneObjectList *OwnerList) {
+// In the original, may be found in subPostInit.
+// Without it, enableControl asserts
+ loadScene(1330);
+ SceneExt::postInit();
+//
+
+ // Hide the user interface
+ R2_GLOBALS._uiElements._active = false;
+ BF_GLOBALS._interfaceY = 200;
+
+ R2_GLOBALS._player.enableControl();
+ R2_GLOBALS._player._canWalk = false;
+
+ _unkFctPtr412 = NULL;
+
+ _field3EF0 = NULL;
+ _field3EF4 = NULL;
+ _field3EF8 = NULL;
+
+ _arrunkObj1337[2]._arr1[0]._field36 = Common::Point(10, 174);
+ _arrunkObj1337[2]._arr1[1]._field36 = Common::Point(37, 174);
+ _arrunkObj1337[2]._arr1[2]._field36 = Common::Point(64, 174);
+ _arrunkObj1337[2]._arr1[3]._field36 = Common::Point(91, 174);
+
+ _arrunkObj1337[2]._arr2[0]._field36 = Common::Point(119, 174);
+ _arrunkObj1337[2]._arr2[1]._field36 = Common::Point(119, 148);
+ _arrunkObj1337[2]._arr2[2]._field36 = Common::Point(119, 122);
+ _arrunkObj1337[2]._arr2[3]._field36 = Common::Point(145, 122);
+ _arrunkObj1337[2]._arr2[4]._field36 = Common::Point(171, 122);
+ _arrunkObj1337[2]._arr2[5]._field36 = Common::Point(171, 148);
+ _arrunkObj1337[2]._arr2[6]._field36 = Common::Point(171, 174);
+ _arrunkObj1337[2]._arr2[7]._field36 = Common::Point(145, 174);
+
+ _arrunkObj1337[2]._arr3[0]._field36 = Common::Point(199, 174);
+
+ _arrunkObj1337[2]._arr4[0]._field36 = Common::Point(145, 148);
+
+ _arrunkObj1337[2]._fieldB94 = Common::Point(10, 174);
+ _arrunkObj1337[2]._fieldB98 = Common::Point(37, 174);
+ _arrunkObj1337[2]._fieldB9C = Common::Point(64, 174);
+ _arrunkObj1337[2]._fieldBA0 = Common::Point(91, 174);
+ _arrunkObj1337[2]._fieldBA4 = 2;
+
+ _arrunkObj1337[3]._arr1[0]._field36 = Common::Point(14, 14);
+ _arrunkObj1337[3]._arr1[1]._field36 = Common::Point(14, 36);
+ _arrunkObj1337[3]._arr1[2]._field36 = Common::Point(14, 58);
+ _arrunkObj1337[3]._arr1[3]._field36 = Common::Point(14, 80);
+
+ _arrunkObj1337[3]._arr2[0]._field36 = Common::Point(37, 66);
+ _arrunkObj1337[3]._arr2[1]._field36 = Common::Point(63, 66);
+ _arrunkObj1337[3]._arr2[2]._field36 = Common::Point(89, 66);
+ _arrunkObj1337[3]._arr2[3]._field36 = Common::Point(89, 92);
+ _arrunkObj1337[3]._arr2[4]._field36 = Common::Point(89, 118);
+ _arrunkObj1337[3]._arr2[5]._field36 = Common::Point(63, 118);
+ _arrunkObj1337[3]._arr2[6]._field36 = Common::Point(37, 118);
+ _arrunkObj1337[3]._arr2[7]._field36 = Common::Point(37, 92);
+
+ _arrunkObj1337[3]._arr3[0]._field36 = Common::Point(37, 145);
+
+ _arrunkObj1337[3]._arr4[0]._field36 = Common::Point(63, 92);
+
+ _arrunkObj1337[3]._fieldB94 = Common::Point(14, 14);
+ _arrunkObj1337[3]._fieldB98 = Common::Point(14, 36);
+ _arrunkObj1337[3]._fieldB9C = Common::Point(14, 58);
+ _arrunkObj1337[3]._fieldBA0 = Common::Point(14, 80);
+ _arrunkObj1337[3]._fieldBA4 = 3;
+
+ _arrunkObj1337[0]._arr1[0]._field36 = Common::Point(280, 5);
+ _arrunkObj1337[0]._arr1[1]._field36 = Common::Point(253, 5);
+ _arrunkObj1337[0]._arr1[2]._field36 = Common::Point(226, 5);
+ _arrunkObj1337[0]._arr1[3]._field36 = Common::Point(199, 5);
+
+ _arrunkObj1337[0]._arr2[0]._field36 = Common::Point(171, 16);
+ _arrunkObj1337[0]._arr2[1]._field36 = Common::Point(171, 42);
+ _arrunkObj1337[0]._arr2[2]._field36 = Common::Point(171, 68);
+ _arrunkObj1337[0]._arr2[3]._field36 = Common::Point(145, 68);
+ _arrunkObj1337[0]._arr2[4]._field36 = Common::Point(119, 68);
+ _arrunkObj1337[0]._arr2[5]._field36 = Common::Point(119, 42);
+ _arrunkObj1337[0]._arr2[6]._field36 = Common::Point(119, 16);
+ _arrunkObj1337[0]._arr2[7]._field36 = Common::Point(145, 16);
+
+ _arrunkObj1337[0]._arr3[0]._field36 = Common::Point(91, 16);
+
+ _arrunkObj1337[0]._arr4[0]._field36 = Common::Point(145, 42);
+
+ _arrunkObj1337[0]._fieldB94 = Common::Point(280, 5);
+ _arrunkObj1337[0]._fieldB98 = Common::Point(253, 5);
+ _arrunkObj1337[0]._fieldB9C = Common::Point(226, 5);
+ _arrunkObj1337[0]._fieldBA0 = Common::Point(199, 5);
+ _arrunkObj1337[0]._fieldBA4 = 2;
+
+ _arrunkObj1337[1]._arr1[0]._field36 = Common::Point(283, 146);
+ _arrunkObj1337[1]._arr1[1]._field36 = Common::Point(283, 124);
+ _arrunkObj1337[1]._arr1[2]._field36 = Common::Point(283, 102);
+ _arrunkObj1337[1]._arr1[3]._field36 = Common::Point(283, 80);
+
+ _arrunkObj1337[1]._arr2[0]._field36 = Common::Point(253, 122);
+ _arrunkObj1337[1]._arr2[1]._field36 = Common::Point(227, 122);
+ _arrunkObj1337[1]._arr2[2]._field36 = Common::Point(201, 122);
+ _arrunkObj1337[1]._arr2[3]._field36 = Common::Point(201, 96);
+ _arrunkObj1337[1]._arr2[4]._field36 = Common::Point(201, 70);
+ _arrunkObj1337[1]._arr2[5]._field36 = Common::Point(227, 70);
+ _arrunkObj1337[1]._arr2[6]._field36 = Common::Point(253, 70);
+ _arrunkObj1337[1]._arr2[7]._field36 = Common::Point(253, 96);
+
+ _arrunkObj1337[1]._arr3[0]._field36 = Common::Point(253, 43);
+
+ _arrunkObj1337[1]._arr4[0]._field36 = Common::Point(227, 96);
+
+ _arrunkObj1337[1]._fieldB94 = Common::Point(283, 146);
+ _arrunkObj1337[1]._fieldB98 = Common::Point(283, 124);
+ _arrunkObj1337[1]._fieldB9C = Common::Point(283, 102);
+ _arrunkObj1337[1]._fieldBA0 = Common::Point(283, 80);
+ _arrunkObj1337[1]._fieldBA4 = 4;
+
+ subPostInit();
+}
+
+void Scene1337::remove() {
+ if (R2_GLOBALS._v57709 > 1) {
+ subD1917();
+ subD1940(false);
+ }
+
+ R2_GLOBALS._uiElements._active = true;
+ SceneExt::remove();
+}
+
+void Scene1337::process(Event &event) {
+ if (event.eventType == EVENT_BUTTON_DOWN) {
+ if (event.btnState != BTNSHIFT_RIGHT) {
+ subD183F(R2_GLOBALS._v5780E, 1);
+ event.handled = true;
+ } else if (_unkFctPtr412) {
+ FunctionPtrType tmpFctPtr = _unkFctPtr412;
+ _unkFctPtr412 = NULL;
+ (this->*tmpFctPtr)();
+ event.handled = true;
+ }
+ } else if (event.eventType == EVENT_KEYPRESS) {
+ if (event.kbd.keycode == Common::KEYCODE_SPACE) {
+ if (_unkFctPtr412) {
+ FunctionPtrType tmpFctPtr = _unkFctPtr412;
+ _unkFctPtr412 = NULL;
+ (this->*tmpFctPtr)();
+ event.handled = true;
+ }
+ } else
+ warning("Fixme: Find proper keycode value");
+ }
+
+ if (!event.handled)
+ Scene::process(event);
+}
+
+void Scene1337::dispatch() {
+ if (_field424C == 0) {
+ ++_field424E;
+ if (_field424E == 4) {
+ _field424C = 1;
+ suggestInstructions();
+ }
+ }
+ Scene::dispatch();
+}
+
+void Scene1337::actionDisplay(int resNum, int lineNum, int x, int y, int arg5, int width, int textMode, int fontNum, int colFG, int colBGExt, int colFGExt) {
+ // TODO: Check if it's normal that arg5 is unused and replaced by an hardcoded 0 value
+ // May hide an original bug
+
+ SceneItem::display(resNum, lineNum, SET_X, x, SET_Y, y, SET_KEEP_ONSCREEN, 0, SET_WIDTH, width, SET_POS_MODE, -1, SET_TEXT_MODE, textMode, SET_FONT, fontNum, SET_FG_COLOR, colFG, SET_EXT_BGCOLOR, colBGExt, SET_EXT_FGCOLOR, colFGExt, LIST_END);
+}
+
+void Scene1337::setAnimationInfo(unkObj1337sub1 *subObj) {
+ if (!subObj)
+ return;
+
+ if (subObj->_field34 > 9) {
+ if (subObj->_field34 > 25) {
+ subObj->_object1.setStrip2(4);
+ subObj->_object1.setFrame(subObj->_field34 - 25);
+ } else {
+ subObj->_object1.setStrip2(3);
+ subObj->_object1.setFrame(subObj->_field34 - 9);
+ }
+ } else {
+ subObj->_object1.setStrip2(2);
+ subObj->_object1.setFrame(subObj->_field34);
+ }
+
+ subObj->_object1.show();
+ R2_GLOBALS._sceneObjects->draw();
+}
+
+void Scene1337::subC20E5() {
+ subC2586();
+}
+
+void Scene1337::subC20F9() {
+ switch (_field424A) {
+ case -1:
+ ++_field423E;
+ if (_field423E == 3)
+ _field423E = 0;
+
+ if (_field4244 == 1) {
+ _object1.show();
+ switch (_field423E) {
+ case 0:
+ _object1.setStrip(3);
+ break;
+ case 1:
+ _object1.setStrip(4);
+ break;
+ case 2:
+ subD1975(174, 107);
+ _object1.setStrip(1);
+ break;
+ case 3:
+ subC4CEC();
+ _object1.setStrip(2);
+ break;
+ default:
+ break;
+ }
+
+ if (!_autoplay)
+ _unkFctPtr412 = &Scene1337::subC20E5;
+ else
+ subC20E5();
+ } else {
+ subC20E5();
+ }
+ break;
+ case 0:
+ _aSound2.play(62);
+ actionDisplay(1330, 135, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ actionDisplay(1330, 121, 20, 99, 1, 136, 0, 7, 0, 172, 172);
+ actionDisplay(1330, 122, 300, 99, 1, 136, 0, 7, 0, 117, 117);
+ R2_GLOBALS._sceneObjects->draw();
+ actionDisplay(1330, 123, 159, 134, 1, 200, 0, 7, 0, 105, 105);
+ break;
+ case 1:
+ _aSound2.play(62);
+ actionDisplay(1330, 151, 300, 99, 1, 136, 0, 7, 0, 117, 117);
+ actionDisplay(1330, 118, 20, 99, 1, 136, 0, 7, 0, 172, 172);
+ actionDisplay(1330, 119, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ R2_GLOBALS._sceneObjects->draw();
+ actionDisplay(1330, 120, 159, 134, 1, 200, 0, 7, 0, 105, 105);
+ break;
+ case 2:
+ _aSound2.play(62);
+ actionDisplay(1330, 134, 159, 134, 1, 200, 0, 7, 0, 105, 105);
+ actionDisplay(1330, 124, 20, 99, 1, 136, 0, 7, 0, 172, 172);
+ actionDisplay(1330, 126, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ R2_GLOBALS._sceneObjects->draw();
+ actionDisplay(1330, 125, 300, 99, 1, 136, 0, 7, 0, 117, 117);
+ break;
+ case 3:
+ _aSound2.play(62);
+ actionDisplay(1330, 150, 20, 99, 1, 136, 0, 7, 0, 172, 172);
+ actionDisplay(1330, 115, 300, 99, 1, 136, 0, 7, 0, 117, 117);
+ actionDisplay(1330, 116, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ R2_GLOBALS._sceneObjects->draw();
+ actionDisplay(1330, 117, 159, 134, 1, 200, 0, 7, 0, 105, 105);
+ break;
+ default:
+ break;
+ }
+
+ if (_field424A != -1)
+ R2_GLOBALS._sceneManager.changeScene(125);
+
+}
+
+void Scene1337::subC2586() {
+ if (_field4244 != 0)
+ _object1.hide();
+
+ switch (_field423E) {
+ case 2:
+ subC4CD2();
+ if (_field4246 == 1)
+ actionDisplay(1330, 114, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ _field4246 = 0;
+ // No break on purpose
+ case 0:
+ // No break on purpose
+ case 1:
+ // No break on purpose
+ case 3:
+ _item1.setAction(&_action4);
+ default:
+ break;
+ }
+
+ _field4244 = 1;
+
+}
+
+bool Scene1337::subC264B(int arg1) {
+ switch (arg1) {
+ case 10:
+ // No break on purpose
+ case 12:
+ // No break on purpose
+ case 15:
+ // No break on purpose
+ case 17:
+ // No break on purpose
+ case 18:
+ // No break on purpose
+ case 19:
+ // No break on purpose
+ case 20:
+ // No break on purpose
+ case 21:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool Scene1337::subC2687(int arg1) {
+ switch (arg1) {
+ case 11:
+ // No break on purpose
+ case 14:
+ // No break on purpose
+ case 16:
+ // No break on purpose
+ case 24:
+ return true;
+ default:
+ return false;
+ }
+}
+
+int Scene1337::subC26CB(int arg1, int arg2) {
+ if ((_arrunkObj1337[arg1]._arr1[arg2]._field34 > 1) && (_arrunkObj1337[arg1]._arr1[arg2]._field34 <= 9)) {
+ return arg2;
+ }
+
+ return -1;
+}
+
+int Scene1337::subC2719(int arg1) {
+ for (int i = 0; i <= 3; i++) {
+ if (_arrunkObj1337[arg1]._arr1[i]._field34 == 1)
+ return i;
+ }
+
+ return -1;
+}
+
+int Scene1337::subC274D(int arg1) {
+ for (int i = 0; i <= 3; i++) {
+ if (_arrunkObj1337[arg1]._arr1[i]._field34 == 13)
+ return i;
+ }
+
+ return -1;
+}
+
+int Scene1337::subC2781(int arg1) {
+ for (int i = 0; i <= 3; i++) {
+ if (_arrunkObj1337[arg1]._arr1[i]._field34 == 25)
+ return i;
+ }
+
+ return -1;
+}
+
+int Scene1337::subC27B5(int arg1) {
+ switch (arg1) {
+ case 11:
+ // No break on purpose
+ case 14:
+ // No break on purpose
+ case 16:
+ // No break on purpose
+ case 24:
+ return arg1;
+ break;
+ default:
+ return -1;
+ break;
+ }
+}
+
+int Scene1337::subC27F9(int arg1) {
+ switch (arg1) {
+ case 10:
+ // No break on purpose
+ case 12:
+ // No break on purpose
+ case 15:
+ // No break on purpose
+ case 17:
+ // No break on purpose
+ case 18:
+ // No break on purpose
+ case 19:
+ // No break on purpose
+ case 20:
+ // No break on purpose
+ case 21:
+ return arg1;
+ default:
+ return -1;
+ }
+}
+
+void Scene1337::subC2835(int arg1) {
+ int i;
+ bool found = false;
+ switch (arg1) {
+ case 0:
+ for (i = 0; i <= 3; i++) {
+ if (subC27F9(_arrunkObj1337[arg1]._arr1[i]._field34) != -1) {
+ found = true;
+ break;
+ }
+ }
+
+ if (found)
+ break;
+
+ for (i = 0; i <= 3; i++) {
+ if (subC27B5(_arrunkObj1337[arg1]._arr1[i]._field34) != -1) {
+ found = true;
+ break;
+ }
+ }
+
+ if (found)
+ break;
+
+ for (i = 0; i <= 3; i++) {
+ if ((_arrunkObj1337[arg1]._arr1[i]._field34 > 1) && (_arrunkObj1337[arg1]._arr1[i]._field34 <= 9)) {
+ found = true;
+ break;
+ }
+ }
+
+ if (found)
+ break;
+
+ for (i = 0; i <= 3; i++) {
+ if ((_arrunkObj1337[arg1]._arr1[i]._field34 >= 26) && (_arrunkObj1337[arg1]._arr1[i]._field34 <= 33)) {
+ found = true;
+ break;
+ }
+ }
+
+ if (found)
+ break;
+
+ for (i = 0; i <= 3; i++) {
+ if (_arrunkObj1337[arg1]._arr1[i]._field34 == 1) {
+ found = true;
+ break;
+ }
+ }
+
+ if (found)
+ break;
+
+ for (i = 0; i <= 3; i++) {
+ if (_arrunkObj1337[arg1]._arr1[i]._field34 == 25) {
+ found = true;
+ break;
+ }
+ }
+
+ if (found)
+ break;
+
+ for (i = 0; i <= 3; i++) {
+ if (_arrunkObj1337[arg1]._arr1[i]._field34 == 13) {
+ found = true;
+ break;
+ }
+ }
+ break;
+ case 1:
+ for (i = 0; i <= 3; i++) {
+ if ((_arrunkObj1337[arg1]._arr1[i]._field34 >= 26) && (_arrunkObj1337[arg1]._arr1[i]._field34 <= 33)) {
+ found = true;
+ break;
+ }
+ }
+
+ if (found)
+ break;
+
+ for (i = 0; i <= 3; i++) {
+ if (_arrunkObj1337[arg1]._arr1[i]._field34 == 1) {
+ found = true;
+ break;
+ }
+ }
+
+ if (found)
+ break;
+
+ for (i = 0; i <= 3; i++) {
+ if ((_arrunkObj1337[arg1]._arr1[i]._field34 > 1) && (_arrunkObj1337[arg1]._arr1[i]._field34 <= 9)) {
+ found = true;
+ break;
+ }
+ }
+
+ if (found)
+ break;
+
+ for (i = 0; i <= 3; i++) {
+ if (subC27F9(_arrunkObj1337[arg1]._arr1[i]._field34) != -1) {
+ found = true;
+ break;
+ }
+ }
+
+ if (found)
+ break;
+
+ for (i = 0; i <= 3; i++) {
+ if (subC27B5(_arrunkObj1337[arg1]._arr1[i]._field34) != -1) {
+ found = true;
+ break;
+ }
+ }
+
+ if (found)
+ break;
+
+ for (i = 0; i <= 3; i++) {
+ if (_arrunkObj1337[arg1]._arr1[i]._field34 == 25) {
+ found = true;
+ break;
+ }
+ }
+
+ if (found)
+ break;
+
+ for (i = 0; i <= 3; i++) {
+ if (_arrunkObj1337[arg1]._arr1[i]._field34 == 13) {
+ found = true;
+ break;
+ }
+ }
+
+ break;
+ default:
+ return;
+ }
+
+ subC4A39(&_arrunkObj1337[arg1]._arr1[i]);
+}
+
+bool Scene1337::subC2BF8(unkObj1337sub1 *subObj1, Common::Point pt) {
+ if ((subObj1->_field36.x > pt.x) || (subObj1->_field36.x + 24 < pt.x))
+ return false;
+
+ if ((subObj1->_field36.y > pt.y) || (subObj1->_field36.y + 24 < pt.y))
+ return false;
+
+ return true;
+}
+
+void Scene1337::subC2C2F() {
+ bool found = true;
+
+ if (_arrunkObj1337[3]._arr3[0]._field34 != 0) {
+ switch (_arrunkObj1337[3]._arr3[0]._field34) {
+ case 10:
+ // No break on purpose
+ case 12:
+ // No break on purpose
+ case 15:
+ // No break on purpose
+ case 17:
+ // No break on purpose
+ case 18:
+ // No break on purpose
+ case 19:
+ // No break on purpose
+ case 20:
+ // No break on purpose
+ case 21:
+ subC4A39(&_arrunkObj1337[3]._arr3[0]);
+ found = false;
+ break;
+ default:
+ found = false;
+ int i;
+ for (i = 0; i <= 3; i++) {
+ if (subC3386(_arrunkObj1337[3]._arr3[0]._field34, _arrunkObj1337[3]._arr1[i]._field34)) {
+ found = true;
+ break;
+ }
+ }
+
+ if (found) {
+ found = false;
+ subC34A1(&_arrunkObj1337[3]._arr1[i], &_arrunkObj1337[3]._arr3[0]);
+ }
+ break;
+ }
+ }
+
+ if (!found)
+ return;
+
+ int randIndx = R2_GLOBALS._randomSource.getRandomNumber(3);
+
+ if (_arrunkObj1337[3]._arr1[randIndx]._field34 == 1) {
+ found = false;
+
+ for (int i = 0; i <= 7; i++) {
+ if ((_arrunkObj1337[3]._arr2[i]._field34 == 0) && (!subC2687(_arrunkObj1337[3]._arr3[0]._field34))) {
+ subC340B(&_arrunkObj1337[3]._arr1[randIndx], &_arrunkObj1337[3]._arr2[i]);
+ found = true;
+ break;
+ }
+ }
+
+ if (found) {
+ return;
+ }
+ } else if (_arrunkObj1337[3]._arr1[randIndx]._field34 <= 9) {
+ found = false;
+
+ for (int i = 0; i <= 7; i++) {
+ if (_arrunkObj1337[3]._arr2[i]._field34 == _arrunkObj1337[3]._arr1[randIndx]._field34) {
+ found = true;
+ break;
+ }
+ }
+
+ if (!found) {
+ for (int i = 0; i <= 7; i++) {
+ if ((_arrunkObj1337[3]._arr2[i]._field34 == 1) && (!subC2687(_arrunkObj1337[3]._arr3[i]._field34))) {
+ int tmpVal = 0;
+
+ for (int j = 0; j <= 7; j++) {
+ if ((_arrunkObj1337[3]._arr2[j]._field34 > 1) && (_arrunkObj1337[3]._arr2[j]._field34 <= 9))
+ ++tmpVal;
+ }
+
+ if (tmpVal == 7)
+ _field424A = 3;
+
+ subC33C0(&_arrunkObj1337[3]._arr1[randIndx], &_arrunkObj1337[3]._arr2[i]);
+ found = true;
+ break;
+ }
+ }
+ if (found)
+ return;
+ }
+ } else if (_arrunkObj1337[3]._arr1[randIndx]._field34 == 13) {
+ int tmpVal = subC331B(3);
+
+ if (tmpVal != -1) {
+ subC358E(&_arrunkObj1337[3]._arr1[randIndx], tmpVal);
+ return;
+ }
+ } else if (_arrunkObj1337[3]._arr1[randIndx]._field34 == 25) {
+ int tmpVal = -1;
+ found = false;
+ int tmpRandIndx = R2_GLOBALS._randomSource.getRandomNumber(3);
+
+ for (int i = 0; i <= 3; i++) {
+ if ( (tmpRandIndx != 3)
+ && ( (_arrunkObj1337[tmpRandIndx]._arr1[0]._field34 != 0)
+ || (_arrunkObj1337[tmpRandIndx]._arr1[1]._field34 != 0)
+ || (_arrunkObj1337[tmpRandIndx]._arr1[2]._field34 != 0)
+ || (_arrunkObj1337[tmpRandIndx]._arr1[3]._field34 != 0) )) {
+ tmpVal = tmpRandIndx;
+ break;
+ }
+
+ ++tmpRandIndx;
+ if (tmpRandIndx > 3)
+ tmpRandIndx = 0;
+ }
+
+ if (tmpVal != -1) {
+ subC318B(3, &_arrunkObj1337[3]._arr1[randIndx], tmpVal);
+ return;
+ }
+ } else {
+ switch (_arrunkObj1337[3]._arr1[randIndx]._field34) {
+ case 10:
+ // No break on purpose
+ case 11:
+ // No break on purpose
+ case 12:
+ // No break on purpose
+ case 14:
+ // No break on purpose
+ case 15:
+ // No break on purpose
+ case 16:
+ // No break on purpose
+ case 17:
+ // No break on purpose
+ case 18:
+ // No break on purpose
+ case 19:
+ // No break on purpose
+ case 20:
+ // No break on purpose
+ case 21:
+ // No break on purpose
+ case 24: {
+ int tmpVal = -1;
+ int tmpRandIndx = R2_GLOBALS._randomSource.getRandomNumber(3);
+
+ for (int i = 0; i <= 3; i++) {
+ if (tmpRandIndx != 3) {
+ // The variables 'i' and 'j' are not used in the inner code of the loop.
+ // It's understandable for 'i', which helps making sure that tmpVal is used properly,
+ // but it's suspect for j
+ for (int j = 0; j <= 7; j++) {
+ if ((_arrunkObj1337[tmpRandIndx]._arr3[0]._field34 == 0) && (subC32B1(tmpRandIndx, _arrunkObj1337[3]._arr1[randIndx]._field34))) {
+ tmpVal = j;
+ }
+ }
+ }
+
+ ++tmpRandIndx;
+ if (tmpRandIndx > 3)
+ tmpRandIndx = 0;
+
+ if (tmpVal != -1)
+ break;
+ }
+
+ if (tmpVal != -1) {
+ // Useless second identical check skipped
+ subC3456(&_arrunkObj1337[3]._arr1[randIndx], &_arrunkObj1337[tmpVal]._arr3[0]);
+ return;
+ }
+ }
+ default:
+ break;
+ }
+ }
+
+ subC4A39(&_arrunkObj1337[3]._arr1[randIndx]);
+}
+
+void Scene1337::subC318B(int arg1, unkObj1337sub1 *subObj1, int arg3) {
+ _field4240 = arg1;
+ _field4242 = arg3;
+
+ int randIndx;
+
+ for (;;) {
+ randIndx = R2_GLOBALS._randomSource.getRandomNumber(3);
+ if (_arrunkObj1337[arg3]._arr1[randIndx]._field34 != 0)
+ break;
+ }
+
+ _field3EF0 = subObj1;
+ _field3EF4 = &_arrunkObj1337[arg3]._arr4[0];
+ _field3EF8 = &_arrunkObj1337[arg3]._arr1[randIndx];
+
+ _item1.setAction(&_action11);
+}
+
+int Scene1337::subC3257(int arg1) {
+ int retVal;
+
+ switch (arg1) {
+ case 10:
+ retVal = 2;
+ break;
+ case 12:
+ retVal = 3;
+ break;
+ case 15:
+ retVal = 5;
+ break;
+ case 17:
+ retVal = 9;
+ break;
+ case 18:
+ retVal = 6;
+ break;
+ case 19:
+ retVal = 4;
+ break;
+ case 20:
+ retVal = 8;
+ break;
+ case 21:
+ retVal = 7;
+ break;
+ default:
+ retVal = -1;
+ }
+
+ return retVal;
+}
+
+bool Scene1337::subC32B1(int arg1, int arg2) {
+ for (int i = 0; i <= 7; i++) {
+ if (_arrunkObj1337[arg1]._arr2[i]._field34 != 0) {
+ int tmpVal = subC3257(arg2);
+ if (tmpVal == _arrunkObj1337[arg1]._arr2[i]._field34)
+ return false;
+ }
+ }
+ return true;
+}
+
+int Scene1337::subC331B(int arg1) {
+ int randIndx = R2_GLOBALS._randomSource.getRandomNumber(3);
+
+ for (int i = 0; i <= 3; i++) {
+ if (randIndx != arg1) {
+ for (int j = 0; j <= 7; j++) {
+ if (_arrunkObj1337[randIndx]._arr2[j]._field34 != 0)
+ return randIndx;
+ }
+ }
+
+ if (arg1 == 1) {
+ randIndx--;
+ if (randIndx < 0)
+ randIndx = 3;
+ } else {
+ ++randIndx;
+ if (randIndx > 3)
+ randIndx = 0;
+ }
+ }
+
+ return -1;
+}
+
+bool Scene1337::subC3386(int arg1, int arg2) {
+ if ((arg1 == 11) && (arg2 == 26))
+ return true;
+
+ if ((arg1 == 14) && (arg2 == 30))
+ return true;
+
+ if ((arg1 == 16) && (arg2 == 32))
+ return true;
+
+ if ((arg1 == 24) && (arg2 == 28))
+ return true;
+
+ return false;
+}
+
+void Scene1337::subC33C0(unkObj1337sub1 *subObj1, unkObj1337sub1 *subObj2) {
+ _field3EF4 = subObj2;
+ _field3EF0 = subObj1;
+ _item1.setAction(&_action7);
+}
+
+int Scene1337::subC3E92(int arg1) {
+ if ( (_arrunkObj1337[arg1]._arr1[0]._field34 == 0)
+ && (_arrunkObj1337[arg1]._arr1[1]._field34 == 0)
+ && (_arrunkObj1337[arg1]._arr1[2]._field34 == 0)
+ && (_arrunkObj1337[arg1]._arr1[3]._field34 == 0))
+ return -1;
+
+ int randIndx;
+ for (;;) {
+ randIndx = R2_GLOBALS._randomSource.getRandomNumber(3);
+ if (_arrunkObj1337[arg1]._arr1[randIndx]._field34 == 0)
+ break;
+ }
+
+ return randIndx;
+}
+
+void Scene1337::subC340B(unkObj1337sub1 *subObj1, unkObj1337sub1 *subObj2) {
+ _field3EF0 = subObj1;
+ _field3EF4 = subObj2;
+
+ _item1.setAction(&_action6);
+}
+
+void Scene1337::subC3456(unkObj1337sub1 *subObj1, unkObj1337sub1 *subObj2) {
+ _field3EF0 = subObj1;
+ _field3EF4 = subObj2;
+
+ _item1.setAction(&_action9);
+}
+
+void Scene1337::subC34A1(unkObj1337sub1 *subObj1, unkObj1337sub1 *subObj2) {
+ _field3EF0 = subObj1;
+ _field3EF4 = subObj2;
+
+ _item1.setAction(&_action8);
+}
+
+Scene1337::unkObj1337sub1 *Scene1337::subC34EC(int arg1) {
+ for (int i = 0; i <= 7; i++) {
+ if (_arrunkObj1337[arg1]._arr2[i]._field34 == 1) {
+ return &_arrunkObj1337[arg1]._arr2[i];
+ }
+ }
+
+ for (int i = 0; i <= 7; i++) {
+ if ((_arrunkObj1337[arg1]._arr2[i]._field34 != 0) && (_arrunkObj1337[arg1]._arr2[i]._field34 < 10)) {
+ return &_arrunkObj1337[arg1]._arr2[i];
+ }
+ }
+
+ return NULL;
+}
+
+void Scene1337::subC358E(unkObj1337sub1 *subObj1, int arg2) {
+ _field3EF0 = subObj1;
+ _field3EF4 = subC34EC(arg2);
+ _field3EF8 = &_arrunkObj1337[arg2]._arr4[0];
+ _field4240 = arg2;
+ _item1.setAction(&_action10);
+}
+
+void Scene1337::subC4A39(unkObj1337sub1 *subObj) {
+ _field3EF0 = subObj;
+
+ _item1.setAction(&_action5);
+}
+
+void Scene1337::subC4CD2() {
+ if (R2_GLOBALS._v57709 > 0) {
+ subD1917();
+ subD1940(false);
+ }
+}
+
+void Scene1337::subC4CEC() {
+ if (R2_GLOBALS._v57709 != 0)
+ return;
+
+ subD18F5();
+ subD1940(1);
+}
+
+void Scene1337::subC51A0(unkObj1337sub1 *subObj1, unkObj1337sub1 *subObj2) {
+ _field3EF0 = subObj1;
+ _field3EF4 = subObj2;
+
+ _item1.setAction(&_action13);
+}
+
+void Scene1337::displayDialog(int dialogNumb) {
+ switch (dialogNumb - 1) {
+ case 0:
+ actionDisplay(1330, 53, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ case 1:
+ actionDisplay(1330, 57, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ case 2:
+ actionDisplay(1330, 58, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ case 3:
+ actionDisplay(1330, 59, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ case 4:
+ actionDisplay(1330, 60, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ case 5:
+ actionDisplay(1330, 61, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ case 6:
+ actionDisplay(1330, 62, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ case 7:
+ actionDisplay(1330, 63, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ case 8:
+ actionDisplay(1330, 64, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ case 9:
+ actionDisplay(1330, 65, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ case 10:
+ actionDisplay(1330, 67, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ case 11:
+ actionDisplay(1330, 69, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ case 12:
+ actionDisplay(1330, 71, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ actionDisplay(1330, 72, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ actionDisplay(1330, 73, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ case 13:
+ actionDisplay(1330, 79, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ case 14:
+ actionDisplay(1330, 81, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ case 15:
+ actionDisplay(1330, 83, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ case 16:
+ actionDisplay(1330, 85, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ case 17:
+ actionDisplay(1330, 87, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ case 18:
+ actionDisplay(1330, 89, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ case 19:
+ actionDisplay(1330, 91, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ case 20:
+ actionDisplay(1330, 93, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ case 23:
+ actionDisplay(1330, 95, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ case 24:
+ actionDisplay(1330, 97, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ case 25:
+ actionDisplay(1330, 104, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ case 26:
+ actionDisplay(1330, 105, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ actionDisplay(1330, 106, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ case 27:
+ actionDisplay(1330, 110, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ case 28:
+ actionDisplay(1330, 108, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ actionDisplay(1330, 109, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ case 29:
+ actionDisplay(1330, 111, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ case 31:
+ actionDisplay(1330, 112, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene1337::subPostInit() {
+ R2_GLOBALS._v57709 = 0;
+ R2_GLOBALS._v5780C = 0;
+ subD183F(1, 0);
+ subD1940(true);
+ subD18F5();
+
+// loadScene(1330);
+// SceneExt::postInit();
+
+ R2_GLOBALS._scenePalette.addRotation(224, 235, 1);
+
+ _field3E28[0] = 1;
+ _field3E28[1] = 1;
+ _field3E28[2] = 1;
+ _field3E28[3] = 1;
+ _field3E28[4] = 1;
+ _field3E28[5] = 1;
+ _field3E28[6] = 1;
+ _field3E28[7] = 1;
+ _field3E28[8] = 26;
+ _field3E28[9] = 2;
+ _field3E28[10] = 2;
+ _field3E28[11] = 2;
+ _field3E28[12] = 2;
+ _field3E28[13] = 2;
+ _field3E28[14] = 26;
+ _field3E28[15] = 3;
+ _field3E28[16] = 3;
+ _field3E28[17] = 3;
+ _field3E28[18] = 3;
+ _field3E28[19] = 3;
+ _field3E28[20] = 28;
+ _field3E28[21] = 4;
+ _field3E28[22] = 4;
+ _field3E28[23] = 4;
+ _field3E28[24] = 4;
+ _field3E28[25] = 4;
+ _field3E28[26] = 28;
+ _field3E28[27] = 5;
+ _field3E28[28] = 5;
+ _field3E28[29] = 5;
+ _field3E28[30] = 5;
+ _field3E28[31] = 5;
+ _field3E28[32] = 30;
+ _field3E28[33] = 6;
+ _field3E28[34] = 6;
+ _field3E28[35] = 6;
+ _field3E28[36] = 6;
+ _field3E28[37] = 6;
+ _field3E28[38] = 30;
+ _field3E28[39] = 7;
+ _field3E28[40] = 7;
+ _field3E28[41] = 7;
+ _field3E28[42] = 7;
+ _field3E28[43] = 7;
+ _field3E28[44] = 32;
+ _field3E28[45] = 8;
+ _field3E28[46] = 8;
+ _field3E28[47] = 8;
+ _field3E28[48] = 8;
+ _field3E28[49] = 8;
+ _field3E28[50] = 32;
+ _field3E28[51] = 9;
+ _field3E28[52] = 9;
+ _field3E28[53] = 9;
+ _field3E28[54] = 9;
+ _field3E28[55] = 9;
+ _field3E28[56] = 10;
+ _field3E28[57] = 11;
+ _field3E28[58] = 12;
+ _field3E28[59] = 13;
+ _field3E28[60] = 13;
+ _field3E28[61] = 14;
+ _field3E28[62] = 15;
+ _field3E28[63] = 16;
+ _field3E28[64] = 17;
+ _field3E28[65] = 18;
+ _field3E28[66] = 19;
+ _field3E28[67] = 20;
+ _field3E28[68] = 21;
+ _field3E28[69] = 26;
+ _field3E28[70] = 28;
+ _field3E28[71] = 24;
+ _field3E28[72] = 25;
+ _field3E28[73] = 25;
+ _field3E28[74] = 25;
+ _field3E28[75] = 25;
+ _field3E28[76] = 26;
+ _field3E28[77] = 26;
+ _field3E28[78] = 26;
+ _field3E28[79] = 27;
+ _field3E28[80] = 27;
+ _field3E28[81] = 28;
+ _field3E28[82] = 28;
+ _field3E28[83] = 28;
+ _field3E28[84] = 29;
+ _field3E28[85] = 29;
+ _field3E28[86] = 29;
+ _field3E28[87] = 30;
+ _field3E28[88] = 30;
+ _field3E28[89] = 30;
+ _field3E28[90] = 30;
+ _field3E28[91] = 32;
+ _field3E28[92] = 1;
+ _field3E28[93] = 32;
+ _field3E28[94] = 32;
+ _field3E28[95] = 32;
+ _field3E28[96] = 1;
+ _field3E28[97] = 1;
+ _field3E28[98] = 1;
+ _field3E28[99] = 0;
+
+ _field3E24 = 98;
+ _field3E26 = 98;
+
+ _item7._field34 = 0;
+ _item7._field36 = Common::Point(128, 95);
+
+ _item8._field34 = 0;
+ _item8._field36 = Common::Point(162, 95);
+
+ _item6._field34 = 0;
+
+ _item2._object1.postInit();
+ _item2._object1.setVisage(1332);
+ _item2._object1.setStrip(5);
+ _item2._object1.setFrame(1);
+ _item2._object1._moveDiff = Common::Point(10, 10);
+ _item2._object1.fixPriority(400);
+ _item2._object1.setPosition(Common::Point(128, 95), 0);
+ _item2._object1.animate(ANIM_MODE_2, NULL);
+ _item2._object1.hide();
+
+ _object1.postInit();
+ _object1.setVisage(1334);
+ _object1.setStrip(1);
+ _object1.setFrame(1);
+ _object1._numFrames = 12;
+ _object1.fixPriority(500);
+ _object1.setPosition(Common::Point(174, 107), 0);
+ _object1.animate(ANIM_MODE_2, NULL);
+ _object1.hide();
+
+ _field4244 = 1;
+ _field4246 = 0;
+ _field4248 = 0;
+ _field424A = -1;
+
+ _background1.setup2(9531, 1, 1, 249, 168, 155, 0);
+
+ _autoplay = false;
+ _field424C = 0;
+ _field424E = 0;
+}
+
+void Scene1337::suggestInstructions() {
+ if (R2_GLOBALS._v57709 > 0)
+ subD1917();
+ if (MessageDialog::show(NEED_INSTRUCTIONS, NO_MSG, YES_MSG) == 0) {
+ if (R2_GLOBALS._v57709 == 0)
+ subD18F5();
+ subCCF26();
+ } else {
+ if (R2_GLOBALS._v57709 == 0)
+ subD18F5();
+ subCB59B();
+ }
+}
+
+void Scene1337::subCB59B() {
+ _item1.setAction(&_action1);
+}
+
+void Scene1337::shuffleCards() {
+ R2_GLOBALS._sceneObjects->draw();
+
+ for (int i = 0; i <= 98; i++) {
+ if (_field3E28[i] == 0) {
+ for (int j = i + 1; j <= 98; j ++) {
+ if (_field3E28[j] != 0) {
+ _field3E28[i] = _field3E28[j];
+ _field3E28[j] = 0;
+ break;
+ }
+ }
+ }
+ }
+
+ for (int i = 0; i <= 99; i ++) {
+ if (_field3E28[i] == 0) {
+ _field3E24 = i - 1;
+ _field3E26 = 98;
+ break;
+ }
+ }
+
+ // tmpVal is never modified in the original. It looks weird but it works: at the end, the cards are suffled!
+ int tmpVal = 0;
+ int randIndx;
+ int swap;
+ for (int i = 0; i < 2000; i ++) {
+ randIndx = R2_GLOBALS._randomSource.getRandomNumber(_field3E24);
+ swap = _field3E28[tmpVal];
+ _field3E28[tmpVal] = _field3E28[randIndx];
+ _field3E28[randIndx] = swap;
+ }
+
+ _field423C = 0;
+ _item2._object1.setAction(&_action2);
+
+ while(_field423C == 0) {
+ g_globals->_scenePalette.signalListeners();
+ R2_GLOBALS._sceneObjects->draw();
+ warning("TODO: recurse on draw() and on signalListeners()?");
+ g_globals->_events.delay(g_globals->_sceneHandler->_delayTicks);
+
+ // Hack to avoid eternal loop
+ // To be removed when the recurse is working properly
+ _field423C = 1;
+ }
+}
+
+void Scene1337::subCCF26() {
+ _item2._object1._moveDiff = Common::Point(30, 30);
+ shuffleCards();
+ _item1.setAction(&_action3);
+}
+void Scene1337::subCD193() {
+ warning("STUBBED: subCD193()");
+}
+
+void Scene1337::subCDB90(int arg1, Common::Point pt) {
+ bool found = false;
+ int curReg = R2_GLOBALS._sceneRegions.indexOf(g_globals->_events._mousePos);
+
+ if (arg1 == 3) {
+ int i;
+ for (i = 0; i <= 7; i++) {
+ if ( (subC2BF8(&_arrunkObj1337[2]._arr2[i], pt))
+ || (subC2BF8(&_arrunkObj1337[0]._arr2[i], pt))
+ || (subC2BF8(&_arrunkObj1337[1]._arr2[i], pt))
+ || (subC2BF8(&_arrunkObj1337[3]._arr2[i], pt)) ) {
+ found = true;
+ break;
+ }
+ }
+
+ if (found) {
+ switch (curReg) {
+ case 5:
+ if (_arrunkObj1337[2]._arr2[i]._field34 != 0)
+ displayDialog(_arrunkObj1337[2]._arr2[i]._field34);
+ else
+ actionDisplay(1330, 20, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ case 10:
+ if (_arrunkObj1337[3]._arr2[i]._field34 != 0)
+ displayDialog(_arrunkObj1337[3]._arr2[i]._field34);
+ else
+ actionDisplay(1330, 22, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ case 15:
+ if (_arrunkObj1337[0]._arr2[i]._field34 != 0)
+ displayDialog(_arrunkObj1337[0]._arr2[i]._field34);
+ else
+ actionDisplay(1330, 21, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ case 20:
+ if (_arrunkObj1337[1]._arr2[i]._field34 != 0)
+ displayDialog(_arrunkObj1337[1]._arr2[i]._field34);
+ else
+ actionDisplay(1330, 23, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ default:
+ break;
+ }
+ } else {
+ if ( (subC2BF8(&_arrunkObj1337[2]._arr3[0], pt))
+ || (subC2BF8(&_arrunkObj1337[0]._arr3[0], pt))
+ || (subC2BF8(&_arrunkObj1337[1]._arr3[0], pt))
+ || (subC2BF8(&_arrunkObj1337[3]._arr3[0], pt)) ) {
+ found = true;
+ }
+
+ if (found) {
+ switch (curReg) {
+ case 5:
+ if (_arrunkObj1337[2]._arr3[0]._field34 != 0)
+ displayDialog(_arrunkObj1337[2]._arr3[0]._field34);
+ else
+ actionDisplay(1330, 10, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ case 10:
+ if (_arrunkObj1337[3]._arr3[0]._field34 != 0)
+ displayDialog(_arrunkObj1337[3]._arr3[0]._field34);
+ else
+ actionDisplay(1330, 16, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ case 15:
+ if (_arrunkObj1337[0]._arr3[0]._field34 != 0)
+ displayDialog(_arrunkObj1337[3]._arr3[0]._field34);
+ else
+ actionDisplay(1330, 13, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ case 20:
+ if (_arrunkObj1337[1]._arr3[0]._field34 != 0)
+ displayDialog(_arrunkObj1337[1]._arr3[0]._field34);
+ else
+ actionDisplay(1330, 18, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ default:
+ break;
+ }
+ } else {
+ if (subC2BF8(&_item7, pt)) {
+ if (_item7._field34 != 0)
+ displayDialog(_item7._field34);
+ else
+ actionDisplay(1330, 7, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ } else if (_background1._bounds.contains(pt)) {
+ actionDisplay(1330, 43, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ } else if (subC2BF8(&_item8, pt)) {
+ actionDisplay(1330, 4, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ } else if ( (subC2BF8(&_arrunkObj1337[2]._arr4[0], pt))
+ || (subC2BF8(&_arrunkObj1337[3]._arr4[0], pt))
+ || (subC2BF8(&_arrunkObj1337[0]._arr4[0], pt))
+ || (subC2BF8(&_arrunkObj1337[1]._arr4[0], pt)) ) {
+ actionDisplay(1330, 32, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ } else {
+ if (subC2BF8(&_arrunkObj1337[2]._arr1[0], pt))
+ displayDialog(_arrunkObj1337[2]._arr1[0]._field34);
+ else if (subC2BF8(&_arrunkObj1337[2]._arr1[1], pt))
+ displayDialog(_arrunkObj1337[2]._arr1[1]._field34);
+ else if (subC2BF8(&_arrunkObj1337[2]._arr1[2], pt))
+ displayDialog(_arrunkObj1337[2]._arr1[2]._field34);
+ else if (subC2BF8(&_arrunkObj1337[2]._arr1[3], pt))
+ displayDialog(_arrunkObj1337[2]._arr1[3]._field34);
+ else if ((curReg >= 6) || (curReg <= 9))
+ actionDisplay(1330, 29, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ else if ((curReg >= 11) || (curReg <= 14))
+ actionDisplay(1330, 31, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ else if ((curReg >= 16) || (curReg <= 19))
+ actionDisplay(1330, 30, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ else {
+ switch (curReg) {
+ case 0:
+ actionDisplay(1330, 2, 159, 134, 1, 200, 0, 7, 0, 105, 105);
+ break;
+ case 5:
+ actionDisplay(1330, 25, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ case 10:
+ actionDisplay(1330, 27, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ case 15:
+ actionDisplay(1330, 26, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ case 20:
+ actionDisplay(1330, 28, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ case 21:
+ actionDisplay(1330, 24, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (arg1 != 1)
+ return;
+
+ for (int i = 0; i <= 7; i++) {
+ if (subC2BF8(&_arrunkObj1337[2]._arr2[i], pt)) {
+ switch (_arrunkObj1337[2]._arr2[i]._field34) {
+ case 0:
+ actionDisplay(1330, 11, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ case 1:
+ actionDisplay(1330, 54, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ default:
+ actionDisplay(1330, 34, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ }
+ found = true;
+ break;
+ } else if (subC2BF8(&_arrunkObj1337[0]._arr2[i], pt)) {
+ switch (_arrunkObj1337[0]._arr2[i]._field34) {
+ case 0:
+ actionDisplay(1330, 11, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ default:
+ actionDisplay(1330, 1, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ }
+ found = true;
+ break;
+ } else if (subC2BF8(&_arrunkObj1337[1]._arr2[i], pt)) {
+ switch (_arrunkObj1337[1]._arr2[i]._field34) {
+ case 0:
+ actionDisplay(1330, 146, 300, 99, 1, 136, 0, 7, 0, 117, 117);
+ break;
+ default:
+ actionDisplay(1330, 144, 300, 99, 1, 136, 0, 7, 0, 117, 117);
+ break;
+ }
+ found = true;
+ break;
+ } else if (subC2BF8(&_arrunkObj1337[3]._arr2[i], pt)) {
+ switch (_arrunkObj1337[3]._arr2[i]._field34) {
+ case 0:
+ actionDisplay(1330, 147, 20, 99, 1, 136, 0, 7, 0, 172, 172);
+ break;
+ default:
+ actionDisplay(1330, 145, 20, 99, 1, 136, 0, 7, 0, 172, 172);
+ break;
+ }
+ found = true;
+ break;
+ }
+ }
+
+ if (subC2BF8(&_arrunkObj1337[2]._arr3[0], pt)) {
+ if (_arrunkObj1337[0]._arr3[0]._field34 != 0) {
+ actionDisplay(1330, 39, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ } else {
+ actionDisplay(1330, 11, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ }
+ found = true;
+ }
+
+ if (subC2BF8(&_arrunkObj1337[3]._arr3[0], pt)) {
+ if (_arrunkObj1337[3]._arr3[0]._field34 != 0) {
+ actionDisplay(1330, 145, 20, 99, 1, 136, 0, 7, 0, 172, 172);
+ } else {
+ actionDisplay(1330, 147, 20, 99, 1, 136, 0, 7, 0, 172, 172);
+ }
+ found = true;
+ }
+
+ if (subC2BF8(&_arrunkObj1337[1]._arr3[0], pt)) {
+ if (_arrunkObj1337[1]._arr3[0]._field34 != 0) {
+ actionDisplay(1330, 144, 300, 99, 1, 136, 0, 7, 0, 117, 117);
+ } else {
+ actionDisplay(1330, 146, 300, 99, 1, 136, 0, 7, 0, 117, 117);
+ }
+ found = true;
+ }
+
+ if (subC2BF8(&_arrunkObj1337[0]._arr3[0], pt)) {
+ if (_arrunkObj1337[0]._arr3[0]._field34 != 0) {
+ actionDisplay(1330, 1, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ } else {
+ actionDisplay(1330, 11, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ }
+ found = true;
+ }
+
+ if (subC2BF8(&_arrunkObj1337[3]._arr4[0], pt)) {
+ actionDisplay(1330, 147, 20, 99, 1, 136, 0, 7, 0, 172, 172);
+ found = true;
+ }
+
+ if (subC2BF8(&_arrunkObj1337[1]._arr4[0], pt)) {
+ actionDisplay(1330, 146, 300, 99, 1, 136, 0, 7, 0, 117, 117);
+ found = true;
+ }
+
+ if (subC2BF8(&_arrunkObj1337[0]._arr4[0], pt)) {
+ actionDisplay(1330, 11, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ found = true;
+ }
+
+ if (found)
+ return;
+
+ if (_background1._bounds.contains(pt)) {
+ subCD193();
+ return;
+ }
+
+ if (subC2BF8(&_item7, pt))
+ actionDisplay(1330, 9, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ else if (subC2BF8(&_item8, pt))
+ actionDisplay(1330, 5, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ else {
+ switch (curReg) {
+ case 0:
+ actionDisplay(1330, 3, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ case 6:
+ // no break on purpose
+ case 7:
+ // no break on purpose
+ case 8:
+ // no break on purpose
+ case 9:
+ actionDisplay(1330, 145, 20, 99, 1, 136, 0, 7, 0, 172, 172);
+ break;
+ case 10:
+ actionDisplay(1330, 147, 20, 99, 1, 136, 0, 7, 0, 172, 172);
+ break;
+ case 11:
+ // no break on purpose
+ case 12:
+ // no break on purpose
+ case 13:
+ // no break on purpose
+ case 14:
+ actionDisplay(1330, 1, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ case 16:
+ // no break on purpose
+ case 17:
+ // no break on purpose
+ case 18:
+ // no break on purpose
+ case 19:
+ actionDisplay(1330, 144, 300, 99, 1, 136, 0, 7, 0, 117, 117);
+ break;
+ case 20:
+ actionDisplay(1330, 146, 300, 99, 1, 136, 0, 7, 0, 117, 117);
+ break;
+ default:
+ actionDisplay(1330, 11, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ }
+ }
+}
+
+void Scene1337::subCF31D() {
+ int tmpVal = 1;
+ bool found;
+ int count;
+
+ if (this->_arrunkObj1337[1]._arr3[0]._field34 != 0) {
+ switch (_arrunkObj1337[1]._arr3[0]._field34) {
+ case 10:
+ // No break on purpose
+ case 12:
+ // No break on purpose
+ case 15:
+ // No break on purpose
+ case 17:
+ // No break on purpose
+ case 18:
+ // No break on purpose
+ case 19:
+ // No break on purpose
+ case 20:
+ // No break on purpose
+ case 21:
+ tmpVal = 0;
+ subC4A39(&_arrunkObj1337[1]._arr3[0]);
+ break;
+ default:
+ found = false;
+ int i;
+ for (i = 0; i <= 3; i++) {
+ if (subC3386(_arrunkObj1337[1]._arr3[0]._field34, _arrunkObj1337[1]._arr1[i]._field34)) {
+ found = true;
+ break;
+ }
+ }
+
+ if (found) {
+ tmpVal = 0;
+ subC34A1(&_arrunkObj1337[1]._arr1[i], &_arrunkObj1337[1]._arr3[0]);
+ }
+ }
+ }
+
+ if (tmpVal != 1)
+ return;
+
+ found = false;
+ for (int i = 0; i <= 3; i++) {
+ int tmpIndx = subC26CB(1, i);
+ if (tmpIndx == -1)
+ break;
+
+ tmpVal = 0;
+ for (int j = 0; j <= 7; j++) {
+ if (_arrunkObj1337[1]._arr2[j]._field34 == _arrunkObj1337[1]._arr1[tmpIndx]._field34) {
+ tmpVal = 1;
+ break;
+ }
+ }
+
+ if (tmpVal == 0)
+ break;
+
+ for (int j = 0; j <= 7; j++) {
+ if (_arrunkObj1337[1]._arr2[j]._field34 == 1) {
+ if (!subC2687(_arrunkObj1337[1]._arr3[0]._field34)) {
+ count = 0;
+ for (int k = 0; k <= 7; k++) {
+ if ((_arrunkObj1337[1]._arr2[k]._field34 > 1) && (_arrunkObj1337[1]._arr2[k]._field34 <= 9))
+ ++count;
+ }
+
+ if (count == 7)
+ _field424A = 1;
+
+ subC33C0(&_arrunkObj1337[1]._arr1[tmpIndx], &_arrunkObj1337[1]._arr2[j]);
+ found = true;
+ break;
+ }
+ }
+ }
+ }
+
+ if (found)
+ return;
+
+ tmpVal = subC2719(1);
+ if (tmpVal != -1) {
+ for (int i = 0; i <= 7; i++) {
+ if ((_arrunkObj1337[1]._arr2[i]._field34 == 0) && (!subC2687(_arrunkObj1337[1]._arr3[0]._field34))) {
+ subC340B(&_arrunkObj1337[1]._arr1[tmpVal], &_arrunkObj1337[1]._arr2[i]);
+ found = true;
+ }
+ }
+ }
+
+ if (found)
+ return;
+
+ tmpVal = subC274D(1);
+ int tmpVal2 = subC331B(1);
+
+ if ((tmpVal != -1) && ( tmpVal2 != -1))
+ subC358E(&_arrunkObj1337[1]._arr1[tmpVal], tmpVal2);
+
+ if (found)
+ return;
+
+ tmpVal = subC2781(1);
+ if (tmpVal != -1) {
+ count = -1;
+ int rndVal = R2_GLOBALS._randomSource.getRandomNumber(3);
+ for (int i = 0; i <= 3; i++) {
+ if (rndVal != 1) {
+ if ( (_arrunkObj1337[rndVal]._arr1[0]._field34 != 0)
+ || (_arrunkObj1337[rndVal]._arr1[1]._field34 != 0)
+ || (_arrunkObj1337[rndVal]._arr1[2]._field34 != 0)
+ || (_arrunkObj1337[rndVal]._arr1[3]._field34 == 0)) {
+ count = rndVal;
+ break;
+ }
+
+ rndVal--;
+ if (rndVal < 0)
+ rndVal = 3;
+ }
+ }
+
+ if (count != -1) {
+ subC318B(1, &_arrunkObj1337[1]._arr1[tmpVal], count);
+ found = true;
+ }
+ }
+
+ if (found)
+ return;
+
+ count = -1;
+ int i;
+ for (i = 0; i <= 3; i++) {
+ tmpVal = subC27B5(_arrunkObj1337[1]._arr1[i]._field34);
+ if (tmpVal != -1) {
+ int rndVal = R2_GLOBALS._randomSource.getRandomNumber(3);
+
+ for (int j = 0; j <= 3; j++) {
+ if (tmpVal != 1) {
+ for (int k = 0; k <= 7; k++) {
+ // 'k' is not used in that loop.
+ // It looks suspicious.
+ if ((_arrunkObj1337[tmpVal]._arr3[0]._field34 == 0) && (subC32B1(tmpVal, _arrunkObj1337[1]._arr1[i]._field34))) {
+ count = tmpVal;
+ break;
+ }
+ }
+ }
+
+ if (count != -1) {
+ found = true;
+ break;
+ } else {
+ rndVal--;
+ if (rndVal < 0)
+ rndVal = 3;
+ }
+ }
+
+ if (found)
+ break;
+ }
+ }
+
+ if (found) {
+ if (count == -1)
+ return;
+
+ subC3456(&_arrunkObj1337[1]._arr1[i], &_arrunkObj1337[count]._arr3[0]);
+ } else {
+ int j;
+ for (j = 0; j <= 3; j++) {
+ if (subC27F9(_arrunkObj1337[1]._arr1[j]._field34) != -1) {
+ count = -1;
+ int rndVal = R2_GLOBALS._randomSource.getRandomNumber(3);
+ for (int l = 0; l <= 3; l++) {
+ if (rndVal != 1) {
+ for (int m = 0; m <= 7; m++) {
+ // 'm' is not used in that loop. It looks suspicious.
+ if ((_arrunkObj1337[rndVal]._arr3[0]._field34 == 0) && (_arrunkObj1337[1]._arr1[j]._field34 == 1)) {
+ count = rndVal;
+ break;
+ }
+ }
+ }
+ if (count != -1) {
+ found = true;
+ break;
+ } else {
+ rndVal--;
+ if (rndVal < 0)
+ rndVal = 3;
+ }
+ }
+ if (found)
+ break;
+ }
+ }
+
+ if (found) {
+ if (count == -1)
+ return;
+
+ subC3456(&_arrunkObj1337[1]._arr1[j], &_arrunkObj1337[count]._arr3[0]);
+ } else {
+ subC2835(1);
+ }
+ }
+
+}
+
+void Scene1337::subCF979() {
+ bool found = true;
+
+ if (_arrunkObj1337[0]._arr3[0]._field34 != 0) {
+ switch (_arrunkObj1337[0]._arr3[0]._field34) {
+ case 10:
+ //No break on purpose
+ case 12:
+ //No break on purpose
+ case 15:
+ //No break on purpose
+ case 17:
+ //No break on purpose
+ case 18:
+ //No break on purpose
+ case 19:
+ //No break on purpose
+ case 20:
+ //No break on purpose
+ case 21:
+ subC4A39(&_arrunkObj1337[0]._arr3[0]);
+ found = false;
+ break;
+ default:
+ int i;
+ found = false;
+
+ for (i = 0; i <= 3; i++) {
+ if (subC3386(_arrunkObj1337[0]._arr3[0]._field34, _arrunkObj1337[0]._arr1[i]._field34)) {
+ found = true;
+ break;
+ }
+ }
+
+ if (found) {
+ found = false;
+ subC34A1(&_arrunkObj1337[0]._arr1[i], &_arrunkObj1337[0]._arr3[0]);
+ }
+ break;
+ }
+ }
+
+ if (found)
+ return;
+
+ int tmpVal;
+ found = false;
+ for (int i = 0; i <= 3; i++) {
+ tmpVal = subC26CB(0, i);
+
+ if (tmpVal != -1) {
+ bool flag = false;;
+ for (int j = 0; j <= 7; j++) {
+ if (_arrunkObj1337[0]._arr2[j]._field34 == _arrunkObj1337[0]._arr1[tmpVal]._field34) {
+ flag = true;
+ break;
+ }
+ }
+
+ if (!flag) {
+ for (int j = 0; j <= 7; j++) {
+ if ((_arrunkObj1337[0]._arr2[j]._field34 == 1) && (!subC2687(_arrunkObj1337[0]._arr3[0]._field34))) {
+ int count = 0;
+ for (int k = 0; k <= 7; k++) {
+ if ((_arrunkObj1337[0]._arr2[k]._field34 > 1) && (_arrunkObj1337[0]._arr2[k]._field34 <= 9)) {
+ ++count;
+ }
+ }
+
+ if (count == 7)
+ _field424A = 0;
+
+ subC33C0(&_arrunkObj1337[0]._arr1[tmpVal], &_arrunkObj1337[0]._arr2[j]);
+ found = true;
+ }
+ }
+ }
+ }
+
+ if (found)
+ break;
+ }
+
+ if (found)
+ return;
+
+ found = false;
+ tmpVal = subC2719(0);
+
+ if (tmpVal != -1) {
+ for (int i = 0; i <= 7; i++) {
+ if ((_arrunkObj1337[0]._arr2[i]._field34 == 0) && (!subC2687(_arrunkObj1337[0]._arr3[0]._field34))) {
+ subC340B(&_arrunkObj1337[0]._arr1[tmpVal], &_arrunkObj1337[0]._arr2[i]);
+ found = true;
+ break;
+ }
+ }
+ }
+
+ if (found)
+ return;
+
+ tmpVal = subC274D(0);
+ if (tmpVal != -1) {
+ for (int i = 0; i <= 7; i++) {
+ if (_arrunkObj1337[2]._arr2[i]._field34 != 0) {
+ subC358E(&_arrunkObj1337[0]._arr1[tmpVal], 2);
+ found = true;
+ break;
+ }
+ }
+ }
+
+ if (found)
+ return;
+
+ tmpVal = subC2781(0);
+ if (tmpVal != -1) {
+ if ( (_arrunkObj1337[2]._arr1[0]._field34 != 0)
+ || (_arrunkObj1337[2]._arr1[1]._field34 != 0)
+ || (_arrunkObj1337[2]._arr1[2]._field34 != 0)
+ || (_arrunkObj1337[2]._arr1[3]._field34 != 0) ) {
+ subC318B(0, &_arrunkObj1337[0]._arr1[tmpVal], 2);
+ found = true;
+ }
+ }
+
+ if (found)
+ return;
+
+ for (int i = 0; i <= 3; i++) {
+ if (subC27B5(_arrunkObj1337[0]._arr1[i]._field34) != -1) {
+ // The variable 'j' is not used in the inner code of the loop. It's suspect
+ for (int j = 0; j <= 7; j++) {
+ if ((_arrunkObj1337[2]._arr3[0]._field34 == 0) && (subC32B1(2, _arrunkObj1337[0]._arr1[i]._field34))) {
+ subC3456(&_arrunkObj1337[0]._arr1[i], &_arrunkObj1337[2]._arr3[0]);
+ found = true;
+ break;
+ }
+ }
+
+ if (found)
+ break;
+ }
+ }
+
+ if (found)
+ return;
+
+ for (int i = 0; i <= 3; i++) {
+ if (subC27F9(_arrunkObj1337[0]._arr1[i]._field34) != -1) {
+ // The variable 'j' is not used in the inner code of the loop. It's suspect
+ for (int j = 0; j <= 7; j++) {
+ if ((_arrunkObj1337[2]._arr3[0]._field34 == 0) && (subC32B1(2, _arrunkObj1337[0]._arr1[i]._field34))) {
+ subC3456(&_arrunkObj1337[0]._arr1[i], &_arrunkObj1337[2]._arr3[0]);
+ found = true;
+ }
+ }
+
+ if (found)
+ break;
+ }
+ }
+
+ if (found)
+ return;
+
+ tmpVal = subC274D(0);
+ int tmpVal2 = subC331B(0);
+
+ if ((tmpVal != -1) && (tmpVal2 != -1)) {
+ subC358E(&_arrunkObj1337[0]._arr1[tmpVal], tmpVal2);
+ found = true;
+ }
+
+ if (found)
+ return;
+
+ tmpVal = subC2781(0);
+ if (tmpVal != -1) {
+ if ( (_arrunkObj1337[1]._arr1[0]._field34 != 0)
+ || (_arrunkObj1337[1]._arr1[1]._field34 != 0)
+ || (_arrunkObj1337[1]._arr1[2]._field34 != 0)
+ || (_arrunkObj1337[1]._arr1[3]._field34 != 0) ) {
+ subC318B(0, &_arrunkObj1337[0]._arr1[tmpVal], 1);
+ found = true;
+ }
+ }
+
+ if (found)
+ return;
+
+ for (int i = 0; i <= 3; i++) {
+ tmpVal = subC27F9(_arrunkObj1337[0]._arr1[i]._field34);
+ if (tmpVal != -1) {
+ // The variable 'j' is not used in the inner code of the loop. It's suspect.
+ for (int j = 0; j <= 7; j++) {
+ if ((_arrunkObj1337[1]._arr3[0]._field34 == 0) && (subC32B1(1, _arrunkObj1337[0]._arr1[i]._field34))) {
+ subC3456(&_arrunkObj1337[0]._arr1[i], &_arrunkObj1337[1]._arr3[0]);
+ found = true;
+ }
+ }
+
+ if (!found) {
+ // The variable 'j' is not used in the inner code of the loop. It's suspect.
+ for (int j = 0; j <= 7; j++) {
+ if ((_arrunkObj1337[3]._arr3[0]._field34 == 0) && (subC32B1(3, _arrunkObj1337[0]._arr1[i]._field34))) {
+ subC3456(&_arrunkObj1337[0]._arr1[i], &_arrunkObj1337[3]._arr3[0]);
+ found = true;
+ }
+ }
+ }
+
+ if (found)
+ break;
+ }
+ }
+
+ if (found)
+ return;
+
+ for (int i = 0; i <= 3; i++) {
+ tmpVal = subC27B5(_arrunkObj1337[0]._arr1[i]._field34);
+ if (tmpVal != -1) {
+ // The variable 'j' is not used in the inner code of the loop. It's suspect.
+ for (int j = 0; j <= 7; j++) {
+ if ((_arrunkObj1337[1]._arr3[0]._field34 == 0) && (subC32B1(1, _arrunkObj1337[0]._arr1[i]._field34))) {
+ subC3456(&_arrunkObj1337[0]._arr1[i], &_arrunkObj1337[1]._arr3[0]);
+ found = true;
+ }
+ }
+
+ if (!found) {
+ // The variable 'j' is not used in the inner code of the loop. It's suspect.
+ for (int j = 0; j <= 7; j++) {
+ if ((_arrunkObj1337[3]._arr3[0]._field34 == 0) && (subC32B1(3, _arrunkObj1337[0]._arr1[i]._field34))) {
+ subC3456(&_arrunkObj1337[0]._arr1[i], &_arrunkObj1337[3]._arr3[0]);
+ found = true;
+ }
+ }
+ }
+
+ if (found)
+ break;
+ }
+ }
+
+ if (found)
+ return;
+
+ subC2835(0);
+}
+
+void Scene1337::subD026D() {
+ subD02CA();
+}
+
+void Scene1337::subD0281() {
+ if (subC27F9(this->_arrunkObj1337[2]._arr3[0]._field34) == -1)
+ _unkFctPtr412 = &Scene1337::subD026D;
+ else
+ subC4A39(&_arrunkObj1337[2]._arr3[0]);
+}
+
+void Scene1337::subD02CA() {
+ _item6._field36 = g_globals->_events._mousePos;
+
+ if (R2_GLOBALS._v57810 == 200) {
+ int di;
+ for (di = 0; di < 4; di++) {
+ if ((subC2BF8(&_arrunkObj1337[2]._arr1[di], _item6._field36) != 0) && (_arrunkObj1337[2]._arr1[di]._field34 != 0)) {
+ _item6._field34 = _arrunkObj1337[2]._arr1[di]._field34;
+ _item6._field36 = _arrunkObj1337[2]._arr1[di]._field36;
+ // _item6._actorName = _arrunkObj1337[2]._arr1[di]._actorName;
+ _item6._fieldE = _arrunkObj1337[2]._arr1[di]._fieldE;
+ _item6._field10 = _arrunkObj1337[2]._arr1[di]._field10;
+ warning("_item6._field12 = _arrunkObj1337[2]._arr1[di]._field12;");
+ warning("_item6._field14 = _arrunkObj1337[2]._arr1[di]._field14;");
+ warning("_item6._field16 = _arrunkObj1337[2]._arr1[di]._field16;");
+ _item6._sceneRegionId = _arrunkObj1337[2]._arr1[di]._sceneRegionId;
+ _item6._position = _arrunkObj1337[2]._arr1[di]._position;
+ _item6._yDiff = _arrunkObj1337[2]._arr1[di]._yDiff;
+ _item6._bounds = _arrunkObj1337[2]._arr1[di]._bounds;
+ _item6._resNum = _arrunkObj1337[2]._arr1[di]._resNum;
+ _item6._lookLineNum = _arrunkObj1337[2]._arr1[di]._lookLineNum;
+ _item6._talkLineNum = _arrunkObj1337[2]._arr1[di]._talkLineNum;
+ _item6._useLineNum = _arrunkObj1337[2]._arr1[di]._useLineNum;
+ _item6._action = _arrunkObj1337[2]._arr1[di]._action;
+ warning("_item6._field0 = _arrunkObj1337[2]._arr1[di]._field0;");
+ _item6._object1._updateStartFrame = _arrunkObj1337[2]._arr1[di]._object1._updateStartFrame;
+ _item6._object1._walkStartFrame = _arrunkObj1337[2]._arr1[di]._object1._walkStartFrame;
+ // _field2E is named _field3C in R2R
+ _item6._object1._field2E = _arrunkObj1337[2]._arr1[di]._object1._field2E;
+ _item6._object1._percent = _arrunkObj1337[2]._arr1[di]._object1._percent;
+ _item6._object1._priority = _arrunkObj1337[2]._arr1[di]._object1._priority;
+ _item6._object1._angle = _arrunkObj1337[2]._arr1[di]._object1._angle;
+ _item6._object1._flags = _arrunkObj1337[2]._arr1[di]._object1._flags;
+ _item6._object1._xe = _arrunkObj1337[2]._arr1[di]._object1._xe;
+ _item6._object1._xs = _arrunkObj1337[2]._arr1[di]._object1._xs;
+ _item6._object1._paneRects[0] = _arrunkObj1337[2]._arr1[di]._object1._paneRects[0];
+ _item6._object1._paneRects[1] = _arrunkObj1337[2]._arr1[di]._object1._paneRects[1];
+ _item6._object1._visage = _arrunkObj1337[2]._arr1[di]._object1._visage;
+ _item6._object1._objectWrapper = _arrunkObj1337[2]._arr1[di]._object1._objectWrapper;
+ _item6._object1._strip = _arrunkObj1337[2]._arr1[di]._object1._strip;
+ _item6._object1._animateMode = _arrunkObj1337[2]._arr1[di]._object1._animateMode;
+ _item6._object1._frame = _arrunkObj1337[2]._arr1[di]._object1._frame;
+ _item6._object1._endFrame = _arrunkObj1337[2]._arr1[di]._object1._endFrame;
+ // _field68 is named _field76 in R2R
+ _item6._object1._field68 = _arrunkObj1337[2]._arr1[di]._object1._field68;
+ _item6._object1._frameChange = _arrunkObj1337[2]._arr1[di]._object1._frameChange;
+ _item6._object1._numFrames = _arrunkObj1337[2]._arr1[di]._object1._numFrames;
+ _item6._object1._regionIndex = _arrunkObj1337[2]._arr1[di]._object1._regionIndex;
+ _item6._object1._mover = _arrunkObj1337[2]._arr1[di]._object1._mover;
+ _item6._object1._moveDiff = _arrunkObj1337[2]._arr1[di]._object1._moveDiff;
+ _item6._object1._moveRate = _arrunkObj1337[2]._arr1[di]._object1._moveRate;
+ _item6._object1._field8A = _arrunkObj1337[2]._arr1[di]._object1._field8A;
+ _item6._object1._endAction = _arrunkObj1337[2]._arr1[di]._object1._endAction;
+ _item6._object1._regionBitList = _arrunkObj1337[2]._arr1[di]._object1._regionBitList;
+ // _item6._object1._actorName = _arrunkObj1337[2]._arr1[di]._object1._actorName;
+ _item6._object1._fieldE = _arrunkObj1337[2]._arr1[di]._object1._fieldE;
+ _item6._object1._field10 = _arrunkObj1337[2]._arr1[di]._object1._field10;
+ warning("_item6._object1._field12 = _arrunkObj1337[2]._arr1[di]._object1._field12;");
+ warning("_item6._object1._field14 = _arrunkObj1337[2]._arr1[di]._object1._field14;");
+ warning("_item6._object1._field16 = _arrunkObj1337[2]._arr1[di]._object1._field16;");
+ _item6._object1 = _arrunkObj1337[2]._arr1[di]._object1;
+ }
+ }
+
+ if (di == 4) {
+ subCDB90(1, _item6._field36);
+ subD0281();
+ return;
+ }
+ } else if (R2_GLOBALS._v57810 == 300) {
+ subCDB90(3, _item6._field36);
+ subD0281();
+ return;
+ } else {
+ subD1A48(R2_GLOBALS._v57810);
+ subD0281();
+ return;
+ }
+
+ // That continues the block when R2_GLOBALS._v57810 == 200 and di != 4
+ subD18B5(1332, _item6._object1._strip, _item6._object1._frame);
+ R2_GLOBALS._sceneObjects->draw();
+ Event event;
+ bool found = false;
+ bool found_di;
+ for (;;) {
+ if ( ((g_globals->_events.getEvent(event, EVENT_BUTTON_DOWN)) && (event.btnState == BTNSHIFT_RIGHT))
+ || (g_globals->_events.getEvent(event, EVENT_KEYPRESS)) ){
+ _item6._field36 = g_globals->_events._mousePos;
+ found_di = false;
+
+ for (int i = 0; i <= 3; i ++) {
+ if (subC2BF8(&_arrunkObj1337[2]._arr1[i], Common::Point(_item6._field36.x + 12, _item6._field36.y + 12)) != 0) {
+ if (_arrunkObj1337[2]._arr1[i]._field34 == 0) {
+ _arrunkObj1337[2]._arr1[i]._field34 = _item6._field34;
+ _arrunkObj1337[2]._arr1[i]._object1.postInit();
+ _arrunkObj1337[2]._arr1[i]._object1.hide();
+ _arrunkObj1337[2]._arr1[i]._object1.setVisage(1332);
+ _arrunkObj1337[2]._arr1[i]._object1.setPosition(_arrunkObj1337[2]._arr1[i]._field36, 0);
+ _arrunkObj1337[2]._arr1[i]._object1.fixPriority(170);
+ setAnimationInfo(&_arrunkObj1337[2]._arr1[i]);
+ subD18B5(5, 1, 4);
+ found = true;
+ _field423E--;
+ _field4244 = 0;
+ subC20F9();
+ } else {
+ actionDisplay(1330, 127, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ found_di = true;
+ }
+ break;
+ }
+ }
+
+ if ((!found) && (!found_di)) {
+ if (subC2BF8(&_item7, Common::Point(_item6._field36.x + 12, _item6._field36.y + 12)) != 0) {
+ subC4A39(&_item6);
+ } else if (!found) {
+ bool foundVar4;
+ int i;
+ if (_item6._field34 == 1) {
+ foundVar4 = false;
+ for (i = 0; i <= 7; i++) {
+ if (subC2BF8(&_arrunkObj1337[2]._arr2[i], Common::Point(_item6._field36.x + 12, _item6._field36.y + 12)) != 0) {
+ foundVar4 = true;
+ break;
+ }
+ }
+
+ if ((foundVar4) && (_arrunkObj1337[2]._arr2[i]._field34 == 0)) {
+ if (subC27B5(_arrunkObj1337[2]._arr3[0]._field34) != -1) {
+ actionDisplay(1330, 55, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ } else {
+ subC340B(&_item6, &_arrunkObj1337[2]._arr2[i]);
+ return;
+ }
+ } else {
+ actionDisplay(1330, 56, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ }
+ } else if (_item6._field34 <= 9) {
+ foundVar4 = false;
+ for (i = 0; i <= 7; i++) {
+ if (subC2BF8(&_arrunkObj1337[2]._arr2[i], Common::Point(_item6._field36.x + 12, _item6._field36.y + 12)) != 0) {
+ foundVar4 = true;
+ break;
+ }
+ }
+ if ((foundVar4) && (_arrunkObj1337[2]._arr2[i]._field34 == 1)) {
+ foundVar4 = false;
+ int j;
+ for (j = 0; j <= 7; j++) {
+ if (_item6._field34 == _arrunkObj1337[2]._arr2[j]._field34) {
+ foundVar4 = true;
+ break;
+ }
+ }
+ if (foundVar4) {
+ actionDisplay(1330, 34, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ } else if (subC27B5(_arrunkObj1337[2]._arr3[0]._field34) != -1) {
+ actionDisplay(1330, 35, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ } else {
+ if (j == 7)
+ _field424A = 2;
+
+ subC33C0(&_item6, &_arrunkObj1337[2]._arr2[i]);
+ return;
+ }
+ } else {
+ actionDisplay(1330, 37, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ }
+ } else {
+ if ((_item6._field34 == 26) || (_item6._field34 == 30) ||(_item6._field34 == 32) || (_item6._field34 == 28)) {
+ if (subC2BF8(&_arrunkObj1337[2]._arr3[0], Common::Point(_item6._field36.x + 12, _item6._field36.y + 12)) != 0) {
+ actionDisplay(1330, 42, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ } else if (!subC3386(_arrunkObj1337[2]._arr3[0]._field34, _item6._field34)) {
+ if (_arrunkObj1337[2]._arr3[0]._field34 != 0) {
+ switch (_arrunkObj1337[2]._arr3[0]._field34) {
+ case 11:
+ actionDisplay(1330, 68, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ case 14:
+ actionDisplay(1330, 80, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ case 16:
+ actionDisplay(1330, 84, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ case 24:
+ actionDisplay(1330, 96, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ default:
+ break;
+ }
+ } else {
+ actionDisplay(1330, 41, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ }
+ } else {
+ subC34A1(&_item6, &_arrunkObj1337[2]._arr3[0]);
+ return;
+ }
+ } else {
+ if ((subC27F9(_item6._field34) == -1) && (subC27B5(_item6._field34) == -1)) {
+ if (_item6._field34 == 13) {
+ if (subC2BF8(&_arrunkObj1337[0]._arr4[0], Common::Point(_item6._field36.x + 12, _item6._field36.y + 12)) != 0) {
+ for (int k = 0; k <= 7; k++) {
+ if (_arrunkObj1337[0]._arr2[k]._field34 != 0) {
+ found = true;
+ subC358E(&_item6, 0);
+ }
+ }
+
+ if (!found)
+ actionDisplay(1330, 74, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ } else if (subC2BF8(&_arrunkObj1337[3]._arr4[0], Common::Point(_item6._field36.x + 12, _item6._field36.y + 12)) != 0) {
+ for (int k = 0; k <= 7; k++) {
+ if (_arrunkObj1337[3]._arr2[k]._field34 != 0) {
+ found = true;
+ subC358E(&_item6, 3);
+ }
+ }
+ if (!found)
+ actionDisplay(1330, 74, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ } else if (subC2BF8(&_arrunkObj1337[1]._arr4[0], Common::Point(_item6._field36.x + 12, _item6._field36.y + 12)) != 0) {
+ for (int k = 0; k <= 7; k++) {
+ if (_arrunkObj1337[1]._arr2[k]._field34 == 0) {
+ found = true;
+ subC358E(&_item6, 1);
+ }
+ }
+ if (!found)
+ actionDisplay(1330, 74, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ } else {
+ actionDisplay(1330, 128, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ }
+ } else if (_item6._field34 == 25) {
+ int k;
+ if (subC2BF8(&_arrunkObj1337[0]._arr4[0], Common::Point(_item6._field36.x + 12, _item6._field36.y + 12)) != 0) {
+ if ( (_arrunkObj1337[0]._arr1[0]._field34 != 0)
+ || (_arrunkObj1337[0]._arr1[1]._field34 != 0)
+ || (_arrunkObj1337[0]._arr1[2]._field34 != 0)
+ || (_arrunkObj1337[0]._arr1[3]._field34 != 0) ) {
+ for (k = 0; k <= 3; k++){
+ if (_arrunkObj1337[2]._arr1[k]._field34 == 0)
+ break;
+ }
+ subC318B(2, &_arrunkObj1337[2]._arr1[k], 0);
+ return;
+ } else {
+ actionDisplay(1330, 99, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ }
+ } else if (subC2BF8(&_arrunkObj1337[1]._arr4[0], Common::Point(_item6._field36.x + 12, _item6._field36.y + 12)) != 0) {
+ if ( (_arrunkObj1337[1]._arr1[0]._field34 != 0)
+ || (_arrunkObj1337[1]._arr1[1]._field34 != 0)
+ || (_arrunkObj1337[1]._arr1[2]._field34 != 0)
+ || (_arrunkObj1337[1]._arr1[3]._field34 != 0) ) {
+ for (k = 0; k <= 3; k++){
+ if (_arrunkObj1337[2]._arr1[k]._field34 == 0)
+ break;
+ }
+ subC318B(2, &_arrunkObj1337[2]._arr1[k], 1);
+ return;
+ } else {
+ actionDisplay(1330, 99, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ }
+ }
+
+ if (subC2BF8(&_arrunkObj1337[3]._arr4[0], Common::Point(_item6._field36.x + 12, _item6._field36.y + 12)) != 0) {
+ if ( (_arrunkObj1337[3]._arr1[0]._field34 != 0)
+ || (_arrunkObj1337[3]._arr1[1]._field34 != 0)
+ || (_arrunkObj1337[3]._arr1[2]._field34 != 0)
+ || (_arrunkObj1337[3]._arr1[3]._field34 != 0) ) {
+ for (k = 0; k <= 3; k++){
+ if (_arrunkObj1337[2]._arr1[k]._field34 == 0)
+ break;
+ }
+ subC318B(2, &_arrunkObj1337[2]._arr1[k], 3);
+ return;
+ } else {
+ actionDisplay(1330, 99, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ }
+ } else {
+ actionDisplay(1330, 129, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ }
+ } else if (_item6._field34 == 29) {
+ actionDisplay(1330, 136, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ } else if (_item6._field34 == 27) {
+ actionDisplay(1330, 137, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ }
+ } else {
+ if (subC2BF8(&_arrunkObj1337[0]._arr3[0], Common::Point(_item6._field36.x + 12, _item6._field36.y + 12)) != 0) {
+ if (_arrunkObj1337[0]._arr3[0]._field34 != 0) {
+ actionDisplay(1330, 15, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ } else if (!subC32B1(0, _item6._field34)) {
+ switch (_item6._field34) {
+ case 10:
+ actionDisplay(1330, 66, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ case 12:
+ actionDisplay(1330, 70, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ case 15:
+ actionDisplay(1330, 82, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ case 17:
+ actionDisplay(1330, 86, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ case 18:
+ actionDisplay(1330, 88, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ case 19:
+ actionDisplay(1330, 90, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ case 20:
+ actionDisplay(1330, 92, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ case 21:
+ actionDisplay(1330, 94, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ default:
+ break;
+ }
+ } else {
+ subC3456(&_item6, &_arrunkObj1337[0]._arr3[0]);
+ found = true;
+ }
+ } else if (subC2BF8(&_arrunkObj1337[3]._arr3[0], Common::Point(_item6._field36.x + 12, _item6._field36.y + 12)) != 0) {
+ if (_arrunkObj1337[3]._arr3[0]._field34 != 0) {
+ actionDisplay(1330, 17, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ } else if (!subC32B1(3, _item6._field34)) {
+ switch (_item6._field34) {
+ case 10:
+ actionDisplay(1330, 66, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ case 12:
+ actionDisplay(1330, 70, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ case 15:
+ actionDisplay(1330, 82, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ case 17:
+ actionDisplay(1330, 86, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ case 18:
+ actionDisplay(1330, 88, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ case 19:
+ actionDisplay(1330, 90, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ case 20:
+ actionDisplay(1330, 92, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ case 21:
+ actionDisplay(1330, 94, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ default:
+ break;
+ }
+ } else {
+ subC3456(&_item6, &_arrunkObj1337[3]._arr3[0]);
+ found = true;
+ }
+ } else if (subC2BF8(&_arrunkObj1337[1]._arr3[0], Common::Point(_item6._field36.x + 12, _item6._field36.y + 12)) != 0) {
+ if (_arrunkObj1337[1]._arr3[0]._field34 != 0) {
+ actionDisplay(1330, 19, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ } else if (!subC32B1(1, _item6._field34)) {
+ switch (_item6._field34) {
+ case 10:
+ actionDisplay(1330, 66, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ case 12:
+ actionDisplay(1330, 70, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ case 15:
+ actionDisplay(1330, 82, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ case 17:
+ actionDisplay(1330, 86, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ case 18:
+ actionDisplay(1330, 88, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ case 19:
+ actionDisplay(1330, 90, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ case 20:
+ actionDisplay(1330, 92, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ case 21:
+ actionDisplay(1330, 94, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ break;
+ default:
+ break;
+ }
+ } else {
+ subC3456(&_item6, &_arrunkObj1337[1]._arr3[0]);
+ found = true;
+ }
+ } else {
+ actionDisplay(1330, 38, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (found)
+ return;
+ } else {
+ g_globals->_scenePalette.signalListeners();
+ R2_GLOBALS._sceneObjects->draw();
+ g_globals->_events.delay(g_globals->_sceneHandler->_delayTicks);
+ }
+ }
+}
+
+void Scene1337::subD183F(int arg1, int arg2) {
+ if ((R2_GLOBALS._v57709 != 0) || (R2_GLOBALS._v5780C != 0))
+ return;
+
+ R2_GLOBALS._v5780E = arg1 + arg2;
+
+ if (arg2 != 0) {
+ if (R2_GLOBALS._v5780E < 1)
+ R2_GLOBALS._v5780E = 2;
+
+ if (R2_GLOBALS._v5780E > 2)
+ R2_GLOBALS._v5780E = 1;
+ }
+
+ if (R2_GLOBALS._v5780E == 1) {
+ R2_GLOBALS._v57810 = 200;
+ subD195F(1, 4);
+ } else if (R2_GLOBALS._v5780E == 2) {
+ R2_GLOBALS._v57810 = 300;
+ subD195F(1, 5);
+ } else {
+ R2_GLOBALS._v57810 = 0;
+ subD195F(0, 0);
+ }
+}
+
+void Scene1337::subD18B5(int resNum, int rlbNum, int arg3) {
+ warning("STUBBED lvl3 Scene1337::subD18B5()");
+}
+
+int Scene1337::subD18F5() {
+ if (R2_GLOBALS._v57709 == 0)
+ // The cursor looks... very dummy
+ // To be checked
+ warning("TODO: CursorManager.setData(R2_GLOBALS.off_57705)");
+
+ ++R2_GLOBALS._v57709;
+
+ return R2_GLOBALS._v57709;
+}
+
+int Scene1337::subD1917() {
+ if (R2_GLOBALS._v57709 != 0) {
+ R2_GLOBALS._v57709--;
+ if (R2_GLOBALS._v57709 != 0)
+ warning("FIXME: subD195F(_width, _data);");
+ }
+
+ return R2_GLOBALS._v57709;
+}
+
+int Scene1337::subD1940(bool flag) {
+ if (flag)
+ ++R2_GLOBALS._v5780C;
+ else if (R2_GLOBALS._v5780C != 0)
+ --R2_GLOBALS._v5780C;
+
+ return R2_GLOBALS._v5780C;
+}
+
+void Scene1337::subD195F(int arg1, int arg2) {
+ subD18B5(5, arg1, arg2);
+}
+
+void Scene1337::subD1975(int arg1, int arg2) {
+ warning("STUBBED lvl2 Scene1337::subD1975()");
+}
+
+void Scene1337::subD1A48(int arg1) {
+ int tmpVal = -1;
+
+ switch (arg1) {
+ case 200:
+ tmpVal = 141;
+ break;
+ case 300:
+ tmpVal = 142;
+ break;
+ default:
+ MessageDialog::show(WRONG_ANSWER_MSG, OK_BTN_STRING);
+ break;
+ }
+
+ if (tmpVal == -1)
+ return;
+
+ actionDisplay(1330, tmpVal, -1, -1, 1, 220, 1, 5, 0, 105, 0);
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 1500 - Cutscene: Ship landing
+ *
+ *--------------------------------------------------------------------------*/
+void Scene1500::postInit(SceneObjectList *OwnerList) {
+ loadScene(1500);
+ R2_GLOBALS._uiElements._active = false;
+ R2_GLOBALS._v5589E.top = 0;
+ R2_GLOBALS._v5589E.bottom = 200;
+ setZoomPercents(170, 13, 240, 100);
+ SceneExt::postInit();
+ scalePalette(65, 65, 65);
+
+ R2_GLOBALS._player.postInit();
+ R2_GLOBALS._player.hide();
+ R2_GLOBALS._player.disableControl();
+
+ _actor2.postInit();
+ _actor2.setup(1401, 1, 1);
+ _actor2._effect = 5;
+ _actor2.fixPriority(10);
+ _actor2._field9C = _field312;
+
+ _actor1.postInit();
+ _actor1.setup(1400, 1, 1);
+ _actor1._moveDiff = Common::Point(1, 1);
+ _actor1._linkedActor = &_actor2;
+
+ if (R2_GLOBALS._sceneManager._previousScene != 1010) {
+ _actor4.postInit();
+ _actor4.setup(1401, 2, 1);
+ _actor4._effect = 5;
+ _actor4.fixPriority(10);
+ _actor4._field9C = _field312;
+
+ _actor3.postInit();
+ _actor3._moveRate = 30;
+ _actor3._moveDiff = Common::Point(1, 1);
+ _actor3._linkedActor = &_actor4;
+ }
+
+ if (R2_GLOBALS._sceneManager._previousScene == 300) {
+ _actor1.setPosition(Common::Point(189, 139), 5);
+
+ _actor3.setup(1400, 1, 2);
+ _actor3.setPosition(Common::Point(148, 108), 0);
+
+ _sceneMode = 20;
+ R2_GLOBALS._sound1.play(110);
+ } else if (R2_GLOBALS._sceneManager._previousScene == 1550) {
+ _actor1.setPosition(Common::Point(189, 139), 5);
+
+ _actor3.setup(1400, 2, 1);
+ _actor3.changeZoom(-1);
+ _actor3.setPosition(Common::Point(298, 258), 5);
+
+ _sceneMode = 10;
+ R2_GLOBALS._sound1.play(106);
+ } else {
+ _actor1.setPosition(Common::Point(289, 239), -30);
+ _sceneMode = 0;
+ R2_GLOBALS._sound1.play(102);
+ }
+ signal();
+}
+
+void Scene1500::remove() {
+ R2_GLOBALS._v5589E.top = 3;
+ R2_GLOBALS._v5589E.bottom = 168;
+ R2_GLOBALS._uiElements._active = true;
+
+ SceneExt::remove();
+}
+
+void Scene1500::signal() {
+ switch(_sceneMode++) {
+ case 0:
+ R2_GLOBALS.setFlag(25);
+ setAction(&_sequenceManager, this, 1, &R2_GLOBALS._player, NULL);
+ // No break on purpose
+ case 1:
+ if (_actor1._yDiff < 50) {
+ _actor1.setPosition(Common::Point(289, 239), _actor1._yDiff + 1);
+ _sceneMode = 1;
+ }
+ setAction(&_sequenceManager, this, 1, &R2_GLOBALS._player, NULL);
+ break;
+ case 2: {
+ Common::Point pt(189, 139);
+ NpcMover *mover = new NpcMover();
+ _actor1.addMover(mover, &pt, this);
+ }
+ break;
+ case 3:
+ if (_actor1._yDiff > 5) {
+ _actor1.setPosition(Common::Point(189, 139), _actor1._yDiff - 1);
+ _sceneMode = 3;
+ }
+ setAction(&_sequenceManager, this, 1, &R2_GLOBALS._player, NULL);
+ break;
+ case 13:
+ R2_GLOBALS._player._characterIndex = R2_MIRANDA;
+ // No break on purpose
+ case 4:
+ R2_GLOBALS._sceneManager.changeScene(300);
+ break;
+ case 10:
+ // No break on purpose
+ case 20:
+ setAction(&_sequenceManager, this, 1, &R2_GLOBALS._player, NULL);
+ break;
+ case 11: {
+ Common::Point pt(148, 108);
+ NpcMover *mover = new NpcMover();
+ _actor3.addMover(mover, &pt, this);
+ }
+ break;
+ case 12:
+ setAction(&_sequenceManager, this, 2, &R2_GLOBALS._player, NULL);
+ break;
+ case 21: {
+ Common::Point pt(-2, -42);
+ NpcMover *mover = new NpcMover();
+ _actor3.addMover(mover, &pt, NULL);
+ signal();
+ }
+ break;
+ case 22:
+ if (_actor1._yDiff < 50) {
+ _actor1.setPosition(Common::Point(189, 139), _actor1._yDiff + 1);
+ _sceneMode = 22;
+ }
+ setAction(&_sequenceManager, this, 1, &R2_GLOBALS._player, NULL);
+ break;
+ case 23: {
+ Common::Point pt(-13, -61);
+ NpcMover *mover = new NpcMover();
+ _actor1.addMover(mover, &pt, this);
+ }
+ break;
+ case 24:
+ R2_GLOBALS._sceneManager.changeScene(300);
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene1500::dispatch() {
+ if (_sceneMode > 10) {
+ float yDiff = sqrt((float) (_actor3._position.x * _actor3._position.x) + (_actor3._position.y * _actor3._position.y));
+ if (yDiff > 6)
+ _actor3.setPosition(_actor3._position, (int) yDiff);
+ }
+
+ Scene::dispatch();
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 1525 - Cutscene - Ship
+ *
+ *--------------------------------------------------------------------------*/
+void Scene1525::postInit(SceneObjectList *OwnerList) {
+ loadScene(1525);
+ R2_GLOBALS._uiElements._active = false;
+ SceneExt::postInit();
+
+ R2_GLOBALS._player.postInit();
+ if (R2_GLOBALS._sceneManager._previousScene == 525)
+ R2_GLOBALS._player.setup(1525, 1, 1);
+ else
+ R2_GLOBALS._player.setup(1525, 1, 16);
+ R2_GLOBALS._player.setPosition(Common::Point(244, 148));
+ R2_GLOBALS._player.disableControl();
+
+ _sceneMode = 0;
+ setAction(&_sequenceManager, this, 2, &R2_GLOBALS._player, NULL);
+}
+
+void Scene1525::signal() {
+ switch (_sceneMode++) {
+ case 0:
+ if (R2_GLOBALS._sceneManager._previousScene == 525)
+ setAction(&_sequenceManager, this, 1525, &R2_GLOBALS._player, NULL);
+ else
+ setAction(&_sequenceManager, this, 1526, &R2_GLOBALS._player, NULL);
+ break;
+ case 1:
+ setAction(&_sequenceManager, this, 2, &R2_GLOBALS._player, NULL);
+ break;
+ case 2:
+ if (R2_GLOBALS._sceneManager._previousScene == 1530)
+ R2_GLOBALS._sceneManager.changeScene(1550);
+ else
+ R2_GLOBALS._sceneManager.changeScene(1530);
+ default:
+ break;
+ }
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 1530 - Cutscene - Elevator
+ *
+ *--------------------------------------------------------------------------*/
+void Scene1530::postInit(SceneObjectList *OwnerList) {
+ if (R2_GLOBALS._sceneManager._previousScene == 1000)
+ loadScene(1650);
+ else if (R2_GLOBALS._sceneManager._previousScene == 1580)
+ loadScene(1550);
+ else
+ loadScene(1530);
+
+ R2_GLOBALS._uiElements._active = false;
+ SceneExt::postInit();
+
+ _stripManager.addSpeaker(&_quinnSpeaker);
+ _stripManager.addSpeaker(&_seekerSpeaker);
+
+ if (R2_GLOBALS._sceneManager._previousScene == 1000) {
+ R2_GLOBALS._player.postInit();
+ R2_GLOBALS._player.hide();
+ R2_GLOBALS._player.disableControl();
+
+ R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS);
+ _stripManager.start(538, this);
+ R2_GLOBALS._sound1.play(114);
+
+ _sceneMode = 3;
+ } else if (R2_GLOBALS._sceneManager._previousScene == 1580) {
+ R2_GLOBALS._player.postInit();
+ R2_GLOBALS._player._characterIndex = R2_QUINN;
+ R2_GLOBALS._player.setObjectWrapper(NULL);
+ R2_GLOBALS._player.setup(1516, 6, 1);
+ R2_GLOBALS._player.setPosition(Common::Point(160, 125));
+ R2_GLOBALS._player._moveRate = 30;
+ R2_GLOBALS._player._moveDiff = Common::Point(4, 1);
+
+ _actor2.postInit();
+ _actor2.setup(1516, 7, 1);
+ _actor2.setPosition(Common::Point(121, 41));
+ _actor2.animate(ANIM_MODE_2, NULL);
+
+ _actor3.postInit();
+ _actor3.setup(1516, 8, 1);
+ _actor3.setPosition(Common::Point(107, 116));
+ _actor3.animate(ANIM_MODE_2, NULL);
+
+ R2_GLOBALS._player.disableControl();
+ Common::Point pt(480, 75);
+ NpcMover *mover = new NpcMover();
+ R2_GLOBALS._player.addMover(mover, &pt, this);
+ R2_GLOBALS._sound1.play(111);
+
+ _sceneMode = 1;
+ } else {
+ _actor1.postInit();
+ _actor1._effect = 1;
+
+ R2_GLOBALS._player.postInit();
+ R2_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+ R2_GLOBALS._player.disableControl();
+
+ setAction(&_sequenceManager, this, 1530, &R2_GLOBALS._player, &_actor1, NULL);
+
+ _sceneMode = 2;
+ }
+
+}
+
+void Scene1530::signal() {
+ switch (_sceneMode - 1) {
+ case 0:
+ R2_GLOBALS._sceneManager.changeScene(1000);
+ break;
+ case 1:
+ R2_GLOBALS._sceneManager.changeScene(1525);
+ break;
+ case 2:
+ R2_GLOBALS._player.disableControl();
+ _sceneMode = 4;
+ R2_GLOBALS._player.show();
+ setAction(&_sequenceManager, this, 1650, &R2_GLOBALS._player, NULL);
+ break;
+ case 3:
+ R2_GLOBALS._sceneManager.changeScene(1700);
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene1530::dispatch() {
+ int16 x = R2_GLOBALS._player._position.x;
+ int16 y = R2_GLOBALS._player._position.y;
+
+ _actor2.setPosition(Common::Point(x - 39, y - 85));
+ _actor3.setPosition(Common::Point(x - 53, y - 9));
+
+ Scene::dispatch();
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 1550 -
+ *
+ *--------------------------------------------------------------------------*/
+Scene1550::UnkObj15501::UnkObj15501() {
+ _fieldA4 = _fieldA6 = 0;
+}
+
+void Scene1550::UnkObj15501::synchronize(Serializer &s) {
+ SceneActor::synchronize(s);
+
+ s.syncAsSint16LE(_fieldA4);
+ s.syncAsSint16LE(_fieldA6);
+}
+
+bool Scene1550::UnkObj15501::startAction(CursorType action, Event &event) {
+ Scene1550 *scene = (Scene1550 *)R2_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_USE:
+ if (_visage == 1561) {
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 40;
+ Common::Point pt(_position.x + 5, _position.y + 20);
+ PlayerMover *mover = new PlayerMover();
+ R2_GLOBALS._player.addMover(mover, &pt, scene);
+ return true;
+ }
+ return SceneActor::startAction(action, event);
+ break;
+ case CURSOR_LOOK:
+ if (_visage == 1561) {
+ switch (_frame) {
+ case 2:
+ SceneItem::display(1550, 23, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ break;
+ case 3:
+ SceneItem::display(1550, 26, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ break;
+ case 4:
+ SceneItem::display(1550, 35, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ break;
+ default:
+ break;
+ }
+ } else {
+ switch ((((_strip - 1) * 5) + _frame) % 3) {
+ case 0:
+ SceneItem::display(1550, 62, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ break;
+ case 1:
+ SceneItem::display(1550, 53, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ break;
+ case 2:
+ SceneItem::display(1550, 76, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ break;
+ default:
+ break;
+ }
+ }
+ return true;
+ break;
+ default:
+ return SceneActor::startAction(action, event);
+ break;
+ }
+}
+
+Scene1550::UnkObj15502::UnkObj15502() {
+ _fieldA4 = 0;
+}
+
+void Scene1550::UnkObj15502::synchronize(Serializer &s) {
+ SceneActor::synchronize(s);
+
+ s.syncAsSint16LE(_fieldA4);
+}
+
+bool Scene1550::UnkObj15502::startAction(CursorType action, Event &event) {
+ Scene1550 *scene = (Scene1550 *)R2_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_USE:
+ if (_fieldA4 == 8) {
+ scene->_field412 = 1;
+ R2_GLOBALS._player.disableControl();
+ if (R2_GLOBALS._player._characterIndex == 1)
+ scene->_sceneMode = 1576;
+ else
+ scene->_sceneMode = 1584;
+ // strcpy(scene->_arrUnkObj15502[7]._actorName, 'hatch');
+ scene->setAction(&scene->_sequenceManager1, scene, scene->_sceneMode, &R2_GLOBALS._player, &scene->_arrUnkObj15502[7], NULL);
+ return true;
+ }
+ return SceneActor::startAction(action, event);
+ break;
+ case CURSOR_LOOK:
+ if (_fieldA4 == 8)
+ SceneItem::display(1550, 75, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ else if (_frame == 1)
+ SceneItem::display(1550, 70, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ else
+ SceneItem::display(1550, 71, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ return true;
+ break;
+ case R2_FUEL_CELL:
+ scene->_field412 = 1;
+ if (_fieldA4 == 6) {
+ R2_GLOBALS._player.disableControl();
+ scene->_actor1.postInit();
+ if (R2_GLOBALS._player._characterIndex == 1)
+ scene->_sceneMode = 1574;
+ else
+ scene->_sceneMode = 1582;
+ scene->setAction(&scene->_sequenceManager1, scene, scene->_sceneMode, &R2_GLOBALS._player, &scene->_arrUnkObj15502[5], &scene->_actor1, NULL);
+ return true;
+ }
+ return SceneActor::startAction(action, event);
+ break;
+ case R2_GYROSCOPE:
+ scene->_field412 = 1;
+ if (_fieldA4 == 3) {
+ R2_GLOBALS._player.disableControl();
+ scene->_actor1.postInit();
+ if (R2_GLOBALS._player._characterIndex == 1)
+ scene->_sceneMode = 1571;
+ else
+ scene->_sceneMode = 1581;
+ scene->setAction(&scene->_sequenceManager1, scene, scene->_sceneMode, &R2_GLOBALS._player, &scene->_arrUnkObj15502[2], &scene->_actor1, NULL);
+ return true;
+ }
+ return SceneActor::startAction(action, event);
+ break;
+ case R2_GUIDANCE_MODULE:
+ scene->_field412 = 1;
+ if (_fieldA4 == 1) {
+ R2_GLOBALS._player.disableControl();
+ scene->_actor1.postInit();
+ if (R2_GLOBALS._player._characterIndex == 1)
+ scene->_sceneMode = 1569;
+ else
+ scene->_sceneMode = 1579;
+ scene->setAction(&scene->_sequenceManager1, scene, scene->_sceneMode, &R2_GLOBALS._player, &scene->_arrUnkObj15502[0], &scene->_actor1, NULL);
+ return true;
+ }
+ return SceneActor::startAction(action, event);
+ break;
+ case R2_THRUSTER_VALVE:
+ scene->_field412 = 1;
+ if (_fieldA4 == 4) {
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 1572;
+ scene->_actor1.postInit();
+ scene->setAction(&scene->_sequenceManager1, scene, scene->_sceneMode, &R2_GLOBALS._player, &scene->_arrUnkObj15502[3], &scene->_actor1, NULL);
+ return true;
+ }
+ return SceneActor::startAction(action, event);
+ break;
+ case R2_RADAR_MECHANISM:
+ scene->_field412 = 1;
+ if (_fieldA4 == 2) {
+ R2_GLOBALS._player.disableControl();
+ scene->_actor1.postInit();
+ if (R2_GLOBALS._player._characterIndex == 1)
+ scene->_sceneMode = 1570;
+ else
+ scene->_sceneMode = 1580;
+ scene->setAction(&scene->_sequenceManager1, scene, scene->_sceneMode, &R2_GLOBALS._player, &scene->_arrUnkObj15502[1], &scene->_actor1, NULL);
+ return true;
+ }
+ return SceneActor::startAction(action, event);
+ break;
+ case R2_IGNITOR:
+ scene->_field412 = 1;
+ if (_fieldA4 == 5) {
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 1573;
+ scene->_actor1.postInit();
+ scene->setAction(&scene->_sequenceManager1, scene, scene->_sceneMode, &R2_GLOBALS._player, &scene->_arrUnkObj15502[4], &scene->_actor1, NULL);
+ return true;
+ }
+ return SceneActor::startAction(action, event);
+ break;
+ case R2_BATTERY:
+ scene->_field412 = 1;
+ if (_fieldA4 == 7) {
+ R2_GLOBALS._player.disableControl();
+ scene->_actor1.postInit();
+ if (R2_GLOBALS._player._characterIndex == 1)
+ scene->_sceneMode = 1575;
+ else
+ scene->_sceneMode = 1583;
+ scene->setAction(&scene->_sequenceManager1, scene, scene->_sceneMode, &R2_GLOBALS._player, &scene->_arrUnkObj15502[6], &scene->_actor1, NULL);
+ return true;
+ }
+ return SceneActor::startAction(action, event);
+ break;
+ default:
+ return SceneActor::startAction(action, event);
+ break;
+ }
+}
+
+void Scene1550::UnkObj15502::subA5CDF(int strip) {
+ _fieldA4 = strip;
+ postInit();
+ setup(1517, _fieldA4, 1);
+ switch (_fieldA4 - 1) {
+ case 0:
+ if (R2_INVENTORY.getObjectScene(R2_GUIDANCE_MODULE) == 0)
+ setFrame(5);
+ setPosition(Common::Point(287, 85));
+ break;
+ case 1:
+ if (R2_INVENTORY.getObjectScene(R2_RADAR_MECHANISM) == 0)
+ setFrame(5);
+ setPosition(Common::Point(248, 100));
+ break;
+ case 2:
+ if (R2_INVENTORY.getObjectScene(R2_DIAGNOSTICS_DISPLAY) == 0)
+ setFrame(5);
+ setPosition(Common::Point(217, 85));
+ break;
+ case 3:
+ if (R2_INVENTORY.getObjectScene(R2_THRUSTER_VALVE))
+ setFrame(5);
+ setPosition(Common::Point(161, 121));
+ break;
+ case 4:
+ if (R2_INVENTORY.getObjectScene(R2_IGNITOR))
+ setFrame(5);
+ setPosition(Common::Point(117, 121));
+ break;
+ case 5:
+ if (R2_INVENTORY.getObjectScene(R2_FUEL_CELL))
+ setFrame(5);
+ setPosition(Common::Point(111, 85));
+ break;
+ case 6:
+ if (R2_INVENTORY.getObjectScene(R2_BATTERY))
+ setFrame(5);
+ setPosition(Common::Point(95, 84));
+ break;
+ case 7: {
+ setup(1516, 1, 1);
+ setPosition(Common::Point(201, 45));
+ Scene1550 *scene = (Scene1550 *)R2_GLOBALS._sceneManager._scene;
+ if ((scene->_sceneMode == 1577) || (scene->_sceneMode == 1578))
+ hide();
+ fixPriority(92);
+ setDetails(1550, 70, -1, -1, 2, (SceneItem *) NULL);
+ }
+ break;
+ default:
+ break;
+ }
+}
+
+Scene1550::UnkObj15503::UnkObj15503() {
+ _fieldA4 = 0;
+}
+
+void Scene1550::UnkObj15503::synchronize(Serializer &s) {
+ SceneActor::synchronize(s);
+
+ s.syncAsSint16LE(_fieldA4);
+}
+
+bool Scene1550::UnkObj15503::startAction(CursorType action, Event &event) {
+ Scene1550 *scene = (Scene1550 *)R2_GLOBALS._sceneManager._scene;
+
+ if (action != CURSOR_USE)
+ return SceneActor::startAction(action, event);
+ switch (_fieldA4) {
+ case 1:
+ if (scene->_actor13._frame == 5) {
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 25;
+ if (scene->_actor4._frame == 1) {
+ scene->setAction(&scene->_sequenceManager1, scene, 1560, &scene->_actor4, NULL);
+ R2_GLOBALS.setFlag(20);
+ setFrame(2);
+ } else {
+ scene->setAction(&scene->_sequenceManager1, scene, 1561, &scene->_actor4, NULL);
+ R2_GLOBALS.clearFlag(20);
+ setFrame(1);
+ }
+ scene->_unkArea1.remove();
+ }
+ break;
+ case 2:
+ R2_GLOBALS._player.disableControl();
+ if (scene->_actor13._frame == 1) {
+ scene->_sceneMode = 23;
+ scene->setAction(&scene->_sequenceManager1, scene, 1560, this, NULL);
+ } else {
+ if (scene->_actor4._frame == 1)
+ scene->_sceneMode = 24;
+ else
+ scene->_sceneMode = 22;
+ scene->setAction(&scene->_sequenceManager1, scene, 1561, this, NULL);
+ }
+ break;
+ default:
+ break;
+ }
+ return true;
+}
+
+void Scene1550::UnkArea1550::remove() {
+ Scene1550 *scene = (Scene1550 *)R2_GLOBALS._sceneManager._scene;
+
+ _unkObj155031.remove();
+ _unkObj155032.remove();
+ // sub201EA is a common part with UnkArea1200
+ R2_GLOBALS._sceneItems.remove((SceneItem *)this);
+ _areaActor.remove();
+ SceneArea::remove();
+ R2_GLOBALS._insetUp--;
+ //
+ if ((scene->_sceneMode >= 20) && (scene->_sceneMode <= 29))
+ return;
+
+ R2_GLOBALS._player.disableControl();
+ if (scene->_actor4._frame == 1) {
+ scene->_sceneMode = 1559;
+ scene->setAction(&scene->_sequenceManager1, scene, 1559, &R2_GLOBALS._player, NULL);
+ } else {
+ scene->_sceneMode = 1562;
+ scene->setAction(&scene->_sequenceManager1, scene, 1562, &R2_GLOBALS._player, NULL);
+ }
+}
+
+void Scene1550::UnkArea1550::process(Event &event) {
+// This is a copy of Scene1200::Area1::process
+ if (_field20 != R2_GLOBALS._insetUp)
+ return;
+
+ CursorType cursor = R2_GLOBALS._events.getCursor();
+
+ if (_areaActor._bounds.contains(event.mousePos.x + g_globals->gfxManager()._bounds.left , event.mousePos.y)) {
+ if (cursor == _cursorNum)
+ warning("TODO: _cursorState = ???");
+ R2_GLOBALS._events.setCursor(_savedCursorNum); //, _cursorState);
+ } else if (event.mousePos.y < 168) {
+ if (cursor != _cursorNum) {
+ _savedCursorNum = cursor;
+ warning("TODO: _cursorState = ???");
+ R2_GLOBALS._events.setCursor(CURSOR_INVALID);
+ }
+ if (event.eventType == EVENT_BUTTON_DOWN) {
+ event.handled = true;
+ warning("TODO: _cursorState = ???");
+ R2_GLOBALS._events.setCursor(_savedCursorNum); //, _cursorState);
+ remove();
+ }
+ }
+}
+
+void Scene1550::UnkArea1550::proc12(int visage, int stripFrameNum, int frameNum, int posX, int posY) {
+ // UnkArea1200::proc12();
+ Scene1550 *scene = (Scene1550 *)R2_GLOBALS._sceneManager._scene;
+
+ _areaActor.postInit();
+ _areaActor.setup(visage, stripFrameNum, frameNum);
+ _areaActor.setPosition(Common::Point(posX, posY));
+ _areaActor.fixPriority(250);
+ _cursorNum = CURSOR_INVALID;
+ scene->_sceneAreas.push_front(this);
+ ++R2_GLOBALS._insetUp;
+ _field20 = R2_GLOBALS._insetUp;
+ //
+
+ proc13(1550, 67, -1, -1);
+ _unkObj155031.postInit();
+ _unkObj155031._fieldA4 = 1;
+ if (scene->_actor4._frame == 1)
+ _unkObj155031.setup(1559, 3, 1);
+ else
+ _unkObj155031.setup(1559, 3, 2);
+ _unkObj155031.setPosition(Common::Point(142, 79));
+ _unkObj155031.fixPriority(251);
+ _unkObj155031.setDetails(1550, 68, -1, -1, 2, (SceneItem *) NULL);
+
+ _unkObj155032.postInit();
+ _unkObj155032._numFrames = 5;
+ _unkObj155032._fieldA4 = 2;
+ if (scene->_actor13._frame == 1)
+ _unkObj155032.setup(1559, 2, 1);
+ else
+ _unkObj155032.setup(1559, 2, 2);
+ _unkObj155032.setPosition(Common::Point(156, 103));
+ _unkObj155032.fixPriority(251);
+ _unkObj155032.setDetails(1550, 69, -1, -1, 2, (SceneItem *) NULL);
+}
+
+void Scene1550::UnkArea1550::proc13(int resNum, int lookLineNum, int talkLineNum, int useLineNum) {
+ // Copy of Scene1200::Area1::proc13
+ _areaActor.setDetails(resNum, lookLineNum, talkLineNum, useLineNum, 2, (SceneItem *) NULL);
+}
+
+bool Scene1550::Hotspot1::startAction(CursorType action, Event &event) {
+ return SceneHotspot::startAction(action, event);
+}
+
+bool Scene1550::Hotspot3::startAction(CursorType action, Event &event) {
+ // Arrays related to this scene are all hacky in the origina: they are based on the impossibility to use Miranda
+ assert ((R2_GLOBALS._player._characterIndex == 1) || (R2_GLOBALS._player._characterIndex == 2));
+ // The original contains a debug message when CURSOR_TALK is used.
+ // This part is totally useless, we could remove it (and the entire function as well)
+ if (action == CURSOR_TALK)
+ warning("Location: %d/%d - %d", R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex], R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex + 2], k5A4D6[(R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex + 2] * 30)] + R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex]);
+
+ return SceneHotspot::startAction(action, event);
+}
+
+bool Scene1550::Actor6::startAction(CursorType action, Event &event) {
+ return SceneActor::startAction(action, event);
+}
+
+bool Scene1550::Actor7::startAction(CursorType action, Event &event) {
+ if (action != CURSOR_TALK)
+ return SceneActor::startAction(action, event);
+
+ Scene1550 *scene = (Scene1550 *)R2_GLOBALS._sceneManager._scene;
+ scene->_sceneMode = 80;
+ scene->signal();
+
+ return true;
+}
+
+bool Scene1550::Actor8::startAction(CursorType action, Event &event) {
+ if (action != CURSOR_USE)
+ return SceneActor::startAction(action, event);
+
+ R2_GLOBALS._player.disableControl();
+ Scene1550 *scene = (Scene1550 *)R2_GLOBALS._sceneManager._scene;
+ scene->_field412 = 1;
+ if (R2_GLOBALS._player._characterIndex == 1)
+ scene->_sceneMode = 1552;
+ else
+ scene->_sceneMode = 1588;
+
+ scene->setAction(&scene->_sequenceManager1, scene, scene->_sceneMode, &R2_GLOBALS._player, &scene->_actor8, NULL);
+ return true;
+}
+
+bool Scene1550::Actor9::startAction(CursorType action, Event &event) {
+ Scene1550 *scene = (Scene1550 *)R2_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_USE:
+ scene->_sceneMode = 50;
+ R2_GLOBALS._player.disableControl();
+ R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS);
+ if (R2_GLOBALS._player._characterIndex == 1)
+ scene->_stripManager.start(518, scene);
+ else
+ scene->_stripManager.start(520, scene);
+ return true;
+ break;
+ case CURSOR_LOOK:
+ SceneItem::display(1550, 41, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ return true;
+ break;
+ default:
+ return SceneActor::startAction(action, event);
+ }
+}
+
+bool Scene1550::Actor10::startAction(CursorType action, Event &event) {
+ if (action != CURSOR_USE)
+ return SceneActor::startAction(action, event);
+
+ Scene1550 *scene = (Scene1550 *)R2_GLOBALS._sceneManager._scene;
+ R2_GLOBALS._player.disableControl();
+ if (R2_GLOBALS._player._characterIndex == 1)
+ scene->_sceneMode = 1555;
+ else
+ scene->_sceneMode = 1589;
+
+ scene->setAction(&scene->_sequenceManager1, scene, scene->_sceneMode, &R2_GLOBALS._player, &scene->_actor10, NULL);
+ return true;
+}
+
+bool Scene1550::Actor11::startAction(CursorType action, Event &event) {
+ if (action != CURSOR_USE)
+ return SceneActor::startAction(action, event);
+
+ Scene1550 *scene = (Scene1550 *)R2_GLOBALS._sceneManager._scene;
+ R2_GLOBALS._player.disableControl();
+ scene->_field412 = 1;
+ if (R2_GLOBALS._player._characterIndex == 1)
+ scene->_sceneMode = 1586;
+ else
+ scene->_sceneMode = 1587;
+
+ scene->setAction(&scene->_sequenceManager1, scene, scene->_sceneMode, &R2_GLOBALS._player, &scene->_actor11, NULL);
+ return true;
+}
+
+bool Scene1550::Actor12::startAction(CursorType action, Event &event) {
+ if (action != CURSOR_USE)
+ return SceneActor::startAction(action, event);
+
+ Scene1550 *scene = (Scene1550 *)R2_GLOBALS._sceneManager._scene;
+
+ if (R2_GLOBALS._player._characterIndex == 2) {
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 1585;
+ scene->setAction(&scene->_sequenceManager1, scene, 1585, &R2_GLOBALS._player, NULL);
+ } else {
+ R2_GLOBALS._player.disableControl();
+ switch(scene->_field415) {
+ case 0:
+ scene->_actor13.fixPriority(168);
+ scene->_actor4.fixPriority(125);
+ scene->_sceneMode = 1558;
+ scene->setAction(&scene->_sequenceManager1, scene, 1558, &R2_GLOBALS._player, NULL);
+ break;
+ case 1:
+ return SceneActor::startAction(action, event);
+ break;
+ case 2:
+ scene->_field415 = 1;
+ scene->_sceneMode = 1563;
+ scene->setAction(&scene->_sequenceManager1, scene, 1563, &R2_GLOBALS._player, &scene->_actor4, NULL);
+ break;
+ default:
+ break;
+ }
+ }
+ return true;
+
+}
+
+bool Scene1550::Actor13::startAction(CursorType action, Event &event) {
+ Scene1550 *scene = (Scene1550 *)R2_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_USE:
+ if (scene->_field415 != 2)
+ return SceneActor::startAction(action, event);
+
+ if (R2_INVENTORY.getObjectScene(R2_BATTERY) == 1550) {
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 1564;
+ scene->setAction(&scene->_sequenceManager1, scene, 1564, &R2_GLOBALS._player, NULL);
+ } else
+ SceneItem::display(1550, 64, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ return true;
+ break;
+ case CURSOR_LOOK:
+ if (scene->_field415 != 2)
+ return SceneActor::startAction(action, event);
+
+ if (R2_INVENTORY.getObjectScene(R2_BATTERY) == 1550) {
+ SceneItem::display(1550, 74, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ } else
+ SceneItem::display(1550, 64, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ return true;
+ break;
+ default:
+ return SceneActor::startAction(action, event);
+ break;
+ }
+}
+
+Scene1550::Scene1550() {
+ _field412 = 0;
+ _field414 = 0;
+ _field415 = 0;
+ _field417 = 0;
+ _field419 = 0;
+}
+
+void Scene1550::synchronize(Serializer &s) {
+ SceneExt::synchronize(s);
+
+ s.syncAsSint16LE(_field412);
+ s.syncAsByte(_field414);
+ s.syncAsSint16LE(_field415);
+ s.syncAsSint16LE(_field417);
+ s.syncAsSint16LE(_field419);
+}
+
+void Scene1550::postInit(SceneObjectList *OwnerList) {
+ if ((R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex] == 9) && (R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex + 2] == 11))
+ loadScene(1234);
+ else
+ loadScene(1550);
+
+ scalePalette(65, 65, 65);
+ setZoomPercents(30, 75, 170, 100);
+ _field417 = 1550;
+ _field419 = 0;
+ SceneExt::postInit();
+
+ if (R2_GLOBALS._sceneManager._previousScene == -1)
+ R2_GLOBALS.setFlag(R2_ATTRACTOR_CABLE_HARNESS);
+
+ if ((R2_GLOBALS._player._characterScene[1] != 1550) && (R2_GLOBALS._player._characterScene[1] != 1580)) {
+ R2_GLOBALS._player._characterScene[1] = 1550;
+ R2_GLOBALS._player._characterScene[2] = 1550;
+ }
+
+ _stripManager.setColors(60, 255);
+ _stripManager.setFontNumber(3);
+ _stripManager.addSpeaker(&_quinnSpeaker);
+ _stripManager.addSpeaker(&_seekerSpeaker);
+
+ R2_GLOBALS._player.postInit();
+ R2_GLOBALS._player._effect = 6;
+
+ if (R2_GLOBALS._player._characterIndex == 1)
+ R2_GLOBALS._player.setup(1500, 3, 1);
+ else
+ R2_GLOBALS._player.setup(1505, 3, 1);
+
+ R2_GLOBALS._player._moveDiff = Common::Point(5, 3);
+
+ if ((R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex] == 9) && (R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex + 2] == 11))
+ R2_GLOBALS._player.setPosition(Common::Point(157, 135));
+ else
+ R2_GLOBALS._player.setPosition(Common::Point(160, 100));
+
+ R2_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+ R2_GLOBALS._player.disableControl();
+
+ _field414 = 0;
+ _actor7.changeZoom(-1);
+ R2_GLOBALS._player.changeZoom(-1);
+
+ switch (R2_GLOBALS._sceneManager._previousScene) {
+ case 1530:
+ R2_GLOBALS._v565AE = 0;
+ // No break on purpose
+ case 300:
+ // No break on purpose
+ case 1500:
+ // No break on purpose
+ case 3150:
+ R2_GLOBALS._sound1.play(105);
+ break;
+ case 1580:
+ if (R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] == 1580) {
+ R2_GLOBALS._player.disableControl();
+ R2_GLOBALS._player.animate(ANIM_MODE_NONE, NULL);
+
+ _field412 = 1;
+
+ _actor1.postInit();
+ _arrUnkObj15502[7].subA5CDF(8);
+ _arrUnkObj15502[7].hide();
+ if (R2_GLOBALS._player._characterIndex == 1)
+ _sceneMode = 1577;
+ else
+ _sceneMode = 1578;
+
+ setAction(&_sequenceManager1, this, _sceneMode, &R2_GLOBALS._player, &_actor1, &_arrUnkObj15502[7], NULL);
+ R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] = 1550;
+ } else {
+ R2_GLOBALS._player.enableControl();
+ }
+ break;
+ default:
+ break;
+ }
+
+ subA2B2F();
+
+ _item1.setDetails(16, 1550, 10, -1, -1);
+ _item2.setDetails(24, 1550, 10, -1, -1);
+ _item3.setDetails(Rect(0, 0, 320, 200), 1550, 0, 1, -1, 1, NULL);
+
+ if ((R2_GLOBALS._sceneManager._previousScene == 1500) && (R2_GLOBALS.getFlag(16))) {
+ _sceneMode = 70;
+ if (!R2_GLOBALS._sceneObjects->contains(&_actor7))
+ _actor7.postInit();
+
+ if (R2_GLOBALS._player._characterIndex == 1)
+ _actor7.setVisage(1505);
+ else
+ _actor7.setVisage(1500);
+
+ _actor7.changeZoom(77);
+ _actor7.setDetails(1550, -1, -1, -1, 2, (SceneItem *) NULL);
+
+ assert(_field419 >= 1550);
+ R2_GLOBALS._walkRegions.enableRegion(k5A750[_field419 - 1550]);
+
+ setAction(&_sequenceManager1, this, 1590, &_actor7, NULL);
+ } else if ((_sceneMode != 1577) && (_sceneMode != 1578))
+ R2_GLOBALS._player.enableControl();
+}
+
+void Scene1550::signal() {
+ switch (_sceneMode) {
+ case 1:
+ // No break on purpose
+ case 3:
+ // No break on purpose
+ case 5:
+ // No break on purpose
+ case 7:
+ _field412 = 0;
+ R2_GLOBALS._v56AAB = 0;
+ R2_GLOBALS._player.enableControl(CURSOR_ARROW);
+ break;
+ case 20:
+ // No break on purpose
+ case 21:
+ // No break on purpose
+ case 25:
+ // No break on purpose
+ case 1563:
+ R2_GLOBALS.clearFlag(20);
+ _unkArea1.proc12(1559, 1, 1, 160, 125);
+ R2_GLOBALS._player.enableControl();
+ _sceneMode = 0;
+ break;
+ case 22:
+ _unkArea1.remove();
+ _sceneMode = 24;
+ setAction(&_sequenceManager1, this, 1561, &_actor4, NULL);
+ R2_GLOBALS.clearFlag(20);
+ break;
+ case 23:
+ _unkArea1.remove();
+ _sceneMode = 20;
+ setAction(&_sequenceManager1, this, 1566, &_actor13, &_actor5, NULL);
+ R2_GLOBALS.setFlag(21);
+ break;
+ case 24:
+ _unkArea1.remove();
+ _sceneMode = 21;
+ setAction(&_sequenceManager1, this, 1567, &_actor13, &_actor5, NULL);
+ R2_GLOBALS.clearFlag(19);
+ break;
+ case 30:
+ // No break on purpose
+ case 1556:
+ // No break on purpose
+ case 1557:
+ // Nothing on purpose
+ break;
+ case 40: {
+ _sceneMode = 41;
+ Common::Point pt(_arrUnkObj15501[0]._position.x, _arrUnkObj15501[0]._position.y + 20);
+ NpcMover *mover = new NpcMover();
+ R2_GLOBALS._player.addMover(mover, &pt, this);
+ }
+ break;
+ case 41:
+ _sceneMode = 42;
+ if (R2_GLOBALS._player._characterIndex == 1) {
+ R2_GLOBALS._player.setup(1502, 8, 1);
+ } else {
+ R2_GLOBALS._player.changeZoom(R2_GLOBALS._player._percent + 14);
+ R2_GLOBALS._player.setup(1516, 4, 1);
+ }
+ R2_GLOBALS._player.animate(ANIM_MODE_5, this);
+ break;
+ case 42:
+ _sceneMode = 43;
+ warning("TODO: unknown use of arrUnkObj15501[0]._fieldA6");
+ switch (_arrUnkObj15501[0]._frame - 1) {
+ case 0:
+ R2_INVENTORY.setObjectScene(26, R2_GLOBALS._player._characterIndex);
+ break;
+ case 1:
+ R2_INVENTORY.setObjectScene(17, R2_GLOBALS._player._characterIndex);
+ break;
+ case 2:
+ R2_INVENTORY.setObjectScene(22, R2_GLOBALS._player._characterIndex);
+ break;
+ case 3:
+ R2_INVENTORY.setObjectScene(25, R2_GLOBALS._player._characterIndex);
+ break;
+ case 4:
+ R2_INVENTORY.setObjectScene(45, R2_GLOBALS._player._characterIndex);
+ break;
+ case 5:
+ R2_INVENTORY.setObjectScene(28, R2_GLOBALS._player._characterIndex);
+ break;
+ default:
+ break;
+ }
+ _arrUnkObj15501[0].remove();
+ R2_GLOBALS._player.animate(ANIM_MODE_6, this);
+ break;
+ case 43:
+ warning("TODO: unknown use of arrUnkObj15501[0]._fieldA6");
+ if (R2_GLOBALS._player._characterIndex == 1)
+ R2_GLOBALS._player.setVisage(1500);
+ else {
+ R2_GLOBALS._player.changeZoom(-1);
+ R2_GLOBALS._player.setVisage(1505);
+ }
+ R2_GLOBALS._player.animate(ANIM_MODE_1, this);
+ R2_GLOBALS._player.setStrip(8);
+ R2_GLOBALS._player.enableControl();
+ break;
+ case 50:
+ warning("STUB: sub_1D227()");
+ ++_sceneMode;
+ setAction(&_sequenceManager1, this, 1591, &R2_GLOBALS._player, NULL);
+ if (g_globals->_sceneObjects->contains(&_actor7))
+ signal();
+ else {
+ _actor7.postInit();
+ if (R2_GLOBALS._player._characterIndex == 1)
+ _actor7.setVisage(1505);
+ else
+ _actor7.setVisage(1500);
+ _actor7.changeZoom(77);
+ _actor7.setAction(&_sequenceManager2, this, 1590, &_actor7, NULL);
+ _actor7.setDetails(1550, -1, -1, -1, 2, (SceneItem *) NULL);
+ }
+ break;
+ case 51:
+ ++_sceneMode;
+ break;
+ case 52:
+ _actor7.changeZoom(-1);
+ _sceneMode = 1592;
+ if (R2_GLOBALS._player._characterIndex == 1)
+ setAction(&_sequenceManager1, this, 1592, &R2_GLOBALS._player, &_actor7, &_arrUnkObj15501[0], &_actor9, NULL);
+ else
+ setAction(&_sequenceManager1, this, 1593, &R2_GLOBALS._player, &_actor7, &_arrUnkObj15501[0], &_actor9, NULL);
+ break;
+ case 61:
+ R2_GLOBALS._player.enableControl(CURSOR_USE);
+ R2_GLOBALS._player._canWalk = false;
+ _field415 = 2;
+ break;
+ case 62:
+ R2_GLOBALS._player.enableControl(CURSOR_TALK);
+ if (_field415 == 2) {
+ R2_GLOBALS._player.enableControl(CURSOR_USE);
+ R2_GLOBALS._player._canWalk = false;
+ }
+ break;
+ case 70:
+ R2_GLOBALS._v565EC[2] = R2_GLOBALS._v565EC[1];
+ R2_GLOBALS._v565EC[4] = R2_GLOBALS._v565EC[3];
+ R2_GLOBALS._v565EC[0] = 1;
+ _sceneMode = 60;
+ R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS);
+ _stripManager.start(500, this);
+ break;
+ case 80:
+ if (R2_GLOBALS.getFlag(16)) {
+ _sceneMode = 60;
+ R2_GLOBALS._player.disableControl();
+ R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS);
+ if (R2_GLOBALS._v565AE >= 3) {
+ if (R2_GLOBALS._player._characterIndex == 1)
+ _stripManager.start(572, this);
+ else
+ _stripManager.start(573, this);
+ } else {
+ ++R2_GLOBALS._v565AE;
+ if (R2_GLOBALS._player._characterIndex == 1)
+ _stripManager.start(499 + R2_GLOBALS._v565AE, this);
+ else
+ _stripManager.start(502 + R2_GLOBALS._v565AE, this);
+ }
+ } else {
+ _sceneMode = 60;
+ R2_GLOBALS._player.disableControl();
+ R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS);
+ if (R2_GLOBALS._v565AE >= 4) {
+ if (R2_GLOBALS._player._characterIndex == 1)
+ _stripManager.start(572, this);
+ else
+ _stripManager.start(573, this);
+ } else {
+ ++R2_GLOBALS._v565AE;
+ if (R2_GLOBALS._player._characterIndex == 1)
+ _stripManager.start(563 + R2_GLOBALS._v565AE, this);
+ else
+ _stripManager.start(567 + R2_GLOBALS._v565AE, this);
+ }
+ }
+ break;
+ case 1550:
+ R2_GLOBALS._sceneManager.changeScene(1525);
+ break;
+ case 1552:
+ // No break on purpose
+ case 1588:
+ R2_INVENTORY.setObjectScene(R2_AIRBAG, R2_GLOBALS._player._characterIndex);
+ _actor8.remove();
+ _field412 = 0;
+ R2_GLOBALS._player.enableControl();
+ break;
+ case 1553:
+ R2_GLOBALS._sceneManager.changeScene(1575);
+ break;
+ case 1554:
+ R2_GLOBALS._player.enableControl();
+ _field412 = 0;
+ break;
+ case 1555:
+ // No break on purpose
+ case 1589:
+ R2_INVENTORY.setObjectScene(R2_GYROSCOPE, R2_GLOBALS._player._characterIndex);
+ _actor10.remove();
+ R2_GLOBALS._player.enableControl();
+ break;
+ case 1558:
+ _actor13.fixPriority(124);
+ _field415 = 1;
+ _unkArea1.proc12(1559, 1, 1, 160, 125);
+ R2_GLOBALS._player.enableControl();
+ break;
+ case 1559:
+ _actor13.fixPriority(168);
+ _actor4.fixPriority(169);
+ R2_GLOBALS._player.fixPriority(-1);
+ R2_GLOBALS._player.changeZoom(-1);
+ _field415 = 0;
+ R2_GLOBALS._player.enableControl();
+ break;
+ case 1562:
+ R2_GLOBALS._player.enableControl();
+ R2_GLOBALS._player._canWalk = false;
+ _field415 = 2;
+ break;
+ case 1564:
+ R2_INVENTORY.setObjectScene(R2_BATTERY, 1);
+ _sceneMode = 1565;
+ setAction(&_sequenceManager1, this, 1565, &R2_GLOBALS._player, NULL);
+ break;
+ case 1565:
+ R2_GLOBALS._player.enableControl(CURSOR_USE);
+ R2_GLOBALS._player._canWalk = false;
+ break;
+ case 1569:
+ // No break on purpose
+ case 1579:
+ _field412 = 0;
+ _actor1.remove();
+ R2_INVENTORY.setObjectScene(R2_GUIDANCE_MODULE, 0);
+ R2_GLOBALS._player.enableControl();
+ break;
+ case 1570:
+ // No break on purpose
+ case 1580:
+ _field412 = 0;
+ _actor1.remove();
+ R2_INVENTORY.setObjectScene(R2_RADAR_MECHANISM, 0);
+ R2_GLOBALS._player.enableControl();
+ break;
+ case 1571:
+ // No break on purpose
+ case 1581:
+ _field412 = 0;
+ _actor1.remove();
+ R2_INVENTORY.setObjectScene(R2_GYROSCOPE, 0);
+ R2_GLOBALS._player.enableControl();
+ break;
+ case 1572:
+ _field412 = 0;
+ _actor1.remove();
+ R2_INVENTORY.setObjectScene(R2_THRUSTER_VALVE, 0);
+ R2_GLOBALS._player.enableControl();
+ break;
+ case 1573:
+ _field412 = 0;
+ _actor1.remove();
+ R2_INVENTORY.setObjectScene(R2_IGNITOR, 0);
+ R2_GLOBALS._player.enableControl();
+ break;
+ case 1574:
+ // No break on purpose
+ case 1582:
+ _field412 = 0;
+ _actor1.remove();
+ R2_INVENTORY.setObjectScene(R2_FUEL_CELL, 0);
+ R2_GLOBALS._player.enableControl();
+ break;
+ case 1575:
+ // No break on purpose
+ case 1583:
+ _field412 = 0;
+ _actor1.remove();
+ R2_INVENTORY.setObjectScene(R2_BATTERY, 0);
+ R2_GLOBALS._player.enableControl();
+ break;
+ case 1576:
+ // No break on purpose
+ case 1584:
+ R2_GLOBALS._sceneManager.changeScene(1580);
+ R2_GLOBALS._player.enableControl();
+ break;
+ case 1577:
+ // No break on purpose
+ case 1578:
+ _sceneMode = 0;
+ _actor1.remove();
+ _field412 = 0;
+ R2_GLOBALS._player.fixPriority(-1);
+ R2_GLOBALS._player.enableControl();
+ break;
+ case 1585:
+ SceneItem::display(1550, 66, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ R2_GLOBALS._player.enableControl();
+ break;
+ case 1586:
+ // No break on purpose
+ case 1587:
+ R2_INVENTORY.setObjectScene(R2_DIAGNOSTICS_DISPLAY, R2_GLOBALS._player._characterIndex);
+ _actor1.remove();
+ _field412 = 0;
+ R2_GLOBALS._player.enableControl();
+ break;
+ case 1592:
+ _actor9.remove();
+ R2_INVENTORY.setObjectScene(R2_JOYSTICK, 1);
+ if (R2_GLOBALS._player._characterIndex == 1) {
+ R2_GLOBALS._v565EC[2] = R2_GLOBALS._v565EC[1];
+ R2_GLOBALS._v565EC[4] = R2_GLOBALS._v565EC[3];
+ } else {
+ R2_GLOBALS._v565EC[1] = R2_GLOBALS._v565EC[2];
+ R2_GLOBALS._v565EC[3] = R2_GLOBALS._v565EC[4];
+ }
+ R2_GLOBALS._player.enableControl();
+ break;
+ default:
+ _sceneMode = 62;
+ setAction(&_sequenceManager1, this, 1, &R2_GLOBALS._player, NULL);
+ break;
+ }
+}
+
+void Scene1550::process(Event &event) {
+ if ((!R2_GLOBALS._player._canWalk) && (R2_GLOBALS._events.getCursor() == R2_NEGATOR_GUN) && (event.eventType == EVENT_BUTTON_DOWN) && (this->_screenNumber == 1234)) {
+ int curReg = R2_GLOBALS._sceneRegions.indexOf(event.mousePos);
+ if (curReg == 0)
+ _field412 = 1;
+ else if (((R2_GLOBALS._player._position.y < 90) && (event.mousePos.y > 90)) || ((R2_GLOBALS._player._position.y > 90) && (event.mousePos.y < 90)))
+ _field412 = 1;
+ else
+ _field412 = 0;
+
+ if ((curReg == 13) || (curReg == 14))
+ _field412 = 0;
+ }
+
+ Scene::process(event);
+}
+
+void Scene1550::dispatch() {
+ Scene::dispatch();
+
+ // Arrays related to this scene are all hacky in the origina: they are based on the impossibility to use Miranda
+ assert ((R2_GLOBALS._player._characterIndex == 1) || (R2_GLOBALS._player._characterIndex == 2));
+
+ if ((R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex] == 15) && (R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex + 2] == 16)) {
+ R2_GLOBALS._player._shade = 0;
+ // Original game contains a switch based on an uninitialised variable.
+ // Until we understand what should really happen there, this code is unused on purpose
+ int missingVariable = 0;
+ switch (missingVariable) {
+ case 144:
+ // No break on purpose
+ case 146:
+ _actor13._frame = 5;
+ R2_GLOBALS._player._shade = 3;
+ break;
+ case 148:
+ // No break on purpose
+ case 149:
+ _actor13._frame = 1;
+ // No break on purpose
+ case 147:
+ // No break on purpose
+ case 150:
+ R2_GLOBALS._player._shade = 3;
+ break;
+ default:
+ break;
+ }
+ }
+
+ if (_field412 != 0)
+ return;
+
+ switch (R2_GLOBALS._player.getRegionIndex() - 11) {
+ case 0:
+ // No break on purpose
+ case 5:
+ R2_GLOBALS._player.disableControl();
+ _sceneMode = 1;
+ _field412 = 1;
+ --R2_GLOBALS._v565EC[2 + R2_GLOBALS._player._characterIndex];
+
+ subA2B2F();
+
+ R2_GLOBALS._player.setPosition(Common::Point( 160 - (((((160 - R2_GLOBALS._player._position.x) * 100) / 108) * 172) / 100), 145));
+ if (R2_GLOBALS._player._position.x < 160) {
+ Common::Point pt(R2_GLOBALS._player._position.x + 5, 135);
+ NpcMover *mover = new NpcMover();
+ R2_GLOBALS._player.addMover(mover, &pt, this);
+ } else if (R2_GLOBALS._player._position.x <= 160) { // the check is really in the original...
+ Common::Point pt(R2_GLOBALS._player._position.x, 135);
+ NpcMover *mover = new NpcMover();
+ R2_GLOBALS._player.addMover(mover, &pt, this);
+ } else {
+ Common::Point pt(R2_GLOBALS._player._position.x - 5, 135);
+ NpcMover *mover = new NpcMover();
+ R2_GLOBALS._player.addMover(mover, &pt, this);
+ }
+ break;
+ case 1:
+ R2_GLOBALS._player.disableControl();
+ _sceneMode = 3;
+ _field412 = 1;
+ ++R2_GLOBALS._v565EC[2 + R2_GLOBALS._player._characterIndex];
+
+ subA2B2F();
+
+ R2_GLOBALS._player.setPosition(Common::Point( 160 - (((((160 - R2_GLOBALS._player._position.x) * 100) / 172) * 108) / 100), 19));
+ if (R2_GLOBALS._player._position.x < 160) {
+ Common::Point pt(R2_GLOBALS._player._position.x + 5, 29);
+ NpcMover *mover = new NpcMover();
+ R2_GLOBALS._player.addMover(mover, &pt, this);
+ } else if (R2_GLOBALS._player._position.x <= 160) { // the check is really in the original...
+ Common::Point pt(R2_GLOBALS._player._position.x, 29);
+ NpcMover *mover = new NpcMover();
+ R2_GLOBALS._player.addMover(mover, &pt, this);
+ } else {
+ Common::Point pt(R2_GLOBALS._player._position.x - 5, 29);
+ NpcMover *mover = new NpcMover();
+ R2_GLOBALS._player.addMover(mover, &pt, this);
+ }
+ break;
+ case 2:
+ R2_GLOBALS._player.disableControl();
+ _sceneMode = 5;
+ _field412 = 1;
+ ++R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex];
+
+ subA2B2F();
+
+ if ((R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex] == 9) && (R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex + 2] == 11) && (R2_GLOBALS._player._position.y > 50) && (R2_GLOBALS._player._position.y < 135)) {
+ if (R2_GLOBALS._player._position.y >= 85) {
+ R2_GLOBALS._player.setPosition(Common::Point(320 - R2_GLOBALS._player._position.x, R2_GLOBALS._player._position.y + 10));
+ Common::Point pt(R2_GLOBALS._player._position.x + 30, R2_GLOBALS._player._position.y + 20);
+ NpcMover *mover = new NpcMover();
+ R2_GLOBALS._player.addMover(mover, &pt, this);
+ } else {
+ R2_GLOBALS._player.setPosition(Common::Point(320 - R2_GLOBALS._player._position.x, R2_GLOBALS._player._position.y - 10));
+ Common::Point pt(R2_GLOBALS._player._position.x + 30, R2_GLOBALS._player._position.y - 20);
+ NpcMover *mover = new NpcMover();
+ R2_GLOBALS._player.addMover(mover, &pt, this);
+ }
+ } else {
+ R2_GLOBALS._player.setPosition(Common::Point(320 - R2_GLOBALS._player._position.x, R2_GLOBALS._player._position.y));
+ Common::Point pt(R2_GLOBALS._player._position.x + 10, R2_GLOBALS._player._position.y);
+ NpcMover *mover = new NpcMover();
+ R2_GLOBALS._player.addMover(mover, &pt, this);
+ }
+ break;
+ case 3:
+ R2_GLOBALS._player.disableControl();
+ _sceneMode = 7;
+ _field412 = 1;
+ --R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex];
+ if ((R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex] == 24) && (R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex + 2] == 11)) {
+ R2_GLOBALS._player.setPosition(Common::Point(320 - R2_GLOBALS._player._position.x, R2_GLOBALS._player._position.y / 2));
+ Common::Point pt(265, 29);
+ NpcMover *mover = new NpcMover();
+ R2_GLOBALS._player.addMover(mover, &pt, this);
+ } else if ((R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex] == 9) && (R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex + 2] == 11) && (R2_GLOBALS._player._position.y > 50) && (R2_GLOBALS._player._position.y < 135)) {
+ if (R2_GLOBALS._player._position.y >= 85) {
+ R2_GLOBALS._player.setPosition(Common::Point(320 - R2_GLOBALS._player._position.x, R2_GLOBALS._player._position.y + 10));
+ Common::Point pt(R2_GLOBALS._player._position.x - 30, R2_GLOBALS._player._position.y + 20);
+ NpcMover *mover = new NpcMover();
+ R2_GLOBALS._player.addMover(mover, &pt, this);
+ } else {
+ R2_GLOBALS._player.setPosition(Common::Point(320 - R2_GLOBALS._player._position.x, R2_GLOBALS._player._position.y - 10));
+ Common::Point pt(R2_GLOBALS._player._position.x - 30, R2_GLOBALS._player._position.y - 20);
+ NpcMover *mover = new NpcMover();
+ R2_GLOBALS._player.addMover(mover, &pt, this);
+ }
+ } else {
+ R2_GLOBALS._player.setPosition(Common::Point(320 - R2_GLOBALS._player._position.x, R2_GLOBALS._player._position.y));
+ Common::Point pt(R2_GLOBALS._player._position.x - 10, R2_GLOBALS._player._position.y);
+ NpcMover *mover = new NpcMover();
+ R2_GLOBALS._player.addMover(mover, &pt, this);
+ }
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene1550::saveCharacter(int characterIndex) {
+ if (R2_GLOBALS._player._characterIndex == 3)
+ R2_GLOBALS._sound1.fadeOut2(NULL);
+
+ SceneExt::saveCharacter(characterIndex);
+}
+
+void Scene1550::SceneActor1550::subA4D14(int frameNumber, int strip) {
+ Scene1550 *scene = (Scene1550 *)R2_GLOBALS._sceneManager._scene;
+
+ postInit();
+ if (scene->_field414 == 2)
+ setup(1551, strip, frameNumber);
+ else
+ setup(1554, strip, frameNumber);
+
+ switch (strip) {
+ case 0:
+ switch (frameNumber - 1) {
+ case 0:
+ setup(1551, 1, 1);
+ setPosition(Common::Point(30, 67));
+ break;
+ case 1:
+ setup(1560, 1, 5);
+ setPosition(Common::Point(141, 54));
+ break;
+ case 2:
+ setup(1560, 2, 5);
+ setPosition(Common::Point(178, 54));
+ break;
+ case 3:
+ setup(1560, 2, 1);
+ setPosition(Common::Point(289, 67));
+ break;
+ case 4:
+ setup(1560, 2, 2);
+ setPosition(Common::Point(298, 132));
+ break;
+ case 5:
+ setup(1560, 1, 2);
+ setPosition(Common::Point(21, 132));
+ break;
+ case 6:
+ setup(1560, 2, 4);
+ setPosition(Common::Point(285, 123));
+ break;
+ case 7:
+ setup(1560, 1, 3);
+ setPosition(Common::Point(30, 111));
+ break;
+ case 8:
+ setup(1560, 2, 3);
+ setPosition(Common::Point(289, 111));
+ break;
+ case 9:
+ setup(1560, 1, 4);
+ setPosition(Common::Point(34, 123));
+ break;
+ default:
+ break;
+ }
+ fixPriority(1);
+ break;
+ case 1:
+ if (frameNumber == 3) {
+ setup(1553, 3, 1);
+ setPosition(Common::Point(48, 44));
+ fixPriority(2);
+ } else {
+ fixPriority(1);
+ setPosition(Common::Point(32, 17));
+ }
+
+ switch (frameNumber) {
+ case 2:
+ setDetails(1550, 3, -1, -1, 2, (SceneItem *) NULL);
+ break;
+ case 3:
+ setDetails(1550, 6, -1, -1, 2, (SceneItem *) NULL);
+ break;
+ default:
+ setDetails(1550, 72, -1, -1, 2, (SceneItem *) NULL);
+ break;
+ }
+ break;
+ case 2:
+ fixPriority(1);
+ switch (frameNumber) {
+ case 4:
+ setup(1553, 4, 1);
+ setPosition(Common::Point(48, 168));
+ break;
+ case 5:
+ setup(1553, 3, 2);
+ setPosition(Common::Point(20, 168));
+ fixPriority(250);
+ break;
+ default:
+ setPosition(Common::Point(28, 116));
+ break;
+ }
+
+ switch (frameNumber) {
+ case 2:
+ setDetails(1550, 3, -1, -1, 2, (SceneItem *) NULL);
+ break;
+ case 4:
+ setDetails(1550, 6, -1, -1, 2, (SceneItem *) NULL);
+ break;
+ case 5:
+ setDetails(1550, 6, -1, -1, 2, (SceneItem *) NULL);
+ break;
+ default:
+ setDetails(1550, 72, -1, -1, 2, (SceneItem *) NULL);
+ break;
+ }
+ break;
+ case 3:
+ switch (frameNumber) {
+ case 2:
+ fixPriority(2);
+ if (scene->_field414 == 2)
+ setup(1553, 2, 1);
+ else
+ setup(1556, 2, 1);
+ setPosition(Common::Point(160, 44));
+ break;
+ case 3:
+ fixPriority(2);
+ setup(1553, 5, 1);
+ setPosition(Common::Point(178, 44));
+ break;
+ default:
+ fixPriority(1);
+ setPosition(Common::Point(160, 17));
+ break;
+ }
+
+ if (frameNumber == 1)
+ setDetails(1550, 3, -1, -1, 2, (SceneItem *) NULL);
+ else
+ setDetails(1550, 6, -1, -1, 2, (SceneItem *) NULL);
+ break;
+ case 4:
+ if (frameNumber == 2) {
+ fixPriority(250);
+ if (scene->_field414 == 2)
+ setup(1553, 1, 1);
+ else
+ setup(1556, 1, 1);
+ } else {
+ fixPriority(2);
+ }
+
+ if (frameNumber != 1)
+ setDetails(1550, 6, -1, -1, 2, (SceneItem *) NULL);
+
+ setPosition(Common::Point(160, 168));
+ break;
+ case 5:
+ fixPriority(1);
+ setPosition(Common::Point(287, 17));
+
+ switch (frameNumber) {
+ case 2:
+ setDetails(1550, 3, -1, -1, 2, (SceneItem *) NULL);
+ break;
+ case 3:
+ setDetails(1550, 6, -1, -1, 2, (SceneItem *) NULL);
+ break;
+ default:
+ setDetails(1550, 72, -1, -1, 2, (SceneItem *) NULL);
+ break;
+ }
+ break;
+ case 6:
+ fixPriority(1);
+ setPosition(Common::Point(291, 116));
+
+ if (frameNumber == 2)
+ setDetails(1550, 3, -1, -1, 2, (SceneItem *) NULL);
+ else
+ setDetails(1550, 72, -1, -1, 2, (SceneItem *) NULL);
+ break;
+ default:
+ break;
+ }
+
+}
+
+void Scene1550::subA2B2F() {
+ Rect tmpRect;
+ _field419 = 0;
+ _field415 = 0;
+
+ tmpRect = R2_GLOBALS._v5589E;
+
+ _actor14.remove();
+ _actor17.remove();
+ _actor15.remove();
+ _actor19.remove();
+ _actor16.remove();
+ _actor18.remove();
+
+ for (int i = 0; i < 8; ++i)
+ _arrUnkObj15501[i].remove();
+
+ _actor6.remove();
+
+ for (int i = 0; i < 8; ++i)
+ _arrUnkObj15502[i].remove();
+
+ _actor8.remove();
+ _actor9.remove();
+ _actor10.remove();
+ _actor3.remove();
+ _actor11.remove();
+
+ if ((_sceneMode != 1577) && (_sceneMode != 1578))
+ _actor1.remove();
+
+ _actor2.remove();
+ _actor7.remove();
+ _actor13.remove();
+ _actor5.remove();
+ _actor12.remove();
+ _actor4.remove();
+
+ switch (R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex + 2]) {
+ case 0:
+ switch (R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex]) {
+ case 3:
+ R2_GLOBALS._walkRegions.load(1554);
+ _field419 = 1554;
+ break;
+ case 4:
+ R2_GLOBALS._walkRegions.load(1553);
+ _field419 = 1553;
+ break;
+ default:
+ break;
+ }
+ break;
+ case 3:
+ // No break on purpose
+ case 4:
+ if ((R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex] == 23) || (R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex])) {
+ if (!R2_GLOBALS.getFlag(16)) {
+ R2_GLOBALS._walkRegions.load(1559);
+ _field419 = 1559;
+ }
+ }
+ break;
+ case 7:
+ switch (R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex]) {
+ case 10:
+ R2_GLOBALS._walkRegions.load(1555);
+ _field419 = 1555;
+ break;
+ case 11:
+ R2_GLOBALS._walkRegions.load(1556);
+ _field419 = 1556;
+ break;
+ default:
+ break;
+ }
+ break;
+ case 11:
+ switch (R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex]) {
+ case 24:
+ R2_GLOBALS._walkRegions.load(1558);
+ _field419 = 1558;
+ break;
+ case 25:
+ R2_GLOBALS._walkRegions.load(1557);
+ _field419 = 1557;
+ break;
+ default:
+ break;
+ }
+ break;
+ case 16:
+ switch (R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex]) {
+ case 2:
+ R2_GLOBALS._walkRegions.load(1552);
+ _field419 = 1552;
+ break;
+ case 3:
+ R2_GLOBALS._walkRegions.load(1551);
+ _field419 = 1551;
+ break;
+ case 15:
+ R2_GLOBALS._walkRegions.load(1575);
+ _field419 = 1575;
+ default:
+ break;
+ }
+ break;
+ default:
+ break;
+ }
+
+ int varA = 0;
+
+ if (!R2_GLOBALS.getFlag(16)) {
+ switch (R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex + 2] - 2) {
+ case 0:
+ switch (R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex] - 22) {
+ case 0:
+ varA = 1553;
+ _actor15.subA4D14(6, 0);
+ break;
+ case 1:
+ // No break on purpose
+ case 2:
+ // No break on purpose
+ case 3:
+ // No break on purpose
+ case 4:
+ varA = 1553;
+ break;
+ case 5:
+ varA = 1553;
+ _actor15.subA4D14(6, 0);
+ break;
+ default:
+ break;
+ }
+ break;
+ case 1:
+ // No break on purpose
+ case 2:
+ switch (R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex] - 21) {
+ case 0:
+ varA = 1550;
+ _actor15.subA4D14(9, 0);
+ break;
+ case 1:
+ varA = 1552;
+ _actor15.subA4D14(10, 0);
+ break;
+ case 2:
+ // No break on purpose
+ case 3:
+ // No break on purpose
+ case 4:
+ // No break on purpose
+ case 5:
+ varA = 1552;
+ break;
+ case 6:
+ varA = 1552;
+ _actor15.subA4D14(7, 0);
+ break;
+ case 7:
+ varA = 1550;
+ _actor15.subA4D14(8, 0);
+ break;
+ default:
+ break;
+ }
+ break;
+ case 3:
+ switch (R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex] - 21) {
+ case 0:
+ varA = 1550;
+ _actor15.subA4D14(4, 0);
+ break;
+ case 1:
+ varA = 1550;
+ _actor15.subA4D14(3, 0);
+ break;
+ case 2:
+ // No break on purpose
+ case 3:
+ // No break on purpose
+ case 4:
+ // No break on purpose
+ case 5:
+ varA = 1551;
+ break;
+ case 6:
+ varA = 1550;
+ _actor15.subA4D14(2, 0);
+ break;
+ case 7:
+ varA = 1550;
+ _actor15.subA4D14(1, 0);
+ break;
+ default:
+ break;
+ }
+ break;
+ default:
+ break;
+ }
+ if ((R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex + 2] > 0) && (R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex] <= 29) && (R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex] >= 20) && (R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex + 2] > 7)) {
+ R2_GLOBALS.setFlag(16);
+ R2_GLOBALS._sceneManager.changeScene(1500);
+ }
+ }
+
+ if ((R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex] == 9) && (R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex + 2] == 11)) {
+ if (R2_GLOBALS._sceneManager._sceneNumber != 1234) {
+ R2_GLOBALS._sceneManager._fadeMode = FADEMODE_IMMEDIATE;
+ loadScene(1234);
+ R2_GLOBALS._sceneManager._hasPalette = false;
+ _field414 = 0;
+ }
+ } else {
+ if (R2_GLOBALS._sceneManager._sceneNumber == 1234) {
+ R2_GLOBALS._sceneManager._fadeMode = FADEMODE_IMMEDIATE;
+ loadScene(1550);
+ R2_GLOBALS._sceneManager._hasPalette = false;
+ }
+ }
+
+ if (R2_GLOBALS._sceneManager._sceneNumber == 1234)
+ _field419 = 1576;
+
+ if (_field414 == 0) {
+ _field414 = 1;
+ } else {
+ if (_field414 == 2) {
+ _field414 = 3;
+ } else {
+ _field414 = 2;
+ }
+
+ if (R2_GLOBALS._sceneManager._sceneNumber == 1550){
+ warning("Mouse_hideIfNeeded()");
+ warning("gfx_set_pane_p");
+ for (int i = 3; i != 168; ++i) {
+ warning("sub294D2(4, i, 312, var14C)");
+ warning("missing for loop, to be implemented");
+ warning("gfx_draw_slice");
+ }
+ warning("Missing sub2957D()");
+ warning("gfx_set_pane_p()");
+ R2_GLOBALS._sceneManager._fadeMode = FADEMODE_IMMEDIATE;
+
+ if (varA == 0) {
+ if (_field417 != 1550)
+ g_globals->_scenePalette.loadPalette(1550);
+ R2_GLOBALS._sceneManager._hasPalette = true;
+ } else {
+ g_globals->_scenePalette.loadPalette(varA);
+ R2_GLOBALS._sceneManager._hasPalette = true;
+ }
+
+ if (R2_GLOBALS._sceneManager._hasPalette)
+ _field417 = varA;
+
+ warning("sub_2C429()");
+ }
+ }
+
+ switch (k5A4D6[(R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex + 2] * 30)] + R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex]) {
+ case 0:
+ if (_field419 == 0) {
+ R2_GLOBALS._walkRegions.load(1550);
+ _field419 = 1550;
+ }
+ break;
+ case 1:
+ if (_field419 == 0) {
+ R2_GLOBALS._walkRegions.load(1560);
+ _field419 = 1560;
+ }
+ _actor14.subA4D14(2, 1);
+ _actor15.subA4D14(1, 3);
+ _actor16.subA4D14(2, 5);
+ break;
+ case 2:
+ R2_GLOBALS._walkRegions.load(1561);
+ _field419 = 1561;
+ _actor14.subA4D14(2, 1);
+ _actor17.subA4D14(2, 2);
+ _actor15.subA4D14(1, 3);
+ _actor16.subA4D14(2, 5);
+ break;
+ case 3:
+ R2_GLOBALS._walkRegions.load(1562);
+ _field419 = 1562;
+ _actor14.subA4D14(2, 1);
+ _actor15.subA4D14(1, 3);
+ _actor16.subA4D14(2, 5);
+ _actor18.subA4D14(2, 6);
+ break;
+ case 4:
+ R2_GLOBALS._walkRegions.load(1563);
+ _field419 = 1563;
+ _actor15.subA4D14(2, 3);
+ break;
+ case 5:
+ R2_GLOBALS._walkRegions.load(1564);
+ _field419 = 1564;
+ _actor19.subA4D14(2, 4);
+ break;
+ case 6:
+ R2_GLOBALS._walkRegions.load(1565);
+ _field419 = 1565;
+ _actor14.subA4D14(1, 1);
+ _actor17.subA4D14(1, 2);
+ _actor15.subA4D14(3, 3);
+ break;
+ case 7:
+ R2_GLOBALS._walkRegions.load(1566);
+ _field419 = 1566;
+ _actor14.subA4D14(1, 1);
+ _actor17.subA4D14(1, 2);
+ _actor15.subA4D14(2, 4);
+ break;
+ case 8:
+ R2_GLOBALS._walkRegions.load(1567);
+ _field419 = 1567;
+ _actor17.subA4D14(5, 2);
+ break;
+ case 9:
+ R2_GLOBALS._walkRegions.load(1568);
+ _field419 = 1568;
+ _actor17.subA4D14(4, 2);
+ break;
+ case 10:
+ R2_GLOBALS._walkRegions.load(1569);
+ _field419 = 1569;
+ _actor14.subA4D14(3, 1);
+ break;
+ case 11:
+ R2_GLOBALS._walkRegions.load(1570);
+ _field419 = 1570;
+ _actor14.subA4D14(1, 1);
+ _actor17.subA4D14(1, 2);
+ break;
+ case 12:
+ R2_GLOBALS._walkRegions.load(1571);
+ _field419 = 1571;
+ _actor16.subA4D14(1, 5);
+ _actor18.subA4D14(1, 6);
+ break;
+ case 13:
+ R2_GLOBALS._walkRegions.load(1572);
+ _field419 = 1572;
+ _actor14.subA4D14(1, 1);
+ _actor17.subA4D14(1, 2);
+ _actor19.subA4D14(1, 4);
+ break;
+ case 14:
+ R2_GLOBALS._walkRegions.load(1573);
+ _field419 = 1573;
+ _actor19.subA4D14(1, 4);
+ _actor16.subA4D14(1, 5);
+ _actor18.subA4D14(1, 6);
+ break;
+ case 15:
+ R2_GLOBALS._walkRegions.load(1574);
+ _field419 = 1574;
+ _actor19.subA4D14(1, 4);
+ break;
+ case 16:
+ R2_GLOBALS._walkRegions.load(1570);
+ _field419 = 1570;
+ _actor14.subA4D14(2, 1);
+ _actor17.subA4D14(2, 2);
+ break;
+ case 17:
+ R2_GLOBALS._walkRegions.load(1570);
+ _field419 = 1570;
+ _actor14.subA4D14(2, 1);
+ _actor17.subA4D14(3, 2);
+ break;
+ case 18:
+ R2_GLOBALS._walkRegions.load(1571);
+ _field419 = 1571;
+ _actor16.subA4D14(2, 5);
+ _actor18.subA4D14(2, 6);
+ break;
+ case 19:
+ R2_GLOBALS._walkRegions.load(1571);
+ _field419 = 1571;
+ _actor16.subA4D14(2, 5);
+ _actor18.subA4D14(3, 6);
+ break;
+ default:
+ break;
+ }
+
+ int di = 0;
+ int tmpIdx = 0;
+ // Original game was checking "i < 129" but it was clearly a bug as it's out of bounds
+ for (int i = 0; i < 129 * 4; i += 4) {
+ if ((R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex] == k562CC[i]) && (R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex + 2] == k562CC[i + 1]) && (k562CC[i + 2] != 0)) {
+ tmpIdx = k562CC[i + 3];
+ _arrUnkObj15501[di].postInit();
+ _arrUnkObj15501[di]._effect = 6;
+ _arrUnkObj15501[di]._shade = 0;
+ _arrUnkObj15501[di]._fieldA4 = tmpIdx;
+ _arrUnkObj15501[di]._fieldA6 = i;
+ _arrUnkObj15501[di].setDetails(1550, 62, -1, 63, 2, (SceneItem *) NULL);
+ if (k562CC[i + 2] == 41) {
+ _arrUnkObj15501[di].changeZoom(-1);
+ _arrUnkObj15501[di].setPosition(Common::Point(150, 70));
+ _arrUnkObj15501[di].setup(1562, 1, 1);
+ R2_GLOBALS._walkRegions.enableRegion(k5A78C);
+ R2_GLOBALS._walkRegions.enableRegion(k5A78D);
+ R2_GLOBALS._walkRegions.enableRegion(k5A790);
+ R2_GLOBALS._walkRegions.enableRegion(k5A791);
+ if (R2_INVENTORY.getObjectScene(R2_JOYSTICK) == 1550) {
+ _actor9.postInit();
+ _actor9.setup(1562, 3, 1);
+ _actor9.setPosition(Common::Point(150, 70));
+ _actor9.fixPriority(10);
+ _actor9.setDetails(1550, 41, -1, 42, 2, (SceneItem *) NULL);
+ }
+ } else {
+ if (k562CC[i + 2] > 40) {
+ _arrUnkObj15501[di].changeZoom(100);
+ _arrUnkObj15501[di].setup(1561, 1, k562CC[i + 2] - 40);
+ } else {
+ _arrUnkObj15501[di].changeZoom(-1);
+ _arrUnkObj15501[di].setup(1552, ((k562CC[i + 2] - 1) / 5) + 1, ((k562CC[i + 2] - 1) % 5) + 1);
+ }
+ _arrUnkObj15501[di].setPosition(Common::Point(k5A72E[tmpIdx], k5A73F[tmpIdx]));
+ if (k5A78A[tmpIdx] != 0)
+ R2_GLOBALS._walkRegions.enableRegion(k5A78A[tmpIdx]);
+ di++;
+ }
+ }
+ }
+
+ for (int i = 0; i < 15 * 3; i++) {
+ if ((R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex] == k5A79B[i]) && (R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex + 2] == k5A79B[i + 1])) {
+ tmpIdx = k5A79B[i + 2];
+ switch (tmpIdx - 1) {
+ case 0:
+ if (!R2_GLOBALS.getFlag(16)) {
+ _actor1.postInit();
+ if (R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex + 2] == 3)
+ _actor1.setup(1555, 2, 1);
+ else
+ _actor1.setup(1555, 1, 1);
+ _actor1.setPosition(Common::Point(150, 100));
+ _actor1.fixPriority(92);
+ _actor1.setDetails(1550, 73, -1, -1, 2, (SceneItem *) NULL);
+ }
+ break;
+ case 1:
+ _actor13.postInit();
+ warning("_actor13._actorName = \"dish\";");
+ if (R2_GLOBALS.getFlag(19))
+ _actor13.setup(1556, 3, 5);
+ else
+ _actor13.setup(1556, 3, 1);
+ _actor13.changeZoom(95);
+ _actor13.setPosition(Common::Point(165, 83));
+ _actor13.fixPriority(168);
+ _actor13.setDetails(1550, 17, -1, 19, 2, (SceneItem *) NULL);
+
+ _actor12.postInit();
+ _actor12.setup(1556, 4, 1);
+ _actor12.setPosition(Common::Point(191, 123));
+ _actor12.changeZoom(95);
+ _actor12.setDetails(1550, 65, -1, 66, 2, (SceneItem *) NULL);
+
+ _actor5.postInit();
+ _actor5._numFrames = 5;
+ if (R2_GLOBALS.getFlag(19))
+ _actor5.setup(1556, 8, 5);
+ else
+ _actor5.setup(1556, 8, 1);
+
+ _actor5.setPosition(Common::Point(156, 151));
+ _actor5.fixPriority(10);
+
+ _actor4.postInit();
+ if (R2_GLOBALS.getFlag(20))
+ _actor4.setup(1558, 3, 10);
+ else
+ _actor4.setup(1558, 3, 1);
+
+ _actor4.setPosition(Common::Point(172, 48));
+ _actor4.fixPriority(169);
+ R2_GLOBALS._walkRegions.enableRegion(k5A78A[15]);
+ break;
+ case 2:
+ _actor6.postInit();
+ _actor6.setup(1550, 1, 1);
+ _actor6.setPosition(Common::Point(259, 55));
+ _actor6.fixPriority(133);
+ _actor6.setDetails(1550, 9, -1, -1, 2, (SceneItem *) NULL);
+
+ _actor1.postInit();
+ _actor1.setup(1550, 1, 2);
+ _actor1.setPosition(Common::Point(259, 133));
+ _actor1.fixPriority(105);
+ _actor1.setDetails(1550, 9, -1, -1, 2, (SceneItem *) NULL);
+ if (R2_INVENTORY.getObjectScene(R2_GYROSCOPE) == 1550) {
+ _actor10.postInit();
+ _actor10.setup(1550, 7, 2);
+ _actor10.setPosition(Common::Point(227, 30));
+ _actor10.fixPriority(130);
+ _actor10.setDetails(1550, 29, -1, 63, 2, (SceneItem *) NULL);
+ }
+ break;
+ case 3:
+ _actor6.postInit();
+ _actor6.setup(1550, 1, 4);
+ _actor6.setPosition(Common::Point(76, 131));
+ _actor6.fixPriority(10);
+ _actor6.setDetails(1550, 9, -1, -1, 2, (SceneItem *) NULL);
+
+ _actor1.postInit();
+ _actor1.setup(1550, 1, 3);
+ _actor1.setPosition(Common::Point(76, 64));
+ _actor1.setDetails(1550, 9, -1, -1, 2, (SceneItem *) NULL);
+ if (R2_INVENTORY.getObjectScene(R2_DIAGNOSTICS_DISPLAY) == 1550) {
+ _actor11.postInit();
+ _actor11.setup(1504, 4, 1);
+ _actor11.setPosition(Common::Point(49, 35));
+ _actor11.animate(ANIM_MODE_2, NULL);
+ _actor11._numFrames = 4;
+ _actor11.fixPriority(65);
+ _actor11.setDetails(1550, 14, 15, 63, 2, (SceneItem *) NULL);
+ }
+ if (R2_INVENTORY.getObjectScene(R2_AIRBAG) == 1550) {
+ _actor8.postInit();
+ _actor8.setup(1550, 7, 1);
+ _actor8.setPosition(Common::Point(45, 44));
+ _actor8.fixPriority(150);
+ _actor8.setDetails(1550, 44, -1, 63, 2, (SceneItem *) NULL);
+ }
+ break;
+ case 4:
+ _actor6.postInit();
+ _actor6.setup(1550, 2, 4);
+ _actor6.setPosition(Common::Point(243, 131));
+ _actor6.fixPriority(10);
+ _actor6.setDetails(1550, 9, -1, -1, 2, (SceneItem *) NULL);
+
+ _actor1.postInit();
+ _actor1.setup(1550, 2, 3);
+ _actor1.setPosition(Common::Point(243, 64));
+ _actor1.setDetails(1550, 9, -1, -1, 2, (SceneItem *) NULL);
+ break;
+ case 5:
+ _actor6.postInit();
+ _actor6.setup(1550, 2, 1);
+ _actor6.setPosition(Common::Point(60, 55));
+ _actor6.fixPriority(133);
+ _actor6.setDetails(1550, 9, -1, -1, 2, (SceneItem *) NULL);
+
+ _actor1.postInit();
+ _actor1.setup(1550, 2, 2);
+ _actor1.setPosition(Common::Point(60, 133));
+ _actor1.fixPriority(106);
+ _actor1.setDetails(1550, 9, -1, -1, 2, (SceneItem *) NULL);
+ break;
+ case 6:
+ _actor6.postInit();
+ _actor6.setup(1550, 3, 1);
+ _actor6.setPosition(Common::Point(281, 132));
+ _actor6.setDetails(1550, 56, -1, -1, 2, (SceneItem *) NULL);
+ break;
+ case 7:
+ _actor6.postInit();
+ _actor6.setup(1550, 3, 2);
+ _actor6.setPosition(Common::Point(57, 96));
+ _actor6.fixPriority(70);
+ _actor6.setDetails(1550, 56, -1, -1, 2, (SceneItem *) NULL);
+
+ _actor1.postInit();
+ _actor1.setup(1550, 3, 3);
+ _actor1.setPosition(Common::Point(145, 88));
+ _actor1.fixPriority(55);
+ _actor1.setDetails(1550, 56, -1, -1, 2, (SceneItem *) NULL);
+
+ _actor2.postInit();
+ _actor2.setup(1550, 3, 4);
+ _actor2.setPosition(Common::Point(64, 137));
+ _actor2.fixPriority(115);
+ _actor2.setDetails(1550, 56, -1, -1, 2, (SceneItem *) NULL);
+
+ _actor3.postInit();
+ _actor3.setup(1550, 5, 1);
+ _actor3.setPosition(Common::Point(60, 90));
+ _actor3.fixPriority(45);
+ break;
+ case 8:
+ _actor6.postInit();
+ _actor6.setup(1550, 4, 2);
+ _actor6.setPosition(Common::Point(262, 96));
+ _actor6.fixPriority(70);
+ _actor6.setDetails(1550, 56, -1, -1, 2, (SceneItem *) NULL);
+
+ _actor1.postInit();
+ _actor1.setup(1550, 4, 3);
+ _actor1.setPosition(Common::Point(174, 88));
+ _actor1.fixPriority(55);
+ _actor1.setDetails(1550, 56, -1, -1, 2, (SceneItem *) NULL);
+
+ _actor2.postInit();
+ _actor2.setup(1550, 4, 4);
+ _actor2.setPosition(Common::Point(255, 137));
+ _actor2.fixPriority(115);
+ _actor2.setDetails(1550, 56, -1, -1, 2, (SceneItem *) NULL);
+
+ _actor3.postInit();
+ _actor3.setup(1550, 6, 1);
+ _actor3.setPosition(Common::Point(259, 90));
+ _actor3.fixPriority(45);
+ break;
+ case 9:
+ _actor6.postInit();
+ _actor6.setup(1550, 4, 1);
+ _actor6.setPosition(Common::Point(38, 132));
+ _actor6.setDetails(1550, 56, -1, -1, 2, (SceneItem *) NULL);
+ break;
+ case 11:
+ _arrUnkObj15502[7].subA5CDF(8);
+ _arrUnkObj15502[0].subA5CDF(1);
+ _arrUnkObj15502[1].subA5CDF(2);
+ _arrUnkObj15502[2].subA5CDF(3);
+ _arrUnkObj15502[3].subA5CDF(4);
+ _arrUnkObj15502[4].subA5CDF(5);
+ _arrUnkObj15502[5].subA5CDF(6);
+ _arrUnkObj15502[6].subA5CDF(7);
+ default:
+ break;
+ }
+ }
+ }
+
+ if ((R2_GLOBALS._v565EC[1] == R2_GLOBALS._v565EC[2]) && (R2_GLOBALS._v565EC[3] == R2_GLOBALS._v565EC[4])) {
+ _actor7.postInit();
+ _actor7._effect = 7;
+ _actor7.changeZoom(-1);
+
+ assert((_field419 >= 1550) && (_field419 <= 2008));
+ R2_GLOBALS._walkRegions.enableRegion(k5A750[_field419 - 1550]);
+ _actor7.setPosition(Common::Point(k5A72E[k5A76D[_field419 - 1550]], k5A73F[k5A76D[_field419 - 1550]] + 8));
+ if (R2_GLOBALS._player._characterIndex == 1) {
+ if (R2_GLOBALS._player._characterScene[2] == 1580) {
+ _actor7.setup(1516, 3, 17);
+ _actor7.setPosition(Common::Point(272, 94));
+ _actor7.fixPriority(91);
+ _actor7.changeZoom(100);
+ _actor7.setDetails(1550, -1, -1, -1, 5, &_arrUnkObj15502[7]);
+ } else {
+ _actor7.setup(1505, 6, 1);
+ _actor7.setDetails(1550, -1, -1, -1, 2, (SceneItem *) NULL);
+ }
+ } else {
+ if (R2_GLOBALS._player._characterScene[1] == 1580) {
+ _actor7.setup(1516, 2, 14);
+ _actor7.setPosition(Common::Point(276, 97));
+ _actor7.fixPriority(91);
+ _actor7.changeZoom(100);
+ _actor7.setDetails(1550, -1, -1, -1, 5, &_arrUnkObj15502[7]);
+ } else {
+ _actor7.setup(1500, 6, 1);
+ _actor7.setDetails(1550, -1, -1, -1, 2, (SceneItem *) NULL);
+ }
+ }
+ }
+ R2_GLOBALS._uiElements.updateInventory();
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 1575 -
+ *
+ *--------------------------------------------------------------------------*/
+Scene1575::Scene1575() {
+ _field412 = 0;
+ _field414 = 0;
+ _field416 = 0;
+ _field418 = 0;
+ _field41A = 0;
+}
+
+void Scene1575::synchronize(Serializer &s) {
+ SceneExt::synchronize(s);
+
+ s.syncAsSint16LE(_field412);
+ s.syncAsSint16LE(_field414);
+ s.syncAsSint16LE(_field416);
+ s.syncAsSint16LE(_field418);
+ s.syncAsSint16LE(_field41A);
+}
+
+Scene1575::Hotspot1::Hotspot1() {
+ _field34 = 0;
+ _field36 = 0;
+}
+
+void Scene1575::Hotspot1::synchronize(Serializer &s) {
+ NamedHotspot::synchronize(s);
+
+ s.syncAsSint16LE(_field34);
+ s.syncAsSint16LE(_field36);
+}
+
+void Scene1575::Hotspot1::process(Event &event) {
+ if ((event.eventType != EVENT_BUTTON_DOWN) || (R2_GLOBALS._events.getCursor() != R2_STEPPING_DISKS) || (!_bounds.contains(event.mousePos))) {
+ if (_field36 == 0)
+ return;
+ if ((_field34 == 1) || (event.eventType == EVENT_BUTTON_UP) || (!_bounds.contains(event.mousePos))) {
+ _field36 = 0;
+ return;
+ }
+ }
+ _field36 = 1;
+ Scene1575 *scene = (Scene1575 *)R2_GLOBALS._sceneManager._scene;
+
+ event.handled = true;
+ if (R2_GLOBALS.getFlag(18) && (_field34 > 1) && (_field34 < 6)) {
+ warning("sub1A03B(\"Better not move the laser while it\'s firing!\", 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);");
+ return;
+ }
+ int di = scene->_actor1._position.x;
+
+ switch (_field34 - 1) {
+ case 0:
+ if (R2_GLOBALS.getFlag(18)) {
+ scene->_actor14.hide();
+ scene->_actor15.hide();
+ R2_GLOBALS.clearFlag(18);
+ } else if ((scene->_actor12._position.x == 85) && (scene->_actor12._position.y == 123)) {
+ scene->_actor14.show();
+ scene->_actor15.show();
+ R2_GLOBALS.setFlag(18);
+ } else {
+ warning("sub1A03B(\"That\'s probably not a good thing, ya know!\", 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);");
+ }
+ break;
+ case 1:
+ if (scene->_field41A < 780) {
+ if (di > 54)
+ di -= 65;
+ di += 2;
+ scene->_field41A += 2;
+
+ for (int i = 0; i < 17; i++)
+ scene->_arrActor[i].setPosition(Common::Point(scene->_arrActor[i]._position.x + 2, scene->_arrActor[i]._position.y));
+
+ scene->_actor13.setPosition(Common::Point(scene->_actor13._position.x + 2, scene->_actor13._position.y));
+ scene->_actor12.setPosition(Common::Point(scene->_actor12._position.x + 2, scene->_actor12._position.y));
+ scene->_actor1.setPosition(Common::Point(di, scene->_actor1._position.y));
+ scene->_actor2.setPosition(Common::Point(di + 65, scene->_actor1._position.y));
+ scene->_actor3.setPosition(Common::Point(di + 130, scene->_actor1._position.y));
+ }
+ break;
+ case 2:
+ if (scene->_field41A > 0) {
+ if (di < -8)
+ di += 65;
+
+ di -= 2;
+ scene->_field41A -= 2;
+ for (int i = 0; i < 178; i++)
+ scene->_arrActor[i].setPosition(Common::Point(scene->_arrActor[i]._position.x - 2, scene->_arrActor[i]._position.y));
+
+ scene->_actor13.setPosition(Common::Point(scene->_actor13._position.x - 2, scene->_actor13._position.y));
+ scene->_actor12.setPosition(Common::Point(scene->_actor12._position.x - 2, scene->_actor12._position.y));
+ scene->_actor1.setPosition(Common::Point(di, scene->_actor1._position.y));
+ scene->_actor2.setPosition(Common::Point(di + 65, scene->_actor1._position.y));
+ scene->_actor3.setPosition(Common::Point(di + 130, scene->_actor1._position.y));
+ }
+ break;
+ case 3: {
+ int tmpPosY = scene->_actor1._position.y;
+ if (tmpPosY < 176) {
+ ++tmpPosY;
+ for (int i = 0; i < 17; ++i)
+ scene->_arrActor[i].setPosition(Common::Point(scene->_arrActor[i]._position.x, scene->_arrActor[i]._position.y + 1));
+
+ scene->_actor13.setPosition(Common::Point(scene->_actor13._position.x, scene->_actor13._position.y + 1));
+ scene->_actor12.setPosition(Common::Point(scene->_actor12._position.x, scene->_actor12._position.y + 1));
+ scene->_actor1.setPosition(Common::Point(di, scene->_actor1._position.y));
+ scene->_actor2.setPosition(Common::Point(di + 65, scene->_actor1._position.y));
+ scene->_actor3.setPosition(Common::Point(di + 130, scene->_actor1._position.y));
+ }
+ }
+ break;
+ case 4: {
+ int tmpPosY = scene->_actor1._position.y;
+ if (tmpPosY > 145) {
+ tmpPosY--;
+ for (int i = 0; i < 17; ++i)
+ scene->_arrActor[i].setPosition(Common::Point(scene->_arrActor[i]._position.x, scene->_arrActor[i]._position.y - 1));
+
+ scene->_actor13.setPosition(Common::Point(scene->_actor13._position.x, scene->_actor13._position.y - 1));
+ scene->_actor12.setPosition(Common::Point(scene->_actor12._position.x, scene->_actor12._position.y - 1));
+ scene->_actor1.setPosition(Common::Point(di, scene->_actor1._position.y));
+ scene->_actor2.setPosition(Common::Point(di + 65, scene->_actor1._position.y));
+ scene->_actor3.setPosition(Common::Point(di + 130, scene->_actor1._position.y));
+ }
+ }
+ break;
+ case 5:
+ R2_GLOBALS._sceneManager.changeScene(1550);
+ break;
+ default:
+ break;
+ }
+
+ int j = 0;
+ for (int i = 0; i < 17; i++) {
+ if (scene->_arrActor[i]._bounds.contains(85, 116))
+ j = i;
+ }
+
+ if (scene->_actor13._bounds.contains(85, 116))
+ j = 18;
+
+ if (scene->_actor12._bounds.contains(85, 116))
+ j = 19;
+
+ if (j)
+ scene->_actor11.show();
+ else
+ scene->_actor11.hide();
+}
+
+bool Scene1575::Hotspot1::startAction(CursorType action, Event &event) {
+ if (action == CURSOR_USE)
+ return false;
+ return SceneHotspot::startAction(action, event);
+}
+
+void Scene1575::Hotspot1::subA910D(int indx) {
+ warning("STUB: Scene1575:Hotspot1::subA910D(%d)", indx);
+}
+
+void Scene1575::postInit(SceneObjectList *OwnerList) {
+ loadScene(1575);
+ R2_GLOBALS._uiElements._active = false;
+ R2_GLOBALS._v5589E = Rect(0, 0, 320, 200);
+ SceneExt::postInit();
+ _field414 = 390;
+
+ _actor1.postInit();
+ _actor1.setup(1575, 1, 1);
+ _actor1.setPosition(Common::Point(54, 161));
+ _actor1.fixPriority(5);
+
+ _actor2.postInit();
+ _actor2.setup(1575, 1, 1);
+ _actor2.setPosition(Common::Point(119, 161));
+ _actor2.fixPriority(5);
+
+ _actor3.postInit();
+ _actor3.setup(1575, 1, 1);
+ _actor3.setPosition(Common::Point(184, 161));
+ _actor3.fixPriority(5);
+
+ for (int i = 0; i < 17; i++) {
+ _arrActor[i].postInit();
+ _arrActor[i].setup(1575, 2, k5A7F6[(3 * i) + 2]);
+ warning("TODO: immense pile of floating operations");
+ _arrActor[i].fixPriority(6);
+ }
+
+ _actor4.postInit();
+ _actor4.setup(1575, 3, 1);
+ _actor4.setPosition(Common::Point(48, 81));
+
+ _actor5.postInit();
+ _actor5.setup(1575, 3,1);
+ _actor5.setPosition(Common::Point(121, 81));
+
+ _actor6.postInit();
+ _actor6.setup(1575, 3, 2);
+ _actor6.setPosition(Common::Point(203, 80));
+
+ _actor7.postInit();
+ _actor7.setup(1575, 3, 2);
+ _actor7.setPosition(Common::Point(217, 80));
+
+ _actor8.postInit();
+ _actor8.setup(1575, 3, 2);
+ _actor8.setPosition(Common::Point(231, 80));
+
+ _actor9.postInit();
+ _actor9.setup(1575, 3, 2);
+ _actor9.setPosition(Common::Point(273, 91));
+
+ _actor10.postInit();
+ _actor10.setup(1575, 3, 2);
+ _actor10.setPosition(Common::Point(287, 91));
+
+ _item1.subA910D(1);
+ _item1.subA910D(2);
+ _item1.subA910D(3);
+ _item1.subA910D(4);
+ _item1.subA910D(5);
+ _item1.subA910D(6);
+
+ _actor11.postInit();
+ _actor11.setup(1575, 4, 2);
+ _actor11.setPosition(Common::Point(84, 116));
+ _actor11.hide();
+
+ R2_GLOBALS._player.postInit();
+ R2_GLOBALS._player.hide();
+ R2_GLOBALS._player.enableControl();
+
+ do {
+ _field412 = R2_GLOBALS._randomSource.getRandomNumber(20) - 10;
+ _field414 = R2_GLOBALS._randomSource.getRandomNumber(20) - 10;
+ } while ((_field412) && (_field414));
+
+ if (_field412 < 0)
+ _actor4.hide();
+
+ if (_field414 < 0)
+ _actor5.hide();
+
+ _field416 = R2_GLOBALS._randomSource.getRandomNumber(4) + 1;
+ _field418 = R2_GLOBALS._randomSource.getRandomNumber(4) + 1;
+
+ _actor13.postInit();
+ _actor13.setup(1575, 2, 4);
+
+ warning("TODO: another immense pile of floating operations");
+
+ _actor12.postInit();
+ _actor12.fixPriority(12);
+
+ if (R2_GLOBALS.getFlag(17)) {
+ _actor13.setPosition(Common::Point(_actor13._position.x + 5, _actor13._position.y));
+ _actor12.setPosition(Common::Point(_actor12._position.x + 5, _actor12._position.y));
+ }
+
+ _actor14.postInit();
+ _actor14.setup(1575, 5, 1);
+ _actor14.setPosition(Common::Point(85, 176));
+ _actor14.fixPriority(7);
+ _actor14.hide();
+
+ _actor15.postInit();
+ _actor15.setup(1575, 5, 2);
+ _actor15.setPosition(Common::Point(85, 147));
+ _actor15.fixPriority(7);
+ _actor15.hide();
+}
+
+void Scene1575::remove() {
+ SceneExt::remove();
+ R2_GLOBALS._v5589E.top = 3;
+ R2_GLOBALS._v5589E.bottom = 168;
+ R2_GLOBALS._uiElements._active = true;
+}
+
+void Scene1575::signal() {
+ R2_GLOBALS._player.enableControl();
+}
+
+void Scene1575::process(Event &event) {
+ Scene::process(event);
+
+ g_globals->_sceneObjects->recurse(SceneHandler::dispatchObject);
+ warning("TODO: check Scene1575::process");
+}
+
+void Scene1575::dispatch() {
+ if (_field412 <= 0) {
+ ++_field412;
+ if (_field412 == 0) {
+ _actor4.show();
+ _field412 = R2_GLOBALS._randomSource.getRandomNumber(9) + 1;
+ }
+ } else {
+ _field412--;
+ if (_field412 ==0) {
+ _actor4.hide();
+ _field412 = R2_GLOBALS._randomSource.getRandomNumber(9) + 1;
+ }
+ }
+
+ if (_field414 <= 0) {
+ ++_field414;
+ if (_field414 == 0) {
+ _actor5.show();
+ _field414 = R2_GLOBALS._randomSource.getRandomNumber(9) + 1;
+ }
+ } else {
+ _field414--;
+ if (_field414 == 0) {
+ _actor5.hide();
+ _field414 = R2_GLOBALS._randomSource.getRandomNumber(9) + 1;
+ }
+ }
+
+ if (_field416 == 0) {
+ switch(R2_GLOBALS._randomSource.getRandomNumber(3)) {
+ case 0:
+ _actor6.hide();
+ _actor7.hide();
+ _actor8.hide();
+ break;
+ case 1:
+ _actor6.show();
+ _actor7.hide();
+ _actor8.hide();
+ break;
+ case 2:
+ _actor6.show();
+ _actor7.show();
+ _actor8.hide();
+ break;
+ case 3:
+ _actor6.show();
+ _actor7.show();
+ _actor8.show();
+ break;
+ default:
+ break;
+ }
+ _field416 = R2_GLOBALS._randomSource.getRandomNumber(4) + 1;
+ } else {
+ --_field416;
+ }
+
+ if (_field418 == 0) {
+ switch(R2_GLOBALS._randomSource.getRandomNumber(2)) {
+ case 0:
+ _actor9.hide();
+ _actor10.hide();
+ break;
+ case 1:
+ _actor9.show();
+ _actor10.hide();
+ break;
+ case 2:
+ _actor9.show();
+ _actor10.show();
+ break;
+ default:
+ break;
+ }
+ _field418 = R2_GLOBALS._randomSource.getRandomNumber(4) + 1;
+ } else {
+ _field418--;
+ }
+ Scene::dispatch();
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 1580 - Inside wreck
+ *
+ *--------------------------------------------------------------------------*/
+Scene1580::Scene1580() {
+ _field412 = 0;
+}
+
+void Scene1580::synchronize(Serializer &s) {
+ SceneExt::synchronize(s);
+
+ s.syncAsSint16LE(_field412);
+}
+
+bool Scene1580::Hotspot1::startAction(CursorType action, Event &event) {
+ Scene1580 *scene = (Scene1580 *)R2_GLOBALS._sceneManager._scene;
+
+ if (action == R2_JOYSTICK) {
+ R2_INVENTORY.setObjectScene(26, 1580);
+ R2_GLOBALS._sceneItems.remove(&scene->_item1);
+ scene->_actor2.postInit();
+ scene->_actor2.setup(1580, 1, 4);
+ scene->_actor2.setPosition(Common::Point(159, 163));
+ scene->_actor2.setDetails(1550, 78, -1, -1, 2, (SceneItem *) NULL);
+
+ scene->_arrActor[5].remove();
+
+ return true;
+ }
+
+ return SceneHotspot::startAction(action, event);
+}
+
+bool Scene1580::Hotspot2::startAction(CursorType action, Event &event) {
+ Scene1580 *scene = (Scene1580 *)R2_GLOBALS._sceneManager._scene;
+
+ if (action == R2_DIAGNOSTICS_DISPLAY) {
+ R2_INVENTORY.setObjectScene(28, 1580);
+ R2_GLOBALS._player.disableControl();
+ R2_GLOBALS._sceneItems.remove(&scene->_item2);
+
+ scene->_actor3.postInit();
+ scene->_actor3.setup(1580, 1, 1);
+ scene->_actor3.setPosition(Common::Point(124, 108));
+ scene->_actor3.fixPriority(10);
+
+ if (R2_INVENTORY.getObjectScene(26) == 1580)
+ scene->_actor3.setDetails(1550, 14, -1, -1, 5, &scene->_actor2);
+ else
+ scene->_actor3.setDetails(1550, 14, -1, -1, 2, (SceneItem *)NULL);
+
+ scene->_actor1.postInit();
+ scene->_actor1.setup(1580, 3, 1);
+ scene->_actor1.setPosition(Common::Point(124, 109));
+ scene->_actor1.fixPriority(20);
+ scene->_field412 = 1;
+ scene->_sceneMode = 10;
+ scene->setAction(&scene->_sequenceManager, scene, 1, &R2_GLOBALS._player, NULL);
+
+ return true;
+ }
+
+ return SceneHotspot::startAction(action, event);
+}
+
+bool Scene1580::Actor2::startAction(CursorType action, Event &event) {
+ if ( (action == CURSOR_USE) && (R2_INVENTORY.getObjectScene(28) == 1580)
+ && (R2_INVENTORY.getObjectScene(17) == 0) && (R2_INVENTORY.getObjectScene(22) == 0)
+ && (R2_INVENTORY.getObjectScene(25) == 0) && (R2_INVENTORY.getObjectScene(18) == 0)
+ && (R2_INVENTORY.getObjectScene(23) == 0) && (R2_INVENTORY.getObjectScene(27) == 0)) {
+ Scene1580 *scene = (Scene1580 *)R2_GLOBALS._sceneManager._scene;
+ scene->_sceneMode = 31;
+ R2_GLOBALS._player.disableControl();
+ R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS);
+ if (R2_GLOBALS._player._characterIndex == 1)
+ scene->_stripManager.start(536, scene);
+ else
+ scene->_stripManager.start(537, scene);
+
+ return true;
+ }
+
+ return SceneActor::startAction(action, event);
+}
+
+bool Scene1580::Actor3::startAction(CursorType action, Event &event) {
+ if ((action == CURSOR_USE) && (R2_INVENTORY.getObjectScene(51) == 1580)) {
+ Scene1580 *scene = (Scene1580 *)R2_GLOBALS._sceneManager._scene;
+
+ R2_INVENTORY.setObjectScene(51, R2_GLOBALS._player._characterIndex);
+ scene->_item2.setDetails(Rect(69, 29, 177, 108), 1550, 82, -1, -1, 2, NULL);
+ scene->_actor1.remove();
+ remove();
+ return true;
+ }
+
+ return SceneActor::startAction(action, event);
+}
+
+bool Scene1580::Actor4::startAction(CursorType action, Event &event) {
+ if (action != CURSOR_USE)
+ return SceneActor::startAction(action, event);
+
+ Scene1580 *scene = (Scene1580 *)R2_GLOBALS._sceneManager._scene;
+
+ R2_GLOBALS._player.disableControl();
+ R2_GLOBALS._sceneItems.remove(&scene->_actor4);
+ scene->_sceneMode = 0;
+ animate(ANIM_MODE_5, scene);
+
+ return true;
+}
+
+bool Scene1580::Actor5::startAction(CursorType action, Event &event) {
+ if (action != CURSOR_USE)
+ return SceneActor::startAction(action, event);
+
+ Scene1580 *scene = (Scene1580 *)R2_GLOBALS._sceneManager._scene;
+
+ R2_GLOBALS._player.disableControl();
+ setFrame(2);
+ scene->_sceneMode = 20;
+ scene->setAction(&scene->_sequenceManager, scene, 2, &R2_GLOBALS._player, NULL);
+
+ return true;
+}
+
+bool Scene1580::Actor6::startAction(CursorType action, Event &event) {
+ Scene1580 *scene = (Scene1580 *)R2_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_USE:
+ if (R2_GLOBALS._player._characterIndex == 1) {
+ R2_INVENTORY.setObjectScene(23, 1);
+ remove();
+ return true;
+ }
+ break;
+ case R2_COM_SCANNER:
+ scene->_sceneMode = 30;
+ R2_GLOBALS._player.disableControl();
+ R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS);
+ scene->_stripManager.start(529, scene);
+ return true;
+ break;
+ case R2_COM_SCANNER_2:
+ scene->_sceneMode = 30;
+ R2_GLOBALS._player.disableControl();
+ R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS);
+ scene->_stripManager.start(527, scene);
+ return true;
+ break;
+ default:
+ break;
+ }
+
+ return SceneActor::startAction(action, event);
+}
+
+bool Scene1580::Actor7::startAction(CursorType action, Event &event) {
+ Scene1580 *scene = (Scene1580 *)R2_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_USE:
+ if (R2_GLOBALS._player._characterIndex == 1) {
+ R2_INVENTORY.setObjectScene(27, 1);
+ remove();
+ return true;
+ }
+ break;
+ case R2_COM_SCANNER:
+ scene->_sceneMode = 30;
+ R2_GLOBALS._player.disableControl();
+ R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS);
+ scene->_stripManager.start(529, scene);
+ return true;
+ break;
+ case R2_COM_SCANNER_2:
+ scene->_sceneMode = 30;
+ R2_GLOBALS._player.disableControl();
+ R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS);
+ scene->_stripManager.start(527, scene);
+ return true;
+ break;
+ default:
+ break;
+ }
+
+ return SceneActor::startAction(action, event);
+}
+
+void Scene1580::postInit(SceneObjectList *OwnerList) {
+ loadScene(1580);
+ R2_GLOBALS._sceneManager._fadeMode = FADEMODE_GRADUAL;
+ SceneExt::postInit();
+ _field412 = 0;
+
+ _stripManager.setColors(60, 255);
+ _stripManager.setFontNumber(3);
+ _stripManager.addSpeaker(&_quinnSpeaker);
+ _stripManager.addSpeaker(&_seekerSpeaker);
+
+ _sceneMode = 0;
+
+ R2_GLOBALS._player.disableControl();
+ if (R2_INVENTORY.getObjectScene(26) == 1580) {
+ _actor2.postInit();
+ _actor2.setup(1580, 1, 4);
+ _actor2.setPosition(Common::Point(159, 163));
+ _actor2.setDetails(1550, 78, -1, -1, 1, (SceneItem *) NULL);
+ } else {
+ _item1.setDetails(Rect(141, 148, 179, 167), 1550, 79, -1, -1, 1, NULL);
+ }
+
+ if (R2_INVENTORY.getObjectScene(51) == 1580) {
+ _actor3.postInit();
+ _actor3.setup(1580, 1, 1);
+ _actor3.setPosition(Common::Point(124, 108));
+ _actor3.fixPriority(10);
+ _actor3.setDetails(1550, 13, -1, -1, 1, (SceneItem *) NULL);
+
+ _actor1.postInit();
+ _actor1.setup(1580, 1, 3);
+ _actor1.setPosition(Common::Point(124, 96));
+ _actor1.fixPriority(20);
+ } else if (R2_INVENTORY.getObjectScene(28) == 1580) {
+ _actor3.postInit();
+ _actor3.setup(1580, 1, 1);
+ _actor3.setPosition(Common::Point(124, 108));
+ _actor3.fixPriority(10);
+ _actor3.setDetails(1550, 14, -1, -1, 1, (SceneItem *) NULL);
+
+ _actor1.postInit();
+ _actor1.setup(1580, 3, 1);
+ _actor1.setPosition(Common::Point(124, 109));
+ _actor1.fixPriority(20);
+
+ _sceneMode = 10;
+ } else {
+ _item2.setDetails(Rect(69, 29, 177, 108), 1550, 82, -1, -1, 1, NULL);
+ }
+
+ _actor4.postInit();
+ if (R2_INVENTORY.getObjectScene(58) == 0) {
+ _actor4.setup(1580, 5, 1);
+ _actor4.setDetails(1550, 80, -1, -1, 1, (SceneItem *) NULL);
+ } else {
+ _actor4.setup(1580, 5, 6);
+ }
+
+ _actor4.setPosition(Common::Point(216, 108));
+ _actor4.fixPriority(100);
+
+ _actor5.postInit();
+ _actor5.setup(1580, 4, 1);
+ _actor5.setPosition(Common::Point(291, 147));
+ _actor5.fixPriority(100);
+ _actor5.setDetails(1550, 81, -1, -1, 1, (SceneItem *) NULL);
+
+ if (R2_INVENTORY.getObjectScene(23) == 1580) {
+ _actor6.postInit();
+ _actor6.setup(1580, 6, 2);
+ _actor6.setPosition(Common::Point(222, 108));
+ _actor6.fixPriority(50);
+ _actor6.setDetails(1550, 32, -1, 34, 1, (SceneItem *) NULL);
+ }
+
+ if (R2_INVENTORY.getObjectScene(27) == 1580) {
+ _actor7.postInit();
+ _actor7.setup(1580, 6, 1);
+ _actor7.setPosition(Common::Point(195, 108));
+ _actor7.fixPriority(50);
+ _actor7.setDetails(1550, 38, -1, 34, 1, (SceneItem *) NULL);
+ }
+
+ R2_GLOBALS._player.postInit();
+ R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] = 1580;
+ R2_GLOBALS._player.hide();
+ setAction(&_sequenceManager, this, 1, &R2_GLOBALS._player, NULL);
+ _item3.setDetails(Rect(0, 0, 320, 200), 1550, 50, -1, -1, 1, NULL);
+
+}
+
+void Scene1580::signal() {
+ switch (_sceneMode++) {
+ case 10:
+ _actor1.animate(ANIM_MODE_5, this);
+ break;
+ case 11:
+ _actor1.setup(1580, 1, 2);
+ _actor1.setPosition(Common::Point(124, 94));
+
+ if (R2_INVENTORY.getObjectScene(18) != 0) {
+ _arrActor[0].postInit();
+ _arrActor[0].setup(1580, 2, 1);
+ _arrActor[0].setPosition(Common::Point(138, 56));
+ }
+
+ if (R2_INVENTORY.getObjectScene(25) != 0) {
+ _arrActor[1].postInit();
+ _arrActor[1].setup(1580, 2, 2);
+ _arrActor[1].setPosition(Common::Point(140, 66));
+ }
+
+ if (R2_INVENTORY.getObjectScene(27) != 0) {
+ _arrActor[2].postInit();
+ _arrActor[2].setup(1580, 2, 3);
+ _arrActor[2].setPosition(Common::Point(142, 85));
+ }
+
+ if (R2_INVENTORY.getObjectScene(23) != 0) {
+ _arrActor[3].postInit();
+ _arrActor[3].setup(1580, 2, 4);
+ _arrActor[3].setPosition(Common::Point(142, 92));
+ }
+
+ if (R2_INVENTORY.getObjectScene(22) != 0) {
+ _arrActor[4].postInit();
+ _arrActor[4].setup(1580, 2, 5);
+ _arrActor[4].setPosition(Common::Point(108, 54));
+ }
+
+ if (R2_INVENTORY.getObjectScene(26) != 0) {
+ _arrActor[5].postInit();
+ _arrActor[5].setup(1580, 2, 6);
+ _arrActor[5].setPosition(Common::Point(110, 64));
+ }
+
+ if (R2_INVENTORY.getObjectScene(45) != 0) {
+ _arrActor[6].postInit();
+ _arrActor[6].setup(1580, 2, 7);
+ _arrActor[6].setPosition(Common::Point(108, 80));
+ }
+
+ if (R2_INVENTORY.getObjectScene(17) != 0) {
+ _arrActor[7].postInit();
+ _arrActor[7].setup(1580, 2, 8);
+ _arrActor[7].setPosition(Common::Point(111, 92));
+ }
+
+ R2_GLOBALS._player.enableControl(CURSOR_USE);
+ R2_GLOBALS._player._canWalk = false;
+ break;
+ case 20:
+ R2_GLOBALS._sceneManager.changeScene(1550);
+ break;
+ case 31:
+ R2_GLOBALS._sceneManager.changeScene(1530);
+ break;
+ default:
+ R2_GLOBALS._player.enableControl(CURSOR_USE);
+ R2_GLOBALS._player._canWalk = false;
+ break;
+ }
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 1625 - Miranda being questioned
+ *
+ *--------------------------------------------------------------------------*/
+Scene1625::Scene1625() {
+ _field412 = 0;
+}
+
+void Scene1625::synchronize(Serializer &s) {
+ SceneExt::synchronize(s);
+
+ s.syncAsSint16LE(_field412);
+}
+
+bool Scene1625::Actor7::startAction(CursorType action, Event &event) {
+ if (action != CURSOR_USE)
+ return SceneActor::startAction(action, event);
+
+ Scene1625 *scene = (Scene1625 *)R2_GLOBALS._sceneManager._scene;
+ R2_GLOBALS._player.disableControl();
+
+ scene->_sceneMode = 1631;
+ scene->_actor3.postInit();
+ scene->setAction(&scene->_sequenceManager, scene, 1631, &scene->_actor3, &scene->_actor7, NULL);
+ return true;
+}
+
+void Scene1625::postInit(SceneObjectList *OwnerList) {
+ loadScene(1625);
+ R2_GLOBALS._player._characterIndex = R2_MIRANDA;
+ SceneExt::postInit();
+
+ _stripManager.addSpeaker(&_mirandaSpeaker);
+ _stripManager.addSpeaker(&_tealSpeaker);
+ _stripManager.addSpeaker(&_soldierSpeaker);
+
+ R2_GLOBALS._player.postInit();
+
+ _actor7.postInit();
+ _actor7.setup(1626, 2, 1);
+ _actor7.setPosition(Common::Point(206, 133));
+ _actor7.setDetails(1625, 0, -1, -1, 1, (SceneItem *) NULL);
+
+ _actor5.postInit();
+ _actor5.setup(1625, 8, 1);
+ _actor5.setPosition(Common::Point(190, 131));
+ _actor5.setDetails(1625, 6, -1, 2, 1, (SceneItem *) NULL);
+
+ if (R2_GLOBALS._player._oldCharacterScene[3] == 1625) {
+ if (!R2_GLOBALS.getFlag(83)) {
+ _actor4.postInit();
+ _actor4.setup(1626, 4, 1);
+ _actor4.setPosition(Common::Point(96, 166));
+ _actor4.setDetails(1625, -1, -1, -1, 1, (SceneItem *) NULL);
+ }
+ R2_GLOBALS._player.enableControl();
+ R2_GLOBALS._player._canWalk = false;
+ } else {
+ _actor1.postInit();
+ _actor1.fixPriority(10);
+
+ _actor6.postInit();
+
+ R2_GLOBALS._player.disableControl();
+ _sceneMode = 1625;
+ setAction(&_sequenceManager, this, 1625, &_actor1, &_actor6, NULL);
+ }
+
+ R2_GLOBALS._sound1.play(245);
+ _item1.setDetails(Rect(0, 0, 320, 200), 1625, 12, -1, -1, 1, NULL);
+ R2_GLOBALS._player._oldCharacterScene[3] = 1625;
+ R2_GLOBALS._player._characterScene[3] = 1625;
+}
+
+void Scene1625::remove() {
+ R2_GLOBALS._sound1.fadeOut2(NULL);
+ SceneExt::remove();
+}
+
+void Scene1625::signal() {
+ switch (_sceneMode) {
+ case 10:
+ R2_GLOBALS._player.disableControl();
+ _actor4.postInit();
+ _actor4.setDetails(1625, -1, -1, -1, 2, (SceneItem *) NULL);
+ _sceneMode = 1626;
+ setAction(&_sequenceManager, this, 1626, &_actor2, &_actor4, NULL);
+ break;
+ case 12:
+ // TODO: check if OK_BTN_STRING is required
+ MessageDialog::show(DONE_MSG, OK_BTN_STRING);
+ break;
+ case 14:
+ _actor2.postInit();
+ _actor2.setup(1627, 1, 1);
+ _actor2.setPosition(Common::Point(68, 68));
+ _sceneMode = 99;
+ R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS);
+ _stripManager.start(831, this);
+ break;
+ case 99:
+ R2_GLOBALS._player.disableControl();
+ switch (_stripManager._field2E8) {
+ case 0:
+ _sceneMode = 1627;
+ setAction(&_sequenceManager, this, 1627, &_actor3, &_actor4, NULL);
+ break;
+ case 1:
+ _sceneMode = 1629;
+ setAction(&_sequenceManager, this, 1629, &_actor2, &_actor5, NULL);
+ break;
+ case 3:
+ R2_GLOBALS._player._oldCharacterScene[3] = 3150;
+ R2_GLOBALS._player._characterScene[3] = 3150;
+ R2_GLOBALS._player._characterIndex = R2_QUINN;
+ R2_GLOBALS._sceneManager.changeScene(R2_GLOBALS._player._characterScene[1]);
+ break;
+ case 4:
+ _sceneMode = 1628;
+ _actor2.remove();
+ setAction(&_sequenceManager, this, 1628, &_actor3, &_actor4, NULL);
+ break;
+ case 5:
+ _actor4.postInit();
+ _actor4.setDetails(1625, -1, -1, -1, 2, (SceneItem *) NULL);
+ _sceneMode = 1632;
+ setAction(&_sequenceManager, this, 1632, &_actor4, NULL);
+ break;
+ case 6:
+ _sceneMode = 1633;
+ setAction(&_sequenceManager, this, 1633, &_actor4, NULL);
+ break;
+ case 7:
+ _sceneMode = 1635;
+ setAction(&_sequenceManager, this, 1635, &_actor3, &_actor5, NULL);
+ break;
+ case 8:
+ _actor4.postInit();
+ _actor4.setDetails(1625, -1, -1, -1, 2, (SceneItem *) NULL);
+ _sceneMode = 1634;
+ setAction(&_sequenceManager, this, 1634, &_actor3, &_actor5, NULL);
+ break;
+ case 2:
+ // No break on purpose
+ default:
+ _sceneMode = 1630;
+ _actor2.postInit();
+ setAction(&_sequenceManager, this, 1630, &_actor1, &_actor6, NULL);
+ break;
+ }
+ _field412 = _stripManager._field2E8;
+ _stripManager._field2E8 = 0;
+ break;
+ case 1625:
+ _actor2.postInit();
+ _actor2.setup(1627, 1, 1);
+ _actor2.setPosition(Common::Point(68, 68));
+ _sceneMode = 10;
+ R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS);
+ _stripManager.start(800, this);
+ break;
+ case 1626:
+ _actor2.setup(1627, 1, 1);
+ _actor2.setPosition(Common::Point(68, 68));
+ _actor2.show();
+
+ _actor3.postInit();
+ _actor3.setup(1627, 3, 1);
+ _actor3.setPosition(Common::Point(196, 65));
+
+ _sceneMode = 99;
+ R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS);
+ _stripManager.start(832, this);
+ break;
+ case 1627:
+ _actor3.setup(1627, 3, 1);
+ _actor3.setPosition(Common::Point(196, 65));
+ _actor3.show();
+
+ _sceneMode = 99;
+ R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS);
+ _stripManager.start(833, this);
+ break;
+ case 1628:
+ R2_GLOBALS.setFlag(83);
+ _actor2.postInit();
+ _actor2.setup(1627, 1, 1);
+ _actor2.setPosition(Common::Point(68, 68));
+
+ _actor3.setup(1627, 3, 1);
+ _actor3.setPosition(Common::Point(196, 65));
+ _actor3.show();
+
+ _sceneMode = 99;
+ R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS);
+ _stripManager.start(834, this);
+ break;
+ case 1629:
+ _actor2.setup(1627, 1, 1);
+ _actor2.setPosition(Common::Point(68, 68));
+ _actor2.show();
+
+ _sceneMode = 99;
+ R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS);
+ _stripManager.start(805, this);
+ break;
+ case 1630:
+ R2_GLOBALS._player.enableControl(CURSOR_USE);
+ R2_GLOBALS._player._canWalk = true;
+ break;
+ case 1631:
+ _actor3.setup(1627, 3, 1);
+ _actor3.setPosition(Common::Point(196, 65));
+ _actor3.show();
+
+ _actor7.remove();
+
+ _actor1.postInit();
+ _actor1.fixPriority(10);
+
+ _actor6.postInit();
+ warning("_actor6._actorName = \"arm\";");
+
+ R2_INVENTORY.setObjectScene(40, 3);
+ _sceneMode = 14;
+
+ setAction(&_sequenceManager, this, 1625, &_actor1, &_actor6, NULL);
+ break;
+ case 1632:
+ _actor2.setup(1627, 1, 1);
+ _actor2.setPosition(Common::Point(68, 68));
+ _actor2.show();
+
+ _sceneMode = 99;
+ R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS);
+ _stripManager.start(835, this);
+ break;
+ case 1633:
+ _actor4.remove();
+ _sceneMode = 99;
+ R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS);
+ _stripManager.start(818, this);
+ break;
+ case 1634:
+ _sceneMode = 99;
+ R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS);
+ _stripManager.start(836, this);
+ break;
+ case 1635:
+ _actor3.setup(1627, 3, 1);
+ _actor3.setPosition(Common::Point(196, 65));
+ _actor3.show();
+
+ _sceneMode = 99;
+ R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS);
+ _stripManager.start(818, this);
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene1625::process(Event &event) {
+ if ((event.eventType == EVENT_KEYPRESS) && (event.kbd.keycode == Common::KEYCODE_ESCAPE))
+ event.handled = true;
+ else
+ Scene::process(event);
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 1700 -
+ *
+ *--------------------------------------------------------------------------*/
+Scene1700::Scene1700() {
+ _field77A = 0;
+ _field77C = 0;
+}
+
+void Scene1700::synchronize(Serializer &s) {
+ SceneExt::synchronize(s);
+
+ s.syncAsSint16LE(_field77A);
+ s.syncAsSint16LE(_field77C);
+}
+
+bool Scene1700::Item2::startAction(CursorType action, Event &event) {
+ // The original contains a debug trace. It's currently skipped.
+ // TODO: either add the debug trace, or remove this function and associated class
+ return SceneHotspot::startAction(action, event);
+}
+
+bool Scene1700::Actor11::startAction(CursorType action, Event &event) {
+ if (action != CURSOR_USE)
+ return SceneActor::startAction(action, event);
+
+ Scene1700 *scene = (Scene1700 *)R2_GLOBALS._sceneManager._scene;
+
+ R2_GLOBALS._player.disableControl();
+ R2_GLOBALS._v558B6.set(80, 0, 240, 200);
+ scene->_sceneMode = 4;
+
+ Common::Point pt(271, 90);
+ PlayerMover *mover = new PlayerMover();
+ R2_GLOBALS._player.addMover(mover, &pt, scene);
+
+ return true;
+}
+
+bool Scene1700::Actor12::startAction(CursorType action, Event &event) {
+ if (action != CURSOR_TALK)
+ return SceneActor::startAction(action, event);
+
+ Scene1700 *scene = (Scene1700 *)R2_GLOBALS._sceneManager._scene;
+ scene->_sceneMode = 30;
+ scene->signal();
+
+ return true;
+}
+
+void Scene1700::Exit1::changeScene() {
+ Scene1700 *scene = (Scene1700 *)R2_GLOBALS._sceneManager._scene;
+
+ R2_GLOBALS._player.disableControl();
+ _moving = false;
+ scene->_sceneMode = 1;
+
+ Common::Point pt(R2_GLOBALS._player._position.x, 0);
+ NpcMover *mover = new NpcMover();
+ R2_GLOBALS._player.addMover(mover, &pt, scene);
+}
+
+void Scene1700::Exit2::changeScene() {
+ Scene1700 *scene = (Scene1700 *)R2_GLOBALS._sceneManager._scene;
+
+ R2_GLOBALS._player.disableControl();
+ _moving = false;
+ scene->_sceneMode = 2;
+
+ Common::Point pt(R2_GLOBALS._player._position.x, 170);
+ NpcMover *mover = new NpcMover();
+ R2_GLOBALS._player.addMover(mover, &pt, scene);
+}
+
+void Scene1700::Exit3::changeScene() {
+ Scene1700 *scene = (Scene1700 *)R2_GLOBALS._sceneManager._scene;
+
+ R2_GLOBALS._player.disableControl();
+ _moving = false;
+ scene->_sceneMode = 6;
+
+ Common::Point pt(0, R2_GLOBALS._player._position.y);
+ NpcMover *mover = new NpcMover();
+ R2_GLOBALS._player.addMover(mover, &pt, scene);
+}
+
+void Scene1700::subAF3F8() {
+ Rect tmpRect;
+ R2_GLOBALS._walkRegions.load(1700);
+
+ _actor3.remove();
+ _actor4.remove();
+ _actor5.remove();
+ _actor6.remove();
+ _actor7.remove();
+ _actor8.remove();
+ _actor11.remove();
+
+ if (_sceneMode != 40) {
+ _actor9.remove();
+ _actor10.remove();
+ }
+
+ warning("tmpRect = _v5589E;");
+ warning("Mouse_hideIfNeeded");
+ warning("set_pane_p(_paneNumber);");
+ warning("Big loop calling gfx_draw_slice_p");
+
+ if (_field77A == 0)
+ _field77A = 1;
+ else
+ _field77A = 0;
+
+ warning("set_pane_p(_paneNumber);");
+
+ if ((_sceneMode != 40) && (R2_GLOBALS._v565F6 != 0)){
+ _actor9.postInit();
+ _actor9.setup(1701, 1, 1);
+ _actor9.setPosition(Common::Point(220, 137));
+ _actor9.setDetails(1700, 6, -1, -1, 2, (SceneItem *) NULL);
+ R2_GLOBALS._walkRegions.enableRegion(2);
+ R2_GLOBALS._walkRegions.enableRegion(12);
+ }
+
+ if ((R2_GLOBALS._v565F6 + 2) % 4 == 0) {
+ _actor3.postInit();
+ _actor3.setup(1700, 1, 1);
+ _actor3.setPosition(Common::Point(222, 82));
+ _actor3.setDetails(100, -1, -1, -1, 2, (SceneItem *) NULL);
+
+ _actor5.postInit();
+ _actor5.setup(1700, 2, 1);
+ _actor5.setPosition(Common::Point(177, 82));
+ _actor5.fixPriority(0);
+
+ _actor6.postInit();
+ _actor6.setup(1700, 2, 2);
+ _actor6.setPosition(Common::Point(332, 96));
+ _actor6.fixPriority(0);
+
+ _actor4.postInit();
+ _actor4.setup(1700, 1, 2);
+ _actor4.setPosition(Common::Point(424, 84));
+
+ R2_GLOBALS._walkRegions.enableRegion(11);
+ }
+
+ if ((R2_GLOBALS._v565F6 + 399) % 800 == 0) {
+ _actor7.postInit();
+ _actor7.setup(1700, 3, 2);
+ _actor7.setPosition(Common::Point(51, 141));
+ _actor7.fixPriority(0);
+ _actor7.setDetails(100, -1, -1, -1, 2, (SceneItem *) NULL);
+
+ _exit3._enabled = true;
+ } else {
+ R2_GLOBALS._walkRegions.enableRegion(1);
+ _exit3._enabled = false;
+ }
+
+ if ( ((!R2_GLOBALS.getFlag(15)) && ((R2_GLOBALS._v565F6 == 25) || (R2_GLOBALS._v565F6 == -3)))
+ || ((R2_GLOBALS.getFlag(15)) && (R2_GLOBALS._v565F6 == R2_GLOBALS._v565FA))
+ ) {
+ R2_GLOBALS._v565FA = R2_GLOBALS._v565F6;
+ if (!R2_GLOBALS.getFlag(15))
+ _field77C = 1;
+
+ _actor11.postInit();
+ _actor11.setup(1700, 3, 1);
+ _actor11.setPosition(Common::Point(338, 150));
+ _actor11.setDetails(1700, 9, -1, -1, 2, (SceneItem *) NULL);
+ _actor11.fixPriority(15);
+
+ _actor8.postInit();
+ _actor8.setup(1700, 4, 1);
+ _actor8.setPosition(Common::Point(312, 106));
+ _actor8.fixPriority(130);
+ }
+}
+
+void Scene1700::postInit(SceneObjectList *OwnerList) {
+ loadScene(1700);
+ SceneExt::postInit();
+ if (R2_GLOBALS._sceneManager._previousScene == -1)
+ R2_GLOBALS._sceneManager._previousScene = 1530;
+
+ scalePalette(65, 65, 65);
+ _stripManager.addSpeaker(&_quinnSpeaker);
+ _stripManager.addSpeaker(&_seekerSpeaker);
+
+ _field77A = 0;
+ _field77C = 0;
+
+ _exit1.setDetails(Rect(94, 0, 319, 12), EXITCURSOR_N, 1700);
+ _exit2.setDetails(Rect(0, 161, 319, 168), EXITCURSOR_S, 1700);
+ _exit3.setDetails(Rect(0, 0, 2, 138), EXITCURSOR_W, 1800);
+
+ R2_GLOBALS._player.postInit();
+ R2_GLOBALS._player.setPosition(Common::Point(0, 0));
+ R2_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+ if (R2_GLOBALS._player._characterIndex == R2_QUINN) {
+ R2_GLOBALS._player.setVisage(1501);
+ R2_GLOBALS._player._moveDiff = Common::Point(2, 1);
+ } else {
+ R2_GLOBALS._player.setVisage(1506);
+ R2_GLOBALS._player._moveDiff = Common::Point(3, 1);
+ }
+
+ _actor12.postInit();
+ _actor12.animate(ANIM_MODE_1, NULL);
+ _actor12.setObjectWrapper(new SceneObjectWrapper());
+
+ if (R2_GLOBALS._player._characterIndex == R2_QUINN) {
+ _actor12.setVisage(1506);
+ _actor12._moveDiff = Common::Point(3, 1);
+ _actor12.setDetails(9002, 1, -1, -1, 1, (SceneItem *) NULL);
+ } else {
+ _actor12.setVisage(1501);
+ _actor12._moveDiff = Common::Point(2, 1);
+ _actor12.setDetails(9001, 1, -1, -1, 1, (SceneItem *) NULL);
+ }
+
+ R2_GLOBALS._sound1.play(134);
+
+ _actor1.postInit();
+ _actor1.fixPriority(10);
+
+ if (R2_GLOBALS._player._characterIndex == R2_QUINN)
+ _actor1.setVisage(1112);
+ else
+ _actor1.setVisage(1111);
+
+ _actor1._effect = 5;
+ _actor1._field9C = _field312;
+ R2_GLOBALS._player._linkedActor = &_actor1;
+
+ _actor2.postInit();
+ _actor2.fixPriority(10);
+ if (R2_GLOBALS._player._characterIndex == R2_QUINN)
+ _actor2.setVisage(1111);
+ else
+ _actor2.setVisage(1112);
+
+ _actor2._effect = 5;
+ _actor2._field9C = _field312;
+ _actor12._linkedActor = &_actor2;
+
+ R2_GLOBALS._sound1.play(134);
+
+ switch (R2_GLOBALS._sceneManager._previousScene) {
+ case 1530:
+ R2_GLOBALS._player._characterIndex = R2_QUINN;
+ R2_GLOBALS._player.disableControl();
+ R2_GLOBALS._player.hide();
+ _actor12.hide();
+
+ _actor10.postInit();
+ warning("_actor10._actorName = \"hatch\";");
+ _actor10.hide();
+
+ _actor9.postInit();
+ _actor9.setup(1701, 1, 1);
+ _actor9.setPosition(Common::Point(220, 137));
+ _actor9.setDetails(1700, 6, -1, -1, 1, (SceneItem *) NULL);
+
+ _actor1.hide();
+ _actor2.hide();
+ R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS);
+ _stripManager.start(539, this);
+ _sceneMode = 40;
+ break;
+ case 1750: {
+ R2_GLOBALS._player.setPosition(Common::Point(282, 121));
+ _actor12.setPosition(Common::Point(282, 139));
+ _sceneMode = 8;
+ Common::Point pt(262, 101);
+ NpcMover *mover = new NpcMover();
+ R2_GLOBALS._player.addMover(mover, &pt, this);
+ Common::Point pt2(262, 119);
+ NpcMover *mover2 = new NpcMover();
+ _actor12.addMover(mover2, &pt2, this);
+ }
+ break;
+ case 1800: {
+ R2_GLOBALS._player.disableControl();
+ R2_GLOBALS._player.setPosition(Common::Point(0, 86));
+ _actor12.setPosition(Common::Point(0, 64));
+ _sceneMode = 7;
+ R2_GLOBALS._player.setObjectWrapper(NULL);
+ R2_GLOBALS._player._strip = 1;
+ Common::Point pt(64, 86);
+ NpcMover *mover = new NpcMover();
+ R2_GLOBALS._player.addMover(mover, &pt, this);
+ _actor12.setObjectWrapper(NULL);
+ _actor12._strip = 1;
+ Common::Point pt2(77, 64);
+ NpcMover *mover2 = new NpcMover();
+ _actor12.addMover(mover2, &pt2, NULL);
+ }
+ break;
+ default:
+ if (R2_GLOBALS._player._characterIndex == R2_QUINN) {
+ R2_GLOBALS._player.setPosition(Common::Point(109, 160));
+ _actor12.setPosition(Common::Point(156, 160));
+ R2_GLOBALS._walkRegions.enableRegion(15);
+ } else {
+ R2_GLOBALS._player.setPosition(Common::Point(156, 160));
+ _actor12.setPosition(Common::Point(109, 160));
+ R2_GLOBALS._walkRegions.enableRegion(17);
+ }
+ _sceneMode = 50;
+ setAction(&_sequenceManager, this, 1, &R2_GLOBALS._player, NULL);
+ break;
+ }
+ R2_GLOBALS._player._characterScene[1] = 1700;
+ R2_GLOBALS._player._characterScene[2] = 1700;
+ R2_GLOBALS._player._oldCharacterScene[1] = 1700;
+ R2_GLOBALS._player._oldCharacterScene[2] = 1700;
+
+ R2_GLOBALS._v558B6.set(20, 0, 320, 200);
+ subAF3F8();
+ _item1.setDetails(1, 1700, 3, -1, -1);
+ _item2.setDetails(Rect(0, 0, 480, 200), 1700, 0, -1, -1, 1, NULL);
+}
+
+void Scene1700::remove() {
+ R2_GLOBALS._sound1.fadeOut2(NULL);
+ SceneExt::remove();
+}
+
+void Scene1700::signal() {
+ switch (_sceneMode) {
+ case 1: {
+ _sceneMode = 3;
+ if ((R2_GLOBALS._v565F6 < 2400) && (R2_GLOBALS._v565F6 >= 0))
+ ++R2_GLOBALS._v565F6;
+ subAF3F8();
+ R2_GLOBALS._player.setPosition(Common::Point(235 - (((((235 - R2_GLOBALS._player._position.x) * 100) / 103) * 167) / 100), 170));
+ Common::Point pt(R2_GLOBALS._player._position.x, 160);
+ NpcMover *mover = new NpcMover();
+ R2_GLOBALS._player.addMover(mover, &pt, this);
+
+ if (R2_GLOBALS._player._position.x < 132) {
+ _actor12.setPosition(Common::Point(156, 170));
+ Common::Point pt2(156, 160);
+ NpcMover *mover2 = new NpcMover();
+ _actor12.addMover(mover2, &pt2, NULL);
+ R2_GLOBALS._walkRegions.enableRegion(15);
+ } else {
+ _actor12.setPosition(Common::Point(109, 170));
+ Common::Point pt3(109, 160);
+ NpcMover *mover3 = new NpcMover();
+ _actor12.addMover(mover3, &pt3, NULL);
+ R2_GLOBALS._walkRegions.enableRegion(17);
+ }
+ }
+ break;
+ case 2: {
+ _sceneMode = 3;
+ if ((R2_GLOBALS._v565F6 > -2400) && (R2_GLOBALS._v565F6 < 0))
+ R2_GLOBALS._v565F6--;
+ subAF3F8();
+ R2_GLOBALS._player.setPosition(Common::Point(235 - (((((235 - R2_GLOBALS._player._position.x) * 100) / 167) * 103) / 100), 0));
+ Common::Point pt(R2_GLOBALS._player._position.x, 10);
+ NpcMover *mover = new NpcMover();
+ R2_GLOBALS._player.addMover(mover, &pt, this);
+
+ if (R2_GLOBALS._player._position.x >= 171) {
+ _actor12.setPosition(Common::Point(155, 0));
+ Common::Point pt2(155, 10);
+ NpcMover *mover2 = new NpcMover();
+ _actor12.addMover(mover2, &pt2, NULL);
+ R2_GLOBALS._walkRegions.enableRegion(15);
+ } else {
+ _actor12.setPosition(Common::Point(188, 0));
+ Common::Point pt3(188, 10);
+ NpcMover *mover3 = new NpcMover();
+ _actor12.addMover(mover3, &pt3, NULL);
+ R2_GLOBALS._walkRegions.enableRegion(17);
+ }
+ }
+ break;
+ case 3:
+ if (_field77C == 0) {
+ R2_GLOBALS._player.enableControl(CURSOR_ARROW);
+ } else {
+ R2_GLOBALS.setFlag(15);
+ _field77C = 0;
+ _sceneMode = 31;
+ R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS);
+ if (R2_GLOBALS._player._characterIndex == R2_QUINN)
+ _stripManager.start(542, this);
+ else
+ _stripManager.start(543, this);
+ }
+ break;
+ case 4: {
+ _sceneMode = 5;
+ Common::Point pt(271, 90);
+ PlayerMover *mover = new PlayerMover();
+ _actor12.addMover(mover, &pt, NULL);
+ if (R2_GLOBALS._player._characterIndex == 1)
+ setAction(&_sequenceManager, this, 1700, &R2_GLOBALS._player, &_actor8, NULL);
+ else
+ setAction(&_sequenceManager, this, 1701, &R2_GLOBALS._player, &_actor8, NULL);
+ }
+ break;
+ case 5:
+ R2_GLOBALS._sceneManager.changeScene(1750);
+ break;
+ case 6:
+ R2_GLOBALS._sceneManager.changeScene(1800);
+ break;
+ case 7:
+ R2_GLOBALS._player.setObjectWrapper(new SceneObjectWrapper());
+ R2_GLOBALS._player._strip = 1;
+ _actor12.setObjectWrapper(new SceneObjectWrapper());
+ _actor12._strip = 1;
+ R2_GLOBALS._player.enableControl(CURSOR_ARROW);
+ R2_GLOBALS._walkRegions.enableRegion(14);
+ break;
+ case 8:
+ R2_GLOBALS._player._strip = 2;
+ _actor12._strip = 1;
+ R2_GLOBALS._player.enableControl(CURSOR_ARROW);
+ R2_GLOBALS._walkRegions.enableRegion(12);
+ break;
+ case 30:
+ _sceneMode = 31;
+ R2_GLOBALS._player.disableControl();
+ R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS);
+ if (R2_GLOBALS._player._characterIndex == R2_QUINN)
+ _stripManager.start(540, this);
+ else
+ _stripManager.start(541, this);
+ break;
+ case 31:
+ R2_GLOBALS._v56AAB = 0;
+ R2_GLOBALS._player.enableControl(CURSOR_TALK);
+ break;
+ case 40:
+ R2_GLOBALS._player.disableControl();
+ _sceneMode = 1704;
+ setAction(&_sequenceManager, this, 1704, &R2_GLOBALS._player, &_actor12, &_actor10, &_actor9, &_actor1, &_actor2, NULL);
+ break;
+ case 50:
+ if (R2_GLOBALS._player._characterIndex == R2_QUINN)
+ R2_GLOBALS._walkRegions.enableRegion(15);
+ else
+ R2_GLOBALS._walkRegions.enableRegion(17);
+
+ R2_GLOBALS._player.enableControl();
+ break;
+ case 1704:
+ R2_GLOBALS._sound1.play(134);
+ R2_GLOBALS._walkRegions.enableRegion(15);
+ R2_GLOBALS._walkRegions.enableRegion(2);
+ R2_GLOBALS._walkRegions.enableRegion(12);
+ R2_GLOBALS._player.fixPriority(-1);
+ R2_GLOBALS._player.enableControl(CURSOR_ARROW);
+ break;
+ default:
+ R2_GLOBALS._player.enableControl();
+ break;
+ }
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 1750 -
+ *
+ *--------------------------------------------------------------------------*/
+Scene1750::Actor4::Actor4() {
+ _fieldA4 = 0;
+ _fieldA6 = 0;
+ _fieldA8 = 0;
+ _fieldAA = 0;
+ _fieldAC = 0;
+ _fieldAE = 0;
+}
+
+void Scene1750::Actor4::synchronize(Serializer &s) {
+ SceneActor::synchronize(s);
+
+ s.syncAsSint16LE(_fieldA4);
+ s.syncAsSint16LE(_fieldA6);
+ s.syncAsSint16LE(_fieldA8);
+ s.syncAsSint16LE(_fieldAA);
+ s.syncAsSint16LE(_fieldAC);
+ s.syncAsSint16LE(_fieldAE);
+}
+
+Scene1750::Actor5::Actor5() {
+ _fieldA4 = 0;
+}
+
+void Scene1750::Actor5::synchronize(Serializer &s) {
+ SceneActor::synchronize(s);
+
+ s.syncAsSint16LE(_fieldA4);
+}
+
+Scene1750::Scene1750() {
+ _field412 = 0;
+ _field413 = 0;
+ _field415 = 0;
+ _field417 = 0;
+ _field419 = 0;
+ _field41B = 0;
+ _field41D = 0;
+}
+
+void Scene1750::synchronize(Serializer &s) {
+ SceneExt::synchronize(s);
+ SYNC_POINTER(_rotation);
+
+ s.syncAsSint16LE(_field412);
+ s.syncAsSint16LE(_field413);
+ s.syncAsSint16LE(_field415);
+ s.syncAsSint16LE(_field417);
+ s.syncAsSint16LE(_field419);
+ s.syncAsSint16LE(_field41B);
+ s.syncAsSint16LE(_field41D);
+}
+
+void Scene1750::Actor4::subB1A76(int arg1, int arg2, int arg3, int arg4, int arg5) {
+ _fieldA4 = arg1;
+ _fieldAE = 0;
+ _fieldA6 = arg2;
+ _fieldA8 = arg3;
+ _fieldAA = arg4;
+ _fieldAC = arg5;
+
+ postInit();
+ setup(1750, 1, 1);
+ fixPriority(255);
+ setPosition(Common::Point(_fieldA6, _fieldA8 + ((_fieldAA * (arg1 - 1)) / (_fieldAC - 1))));
+}
+
+void Scene1750::Actor4::subB1B27() {
+ Scene1750 *scene = (Scene1750 *)R2_GLOBALS._sceneManager._scene;
+
+ int tmpVar = (_fieldAA / (_fieldAC - 1)) / 2;
+ int tmpVar2 = ((_position.y - _fieldA8 + tmpVar) * _fieldAC) / (_fieldAA + 2 * tmpVar);
+
+ setPosition(Common::Point(_fieldA6, _fieldA8 + ((_fieldAA * tmpVar2) / (_fieldAC - 1))));
+ scene->_field415 = scene->_field412 * tmpVar2;
+}
+
+void Scene1750::Actor4::remove() {
+ // Function kept to match IDA. Could be removed.
+ SceneActor::remove();
+}
+
+void Scene1750::Actor4::process(Event &event) {
+ if ((event.eventType == EVENT_BUTTON_DOWN) && (R2_GLOBALS._events.getCursor() == CURSOR_USE) && (_bounds.contains(event.mousePos))) {
+ _fieldAE = 1;
+ event.eventType = EVENT_NONE;
+ }
+
+ if ((event.eventType == EVENT_BUTTON_UP) && (_fieldAE != 0)) {
+ _fieldAE = 0;
+ event.handled = true;
+ addMover(NULL);
+ subB1B27();
+ }
+
+ if (_fieldAE != 0) {
+ event.handled = true;
+ if (event.mousePos.y >= _fieldA8) {
+ if (_fieldA8 + _fieldAA >= event.mousePos.y)
+ setPosition(Common::Point(_fieldA6, event.mousePos.y));
+ else
+ setPosition(Common::Point(_fieldA6, _fieldA8 + _fieldAA));
+ } else {
+ setPosition(Common::Point(_fieldA6, _fieldA8));
+ }
+ }
+}
+
+bool Scene1750::Actor4::startAction(CursorType action, Event &event) {
+ if (action == CURSOR_USE)
+ return SceneActor::startAction(action, event);
+
+ return false;
+}
+
+bool Scene1750::Actor5::startAction(CursorType action, Event &event) {
+ if (action != CURSOR_USE)
+ return SceneActor::startAction(action, event);
+
+ Scene1750 *scene = (Scene1750 *)R2_GLOBALS._sceneManager._scene;
+
+ switch (_fieldA4) {
+ case 1:
+ show();
+ scene->_actor6.hide();
+ if (scene->_field415 < 0)
+ scene->_field415 ^= 0xFFFE;
+ scene->_field412 = 1;
+ break;
+ case 2:
+ show();
+ scene->_actor5.hide();
+ if (scene->_field415 > 0)
+ scene->_field415 ^= 0xFFFE;
+ scene->_field412 = -1;
+ break;
+ case 3:
+ if (scene->_rotation->_idxChange == 0) {
+ show();
+ R2_GLOBALS._sceneManager.changeScene(1700);
+ } else {
+ scene->_field415 = 0;
+ scene->_actor4._moveRate = 20;
+ scene->_actor5._moveDiff.y = 1;
+ Common::Point pt(286, 143);
+ NpcMover *mover = new NpcMover();
+ scene->_actor4.addMover(mover, &pt, NULL);
+ }
+ default:
+ break;
+ }
+
+ return true;
+}
+
+void Scene1750::postInit(SceneObjectList *OwnerList) {
+ loadScene(1750);
+ R2_GLOBALS._sound1.play(115);
+ R2_GLOBALS._uiElements._active = false;
+ R2_GLOBALS._v5589E.set(0, 0, 320, 200);
+ SceneExt::postInit();
+
+ R2_GLOBALS._player._characterScene[1] = 1750;
+ R2_GLOBALS._player._characterScene[2] = 1750;
+ R2_GLOBALS._player._oldCharacterScene[1] = 1750;
+ R2_GLOBALS._player._oldCharacterScene[2] = 1750;
+
+ _rotation = R2_GLOBALS._scenePalette.addRotation(224, 254, 1);
+ _rotation->setDelay(0);
+ _rotation->_idxChange = 0;
+ _rotation->_countdown = 2;
+
+ switch ((R2_GLOBALS._v565F6 + 2) % 4) {
+ case 0:
+ _rotation->_currIndex = 247;
+ break;
+ case 1:
+ _rotation->_currIndex = 235;
+ break;
+ case 2:
+ _rotation->_currIndex = 239;
+ break;
+ case 3:
+ _rotation->_currIndex = 243;
+ break;
+ default:
+ break;
+ }
+
+ byte tmpPal[768];
+
+ for (int i = 224; i < 255; i++) {
+ int tmpIndex = _rotation->_currIndex - 224;
+ if (tmpIndex > 254)
+ tmpIndex -= 31;
+ tmpPal[3 * i] = R2_GLOBALS._scenePalette._palette[3 * tmpIndex];
+ tmpPal[(3 * i) + 1] = R2_GLOBALS._scenePalette._palette[(3 * tmpIndex) + 1];
+ tmpPal[(3 * i) + 2] = R2_GLOBALS._scenePalette._palette[(3 * tmpIndex) + 2];
+ }
+
+ for (int i = 224; i < 255; i++) {
+ R2_GLOBALS._scenePalette._palette[3 * i] = tmpPal[3 * i];
+ R2_GLOBALS._scenePalette._palette[(3 * i) + 1] = tmpPal[(3 * i) + 1];
+ R2_GLOBALS._scenePalette._palette[(3 * i) + 2] = tmpPal[(3 * i) + 2];
+ }
+
+ R2_GLOBALS._player.postInit();
+ R2_GLOBALS._player.hide();
+ R2_GLOBALS._player.enableControl();
+
+ _actor3.postInit();
+ _actor3.setup(1750, 3, 1);
+ _actor3.setPosition(Common::Point(49, 185));
+ _actor3.fixPriority(7);
+ _actor3.setDetails(1750, 30, -1, -1, 1, (SceneItem *) NULL);
+
+ _actor1.postInit();
+ _actor1.setup(1750, 2, 1);
+ _actor1.setPosition(Common::Point(35, ((_rotation->_currIndex - 218) % 4) + ((R2_GLOBALS._v565F6 % 800) * 4) - 1440));
+ _actor1.fixPriority(8);
+
+ _actor2.postInit();
+ _actor2.setup(1750, 1, 4);
+
+ int tmpVar = abs(_actor1._position.y - 158) / 100;
+
+ if (tmpVar >= 8)
+ _actor2.hide();
+ else if (_actor1._position.y <= 158)
+ _actor2.setPosition(Common::Point(137, (tmpVar * 7) + 122));
+ else
+ _actor2.setPosition(Common::Point(148, (tmpVar * 7) + 122));
+
+ _actor4.subB1A76(1, 286, 143, 41, 15);
+ _actor4.setDetails(1750, 24, 1, -1, 1, (SceneItem *) NULL);
+
+ _actor5.postInit();
+ _actor5._fieldA4 = 1;
+ _actor5.setup(1750, 1, 2);
+ _actor5.setPosition(Common::Point(192, 140));
+ _actor5.setDetails(1750, 18, 1, -1, 1, (SceneItem *) NULL);
+
+ _actor6.postInit();
+ _actor6._fieldA4 = 2;
+ _actor6.setup(1750, 1, 3);
+ _actor6.setPosition(Common::Point(192, 163));
+ _actor6.setDetails(1750, 18, 1, -1, 1, (SceneItem *) NULL);
+ _actor6.hide();
+
+ _actor7.postInit();
+ _actor7._fieldA4 = 3;
+ _actor7.setup(1750, 1, 5);
+ _actor7.setPosition(Common::Point(230, 183));
+ _actor7.setDetails(1750, 27, 1, -1, 1, (SceneItem *) NULL);
+
+ _field412 = 1;
+ _field417 = 0;
+ _field413 = 0;
+ _field415 = 0;
+ _field419 = ((_rotation->_currIndex - 218) / 4) % 4;
+
+ _item2.setDetails(Rect(129, 112, 155, 175), 1750, 21, -1, -1, 1, NULL);
+ _item3.setDetails(Rect(93, 122, 126, 172), 1750, 15, -1, -1, 1, NULL);
+ _item4.setDetails(Rect(3, 3, 157, 99), 1750, 9, -1, -1, 1, NULL);
+ _item5.setDetails(Rect(162, 3, 316, 99), 1750, 12, -1, -1, 1, NULL);
+ _item1.setDetails(Rect(0, 0, 320, 200), 1750, 6, 1, -1, 1, NULL);
+}
+
+void Scene1750::remove() {
+ _rotation->remove();
+
+ if (R2_GLOBALS._v565F6 == 2400)
+ R2_GLOBALS._v565F6 = 2399;
+
+ if (R2_GLOBALS._v565F6 == -2400)
+ R2_GLOBALS._v565F6 = -2399;
+
+ R2_GLOBALS._v565FA = R2_GLOBALS._v565F6;
+
+ SceneExt::remove();
+ R2_GLOBALS._sound1.fadeOut2(NULL);
+ R2_GLOBALS._v5589E.top = 3;
+ R2_GLOBALS._v5589E.bottom = 168;
+ R2_GLOBALS._uiElements._active = true;
+}
+
+void Scene1750::signal() {
+ R2_GLOBALS._player.enableControl();
+}
+
+void Scene1750::process(Event &event) {
+ Scene::process(event);
+ if (!event.handled)
+ _actor4.process(event);
+}
+
+void Scene1750::dispatch() {}
+
+/*--------------------------------------------------------------------------
+ * Scene 1800 -
+ *
+ *--------------------------------------------------------------------------*/
+Scene1800::Scene1800() {
+ _field412 = 0;
+}
+
+void Scene1800::synchronize(Serializer &s) {
+ SceneExt::synchronize(s);
+
+ s.syncAsSint16LE(_field412);
+}
+
+bool Scene1800::Hotspot5::startAction(CursorType action, Event &event) {
+ if ((action != R2_COM_SCANNER) && (action != R2_COM_SCANNER_2))
+ return false;
+
+ Scene1800 *scene = (Scene1800 *)R2_GLOBALS._sceneManager._scene;
+
+ R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS);
+
+ if (R2_GLOBALS._player._characterIndex == R2_QUINN) {
+ if (R2_GLOBALS._v565F6 == 1201) {
+ scene->_stripManager.start(548, this);
+ } else if (R2_GLOBALS.getFlag(66)) {
+ return false;
+ } else {
+ scene->_stripManager.start(546, this);
+ }
+ } else {
+ if (R2_GLOBALS._v565F6 == 1201) {
+ scene->_stripManager.start(549, this);
+ } else if (R2_GLOBALS.getFlag(66)) {
+ return false;
+ } else {
+ scene->_stripManager.start(547, this);
+ }
+ }
+
+ R2_GLOBALS.setFlag(66);
+ return true;
+}
+
+bool Scene1800::Actor6::startAction(CursorType action, Event &event) {
+ if (action != CURSOR_USE)
+ return SceneActor::startAction(action, event);
+
+ if (!R2_GLOBALS.getFlag(14))
+ return false;
+
+ if (R2_GLOBALS._player._characterIndex != R2_QUINN)
+ return SceneActor::startAction(action, event);
+
+ Scene1800 *scene = (Scene1800 *)R2_GLOBALS._sceneManager._scene;
+ R2_GLOBALS._player.disableControl();
+
+ if (_frame == 1) {
+ R2_GLOBALS.setFlag(64);
+ scene->_sceneMode = 1810;
+ scene->setAction(&scene->_sequenceManager, scene, 1810, &R2_GLOBALS._player, &scene->_actor6, &scene->_actor4, &scene->_actor5, NULL);
+ } else {
+ R2_GLOBALS.clearFlag(64);
+ scene->_sceneMode = 1811;
+ scene->setAction(&scene->_sequenceManager, scene, 1811, &R2_GLOBALS._player, &scene->_actor6, &scene->_actor4, &scene->_actor5, NULL);
+ }
+ return true;
+}
+
+bool Scene1800::Actor7::startAction(CursorType action, Event &event) {
+ if (action != CURSOR_USE)
+ return SceneActor::startAction(action, event);
+
+ Scene1800 *scene = (Scene1800 *)R2_GLOBALS._sceneManager._scene;
+
+ if (R2_GLOBALS._player._characterIndex == R2_SEEKER) {
+ R2_GLOBALS._player.disableControl();
+ if (scene->_field412 >= 2) {
+ if (R2_GLOBALS.getFlag(14)) {
+ scene->_sceneMode = 1809;
+ scene->setAction(&scene->_sequenceManager, scene, 1809, &R2_GLOBALS._player, &scene->_actor7, NULL);
+ R2_GLOBALS.clearFlag(14);
+ } else {
+ scene->_sceneMode = 1808;
+ scene->setAction(&scene->_sequenceManager, scene, 1808, &R2_GLOBALS._player, &scene->_actor7, NULL);
+ R2_GLOBALS.setFlag(14);
+ }
+ } else {
+ scene->_sceneMode = 1813;
+ scene->setAction(&scene->_sequenceManager, scene, 1813, &R2_GLOBALS._player, NULL);
+ }
+ } else if (R2_GLOBALS.getFlag(14)) {
+ return SceneActor::startAction(action, event);
+ } else {
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 1812;
+ scene->setAction(&scene->_sequenceManager, scene, 1812, &R2_GLOBALS._player, NULL);
+ }
+
+ return true;
+}
+
+bool Scene1800::Actor8::startAction(CursorType action, Event &event) {
+ if (action != CURSOR_USE)
+ return SceneActor::startAction(action, event);
+
+ Scene1800 *scene = (Scene1800 *)R2_GLOBALS._sceneManager._scene;
+
+ if (_position.x < 160) {
+ if (scene->_actor4._frame == 1) {
+ return SceneActor::startAction(action, event);
+ } else {
+ R2_GLOBALS.setFlag(29);
+ R2_GLOBALS._player.disableControl();
+ if (R2_GLOBALS._player._characterIndex == R2_QUINN) {
+ if (R2_GLOBALS.getFlag(14)) {
+ scene->_sceneMode = 1804;
+ scene->setAction(&scene->_sequenceManager, scene, 1804, &R2_GLOBALS._player, &scene->_actor2, &scene->_actor8, NULL);
+ } else {
+ scene->_sceneMode = 1;
+ scene->setAction(&scene->_sequenceManager, scene, 1809, &R2_GLOBALS._player, &scene->_actor2, &scene->_actor7, NULL);
+ R2_GLOBALS.clearFlag(14);
+ }
+ } else {
+ if (R2_GLOBALS.getFlag(14)) {
+ scene->_sceneMode = 1;
+ scene->setAction(&scene->_sequenceManager, scene, 1809, &R2_GLOBALS._player, &scene->_actor7, NULL);
+ R2_GLOBALS.clearFlag(14);
+ } else {
+ scene->_sceneMode = 1805;
+ scene->setAction(&scene->_sequenceManager, scene, 1805, &R2_GLOBALS._player, &scene->_actor2, &scene->_actor8, NULL);
+ }
+ }
+ }
+ } else {
+ if (scene->_actor4._frame == 1) {
+ return SceneActor::startAction(action, event);
+ } else {
+ R2_GLOBALS.clearFlag(29);
+ R2_GLOBALS._player.disableControl();
+ if (R2_GLOBALS._player._characterIndex == R2_QUINN) {
+ if (R2_GLOBALS.getFlag(14)) {
+ scene->_sceneMode = 2;
+ scene->setAction(&scene->_sequenceManager, scene, 1809, &R2_GLOBALS._player, &scene->_actor2, &scene->_actor7, NULL);
+ R2_GLOBALS.clearFlag(14);
+ } else {
+ scene->_sceneMode = 1806;
+ scene->setAction(&scene->_sequenceManager, scene, 1806, &R2_GLOBALS._player, &scene->_actor2, &scene->_actor9, NULL);
+ }
+ } else {
+ if (R2_GLOBALS.getFlag(14)) {
+ scene->_sceneMode = 2;
+ scene->setAction(&scene->_sequenceManager, scene, 1809, &R2_GLOBALS._player, &scene->_actor7, NULL);
+ R2_GLOBALS.clearFlag(14);
+ } else {
+ scene->_sceneMode = 1807;
+ scene->setAction(&scene->_sequenceManager, scene, 1807, &R2_GLOBALS._player, &scene->_actor2, &scene->_actor9, NULL);
+ }
+ }
+ }
+ }
+
+ return true;
+}
+
+void Scene1800::Exit1::changeScene() {
+ Scene1800 *scene = (Scene1800 *)R2_GLOBALS._sceneManager._scene;
+
+ _enabled = false;
+ R2_GLOBALS._events.setCursor(CURSOR_ARROW);
+ R2_GLOBALS._player.disableControl();
+ if (R2_GLOBALS.getFlag(14)) {
+ scene->_sceneMode = 3;
+ if (R2_GLOBALS._player._characterIndex == R2_QUINN)
+ scene->setAction(&scene->_sequenceManager, scene, 1809, &R2_GLOBALS._player, &scene->_actor7, NULL);
+ else
+ scene->setAction(&scene->_sequenceManager, scene, 1809, &scene->_actor2, &scene->_actor7, NULL);
+ R2_GLOBALS.clearFlag(14);
+ } else {
+ scene->_sceneMode = 1802;
+ if (R2_GLOBALS._player._characterIndex == R2_QUINN)
+ scene->setAction(&scene->_sequenceManager, scene, 1802, &R2_GLOBALS._player, &scene->_actor2, NULL);
+ else
+ scene->setAction(&scene->_sequenceManager, scene, 1802, &R2_GLOBALS._player, &scene->_actor2, NULL);
+ }
+}
+
+void Scene1800::postInit(SceneObjectList *OwnerList) {
+ loadScene(1800);
+ SceneExt::postInit();
+ R2_GLOBALS._sound1.play(116);
+ _stripManager.addSpeaker(&_quinnSpeaker);
+ _stripManager.addSpeaker(&_seekerSpeaker);
+
+ if (R2_GLOBALS._sceneManager._previousScene == -1)
+ R2_GLOBALS._v565F6 = 1201;
+
+ if (R2_GLOBALS._v565F6 == 1201)
+ _field412 = 2;
+ else
+ _field412 = 0;
+
+ scalePalette(65, 65, 65);
+ _exit1.setDetails(Rect(0, 160, 319, 168), EXITCURSOR_S, 1800);
+ _item5.setDetails(Rect(0, 0, 320, 200), -1, -1, -1, -1, 1, NULL);
+
+ _actor6.postInit();
+ _actor6.setup(1801, 4, 1);
+ _actor6.setPosition(Common::Point(170, 24));
+ _actor6.setDetails(1800, 13, 14, 15, 1, (SceneItem *) NULL);
+
+ _actor7.postInit();
+ _actor7.setup(1801, 3, 1);
+ _actor7.setPosition(Common::Point(160, 139));
+ _actor7.setDetails(1800, 6, -1, -1, 1, (SceneItem *) NULL);
+
+ _actor8.postInit();
+ _actor8.setup(1800, 1, 1);
+ _actor8.setPosition(Common::Point(110, 78));
+ _actor8.fixPriority(135);
+ _actor8.setDetails(1800, 20, -1, -1, 1, (SceneItem *) NULL);
+
+ _actor9.postInit();
+ _actor9.setup(1800, 2, 1);
+ _actor9.setPosition(Common::Point(209, 78));
+ _actor9.fixPriority(135);
+ _actor9.setDetails(1800, 20, -1, -1, 1, (SceneItem *) NULL);
+
+ _actor4.postInit();
+ if ((_field412 != 1) && (_field412 != 3) && (!R2_GLOBALS.getFlag(64)))
+ _actor4.setup(1801, 2, 1);
+ else
+ _actor4.setup(1801, 2, 10);
+ _actor4.setPosition(Common::Point(76, 142));
+ _actor4.setDetails(1800, 3, -1, -1, 1, (SceneItem *) NULL);
+
+ _actor5.postInit();
+ if ((_field412 != 1) && (_field412 != 3) && (!R2_GLOBALS.getFlag(64)))
+ _actor5.setup(1801, 1, 1);
+ else
+ _actor5.setup(1801, 1, 10);
+ _actor5.setPosition(Common::Point(243, 142));
+ _actor5.setDetails(1800, 3, -1, -1, 1, (SceneItem *) NULL);
+
+ R2_GLOBALS._player.postInit();
+ R2_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+ if (R2_GLOBALS._player._characterIndex == R2_QUINN) {
+ if (R2_GLOBALS.getFlag(14)) {
+ R2_GLOBALS._player.animate(ANIM_MODE_NONE, NULL);
+ R2_GLOBALS._player.setObjectWrapper(NULL);
+ R2_GLOBALS._player.setup(1801, 5, 12);
+ R2_GLOBALS._player.setPosition(Common::Point(160, 139));
+ R2_GLOBALS._walkRegions.enableRegion(9);
+ _actor7.hide();
+ } else {
+ R2_GLOBALS._player.setVisage(1507);
+ }
+ R2_GLOBALS._player._moveDiff = Common::Point(4, 2);
+ } else {
+ R2_GLOBALS._player.setVisage(1503);
+ R2_GLOBALS._player._moveDiff = Common::Point(2, 2);
+ }
+
+ _actor2.postInit();
+ _actor2.animate(ANIM_MODE_1, NULL);
+ _actor2.setObjectWrapper(new SceneObjectWrapper());
+ if (R2_GLOBALS._player._characterIndex == R2_QUINN) {
+ if (R2_GLOBALS.getFlag(14)) {
+ _actor2.animate(ANIM_MODE_NONE, NULL);
+ _actor2.setObjectWrapper(NULL);
+ _actor2.setup(1801, 5, 12);
+
+ R2_GLOBALS._walkRegions.enableRegion(9);
+ _actor7.hide();
+ } else {
+ _actor2.setup(1507, 1, 1);
+ _actor2.setPosition(Common::Point(180, 160));
+ }
+ _actor2.setDetails(9002, 0, 4, 3, 1, (SceneItem *) NULL);
+ _actor2._moveDiff = Common::Point(4, 2);
+ } else {
+ _actor2.setDetails(9001, 0, 5, 3, 1, (SceneItem *) NULL);
+ _actor2.setVisage(1503);
+ _actor2._moveDiff = Common::Point(2, 2);
+ }
+
+ if (R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] == 1800) {
+ if (R2_GLOBALS._player._characterIndex == R2_QUINN) {
+ R2_GLOBALS._player.setPosition(Common::Point(114, 150));
+ R2_GLOBALS._player.setStrip(5);
+ if (R2_GLOBALS.getFlag(14)) {
+ _actor2.setPosition(Common::Point(160, 139));
+ R2_GLOBALS._walkRegions.enableRegion(8);
+ } else {
+ _actor2.setPosition(Common::Point(209, 150));
+ _actor2.setStrip(6);
+ R2_GLOBALS._walkRegions.enableRegion(8);
+ }
+ } else {
+ if (R2_GLOBALS.getFlag(14)) {
+ R2_GLOBALS._player.setup(1801, 5, 12);
+ R2_GLOBALS._player.setPosition(Common::Point(160, 139));
+ } else {
+ R2_GLOBALS._player.setPosition(Common::Point(209, 150));
+ R2_GLOBALS._player.setStrip(6);
+ }
+ _actor2.setPosition(Common::Point(114, 150));
+ _actor2.setStrip(5);
+ R2_GLOBALS._walkRegions.enableRegion(10);
+ R2_GLOBALS._walkRegions.enableRegion(11);
+ }
+ } else {
+ if (R2_GLOBALS._player._characterIndex == R2_QUINN) {
+ R2_GLOBALS._player.setPosition(Common::Point(140, 160));
+ _actor2.setPosition(Common::Point(180, 160));
+ } else {
+ R2_GLOBALS._player.setPosition(Common::Point(180, 160));
+ _actor2.setPosition(Common::Point(140, 160));
+ }
+ }
+
+ _actor1.postInit();
+ _actor1.fixPriority(10);
+ if (R2_GLOBALS._player._characterIndex == R2_QUINN)
+ _actor1.setVisage(1111);
+ else
+ _actor1.setVisage(1110);
+
+ _actor1._effect = 5;
+ _actor1._field9C = _field312;
+
+ R2_GLOBALS._player._linkedActor = &_actor1;
+
+ _actor3.postInit();
+ _actor3.fixPriority(10);
+ if (R2_GLOBALS._player._characterIndex == R2_QUINN)
+ _actor3.setVisage(1110);
+ else
+ _actor3.setVisage(1111);
+
+ _actor3._effect = 5;
+ _actor3._field9C = _field312;
+
+ _actor2._linkedActor = &_actor3;
+
+ R2_GLOBALS._player._characterScene[1] = 1800;
+ R2_GLOBALS._player._characterScene[2] = 1800;
+
+ _item2.setDetails(Rect(128, 95, 190, 135), 1800, 10, -1, -1, 1, NULL);
+ _item1.setDetails(Rect(95, 3, 223, 135), 1800, 0, -1, -1, 1, NULL);
+
+ // Original was calling _item3.setDetails(Rect(1800, 11, 24, 23), 25, -1, -1, -1, 1, NULL);
+ // This is *wrong*. The following statement is a wild guess based on good common sense
+ _item3.setDetails(11, 1800, 23, 24, 25);
+ _item4.setDetails(Rect(0, 0, 320, 200), 1800, 17, -1, 19, 1, NULL);
+
+ R2_GLOBALS._player.disableControl();
+ if (R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] == 1800) {
+ if ((R2_GLOBALS.getFlag(14)) && (R2_GLOBALS._player._characterIndex == R2_SEEKER)) {
+ R2_GLOBALS._player.enableControl(CURSOR_USE);
+ R2_GLOBALS._player._canWalk = false;
+ } else {
+ R2_GLOBALS._player.enableControl(CURSOR_ARROW);
+ }
+ } else if (R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] == 1850) {
+ if (R2_GLOBALS.getFlag(29)) {
+ if (R2_GLOBALS._player._characterIndex == R2_QUINN) {
+ _sceneMode = 1814;
+ setAction(&_sequenceManager, this, 1814, &R2_GLOBALS._player, &_actor2, &_actor8, NULL);
+ } else {
+ _sceneMode = 1815;
+ setAction(&_sequenceManager, this, 1815, &R2_GLOBALS._player, &_actor2, &_actor8, NULL);
+ }
+ } else {
+ if (R2_GLOBALS._player._characterIndex == R2_QUINN) {
+ _sceneMode = 1816;
+ setAction(&_sequenceManager, this, 1816, &R2_GLOBALS._player, &_actor2, &_actor9, NULL);
+ } else {
+ _sceneMode = 1817;
+ setAction(&_sequenceManager, this, 1817, &R2_GLOBALS._player, &_actor2, &_actor9, NULL);
+ }
+ }
+ } else {
+ if (R2_GLOBALS._player._characterIndex == R2_QUINN) {
+ _sceneMode = 1800;
+ setAction(&_sequenceManager, this, 1800, &R2_GLOBALS._player, &_actor2, NULL);
+ } else {
+ _sceneMode = 1801;
+ setAction(&_sequenceManager, this, 1801, &R2_GLOBALS._player, &_actor2, NULL);
+ }
+ }
+
+ R2_GLOBALS._player._oldCharacterScene[1] = 1800;
+ R2_GLOBALS._player._oldCharacterScene[2] = 1800;
+}
+
+void Scene1800::signal() {
+ switch (_sceneMode) {
+ case 1:
+ if (R2_GLOBALS._player._characterIndex == R2_QUINN) {
+ _sceneMode = 1804;
+ setAction(&_sequenceManager, this, 1804, &R2_GLOBALS._player, &_actor2, &_actor8, NULL);
+ } else {
+ _sceneMode = 1805;
+ setAction(&_sequenceManager, this, 1805, &R2_GLOBALS._player, &_actor2, &_actor8, NULL);
+ }
+ break;
+ case 2:
+ if (R2_GLOBALS._player._characterIndex == R2_QUINN) {
+ _sceneMode = 1806;
+ setAction(&_sequenceManager, this, 1806, &R2_GLOBALS._player, &_actor2, &_actor9, NULL);
+ } else {
+ _sceneMode = 1807;
+ setAction(&_sequenceManager, this, 1807, &R2_GLOBALS._player, &_actor2, &_actor9, NULL);
+ }
+ break;
+ case 3:
+ _sceneMode = 1802;
+ if (R2_GLOBALS._player._characterIndex == R2_QUINN)
+ setAction(&_sequenceManager, this, 1802, &R2_GLOBALS._player, &_actor2, NULL);
+ else
+ setAction(&_sequenceManager, this, 1803, &R2_GLOBALS._player, &_actor2, NULL);
+ break;
+ case 10:
+ // No break on purpose
+ case 11:
+ R2_GLOBALS._player.enableControl(CURSOR_TALK);
+ break;
+ case 12:
+ R2_GLOBALS._player.enableControl(CURSOR_TALK);
+ R2_GLOBALS._player._canWalk = false;
+ break;
+ case 13:
+ _sceneMode = 14;
+ R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS);
+ R2_GLOBALS._player.setup(1801, 7, 1);
+ R2_GLOBALS._player.animate(ANIM_MODE_8, NULL);
+ _stripManager.start(550, this);
+ break;
+ case 14:
+ _sceneMode = 15;
+ R2_GLOBALS._player.disableControl();
+ R2_GLOBALS._player.setup(1801, 6, 1);
+ R2_GLOBALS._player.animate(ANIM_MODE_6, this);
+ break;
+ case 15:
+ R2_GLOBALS._player.setup(1503, 4, 1);
+ R2_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+ R2_GLOBALS._player.enableControl(CURSOR_USE);
+ break;
+ case 1800:
+ R2_GLOBALS._walkRegions.enableRegion(8);
+ if (R2_GLOBALS.getFlag(63))
+ R2_GLOBALS._player.enableControl(CURSOR_USE);
+ else {
+ _sceneMode = 10;
+ R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS);
+ _stripManager.start(544, this);
+ }
+ break;
+ case 1801:
+ R2_GLOBALS._walkRegions.enableRegion(10);
+ R2_GLOBALS._walkRegions.enableRegion(11);
+ R2_GLOBALS.setFlag(63);
+
+ // The following check is completely dumb.
+ // Either an original bug, or dead code.
+ if (R2_GLOBALS.getFlag(63)) {
+ R2_GLOBALS._player.enableControl(CURSOR_ARROW);
+ } else {
+ _sceneMode = 10;
+ R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS);
+ _stripManager.start(545, this);
+ }
+ break;
+ case 1802:
+ R2_GLOBALS.clearFlag(14);
+ R2_GLOBALS._sceneManager.changeScene(1700);
+ break;
+ case 1804:
+ // No break on purpose
+ case 1805:
+ // No break on purpose
+ case 1806:
+ // No break on purpose
+ case 1807:
+ R2_GLOBALS.clearFlag(14);
+ R2_GLOBALS._sceneManager.changeScene(1850);
+ break;
+ case 1808:
+ _sceneMode = 12;
+ R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS);
+ _stripManager.start(553, this);
+ break;
+ case 1812:
+ _sceneMode = 13;
+ R2_GLOBALS._player.animate(ANIM_MODE_5, this);
+ break;
+ case 1814:
+ // No break on purpose
+ case 1815:
+ R2_GLOBALS._walkRegions.enableRegion(10);
+ R2_GLOBALS._walkRegions.enableRegion(11);
+ R2_GLOBALS._player.enableControl();
+ break;
+ case 1816:
+ // No break on purpose
+ case 1817:
+ R2_GLOBALS._walkRegions.enableRegion(8);
+ R2_GLOBALS._player.enableControl();
+ break;
+ default:
+ R2_GLOBALS._player.enableControl();
+ break;
+ }
+}
+
+void Scene1800::saveCharacter(int characterIndex) {
+ if (R2_GLOBALS._player._characterIndex == R2_MIRANDA)
+ R2_GLOBALS._sound1.fadeOut2(NULL);
+
+ SceneExt::saveCharacter(characterIndex);
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 1850 -
+ *
+ *--------------------------------------------------------------------------*/
+Scene1850::Scene1850() {
+ warning("STUBBED: Scene1850()");
+}
+
+void Scene1850::synchronize(Serializer &s) {
+ warning("STUBBED: Scene1850::synchronize()");
+}
+
+bool Scene1850::Hotspot2::startAction(CursorType action, Event &event) {
+ if (action != CURSOR_USE)
+ return SceneHotspot::startAction(action, event);
+
+ Scene1850 *scene = (Scene1850 *)R2_GLOBALS._sceneManager._scene;
+
+ R2_GLOBALS._player.disableControl();
+ if (R2_GLOBALS._player._characterIndex == R2_QUINN) {
+ scene->_sceneMode = 1852;
+ if (R2_GLOBALS.getFlag(32))
+ scene->setAction(&scene->_sequenceManager1, scene, 1871, &R2_GLOBALS._player, NULL);
+ else
+ scene->setAction(&scene->_sequenceManager1, scene, 1852, &R2_GLOBALS._player, NULL);
+ } else if (R2_GLOBALS.getFlag(30)) {
+ scene->_field41E = 1;
+ scene->_sceneMode = 1860;
+
+ if (R2_GLOBALS.getFlag(32))
+ scene->setAction(&scene->_sequenceManager1, scene, 1860, &R2_GLOBALS._player, &scene->_actor5, NULL);
+ else
+ scene->setAction(&scene->_sequenceManager1, scene, 1859, &R2_GLOBALS._player, &scene->_actor5, NULL);
+
+ R2_GLOBALS.clearFlag(30);
+ } else {
+ scene->_sceneMode = 1853;
+
+ if (R2_GLOBALS.getFlag(32))
+ scene->setAction(&scene->_sequenceManager1, scene, 1872, &R2_GLOBALS._player, NULL);
+ else
+ scene->setAction(&scene->_sequenceManager1, scene, 1853, &R2_GLOBALS._player, NULL);
+ }
+
+ return true;
+}
+
+bool Scene1850::Actor5::startAction(CursorType action, Event &event) {
+ Scene1850 *scene = (Scene1850 *)R2_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_USE:
+ if ((R2_GLOBALS._player._characterIndex != R2_SEEKER) || (R2_GLOBALS.getFlag(33)) || (R2_GLOBALS.getFlag(30)))
+ return SceneActor::startAction(action, event);
+
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 1857;
+
+ if (R2_GLOBALS.getFlag(32))
+ scene->setAction(&scene->_sequenceManager1, scene, 1858, &R2_GLOBALS._player, &scene->_actor5, NULL);
+ else
+ scene->setAction(&scene->_sequenceManager1, scene, 1857, &R2_GLOBALS._player, &scene->_actor5, NULL);
+
+ R2_GLOBALS.setFlag(30);
+ return true;
+ break;
+ case CURSOR_LOOK:
+ if (R2_GLOBALS.getFlag(34))
+ SceneItem::display(1850, 2, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ else
+ SceneItem::display(1850, 1, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+
+ return true;
+ break;
+ case R2_AIRBAG:
+ if (R2_GLOBALS._player._characterIndex == R2_SEEKER) {
+ if (R2_GLOBALS.getFlag(70)) {
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 30;
+
+ R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS);
+ scene->_stripManager.start(558, scene);
+
+ return true;
+ } else {
+ return SceneActor::startAction(action, event);
+ }
+ } else if (R2_GLOBALS.getFlag(30)) {
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 1875;
+ scene->_actor2.postInit();
+
+ if (R2_GLOBALS.getFlag(32))
+ scene->setAction(&scene->_sequenceManager1, scene, 1876, &R2_GLOBALS._player, &scene->_actor2, NULL);
+ else
+ scene->setAction(&scene->_sequenceManager1, scene, 1875, &R2_GLOBALS._player, &scene->_actor2, NULL);
+
+ return true;
+ } else if (R2_GLOBALS.getFlag(70)) {
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 30;
+ R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS);
+ scene->_stripManager.start(557, scene);
+ R2_GLOBALS.setFlag(69);
+
+ return true;
+ } else {
+ return SceneActor::startAction(action, event);
+ }
+ break;
+ case R2_REBREATHER_TANK:
+ if (R2_INVENTORY.getObjectScene(R2_AIRBAG) == 1850) {
+ if (R2_GLOBALS.getFlag(30))
+ return SceneActor::startAction(action, event);;
+
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 1878;
+ scene->setAction(&scene->_sequenceManager1, scene, 1878, &R2_GLOBALS._player, &scene->_actor5, &scene->_actor2, NULL);
+ }
+
+ return true;
+ break;
+ default:
+ return SceneActor::startAction(action, event);
+ break;
+ }
+}
+
+bool Scene1850::Actor6::startAction(CursorType action, Event &event) {
+ if (action != CURSOR_USE)
+ return SceneHotspot::startAction(action, event);
+
+ Scene1850 *scene = (Scene1850 *)R2_GLOBALS._sceneManager._scene;
+
+ if (R2_GLOBALS.getFlag(32)) {
+ SceneItem::display(3240, 4, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ return true;
+ }
+
+ R2_GLOBALS._player.disableControl();
+ if (scene->_field412 == 1851)
+ R2_GLOBALS._player._effect = 1;
+
+ if (_position.x >= 160)
+ R2_GLOBALS.setFlag(29);
+ else
+ R2_GLOBALS.clearFlag(29);
+
+ if ((R2_GLOBALS._player._characterIndex == R2_SEEKER) && (R2_GLOBALS.getFlag(30))) {
+ if (_position.x >= 160)
+ scene->_field41E = 3;
+ else
+ scene->_field41E = 2;
+
+ scene->_sceneMode = 1860;
+
+ if (R2_GLOBALS.getFlag(32)) {
+ scene->setAction(&scene->_sequenceManager1, scene, 1860, &R2_GLOBALS._player, &scene->_actor5, NULL);
+ } else {
+ scene->setAction(&scene->_sequenceManager1, scene, 1859, &R2_GLOBALS._player, &scene->_actor5, NULL);
+ }
+ } else {
+ scene->_sceneMode = 11;
+ if (_position.x >= 160) {
+ scene->setAction(&scene->_sequenceManager1, scene, 1866, &R2_GLOBALS._player, &scene->_actor7, NULL);
+ } else {
+ scene->setAction(&scene->_sequenceManager1, scene, 1865, &R2_GLOBALS._player, &scene->_actor6, NULL);
+ }
+ }
+
+ return true;
+}
+
+bool Scene1850::Actor8::startAction(CursorType action, Event &event) {
+ if ((action != CURSOR_USE) || (_position.y != 120))
+ return SceneHotspot::startAction(action, event);
+
+ Scene1850 *scene = (Scene1850 *)R2_GLOBALS._sceneManager._scene;
+
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 1881;
+
+ if (R2_GLOBALS._player._characterIndex == R2_QUINN) {
+ scene->setAction(&scene->_sequenceManager1, scene, 1881, &R2_GLOBALS._player, NULL);
+ } else {
+ scene->setAction(&scene->_sequenceManager1, scene, 1880, &R2_GLOBALS._player, NULL);
+ }
+
+ return true;
+}
+
+void Scene1850::postInit(SceneObjectList *OwnerList) {
+ loadScene(1850);
+
+ if (R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] != 1850)
+ R2_GLOBALS.clearFlag(31);
+
+ _palette1.loadPalette(0);
+
+ if (R2_GLOBALS.getFlag(31)) {
+ _field412 = 1850;
+ g_globals->_scenePalette.loadPalette(1850);
+ } else {
+ _field412 = 1851;
+ g_globals->_scenePalette.loadPalette(1851);
+ }
+
+ SceneExt::postInit();
+
+ if (R2_GLOBALS._sceneManager._previousScene == 3150)
+ R2_GLOBALS._sound1.play(116);
+
+ _stripManager.addSpeaker(&_quinnSpeaker);
+ _stripManager.addSpeaker(&_seekerSpeaker);
+
+ _field418 = 0;
+ _field41E = 0;
+ _field41A = Common::Point(0, 0);
+
+ R2_GLOBALS._player._characterScene[1] = 1850;
+ R2_GLOBALS._player._characterScene[2] = 1850;
+
+ _item2.setDetails(Rect(101, 56, 111, 63), 1850, 19, -1, -1, 1, NULL);
+
+ _actor6.postInit();
+ _actor6.setup(1850, 3, 1);
+ _actor6.setPosition(Common::Point(66, 102));
+ _actor6.setDetails(1850, 22, -1, -1, 1, (SceneItem *) NULL);
+
+ _actor7.postInit();
+ _actor7.setup(1850, 2, 1);
+ _actor7.setPosition(Common::Point(253, 102));
+ _actor7.setDetails(1850, 22, -1, -1, 1, (SceneItem *) NULL);
+
+ R2_GLOBALS._walkRegions.enableRegion(1);
+
+ _actor5.postInit();
+
+ if (R2_GLOBALS.getFlag(34)) {
+ R2_GLOBALS._walkRegions.enableRegion(2);
+ _actor5.setup(1851, 4, 3);
+ } else if (R2_GLOBALS.getFlag(30)) {
+ _actor5.setup(1851, 2, 2);
+ } else {
+ R2_GLOBALS._walkRegions.enableRegion(5);
+ if (R2_GLOBALS.getFlag(33)) {
+ R2_GLOBALS._walkRegions.enableRegion(2);
+ _actor5.setup(1851, 1, 3);
+ } else {
+ _actor5.setup(1851, 2, 1);
+ }
+ }
+
+ _actor5.setPosition(Common::Point(219, 130));
+ _actor5.fixPriority(114);
+ _actor5.setDetails(1850, -1, -1, -1, 1, (SceneItem *) NULL);
+
+ R2_GLOBALS._player.postInit();
+
+ _actor1.postInit();
+ if (R2_GLOBALS._player._characterIndex == R2_QUINN) {
+ _actor1.setDetails(9002, 0, 4, 3, 1, (SceneItem *) NULL);
+ } else {
+ _actor1.setDetails(9001, 0, 5, 3, 1, (SceneItem *) NULL);
+ }
+
+ if (R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] == 1850) {
+ R2_GLOBALS._player._effect = 6;
+ _actor1._effect = 6;
+ if (R2_GLOBALS.getFlag(31)) {
+ R2_GLOBALS._player._shade = 0;
+ _actor1._shade = 0;
+ } else {
+ R2_GLOBALS._player._shade = 6;
+ _actor1._shade = 6;
+ }
+
+ if (R2_INVENTORY.getObjectScene(R2_AIRBAG) == 1850) {
+ _actor2.postInit();
+ if (R2_GLOBALS.getFlag(34)) {
+ _actor2.setup(1851, 4, 2);
+ _actor2.fixPriority(114);
+ } else {
+ _actor2.setup(1851, 4, 1);
+ }
+
+ _actor2.setPosition(Common::Point(179, 113));
+
+ if ((_actor5._strip == 1) && (_actor5._frame == 3)){
+ _actor2.hide();
+ }
+
+ _actor2.setDetails(1850, 6, -1, -1, 1, (SceneItem *) NULL);
+ }
+
+ if (R2_GLOBALS._player._characterIndex == R2_QUINN) {
+ if (R2_GLOBALS.getFlag(32)) {
+ R2_GLOBALS._player.setVisage(1511);
+ _actor1.setVisage(1508);
+
+ _actor3.postInit();
+ _actor3.setup(1853, 3, 1);
+ _actor3.setPosition(Common::Point(122, 113));
+ _actor3.fixPriority(114);
+ _actor3._effect = 6;
+
+ // Totally useless test
+ if (R2_GLOBALS._player._characterIndex == R2_QUINN) {
+ _actor3.setDetails(1850, 28, -1, -1, 2, (SceneItem *) NULL);
+ } else {
+ // And the associated dead code
+ _actor3.setDetails(1850, 30, -1, -1, 2, (SceneItem *) NULL);
+ }
+
+ _actor4.postInit();
+ _actor4.setup(1853, 3, 2);
+ _actor4.setPosition(Common::Point(139, 111));
+ _actor4.fixPriority(114);
+ _actor4._effect = 6;
+
+ // Still totally useless test
+ if (R2_GLOBALS._player._characterIndex == R2_QUINN) {
+ _actor4.setDetails(1850, 29, -1, -1, 2, (SceneItem *) NULL);
+ } else {
+ // Another piece of dead code
+ _actor4.setDetails(1850, 28, -1, -1, 2, (SceneItem *) NULL);
+ }
+
+ if (R2_GLOBALS.getFlag(31)) {
+ _actor3._shade = 0;
+ _actor4._shade = 0;
+ } else {
+ _actor3._shade = 6;
+ _actor4._shade = 6;
+ }
+ } else {
+ R2_GLOBALS._player.setVisage(1500);
+ _actor1.setVisage(1505);
+ }
+ } else { // Not Quinn
+ if (R2_GLOBALS.getFlag(32)) {
+ R2_GLOBALS._player.setVisage(1508);
+ _actor1.setVisage(1511);
+
+ _actor3.postInit();
+ _actor3.setup(1853, 3, 1);
+ _actor3.setPosition(Common::Point(122, 113));
+ _actor3.fixPriority(114);
+ _actor3._effect = 6;
+
+ // Totally useless test
+ if (R2_GLOBALS._player._characterIndex == R2_QUINN) {
+ // Dead code
+ _actor3.setDetails(1850, 28, -1, -1, 2, (SceneItem *) NULL);
+ } else {
+ _actor3.setDetails(1850, 30, -1, -1, 2, (SceneItem *) NULL);
+ }
+
+ _actor4.postInit();
+ _actor4.setup(1853, 3, 2);
+ _actor4.setPosition(Common::Point(139, 111));
+ _actor4.fixPriority(114);
+ _actor4._effect = 6;
+
+ // Again, useless test
+ if (R2_GLOBALS._player._characterIndex == R2_QUINN) {
+ // and dead code
+ _actor4.setDetails(1850, 29, -1, -1, 1, (SceneItem *) NULL);
+ } else {
+ _actor4.setDetails(1850, 28, -1, -1, 1, (SceneItem *) NULL);
+ }
+
+ if (R2_GLOBALS.getFlag(31)) {
+ _actor3._shade = 0;
+ _actor4._shade = 0;
+ } else {
+ _actor3._shade = 6;
+ _actor4._shade = 6;
+ }
+ } else {
+ R2_GLOBALS._player.setVisage(1505);
+ _actor1.setVisage(1500);
+ }
+ }
+
+ R2_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+ R2_GLOBALS._player.setStrip(3);
+ R2_GLOBALS._player.setPosition(Common::Point(80, 114));
+
+ _actor1.animate(ANIM_MODE_1, NULL);
+ _actor1.setObjectWrapper(new SceneObjectWrapper());
+ _actor1.setStrip(3);
+ _actor1.setPosition(Common::Point(180, 96));
+
+ if (R2_GLOBALS.getFlag(30)) {
+ if (R2_GLOBALS._player._characterIndex == R2_QUINN) {
+ _actor1.animate(ANIM_MODE_NONE, NULL);
+ _actor1.setObjectWrapper(NULL);
+ if (R2_GLOBALS.getFlag(32)) {
+ _actor1.setup(1854, 1, 3);
+ } else {
+ _actor1.setup(1854, 2, 3);
+ }
+
+ _actor1.setPosition(Common::Point(164, 106));
+ } else {
+ _actor1.animate(ANIM_MODE_NONE, NULL);
+ _actor1.setObjectWrapper(NULL);
+ if (R2_GLOBALS.getFlag(32)) {
+ R2_GLOBALS._player.setup(1854, 1, 3);
+ } else {
+ R2_GLOBALS._player.setup(1854, 2, 3);
+ }
+
+ R2_GLOBALS._player.setPosition(Common::Point(164, 106));
+ }
+ }
+
+ R2_GLOBALS._player.enableControl();
+ } else { // R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] != 1850
+ R2_GLOBALS._player._effect = 1;
+ _actor1._effect = 1;
+ R2_GLOBALS._player.disableControl();
+ _sceneMode = 10;
+ if (R2_GLOBALS._player._characterIndex == R2_QUINN) {
+ if (R2_GLOBALS.getFlag(29)) {
+ setAction(&_sequenceManager1, this, 1863, &R2_GLOBALS._player, &_actor1, &_actor7, NULL);
+ } else {
+ setAction(&_sequenceManager1, this, 1861, &R2_GLOBALS._player, &_actor1, &_actor6, NULL);
+ }
+ } else {
+ if (R2_GLOBALS.getFlag(29)) {
+ setAction(&_sequenceManager1, this, 1864, &R2_GLOBALS._player, &_actor1, &_actor7, NULL);
+ } else {
+ setAction(&_sequenceManager1, this, 1862, &R2_GLOBALS._player, &_actor1, &_actor6, NULL);
+ }
+ }
+ }
+
+ if (R2_GLOBALS._player._characterIndex == R2_QUINN) {
+ R2_GLOBALS._player._moveDiff = Common::Point(3, 2);
+ _actor1._moveDiff = Common::Point(5, 3);
+ } else {
+ R2_GLOBALS._player._moveDiff = Common::Point(5, 3);
+ _actor1._moveDiff = Common::Point(3, 2);
+ }
+
+ _actor8.postInit();
+ _actor8.setup(1850, 1, 1);
+
+ if (R2_GLOBALS.getFlag(62)) {
+ _actor8.setPosition(Common::Point(159, 120));
+ } else {
+ _actor8.setPosition(Common::Point(159, 184));
+ }
+
+ _actor8.fixPriority(113);
+
+ if (R2_GLOBALS.getFlag(34)) {
+ _actor8.setDetails(1850, 25, -1, -1, 4, &_actor5);
+ } else {
+ _actor8.setDetails(1850, 25, -1, -1, 2, (SceneItem *) NULL);
+ }
+
+ if (!R2_GLOBALS.getFlag(62)) {
+ _actor8.hide();
+ }
+
+ _item1.setDetails(Rect(0, 0, 320, 200), 1850, 16, -1, -1, 1, NULL);
+
+ R2_GLOBALS._player._oldCharacterScene[1] = 1850;
+ R2_GLOBALS._player._oldCharacterScene[2] = 1850;
+}
+
+void Scene1850::remove() {
+ g_globals->_scenePalette.loadPalette(0);
+
+ R2_GLOBALS._scenePalette._palette[771] = 255;
+ R2_GLOBALS._scenePalette._palette[772] = 255;
+ R2_GLOBALS._scenePalette._palette[773] = 255;
+
+ SceneExt::remove();
+}
+
+void Scene1850::signal() {
+ switch (_sceneMode) {
+ case 10:
+ R2_GLOBALS._player._effect = 6;
+ R2_GLOBALS._player._shade = 6;
+
+ _actor1._effect = 6;
+ _actor1._shade = 6;
+
+ R2_GLOBALS._walkRegions.enableRegion(5);
+
+ if (R2_GLOBALS.getFlag(68)) {
+ R2_GLOBALS._player.enableControl();
+ } else {
+ R2_GLOBALS.setFlag(68);
+ _sceneMode = 20;
+ R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS);
+ _stripManager.start(554, this);
+ }
+ break;
+ case 11:
+ R2_GLOBALS.clearFlag(30);
+ R2_GLOBALS._sceneManager.changeScene(1800);
+ break;
+ case 15:
+ _sceneMode = 16;
+ break;
+ case 16:
+ _sceneMode = 1870;
+ setAction(&_sequenceManager1, this, 1870, &R2_GLOBALS._player, &_actor1, &_actor3, &_actor4, NULL);
+ break;
+ case 20:
+ R2_GLOBALS._player.enableControl(CURSOR_TALK);
+ break;
+ case 21:
+ R2_GLOBALS._player.disableControl();
+ _sceneMode = 1877;
+ setAction(&_sequenceManager1, this, 1877, &R2_GLOBALS._player, &_actor1, &_actor5, NULL);
+ break;
+ case 30:
+ R2_GLOBALS._player.disableControl();
+ _sceneMode = 1882;
+ setAction(&_sequenceManager1, this, 1882, &R2_GLOBALS._player, NULL);
+ break;
+ case 1852:
+ // No break on purpose:
+ case 1853:
+ if (_field412 == 1851) {
+ R2_GLOBALS.setFlag(31);
+ _palette1.loadPalette(1850);
+ _field412 = 1850;
+ } else {
+ R2_GLOBALS.clearFlag(31);
+ _palette1.loadPalette(1851);
+ _field412 = 1851;
+ }
+
+ _field418 = 1;
+ if (R2_GLOBALS.getFlag(30)) {
+ _actor8.setAction(&_sequenceManager2, NULL, 1867, &_actor8, NULL);
+ } else if (R2_GLOBALS.getFlag(34)) {
+ if (R2_GLOBALS.getFlag(62)) {
+ R2_GLOBALS.clearFlag(62);
+ _actor8.setAction(&_sequenceManager2, this, 1851, &_actor8, NULL);
+ } else {
+ R2_GLOBALS.setFlag(62);
+ _actor8.setAction(&_sequenceManager2, this, 1850, &_actor8, NULL);
+ }
+ } else if (R2_GLOBALS.getFlag(33)) {
+ R2_GLOBALS.setFlag(62);
+ R2_GLOBALS.setFlag(34);
+ R2_GLOBALS._walkRegions.enableRegion(2);
+
+ _actor2.postInit();
+ _actor2.setDetails(1850, 6, -1, -1, 5, &_actor5);
+
+ _sceneMode = 1879;
+
+ _actor8.setAction(&_sequenceManager2, this, 1879, &_actor5, &_actor8, &_actor2, NULL);
+ } else {
+ _actor8.setAction(&_sequenceManager2, NULL, 1867, &_actor8, NULL);
+ }
+
+ if (R2_GLOBALS.getFlag(34))
+ R2_GLOBALS._scenePalette.addFader(_palette1._palette, 256, 5, NULL);
+ else
+ R2_GLOBALS._scenePalette.addFader(_palette1._palette, 256, 5, this);
+
+ if (_field412 == 1851)
+ _field416 = -20;
+ else
+ _field416 = 20;
+
+ _field414 = 20;
+
+ if (R2_GLOBALS._player._characterIndex == R2_QUINN) {
+ if (_sceneMode == 1879)
+ _sceneMode = 1854;
+
+ if (R2_GLOBALS.getFlag(32)) {
+ setAction(&_sequenceManager1, NULL, 1873, &R2_GLOBALS._player, NULL);
+ } else {
+ setAction(&_sequenceManager1, NULL, 1854, &R2_GLOBALS._player, NULL);
+ }
+ } else {
+ if (_sceneMode == 1879)
+ _sceneMode = 1855;
+
+ if (R2_GLOBALS.getFlag(32)) {
+ setAction(&_sequenceManager1, NULL, 1874, &R2_GLOBALS._player, NULL);
+ } else {
+ setAction(&_sequenceManager1, NULL, 1855, &R2_GLOBALS._player, NULL);
+ }
+ }
+ break;
+ case 1857:
+ if (R2_GLOBALS.getFlag(69)) {
+ R2_GLOBALS._player.enableControl();
+ R2_GLOBALS._player._canWalk = false;
+ } else {
+ _sceneMode = 1858;
+ R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS);
+ _stripManager.start(555, this);
+ R2_GLOBALS.setFlag(69);
+ }
+ break;
+ case 1858:
+ R2_GLOBALS._player.disableControl();
+ _sceneMode = 1859;
+ setAction(&_sequenceManager1, this, 1859, &R2_GLOBALS._player, &_actor5, NULL);
+ R2_GLOBALS.clearFlag(30);
+ break;
+ case 1859:
+ R2_GLOBALS.setFlag(70);
+ _sceneMode = 20;
+ R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS);
+ _stripManager.start(575, this);
+ break;
+ case 1860:
+ if (_field41A.x != 0) {
+ R2_GLOBALS._player.enableControl();
+
+ PlayerMover *mover = new PlayerMover();
+ R2_GLOBALS._player.addMover(mover, &_field41A, this);
+
+ _field41A = Common::Point(0, 0);
+ }
+
+ switch (_field41E) {
+ case 1:
+ _sceneMode = 1853;
+ if (R2_GLOBALS.getFlag(32)) {
+ setAction(&_sequenceManager1, this, 1872, &R2_GLOBALS._player, NULL);
+ } else {
+ setAction(&_sequenceManager1, this, 1853, &R2_GLOBALS._player, NULL);
+ }
+ break;
+ case 2:
+ _sceneMode = 11;
+ setAction(&_sequenceManager1, this, 1865, &R2_GLOBALS._player, &_actor6, NULL);
+ break;
+ case 3:
+ warning("_field41E == 3");
+ _sceneMode = 11;
+ setAction(&_sequenceManager1, this, 1866, &R2_GLOBALS._player, &_actor7, NULL);
+ break;
+ default:
+ break;
+ }
+
+ _field41E = 0;
+ break;
+ case 1870:
+ R2_GLOBALS._walkRegions.enableRegion(5);
+ R2_INVENTORY.setObjectScene(R2_REBREATHER_TANK, 1);
+ R2_GLOBALS.setFlag(32);
+ R2_GLOBALS._player.enableControl(CURSOR_ARROW);
+ break;
+ case 1875:
+ R2_INVENTORY.setObjectScene(R2_AIRBAG, 1850);
+ _sceneMode = 21;
+ R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS);
+ _stripManager.start(561, this);
+ break;
+ case 1877:
+ _actor3.postInit();
+ _actor3._effect = 6;
+
+ if (R2_GLOBALS._player._characterIndex == R2_QUINN) {
+ _actor3.setDetails(1850, 28, -1, -1, 2, (SceneItem *)NULL);
+ } else {
+ _actor3.setDetails(1850, 30, -1, -1, 2, (SceneItem *)NULL);
+ }
+
+ _actor4.postInit();
+ _actor4._effect = 6;
+
+ if (R2_GLOBALS._player._characterIndex == R2_QUINN) {
+ _actor4.setDetails(1850, 29, -1, -1, 2, (SceneItem *)NULL);
+ } else {
+ _actor4.setDetails(1850, 28, -1, -1, 2, (SceneItem *)NULL);
+ }
+
+ if (R2_GLOBALS.getFlag(31)) {
+ _actor3._shade = 0;
+ _actor4._shade = 0;
+ } else {
+ _actor3._shade = 6;
+ _actor4._shade = 6;
+ }
+
+ R2_GLOBALS.clearFlag(30);
+ _sceneMode = 15;
+ setAction(&_sequenceManager1, this, 1869, &R2_GLOBALS._player, &_actor3, NULL);
+ setAction(&_sequenceManager2, this, 1868, &_actor1, &_actor4, NULL);
+ break;
+ case 1878:
+ R2_INVENTORY.setObjectScene(R2_REBREATHER_TANK, 1850);
+ R2_GLOBALS.setFlag(33);
+ R2_GLOBALS._walkRegions.enableRegion(2);
+ R2_GLOBALS._player.enableControl();
+ break;
+ case 1879:
+ R2_GLOBALS._player.enableControl();
+ break;
+ case 1881:
+ R2_GLOBALS._sceneManager.changeScene(1875);
+ break;
+ case 1882:
+ R2_INVENTORY.setObjectScene(R2_AIRBAG, 1);
+ R2_GLOBALS._player.enableControl();
+ break;
+ default:
+ R2_GLOBALS._player.enableControl();
+ break;
+ }
+}
+
+void Scene1850::process(Event &event) {
+ if ( (event.eventType == EVENT_BUTTON_DOWN) && (R2_GLOBALS._events.getCursor() == CURSOR_ARROW)
+ && (R2_GLOBALS._player._characterIndex == R2_SEEKER) && (R2_GLOBALS.getFlag(30))) {
+ _field41A = event.mousePos;
+ R2_GLOBALS._player.disableControl();
+ _sceneMode = 1860;
+ if (R2_GLOBALS.getFlag(32)) {
+ setAction(&_sequenceManager1, this, 1860, &R2_GLOBALS._player, &_actor5, NULL);
+ } else {
+ setAction(&_sequenceManager1, this, 1859, &R2_GLOBALS._player, &_actor5, NULL);
+ }
+ R2_GLOBALS.clearFlag(32);
+ event.handled = true;
+ }
+
+ Scene::process(event);
+}
+
+void Scene1850::dispatch() {
+ if (_field418 != 0) {
+ _field414--;
+ if (_field414 == 0)
+ _field418 = 0;
+
+ if (_field416 >= 0) {
+ R2_GLOBALS._player._shade = (_field414 * 6) / _field416;
+ } else {
+ R2_GLOBALS._player._shade = ((_field414 * 6) / _field416) + 6;
+ }
+ R2_GLOBALS._player._flags |= OBJFLAG_PANES;
+
+ _actor1._shade = R2_GLOBALS._player._shade;
+ _actor1._flags |= OBJFLAG_PANES;
+
+ _actor3._shade = R2_GLOBALS._player._shade;
+ _actor3._flags |= OBJFLAG_PANES;
+
+ _actor4._shade = R2_GLOBALS._player._shade;
+ _actor4._flags |= OBJFLAG_PANES;
+ }
+
+ if (R2_GLOBALS.getFlag(32)) {
+ _actor3.setPosition(Common::Point(_actor8._position.x - 37, _actor8._position.y - 71));
+ _actor4.setPosition(Common::Point(_actor8._position.x - 20, _actor8._position.y - 73));
+ }
+
+ if (R2_INVENTORY.getObjectScene(R2_AIRBAG) == 1850) {
+ _actor2.setPosition(Common::Point(_actor8._position.x + 20, _actor8._position.y - 71));
+ }
+
+ Scene::dispatch();
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 1875 -
+ *
+ *--------------------------------------------------------------------------*/
+Scene1875::Actor1875::Actor1875() {
+ _fieldA4 = 0;
+ _fieldA6 = 0;
+}
+
+void Scene1875::Actor1875::synchronize(Serializer &s) {
+ SceneActor::synchronize(s);
+
+ s.syncAsSint16LE(_fieldA4);
+ s.syncAsSint16LE(_fieldA6);
+}
+
+void Scene1875::Actor1875::subB84AB() {
+ Scene1875 *scene = (Scene1875 *)R2_GLOBALS._sceneManager._scene;
+
+ R2_GLOBALS._sound1.play(227);
+
+ int newFrameNumber;
+ switch (_fieldA4) {
+ case 3:
+ if ((scene->_actor1._frame == 1) && (scene->_actor4._strip == 2)) {
+ R2_GLOBALS._player.disableControl();
+ R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS);
+ scene->_sceneMode = 10;
+ scene->_stripManager.start(576, this);
+ } else {
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 1890;
+ scene->_actor2.postInit();
+ scene->setAction(&scene->_sequenceManager, scene, 1890, &scene->_actor2, NULL);
+ }
+ break;
+ case 4:
+ newFrameNumber = scene->_actor1._frame + 1;
+ if (newFrameNumber > 6)
+ newFrameNumber = 1;
+ scene->_actor1.setFrame(newFrameNumber);
+ break;
+ case 5:
+ newFrameNumber = scene->_actor1._frame - 1;
+ if (newFrameNumber < 1)
+ newFrameNumber = 6;
+ scene->_actor1.setFrame(newFrameNumber);
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene1875::Actor1875::subB8271(int indx) {
+ postInit();
+ _fieldA4 = indx;
+ _fieldA6 = 0;
+ setVisage(1855);
+
+ if (_fieldA4 == 1)
+ setStrip(2);
+ else
+ setStrip(1);
+
+ setFrame(_fieldA4);
+ switch (_fieldA4 - 1) {
+ case 0:
+ setPosition(Common::Point(20, 144));
+ break;
+ case 1:
+ setPosition(Common::Point(82, 144));
+ break;
+ case 2:
+ setPosition(Common::Point(136, 144));
+ break;
+ case 3:
+ setPosition(Common::Point(237, 144));
+ break;
+ case 4:
+ setPosition(Common::Point(299, 144));
+ break;
+ default:
+ break;
+ }
+
+ setDetails(1875, 6, 1, -1, 2, (SceneItem *) NULL);
+}
+
+void Scene1875::Actor1875::process(Event &event) {
+ if ((R2_GLOBALS._player._uiEnabled) || (event.handled))
+ return;
+
+ Scene1875 *scene = (Scene1875 *)R2_GLOBALS._sceneManager._scene;
+
+ if ((event.eventType == EVENT_BUTTON_DOWN) && (R2_GLOBALS._events.getCursor() == R2_STEPPING_DISKS) && (_bounds.contains(event.mousePos)) && (_fieldA6 == 0)) {
+ setStrip(2);
+ switch (_fieldA4) {
+ case 1:
+ R2_GLOBALS._sound2.play(227);
+ scene->_actor5.setStrip(1);
+ break;
+ case 2:
+ R2_GLOBALS._sound2.play(227);
+ scene->_actor4.setStrip(1);
+ break;
+ default:
+ break;
+ }
+ _fieldA6 = 1;
+ event.handled = true;
+ }
+
+ if ((event.eventType == EVENT_BUTTON_UP) && (_fieldA6 != 0)) {
+ if ((_fieldA4 == 3) || (_fieldA4 == 4) || (_fieldA4 == 5)) {
+ setStrip(1);
+ subB84AB();
+ }
+ _fieldA6 = 0;
+ event.handled = true;
+ }
+}
+
+void Scene1875::postInit(SceneObjectList *OwnerList) {
+ loadScene(1875);
+ SceneExt::postInit();
+
+ R2_GLOBALS._player._characterScene[1] = 1875;
+ R2_GLOBALS._player._characterScene[2] = 1875;
+
+ _stripManager.addSpeaker(&_quinnSpeaker);
+ _stripManager.addSpeaker(&_seekerSpeaker);
+
+ _actor4.subB8271(1);
+ _actor5.subB8271(2);
+ _actor6.subB8271(3);
+ _actor7.subB8271(4);
+ _actor8.subB8271(5);
+
+ _actor1.postInit();
+ _actor1.setup(1855, 4, 1);
+ _actor1.setPosition(Common::Point(160, 116));
+
+ R2_GLOBALS._player.postInit();
+ if (R2_GLOBALS._sceneManager._previousScene == 1625) {
+ R2_GLOBALS._sound1.play(122);
+ R2_GLOBALS._player.disableControl();
+ _sceneMode = 11;
+ _actor2.postInit();
+ setAction(&_sequenceManager, this, 1892, &_actor2, NULL);
+ } else if (R2_GLOBALS._sceneManager._previousScene == 3150) {
+ R2_GLOBALS._sound1.play(116);
+ } else {
+ R2_GLOBALS._player.enableControl();
+ R2_GLOBALS._player._canWalk = false;
+ }
+
+ _item2.setDetails(Rect(43, 14, 275, 122), 1875, 9, 1, -1, 1, NULL);
+ _item1.setDetails(Rect(0, 0, 320, 200), 1875, 3, -1, -1, 1, NULL);
+
+ R2_GLOBALS._player._characterScene[1] = 1875;
+ R2_GLOBALS._player._characterScene[2] = 1875;
+ R2_GLOBALS._player._oldCharacterScene[1] = 1875;
+ R2_GLOBALS._player._oldCharacterScene[2] = 1875;
+}
+
+void Scene1875::signal() {
+ switch (_sceneMode) {
+ case 10:
+ R2_GLOBALS._player.disableControl();
+ _sceneMode = 1891;
+ _actor2.postInit();
+ setAction(&_sequenceManager, this, 1891, &_actor2, NULL);
+ break;
+ case 11:
+ R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS);
+ _sceneMode = 1892;
+ _stripManager.start(577, this);
+ break;
+ case 1890:
+ _actor2.remove();
+ R2_GLOBALS._player.enableControl();
+ R2_GLOBALS._player._canWalk = false;
+ break;
+ case 1891:
+ R2_GLOBALS._player.disableControl();
+ R2_GLOBALS._sceneManager.changeScene(1625);
+ break;
+ case 1892:
+ R2_GLOBALS._player.disableControl();
+ R2_GLOBALS._sceneManager.changeScene(1900);
+ break;
+ default:
+ R2_GLOBALS._player.enableControl();
+ R2_GLOBALS._player._canWalk = false;
+ break;
+ }
+}
+
+void Scene1875::process(Event &event) {
+ Scene::process(event);
+
+ _actor4.process(event);
+ _actor5.process(event);
+ _actor6.process(event);
+ _actor7.process(event);
+ _actor8.process(event);
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 1900 -
+ *
+ *--------------------------------------------------------------------------*/
+bool Scene1900::Actor2::startAction(CursorType action, Event &event) {
+ Scene1900 *scene = (Scene1900 *)R2_GLOBALS._sceneManager._scene;
+
+ if (action != CURSOR_USE)
+ return SceneActor::startAction(action, event);
+
+ if ((_frame != 1) || (R2_GLOBALS._player._characterIndex != R2_SEEKER)) {
+ if (R2_GLOBALS._player._characterIndex == R2_QUINN)
+ return SceneActor::startAction(action, event);
+ else
+ return true;
+ }
+
+ R2_GLOBALS._player.enableControl(CURSOR_USE);
+
+ if (_position.x >= 160) {
+ scene->_sceneMode = 1905;
+ scene->setAction(&scene->_sequenceManager1, scene, 1905, &R2_GLOBALS._player, &scene->_actor3, NULL);
+ } else {
+ R2_GLOBALS.setFlag(29);
+ scene->_sceneMode = 1904;
+ scene->setAction(&scene->_sequenceManager1, scene, 1904, &R2_GLOBALS._player, &scene->_actor2, NULL);
+ }
+
+ return true;
+}
+
+void Scene1900::Exit1::changeScene() {
+ Scene1900 *scene = (Scene1900 *)R2_GLOBALS._sceneManager._scene;
+
+ R2_GLOBALS._player.disableControl(CURSOR_ARROW);
+ scene->_sceneMode = 10;
+
+ Common::Point pt(-10, 135);
+ NpcMover *mover = new NpcMover();
+ R2_GLOBALS._player.addMover(mover, &pt, scene);
+}
+
+void Scene1900::Exit2::changeScene() {
+ Scene1900 *scene = (Scene1900 *)R2_GLOBALS._sceneManager._scene;
+
+ R2_GLOBALS._player.disableControl(CURSOR_ARROW);
+ scene->_sceneMode = 11;
+
+ Common::Point pt(330, 135);
+ NpcMover *mover = new NpcMover();
+ R2_GLOBALS._player.addMover(mover, &pt, scene);
+}
+
+void Scene1900::postInit(SceneObjectList *OwnerList) {
+ loadScene(1900);
+ SceneExt::postInit();
+
+ // Debug message, skipped
+
+ if (R2_GLOBALS._sceneManager._previousScene == -1) {
+ R2_GLOBALS._sceneManager._previousScene = 1925;
+ R2_GLOBALS._player._characterIndex = R2_SEEKER;
+ R2_GLOBALS._player._oldCharacterScene[2] = 1925;
+ }
+
+ if (R2_GLOBALS._sceneManager._previousScene != 1875)
+ R2_GLOBALS._sound1.play(200);
+
+ _stripManager.setColors(60, 255);
+ _stripManager.setFontNumber(3);
+ _stripManager.addSpeaker(&_seekerSpeaker);
+
+ _exit1.setDetails(Rect(0, 105, 14, 145), R2_COM_SCANNER, 2000);
+ _exit1.setDest(Common::Point(14, 135));
+
+ _exit2.setDetails(Rect(305, 105, 320, 145), R2_SPENT_POWER_CAPSULE, 2000);
+ _exit2.setDest(Common::Point(315, 135));
+
+ R2_GLOBALS._player.postInit();
+ if (R2_GLOBALS._player._characterIndex == R2_QUINN)
+ R2_GLOBALS._player.setup(2008, 3, 1);
+ else
+ R2_GLOBALS._player.setup(20, 3, 1);
+ R2_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+ if (R2_GLOBALS._player._characterIndex == R2_QUINN)
+ R2_GLOBALS._player._moveDiff = Common::Point(3, 2);
+ else
+ R2_GLOBALS._player._moveDiff = Common::Point(5, 3);
+ R2_GLOBALS._player.disableControl();
+
+ if (R2_GLOBALS._sceneManager._previousScene != 1925)
+ R2_GLOBALS.clearFlag(29);
+
+ _actor2.postInit();
+ _actor2.setup(1901, 1, 1);
+ _actor2.setPosition(Common::Point(95, 109));
+ _actor2.fixPriority(100);
+
+ if (R2_GLOBALS._player._characterIndex == R2_QUINN)
+ _actor2.setDetails(1900, 0, 1, 2, 1, (SceneItem *) NULL);
+ else
+ _actor2.setDetails(1900, 0, 1, -1, 1, (SceneItem *) NULL);
+
+ _actor3.postInit();
+ _actor3.setup(1901, 2, 1);
+ _actor3.setPosition(Common::Point(225, 109));
+ _actor3.fixPriority(100);
+ if (R2_GLOBALS._player._characterIndex == R2_QUINN)
+ _actor3.setDetails(1900, 0, 1, 2, 1, (SceneItem *) NULL);
+ else
+ _actor3.setDetails(1900, 0, 1, -1, 1, (SceneItem *) NULL);
+
+ if (R2_GLOBALS._sceneManager._previousScene != 1875) {
+ _object1.postInit();
+ _object1.setup(1945, 6, 1);
+ _object1.setPosition(Common::Point(96, 109));
+ _object1.fixPriority(80);
+
+ _object2.postInit();
+ _object2.setup(1945, 6, 2);
+ _object2.setPosition(Common::Point(223, 109));
+ _object2.fixPriority(80);
+ }
+
+ if (R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] == 1875) {
+ R2_GLOBALS._player._characterIndex = R2_QUINN;
+ _actor1.postInit();
+ _sceneMode = 20;
+ R2_GLOBALS._player.setAction(&_sequenceManager1, NULL, 1901, &R2_GLOBALS._player, &_actor2, NULL);
+ _actor1.setAction(&_sequenceManager2, this, 1900, &_actor1, &_actor3, NULL);
+ } else if (R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] == 1925) {
+ if (R2_GLOBALS.getFlag(29)) {
+ R2_GLOBALS.clearFlag(29);
+ _actor2.hide();
+
+ R2_GLOBALS._player.setStrip(6);
+ R2_GLOBALS._player.setPosition(Common::Point(90, 106));
+ _sceneMode = 1906;
+ setAction(&_sequenceManager1, this, 1906, &R2_GLOBALS._player, &_actor2, NULL);
+ } else {
+ _actor3.hide();
+ R2_GLOBALS._player.setStrip(5);
+ R2_GLOBALS._player.setPosition(Common::Point(230, 106));
+ _sceneMode = 1907;
+ setAction(&_sequenceManager1, this, 1907, &R2_GLOBALS._player, &_actor3, NULL);
+ }
+
+ if (R2_GLOBALS._player._characterScene[1] == R2_GLOBALS._player._characterScene[2]) {
+ _actor1.postInit();
+ _actor1.setPosition(Common::Point(30, 110));
+ R2_GLOBALS._walkRegions.enableRegion(1);
+ _actor1.setup(2008, 3, 1);
+ _actor1.setDetails(9001, 0, -1, -1, 1, (SceneItem *) NULL);
+ }
+ R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] = 1900;
+ } else if (R2_GLOBALS._player._characterScene[1] == R2_GLOBALS._player._characterScene[2]) {
+ _actor1.postInit();
+ _actor1.setPosition(Common::Point(30, 110));
+ R2_GLOBALS._walkRegions.enableRegion(1);
+ if (R2_GLOBALS._player._characterIndex == R2_QUINN) {
+ _actor1.setup(20, 3, 1);
+ _actor1.setDetails(9002, 1, -1, -1, 1, (SceneItem *) NULL);
+ } else {
+ _actor1.setup(2008, 3, 1);
+ _actor1.setDetails(9001, 0, -1, -1, 1, (SceneItem *) NULL);
+ }
+
+ if (R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] == 2000) {
+ if (R2_GLOBALS._player._characterIndex == R2_QUINN) {
+ if (R2_GLOBALS._v56605[1] == 5) {
+ _sceneMode = 1902;
+ setAction(&_sequenceManager1, this, 1902, &R2_GLOBALS._player, NULL);
+ } else {
+ _sceneMode = 1903;
+ setAction(&_sequenceManager1, this, 1903, &R2_GLOBALS._player, NULL);
+ }
+ } else {
+ if (R2_GLOBALS._v56605[2] == 5) {
+ _sceneMode = 1908;
+ setAction(&_sequenceManager1, this, 1908, &R2_GLOBALS._player, NULL);
+ } else {
+ _sceneMode = 1909;
+ setAction(&_sequenceManager1, this, 1909, &R2_GLOBALS._player, NULL);
+ }
+ }
+ } else {
+ R2_GLOBALS._player.setPosition(Common::Point(160, 135));
+ R2_GLOBALS._player.enableControl();
+ }
+ R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] = 1900;
+ }
+
+ _item2.setDetails(Rect(77, 2, 240, 103), 1900, 6, -1, -1, 1, NULL);
+ _item1.setDetails(Rect(0, 0, 320, 200), 1900, 3, -1, -1, 1, NULL);
+}
+
+void Scene1900::remove() {
+ R2_GLOBALS._sound1.fadeOut(NULL);
+ SceneExt::remove();
+}
+
+void Scene1900::signal() {
+ switch (_sceneMode) {
+ case 10:
+ R2_GLOBALS._v56605[R2_GLOBALS._player._characterIndex] = 5;
+ R2_GLOBALS._sceneManager.changeScene(2000);
+ break;
+ case 11:
+ R2_GLOBALS._v56605[R2_GLOBALS._player._characterIndex] = 6;
+ R2_GLOBALS._sceneManager.changeScene(2000);
+ break;
+ case 20:
+ ++_sceneMode;
+ R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS);
+ _stripManager.start(1300, this);
+ break;
+ case 21:
+ ++_sceneMode;
+ R2_GLOBALS._player.disableControl();
+ if (R2_GLOBALS._player._action)
+ R2_GLOBALS._player._action->_endHandler = this;
+ else
+ signal();
+ break;
+ case 22:
+ _sceneMode = 1910;
+ _actor1.setAction(&_sequenceManager2, this, 1910, &_actor1, NULL);
+ break;
+ case 1904:
+ R2_GLOBALS._scene1925CurrLevel = -3;
+ // No break on purpose
+ case 1905:
+ R2_GLOBALS._player.disableControl(CURSOR_ARROW);
+ R2_GLOBALS._sceneManager.changeScene(1925);
+ break;
+ case 1910:
+ R2_INVENTORY.setObjectScene(22, 2535);
+ R2_GLOBALS._player.disableControl(CURSOR_ARROW);
+ R2_GLOBALS._player._oldCharacterScene[1] = 1900;
+ R2_GLOBALS._player._oldCharacterScene[2] = 1900;
+ R2_GLOBALS._sceneManager.changeScene(2450);
+ break;
+ case 1906:
+ R2_GLOBALS._scene1925CurrLevel = -3;
+ // No break on purpose
+ default:
+ R2_GLOBALS._player.enableControl();
+ break;
+ }
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 1925 -
+ *
+ *--------------------------------------------------------------------------*/
+Scene1925::Scene1925() {
+ _field9B8 = 0;
+ for (int i = 0; i < 5; i++)
+ _levelResNum[i] = 0;
+}
+
+void Scene1925::synchronize(Serializer &s) {
+ SceneExt::synchronize(s);
+
+ s.syncAsSint16LE(_field9B8);
+ for (int i = 0; i < 5; i++)
+ s.syncAsSint16LE(_levelResNum[i]);
+}
+
+bool Scene1925::Hotspot2::startAction(CursorType action, Event &event) {
+ Scene1925 *scene = (Scene1925 *)R2_GLOBALS._sceneManager._scene;
+
+ if (action != CURSOR_USE)
+ return SceneHotspot::startAction(action, event);
+
+ if ((R2_GLOBALS._player._position.x == 110) && (R2_GLOBALS._player._position.y == 100))
+ return SceneHotspot::startAction(action, event);
+
+ if ((R2_GLOBALS._player._position.x == 154) && (R2_GLOBALS._player._position.y == 20))
+ scene->_sceneMode = 1928;
+ else if ((R2_GLOBALS._player._position.x == 154) && (R2_GLOBALS._player._position.y == 200))
+ scene->_sceneMode = 1929;
+ else
+ scene->_sceneMode = 1930;
+
+ R2_GLOBALS._player.disableControl(CURSOR_ARROW);
+ scene->setAction(&scene->_sequenceManager, scene, scene->_sceneMode, &R2_GLOBALS._player, &scene->_actor1, NULL);
+ return true;
+}
+
+bool Scene1925::Hotspot3::startAction(CursorType action, Event &event) {
+ if ((!R2_GLOBALS.getFlag(29)) || (action != CURSOR_USE))
+ return SceneHotspot::startAction(action, event);
+
+ Scene1925 *scene = (Scene1925 *)R2_GLOBALS._sceneManager._scene;
+
+ R2_GLOBALS._player.disableControl(CURSOR_USE);
+ scene->_sceneMode = 0;
+
+ if ((R2_GLOBALS._player._position.x == 110) && (R2_GLOBALS._player._position.y == 100)) {
+ scene->_exit3._enabled = false;
+ scene->_sceneMode = 1925;
+ scene->setAction(&scene->_sequenceManager, scene, scene->_sceneMode, &R2_GLOBALS._player, &scene->_actor1, NULL);
+ return true;
+ }
+
+ if ((R2_GLOBALS._player._position.x == 154) && (R2_GLOBALS._player._position.y == 20) && (event.mousePos.y >= 30)) {
+ scene->_sceneMode = 1931;
+ } else if ((R2_GLOBALS._player._position.x == 154) && (R2_GLOBALS._player._position.y == 200) && (event.mousePos.y < 140)) {
+ scene->_sceneMode = 1932;
+ } else if ( ( ((R2_GLOBALS._player._position.x == 112) && (R2_GLOBALS._player._position.y == 101))
+ || ((R2_GLOBALS._player._position.x == 154) && (R2_GLOBALS._player._position.y == 110))
+ ) && (event.mousePos.y >= 100)) {
+ scene->_sceneMode = 1926;
+ } else if ( ( ((R2_GLOBALS._player._position.x == 112) && (R2_GLOBALS._player._position.y == 101))
+ || ((R2_GLOBALS._player._position.x == 154) && (R2_GLOBALS._player._position.y == 110))
+ ) && (event.mousePos.y < 60)) {
+ scene->_sceneMode = 1927;
+ } else {
+ R2_GLOBALS._player.enableControl(CURSOR_USE);
+ R2_GLOBALS._player._canWalk = false;
+ }
+
+ if (scene->_sceneMode != 0)
+ scene->setAction(&scene->_sequenceManager, scene, scene->_sceneMode, &R2_GLOBALS._player, NULL);
+
+ return true;
+}
+
+void Scene1925::ExitUp::changeScene() {
+ Scene1925 *scene = (Scene1925 *)R2_GLOBALS._sceneManager._scene;
+
+ _moving = false;
+ R2_GLOBALS._player.disableControl(CURSOR_USE);
+ scene->_sceneMode = 0;
+
+ if ((R2_GLOBALS._player._position.x == 110) && (R2_GLOBALS._player._position.y == 100)) {
+ scene->_exit3._enabled = false;
+ scene->_field9B8 = 1927;
+ scene->_sceneMode = 1925;
+ scene->setAction(&scene->_sequenceManager, scene, scene->_sceneMode, &R2_GLOBALS._player, &scene->_actor1, NULL);
+ return;
+ }
+
+ if ( ((R2_GLOBALS._player._position.x == 112) && (R2_GLOBALS._player._position.y == 101))
+ || ((R2_GLOBALS._player._position.x == 154) && (R2_GLOBALS._player._position.y == 110))) {
+ scene->_sceneMode = 1927;
+ } else if ((R2_GLOBALS._player._position.x == 154) && (R2_GLOBALS._player._position.y == 200)) {
+ scene->_sceneMode = 1932;
+ }
+
+ if (scene->_sceneMode != 0)
+ scene->setAction(&scene->_sequenceManager, scene, scene->_sceneMode, &R2_GLOBALS._player, NULL);
+ else {
+ scene->_sceneMode = 1932;
+ scene->signal();
+ }
+}
+
+void Scene1925::Exit2::changeScene() {
+ Scene1925 *scene = (Scene1925 *)R2_GLOBALS._sceneManager._scene;
+
+ _moving = false;
+ R2_GLOBALS._player.disableControl(CURSOR_USE);
+ scene->_sceneMode = 0;
+
+ if ((R2_GLOBALS._player._position.x == 110) && (R2_GLOBALS._player._position.y == 100)) {
+ scene->_exit3._enabled = false;
+ scene->_field9B8 = 1926;
+ scene->_sceneMode = 1925;
+ scene->setAction(&scene->_sequenceManager, scene, scene->_sceneMode, &R2_GLOBALS._player, &scene->_actor1, NULL);
+ return;
+ }
+
+ if ( ((R2_GLOBALS._player._position.x == 112) && (R2_GLOBALS._player._position.y == 101))
+ || ((R2_GLOBALS._player._position.x == 154) && (R2_GLOBALS._player._position.y == 110))) {
+ scene->_sceneMode = 1926;
+ } else if ((R2_GLOBALS._player._position.x == 154) && (R2_GLOBALS._player._position.y == 20)) {
+ scene->_sceneMode = 1931;
+ }
+
+ if (scene->_sceneMode == 0) {
+ scene->_sceneMode = 1931;
+ scene->signal();
+ } else
+ scene->setAction(&scene->_sequenceManager, scene, scene->_sceneMode, &R2_GLOBALS._player, NULL);
+}
+
+void Scene1925::Exit3::changeScene() {
+ Scene1925 *scene = (Scene1925 *)R2_GLOBALS._sceneManager._scene;
+
+ _moving = false;
+ R2_GLOBALS._player.disableControl(CURSOR_ARROW);
+ scene->_sceneMode = 1921;
+ scene->setAction(&scene->_sequenceManager, scene, scene->_sceneMode, &R2_GLOBALS._player, NULL);
+}
+
+void Scene1925::Exit4::changeScene() {
+ Scene1925 *scene = (Scene1925 *)R2_GLOBALS._sceneManager._scene;
+
+ _moving = false;
+ R2_GLOBALS._player.disableControl(CURSOR_ARROW);
+ scene->_sceneMode = 1920;
+ scene->setAction(&scene->_sequenceManager, scene, scene->_sceneMode, &R2_GLOBALS._player, NULL);
+}
+
+void Scene1925::changeLevel(bool upFlag) {
+ if (R2_GLOBALS._scene1925CurrLevel < 0)
+ R2_GLOBALS._scene1925CurrLevel = 3;
+
+ if (upFlag) {
+ R2_GLOBALS._player.setup(1925, 1, 1);
+ R2_GLOBALS._player.setPosition(Common::Point(154, 200));
+ ++R2_GLOBALS._scene1925CurrLevel;
+ } else {
+ R2_GLOBALS._player.setup(1925, 1, 1);
+ R2_GLOBALS._player.setPosition(Common::Point(154, 20));
+ R2_GLOBALS._scene1925CurrLevel--;
+ }
+
+ switch (R2_GLOBALS._scene1925CurrLevel) {
+ case -1:
+ R2_GLOBALS._sceneManager.changeScene(1945);
+ return;
+ break;
+ case 3:
+ loadScene(_levelResNum[4]);
+ _item2.setDetails(Rect(133, 68, 140, 77), 1925, 3, -1, 5, 2, NULL);
+ _actor1.setDetails(1925, 0, 1, 2, 2, (SceneItem *) NULL);
+ _actor1.show();
+ break;
+ case 512:
+ R2_GLOBALS._scene1925CurrLevel = 508;
+ // No break on purpose
+ default:
+ loadScene(_levelResNum[(R2_GLOBALS._scene1925CurrLevel % 4)]);
+ R2_GLOBALS._sceneItems.remove(&_item2);
+ R2_GLOBALS._sceneItems.remove(&_actor1);
+ _actor1.hide();
+ break;
+ }
+
+ R2_GLOBALS._player.enableControl(CURSOR_USE);
+ R2_GLOBALS._player._canWalk = false;
+}
+
+void Scene1925::postInit(SceneObjectList *OwnerList) {
+ _levelResNum[0] = 1930;
+ _levelResNum[1] = 1935;
+ _levelResNum[2] = 1940;
+ _levelResNum[3] = 1935;
+ _levelResNum[4] = 1925;
+
+ if (R2_GLOBALS.getFlag(29)) {
+ if ((R2_GLOBALS._scene1925CurrLevel == -3) || (R2_GLOBALS._scene1925CurrLevel == 3))
+ loadScene(_levelResNum[4]);
+ else
+ loadScene(_levelResNum[R2_GLOBALS._scene1925CurrLevel % 4]);
+ } else {
+ R2_GLOBALS._scene1925CurrLevel = -2;
+ loadScene(1920);
+ }
+ SceneExt::postInit();
+ R2_GLOBALS._sound1.play(220);
+ R2_GLOBALS._player.postInit();
+ R2_GLOBALS._player.disableControl();
+ R2_GLOBALS._player._characterScene[2] = 1925;
+ R2_GLOBALS._player._characterIndex = R2_SEEKER;
+ switch (R2_GLOBALS._scene1925CurrLevel) {
+ case -2:
+ _exit4.setDetails(Rect(203, 44, 247, 111), EXITCURSOR_E, 1925);
+ _item3.setDetails(Rect(31, 3, 45, 167), 1925, 6, -1, 8, 1, NULL);
+ break;
+ case 3:
+ _actor1.setDetails(1925, 0, 1, 2, 1, (SceneItem *) NULL);
+ _item2.setDetails(Rect(133, 68, 140, 77), 1925, 3, -1, 5, 1, NULL);
+ // No break on purpose
+ case -3:
+ _exit3.setDetails(Rect(83, 38, 128, 101), EXITCURSOR_W, 1925);
+ // No break on purpose
+ default:
+ _exitUp.setDetails(Rect(128, 0, 186, 10), EXITCURSOR_N, 1925);
+ _exit2.setDetails(Rect(128, 160, 190, 167), EXITCURSOR_S, 1925);
+ _item3.setDetails(Rect(141, 11, 167, 159), 1925, 6, -1, -1, 1, NULL);
+ break;
+ }
+
+ _actor1.postInit();
+ _actor1.setup(1925, 5, 1);
+ _actor1.setPosition(Common::Point(128, 35));
+ _actor1.hide();
+
+ if (R2_GLOBALS._scene1925CurrLevel == 3)
+ _actor1.show();
+
+ R2_GLOBALS._player.enableControl(CURSOR_USE);
+ switch (R2_GLOBALS._scene1925CurrLevel) {
+ case -2:
+ R2_GLOBALS._player.setup(20, 6, 1);
+ R2_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+ R2_GLOBALS._player.setPosition(Common::Point(224, 109));
+ break;
+ case -3:
+ _actor1.hide();
+ R2_GLOBALS._player.setup(20, 5, 1);
+ R2_GLOBALS._player.setPosition(Common::Point(110, 100));
+ break;
+ case 0:
+ R2_GLOBALS._player.setup(1925, 1, 1);
+ R2_GLOBALS._player.setPosition(Common::Point(154, 200));
+ break;
+ default:
+ R2_GLOBALS._player.setup(1925, 1, 3);
+ R2_GLOBALS._player.setPosition(Common::Point(154, 110));
+ break;
+ }
+
+ R2_GLOBALS._player._canWalk = false;
+ _field9B8 = 0;
+ R2_GLOBALS._sceneManager._previousScene = 1925;
+ _item1.setDetails(Rect(27, 0, 292, 200), 1925, 9, -1, -1, 1, NULL);
+}
+
+void Scene1925::remove() {
+ R2_GLOBALS._sound1.fadeOut2(NULL);
+ R2_GLOBALS._player._oldCharacterScene[2] = 1925;
+ SceneExt::remove();
+}
+
+void Scene1925::signal() {
+ switch (_sceneMode) {
+ case 1920:
+ // No break on purpose
+ case 1921:
+ // No break on purpose
+ case 1928:
+ // No break on purpose
+ case 1929:
+ // No break on purpose
+ case 1930:
+ R2_GLOBALS._scene1925CurrLevel = -3;
+ R2_GLOBALS._sceneManager.changeScene(1900);
+ break;
+ case 1926:
+ // No break on purpose
+ case 1931:
+ // Change level, down
+ changeLevel(false);
+ break;
+ case 1927:
+ // No break on purpose
+ case 1932:
+ // Change level, up
+ changeLevel(true);
+ break;
+ case 1925:
+ _exit3._enabled = false;
+ if (_field9B8 != 0) {
+ _sceneMode = _field9B8;
+ _field9B8 = 0;
+ setAction(&_sequenceManager, this, _sceneMode, &R2_GLOBALS._player, NULL);
+ }
+ // No break on purpose
+ default:
+ R2_GLOBALS._player.enableControl(CURSOR_USE);
+ break;
+ }
+
+ R2_GLOBALS._player._canWalk = false;
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 1945 -
+ *
+ *--------------------------------------------------------------------------*/
+Scene1945::Scene1945() {
+ _fieldEAA = 0;
+ _fieldEAC = 0;
+ _fieldEAE = CURSOR_NONE;
+}
+
+void Scene1945::synchronize(Serializer &s) {
+ SceneExt::synchronize(s);
+
+ s.syncAsSint16LE(_fieldEAA);
+ s.syncAsSint16LE(_fieldEAC);
+ s.syncAsSint16LE(_fieldEAE);
+}
+
+bool Scene1945::Hotspot3::startAction(CursorType action, Event &event) {
+ Scene1945 *scene = (Scene1945 *)R2_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case R2_GUNPOWDER:
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 0;
+ if ((R2_GLOBALS._player._position.x == 191) && (R2_GLOBALS._player._position.y == 142))
+ scene->_sceneMode = 1942;
+ else {
+ scene->_sceneMode = 1940;
+ scene->_fieldEAA = 1942;
+ }
+ // At this point the original check if _sceneMode != 0. Skipped.
+ scene->setAction(&scene->_sequenceManager1, scene, scene->_sceneMode, &R2_GLOBALS._player, NULL);
+ return true;
+ break;
+ case CURSOR_USE:
+ R2_GLOBALS._player.disableControl(CURSOR_USE);
+ scene->_sceneMode = 0;
+ if ((R2_GLOBALS._player._position.x == 154) && (R2_GLOBALS._player._position.y == 50) && (event.mousePos.x >= 130)) {
+ scene->_sceneMode = 1940;
+ // At this point the original check if _sceneMode != 0. Skipped.
+ scene->setAction(&scene->_sequenceManager1, scene, scene->_sceneMode, &R2_GLOBALS._player, NULL);
+ return true;
+ } else {
+ R2_GLOBALS._player.enableControl(CURSOR_USE);
+ R2_GLOBALS._player._canWalk = false;
+ if (event.mousePos.x > 130)
+ scene->_item3.setDetails(1945, 3, -1, -1, 3, (SceneItem *) NULL);
+ else
+ scene->_item3.setDetails(1945, 3, -1, 5, 3, (SceneItem *) NULL);
+ }
+ // No break on purpose
+ default:
+ return SceneHotspot::startAction(action, event);
+ break;
+ }
+}
+
+bool Scene1945::Hotspot4::startAction(CursorType action, Event &event) {
+ Scene1945 *scene = (Scene1945 *)R2_GLOBALS._sceneManager._scene;
+
+ if (action != CURSOR_USE)
+ return SceneHotspot::startAction(action, event);
+
+ R2_GLOBALS._player.disableControl(CURSOR_USE);
+ scene->_sceneMode = 0;
+
+ if ((R2_GLOBALS._player._position.x == 221) && (R2_GLOBALS._player._position.y == 142)) {
+ scene->_sceneMode = 1949;
+ scene->_fieldEAA = 1947;
+ } else if ( ((R2_GLOBALS._player._position.x == 197) && (R2_GLOBALS._player._position.y == 158))
+ || ((R2_GLOBALS._player._position.x == 191) && (R2_GLOBALS._player._position.y == 142)) ) {
+ scene->_sceneMode = 1947;
+ } else if ((R2_GLOBALS._player._position.x == 221) && (R2_GLOBALS._player._position.y == 142) && (event.mousePos.y >= 30)) {
+ scene->_sceneMode = 1940;
+ } else {
+ R2_GLOBALS._player.enableControl(CURSOR_USE);
+ R2_GLOBALS._player._canWalk = false;
+ }
+
+ if (scene->_sceneMode != 0)
+ scene->setAction(&scene->_sequenceManager1, scene, scene->_sceneMode, &R2_GLOBALS._player, NULL);
+
+ return true;
+}
+
+bool Scene1945::Actor3::startAction(CursorType action, Event &event) {
+ if ((action == R2_ALCOHOL_LAMP_3) && (action == R2_ALCOHOL_LAMP_2)) {
+ Scene1945 *scene = (Scene1945 *)R2_GLOBALS._sceneManager._scene;
+
+ scene->_fieldEAE = action;
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 0;
+ if ((R2_GLOBALS._player._position.x == 191) && (R2_GLOBALS._player._position.y == 142)) {
+ scene->_sceneMode= 1947;
+ scene->_fieldEAA = 1943;
+ } else if ((R2_GLOBALS._player._position.x == 154) && (R2_GLOBALS._player._position.y == 50)) {
+ scene->_sceneMode = 1940;
+ scene->_fieldEAA = 1943;
+ } else {
+ scene->_sceneMode = 1949;
+ scene->_fieldEAA = 1947;
+ scene->_fieldEAC = 1943;
+ }
+ // At this point the original check if _sceneMode != 0. Skipped.
+ scene->setAction(&scene->_sequenceManager1, scene, scene->_sceneMode, &R2_GLOBALS._player, NULL);
+ return true;
+ } else {
+ return SceneActor::startAction(action, event);
+ }
+}
+
+void Scene1945::ExitUp::changeScene() {
+ Scene1945 *scene = (Scene1945 *)R2_GLOBALS._sceneManager._scene;
+
+ _moving = false;
+ R2_GLOBALS._player.disableControl(CURSOR_USE);
+ scene->_sceneMode = 0;
+
+ if ((R2_GLOBALS._player._position.x == 221) && (R2_GLOBALS._player._position.y == 142)) {
+ scene->_sceneMode = 1949;
+ scene->_fieldEAA = 1947;
+ } else if ( ((R2_GLOBALS._player._position.x == 197) && (R2_GLOBALS._player._position.y == 158))
+ || ((R2_GLOBALS._player._position.x == 191) && (R2_GLOBALS._player._position.y == 142)) ) {
+ scene->_sceneMode = 1947;
+ }
+
+ if (scene->_sceneMode == 0) {
+ scene->_sceneMode = 1941;
+ signal();
+ } else {
+ scene->setAction(&scene->_sequenceManager1, scene, scene->_sceneMode, &R2_GLOBALS._player, NULL);
+ }
+}
+
+void Scene1945::Exit2::changeScene() {
+ Scene1945 *scene = (Scene1945 *)R2_GLOBALS._sceneManager._scene;
+
+ _moving = false;
+ R2_GLOBALS._player.disableControl(CURSOR_USE);
+ scene->_sceneMode = 0;
+
+ if ((R2_GLOBALS._player._position.x == 154) && (R2_GLOBALS._player._position.y == 50)) {
+ scene->_sceneMode = 1940;
+ scene->_fieldEAA = 1945;
+ } else if ( ((R2_GLOBALS._player._position.x == 197) && (R2_GLOBALS._player._position.y == 158))
+ || ((R2_GLOBALS._player._position.x == 191) && (R2_GLOBALS._player._position.y == 142)) ) {
+ scene->_sceneMode = 1945;
+ }
+
+ if (scene->_sceneMode != 0)
+ scene->setAction(&scene->_sequenceManager1, scene, scene->_sceneMode, &R2_GLOBALS._player, NULL);
+}
+
+void Scene1945::postInit(SceneObjectList *OwnerList) {
+ loadScene(1945);
+ SceneExt::postInit();
+ R2_GLOBALS._sound1.play(220);
+
+ R2_GLOBALS._player.postInit();
+ R2_GLOBALS._player.enableControl(CURSOR_USE);
+ R2_GLOBALS._player._canWalk = false;
+ R2_GLOBALS._player._characterScene[2] = 1945;
+ R2_GLOBALS._player._characterIndex = R2_SEEKER;
+
+ _exitUp.setDetails(Rect(128, 0, 186, 10), EXITCURSOR_N, 1945);
+ _exit2.setDetails(Rect(238, 144, 274, 167), EXITCURSOR_E, 1945);
+
+ _item4.setDetails(Rect(141, 3, 167, 126), 1945, 9, -1, -1, 1, NULL);
+
+ if (!R2_GLOBALS.getFlag(43)) {
+ _exit2._enabled = false;
+ _actor3.postInit();
+ _actor3.setup(1945, 4, 1);
+ _actor3.setPosition(Common::Point(253, 169));
+ _actor3.fixPriority(150);
+
+ if (R2_GLOBALS.getFlag(42))
+ _actor3.setDetails(1945, 15, -1, -1, 1, (SceneItem *) NULL);
+ else
+ _actor3.hide();
+
+ _actor1.postInit();
+ _actor1.setup(1945, 8, 1);
+ _actor1.setPosition(Common::Point(253, 169));
+ _actor1.fixPriority(130);
+
+ _actor2.postInit();
+ _actor2.setup(1945, 3, 1);
+ _actor2.hide();
+ } else {
+ _exit2._enabled = true;
+ }
+
+ switch (R2_GLOBALS._sceneManager._previousScene) {
+ case 1925:
+ R2_GLOBALS._scene1925CurrLevel = 0;
+ R2_GLOBALS.clearFlag(29);
+ R2_GLOBALS._player.setup(1925, 1, 10);
+ R2_GLOBALS._player.setPosition(Common::Point(154, 50));
+ break;
+ case 1950:
+ _sceneMode = 1944;
+ setAction(&_sequenceManager1, this, _sceneMode, &R2_GLOBALS._player, NULL);
+ R2_GLOBALS._player.disableControl(CURSOR_USE);
+ break;
+ default:
+ R2_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+ R2_GLOBALS._player.setup(20, 5, 1);
+ R2_GLOBALS._player.setPosition(Common::Point(191, 142));
+ break;
+ }
+
+ R2_GLOBALS._player._canWalk = false;
+ _fieldEAA = 0;
+ _fieldEAC = 0;
+
+ _item3.setDetails(11, 1945, 3, -1, 5);
+ _item1.setDetails(Rect(238, 144, 274, 167), 1945, 0, -1, 2, 1, NULL);
+ _item2.setDetails(Rect(27, 3, 292, 167), 1945, 3, -1, -1, 1, NULL);
+}
+
+void Scene1945::remove() {
+ R2_GLOBALS._sound1.fadeOut2(NULL);
+ SceneExt::remove();
+}
+
+void Scene1945::signal() {
+ switch (_sceneMode) {
+ case 1940:
+ if (_fieldEAA == 1943) {
+ _sceneMode = _fieldEAA;
+ setAction(&_sequenceManager1, this, _sceneMode, &R2_GLOBALS._player, &_actor2, NULL);
+ } else {
+ _sceneMode = 1946;
+ setAction(&_sequenceManager1, this, _sceneMode, &R2_GLOBALS._player, NULL);
+ }
+ return;
+ break;
+ case 1941:
+ if (_fieldEAA == 0) {
+ R2_GLOBALS._scene1925CurrLevel = 0;
+ R2_GLOBALS.setFlag(29);
+ R2_GLOBALS._sceneManager.changeScene(1925);
+ } else {
+ _sceneMode = _fieldEAA;
+ _fieldEAA = 0;
+ setAction(&_sequenceManager1, this, _sceneMode, &R2_GLOBALS._player, NULL);
+ }
+ return;
+ case 1942:
+ R2_INVENTORY.setObjectScene(R2_GUNPOWDER, 0);
+ _actor3.setDetails(1945, 15, -1, -1, 2, (SceneItem *) NULL);
+ R2_GLOBALS.setFlag(42);
+ break;
+ case 1943:
+ R2_GLOBALS._sound1.fadeOut2(NULL);
+ R2_INVENTORY.setObjectScene(_fieldEAE, 0);
+ _sceneMode = 1948;
+ setAction(&_sequenceManager1, this, _sceneMode, &_actor3, &_actor2, &_actor1, NULL);
+ setAction(&_sequenceManager2, NULL, 1941, &R2_GLOBALS._player, NULL);
+ return;
+ case 1944:
+ break;
+ case 1945:
+ R2_GLOBALS._sceneManager.changeScene(1950);
+ return;
+ case 1946:
+ if (_fieldEAA == 1942) {
+ _sceneMode = _fieldEAA;
+ _fieldEAA = 0;
+ setAction(&_sequenceManager1, this, _sceneMode, &R2_GLOBALS._player, &_actor3, NULL);
+ return;
+ }
+ break;
+ case 1947:
+ if (_fieldEAA == 1943) {
+ _sceneMode = _fieldEAA;
+ _fieldEAA = 1948;
+ setAction(&_sequenceManager1, this, _sceneMode, &R2_GLOBALS._player, &_actor2, NULL);
+ } else {
+ _sceneMode = 1941;
+ setAction(&_sequenceManager1, this, _sceneMode, &R2_GLOBALS._player, NULL);
+ }
+ return;
+ case 1948:
+ R2_GLOBALS._sound1.play(220);
+ _exit2._enabled = true;
+ R2_GLOBALS._sceneItems.remove(&_actor3);
+ R2_GLOBALS.clearFlag(42);
+ R2_GLOBALS.clearFlag(43);
+ _fieldEAA = 1940;
+ // No break on purpose
+ case 1949:
+ _sceneMode = _fieldEAA;
+ if (_fieldEAC == 1943) {
+ _fieldEAA = _fieldEAC;
+ _fieldEAC = 0;
+ setAction(&_sequenceManager1, this, _sceneMode, &R2_GLOBALS._player, &_actor2, NULL);
+ } else {
+ _fieldEAA = 0;
+ setAction(&_sequenceManager1, this, _sceneMode, &R2_GLOBALS._player, NULL);
+ }
+ return;
+ default:
+ break;
+ }
+
+ R2_GLOBALS._player.enableControl(CURSOR_USE);
+ R2_GLOBALS._player._canWalk = false;
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 1950 -
+ *
+ *--------------------------------------------------------------------------*/
+Scene1950::Area1::Area1() {
+ _field20 = 0;
+ _fieldB65 = 0;
+}
+void Scene1950::Area1::synchronize(Serializer &s) {
+ SceneArea::synchronize(s);
+
+ s.syncAsByte(_field20);
+ s.syncAsSint16LE(_fieldB65);
+}
+
+Scene1950::Scene1950() {
+ _field412 = 0;
+ _field414 = 0;
+ _field416 = 0;
+ _field418 = Common::Point(0, 0);
+ _field41C = 0;
+}
+
+void Scene1950::synchronize(Serializer &s) {
+ SceneExt::synchronize(s);
+
+ s.syncAsSint16LE(_field412);
+ s.syncAsSint16LE(_field414);
+ s.syncAsSint16LE(_field416);
+ s.syncAsSint16LE(_field418.x);
+ s.syncAsSint16LE(_field418.y);
+ s.syncAsSint16LE(_field41C);
+}
+
+Scene1950::Area1::Actor10::Actor10() {
+ _fieldA4 = 0;
+ _fieldA6 = 0;
+ _fieldA8 = 0;
+}
+
+void Scene1950::Area1::Actor10::synchronize(Serializer &s) {
+ SceneActor::synchronize(s);
+
+ s.syncAsSint16LE(_fieldA4);
+ s.syncAsSint16LE(_fieldA6);
+ s.syncAsSint16LE(_fieldA8);
+}
+
+void Scene1950::Area1::Actor10::init(int indx) {
+// Scene1950 *scene = (Scene1950 *)R2_GLOBALS._sceneManager._scene;
+
+ _fieldA4 = indx;
+ _fieldA6 = 0;
+ _fieldA8 = 0;
+
+ postInit();
+ setup(1971, 2, 1);
+ fixPriority(249);
+ setPosition(Common::Point(((_fieldA4 / 4) * 22) + 127, ((_fieldA4 / 4) * 19) + 71));
+ warning("FIXME: invalid call to scene->_sceneAreas.push_front(this);");
+}
+
+void Scene1950::Area1::Actor10::process(Event &event) {
+ if ((event.eventType == EVENT_BUTTON_DOWN) && (R2_GLOBALS._events.getCursor() == CURSOR_USE) && (_bounds.contains(event.mousePos)) && (_fieldA6 == 0)) {
+ R2_GLOBALS._sound2.play(227);
+ if (_fieldA8 == 0) {
+ setFrame(2);
+ _fieldA8 = 1;
+ } else {
+ setFrame(1);
+ _fieldA8 = 0;
+ }
+ _fieldA6 = 1;
+ event.handled = true;
+ }
+
+ if ((event.eventType == EVENT_BUTTON_UP) && (_fieldA6 != 0)) {
+ _fieldA6 = 0;
+ event.handled = true;
+ Scene1950 *scene = (Scene1950 *)R2_GLOBALS._sceneManager._scene;
+ scene->subBF4B4(_fieldA4);
+ }
+}
+
+bool Scene1950::Area1::Actor10::startAction(CursorType action, Event &event) {
+ if (action == CURSOR_USE)
+ return false;
+ return SceneActor::startAction(action, event);
+}
+
+void Scene1950::Area1::remove() {
+ Scene1950 *scene = (Scene1950 *)R2_GLOBALS._sceneManager._scene;
+ for (_fieldB65 = 0; _fieldB65 < 16; ++_fieldB65) {
+ warning("Unexpected _sceneAreas.remove() call");
+ // R2_GLOBALS._sceneAreas.remove(&_arrActor1[_fieldB65]);
+ _arrActor1[_fieldB65].remove();
+ }
+
+ // sub201EA
+ R2_GLOBALS._sceneItems.remove((SceneItem *)this);
+ _areaActor.remove();
+ SceneArea::remove();
+ R2_GLOBALS._insetUp--;
+ //
+
+ if (!R2_GLOBALS.getFlag(37))
+ R2_GLOBALS._sound2.play(278);
+
+ R2_GLOBALS._player.disableControl(CURSOR_ARROW);
+ scene->_exit3._enabled = true;
+
+ if (!R2_GLOBALS.getFlag(37)) {
+ if (R2_GLOBALS.getFlag(36)) {
+ scene->_sceneMode = 1964;
+ scene->setAction(&scene->_sequenceManager, scene, 1964, &R2_GLOBALS._player, NULL);
+ } else {
+ scene->_sceneMode = 1965;
+ scene->setAction(&scene->_sequenceManager, scene, 1965, &R2_GLOBALS._player, NULL);
+ }
+ }
+}
+
+void Scene1950::Area1::process(Event &event) {
+// This is a copy of Scene1200::Area1::process
+ if (_field20 != R2_GLOBALS._insetUp)
+ return;
+
+ CursorType cursor = R2_GLOBALS._events.getCursor();
+
+ if (_areaActor._bounds.contains(event.mousePos.x + g_globals->gfxManager()._bounds.left , event.mousePos.y)) {
+ if (cursor == _cursorNum)
+ warning("TODO: _cursorState = ???");
+ R2_GLOBALS._events.setCursor(_savedCursorNum); //, _cursorState);
+ } else if (event.mousePos.y < 168) {
+ if (cursor != _cursorNum) {
+ _savedCursorNum = cursor;
+ warning("TODO: _cursorState = ???");
+ R2_GLOBALS._events.setCursor(CURSOR_INVALID);
+ }
+ if (event.eventType == EVENT_BUTTON_DOWN) {
+ event.handled = true;
+ warning("TODO: _cursorState = ???");
+ R2_GLOBALS._events.setCursor(_savedCursorNum); //, _cursorState);
+ remove();
+ }
+ }
+}
+
+void Scene1950::Area1::proc12(int visage, int stripFrameNum, int frameNum, int posX, int posY) {
+ Scene1950 *scene = (Scene1950 *)R2_GLOBALS._sceneManager._scene;
+
+ if (R2_GLOBALS._player._mover)
+ R2_GLOBALS._player.addMover(NULL);
+ R2_GLOBALS._player._canWalk = false;
+
+ // UnkArea1200::proc12();
+ _areaActor.postInit();
+ _areaActor.setup(visage, stripFrameNum, frameNum);
+ _areaActor.setPosition(Common::Point(posX, posY));
+ _areaActor.fixPriority(250);
+ _cursorNum = CURSOR_INVALID;
+ scene->_sceneAreas.push_front(this);
+ ++R2_GLOBALS._insetUp;
+ _field20 = R2_GLOBALS._insetUp;
+ //
+
+ _areaActor.fixPriority(248);
+ scene->_exit3._enabled = false;
+ proc13(1950, 27, 28, 27);
+
+ for (_fieldB65 = 0; _fieldB65 < 16; _fieldB65++)
+ _arrActor1[_fieldB65].init(_fieldB65);
+}
+
+void Scene1950::Area1::proc13(int resNum, int lookLineNum, int talkLineNum, int useLineNum) {
+ // Copy of Scene1200::Area1::proc13()
+ _areaActor.setDetails(resNum, lookLineNum, talkLineNum, useLineNum, 2, (SceneItem *) NULL);
+}
+
+bool Scene1950::Hotspot2::startAction(CursorType action, Event &event) {
+ if ((action != CURSOR_USE) || (R2_GLOBALS.getFlag(37)))
+ return SceneHotspot::startAction(action, event);
+
+ Scene1950 *scene = (Scene1950 *)R2_GLOBALS._sceneManager._scene;
+
+ R2_GLOBALS._player.disableControl();
+ if (R2_GLOBALS.getFlag(36)) {
+ scene->_sceneMode = 1962;
+ scene->setAction(&scene->_sequenceManager, scene, 1962, &R2_GLOBALS._player, NULL);
+ } else {
+ scene->_sceneMode = 1963;
+ scene->setAction(&scene->_sequenceManager, scene, 1963, &R2_GLOBALS._player, NULL);
+ }
+ return true;
+}
+
+bool Scene1950::Actor2::startAction(CursorType action, Event &event) {
+ if (action != R2_SCRITH_KEY)
+ return SceneActor::startAction(action, event);
+
+ Scene1950 *scene = (Scene1950 *)R2_GLOBALS._sceneManager._scene;
+
+ R2_GLOBALS._player.disableControl();
+ R2_INVENTORY.setObjectScene(31, 0);
+ scene->_sceneMode = 1958;
+ scene->setAction(&scene->_sequenceManager, scene, 1958, &R2_GLOBALS._player, &scene->_actor2, NULL);
+ return true;
+}
+
+bool Scene1950::Actor3::startAction(CursorType action, Event &event) {
+ if ((action != CURSOR_USE) || (R2_INVENTORY.getObjectScene(35) != 1950))
+ return SceneActor::startAction(action, event);
+
+ Scene1950 *scene = (Scene1950 *)R2_GLOBALS._sceneManager._scene;
+
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 1968;
+ scene->setAction(&scene->_sequenceManager, scene, 1968, &R2_GLOBALS._player, NULL);
+
+ return true;
+}
+
+bool Scene1950::Actor5::startAction(CursorType action, Event &event) {
+ if ((action != CURSOR_USE) || (!R2_GLOBALS.getFlag(37)))
+ return SceneActor::startAction(action, event);
+
+ Scene1950 *scene = (Scene1950 *)R2_GLOBALS._sceneManager._scene;
+
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 1967;
+ scene->setAction(&scene->_sequenceManager, scene, 1967, &R2_GLOBALS._player, NULL);
+
+ return true;
+}
+
+Scene1950::Actor8::Actor8() {
+ _fieldA4 = 0;
+ _fieldA6 = 0;
+ _fieldA8 = 0;
+ _fieldAA = 0;
+ _fieldAC = 0;
+ _fieldAE = 0;
+ _fieldAF = 0;
+}
+
+void Scene1950::Actor8::synchronize(Serializer &s) {
+ SceneActor::synchronize(s);
+
+ s.syncAsSint16LE(_fieldA4);
+ s.syncAsSint16LE(_fieldA6);
+ s.syncAsSint16LE(_fieldA8);
+ s.syncAsSint16LE(_fieldAA);
+ s.syncAsSint16LE(_fieldAC);
+ s.syncAsByte(_fieldAE);
+ s.syncAsByte(_fieldAF);
+}
+
+void Scene1950::Actor8::signal() {
+ Scene1950 *scene = (Scene1950 *)R2_GLOBALS._sceneManager._scene;
+
+ switch (_fieldAC) {
+ case 19: {
+ _fieldAC = 0;
+ setVisage(1960);
+ if (R2_GLOBALS._v566A5 == 3)
+ setStrip(2);
+ else
+ setStrip(1);
+
+ NpcMover *mover = new NpcMover();
+ R2_GLOBALS._player.addMover(mover, &scene->_field418, this);
+ }
+ break;
+ case 20: {
+ _fieldAC = 19;
+ R2_GLOBALS._player.setVisage(22);
+ if (R2_GLOBALS._v566A5 == 3)
+ R2_GLOBALS._player.setStrip(1);
+ else
+ R2_GLOBALS._player.setStrip(2);
+ R2_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+ R2_GLOBALS._v56613[((scene->_field41C - 1) * 4) + 1]--;
+
+ if (R2_GLOBALS._v566A5 == 3)
+ _fieldA4 = _position.x + 10;
+ else
+ _fieldA4 = _position.x - 10;
+
+ _fieldA6 = _position.y -4;
+ setVisage(1961);
+
+ if (R2_GLOBALS._v566A5 == 3)
+ setStrip(2);
+ else
+ setStrip(1);
+
+ animate(ANIM_MODE_2, NULL);
+ Common::Point pt(_fieldA4, _fieldA6);
+ PlayerMover *mover = new PlayerMover();
+ addMover(mover, &pt, this);
+
+ R2_GLOBALS._player.enableControl();
+ }
+ break;
+ case 21:
+ R2_GLOBALS._player.setVisage(22);
+ if (R2_GLOBALS._v566A5 == 3)
+ R2_GLOBALS._player.setStrip(1);
+ else
+ R2_GLOBALS._player.setStrip(2);
+ R2_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+
+ setVisage(1961);
+ if (R2_GLOBALS._v566A5 == 3)
+ setStrip(4);
+ else
+ setStrip(3);
+ setDetails(1950, 15, -1, 17, 2, (SceneItem *) NULL);
+ addMover(NULL);
+ _numFrames = 8;
+ R2_GLOBALS._sound2.play(226);
+ animate(ANIM_MODE_5, NULL);
+ fixPriority(10);
+ R2_GLOBALS._v56613[((scene->_field41C - 1) * 4) ]--;
+ R2_GLOBALS._v56613[((scene->_field41C - 1) * 4) + 1]--;
+ R2_GLOBALS._v56613[((scene->_field41C - 1) * 4) + 2] = _position.x;
+ R2_GLOBALS._v56613[((scene->_field41C - 1) * 4) + 3] = _position.y;
+ _fieldA8 = (_position.x - R2_GLOBALS._player._position.x) / 2;
+ _fieldAA = (_position.y - R2_GLOBALS._player._position.y) / 2;
+
+ _fieldAE = 0;
+ for (_fieldAF = 0; _fieldAF < 18; ++_fieldAF)
+ if (R2_GLOBALS._v56613[4 * _fieldAF] == 0)
+ ++_fieldAE;
+
+ if (_fieldAE == 18) {
+ R2_GLOBALS.setFlag(36);
+ _fieldAC = 23;
+ Common::Point pt(R2_GLOBALS._player._position.x + _fieldA8, R2_GLOBALS._player._position.y + _fieldAA);
+ NpcMover *mover = new NpcMover();
+ R2_GLOBALS._player.addMover(mover, &pt, this);
+ } else if (_fieldAE == 1) {
+ _fieldAC = 22;
+ Common::Point pt(R2_GLOBALS._player._position.x + _fieldA8, R2_GLOBALS._player._position.y + _fieldAA);
+ NpcMover *mover = new NpcMover();
+ R2_GLOBALS._player.addMover(mover, &pt, this);
+ } else {
+ R2_GLOBALS._player.enableControl(CURSOR_ARROW);
+ }
+
+ if (R2_GLOBALS._v566A5 == 3)
+ scene->_exit3._enabled = true;
+ else
+ scene->_exit6._enabled = true;
+
+ scene->_field416 = 0;
+ break;
+ case 22:
+ SceneItem::display(1950, 18, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ R2_GLOBALS._player.enableControl(CURSOR_ARROW);
+ break;
+ case 23:
+ SceneItem::display(1950, 25, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ scene->_sceneMode = R2_GLOBALS._v566A5;
+ scene->setAction(&scene->_sequenceManager, scene, 1960, &R2_GLOBALS._player, NULL);
+ break;
+ default:
+ break;
+ }
+}
+
+bool Scene1950::Actor8::startAction(CursorType action, Event &event) {
+ Scene1950 *scene = (Scene1950 *)R2_GLOBALS._sceneManager._scene;
+
+ if ((R2_GLOBALS._v56613[(scene->_field41C - 1) * 4] == 0) || (action != R2_PHOTON_STUNNER))
+ return SceneActor::startAction(action, event);
+
+ R2_GLOBALS._player.disableControl();
+
+ if (R2_GLOBALS._v56613[((scene->_field41C - 1) * 4) + 1] <= 1)
+ _fieldAC = 21;
+ else
+ _fieldAC = 20;
+
+ R2_GLOBALS._player.setVisage(25);
+ if (R2_GLOBALS._v566A5 == 3)
+ R2_GLOBALS._player.setStrip(2);
+ else
+ R2_GLOBALS._player.setStrip(1);
+ R2_GLOBALS._player.animate(ANIM_MODE_5, this);
+ R2_GLOBALS._sound3.play(99);
+
+ return true;
+}
+
+void Scene1950::Exit1::changeScene() {
+ Scene1950 *scene = (Scene1950 *)R2_GLOBALS._sceneManager._scene;
+
+ _enabled = false;
+ R2_GLOBALS._player.disableControl(CURSOR_ARROW);
+ R2_GLOBALS._v566A5 = 1;
+ scene->_sceneMode = 11;
+
+ Common::Point pt(160, 127);
+ PlayerMover *mover = new PlayerMover();
+ R2_GLOBALS._player.addMover(mover, &pt, scene);
+}
+
+void Scene1950::Exit2::changeScene() {
+ Scene1950 *scene = (Scene1950 *)R2_GLOBALS._sceneManager._scene;
+
+ _enabled = false;
+ R2_GLOBALS._player.disableControl(CURSOR_ARROW);
+ R2_GLOBALS._v566A5 = 2;
+ scene->_sceneMode = 12;
+
+ if (scene->_field412 == 0) {
+ if (R2_GLOBALS.getFlag(36))
+ scene->setAction(&scene->_sequenceManager, scene, 1953, &R2_GLOBALS._player, NULL);
+ else
+ scene->setAction(&scene->_sequenceManager, scene, 1970, &R2_GLOBALS._player, NULL);
+ } else {
+ if (R2_GLOBALS.getFlag(36))
+ scene->setAction(&scene->_sequenceManager, scene, 1952, &R2_GLOBALS._player, NULL);
+ else
+ scene->setAction(&scene->_sequenceManager, scene, 1969, &R2_GLOBALS._player, NULL);
+ }
+}
+
+void Scene1950::Exit3::changeScene() {
+ Scene1950 *scene = (Scene1950 *)R2_GLOBALS._sceneManager._scene;
+
+ _enabled = false;
+ R2_GLOBALS._player.disableControl(CURSOR_ARROW);
+ R2_GLOBALS._v566A5 = 3;
+ scene->_sceneMode = 13;
+
+ if (scene->_field416 != 0)
+ R2_GLOBALS._player.animate(ANIM_MODE_9);
+
+ Common::Point pt(340, 160);
+ NpcMover *mover = new NpcMover();
+ R2_GLOBALS._player.addMover(mover, &pt, scene);
+}
+
+void Scene1950::Exit4::changeScene() {
+ Scene1950 *scene = (Scene1950 *)R2_GLOBALS._sceneManager._scene;
+
+ _enabled = false;
+ R2_GLOBALS._player.disableControl(CURSOR_ARROW);
+ R2_GLOBALS._v566A5 = 4;
+ scene->_sceneMode = 14;
+
+ if (R2_GLOBALS.getFlag(36))
+ scene->setAction(&scene->_sequenceManager, scene, 1956, &R2_GLOBALS._player, NULL);
+ else
+ scene->setAction(&scene->_sequenceManager, scene, 1973, &R2_GLOBALS._player, NULL);
+}
+
+void Scene1950::Exit5::changeScene() {
+ Scene1950 *scene = (Scene1950 *)R2_GLOBALS._sceneManager._scene;
+
+ _enabled = false;
+ R2_GLOBALS._player.disableControl(CURSOR_ARROW);
+ R2_GLOBALS._v566A5 = 5;
+ scene->_sceneMode = 15;
+
+ Common::Point pt(160, 213);
+ NpcMover *mover = new NpcMover();
+ R2_GLOBALS._player.addMover(mover, &pt, scene);
+}
+
+void Scene1950::Exit6::changeScene() {
+ Scene1950 *scene = (Scene1950 *)R2_GLOBALS._sceneManager._scene;
+
+ _enabled = false;
+ R2_GLOBALS._player.disableControl(CURSOR_ARROW);
+ R2_GLOBALS._v566A5 = 5;
+ if (R2_GLOBALS._v566A4 == 2) {
+ if ((R2_GLOBALS.getFlag(36)) && (R2_INVENTORY.getObjectScene(34) == 2) && (R2_INVENTORY.getObjectScene(35) == 2)) {
+ scene->_sceneMode = 1961;
+ Common::Point pt(-20, 160);
+ NpcMover *mover = new NpcMover();
+ R2_GLOBALS._player.addMover(mover, &pt, scene);
+ } else {
+ if (!R2_GLOBALS.getFlag(36))
+ SceneItem::display(1950, 33, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ if ((R2_INVENTORY.getObjectScene(34) == 1950) || (R2_INVENTORY.getObjectScene(35) == 1950))
+ SceneItem::display(1950, 34, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ scene->_sceneMode = 0;
+ Common::Point pt(30, 160);
+ NpcMover *mover = new NpcMover();
+ R2_GLOBALS._player.addMover(mover, &pt, scene);
+ }
+ } else {
+ if (scene->_field416 != 0)
+ R2_GLOBALS._player.animate(ANIM_MODE_9);
+
+ scene->_sceneMode = 16;
+ Common::Point pt(-20, 160);
+ NpcMover *mover = new NpcMover();
+ R2_GLOBALS._player.addMover(mover, &pt, scene);
+ }
+}
+
+void Scene1950::Exit7::changeScene() {
+ Scene1950 *scene = (Scene1950 *)R2_GLOBALS._sceneManager._scene;
+
+ _enabled = false;
+ R2_GLOBALS._player.disableControl(CURSOR_ARROW);
+ R2_GLOBALS._v566A5 = 0;
+ scene->_sceneMode = 1951;
+ scene->setAction(&scene->_sequenceManager, scene, 1951, &R2_GLOBALS._player, NULL);
+}
+
+void Scene1950::Exit8::changeScene() {
+ Scene1950 *scene = (Scene1950 *)R2_GLOBALS._sceneManager._scene;
+
+ _enabled = false;
+ R2_GLOBALS._player.disableControl(CURSOR_ARROW);
+ R2_GLOBALS._v566A5 = 3;
+ if (R2_GLOBALS._player._visage == 22) {
+ scene->_sceneMode = 1975;
+ scene->setAction(&scene->_sequenceManager, scene, 1975, &R2_GLOBALS._player, NULL);
+ } else {
+ SceneItem::display(1950, 22, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ R2_GLOBALS._v566A5 = 0;
+ scene->_sceneMode = 0;
+ Common::Point pt(250, 150);
+ NpcMover *mover = new NpcMover();
+ R2_GLOBALS._player.addMover(mover, &pt, scene);
+ _enabled = true;
+ }
+}
+
+void Scene1950::subBDC1E() {
+ _exit1._enabled = false;
+ _exit2._enabled = false;
+ _exit3._enabled = false;
+ _exit4._enabled = false;
+ _exit5._enabled = false;
+ _exit6._enabled = false;
+ _exit7._enabled = false;
+ _exit8._enabled = false;
+ _exit1._insideArea = false;
+ _exit2._insideArea = false;
+ _exit3._insideArea = false;
+ _exit4._insideArea = false;
+ _exit5._insideArea = false;
+ _exit6._insideArea = false;
+ _exit7._insideArea = false;
+ _exit8._insideArea = false;
+ _exit1._moving = false;
+ _exit2._moving = false;
+ _exit3._moving = false;
+ _exit4._moving = false;
+ _exit5._moving = false;
+ _exit6._moving = false;
+ _exit7._moving = false;
+ _exit8._moving = false;
+ _field412 = 0;
+ switch (R2_GLOBALS._v566A4 - 1) {
+ case 0:
+ loadScene(1948);
+ break;
+ case 1:
+ // No break on purpose
+ case 8:
+ // No break on purpose
+ case 10:
+ // No break on purpose
+ case 12:
+ // No break on purpose
+ case 16:
+ // No break on purpose
+ case 19:
+ // No break on purpose
+ case 23:
+ // No break on purpose
+ case 30:
+ // No break on purpose
+ case 44:
+ // No break on purpose
+ case 72:
+ // No break on purpose
+ case 74:
+ // No break on purpose
+ case 86:
+ // No break on purpose
+ case 96:
+ // No break on purpose
+ case 103:
+ loadScene(1950);
+ break;
+ case 2:
+ // No break on purpose
+ case 29:
+ loadScene(1965);
+ break;
+ case 3:
+ // No break on purpose
+ case 9:
+ // No break on purpose
+ case 11:
+ // No break on purpose
+ case 15:
+ // No break on purpose
+ case 24:
+ // No break on purpose
+ case 39:
+ // No break on purpose
+ case 45:
+ // No break on purpose
+ case 71:
+ // No break on purpose
+ case 73:
+ // No break on purpose
+ case 75:
+ // No break on purpose
+ case 79:
+ // No break on purpose
+ case 85:
+ // No break on purpose
+ case 87:
+ // No break on purpose
+ case 95:
+ loadScene(1955);
+ break;
+ case 4:
+ // No break on purpose
+ case 6:
+ // No break on purpose
+ case 13:
+ // No break on purpose
+ case 27:
+ // No break on purpose
+ case 41:
+ // No break on purpose
+ case 48:
+ // No break on purpose
+ case 50:
+ // No break on purpose
+ case 54:
+ // No break on purpose
+ case 76:
+ // No break on purpose
+ case 80:
+ // No break on purpose
+ case 90:
+ // No break on purpose
+ case 104:
+ loadScene(1975);
+ break;
+ case 5:
+ // No break on purpose
+ case 7:
+ // No break on purpose
+ case 14:
+ // No break on purpose
+ case 28:
+ // No break on purpose
+ case 32:
+ // No break on purpose
+ case 47:
+ // No break on purpose
+ case 53:
+ loadScene(1997);
+ break;
+ case 17:
+ // No break on purpose
+ case 20:
+ // No break on purpose
+ case 25:
+ // No break on purpose
+ case 31:
+ // No break on purpose
+ case 33:
+ // No break on purpose
+ case 46:
+ loadScene(1995);
+ break;
+ case 18:
+ // No break on purpose
+ case 22:
+ // No break on purpose
+ case 26:
+ // No break on purpose
+ case 36:
+ // No break on purpose
+ case 38:
+ // No break on purpose
+ case 43:
+ // No break on purpose
+ case 51:
+ // No break on purpose
+ case 70:
+ // No break on purpose
+ case 78:
+ // No break on purpose
+ case 84:
+ // No break on purpose
+ case 89:
+ // No break on purpose
+ case 101:
+ loadScene(1970);
+ break;
+ case 21:
+ // No break on purpose
+ case 34:
+ // No break on purpose
+ case 57:
+ // No break on purpose
+ case 58:
+ // No break on purpose
+ case 59:
+ // No break on purpose
+ case 62:
+ // No break on purpose
+ case 65:
+ loadScene(1980);
+ break;
+ case 35:
+ // No break on purpose
+ case 61:
+ // No break on purpose
+ case 77:
+ // No break on purpose
+ case 83:
+ loadScene(1982);
+ break;
+ case 37:
+ // No break on purpose
+ case 52:
+ // No break on purpose
+ case 82:
+ // No break on purpose
+ case 88:
+ // No break on purpose
+ case 92:
+ // No break on purpose
+ case 97:
+ // No break on purpose
+ case 100:
+ loadScene(1962);
+ break;
+ case 40:
+ // No break on purpose
+ case 102:
+ loadScene(1960);
+ break;
+ case 42:
+ // No break on purpose
+ case 55:
+ // No break on purpose
+ case 60:
+ // No break on purpose
+ case 66:
+ // No break on purpose
+ case 68:
+ // No break on purpose
+ case 69:
+ // No break on purpose
+ case 93:
+ // No break on purpose
+ case 98:
+ loadScene(1990);
+ break;
+ case 49:
+ // No break on purpose
+ case 81:
+ // No break on purpose
+ case 91:
+ // No break on purpose
+ case 94:
+ // No break on purpose
+ case 99:
+ loadScene(1967);
+ break;
+ case 56:
+ // No break on purpose
+ case 63:
+ // No break on purpose
+ case 64:
+ // No break on purpose
+ case 67:
+ loadScene(1985);
+ _field412 = 1;
+ break;
+ default:
+ break;
+ }
+
+ if (R2_GLOBALS._v566A4 != 1)
+ R2_GLOBALS._walkRegions.load(1950);
+
+ switch (R2_GLOBALS._v566A4 - 1) {
+ case 0:
+ _exit7._enabled = true;
+ if ((R2_INVENTORY.getObjectScene(31) == 0) && (R2_INVENTORY.getObjectScene(34) == 1950))
+ _exit8._enabled = true;
+ R2_GLOBALS._walkRegions.enableRegion(2);
+ R2_GLOBALS._walkRegions.enableRegion(3);
+ R2_GLOBALS._walkRegions.enableRegion(4);
+ R2_GLOBALS._walkRegions.enableRegion(5);
+ R2_GLOBALS._walkRegions.enableRegion(6);
+ break;
+ case 1:
+ // No break on purpose
+ case 2:
+ // No break on purpose
+ case 3:
+ // No break on purpose
+ case 8:
+ // No break on purpose
+ case 9:
+ // No break on purpose
+ case 10:
+ // No break on purpose
+ case 11:
+ // No break on purpose
+ case 12:
+ // No break on purpose
+ case 15:
+ // No break on purpose
+ case 16:
+ // No break on purpose
+ case 19:
+ // No break on purpose
+ case 23:
+ // No break on purpose
+ case 24:
+ // No break on purpose
+ case 29:
+ // No break on purpose
+ case 30:
+ // No break on purpose
+ case 39:
+ // No break on purpose
+ case 40:
+ // No break on purpose
+ case 44:
+ // No break on purpose
+ case 45:
+ // No break on purpose
+ case 71:
+ // No break on purpose
+ case 72:
+ // No break on purpose
+ case 73:
+ // No break on purpose
+ case 74:
+ // No break on purpose
+ case 75:
+ // No break on purpose
+ case 79:
+ // No break on purpose
+ case 85:
+ // No break on purpose
+ case 86:
+ // No break on purpose
+ case 87:
+ // No break on purpose
+ case 95:
+ // No break on purpose
+ case 96:
+ // No break on purpose
+ case 102:
+ // No break on purpose
+ case 103:
+ _exit3._enabled = true;
+ _exit6._enabled = true;
+ break;
+ case 4:
+ // No break on purpose
+ case 6:
+ // No break on purpose
+ case 13:
+ // No break on purpose
+ case 17:
+ // No break on purpose
+ case 20:
+ // No break on purpose
+ case 25:
+ // No break on purpose
+ case 27:
+ // No break on purpose
+ case 31:
+ // No break on purpose
+ case 33:
+ // No break on purpose
+ case 37:
+ // No break on purpose
+ case 41:
+ // No break on purpose
+ case 46:
+ // No break on purpose
+ case 48:
+ // No break on purpose
+ case 50:
+ // No break on purpose
+ case 52:
+ // No break on purpose
+ case 54:
+ // No break on purpose
+ case 76:
+ // No break on purpose
+ case 80:
+ // No break on purpose
+ case 82:
+ // No break on purpose
+ case 88:
+ // No break on purpose
+ case 90:
+ // No break on purpose
+ case 92:
+ // No break on purpose
+ case 97:
+ // No break on purpose
+ case 100:
+ // No break on purpose
+ case 104:
+ _exit6._enabled = true;
+ R2_GLOBALS._walkRegions.enableRegion(6);
+ R2_GLOBALS._walkRegions.enableRegion(9);
+ break;
+ case 5:
+ // No break on purpose
+ case 7:
+ // No break on purpose
+ case 14:
+ // No break on purpose
+ case 18:
+ // No break on purpose
+ case 22:
+ // No break on purpose
+ case 26:
+ // No break on purpose
+ case 28:
+ // No break on purpose
+ case 32:
+ // No break on purpose
+ case 36:
+ // No break on purpose
+ case 38:
+ // No break on purpose
+ case 43:
+ // No break on purpose
+ case 47:
+ // No break on purpose
+ case 49:
+ // No break on purpose
+ case 51:
+ // No break on purpose
+ case 53:
+ // No break on purpose
+ case 70:
+ // No break on purpose
+ case 78:
+ // No break on purpose
+ case 81:
+ // No break on purpose
+ case 84:
+ // No break on purpose
+ case 89:
+ // No break on purpose
+ case 91:
+ // No break on purpose
+ case 94:
+ // No break on purpose
+ case 99:
+ // No break on purpose
+ case 101:
+ _exit3._enabled = true;
+ R2_GLOBALS._walkRegions.enableRegion(1);
+ R2_GLOBALS._walkRegions.enableRegion(7);
+ R2_GLOBALS._walkRegions.enableRegion(13);
+ break;
+ default:
+ R2_GLOBALS._walkRegions.enableRegion(1);
+ R2_GLOBALS._walkRegions.enableRegion(6);
+ R2_GLOBALS._walkRegions.enableRegion(7);
+ R2_GLOBALS._walkRegions.enableRegion(9);
+ R2_GLOBALS._walkRegions.enableRegion(13);
+ break;
+ }
+
+ _object1.remove();
+ _object1.removeObject();
+ _actor1.remove();
+
+ switch (R2_GLOBALS._v566A4 - 4) {
+ case 0:
+ // No break on purpose
+ case 3:
+ // No break on purpose
+ case 16:
+ // No break on purpose
+ case 22:
+ // No break on purpose
+ case 24:
+ // No break on purpose
+ case 32:
+ // No break on purpose
+ case 33:
+ // No break on purpose
+ case 45:
+ // No break on purpose
+ case 46:
+ // No break on purpose
+ case 48:
+ // No break on purpose
+ case 51:
+ // No break on purpose
+ case 56:
+ // No break on purpose
+ case 59:
+ // No break on purpose
+ case 67:
+ // No break on purpose
+ case 68:
+ // No break on purpose
+ case 70:
+ // No break on purpose
+ case 73:
+ // No break on purpose
+ case 82:
+ // No break on purpose
+ case 90:
+ _exit1._enabled = true;
+ _object1.setup2(1950, (R2_GLOBALS._v566A4 % 2) + 1, 1, 160, 237, 25, 0);
+
+ _actor1.postInit();
+ _actor1.setVisage(1950);
+ _actor1.setStrip((((R2_GLOBALS._v566A4 - 1) / 35) % 2) + 1);
+ _actor1.setFrame(2);
+ _actor1.setPosition(Common::Point(160, 167));
+ _actor1.fixPriority(220);
+ R2_GLOBALS._walkRegions.enableRegion(3);
+ R2_GLOBALS._walkRegions.enableRegion(4);
+ break;
+ case 7:
+ // No break on purpose
+ case 10:
+ // No break on purpose
+ case 23:
+ // No break on purpose
+ case 29:
+ // No break on purpose
+ case 31:
+ // No break on purpose
+ case 39:
+ // No break on purpose
+ case 40:
+ // No break on purpose
+ case 52:
+ // No break on purpose
+ case 53:
+ // No break on purpose
+ case 55:
+ // No break on purpose
+ case 63:
+ // No break on purpose
+ case 65:
+ // No break on purpose
+ case 66:
+ // No break on purpose
+ case 75:
+ // No break on purpose
+ case 77:
+ // No break on purpose
+ case 81:
+ // No break on purpose
+ case 87:
+ // No break on purpose
+ case 89:
+ // No break on purpose
+ case 97:
+ _exit5._enabled = true;
+ _actor1.postInit();
+ _actor1.setVisage(1950);
+ _actor1.setStrip((((R2_GLOBALS._v566A4 - 1) / 35) % 2) + 1);
+ _actor1.setFrame(3);
+ _actor1.setPosition(Common::Point(160, 167));
+ _actor1.fixPriority(220);
+ break;
+ case 58:
+ // No break on purpose
+ case 74:
+ // No break on purpose
+ case 80:
+ _exit1._enabled = true;
+ _exit5._enabled = true;
+
+ _object1.setup(1950, (R2_GLOBALS._v566A4 % 2) + 1, 1, 160, 137, 25);
+
+ _actor1.postInit();
+ _actor1.setVisage(1950);
+ _actor1.setStrip((((R2_GLOBALS._v566A4 - 1) / 35) % 2) + 1);
+ _actor1.setFrame(3);
+ _actor1.setPosition(Common::Point(160, 167));
+ _actor1.fixPriority(220);
+ R2_GLOBALS._walkRegions.enableRegion(3);
+ R2_GLOBALS._walkRegions.enableRegion(4);
+ break;
+ default:
+ _actor1.postInit();
+ _actor1.setVisage(1950);
+ _actor1.setStrip(((R2_GLOBALS._v566A4 - 1) % 35) + 1);
+ _actor1.setFrame(2);
+ _actor1.setPosition(Common::Point(160, 167));
+ _actor1.fixPriority(220);
+ break;
+ }
+
+ switch (R2_GLOBALS._v566A4 - 3) {
+ case 0:
+ // No break on purpose
+ case 3:
+ // No break on purpose
+ case 5:
+ // No break on purpose
+ case 12:
+ // No break on purpose
+ case 15:
+ // No break on purpose
+ case 18:
+ // No break on purpose
+ case 19:
+ // No break on purpose
+ case 23:
+ // No break on purpose
+ case 26:
+ // No break on purpose
+ case 27:
+ // No break on purpose
+ case 29:
+ // No break on purpose
+ case 30:
+ // No break on purpose
+ case 31:
+ // No break on purpose
+ case 32:
+ // No break on purpose
+ case 44:
+ // No break on purpose
+ case 45:
+ // No break on purpose
+ case 51:
+ // No break on purpose
+ case 55:
+ // No break on purpose
+ case 56:
+ // No break on purpose
+ case 57:
+ // No break on purpose
+ case 60:
+ // No break on purpose
+ case 63:
+ _exit2._enabled = true;
+ case 54:
+ // No break on purpose
+ case 61:
+ // No break on purpose
+ case 62:
+ // No break on purpose
+ case 65:
+ _exit2._enabled = true;
+ // No break on purpose
+ case 35:
+ // No break on purpose
+ case 38:
+ // No break on purpose
+ case 40:
+ // No break on purpose
+ case 47:
+ // No break on purpose
+ case 50:
+ // No break on purpose
+ case 53:
+ // No break on purpose
+ case 58:
+ // No break on purpose
+ case 64:
+ // No break on purpose
+ case 66:
+ // No break on purpose
+ case 67:
+ // No break on purpose
+ case 79:
+ // No break on purpose
+ case 80:
+ // No break on purpose
+ case 86:
+ // No break on purpose
+ case 89:
+ // No break on purpose
+ case 90:
+ // No break on purpose
+ case 91:
+ // No break on purpose
+ case 92:
+ // No break on purpose
+ case 95:
+ // No break on purpose
+ case 96:
+ // No break on purpose
+ case 97:
+ // No break on purpose
+ case 98:
+ // No break on purpose
+ case 100:
+ _exit4._enabled = true;
+ R2_GLOBALS._walkRegions.enableRegion(4);
+ R2_GLOBALS._walkRegions.enableRegion(5);
+ R2_GLOBALS._walkRegions.enableRegion(6);
+ R2_GLOBALS._walkRegions.enableRegion(10);
+ R2_GLOBALS._walkRegions.enableRegion(11);
+ default:
+ break;
+ }
+ R2_GLOBALS._uiElements.draw();
+}
+
+void Scene1950::subBE59B() {
+ R2_GLOBALS._player.disableControl();
+ R2_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+
+ _actor8.remove();
+ _actor2.remove();
+ _actor3.remove();
+
+ _field416 = 0;
+ _field41C = 0;
+
+ switch (R2_GLOBALS._v566A4) {
+ case 10:
+ _field41C = 1;
+ break;
+ case 13:
+ _field41C = 2;
+ break;
+ case 16:
+ _field41C = 3;
+ break;
+ case 17:
+ _field41C = 4;
+ break;
+ case 24:
+ _field41C = 5;
+ break;
+ case 25:
+ _field41C = 6;
+ break;
+ case 31:
+ _field41C = 7;
+ break;
+ case 40:
+ _field41C = 8;
+ break;
+ case 45:
+ _field41C = 9;
+ break;
+ case 46:
+ _field41C = 10;
+ break;
+ case 73:
+ _field41C = 11;
+ break;
+ case 75:
+ _field41C = 12;
+ break;
+ case 80:
+ _field41C = 13;
+ break;
+ case 87:
+ _field41C = 14;
+ break;
+ case 88:
+ _field41C = 15;
+ break;
+ case 96:
+ _field41C = 16;
+ break;
+ case 97:
+ _field41C = 17;
+ break;
+ case 104:
+ _field41C = 18;
+ break;
+ default:
+ break;
+ }
+
+ if (_field41C != 0) {
+ _actor8.postInit();
+ _actor8._numFrames = 6;
+ _actor8._moveRate = 6;
+ _actor8._moveDiff = Common::Point(3, 2);
+ _actor8._effect = 1;
+ if (R2_GLOBALS._v56613[(_field41C - 1) * 4] == 0) {
+ _actor8.setPosition(Common::Point(R2_GLOBALS._v56613[((_field41C - 1) * 4) + 2], R2_GLOBALS._v56613[((_field41C - 1) * 4) + 3]));
+ _actor8.animate(ANIM_MODE_NONE, NULL);
+ _actor8.addMover(NULL);
+ _actor8.setVisage(1961);
+ _actor8.setStrip(4);
+ _actor8.setFrame(10);
+ _actor8.fixPriority(10);
+ _actor8.setDetails(1950, 15, -1, 17, 2, (SceneItem *) NULL);
+ } else {
+ _actor8.setVisage(1960);
+ _actor8.setPosition(Common::Point(160, 130));
+ _actor8.animate(ANIM_MODE_2, NULL);
+ _actor8.setDetails(1950, 12, -1, 14, 2, (SceneItem *) NULL);
+ _field416 = 1;
+ }
+ }
+ if ((R2_GLOBALS._v566A4 == 1) && (R2_INVENTORY.getObjectScene(31) != 0)) {
+ _actor2.postInit();
+ _actor2.setVisage(1948);
+ _actor2.setStrip(3);
+ _actor2.setPosition(Common::Point(278, 155));
+ _actor2.fixPriority(100);
+ _actor2.setDetails(1950, 19, 20, 23, 2, (SceneItem *) NULL);
+ }
+
+ if (R2_GLOBALS._v566A4 == 102) {
+ R2_GLOBALS._walkRegions.load(1951);
+ R2_GLOBALS._walkRegions.enableRegion(1);
+ R2_GLOBALS._walkRegions.enableRegion(5);
+ R2_GLOBALS._walkRegions.enableRegion(6);
+ R2_GLOBALS._walkRegions.enableRegion(7);
+
+ _actor6.postInit();
+ _actor6.setVisage(1970);
+ _actor6.setStrip(1);
+ if (R2_GLOBALS.getFlag(37))
+ _actor6.setFrame(3);
+ else
+ _actor6.setFrame(1);
+ _actor6.setPosition(Common::Point(193, 158));
+ _actor6.setDetails(1950, 3, 4, 5, 2, (SceneItem *) NULL);
+
+ _actor7.postInit();
+ _actor7.setVisage(1970);
+ _actor7.setStrip(3);
+ _actor7.animate(ANIM_MODE_2, NULL);
+ _actor7._numFrames = 6;
+ _actor7.setPosition(Common::Point(194, 158));
+ _actor7.fixPriority(159);
+
+ _item2.setDetails(Rect(188, 124, 199, 133), 1950, 27, 28, -1, 2, NULL);
+
+ if (R2_INVENTORY.getObjectScene(34) == 1950) {
+ _actor5.postInit();
+ _actor5.setVisage(1970);
+ _actor5.setStrip(1);
+ _actor5.setFrame(2);
+ _actor5.fixPriority(160);
+ }
+
+ if (R2_GLOBALS.getFlag(37)) {
+ _actor5.setPosition(Common::Point(192, 118));
+ _actor5.setDetails(1950, 9, 4, -1, 2, (SceneItem *) NULL);
+ } else {
+ _actor4.postInit();
+ _actor4.setVisage(1970);
+ _actor4.setStrip(4);
+ _actor4._numFrames = 4;
+ _actor4.animate(ANIM_MODE_8, NULL);
+ _actor4.setPosition(Common::Point(192, 121));
+ _actor4.fixPriority(159);
+ _actor4.setDetails(1950, 6, 7, 8, 2, (SceneItem *) NULL);
+
+ _actor5.setPosition(Common::Point(192, 109));
+ _actor5.setDetails(1950, 9, 7, 8, 2, (SceneItem *) NULL);
+ }
+
+ _actor3.postInit();
+ _actor3.setVisage(1972);
+ _actor3.setStrip(1);
+ _actor3.setPosition(Common::Point(76, 94));
+ _actor3.fixPriority(25);
+ _actor3.setDetails(1950, 30, -1, -1, 2, (SceneItem *) NULL);
+ if (R2_INVENTORY.getObjectScene(35) == 2)
+ _actor3.setFrame(2);
+ else
+ _actor3.setFrame(1);
+
+ _field414 = 1;
+ } else if (_field414 != 0) {
+ _actor6.remove();
+ _actor4.remove();
+ _actor5.remove();
+ _actor7.remove();
+ _actor3.remove();
+
+ _item1.setDetails(Rect(0, 0, 320, 200), 1950, 0, 1, 2, 2, NULL);
+ }
+
+ switch (R2_GLOBALS._v566A5) {
+ case 0:
+ _sceneMode = 1950;
+ if (R2_INVENTORY.getObjectScene(31) == 0) {
+ R2_GLOBALS._v56AAB = 0;
+ R2_GLOBALS._player.enableControl(CURSOR_ARROW);
+ } else {
+ setAction(&_sequenceManager, this, 1950, &R2_GLOBALS._player, NULL);
+ }
+ break;
+ case 1: {
+ _sceneMode = R2_GLOBALS._v566A5;
+ R2_GLOBALS._player.setPosition(Common::Point(160, 213));
+ Common::Point pt(160, 160);
+ NpcMover *mover = new NpcMover();
+ R2_GLOBALS._player.addMover(mover, &pt, this);
+ }
+ break;
+ case 2:
+ _sceneMode = R2_GLOBALS._v566A5;
+ if (R2_GLOBALS.getFlag(36))
+ setAction(&_sequenceManager, this, 1957, &R2_GLOBALS._player, NULL);
+ else
+ setAction(&_sequenceManager, this, 1974, &R2_GLOBALS._player, NULL);
+ break;
+ case 3:
+ if (_field416 == 0) {
+ _sceneMode = R2_GLOBALS._v566A5;
+ R2_GLOBALS._player.setPosition(Common::Point(-20, 160));
+ Common::Point pt(30, 160);
+ NpcMover *mover = new NpcMover();
+ R2_GLOBALS._player.addMover(mover, &pt, this);
+ } else {
+ _sceneMode = 18;
+ _exit3._enabled = false;
+ _field418 = Common::Point(60, 152);
+ R2_GLOBALS._v56AAB = 0;
+ R2_GLOBALS._player.enableControl(CURSOR_USE);
+ R2_GLOBALS._player._canWalk = false;
+
+ _actor8.setStrip(2);
+ NpcMover *mover = new NpcMover();
+ _actor8.addMover(mover, &_field418, this);
+
+ R2_GLOBALS._player.setPosition(Common::Point(-20, 160));
+ Common::Point pt2(30, 160);
+ NpcMover *mover2 = new NpcMover();
+ R2_GLOBALS._player.addMover(mover2, &pt2, NULL);
+ }
+ break;
+ case 4:
+ _sceneMode = R2_GLOBALS._v566A5;
+ if (_field412 == 0) {
+ if (R2_GLOBALS.getFlag(36))
+ setAction(&_sequenceManager, this, 1955, &R2_GLOBALS._player, NULL);
+ else
+ setAction(&_sequenceManager, this, 1972, &R2_GLOBALS._player, NULL);
+ } else {
+ if (R2_GLOBALS.getFlag(36))
+ setAction(&_sequenceManager, this, 1954, &R2_GLOBALS._player, NULL);
+ else
+ setAction(&_sequenceManager, this, 1971, &R2_GLOBALS._player, NULL);
+ }
+ break;
+ case 5: {
+ _sceneMode = R2_GLOBALS._v566A5;
+ R2_GLOBALS._player.setPosition(Common::Point(160, 127));
+ Common::Point pt(160, 160);
+ NpcMover *mover = new NpcMover();
+ R2_GLOBALS._player.addMover(mover, &pt, this);
+ }
+ break;
+ case 6:
+ if (_field416 == 0) {
+ _sceneMode = R2_GLOBALS._v566A5;
+ if (R2_GLOBALS._v566A4 == 1) {
+ setAction(&_sequenceManager, this, 1961, &R2_GLOBALS._player, NULL);
+ } else {
+ R2_GLOBALS._player.setPosition(Common::Point(340, 160));
+ Common::Point pt(289, 160);
+ NpcMover *mover = new NpcMover();
+ R2_GLOBALS._player.addMover(mover, &pt, this);
+ }
+ } else {
+ _sceneMode = 17;
+ _exit6._enabled = false;
+ _field418 = Common::Point(259, 152);
+
+ R2_GLOBALS._v56AAB = 0;
+ R2_GLOBALS._player.enableControl(CURSOR_USE);
+ R2_GLOBALS._player._canWalk = false;
+
+ _actor8.setStrip(1);
+ NpcMover *mover = new NpcMover();
+ _actor8.addMover(mover, &_field418, this);
+
+ R2_GLOBALS._player.setPosition(Common::Point(340, 160));
+ Common::Point pt2(289, 160);
+ NpcMover *mover2 = new NpcMover();
+ R2_GLOBALS._player.addMover(mover2, &pt2, NULL);
+ }
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene1950::subBF4B4(int indx) {
+ R2_GLOBALS._player.disableControl();
+ int si = indx - 1;
+ if ((indx / 4) == (si / 4)) {
+ if (si < 0)
+ si = 3;
+ } else
+ si = 4;
+
+ if (_area1._arrActor1[si]._fieldA8 == 0) {
+ _area1._arrActor1[si].setFrame(2);
+ _area1._arrActor1[si]._fieldA8 = 1;
+ } else {
+ _area1._arrActor1[si].setFrame(1);
+ _area1._arrActor1[si]._fieldA8 = 0;
+ }
+
+ si = indx + 1;
+ if ((indx / 4) == (si / 4)) {
+ if (si > 15)
+ si = 12;
+ } else
+ si -= 4;
+
+ if (_area1._arrActor1[si]._fieldA8 == 0) {
+ _area1._arrActor1[si].setFrame(2);
+ _area1._arrActor1[si]._fieldA8 = 1;
+ } else {
+ _area1._arrActor1[si].setFrame(1);
+ _area1._arrActor1[si]._fieldA8 = 0;
+ }
+
+ si = indx - 4;
+ if (si < 0)
+ si += 16;
+
+ if (_area1._arrActor1[si]._fieldA8 == 0) {
+ _area1._arrActor1[si].setFrame(2);
+ _area1._arrActor1[si]._fieldA8 = 1;
+ } else {
+ _area1._arrActor1[si].setFrame(1);
+ _area1._arrActor1[si]._fieldA8 = 0;
+ }
+
+ si = indx + 4;
+ if (si > 15)
+ si -= 16;
+
+ if (_area1._arrActor1[si]._fieldA8 == 0) {
+ _area1._arrActor1[si].setFrame(2);
+ _area1._arrActor1[si]._fieldA8 = 1;
+ } else {
+ _area1._arrActor1[si].setFrame(1);
+ _area1._arrActor1[si]._fieldA8 = 0;
+ }
+
+ int cpt = 0;
+ for (si = 0; si < 16; si++) {
+ if (_area1._arrActor1[si]._fieldA8 != 0)
+ ++cpt;
+ }
+
+ if (cpt != 16) {
+ R2_GLOBALS._player.enableControl();
+ R2_GLOBALS._player._canWalk = false;
+ } else {
+ R2_GLOBALS.setFlag(37);
+ _sceneMode = 24;
+ // TODO: check if correct. The original doesn't countain a sceneActor in
+ // this call, but it's extremely unusual
+ setAction(&_sequenceManager, this, 1976, NULL);
+ }
+}
+
+void Scene1950::postInit(SceneObjectList *OwnerList) {
+ _field412 = 0;
+ _field414 = 0;
+ _field416 = 0;
+ _field41C = 0;
+ if (R2_GLOBALS._sceneManager._previousScene == 300)
+ R2_GLOBALS._v566A4 = 103;
+
+ subBDC1E();
+ SceneExt::postInit();
+ R2_GLOBALS._sound1.play(105);
+
+ _exit1.setDetails(Rect(130, 46, 189, 135), SHADECURSOR_UP, 1950);
+ _exit1.setDest(Common::Point(160, 145));
+
+ _exit2.setDetails(Rect(208, 0, 255, 73), EXITCURSOR_N, 1950);
+ _exit2.setDest(Common::Point(200, 151));
+
+ _exit3.setDetails(Rect(305, 95, 320, 147), EXITCURSOR_E, 1950);
+ _exit3.setDest(Common::Point(312, 160));
+
+ _exit4.setDetails(Rect(208, 99, 255, 143), EXITCURSOR_S, 1950);
+ _exit4.setDest(Common::Point(200, 151));
+
+ _exit5.setDetails(Rect(113, 154, 206, 168), SHADECURSOR_DOWN, 1950);
+ _exit5.setDest(Common::Point(160, 165));
+
+ _exit6.setDetails(Rect(0, 95, 14, 147), EXITCURSOR_W, 1950);
+ _exit6.setDest(Common::Point(7, 160));
+
+ _exit7.setDetails(Rect(72, 54, 120, 128), EXITCURSOR_NW, 1950);
+ _exit7.setDest(Common::Point(120, 140));
+
+ _exit8.setDetails(Rect(258, 60, 300, 145), EXITCURSOR_NE, 1950);
+ _exit8.setDest(Common::Point(268, 149));
+
+ R2_GLOBALS._player.postInit();
+ if ( (R2_INVENTORY.getObjectScene(32) == 0) && (R2_INVENTORY.getObjectScene(33) == 0)
+ && (R2_INVENTORY.getObjectScene(46) == 0) && (!R2_GLOBALS.getFlag(36)) )
+ R2_GLOBALS._player.setVisage(22);
+ else
+ R2_GLOBALS._player.setVisage(20);
+
+ R2_GLOBALS._player._moveDiff = Common::Point(5, 3);
+ _item1.setDetails(Rect(0, 0, 320, 200), 1950, 0, 1, 2, 1, NULL);
+
+ subBE59B();
+}
+
+void Scene1950::remove() {
+ R2_GLOBALS._sound1.stop();
+ R2_GLOBALS._sound2.fadeOut2(NULL);
+ SceneExt::remove();
+}
+
+void Scene1950::signal() {
+ switch (_sceneMode) {
+ case 11:
+ R2_GLOBALS._v566A4 += 7;
+ subBDC1E();
+ subBE59B();
+ break;
+ case 12:
+ R2_GLOBALS._v566A4 += 35;
+ subBDC1E();
+ subBE59B();
+ break;
+ case 1975:
+ SceneItem::display(1950, 21, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ // No break on purpose
+ case 13:
+ ++R2_GLOBALS._v566A4;
+ subBDC1E();
+ subBE59B();
+ break;
+ case 14:
+ R2_GLOBALS._v566A4 += 221;
+ subBDC1E();
+ subBE59B();
+ break;
+ case 15:
+ R2_GLOBALS._v566A4 += 249;
+ subBDC1E();
+ subBE59B();
+ break;
+ case 16:
+ // No break on purpose
+ case 1961:
+ --R2_GLOBALS._v566A4;
+ subBDC1E();
+ subBE59B();
+ break;
+ case 17: {
+ _sceneMode = 13;
+ R2_GLOBALS._v566A5 = 3;
+ _field416 = 0;
+ R2_GLOBALS._player.disableControl(CURSOR_ARROW);
+ R2_GLOBALS._player._canWalk = true;
+ R2_GLOBALS._player.setVisage(22);
+ R2_GLOBALS._player.animate(ANIM_MODE_9, NULL);
+ Common::Point pt(340, 160);
+ NpcMover *mover = new NpcMover();
+ R2_GLOBALS._player.addMover(mover, &pt, this);
+ Common::Point pt2(289, 160);
+ NpcMover *mover2 = new NpcMover();
+ _actor8.addMover(mover2, &pt2, NULL);
+ }
+ break;
+ case 18: {
+ _sceneMode = 16;
+ R2_GLOBALS._v566A5 = 6;
+ _field416 = 0;
+ R2_GLOBALS._player.disableControl(CURSOR_ARROW);
+ R2_GLOBALS._player._canWalk = true;
+ R2_GLOBALS._player.setVisage(22);
+ R2_GLOBALS._player.animate(ANIM_MODE_9, NULL);
+ Common::Point pt(-20, 160);
+ NpcMover *mover = new NpcMover();
+ R2_GLOBALS._player.addMover(mover, &pt, this);
+ Common::Point pt2(30, 160);
+ NpcMover *mover2 = new NpcMover();
+ _actor8.addMover(mover2, &pt2, NULL);
+ }
+ break;
+ case 24:
+ _area1.remove();
+ _sceneMode = 1966;
+ _actor6.setFrame(3);
+ setAction(&_sequenceManager, this, 1966, &_actor4, &_actor5, NULL);
+ break;
+ case 1951:
+ R2_GLOBALS._sound1.fadeOut2(NULL);
+ R2_GLOBALS._sceneManager.changeScene(1945);
+ break;
+ case 1958:
+ SceneItem::display(1950, 24, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ R2_GLOBALS._v56AAB = 0;
+ R2_GLOBALS._player.enableControl(CURSOR_ARROW);
+ _exit8._enabled = true;
+ break;
+ case 1959:
+ R2_INVENTORY.setObjectScene(46, 0);
+ R2_GLOBALS._v56AAB = 0;
+ R2_GLOBALS._player.enableControl(CURSOR_ARROW);
+ _exit8._enabled = true;
+ break;
+ case 1962:
+ // No break on purpose
+ case 1963:
+ R2_GLOBALS._player.enableControl();
+ _area1.proc12(1971, 1, 1, 160, 135);
+ break;
+ case 1964:
+ // No break on purpose
+ case 1965:
+ if (!R2_GLOBALS.getFlag(37))
+ SceneItem::display(1950, 26, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ R2_GLOBALS._player.enableControl();
+ break;
+ case 1966:
+ _actor4.remove();
+ if (R2_GLOBALS.getFlag(36)) {
+ _sceneMode = 1964;
+ setAction(&_sequenceManager, this, 1964, &R2_GLOBALS._player, NULL);
+ } else {
+ _sceneMode = 1965;
+ setAction(&_sequenceManager, this, 1965, &R2_GLOBALS._player, NULL);
+ }
+ _actor5.setDetails(1950, 9, -1, -1, 2, (SceneItem *) NULL);
+ case 1967: {
+ _sceneMode = 0;
+ R2_INVENTORY.setObjectScene(34, 2);
+ _actor5.remove();
+ if (R2_GLOBALS.getFlag(36))
+ R2_GLOBALS._player.setVisage(20);
+ else
+ R2_GLOBALS._player.setVisage(22);
+
+ R2_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+ Common::Point pt(218, 165);
+ NpcMover *mover = new NpcMover();
+ R2_GLOBALS._player.addMover(mover, &pt, this);
+ }
+ break;
+ case 1968:
+ R2_GLOBALS._player.disableControl();
+ R2_INVENTORY.setObjectScene(35, 2);
+ _actor3.setFrame(2);
+ if (R2_GLOBALS.getFlag(36))
+ R2_GLOBALS._player.setVisage(20);
+ else
+ R2_GLOBALS._player.setVisage(22);
+ R2_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+ break;
+ default:
+ R2_GLOBALS._v56AAB = 0;
+ R2_GLOBALS._player.enableControl(CURSOR_ARROW);
+ break;
+ }
+}
+
+void Scene1950::process(Event &event) {
+ if ( (event.eventType == EVENT_BUTTON_DOWN)
+ && (R2_GLOBALS._player._uiEnabled)
+ && (R2_GLOBALS._events.getCursor() == R2_LIGHT_BULB)
+ && (R2_GLOBALS._player._bounds.contains(event.mousePos))
+ && (R2_INVENTORY.getObjectScene(31) == 0)) {
+ event.handled = true;
+ R2_GLOBALS._player.disableControl();
+ _exit7._enabled = false;
+ _exit8._enabled = false;
+ _sceneMode = 1959;
+ setAction(&_sequenceManager, this, 1959, &R2_GLOBALS._player, NULL);
+ }
+ Scene::process(event);
+}
+
} // End of namespace Ringworld2
} // End of namespace TsAGE
diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.h b/engines/tsage/ringworld2/ringworld2_scenes1.h
index f0444de70d..5906030c5f 100644
--- a/engines/tsage/ringworld2/ringworld2_scenes1.h
+++ b/engines/tsage/ringworld2/ringworld2_scenes1.h
@@ -56,6 +56,1186 @@ public:
virtual void dispatch();
};
+class Scene1100 : public SceneExt {
+ class Actor16 : public SceneActor {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Actor17 : public SceneActor {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Actor18 : public SceneActor {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+public:
+ int _field412, _field414;
+ SpeakerSeeker1100 _seekerSpeaker;
+ SpeakerQuinn1100 _quinnSpeaker;
+ SpeakerChief1100 _chiefSpeaker;
+ ScenePalette _palette1;
+ NamedHotspot _item1;
+ NamedHotspot _item2;
+ NamedHotspot _item3;
+ NamedHotspot _item4;
+ NamedHotspot _item5;
+ NamedHotspot _item6;
+ NamedHotspot _item7;
+ SceneActor _actor1;
+ SceneActor _actor2;
+ SceneActor _actor3;
+ SceneActor _actor4;
+ SceneActor _actor5;
+ SceneActor _actor6;
+ SceneActor _actor7;
+ SceneActor _actor8;
+ SceneActor _actor9;
+ SceneActor _actor10;
+ SceneActor _actor11;
+ SceneActor _actor12;
+ SceneActor _actor13;
+ SceneActor _actor14;
+ SceneActor _actor15;
+ BackgroundSceneObject _object1;
+ BackgroundSceneObject _object2;
+ Actor16 _actor16;
+ Actor17 _actor17;
+ Actor18 _actor18;
+ SequenceManager _sequenceManager1;
+ SequenceManager _sequenceManager2;
+ SequenceManager _sequenceManager3;
+
+ Scene1100();
+ void synchronize(Serializer &s);
+
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void remove();
+ virtual void signal();
+ virtual void dispatch();
+ virtual void saveCharacter(int characterIndex);
+};
+
+class Scene1200 : public SceneExt {
+ class Area1: public SceneArea {
+ public:
+ class Actor3 : public SceneActorExt {
+ public:
+ void init(int state);
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ SceneActor _actor2;
+ Actor3 _actor3;
+ Actor3 _actor4;
+ Actor3 _actor5;
+
+ byte _field20;
+
+ Area1();
+ void synchronize(Serializer &s);
+
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void remove();
+ virtual void process(Event &event);
+ virtual void proc12(int visage, int stripFrameNum, int frameNum, int posX, int posY);
+ virtual void proc13(int resNum, int lookLineNum, int talkLineNum, int useLineNum);
+ };
+
+public:
+ NamedHotspot _item1;
+ SceneActor _actor1;
+ Area1 _area1;
+ UnkObject1200 _object1;
+ SequenceManager _sequenceManager;
+
+ int _field412;
+ int _field414;
+ int _field416;
+ int _field418;
+ int _field41A;
+ int _field41C;
+
+ Scene1200();
+ void synchronize(Serializer &s);
+
+ void sub9DAD6(int indx);
+
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void signal();
+ virtual void process(Event &event);
+ virtual void dispatch();
+ virtual void saveCharacter(int characterIndex);
+};
+
+class Scene1337 : public SceneExt {
+ class unkObj1337sub1: public SceneHotspot {
+ public:
+ SceneObject _object1;
+
+ int _field34;
+ Common::Point _field36;
+
+ unkObj1337sub1();
+ void synchronize(Serializer &s);
+ };
+
+ class unkObj1337_1: public SceneHotspot {
+ public:
+ unkObj1337sub1 _arr1[4];
+ unkObj1337sub1 _arr2[8];
+ unkObj1337sub1 _arr3[1];
+ unkObj1337sub1 _arr4[1];
+
+ Common::Point _fieldB94;
+ Common::Point _fieldB98;
+ Common::Point _fieldB9C;
+ Common::Point _fieldBA0;
+ int _fieldBA4;
+
+ unkObj1337_1();
+ void synchronize(Serializer &s);
+ };
+
+ class Action1337: public Action {
+ public:
+ void subD18B5(int resNum, int stripNum, int frameNum);
+ void skipFrames(int32 skipCount);
+ };
+
+ class Action1: public Action1337 {
+ public:
+ void signal();
+ };
+ class Action2: public Action1337 {
+ public:
+ void signal();
+ };
+ class Action3: public Action1337 {
+ public:
+ void signal();
+ };
+ class Action4: public Action1337 {
+ public:
+ void signal();
+ };
+ class Action5: public Action1337 {
+ public:
+ void signal();
+ };
+ class Action6: public Action1337 {
+ public:
+ void signal();
+ };
+ class Action7: public Action1337 {
+ public:
+ void signal();
+ };
+ class Action8: public Action1337 {
+ public:
+ void signal();
+ };
+ class Action9: public Action1337 {
+ public:
+ void signal();
+ };
+ class Action10: public Action1337 {
+ public:
+ void signal();
+ };
+ class Action11: public Action1337 {
+ public:
+ void signal();
+ };
+ class Action12: public Action1337 {
+ public:
+ void signal();
+ };
+ class Action13: public Action1337 {
+ public:
+ void signal();
+ };
+public:
+ typedef void (Scene1337::*FunctionPtrType)();
+ FunctionPtrType _unkFctPtr412;
+
+ ASound _aSound1;
+ ASound _aSound2;
+ BackgroundSceneObject _background1;
+ bool _autoplay;
+ unkObj1337_1 _arrunkObj1337[4];
+ SceneItem _item1;
+ SceneObject _object1;
+ Action1 _action1;
+ Action2 _action2;
+ Action3 _action3;
+ Action4 _action4;
+ Action5 _action5;
+ Action6 _action6;
+ Action7 _action7;
+ Action8 _action8;
+ Action9 _action9;
+ Action10 _action10;
+ Action11 _action11;
+ Action12 _action12;
+ Action13 _action13;
+ unkObj1337sub1 _item2;
+ unkObj1337sub1 _item3;
+ unkObj1337sub1 _item4;
+ BackgroundSceneObject _background2;
+ int _field3E24;
+ int _field3E26;
+ int _field3E28[100];
+ unkObj1337sub1 *_field3EF0;
+ unkObj1337sub1 *_field3EF4;
+ unkObj1337sub1 *_field3EF8;
+ unkObj1337sub1 _item5;
+ unkObj1337sub1 _item6;
+ unkObj1337sub1 _item7;
+ unkObj1337sub1 _item8;
+ int _field423C;
+ int _field423E;
+ int _field4240;
+ int _field4242;
+ int _field4244;
+ int _field4246;
+ int _field4248;
+ int _field424A;
+ int _field424C;
+ int _field424E;
+
+ SceneObject _arrObject1[8];
+ SceneObject _arrObject2[8];
+
+ Scene1337();
+ virtual void synchronize(Serializer &s);
+
+ void actionDisplay(int resNum, int lineNum, int x, int y, int arg5, int width, int textMode, int fontNum, int colFG, int colBGExt, int colFGExt);
+ void setAnimationInfo(unkObj1337sub1 *subObj);
+ void subC20E5();
+ void subC20F9();
+ void subC2586();
+ bool subC264B(int arg1);
+ bool subC2687(int arg1);
+ int subC26CB(int arg1, int arg2);
+ int subC2719(int arg1);
+ int subC274D(int arg1);
+ int subC2781(int arg1);
+ int subC27B5(int arg1);
+ int subC27F9(int arg1);
+ void subC2835(int arg1);
+ bool subC2BF8(unkObj1337sub1 *subObj1, Common::Point pt);
+ void subC2C2F();
+ void subC318B(int arg1, unkObj1337sub1 *subObj2, int arg3);
+ int subC3257(int arg1);
+ bool subC32B1(int arg1, int arg2);
+ int subC331B(int arg1);
+ bool subC3386(int arg1, int arg2);
+ void subC33C0(unkObj1337sub1 *subObj1, unkObj1337sub1 *subObj2);
+ void subC3456(unkObj1337sub1 *subObj1, unkObj1337sub1 *subObj2);
+ void subC340B(unkObj1337sub1 *subObj1, unkObj1337sub1 *subObj2);
+ void subC34A1(unkObj1337sub1 *subObj1, unkObj1337sub1 *subObj2);
+ unkObj1337sub1 *subC34EC(int arg1);
+ void subC358E(unkObj1337sub1 *subObj1, int arg2);
+ int subC3E92(int arg1);
+ void subC4A39(unkObj1337sub1 *subObj);
+ void subC4CD2();
+ void subC4CEC();
+ void subC51A0(unkObj1337sub1 *subObj1, unkObj1337sub1 *subObj2);
+ void displayDialog(int dialogNumb);
+ void subPostInit();
+ void subCB59B();
+ void suggestInstructions();
+ void shuffleCards();
+ void subCCF26();
+ void subCD193();
+ void subCDB90(int arg1, Common::Point pt);
+ void subCF31D();
+ void subCF979();
+ void subD026D();
+ void subD0281();
+ void subD02CA();
+ void subD183F(int arg1, int arg2);
+ void subD18B5(int resNum, int rlbNum, int arg3);
+ int subD18F5();
+ int subD1917();
+ int subD1940(bool flag);
+ void subD195F(int arg1, int arg2);
+ void subD1975(int arg1, int arg2);
+ void subD1A48(int arg1);
+
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void remove();
+ virtual void process(Event &event);
+ virtual void dispatch();
+};
+
+class Scene1500 : public SceneExt {
+public:
+ SceneActor _actor1;
+ SceneActor _actor2;
+ SceneActor _actor3;
+ SceneActor _actor4;
+ SequenceManager _sequenceManager;
+
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void remove();
+ virtual void signal();
+ virtual void dispatch();
+};
+
+class Scene1525 : public SceneExt {
+public:
+ SequenceManager _sequenceManager;
+
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void signal();
+};
+
+class Scene1530 : public SceneExt {
+public:
+ SpeakerQuinn _quinnSpeaker;
+ SpeakerSeeker _seekerSpeaker;
+ SceneActor _actor1;
+ SceneActor _actor2;
+ SceneActor _actor3;
+
+ SequenceManager _sequenceManager;
+
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void signal();
+ virtual void dispatch();
+};
+
+class Scene1550 : public SceneExt {
+ class SceneActor1550 : public SceneActor {
+ public:
+ void subA4D14(int frameNumber, int strip);
+ };
+
+ class UnkObj15501 : public SceneActor {
+ public:
+ int _fieldA4;
+ int _fieldA6;
+
+ UnkObj15501();
+ void synchronize(Serializer &s);
+
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ class UnkObj15502 : public SceneActor {
+ public:
+ int _fieldA4;
+
+ UnkObj15502();
+ void synchronize(Serializer &s);
+
+ virtual bool startAction(CursorType action, Event &event);
+ void subA5CDF(int strip);
+ };
+
+ class UnkObj15503 : public SceneActor {
+ public:
+ int _fieldA4;
+
+ UnkObj15503();
+ void synchronize(Serializer &s);
+
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ class UnkArea1550 : public SceneArea {
+ public:
+ byte _field20;
+ SceneActor _areaActor;
+ UnkObj15503 _unkObj155031;
+ UnkObj15503 _unkObj155032;
+
+ virtual void remove();
+ virtual void process(Event &event);
+ virtual void proc12(int visage, int stripFrameNum, int frameNum, int posX, int posY);
+ virtual void proc13(int resNum, int lookLineNum, int talkLineNum, int useLineNum);
+ };
+
+ class Hotspot1 : public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ class Hotspot3 : public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ class Actor6 : public SceneActor {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ class Actor7 : public SceneActor {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ class Actor8 : public SceneActor {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ class Actor9 : public SceneActor {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ class Actor10 : public SceneActor {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ class Actor11 : public SceneActor {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ class Actor12 : public SceneActor {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ class Actor13 : public SceneActor {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ class Actor14 : public SceneActor1550 {
+ // Nothing specific found in the original
+ // TODO: check if it's an useless class
+ };
+
+public:
+ SpeakerQuinn _quinnSpeaker;
+ SpeakerSeeker _seekerSpeaker;
+ Hotspot1 _item1;
+ Hotspot1 _item2;
+ Hotspot3 _item3;
+ SceneActor _actor1;
+ SceneActor _actor2;
+ SceneActor _actor3;
+ SceneActor _actor4;
+ SceneActor _actor5;
+ Actor6 _actor6;
+ Actor7 _actor7;
+ Actor8 _actor8;
+ Actor9 _actor9;
+ Actor10 _actor10;
+ Actor11 _actor11;
+ Actor12 _actor12;
+ Actor13 _actor13;
+ UnkObj15501 _arrUnkObj15501[8];
+ Actor14 _actor14;
+ Actor14 _actor15;
+ Actor14 _actor16;
+ Actor14 _actor17;
+ Actor14 _actor18;
+ Actor14 _actor19;
+ UnkObj15502 _arrUnkObj15502[8];
+ UnkArea1550 _unkArea1;
+ SequenceManager _sequenceManager1;
+ SequenceManager _sequenceManager2;
+
+ int _field412;
+ byte _field414;
+ int _field415;
+ int _field417;
+ int _field419;
+
+ Scene1550();
+ void synchronize(Serializer &s);
+ void subA2B2F();
+
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void signal();
+ virtual void process(Event &event);
+ virtual void dispatch();
+ virtual void saveCharacter(int characterIndex);
+};
+
+class Scene1575 : public SceneExt {
+ class Hotspot1 : public NamedHotspot {
+ public:
+ int _field34;
+ int _field36;
+
+ Hotspot1();
+ void synchronize(Serializer &s);
+ void subA910D(int indx);
+
+ virtual void process(Event &event);
+ virtual bool startAction(CursorType action, Event &event);
+ };
+public:
+ int _field412;
+ int _field414;
+ int _field416;
+ int _field418;
+ int _field41A;
+ Hotspot1 _item1;
+ Hotspot1 _item2;
+ Hotspot1 _item3;
+ Hotspot1 _item4;
+ Hotspot1 _item5;
+ Hotspot1 _item6;
+ SceneActor _actor1;
+ SceneActor _actor2;
+ SceneActor _actor3;
+ SceneActor _actor4;
+ SceneActor _actor5;
+ SceneActor _actor6;
+ SceneActor _actor7;
+ SceneActor _actor8;
+ SceneActor _actor9;
+ SceneActor _actor10;
+ SceneActor _actor11;
+ SceneActor _actor12;
+ SceneActor _actor13;
+ SceneActor _actor14;
+ SceneActor _actor15;
+ SceneActor _arrActor[17];
+ SequenceManager _sequenceManager1;
+
+ Scene1575();
+ void synchronize(Serializer &s);
+
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void remove();
+ virtual void signal();
+ virtual void process(Event &event);
+ virtual void dispatch();
+};
+
+class Scene1580 : public SceneExt {
+ class Hotspot1 : public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Hotspot2 : public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ class Actor2 : public SceneActor {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Actor3 : public SceneActor {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Actor4 : public SceneActor {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Actor5 : public SceneActor {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Actor6 : public SceneActor {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Actor7 : public SceneActor {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+public:
+ int _field412;
+ SpeakerQuinn _quinnSpeaker;
+ SpeakerSeeker _seekerSpeaker;
+ Hotspot1 _item1;
+ Hotspot2 _item2;
+ NamedHotspot _item3;
+ SceneActor _actor1;
+ SceneActor _arrActor[8];
+ Actor2 _actor2;
+ Actor3 _actor3;
+ Actor4 _actor4;
+ Actor5 _actor5;
+ Actor6 _actor6;
+ Actor7 _actor7;
+ SequenceManager _sequenceManager;
+
+ Scene1580();
+ void synchronize(Serializer &s);
+
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void signal();
+};
+
+class Scene1625 : public SceneExt {
+ class Actor7 : public SceneActor {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+public:
+ int _field412;
+ SpeakerMiranda1625 _mirandaSpeaker;
+ SpeakerTeal1625 _tealSpeaker;
+ SpeakerSoldier1625 _soldierSpeaker;
+ NamedHotspot _item1;
+ SceneActor _actor1;
+ SceneActor _actor2;
+ SceneActor _actor3;
+ SceneActor _actor4;
+ SceneActor _actor5;
+ SceneActor _actor6;
+ Actor7 _actor7;
+ SequenceManager _sequenceManager;
+
+ Scene1625();
+ void synchronize(Serializer &s);
+
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void remove();
+ virtual void signal();
+ virtual void process(Event &event);
+};
+
+class Scene1700 : public SceneExt {
+ class Item2 : public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ class Actor11 : public SceneActor {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Actor12 : public SceneActor {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ class Exit1 : public SceneExit {
+ public:
+ virtual void changeScene();
+ };
+ class Exit2 : public SceneExit {
+ public:
+ virtual void changeScene();
+ };
+ class Exit3 : public SceneExit {
+ public:
+ virtual void changeScene();
+ };
+public:
+ SpeakerQuinn _quinnSpeaker;
+ SpeakerSeeker _seekerSpeaker;
+ NamedHotspot _item1;
+ Item2 _item2;
+ SceneActor _actor1;
+ SceneActor _actor2;
+ SceneActor _actor3;
+ SceneActor _actor4;
+ SceneActor _actor5;
+ SceneActor _actor6;
+ SceneActor _actor7;
+ SceneActor _actor8;
+ SceneActor _actor9;
+ SceneActor _actor10;
+ Actor11 _actor11;
+ Actor12 _actor12;
+ Exit1 _exit1;
+ Exit2 _exit2;
+ Exit3 _exit3;
+ SequenceManager _sequenceManager;
+
+ int _field77A;
+ int _field77C;
+
+ Scene1700();
+ void synchronize(Serializer &s);
+ void subAF3F8();
+
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void remove();
+ virtual void signal();
+};
+
+class Scene1750 : public SceneExt {
+ class Actor4 : public SceneActor {
+ public:
+ int _fieldA4;
+ int _fieldA6;
+ int _fieldA8;
+ int _fieldAA;
+ int _fieldAC;
+ int _fieldAE;
+
+ Actor4();
+ virtual void synchronize(Serializer &s);
+ void subB1A76(int arg1, int arg2, int arg3, int arg4, int arg5);
+ void subB1B27();
+
+ virtual void remove();
+ virtual void process(Event &event);
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ class Actor5 : public SceneActor {
+ public:
+ int _fieldA4;
+
+ Actor5();
+ virtual void synchronize(Serializer &s);
+
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+public:
+ NamedHotspot _item1;
+ NamedHotspot _item2;
+ NamedHotspot _item3;
+ NamedHotspot _item4;
+ NamedHotspot _item5;
+ SceneActor _actor1;
+ SceneActor _actor2;
+ SceneActor _actor3;
+ Actor4 _actor4;
+ Actor5 _actor5;
+ Actor5 _actor6;
+ Actor5 _actor7;
+ SequenceManager _sequenceManager;
+ PaletteRotation *_rotation;
+
+ int _field412;
+ int _field413;
+ int _field415;
+ int _field417;
+ int _field419;
+ int _field41B;
+ int _field41D;
+
+ Scene1750();
+ virtual void synchronize(Serializer &s);
+
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void remove();
+ virtual void signal();
+ virtual void process(Event &event);
+ virtual void dispatch();
+};
+
+class Scene1800 : public SceneExt {
+ class Hotspot5 : public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ class Actor6 : public SceneActor {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Actor7 : public SceneActor {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Actor8 : public SceneActor {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ class Exit1 : public SceneExit {
+ public:
+ virtual void changeScene();
+ };
+public:
+ int _field412;
+ SpeakerQuinn _quinnSpeaker;
+ SpeakerSeeker _seekerSpeaker;
+ NamedHotspot _item1;
+ NamedHotspot _item2;
+ NamedHotspot _item3;
+ NamedHotspot _item4;
+ Hotspot5 _item5;
+ SceneActor _actor1;
+ SceneActor _actor2;
+ SceneActor _actor3;
+ SceneActor _actor4;
+ SceneActor _actor5;
+ Actor6 _actor6;
+ Actor7 _actor7;
+ Actor8 _actor8;
+ Actor8 _actor9;
+ Exit1 _exit1;
+ SequenceManager _sequenceManager;
+
+ Scene1800();
+ void synchronize(Serializer &s);
+
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void signal();
+ virtual void saveCharacter(int characterIndex);
+};
+
+class Scene1850 : public SceneExt {
+ class Hotspot2 : public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ class Actor5 : public SceneActor {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Actor6 : public SceneActor {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Actor8 : public SceneActor {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+public:
+ int _field412;
+ int _field414;
+ int _field416;
+ int _field418;
+ Common::Point _field41A;
+ int _field41E;
+ ScenePalette _palette1;
+ SpeakerQuinn _quinnSpeaker;
+ SpeakerSeeker _seekerSpeaker;
+ NamedHotspot _item1;
+ Hotspot2 _item2;
+ SceneActor _actor1;
+ SceneActor _actor2;
+ SceneActor _actor3;
+ SceneActor _actor4;
+ Actor5 _actor5;
+ Actor6 _actor6;
+ Actor6 _actor7;
+ Actor8 _actor8;
+ SequenceManager _sequenceManager1;
+ SequenceManager _sequenceManager2;
+
+ Scene1850();
+ void synchronize(Serializer &s);
+
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void remove();
+ virtual void signal();
+ virtual void process(Event &event);
+ virtual void dispatch();
+};
+
+class Scene1875 : public SceneExt {
+ class Actor1875 : public SceneActor {
+ public:
+ int _fieldA4;
+ int _fieldA6;
+
+ Actor1875();
+ void subB84AB();
+ void subB8271(int indx);
+
+ void synchronize(Serializer &s);
+ virtual void process(Event &event);
+ };
+public:
+ SpeakerQuinn _quinnSpeaker;
+ SpeakerSeeker _seekerSpeaker;
+ NamedHotspot _item1;
+ NamedHotspot _item2;
+ SceneActor _actor1;
+ SceneActor _actor2;
+ SceneActor _actor3;
+ Actor1875 _actor4;
+ Actor1875 _actor5;
+ Actor1875 _actor6;
+ Actor1875 _actor7;
+ Actor1875 _actor8;
+ SequenceManager _sequenceManager;
+
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void signal();
+ virtual void process(Event &event);
+};
+
+class Scene1900 : public SceneExt {
+ class Actor2 : public SceneActor {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ class Exit1 : public SceneExit {
+ public:
+ virtual void changeScene();
+ };
+ class Exit2 : public SceneExit {
+ public:
+ virtual void changeScene();
+ };
+public:
+ SpeakerSeeker1900 _seekerSpeaker;
+ NamedHotspot _item1;
+ NamedHotspot _item2;
+ SceneActor _actor1;
+ BackgroundSceneObject _object1;
+ BackgroundSceneObject _object2;
+ Actor2 _actor2;
+ Actor2 _actor3;
+ Exit1 _exit1;
+ Exit2 _exit2;
+ SequenceManager _sequenceManager1;
+ SequenceManager _sequenceManager2;
+
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void remove();
+ virtual void signal();
+};
+
+class Scene1925 : public SceneExt {
+ class Hotspot2 : public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Hotspot3 : public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ class ExitUp : public SceneExit {
+ public:
+ virtual void changeScene();
+ };
+ class Exit2 : public SceneExit {
+ public:
+ virtual void changeScene();
+ };
+ class Exit3 : public SceneExit {
+ public:
+ virtual void changeScene();
+ };
+ class Exit4 : public SceneExit {
+ public:
+ virtual void changeScene();
+ };
+public:
+ NamedHotspot _item1;
+ Hotspot2 _item2;
+ Hotspot3 _item3;
+ SceneActor _actor1;
+ ExitUp _exitUp;
+ Exit2 _exit2;
+ Exit3 _exit3;
+ Exit4 _exit4;
+ SequenceManager _sequenceManager;
+
+ int _field9B8;
+ int _levelResNum[5];
+
+ Scene1925();
+ void synchronize(Serializer &s);
+
+ void changeLevel(bool upFlag);
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void remove();
+ virtual void signal();
+};
+
+class Scene1945 : public SceneExt {
+ class Hotspot3 : public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Hotspot4 : public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ class Actor3 : public SceneActor {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ class ExitUp : public SceneExit {
+ public:
+ virtual void changeScene();
+ };
+ class Exit2 : public SceneExit {
+ public:
+ virtual void changeScene();
+ };
+public:
+ NamedHotspot _item1;
+ NamedHotspot _item2;
+ Hotspot3 _item3;
+ Hotspot4 _item4;
+ SceneActor _actor1;
+ SceneActor _actor2;
+ Actor3 _actor3;
+ ExitUp _exitUp;
+ Exit2 _exit2;
+ SequenceManager _sequenceManager1;
+ SequenceManager _sequenceManager2;
+
+ int _fieldEAA;
+ int _fieldEAC;
+ CursorType _fieldEAE;
+
+ Scene1945();
+ void synchronize(Serializer &s);
+
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void remove();
+ virtual void signal();
+};
+
+class Scene1950 : public SceneExt {
+ class Area1: public SceneArea {
+ public:
+ class Actor10 : public SceneActor {
+ public:
+ int _fieldA4;
+ int _fieldA6;
+ int _fieldA8;
+
+ Actor10();
+ void synchronize(Serializer &s);
+
+ void init(int indx);
+ virtual void process(Event &event);
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ SceneActor _areaActor;
+ Actor10 _arrActor1[16];
+
+ byte _field20;
+ int _fieldB65;
+
+ Area1();
+ void synchronize(Serializer &s);
+
+ virtual void remove();
+ virtual void process(Event &event);
+ virtual void proc12(int visage, int stripFrameNum, int frameNum, int posX, int posY);
+ virtual void proc13(int resNum, int lookLineNum, int talkLineNum, int useLineNum);
+ };
+
+ class Hotspot2 : public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ class Actor2 : public SceneActor {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Actor3 : public SceneActor {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Actor4 : public SceneActor {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Actor5 : public SceneActor {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Actor8 : public SceneActor {
+ public:
+ int _fieldA4;
+ int _fieldA6;
+ int _fieldA8;
+ int _fieldAA;
+ int _fieldAC;
+ byte _fieldAE;
+ byte _fieldAF;
+
+ Actor8();
+ void synchronize(Serializer &s);
+
+ virtual void signal();
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ class Exit1 : public SceneExit {
+ public:
+ virtual void changeScene();
+ };
+ class Exit2 : public SceneExit {
+ public:
+ virtual void changeScene();
+ };
+ class Exit3 : public SceneExit {
+ public:
+ virtual void changeScene();
+ };
+ class Exit4 : public SceneExit {
+ public:
+ virtual void changeScene();
+ };
+ class Exit5 : public SceneExit {
+ public:
+ virtual void changeScene();
+ };
+ class Exit6 : public SceneExit {
+ public:
+ virtual void changeScene();
+ };
+ class Exit7 : public SceneExit {
+ public:
+ virtual void changeScene();
+ };
+ class Exit8 : public SceneExit {
+ public:
+ virtual void changeScene();
+ };
+public:
+ NamedHotspot _item1;
+ Hotspot2 _item2;
+ SceneActor _actor1;
+ BackgroundSceneObject _object1;
+ Actor2 _actor2;
+ Actor3 _actor3;
+ SceneActor _actor4;
+ Actor5 _actor5;
+ SceneActor _actor6;
+ SceneActor _actor7;
+ Actor8 _actor8;
+ Area1 _area1;
+ Exit1 _exit1;
+ Exit2 _exit2;
+ Exit3 _exit3;
+ Exit4 _exit4;
+ Exit5 _exit5;
+ Exit6 _exit6;
+ Exit7 _exit7;
+ Exit8 _exit8;
+ SequenceManager _sequenceManager;
+
+ int _field412;
+ int _field414;
+ int _field416;
+ Common::Point _field418;
+ int _field41C;
+
+ Scene1950();
+ void synchronize(Serializer &s);
+
+ void subBDC1E();
+ void subBE59B();
+ void subBF4B4(int indx);
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void remove();
+ virtual void signal();
+ virtual void process(Event &event);
+};
} // End of namespace Ringworld2
} // End of namespace TsAGE
diff --git a/engines/tsage/ringworld2/ringworld2_scenes2.cpp b/engines/tsage/ringworld2/ringworld2_scenes2.cpp
index ef2d0526ae..5567519046 100644
--- a/engines/tsage/ringworld2/ringworld2_scenes2.cpp
+++ b/engines/tsage/ringworld2/ringworld2_scenes2.cpp
@@ -1035,7 +1035,7 @@ bool Scene2350::Actor2::startAction(CursorType action, Event &event) {
bool Scene2350::Actor3::startAction(CursorType action, Event &event) {
Scene2350 *scene = (Scene2350 *)R2_GLOBALS._sceneManager._scene;
- if ((action == R2_20) && (R2_GLOBALS.getFlag(74))) {
+ if ((action == R2_REBREATHER_TANK) && (R2_GLOBALS.getFlag(74))) {
R2_GLOBALS._player.disableControl();
scene->_actor1.postInit();
scene->_sceneMode = 2355;
@@ -1269,13 +1269,13 @@ void Scene2400::signal() {
bool Scene2425::Item1::startAction(CursorType action, Event &event) {
Scene2425 *scene = (Scene2425 *)R2_GLOBALS._sceneManager._scene;
- if ((action == R2_37) && (!R2_GLOBALS.getFlag(84))) {
+ if ((action == R2_GUNPOWDER) && (!R2_GLOBALS.getFlag(84))) {
R2_GLOBALS._player.disableControl();
scene->_sceneMode = 2426;
scene->setAction(&scene->_sequenceManager, scene, 2426, &R2_GLOBALS._player, &scene->_actor1, NULL);
R2_GLOBALS.setFlag(84);
return true;
- } else if (action == R2_37) {
+ } else if (action == R2_GUNPOWDER) {
R2_GLOBALS._events.setCursor(R2_STEPPING_DISKS);
R2_GLOBALS._player.enableControl(R2_STEPPING_DISKS);
return NamedHotspot::startAction(R2_STEPPING_DISKS, event);
@@ -1286,13 +1286,13 @@ bool Scene2425::Item1::startAction(CursorType action, Event &event) {
bool Scene2425::Item2::startAction(CursorType action, Event &event) {
Scene2425 *scene = (Scene2425 *)R2_GLOBALS._sceneManager._scene;
- if ((action == R2_37) && (R2_GLOBALS.getFlag(84))) {
+ if ((action == R2_GUNPOWDER) && (R2_GLOBALS.getFlag(84))) {
R2_GLOBALS._player.disableControl();
scene->_sceneMode = 2427;
scene->setAction(&scene->_sequenceManager, scene, 2427, &R2_GLOBALS._player, &scene->_actor1, NULL);
R2_GLOBALS.clearFlag(84);
return true;
- } else if (action == R2_37) {
+ } else if (action == R2_GUNPOWDER) {
R2_GLOBALS._events.setCursor(R2_STEPPING_DISKS);
R2_GLOBALS._player.enableControl(R2_STEPPING_DISKS);
return NamedHotspot::startAction(R2_STEPPING_DISKS, event);
@@ -1303,7 +1303,7 @@ bool Scene2425::Item2::startAction(CursorType action, Event &event) {
bool Scene2425::Item3::startAction(CursorType action, Event &event) {
Scene2425 *scene = (Scene2425 *)R2_GLOBALS._sceneManager._scene;
- if (action != R2_37)
+ if (action != R2_GUNPOWDER)
return NamedHotspot::startAction(action, event);
else {
R2_GLOBALS._player.disableControl();
@@ -1320,7 +1320,7 @@ bool Scene2425::Item3::startAction(CursorType action, Event &event) {
}
bool Scene2425::Item4::startAction(CursorType action, Event &event) {
- if (action != R2_37)
+ if (action != R2_GUNPOWDER)
return NamedHotspot::startAction(action, event);
else {
R2_GLOBALS._events.setCursor(R2_STEPPING_DISKS);
@@ -1332,19 +1332,19 @@ bool Scene2425::Item4::startAction(CursorType action, Event &event) {
bool Scene2425::Actor1::startAction(CursorType action, Event &event) {
if (action == R2_STEPPING_DISKS) {
if (R2_GLOBALS._player._characterIndex == 2) {
- R2_GLOBALS._events.setCursor(R2_37);
+ R2_GLOBALS._events.setCursor(R2_GUNPOWDER);
return true;
} else {
return SceneActor::startAction(action, event);
}
- } else if (R2_GLOBALS._events.getCursor() == R2_37)
+ } else if (R2_GLOBALS._events.getCursor() == R2_GUNPOWDER)
return false;
else
return SceneActor::startAction(action, event);
}
bool Scene2425::Actor2::startAction(CursorType action, Event &event) {
- if (action != R2_37)
+ if (action != R2_GUNPOWDER)
return SceneActor::startAction(action, event);
else {
R2_GLOBALS._events.setCursor(R2_STEPPING_DISKS);
@@ -1601,12 +1601,12 @@ void Scene2430::signal() {
break;
case 2430:
_actor2.remove();
- R2_INVENTORY.setObjectScene(R2_37, 2);
+ R2_INVENTORY.setObjectScene(R2_GUNPOWDER, 2);
R2_GLOBALS._player.enableControl();
break;
case 2435:
_actor3.remove();
- R2_INVENTORY.setObjectScene(R2_50, 2);
+ R2_INVENTORY.setObjectScene(R2_ALCOHOL_LAMP_3, 2);
R2_GLOBALS._player.enableControl();
break;
default:
@@ -1627,18 +1627,18 @@ bool Scene2435::Actor2::startAction(CursorType action, Event &event) {
Scene2435 *scene = (Scene2435 *)R2_GLOBALS._sceneManager._scene;
switch (action) {
- case R2_34:
+ case R2_SAPPHIRE_BLUE:
R2_GLOBALS._player.disableControl();
R2_GLOBALS._events.setCursor(CURSOR_ARROW);
R2_GLOBALS.setFlag(82);
scene->_stripManager.start(603, scene);
return true;
- case R2_35:
+ case R2_ANCIENT_SCROLLS:
R2_GLOBALS._player.disableControl();
R2_GLOBALS._events.setCursor(CURSOR_ARROW);
R2_GLOBALS.setFlag(82);
scene->_stripManager.start(602, scene);
- R2_INVENTORY.setObjectScene(R2_35, 2000);
+ R2_INVENTORY.setObjectScene(R2_ANCIENT_SCROLLS, 2000);
return true;
case CURSOR_TALK:
R2_GLOBALS._player.disableControl();
@@ -1647,7 +1647,7 @@ bool Scene2435::Actor2::startAction(CursorType action, Event &event) {
if ((R2_GLOBALS._player._characterIndex == 1) || (R2_GLOBALS.getFlag(82))) {
scene->_stripManager.start(605, scene);
return true;
- } else if (R2_INVENTORY.getObjectScene(R2_35) == 2) {
+ } else if (R2_INVENTORY.getObjectScene(R2_ANCIENT_SCROLLS) == 2) {
scene->_stripManager.start(601, scene);
return true;
} else {
@@ -2204,7 +2204,7 @@ void Scene2450::signal() {
bool Scene2455::Actor1::startAction(CursorType action, Event &event) {
Scene2455 *scene = (Scene2455 *)R2_GLOBALS._sceneManager._scene;
- if (action == R2_29) {
+ if (action == R2_GLASS_DOME) {
if ((R2_INVENTORY.getObjectScene(49) == 2455) || (R2_INVENTORY.getObjectScene(50) == 2455)) {
R2_GLOBALS._player.disableControl();
scene->_sceneMode = 2458;
@@ -2224,7 +2224,7 @@ bool Scene2455::Actor2::startAction(CursorType action, Event &event) {
Scene2455 *scene = (Scene2455 *)R2_GLOBALS._sceneManager._scene;
switch (action) {
- case R2_49:
+ case R2_ALCOHOL_LAMP_2:
if (R2_INVENTORY.getObjectScene(50) != 2455) {
R2_GLOBALS._player.disableControl();
scene->_actor1.postInit();
@@ -2236,7 +2236,7 @@ bool Scene2455::Actor2::startAction(CursorType action, Event &event) {
return true;
}
break;
- case R2_50:
+ case R2_ALCOHOL_LAMP_3:
if (R2_INVENTORY.getObjectScene(49) != 2455) {
R2_GLOBALS._player.disableControl();
scene->_actor1.postInit();
@@ -2399,7 +2399,7 @@ void Scene2500::postInit(SceneObjectList *OwnerList) {
SceneExt::postInit();
if (R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] == 3100)
- R2_GLOBALS._v58CE2 = 0;
+ R2_GLOBALS._uiElements._active = false;
_stripManager.addSpeaker(&_quinnSpeaker);
_stripManager.addSpeaker(&_seekerSpeaker);
@@ -2488,7 +2488,7 @@ void Scene2500::signal() {
bool Scene2525::Item5::startAction(CursorType action, Event &event) {
Scene2525 *scene = (Scene2525 *)R2_GLOBALS._sceneManager._scene;
- if ((action == R2_20) && (!R2_GLOBALS.getFlag(74))) {
+ if ((action == R2_REBREATHER_TANK) && (!R2_GLOBALS.getFlag(74))) {
R2_GLOBALS._player.disableControl();
scene->_sceneMode = 2526;
scene->setAction(&scene->_sequenceManager, scene, 2526, &R2_GLOBALS._player, NULL);
@@ -2978,7 +2978,7 @@ void Scene2600::synchronize(Serializer &s) {
void Scene2600::postInit(SceneObjectList *OwnerList) {
loadScene(2600);
- R2_GLOBALS._v58CE2 = 0;
+ R2_GLOBALS._uiElements._active = false;
SceneExt::postInit();
R2_GLOBALS._sound1.fadeSound(214);
R2_GLOBALS._sound2.play(215);
@@ -3513,7 +3513,7 @@ void Scene2700::signal() {
}
void Scene2700::process(Event &event) {
if ((R2_GLOBALS._player._canWalk) && (event.eventType == EVENT_BUTTON_DOWN)) {
- if (R2_GLOBALS._events.getCursor() == R2_36) {
+ if (R2_GLOBALS._events.getCursor() == R2_FLUTE) {
if (R2_GLOBALS._player._bounds.contains(event.mousePos)) {
_sceneMode = 10;
_field414 = 2710;
@@ -4177,7 +4177,7 @@ bool Scene2800::Actor1::startAction(CursorType action, Event &event) {
scene->_sceneMode = 2803;
scene->_stripManager.start(scene->_field412, scene);
return true;
- } else if (action == R2_7) {
+ } else if (action == R2_SONIC_STUNNER) {
R2_GLOBALS._events.setCursor(CURSOR_ARROW);
R2_GLOBALS._player.disableControl();
R2_GLOBALS.setFlag(47);
diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.cpp b/engines/tsage/ringworld2/ringworld2_scenes3.cpp
index 5ae15d9c08..2b97cba8e9 100644
--- a/engines/tsage/ringworld2/ringworld2_scenes3.cpp
+++ b/engines/tsage/ringworld2/ringworld2_scenes3.cpp
@@ -60,7 +60,7 @@ void Scene3100::postInit(SceneObjectList *OwnerList) {
if (R2_GLOBALS._sceneManager._previousScene == 1000) {
if (R2_GLOBALS._player._oldCharacterScene[1] == 3100) {
loadScene(3101);
- R2_GLOBALS._v58CE2 = 0;
+ R2_GLOBALS._uiElements._active = false;
} else {
loadScene(3100);
g_globals->gfxManager()._bounds.moveTo(Common::Point(160, 0));
@@ -71,7 +71,7 @@ void Scene3100::postInit(SceneObjectList *OwnerList) {
// Original was doing it twice in a row. Skipped.
if (R2_GLOBALS._sceneManager._previousScene == 3255)
- R2_GLOBALS._v58CE2 = 0;
+ R2_GLOBALS._uiElements._active = false;
SceneExt::postInit();
_stripManager.addSpeaker(&_guardSpeaker);
@@ -385,7 +385,7 @@ bool Scene3150::Item5::startAction(CursorType action, Event &event) {
scene->_sceneMode = 3154;
scene->setAction(&scene->_sequenceManager, scene, 3154, &R2_GLOBALS._player, &scene->_actor3, NULL);
return true;
- case R2_40:
+ case R2_SUPERCONDUCTOR_WIRE:
if ((R2_INVENTORY.getObjectScene(47) != 3150) && (R2_GLOBALS.getFlag(75))) {
R2_GLOBALS._player.disableControl();
scene->_actor3.postInit();
@@ -407,7 +407,7 @@ bool Scene3150::Item6::startAction(CursorType action, Event &event) {
Scene3150 *scene = (Scene3150 *)R2_GLOBALS._sceneManager._scene;
switch (action) {
- case R2_41:
+ case R2_PILLOW:
R2_GLOBALS._player.disableControl();
scene->_actor4.postInit();
scene->_actor4._effect = 6;
@@ -416,7 +416,7 @@ bool Scene3150::Item6::startAction(CursorType action, Event &event) {
scene->_sceneMode = 3158;
scene->setAction(&scene->_sequenceManager, scene, 3158, &R2_GLOBALS._player, &scene->_actor4, NULL);
return true;
- case R2_42:
+ case R2_FOOD_TRAY:
if ((R2_INVENTORY.getObjectScene(47) != 3150) && (R2_INVENTORY.getObjectScene(40) == 3150) && (R2_GLOBALS.getFlag(75))) {
scene->_actor5.postInit();
scene->_actor5._effect = 6;
@@ -447,7 +447,7 @@ bool Scene3150::Actor4::startAction(CursorType action, Event &event) {
scene->_sceneMode = 3151;
scene->setAction(&scene->_sequenceManager, scene, 3151, &R2_GLOBALS._player, &scene->_actor4, NULL);
return true;
- case R2_42:
+ case R2_FOOD_TRAY:
return false;
default:
return SceneActor::startAction(action, event);
@@ -498,7 +498,7 @@ bool Scene3150::Actor6::startAction(CursorType action, Event &event) {
bool Scene3150::Actor7::startAction(CursorType action, Event &event) {
Scene3150 *scene = (Scene3150 *)R2_GLOBALS._sceneManager._scene;
- if ((action == R2_43) && (!R2_GLOBALS.getFlag(80))) {
+ if ((action == R2_LASER_HACKSAW) && (!R2_GLOBALS.getFlag(80))) {
R2_GLOBALS._player.disableControl();
scene->_sceneMode = 3160;
scene->setAction(&scene->_sequenceManager, scene, 3160, &R2_GLOBALS._player, &scene->_actor7, NULL);
@@ -927,7 +927,7 @@ void Scene3175::signal() {
*--------------------------------------------------------------------------*/
void Scene3200::postInit(SceneObjectList *OwnerList) {
loadScene(3200);
- R2_GLOBALS._v58CE2 = 0;
+ R2_GLOBALS._uiElements._active = false;
SceneExt::postInit();
_stripManager.addSpeaker(&_rockoSpeaker);
@@ -955,7 +955,7 @@ void Scene3200::signal() {
*--------------------------------------------------------------------------*/
void Scene3210::postInit(SceneObjectList *OwnerList) {
loadScene(3210);
- R2_GLOBALS._v58CE2 = 0;
+ R2_GLOBALS._uiElements._active = false;
SceneExt::postInit();
_stripManager.addSpeaker(&_privateSpeaker);
@@ -981,7 +981,7 @@ void Scene3210::signal() {
*--------------------------------------------------------------------------*/
void Scene3220::postInit(SceneObjectList *OwnerList) {
loadScene(3220);
- R2_GLOBALS._v58CE2 = 0;
+ R2_GLOBALS._uiElements._active = false;
SceneExt::postInit();
_stripManager.addSpeaker(&_rockoSpeaker);
@@ -1007,7 +1007,7 @@ void Scene3220::signal() {
*--------------------------------------------------------------------------*/
void Scene3230::postInit(SceneObjectList *OwnerList) {
loadScene(3230);
- R2_GLOBALS._v58CE2 = 0;
+ R2_GLOBALS._uiElements._active = false;
SceneExt::postInit();
_stripManager.addSpeaker(&_rockoSpeaker);
@@ -1034,7 +1034,7 @@ void Scene3230::signal() {
*--------------------------------------------------------------------------*/
void Scene3240::postInit(SceneObjectList *OwnerList) {
loadScene(3240);
- R2_GLOBALS._v58CE2 = 0;
+ R2_GLOBALS._uiElements._active = false;
SceneExt::postInit();
_stripManager.addSpeaker(&_tealSpeaker);
@@ -1061,7 +1061,7 @@ void Scene3240::signal() {
*--------------------------------------------------------------------------*/
void Scene3245::postInit(SceneObjectList *OwnerList) {
loadScene(3245);
- R2_GLOBALS._v58CE2 = 0;
+ R2_GLOBALS._uiElements._active = false;
SceneExt::postInit();
_stripManager.addSpeaker(&_ralfSpeaker);
@@ -1641,7 +1641,7 @@ void Scene3275::signal() {
*--------------------------------------------------------------------------*/
void Scene3350::postInit(SceneObjectList *OwnerList) {
loadScene(3350);
- R2_GLOBALS._v58CE2 = 0;
+ R2_GLOBALS._uiElements._active = false;
SceneExt::postInit();
R2_GLOBALS._sound2.play(310);
@@ -2885,6 +2885,1300 @@ void Scene3400::signal() {
}
/*--------------------------------------------------------------------------
+ * Scene 3500 -
+ *
+ *--------------------------------------------------------------------------*/
+Scene3500::Action1::Action1() {
+ _field1E = 0;
+ _field20 = 0;
+ _field22 = 0;
+ _field24 = 0;
+}
+
+void Scene3500::Action1::synchronize(Serializer &s) {
+ Action::synchronize(s);
+
+ s.syncAsSint16LE(_field1E);
+ s.syncAsSint16LE(_field20);
+ s.syncAsSint16LE(_field22);
+ s.syncAsSint16LE(_field24);
+}
+
+void Scene3500::Action1::sub108670(int arg1) {
+ Scene3500 *scene = (Scene3500 *)R2_GLOBALS._sceneManager._scene;
+
+ _field1E = arg1;
+ _field20 = 1;
+ _field24 = 1;
+
+ scene->_actor9.setStrip(2);
+ scene->_actor9.show();
+
+ if (_field1E == 1)
+ scene->_actor6.show();
+ else
+ scene->_actor5.show();
+
+ if (scene->_actor1._frame % 2 == 0)
+ scene->_actor1._frameChange = _field1E;
+ scene->_actor1.setFrame(scene->_actor1.changeFrame());
+
+ setActionIndex(0);
+}
+
+void Scene3500::Action1::sub108732(int arg1) {
+ Scene3500 *scene = (Scene3500 *)R2_GLOBALS._sceneManager._scene;
+
+ _field20 = arg1;
+ _field1E = -_field1E;
+
+ if (_field1E == 1) {
+ scene->_actor6.show();
+ scene->_actor5.hide();
+ } else {
+ scene->_actor5.show();
+ scene->_actor6.hide();
+ }
+
+ switch (_actionIndex) {
+ case 4:
+ scene->_actor1._frameChange = _field1E;
+ scene->_actor1.setFrame(scene->_actor1.changeFrame());
+ // No break on purpose
+ case 3:
+ _actionIndex = 10;
+ setDelay(0);
+ break;
+ case 5: {
+ scene->_fieldAF8 = 160;
+ Common::Point pt(160, 73);
+ NpcMover *mover = new NpcMover();
+ scene->_actor8.addMover(mover, &pt, NULL);
+
+ scene->_fieldB9E = 160 - (_field1E * 2 * 160);
+ Common::Point pt2(scene->_fieldB9E, 73);
+ NpcMover *mover2 = new NpcMover();
+ scene->_actor9.addMover(mover2, &pt2, this);
+
+ _actionIndex = 11;
+ }
+ break;
+ case 6:
+ scene->_actor1._frameChange = _field1E;
+ scene->_actor1.setFrame(scene->_actor1.changeFrame());
+ setDelay(1);
+ // No break on purpose
+ case 8:
+ scene->_actor9.setStrip(2);
+ _actionIndex = 1;
+ break;
+ default:
+ break;
+ }
+}
+
+Scene3500::Action2::Action2() {
+ _field1E = 0;
+}
+
+void Scene3500::Action2::synchronize(Serializer &s) {
+ Action::synchronize(s);
+
+ s.syncAsSint16LE(_field1E);
+}
+
+Scene3500::Item4::Item4() {
+ _field34 = 0;
+}
+
+void Scene3500::Item4::synchronize(Serializer &s) {
+ NamedHotspot::synchronize(s);
+
+ s.syncAsSint16LE(_field34);
+}
+
+Scene3500::Actor7::Actor7() {
+ _fieldA4 = 0;
+ _fieldA6 = 0;
+ _fieldA8 = 0;
+ _fieldAA = 0;
+ _fieldAC = 0;
+ _fieldAE = 0;
+}
+
+void Scene3500::Actor7::synchronize(Serializer &s) {
+ SceneActor::synchronize(s);
+
+ s.syncAsSint16LE(_fieldA4);
+ s.syncAsSint16LE(_fieldA6);
+ s.syncAsSint16LE(_fieldA8);
+ s.syncAsSint16LE(_fieldAA);
+ s.syncAsSint16LE(_fieldAC);
+ s.syncAsSint16LE(_fieldAE);
+}
+
+void Scene3500::Actor7::sub109466(int arg1, int arg2, int arg3, int arg4, int arg5) {
+ _fieldAE = 0;
+ _fieldA4 = arg1;
+ _fieldA6 = arg2;
+ _fieldA8 = arg3;
+ _fieldAA = arg4;
+ _fieldAC = _fieldAA / _fieldA8;
+
+ postInit();
+ setup(10501, 3, 1);
+ fixPriority(255);
+ sub109663(arg5);
+}
+
+void Scene3500::Actor7::sub1094ED() {
+ Scene3500 *scene = (Scene3500 *)R2_GLOBALS._sceneManager._scene;
+
+ scene->_field1270 = _position.x - _fieldA4;
+}
+
+void Scene3500::Actor7::sub109663(int arg1){
+ sub109693(Common::Point(_fieldA4 + arg1, _fieldA6 - (_fieldAC * arg1)));
+}
+
+void Scene3500::Actor7::sub109693(Common::Point Pt) {
+ setPosition(Pt);
+}
+
+int Scene3500::UnkObject3500::sub1097C9(int arg1) {
+ return (_field2A / 2) + arg1 - (arg1 % _field2A);
+}
+
+int Scene3500::UnkObject3500::sub1097EF(int arg1) {
+ return (_field2C / 2) + arg1 - (arg1 % _field2C);
+}
+
+int Scene3500::UnkObject3500::sub109C09(Common::Point pt) {
+ int vx = pt.x / _field2A;
+ int vy = pt.y / _field2C;
+
+ if ((vx >= 0) && (_field26 > vx) && (_field28 > vy)) {
+ return _field16[((_field26 * vy) + vx) * 2];
+ } else
+ return -1;
+}
+
+int Scene3500::UnkObject3500::sub109C5E(int &x, int &y) {
+ int retVal = sub51AFD(Common::Point(x, y));
+ x = _field2E;
+ y = _field30;
+
+ return retVal;
+}
+
+Scene3500::Scene3500() {
+ _fieldAF8 = 0;
+ _fieldB9E = 0;
+ _rotation = NULL;
+ _field126E = 0;
+ _field1270 = 0;
+ _field1272 = 0;
+ _field1274 = 0;
+ _field1276 = 0;
+ _field1278 = 0;
+ _field127A = 0;
+ _field127C = 0;
+ _field127E = 0;
+ _field1280 = 0;
+ _field1282 = 0;
+ _field1284 = 0;
+ _field1286 = 0;
+}
+
+void Scene3500::synchronize(Serializer &s) {
+ SceneExt::synchronize(s);
+ SYNC_POINTER(_rotation);
+
+ s.syncAsSint16LE(_fieldAF8);
+ s.syncAsSint16LE(_fieldB9E);
+ s.syncAsSint16LE(_field126E);
+ s.syncAsSint16LE(_field1270);
+ s.syncAsSint16LE(_field1272);
+ s.syncAsSint16LE(_field1274);
+ s.syncAsSint16LE(_field1276);
+ s.syncAsSint16LE(_field1278);
+ s.syncAsSint16LE(_field127A);
+ s.syncAsSint16LE(_field127C);
+ s.syncAsSint16LE(_field127E);
+ s.syncAsSint16LE(_field1280);
+ s.syncAsSint16LE(_field1282);
+ s.syncAsSint16LE(_field1284);
+ s.syncAsSint16LE(_field1286);
+}
+
+void Scene3500::sub107F71(int arg1) {
+ switch (arg1) {
+ case -1:
+ _actor7.sub1094ED();
+ if (_field1270 != 0) {
+ _field1270--;
+ _actor7.sub109663(_field1270);
+ }
+ if (_action1._field24 != 0)
+ _field1270 = 0;
+ break;
+ case 1:
+ _actor7.sub1094ED();
+ if (_field1270 < 16) {
+ ++_field1270;
+ _actor7.sub109663(_field1270);
+ }
+ if (_action1._field24 != 0)
+ _field1270 = 0;
+ break;
+ case 88:
+ if ((_action == 0) || (_action1._field24 == 0)) {
+ // The original makes a second useless check on action, skipped
+ _action2.sub10831F(2);
+ if ((_action) && ((_action2.getActionIndex() != 0) || (_action2._field1E != 2))) {
+ _action2.signal();
+ } else {
+ _actor9.setAction(&_action2, &_actor9, NULL);
+ }
+ }
+ break;
+ case 96:
+ if ((_action) && (_action1._field24 != 0) && (_action2._field1E != 1)) {
+ _field1278 = 0;
+ _action1.sub108732(0);
+ } else if ((_action) && (_field1278 == 0) && (_action1._field24 != 0)) {
+ _field1278 = arg1;
+ } else if ((_action) && (_action1._field24 == 0)) {
+ _action1.sub108670(1);
+ _action1.signal();
+ } else if (_action == 0) {
+ _action1.sub108670(1);
+ setAction(&_action1, &_actor1, NULL);
+ }
+ break;
+ case 104:
+ if ((_action == 0) || (_action1._field24 == 0)) {
+ _action2.sub10831F(-1);
+ if ((_action) && ((_action2.getActionIndex() != 0) || (_action2._field1E != -1))) {
+ _action2.signal();
+ } else {
+ _actor9.setAction(&_action2, &_actor9, NULL);
+ }
+ }
+ break;
+ case 112:
+ if ((_action) && (_action1._field24 != 0) && (_action2._field1E != -1)) {
+ _field1278 = 0;
+ _action1.sub108732(0);
+ } else if ((_action) && (_field1278 == 0) && (_action1._field24 != 0)) {
+ _field1278 = arg1;
+ } else if ((_action) && (_action1._field24 == 0)) {
+ _action1.sub108670(-1);
+ _action1.signal();
+ } else if (_action == 0) {
+ _action1.sub108670(-1);
+ setAction(&_action1, &_actor1, NULL);
+ }
+ break;
+ default:
+ _field1270 = arg1;
+ _actor7.sub109663(arg1);
+ if (_action1._field24 != 0) {
+ _field1270 = 0;
+ }
+ break;
+ }
+}
+
+void Scene3500::Action1::signal() {
+ Scene3500 *scene = (Scene3500 *)R2_GLOBALS._sceneManager._scene;
+
+ switch(_actionIndex++) {
+ case 0:
+ R2_GLOBALS._player.disableControl();
+ scene->_field1286 = 0;
+ if (scene->_field1270 != 0) {
+ scene->_field1270 = 0;
+ scene->_field126E = 0;
+ scene->_field1272 = 0;
+ scene->_rotation->_idxChange = 0;
+ }
+ break;
+ case 1:
+ if ((scene->_actor1._frame % 2) == 0) {
+ setDelay(1);
+ return;
+ }
+ // No break on purpose
+ case 3:
+ scene->_actor1._frameChange = _field1E;
+ scene->_actor1.setFrame(scene->_actor1.changeFrame());
+ setDelay(1);
+ break;
+ case 4: {
+ int si = scene->_unkObj1.sub109C09(Common::Point(scene->_field127A + 70, scene->_field127C + 46));
+ int var2 = scene->_unkObj1.sub1097C9(scene->_field127A + 70) - 70;
+ int var4 = scene->_unkObj1.sub1097EF(scene->_field127C + 46) - 46;
+ int di = abs(var2 - scene->_field127A);
+ int var6 = abs(var4 - scene->_field127C);
+
+ if ((scene->_actor1._frame % 2) != 0) {
+ scene->_actor1._frameChange = _field1E;
+ scene->_actor1.setFrame(scene->_actor1.changeFrame());
+ }
+
+ int var8 = (scene->_action1._field1E * 2 + scene->_field1276);
+ if (var8 > 7)
+ var8 = 1;
+ else if (var8 < 1)
+ var8 = 7;
+
+ switch (var8) {
+ case 0:
+ if ( ((si != 2) && (si != 3) && (si != 6) && (si != 1) && (si != 23) && (si != 24) && (si != 4) && (si != 11))
+ || (var6 != 0)) {
+ if ((si != 25) && (si != 26) && (si != 5) && (si != 14) && (si != 15))
+ _field20 = 0;
+ else if ((var6 != 0) || (di <= 3)) // useless, skipped: "|| (di == 0)"
+ _field20 = 0;
+ else
+ _field20 = 1;
+ } else
+ _field20 = 1;
+ break;
+ case 2:
+ if ( ((si != 12) && (si != 13) && (si != 11) && (si != 16) && (si != 26) && (si != 24) && (si != 15) && (si != 6) && (si != 31))
+ || (di != 0)) {
+ if ((si != 25) && (si != 23) && (si != 14) && (si != 5) && (si != 4))
+ _field20 = 0;
+ else if ((di != 0) || (var6 <= 3)) // useless, skipped: "|| (var6 == 0)"
+ _field20 = 0;
+ else
+ _field20 = 1;
+ } else
+ _field20 = 1;
+ break;
+ case 4:
+ if ( ((si != 2) && (si != 3) && (si != 6) && (si != 1) && (si != 25) && (si != 26) && (si != 5) && (si != 16) && (si != 31))
+ || (var6 != 0)) {
+ if ((si != 23) && (si != 24) && (si != 4) && (si != 14) && (si != 15))
+ _field20 = 0;
+ else if ((var6 != 0) || (di <= 3)) // useless, skipped: "|| (di == 0)"
+ _field20 = 0;
+ else
+ _field20 = 1;
+ } else
+ _field20 = 1;
+ break;
+ case 6:
+ if ( ((si != 12) && (si != 13) && (si != 11) && (si != 16) && (si != 25) && (si != 23) && (si != 14) && (si != 1) && (si != 31))
+ || (var6 != 0)) {
+ if ((si != 26) && (si != 24) && (si != 15) && (si != 5) && (si != 4))
+ _field20 = 0;
+ else if ((var6 <= 0) || (di != 0)) // useless, skipped: "|| (var6 == 0)"
+ _field20 = 0;
+ else
+ _field20 = 1;
+ } else
+ _field20 = 1;
+ default:
+ break;
+ }
+ }
+ // No break on purpose
+ case 2: {
+ scene->_actor8.setPosition(Common::Point(160, 73));
+ scene->_actor8._moveDiff.x = 160 - scene->_field126E;
+ scene->_fieldAF8 = 160 - ((_field1E * 2) * 160);
+ Common::Point pt(scene->_fieldAF8, 73);
+ NpcMover *mover = new NpcMover();
+ scene->_actor8.addMover(mover, &pt, this);
+
+ scene->_actor9.setPosition(Common::Point(160 + ((_field1E * 2) * 160), 73));;
+ scene->_actor9._moveDiff.x = 160 - scene->_field126E;
+ scene->_fieldB9E = 160;
+ Common::Point pt2(scene->_fieldB9E, 73);
+ NpcMover *mover2 = new NpcMover();
+ scene->_actor9.addMover(mover2, &pt2, NULL);
+ }
+ break;
+ case 5:
+ scene->_actor1._frameChange = _field1E;
+ scene->_field1276 = scene->_actor1.changeFrame();
+ scene->_actor1.setFrame(scene->_field1276);
+ setDelay(1);
+ break;
+ case 6:
+ scene->_actor8.setPosition(Common::Point(160, 73));
+ if (_field20 == 0)
+ scene->_actor8.setStrip(1);
+ else
+ scene->_actor8.setStrip(2);
+ scene->_actor8.fixPriority(1);
+
+ scene->_actor9.setPosition(Common::Point(-160, 73));
+ scene->_actor9.setStrip(9);
+ scene->_actor9.fixPriority(11);
+ scene->_actor9.hide();
+ setDelay(1);
+ break;
+ case 7:
+ if ((scene->_actor1._frame % 2) == 0) {
+ scene->_actor1._frameChange = _field1E;
+ scene->_field1276 = scene->_actor1.changeFrame();
+ scene->_actor1.setFrame(scene->_field1276);
+ }
+ setDelay(1);
+ break;
+ case 8: {
+ R2_GLOBALS._player.enableControl();
+ R2_GLOBALS._player._canWalk = false;
+ scene->_field1286 = 1;
+ if ((scene->_actor1._frame % 2) == 0) {
+ scene->_actor1._frameChange = _field1E;
+ scene->_actor1.setFrame(scene->_actor1.changeFrame());
+ }
+ // All the var_8 initialization was missing in the original
+ // but it's clearly a cut and paste error from case 4.
+ // The following code allows the switch to work properly.
+ warning("Checkme: fix for dead code");
+ int var_8 = (_field1E * 2 + scene->_field1276);
+ if (var_8 > 7)
+ var_8 = 1;
+ else if (var_8 < 1)
+ var_8 = 7;
+ //
+
+ switch (var_8 - 1) {
+ case 0:
+ // No break on purpose
+ case 4:
+ scene->_field127A = scene->_unkObj1.sub1097C9(scene->_field127A + 70) - 70;
+ break;
+ case 2:
+ // No break on purpose
+ case 6:
+ scene->_field127C = scene->_unkObj1.sub1097EF(scene->_field127C + 46) - 46;
+ break;
+ default:
+ break;
+ }
+ scene->_actor5.hide();
+ scene->_actor6.hide();
+ _field24 = 0;
+ if (_field20 == 0) {
+ scene->_actor7.sub1094ED();
+ if (scene->_field126E == scene->_field1270)
+ scene->_aSound1.play(276);
+ }
+ break;
+ }
+ case 10: {
+ scene->_fieldAF8 = 160;
+ Common::Point pt(160, 73);
+ NpcMover *mover = new NpcMover();
+ scene->_actor8.addMover(mover, &pt, NULL);
+
+ scene->_fieldB9E = 160 - (_field1E * 2 * 160);
+ Common::Point pt2(scene->_fieldB9E, 73);
+ NpcMover *mover2 = new NpcMover();
+ scene->_actor9.addMover(mover2, &pt2, this);
+ _actionIndex = 6;
+ }
+ break;
+ case 11: {
+ scene->_actor8.setStrip(2);
+ scene->_actor8.setPosition(Common::Point(160, 73));
+ scene->_fieldAF8 = 160 - (_field1E * 2 * 160);
+ Common::Point pt(scene->_fieldAF8, 73);
+ NpcMover *mover = new NpcMover();
+ scene->_actor8.addMover(mover, &pt, NULL);
+ scene->_actor8.fixPriority(11);
+ if (_field20 == 0)
+ scene->_actor9.setStrip(1);
+ else
+ scene->_actor9.setStrip(2);
+ scene->_actor9.setPosition(Common::Point(160 - (_field1E * 2 * 160), 73));
+ scene->_fieldB9E = 160;
+ Common::Point pt2(scene->_fieldB9E, 73);
+ NpcMover *mover2 = new NpcMover();
+ scene->_actor9.addMover(mover2, &pt2, this);
+ scene->_actor9.fixPriority(1);
+ _actionIndex = 5;
+ }
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene3500::Action1::dispatch() {
+ Scene3500 *scene = (Scene3500 *)R2_GLOBALS._sceneManager._scene;
+
+ Action::dispatch();
+ if ((_actionIndex == 1) && (scene->_field126E <= 4)) {
+ scene->_rotation->_idxChange = 0;
+ signal();
+ }
+}
+
+void Scene3500::Action2::sub10831F(int arg1) {
+ Scene3500 *scene = (Scene3500 *)R2_GLOBALS._sceneManager._scene;
+
+ _field1E = arg1;
+ if (_field1E == -1)
+ scene->_actor3.setFrame2(3);
+ else
+ scene->_actor3.setFrame2(1);
+
+ setActionIndex(0);
+}
+
+void Scene3500::Action2::signal() {
+ Scene3500 *scene = (Scene3500 *)R2_GLOBALS._sceneManager._scene;
+
+ int si;
+ int di;
+
+ switch (_actionIndex++) {
+ case 0: {
+ if (scene->_actor8._mover) {
+ si = scene->_fieldAF8;
+ di = scene->_fieldB9E;
+ } else {
+ scene->_fieldAF8 = scene->_actor8._position.x;
+ si = scene->_fieldAF8;
+ scene->_fieldB9E = scene->_actor9._position.y;
+ di = scene->_fieldB9E;
+ }
+
+ scene->_actor8._moveDiff.y = 9 - (scene->_field126E / 2);
+ Common::Point pt(si, 73 - (_field1E * 12));
+ NpcMover *mover = new NpcMover();
+ scene->_actor8.addMover(mover, &pt, NULL);
+
+ scene->_actor9._moveDiff.y = 9 - (scene->_field126E / 2);
+ Common::Point pt2(di, 73 - (_field1E * 12));
+ NpcMover *mover2 = new NpcMover();
+ scene->_actor9.addMover(mover2, &pt2, NULL);
+ scene->_field126E = (scene->_field126E / 2) + (scene->_field126E % 2);
+ setDelay(17 - scene->_field126E);
+ }
+ break;
+ case 1: {
+ R2_GLOBALS._sound2.play(339);
+ if (scene->_actor8._mover) {
+ si = scene->_fieldAF8;
+ di = scene->_fieldB9E;
+ } else {
+ si = scene->_actor8._position.x;
+ di = scene->_actor9._position.x;
+ }
+
+ scene->_actor7.sub1094ED();
+
+ scene->_actor8._moveDiff.y = 9 - (scene->_field126E / 2);
+ Common::Point pt(si, 73);
+ NpcMover *mover = new NpcMover();
+ scene->_actor8.addMover(mover, &pt, NULL);
+
+ scene->_actor9._moveDiff.y = 9 - (scene->_field126E / 2);
+ Common::Point pt2(di, 73);
+ NpcMover *mover2 = new NpcMover();
+ scene->_actor9.addMover(mover2, &pt2, NULL);
+
+ scene->_actor3.setFrame2(2);
+ }
+ break;
+ default:
+ break;
+ }
+}
+
+bool Scene3500::Item4::startAction(CursorType action, Event &event) {
+ Scene3500 *scene = (Scene3500 *)R2_GLOBALS._sceneManager._scene;
+
+ if (scene->_field1286 == 0)
+ return true;
+
+ if (scene->_field1286 != 4)
+ return SceneHotspot::startAction(action, event);
+
+ R2_GLOBALS._sound2.play(14);
+ scene->sub107F71(_field34);
+
+ return true;
+}
+
+void Scene3500::Actor7::process(Event &event) {
+ Scene3500 *scene = (Scene3500 *)R2_GLOBALS._sceneManager._scene;
+
+ if (scene->_field1286 == 0)
+ return;
+
+ if ((event.eventType == EVENT_BUTTON_DOWN) && (R2_GLOBALS._events.getCursor() == CURSOR_USE) && (_bounds.contains(event.mousePos))) {
+ _fieldAE = 1 + event.mousePos.y - _position.y;
+ event.eventType = EVENT_NONE;
+ }
+
+ if ((event.eventType == EVENT_BUTTON_UP) && (_fieldAE != 0)) {
+ _fieldAE = 0;
+ event.handled = true;
+ if (scene->_action1._field24 == 0)
+ sub1094ED();
+ }
+
+ if (_fieldAE == 0)
+ return;
+
+ R2_GLOBALS._sound2.play(338);
+ event.handled = true;
+
+ int cx = event.mousePos.y - _fieldAE + 1;
+ if (_fieldA6 >= cx) {
+ if (_fieldA6 - _fieldAA <= cx)
+ sub109693(Common::Point(((_fieldA6 - cx) / 2) + _fieldA4 + ((_fieldA6 - cx) % 2), cx));
+ else
+ sub109693(Common::Point(_fieldA4 + _fieldA8, _fieldA6 - _fieldAA));
+ } else {
+ sub109693(Common::Point(_fieldA4, _fieldA6));
+ }
+}
+
+bool Scene3500::Actor7::startAction(CursorType action, Event &event) {
+ Scene3500 *scene = (Scene3500 *)R2_GLOBALS._sceneManager._scene;
+
+ if (scene->_field1286 == 0)
+ return true;
+
+ if (scene->_field1286 == 4)
+ return false;
+
+ return SceneActor::startAction(action, event);
+}
+
+void Scene3500::postInit(SceneObjectList *OwnerList) {
+ byte tmpPal[768];
+ Rect tmpRect;
+
+ loadScene(1050);
+ R2_GLOBALS._uiElements._active = false;
+ R2_GLOBALS._v5589E.set(0, 0, 320, 200);
+ R2_GLOBALS._sound1.play(305);
+ R2_GLOBALS._player._characterIndex = R2_QUINN;
+ R2_GLOBALS._player._characterScene[1] = 3500;
+ R2_GLOBALS._player._characterScene[2] = 3500;
+ R2_GLOBALS._player._characterScene[3] = 3500;
+ _field1284 = 0;
+ _field1282 = 0;
+ _field1278 = 0;
+ _field1272 = 1;
+ _field1270 = 4;
+ _field126E = 4;
+ _field127A = 860;
+ _field127C = 891;
+ _rotation = R2_GLOBALS._scenePalette.addRotation(240, 254, -1);
+ _rotation->setDelay(0);
+ _rotation->_idxChange = 1;
+
+ for (int i = 240; i <= 254; i++) {
+ int tmpIndex = _rotation->_currIndex - 240;
+
+ if (tmpIndex > 254)
+ tmpIndex--;
+
+ tmpPal[3 * i] = R2_GLOBALS._scenePalette._palette[3 * tmpIndex];
+ tmpPal[(3 * i) + 1] = R2_GLOBALS._scenePalette._palette[(3 * tmpIndex) + 1];
+ tmpPal[(3 * i) + 2] = R2_GLOBALS._scenePalette._palette[(3 * tmpIndex) + 2];
+ }
+
+ for (int i = 240; i <= 254; i++) {
+ R2_GLOBALS._scenePalette._palette[3 * i] = tmpPal[3 * i];
+ R2_GLOBALS._scenePalette._palette[(3 * i) + 1] = tmpPal[(3 * i) + 1];
+ R2_GLOBALS._scenePalette._palette[(3 * i) + 2] = tmpPal[(3 * i) + 2];
+ }
+
+ _actor7.sub109466(38, 165, 16, 32, _field1270);
+ _actor7.setDetails(3500, 6, 7, -1, 1, (SceneItem *)NULL);
+ R2_GLOBALS._sound1.play(276);
+
+ _item4._field34 = 88;
+ _item4.setDetails(88, 3500, 18, 10, -1);
+
+ _item5._field34 = 112;
+ _item5.setDetails(112, 3500, 9, 10, -1);
+
+ _item6._field34 = 104;
+ _item6.setDetails(104, 3500, 15, 10, -1);
+
+ _item7._field34 = 96;
+ _item7.setDetails(96, 3500, 12, 10, -1);
+
+ _actor8.postInit();
+ _actor8.setup(10501, 1, 1);
+ _actor8.setPosition(Common::Point(160, 73));
+ _actor8.fixPriority(1);
+
+ _actor9.postInit();
+ _actor9.setup(1050, 2, 1);
+ _actor9.setPosition(Common::Point(-160, 73));
+ _actor9.fixPriority(11);
+ _actor9.hide();
+
+ _item2.setDetails(27, 3500, 21, -1, -1);
+ _item3.setDetails(Rect(160, 89, 299, 182), 3500, 3, -1, -1, 1, NULL);
+ _item1.setDetails(Rect(0, 0, 320, 200), 3500, 0, -1, 2, 1, NULL);
+
+ _actor1.postInit();
+ _field1276 = 1;
+ _actor1.setup(1004, 1, _field1276);
+ _actor1.setPosition(Common::Point(230, 135));
+ _actor1.fixPriority(200);
+ _actor1._frameChange = 1;
+
+ _actor5.postInit();
+ _actor5.setup(1004, 3, 1);
+ _actor5.setPosition(Common::Point(117, 163));
+ _actor5.fixPriority(200);
+ _actor5.hide();
+
+ _actor4.postInit();
+ _actor4.setup(1004, 3, 2);
+ _actor4.setPosition(Common::Point(126, 163));
+ _actor4.fixPriority(200);
+
+ _actor6.postInit();
+ _actor6.setup(1004, 3, 3);
+ _actor6.setPosition(Common::Point(135, 163));
+ _actor6.fixPriority(200);
+ _actor6.hide();
+
+ _actor2.postInit();
+ _actor2.setup(1004, 4, _field126E + 1);
+ _actor2.setPosition(Common::Point(126, 137));
+ _actor2.fixPriority(200);
+
+ _actor3.postInit();
+ _actor3.setup(1004, 5, 2);
+ _actor3.setPosition(Common::Point(126, 108));
+ _actor3.fixPriority(200);
+
+ tmpRect.set(160, 89, 299, 182);
+ _unkObj1.sub9EDE8(tmpRect);
+ _unkObj1.sub51AE9(2);
+ _unkObj1.sub51AFD(Common::Point(_field127A, _field127C));
+
+ _action1._field24 = 0;
+ warning("gfx_set_pane_p()");
+ _unkObj1.sub51B02();
+ warning("gfx_set_pane_p()");
+ _field1286 = 1;
+
+ R2_GLOBALS._player.postInit();
+ R2_GLOBALS._player.hide();
+ R2_GLOBALS._player.enableControl(CURSOR_USE);
+ R2_GLOBALS._player._uiEnabled = false;
+ R2_GLOBALS._player._canWalk = false;
+}
+
+void Scene3500::remove() {
+ _rotation->remove();
+ R2_GLOBALS._sound2.fadeOut2(NULL);
+ SceneExt::remove();
+}
+
+void Scene3500::signal() {
+ R2_GLOBALS._player.enableControl(CURSOR_USE);
+ R2_GLOBALS._player._canWalk = false;
+ _field1286 = 1;
+}
+
+void Scene3500::process(Event &event) {
+ if (_field1286 == 0)
+ return;
+
+ if (event.eventType == EVENT_KEYPRESS) {
+ switch (event.kbd.keycode) {
+ case Common::KEYCODE_1:
+ warning("FIXME: keycode = 0x4700");
+ R2_GLOBALS._sound2.play(338);
+ sub107F71(16);
+ event.handled = true;
+ break;
+ case Common::KEYCODE_2:
+ warning("FIXME: keycode = 0x4800");
+ R2_GLOBALS._sound2.play(14, NULL, 63);
+ sub107F71(88);
+ event.handled = true;
+ break;
+ case Common::KEYCODE_3:
+ warning("FIXME: keycode = 0x4900");
+ if (_field1270 < 16)
+ R2_GLOBALS._sound2.play(338);
+ sub107F71(1);
+ event.handled = true;
+ break;
+ case Common::KEYCODE_4:
+ warning("FIXME: keycode = 0x4B00");
+ R2_GLOBALS._sound2.play(14, NULL, 63);
+ sub107F71(112);
+ event.handled = true;
+ break;
+ case Common::KEYCODE_5:
+ warning("FIXME: keycode = 0x4D00");
+ R2_GLOBALS._sound2.play(14, NULL, 63);
+ sub107F71(96);
+ event.handled = true;
+ break;
+ case Common::KEYCODE_6:
+ warning("FIXME: keycode = 0x4F00");
+ R2_GLOBALS._sound2.play(338);
+ sub107F71(0);
+ event.handled = true;
+ break;
+ case Common::KEYCODE_7:
+ warning("FIXME: keycode = 0x5000");
+ R2_GLOBALS._sound2.play(14, NULL, 63);
+ sub107F71(104);
+ event.handled = true;
+ break;
+ case Common::KEYCODE_8:
+ warning("FIXME: keycode = 0x5100");
+ if (_field1270 != 0)
+ R2_GLOBALS._sound2.play(338);
+ sub107F71(-1);
+ event.handled = true;
+ break;
+ case Common::KEYCODE_9:
+ warning("FIXME: keycode = 0x5200");
+ R2_GLOBALS._sound2.play(338);
+ sub107F71(8);
+ event.handled = true;
+ break;
+ case Common::KEYCODE_0:
+ warning("FIXME: keycode = 0x5300");
+ R2_GLOBALS._sound2.play(338);
+ sub107F71(4);
+ event.handled = true;
+ break;
+ default:
+ break;
+ }
+ }
+
+ if (!event.handled)
+ _actor7.process(event);
+
+ if (!event.handled)
+ _item4.process(event);
+
+ if (!event.handled)
+ _item5.process(event);
+
+ if (!event.handled)
+ _item6.process(event);
+
+ if (!event.handled)
+ _item7.process(event);
+
+ Scene::process(event);
+}
+
+void Scene3500::dispatch() {
+ Rect tmpRect;
+ Scene::dispatch();
+ if (((_actor1._frame % 2) == 0) && (_action1._field24 == 0)) {
+ _actor1.setFrame(_actor1.changeFrame());
+ _field1276 = _actor1._frame;
+ }
+ int oldField1278;
+ if ((_field1278 != 0) && (_action1._field24 == 0)) {
+ oldField1278 = _field1278;
+ _field1278 = 0;
+ sub107F71(oldField1278);
+ }
+
+ if (!_rotation)
+ return;
+
+ int var_field127A = 0;
+ int di = 0;
+ int var_4 = 0;
+ int var_6 = 0;
+ int var_8 = 0;
+ int var_a = 0;
+ int dx = 0;
+ int tmpVar = 0;
+
+ if ((_field126E == 0) && (_field1282 == 0)) {
+ if (_field1284 == 2)
+ R2_GLOBALS._sceneManager.changeScene(1000);
+ } else {
+ _field1282 = 0;
+ tmpRect.set(160, 89, 299, 182);
+
+ var_field127A = _field127A;
+ di = _field127C;
+ var_4 = _unkObj1.sub1097C9(70) - 70;
+ var_6 = _unkObj1.sub1097EF(_field127C + 46) - 46;
+ var_8 = abs(var_4 - var_field127A);
+ var_a = abs(var_6 - di);
+ dx = 0;
+
+ switch (_field1276) {
+ case 0:
+ tmpVar = _unkObj1.sub109C09(Common::Point(var_field127A + 70, 46));
+ if ( ((tmpVar == 2) || (tmpVar == 3) || (tmpVar == 6) || (tmpVar == 1))
+ || (((tmpVar == 25) || (tmpVar == 26) || (tmpVar == 5) || (tmpVar == 14) || (tmpVar == 15)) && (var_8 > 3)) ) {
+ R2_GLOBALS._sound2.play(339);
+ _rotation->_idxChange = 0;
+ _field1270 = 0;
+ _field126E = 0;
+ _field1272 = 0;
+ if (_action1._field24 == 0)
+ _actor8.hide();
+ } else {
+ var_6 = _unkObj1.sub1097EF(di + 46) - 46;
+ di = _field127C - _field126E;
+ dx = _unkObj1.sub109C09(Common::Point(var_field127A + 70, di + 46));
+ if (((tmpVar == 23) || (tmpVar == 24) || (tmpVar == 4)) && (tmpVar != dx)) {
+ di = var_6;
+ R2_GLOBALS._sound2.play(339);
+ _rotation->_idxChange = 0;
+ _field1270 = 0;
+ _field126E = 0;
+ _field1272 = 0;
+ if (_action1._field24 == 0)
+ _actor8.hide();
+ } else if ((tmpVar == 11) && (tmpVar != dx)) {
+ di = var_6 + 3;
+ R2_GLOBALS._sound2.play(339);
+ _rotation->_idxChange = 0;
+ _field1270 = 0;
+ _field126E = 0;
+ _field1272 = 0;
+ if (_action1._field24 == 0)
+ _actor8.hide();
+ } else {
+ var_6 = _unkObj1.sub1097EF(di + 46) - 46;
+ var_a = abs(var_6 - di);
+ tmpVar = _unkObj1.sub109C09(Common::Point(var_field127A + 70, di + 46));
+
+ if ( (((tmpVar == 23) || (tmpVar == 24) || (tmpVar == 4)) && (di <= var_6) && (_field127C>= var_6))
+ || (((tmpVar == 25) || (tmpVar == 26) || (tmpVar == 5) || (tmpVar == 14) || (tmpVar == 15)) && (_field126E >= var_a) && (_field126E > 3) && (_action1._field24 != 0)) ) {
+ di = var_6;
+ if ((tmpVar != 25) && (tmpVar != 26) && (tmpVar != 5) && (tmpVar != 14) && (tmpVar == 15))
+ R2_GLOBALS._sound2.play(339);
+ _rotation->_idxChange = 0;
+ _field1270 = 0;
+ _field126E = 0;
+ _field1272 = 0;
+ if (_action1._field24 == 0)
+ _actor8.hide();
+ } else if ((tmpVar == 11) && (var_6 + 3 >= di) && (_field127C >= var_6 + 3)) {
+ R2_GLOBALS._sound2.play(339);
+ _rotation->_idxChange = 0;
+ _field1270 = 0;
+ _field126E = 0;
+ _field1272 = 0;
+ if (_action1._field24 == 0)
+ _actor8.hide();
+ } else if (((tmpVar == 25) || (tmpVar == 26) || (tmpVar == 5) || (tmpVar == 14) || (tmpVar == 15)) && (var_8 != 0) && (var_8 <= 3)) {
+ var_field127A = var_4;
+ R2_GLOBALS._sound2.play(339);
+ } else {
+ // Nothing
+ }
+ }
+ }
+ break;
+ case 2:
+ tmpVar = _unkObj1.sub109C09(Common::Point(var_field127A + 70, di + 46));
+ if ( ((tmpVar == 12) || (tmpVar == 13) || (tmpVar == 11) || (tmpVar == 16) || (tmpVar == 31))
+ || (((tmpVar == 25) || (tmpVar == 23) || (tmpVar == 14) || (tmpVar == 5) || (tmpVar == 4)) && (var_a > 3)) ) {
+ R2_GLOBALS._sound2.play(339);
+ _rotation->_idxChange = 0;
+ _field1270 = 0;
+ _field126E = 0;
+ _field1272 = 0;
+ if (_action1._field24 == 0)
+ _actor8.hide();
+ } else {
+ var_4 = _unkObj1.sub1097C9(var_field127A + 70) - 70;
+ var_field127A = _field127A + _field126E;
+ dx = _unkObj1.sub109C09(Common::Point(var_field127A + 70, di + 46));
+ if (((tmpVar == 26) || (tmpVar == 24) || (tmpVar == 15)) && (tmpVar != dx)) {
+ var_field127A = var_4;
+ R2_GLOBALS._sound2.play(339);
+ _rotation->_idxChange = 0;
+ _field1270 = 0;
+ _field126E = 0;
+ _field1272 = 0;
+ if (_action1._field24 == 0)
+ _actor8.hide();
+ } else if ((tmpVar == 6) && (tmpVar != dx)) {
+ var_field127A = var_4 - 5;
+ R2_GLOBALS._sound2.play(339);
+ _rotation->_idxChange = 0;
+ _field1270 = 0;
+ _field126E = 0;
+ _field1272 = 0;
+ if (_action1._field24 == 0)
+ _actor8.hide();
+ } else {
+ var_4 = _unkObj1.sub1097C9(var_field127A + 70) - 70;
+ var_8 = abs(var_field127A - var_4);
+ tmpVar = _unkObj1.sub109C09(Common::Point(var_field127A + 70, tmpVar + 46));
+ if ( (((tmpVar == 26) || (tmpVar == 24) || (tmpVar == 15)) && (var_field127A >= var_4) && (_field127A <= var_4))
+ || (((tmpVar == 25) || (tmpVar == 23) || (tmpVar == 14) || (tmpVar == 5) || (tmpVar == 4)) && (_field126E >= var_8) && (_field126E <= 3) && (_action1._field24 != 0)) ) {
+ var_field127A = var_4;
+ if ((tmpVar == 25) || (tmpVar == 23) || (tmpVar == 14) || (tmpVar == 5) || (tmpVar == 4))
+ R2_GLOBALS._sound2.play(339);
+ _rotation->_idxChange = 0;
+ _field1270 = 0;
+ _field126E = 0;
+ _field1272 = 0;
+ if (_action1._field24 == 0)
+ _actor8.hide();
+ } else if ((tmpVar == 6) && (var_4 - 5 <= var_field127A) && (_field127A <= var_4 - 5)) {
+ var_field127A = var_4 - 5;
+ R2_GLOBALS._sound2.play(339);
+ _rotation->_idxChange = 0;
+ _field1270 = 0;
+ _field126E = 0;
+ _field1272 = 0;
+ if (_action1._field24 == 0)
+ _actor8.hide();
+ } else if (((tmpVar == 25) || (tmpVar == 23) || (tmpVar == 14) || (tmpVar == 5) || (tmpVar == 4)) && (var_a != 0) && (var_a <= 3)) {
+ di = var_6;
+ R2_GLOBALS._sound2.play(339);
+ } else {
+ // Nothing
+ }
+ }
+ }
+ break;
+ case 4:
+ tmpVar = _unkObj1.sub109C09(Common::Point(var_field127A + 70, di + 46));
+ if ( ((tmpVar == 2) || (tmpVar == 3) || (tmpVar == 6) || (tmpVar == 1))
+ || (((tmpVar == 23) || (tmpVar == 24) || (tmpVar == 4) || (tmpVar == 14) || (tmpVar == 15)) && (var_8 > 3)) ) {
+ R2_GLOBALS._sound2.play(339);
+ _rotation->_idxChange = 0;
+ _field1270 = 0;
+ _field126E = 0;
+ _field1272 = 0;
+ if (_action1._field24 == 0)
+ _actor8.hide();
+ } else {
+ var_6 = _unkObj1.sub1097EF(di + 46) - 46;
+ di = _field127C + _field126E;
+ dx = _unkObj1.sub109C09(Common::Point(var_field127A + 70, di + 46));
+ if (((tmpVar == 25) || (tmpVar == 26) || (tmpVar == 5)) && (tmpVar == dx)) {
+ R2_GLOBALS._sound2.play(339);
+ _rotation->_idxChange = 0;
+ _field1270 = 0;
+ _field126E = 0;
+ _field1272 = 0;
+ if (_action1._field24 == 0)
+ _actor8.hide();
+ } else if ((tmpVar == 16) && (tmpVar == dx)) {
+ di = var_6 - 3;
+ R2_GLOBALS._sound2.play(339);
+ _rotation->_idxChange = 0;
+ _field1270 = 0;
+ _field126E = 0;
+ _field1272 = 0;
+ if (_action1._field24 == 0)
+ _actor8.hide();
+ } else if ((tmpVar == 31) && (tmpVar == dx)) {
+ di = var_6 + 4;
+ R2_GLOBALS._sound2.play(339);
+ _rotation->_idxChange = 0;
+ _field1270 = 0;
+ _field126E = 0;
+ _field1272 = 0;
+ if (_action1._field24 == 0)
+ _actor8.hide();
+ } else {
+ var_6 = _unkObj1.sub1097EF(di + 46) - 46;
+ var_a = abs(di - var_6);
+ tmpVar = _unkObj1.sub109C09(Common::Point(var_field127A + 70, di + 46));
+ if ( (((tmpVar == 25) || (tmpVar == 26) || (tmpVar == 5)) && (di >= var_6) && (_field127C <= var_6))
+ || (((tmpVar == 23) || (tmpVar == 24) || (tmpVar == 4) || (tmpVar == 14) || (tmpVar == 15)) && (_field126E >= var_a) && (_field126E <= 3) && (_action1._field24 != 0)) ){
+ if ((tmpVar != 23) && (tmpVar != 24) && (tmpVar != 4) && (tmpVar != 14) && (tmpVar != 15))
+ R2_GLOBALS._sound2.play(339);
+ _rotation->_idxChange = 0;
+ _field1270 = 0;
+ _field126E = 0;
+ _field1272 = 0;
+ if (_action1._field24 == 0)
+ _actor8.hide();
+ } else if ((tmpVar == 16) && (var_6 - 3 <= di) && (_field127C <= var_6 - 3)) {
+ di = var_6 - 3;
+ R2_GLOBALS._sound2.play(339);
+ _rotation->_idxChange = 0;
+ _field1270 = 0;
+ _field126E = 0;
+ _field1272 = 0;
+ if (_action1._field24 == 0)
+ _actor8.hide();
+ } else if ((tmpVar == 31) && (var_6 + 4 <= di) && (_field127C <= var_6 + 4)) {
+ di = var_6 + 4;
+ _rotation->_idxChange = 0;
+ _field1270 = 0;
+ _field126E = 0;
+ _field1272 = 0;
+ if (_action1._field24 == 0)
+ _actor8.hide();
+ if ((var_field127A == 660) && (_field126E + 306 <= di) && (di <= 307))
+ ++_field1284;
+ else
+ R2_GLOBALS._sound2.play(339);
+ } else if (((tmpVar == 23) || (tmpVar == 24) || (tmpVar == 4) || (tmpVar == 14) || (tmpVar == 15)) && (var_8 != 0) && (var_8 <= 3)) {
+ var_field127A = var_4;
+ R2_GLOBALS._sound2.play(339);
+ } else {
+ // Nothing
+ }
+ }
+ }
+ break;
+ case 6:
+ tmpVar = _unkObj1.sub109C09(Common::Point(var_field127A + 70, di + 46));
+ if ( ((tmpVar == 12) || (tmpVar == 13) || (tmpVar == 11) || (tmpVar == 16) || (tmpVar == 31))
+ || (((tmpVar == 26) || (tmpVar == 24) || (tmpVar == 15) || (tmpVar == 5) || (tmpVar == 4)) && (var_a > 3)) ) {
+ R2_GLOBALS._sound2.play(339);
+ _rotation->_idxChange = 0;
+ _field1270 = 0;
+ _field126E = 0;
+ _field1272 = 0;
+ if (_action1._field24 == 0)
+ _actor8.hide();
+ } else {
+ var_4 = _unkObj1.sub1097C9(var_field127A + 70) - 70;
+ var_field127A = _field127A - _field126E;
+ dx = _unkObj1.sub109C09(Common::Point(var_field127A + 70, di + 46));
+ if (((tmpVar == 25) || (tmpVar == 23) || (tmpVar == 14)) && (tmpVar != dx)) {
+ var_field127A = var_4;
+ R2_GLOBALS._sound2.play(339);
+ _rotation->_idxChange = 0;
+ _field1270 = 0;
+ _field126E = 0;
+ _field1272 = 0;
+ if (_action1._field24 == 0)
+ _actor8.hide();
+ } else if ((tmpVar == 1) && (tmpVar != dx)) {
+ var_field127A = var_4 + 5;
+ R2_GLOBALS._sound2.play(339);
+ _rotation->_idxChange = 0;
+ _field1270 = 0;
+ _field126E = 0;
+ _field1272 = 0;
+ if (_action1._field24 == 0)
+ _actor8.hide();
+ } else {
+ var_4 = _unkObj1.sub1097C9(var_field127A + 70) - 70;
+ var_8 = abs(var_4 - var_field127A);
+ tmpVar = _unkObj1.sub109C09(Common::Point(var_field127A + 70, di + 46));
+ if ( (((tmpVar == 25) || (tmpVar == 23) || (tmpVar == 14)) && (var_field127A <= var_4) && (_field127A >= var_4))
+ || (((tmpVar == 26) || (tmpVar == 24) || (tmpVar == 15) || (tmpVar == 5) || (tmpVar == 4)) && (_field126E >= var_8) && (_field126E <= 3) && (_action1._field24 != 0)) ) {
+ var_field127A = var_4;
+ if ((tmpVar == 26) || (tmpVar == 24) || (tmpVar == 15) || (tmpVar == 5) || (tmpVar == 4))
+ R2_GLOBALS._sound2.play(339);
+ _rotation->_idxChange = 0;
+ _field1270 = 0;
+ _field126E = 0;
+ _field1272 = 0;
+ if (_action1._field24 == 0)
+ _actor8.hide();
+ } else if ((tmpVar == 1) && (var_field127A >= var_4 + 5) && (_field127A >= var_4 + 5)) {
+ var_field127A = var_4 + 5;
+ R2_GLOBALS._sound2.play(339);
+ _rotation->_idxChange = 0;
+ _field1270 = 0;
+ _field126E = 0;
+ _field1272 = 0;
+ if (_action1._field24 == 0)
+ _actor8.hide();
+ } else if (((tmpVar == 26) || (tmpVar == 24) || (tmpVar == 15) || (tmpVar == 5) || (tmpVar == 4)) && (var_a != 0) && (var_a <= 3)) {
+ di = var_6;
+ R2_GLOBALS._sound2.play(339);
+ } else {
+ // Nothing
+ }
+ }
+ }
+ break;
+ default:
+ break;
+ }
+
+ if (_field1284 < 2) {
+ _field127A = var_field127A;
+ _field127C = di;
+ if (_unkObj1.sub109C5E(_field127A, _field127C) != 0) {
+ _field1272 = 0;
+ _field126E = 0;
+ _field1270 = 0;
+ _rotation->setDelay(0);
+ _rotation->_idxChange = 0;
+ }
+ warning("gfx_set_pane_p");
+ _unkObj1.sub51B02();
+ if (_field1284 != 0)
+ ++_field1284;
+ }
+ }
+
+ if (_field1272 == 0) {
+ if (_field126E != _field1270) {
+ if (_field126E >= _field1270) {
+ if (_field126E == 1) {
+ if (_action1._field24 != 0) {
+ if ( ((_field1276 == 1) && (var_8 == 0) && (var_a != 0) && (var_a <= 3) && ((tmpVar == 25) || (tmpVar == 26) || (tmpVar == 5) || (tmpVar == 14) || (tmpVar == 15)))
+ || ((_field1276 == 3) && (var_a == 0) && (var_8 != 0) && (var_8 <= 3) && ((tmpVar == 25) || (tmpVar == 23) || (tmpVar == 14) || (tmpVar == 5) || (tmpVar == 4)))
+ || ((_field1276 == 5) && (var_8 == 0) && (var_a != 0) && (var_a <= 3) && ((tmpVar == 23) || (tmpVar == 24) || (tmpVar == 4) || (tmpVar == 14) || (tmpVar == 15)))
+ || ((_field1276 == 7) && (var_a == 0) && (var_8 != 0) && (var_8 <= 3) && ((tmpVar == 26) || (tmpVar == 24) || (tmpVar == 15) || (tmpVar == 5) || (tmpVar == 4))) ){
+ _field126E = 1;
+ } else
+ _field126E--;
+ } else
+ _field126E--;
+ } else
+ _field126E--;
+ } else
+ ++_field126E;
+ _field1272 = 1;
+ }
+ _actor2.setFrame2(_field126E);
+ }
+
+ if (_field1272 == 1) {
+ if (_field126E == 0)
+ _rotation->_idxChange = 0;
+ else if (_field126E > 8)
+ _rotation->_idxChange = 2;
+ else
+ _rotation->_idxChange = 1;
+ }
+
+ if (_field1272 != 0)
+ _field1272--;
+
+ if (_field126E != 0) {
+ R2_GLOBALS._player._uiEnabled = false;
+ if (_field126E != _field1270)
+ _aSound1.play(276);
+ } else {
+ R2_GLOBALS._player._uiEnabled = true;
+ _aSound1.fadeOut2(NULL);
+ }
+
+ if (_rotation->_currIndex != _field1274)
+ _field1274 = _rotation->_currIndex;
+}
+
+/*--------------------------------------------------------------------------
* Scene 3600 -
*
*--------------------------------------------------------------------------*/
@@ -3029,10 +4323,10 @@ bool Scene3600::Actor13::startAction(CursorType action, Event &event) {
scene->_stripManager.start(3327, scene);
return true;
- case R2_7:
+ case R2_SONIC_STUNNER:
// No break on purpose
- case R2_44:
- if (action == R2_7)
+ case R2_PHOTON_STUNNER:
+ if (action == R2_SONIC_STUNNER)
R2_GLOBALS._sound3.play(43);
else
R2_GLOBALS._sound3.play(99);
@@ -3582,7 +4876,7 @@ void Scene3600::dispatch() {
*--------------------------------------------------------------------------*/
void Scene3700::postInit(SceneObjectList *OwnerList) {
loadScene(3700);
- R2_GLOBALS._v58CE2 = 0;
+ R2_GLOBALS._uiElements._active = false;
SceneExt::postInit();
_stripManager.setColors(60, 255);
@@ -3929,37 +5223,6 @@ void Scene3800::sub110BBD() {
}
}
-void Scene3800::sub1B007(int arg1, int arg2, int arg3) {
- byte *tmpPal = R2_GLOBALS._scenePalette._palette;
- byte newR, newG, newB;
- int tmp, varC, varD = 0;
-
- for (int i = 0; i < 256; i++) {
- newR = (arg1 * tmpPal[(3 * i)]) / 100;
- newG = (arg2 * tmpPal[(3 * i) + 1]) / 100;
- newB = (arg3 * tmpPal[(3 * i) + 2]) / 100;
-
- varC = 769;
- for (int j = 255; j >= 0; j--) {
- tmp = abs(tmpPal[(3 * j)] - newR);
- if (tmp >= varC)
- continue;
-
- tmp += abs(tmpPal[(3 * j) + 1] - newG);
- if (tmp >= varC)
- continue;
-
- tmp += abs(tmpPal[(3 * j) + 2] - newB);
- if (tmp >= varC)
- continue;
-
- varC = tmp;
- varD = j;
- }
- this->_field312[i] = varD;
- }
-}
-
void Scene3800::postInit(SceneObjectList *OwnerList) {
_field412 = 0;
@@ -3968,7 +5231,7 @@ void Scene3800::postInit(SceneObjectList *OwnerList) {
SceneExt::postInit();
R2_GLOBALS._sound1.play(231);
- warning("sub1B007(65, 65, 65)");
+ scalePalette(65, 65, 65);
setZoomPercents(87, 40, 144, 100);
@@ -4218,7 +5481,8 @@ void Scene3900::postInit(SceneObjectList *OwnerList) {
_exit5._insideArea = false;
_exit5._moving = false;
- warning("sub1B007(65, 65, 65)");
+ scalePalette(65, 65, 65);
+
_exit1.setDest(Common::Point(160, 126));
_exit1._enabled = true;
_exit1._insideArea = false;
diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.h b/engines/tsage/ringworld2/ringworld2_scenes3.h
index c925871747..6088c88479 100644
--- a/engines/tsage/ringworld2/ringworld2_scenes3.h
+++ b/engines/tsage/ringworld2/ringworld2_scenes3.h
@@ -571,6 +571,126 @@ public:
virtual void synchronize(Serializer &s);
};
+class Scene3500 : public SceneExt {
+ class Action1: public Action {
+ public:
+ int _field1E;
+ int _field20;
+ int _field22;
+ int _field24;
+
+ Action1();
+ virtual void synchronize(Serializer &s);
+ void sub108670(int arg1);
+ void sub108732(int arg1);
+ virtual void signal();
+ virtual void dispatch();
+ };
+ class Action2: public Action {
+ public:
+ int _field1E;
+
+ Action2();
+ virtual void synchronize(Serializer &s);
+ void sub10831F(int arg1);
+
+ virtual void signal();
+ };
+
+ class Item4 : public NamedHotspot {
+ public:
+ int _field34;
+
+ Item4();
+ virtual void synchronize(Serializer &s);
+
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ class Actor7 : public SceneActor {
+ public:
+ int _fieldA4;
+ int _fieldA6;
+ int _fieldA8;
+ int _fieldAA;
+ int _fieldAC;
+ int _fieldAE;
+
+ Actor7();
+ virtual void synchronize(Serializer &s);
+
+ void sub109466(int arg1, int arg2, int arg3, int arg4, int arg5);
+ void sub1094ED();
+ void sub109663(int arg1);
+ void sub109693(Common::Point Pt);
+
+ virtual void process(Event &event);
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ class Actor8 : public SceneActor {
+ public:
+ // TODO: double check if nothing specific is present, then remove this class
+ };
+
+ class UnkObject3500 : public UnkObject1200 {
+ public:
+ int sub1097C9(int arg1);
+ int sub1097EF(int arg1);
+ int sub109C09(Common::Point pt);
+ int sub109C5E(int &x, int &y);
+ };
+public:
+ Action1 _action1;
+ Action2 _action2;
+ NamedHotspot _item1;
+ NamedHotspot _item2;
+ NamedHotspot _item3;
+ Item4 _item4;
+ Item4 _item5;
+ Item4 _item6;
+ Item4 _item7;
+ SceneActor _actor1;
+ SceneActor _actor2;
+ SceneActor _actor3;
+ SceneActor _actor4;
+ SceneActor _actor5;
+ SceneActor _actor6;
+ Actor7 _actor7;
+ Actor8 _actor8;
+ Actor8 _actor9;
+ ASoundExt _aSound1;
+ UnkObject3500 _unkObj1;
+ SequenceManager _sequenceManager;
+
+ int _fieldAF8;
+ int _fieldB9E;
+ PaletteRotation *_rotation;
+ int _field126E;
+ int _field1270;
+ int _field1272;
+ int _field1274;
+ int _field1276;
+ int _field1278;
+ int _field127A;
+ int _field127C;
+ int _field127E;
+ int _field1280;
+ int _field1282;
+ int _field1284;
+ int _field1286;
+
+ Scene3500();
+ void sub107F71(int arg1);
+
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void remove();
+ virtual void signal();
+ virtual void process(Event &event);
+ virtual void dispatch();
+ virtual void synchronize(Serializer &s);
+};
+
class Scene3600 : public SceneExt {
class Action3600: public ActionExt {
public:
@@ -695,7 +815,6 @@ public:
Scene3800();
void initScene3800();
void sub110BBD();
- void sub1B007(int arg1, int arg2, int arg3);
virtual void postInit(SceneObjectList *OwnerList = NULL);
virtual void signal();
diff --git a/engines/tsage/ringworld2/ringworld2_speakers.cpp b/engines/tsage/ringworld2/ringworld2_speakers.cpp
index 26ed818819..f729881e8f 100644
--- a/engines/tsage/ringworld2/ringworld2_speakers.cpp
+++ b/engines/tsage/ringworld2/ringworld2_speakers.cpp
@@ -26,6 +26,7 @@
#include "tsage/graphics.h"
#include "tsage/staticres.h"
#include "tsage/ringworld2/ringworld2_scenes0.h"
+#include "tsage/ringworld2/ringworld2_scenes1.h"
#include "tsage/ringworld2/ringworld2_scenes2.h"
#include "tsage/ringworld2/ringworld2_scenes3.h"
@@ -192,6 +193,17 @@ void VisualSpeaker::setDelay(int delay) {
}
//----------------------------------------------------------------------------
+
+SpeakerGameText::SpeakerGameText(): VisualSpeaker() {
+ _speakerName = "GAMETEXT";
+ _color1 = 8;
+ _color2 = 0;
+ _textWidth = 300;
+ _hideObjects = false;
+ _object2 = NULL;
+}
+
+//----------------------------------------------------------------------------
// Classes related to CAPTAIN
//----------------------------------------------------------------------------
@@ -247,6 +259,64 @@ SpeakerCaretaker2450::SpeakerCaretaker2450() {
}
//----------------------------------------------------------------------------
+// Classes related to CHIEF
+//----------------------------------------------------------------------------
+
+SpeakerChief1100::SpeakerChief1100() {
+ _speakerName = "CHIEF";
+ _color1 = 8;
+ _color2 = 0;
+ _fieldF6 = 0;
+ _textWidth = 300;
+ _hideObjects = false;
+ _object2 = NULL;
+ _displayMode = 1;
+ _numFrames = 0;
+}
+
+void SpeakerChief1100::proc15() {
+ int v = _fieldF6;
+ Scene1100 *scene = (Scene1100 *)R2_GLOBALS._sceneManager._scene;
+
+ if (!_object2) {
+ _object2 = &scene->_actor18;
+ _object2->hide();
+ _object1.postInit();
+ _object1.setPosition(_object2->_position);
+ _object1._numFrames = 7;
+
+ if (_object2->_mover)
+ _object2->addMover(NULL);
+ }
+
+ switch (v) {
+ case 0:
+ _object1.animate(ANIM_MODE_2, NULL);
+ break;
+ case 1:
+ ((SceneItem *)_action)->_sceneRegionId = 0;
+ _object1.setup(4080, 1, 1);
+ _object1.animate(ANIM_MODE_5, this);
+ break;
+ case 2:
+ ((SceneItem *)_action)->_sceneRegionId = 0;
+ _object1.setup(4080, 3, 1);
+ _object1.animate(ANIM_MODE_5, this);
+ break;
+ case 100:
+ _numFrames = 0;
+ ((SceneItem *)_action)->_sceneRegionId = 0;
+ _object1.setStrip(_object1._strip - 1);
+ _object1.setFrame(_object1.getFrameCount());
+ _object1.animate(ANIM_MODE_6, this);
+ break;
+ default:
+ signal();
+ break;
+ }
+}
+
+//----------------------------------------------------------------------------
// Classes related to GUARD
//----------------------------------------------------------------------------
@@ -427,6 +497,29 @@ void SpeakerMiranda300::proc15() {
}
}
+void SpeakerMiranda1625::proc15() {
+ int v = _fieldF6;
+
+ if (!_object2) {
+ Scene1625 *scene = (Scene1625 *)R2_GLOBALS._sceneManager._scene;
+ _object2 = &scene->_actor3;
+ _object2->hide();
+ _object1.postInit();
+ _object1.setPosition(Common::Point(196, 65));
+
+ if (_object2->_mover)
+ _object2->addMover(NULL);
+ }
+
+ if (v == 0) {
+ _object1.animate(ANIM_MODE_2, NULL);
+ } else {
+ ((SceneItem *)_action)->_sceneRegionId = 0;
+ _object1.setup(1627, 3, 1);
+ _object1.animate(ANIM_MODE_5, this);
+ }
+}
+
void SpeakerMiranda3255::proc15() {
int v = _fieldF6;
@@ -1046,6 +1139,54 @@ void SpeakerQuinn300::proc15() {
}
}
+void SpeakerQuinn1100::proc15() {
+ int v = _fieldF6;
+
+ if (!_object2) {
+ if (v == 0)
+ return;
+
+ if (R2_GLOBALS._player._characterIndex == 1) {
+ _object2 = &R2_GLOBALS._player;
+ } else {
+ Scene1100 *scene = (Scene1100 *)R2_GLOBALS._sceneManager._scene;
+ _object2 = &scene->_actor16;
+ }
+
+ _object2->hide();
+ _object1.postInit();
+ _object1.setPosition(_object2->_position);
+ _object1._numFrames = 7;
+
+ if (_object2->_mover)
+ _object2->addMover(NULL);
+ }
+
+ switch (v) {
+ case 0:
+ _object1.animate(ANIM_MODE_2, NULL);
+ break;
+ case 1:
+ ((SceneItem *)_action)->_sceneRegionId = 0;
+ _object1.setup(1108, 7, 1);
+ _object1.animate(ANIM_MODE_5, this);
+ break;
+ case 2:
+ ((SceneItem *)_action)->_sceneRegionId = 0;
+ _object1.setup(1109, 1, 1);
+ _object1.animate(ANIM_MODE_5, this);
+ break;
+ case 3:
+ ((SceneItem *)_action)->_sceneRegionId = 0;
+ _object1.setup(1109, 5, 1);
+ _object1.animate(ANIM_MODE_5, this);
+ break;
+ default:
+ signal();
+ break;
+ }
+}
+
void SpeakerQuinn2435::proc15() {
int v = _fieldF6;
@@ -1758,6 +1899,95 @@ void SpeakerSeeker300::proc15() {
}
}
+void SpeakerSeeker1100::proc15() {
+ int v = _fieldF6;
+
+ if (!_object2) {
+ if (v == 0)
+ return;
+
+ if (R2_GLOBALS._player._characterIndex == 2) {
+ _object2 = &R2_GLOBALS._player;
+ } else {
+ Scene1100 *scene = (Scene1100 *)R2_GLOBALS._sceneManager._scene;
+ _object2 = &scene->_actor16;
+ }
+
+ _object2->hide();
+ _object1.postInit();
+ _object1.setPosition(_object2->_position);
+ _object1._numFrames = 7;
+
+ if (_object2->_mover)
+ _object2->addMover(NULL);
+ }
+
+ switch (v) {
+ case 0:
+ _object1.animate(ANIM_MODE_2, NULL);
+ break;
+ case 1:
+ ((SceneItem *)_action)->_sceneRegionId = 0;
+ _object1.setup(1108, 1, 1);
+ _object1.animate(ANIM_MODE_5, this);
+ break;
+ case 2:
+ ((SceneItem *)_action)->_sceneRegionId = 0;
+ _object1.setup(1108, 3, 1);
+ _object1.animate(ANIM_MODE_5, this);
+ break;
+ case 3:
+ _object1.setPosition(Common::Point(197, 134));
+ ((SceneItem *)_action)->_sceneRegionId = 0;
+ _object1.setup(1108, 5, 1);
+ _object1.animate(ANIM_MODE_5, this);
+ break;
+ case 4:
+ ((SceneItem *)_action)->_sceneRegionId = 0;
+ _object1.setup(1109, 7, 1);
+ _object1.animate(ANIM_MODE_5, this);
+ break;
+ case 5:
+ ((SceneItem *)_action)->_sceneRegionId = 0;
+ _object1.setup(1109, 3, 1);
+ _object1.animate(ANIM_MODE_5, this);
+ break;
+ default:
+ signal();
+ break;
+ }
+}
+
+void SpeakerSeeker1900::proc15() {
+ int v = _fieldF6;
+
+ if (!_object2) {
+ if (R2_GLOBALS._player._characterIndex == 2) {
+ _object2 = &R2_GLOBALS._player;
+ } else {
+ Scene1900 *scene = (Scene1900 *)R2_GLOBALS._sceneManager._scene;
+ _object2 = &scene->_actor1;
+ }
+
+ _object2->hide();
+ _object1.postInit();
+ _object1.setPosition(_object2->_position);
+ _object1._numFrames = 7;
+
+ if (_object2->_mover)
+ _object2->addMover(NULL);
+ }
+
+ if (v == 0) {
+ _object1.animate(ANIM_MODE_2, NULL);
+ } else if (v == 1) {
+ _object1.setup(4032, 1, 1);
+ _object1.animate(ANIM_MODE_5, this);
+ } else {
+ signal();
+ }
+}
+
void SpeakerSeeker2435::proc15() {
int v = _fieldF6;
@@ -2181,9 +2411,9 @@ void SpeakerSocko3200::proc15() {
// Classes related to SOLDIER
//----------------------------------------------------------------------------
-SpeakerSoldier300::SpeakerSoldier300(): VisualSpeaker() {
+SpeakerSoldier::SpeakerSoldier(int colour) {
_speakerName = "SOLDIER";
- _color1 = 60;
+ _color1 = colour;
_color2 = 0;
_fieldF6 = 0;
_textWidth = 300;
@@ -2261,6 +2491,30 @@ void SpeakerTeal300::proc15() {
}
}
+void SpeakerTeal1625::proc15() {
+ int v = _fieldF6;
+
+ if (!_object2) {
+ Scene1625 *scene = (Scene1625 *)R2_GLOBALS._sceneManager._scene;
+ _object2 = &scene->_actor2;
+ _object2->hide();
+
+ _object1.postInit();
+ _object1.setPosition(Common::Point(68, 68));
+
+ if (_object2->_mover)
+ _object2->addMover(NULL);
+ }
+
+ if (v == 0) {
+ _object1.animate(ANIM_MODE_2, NULL);
+ } else {
+ ((SceneItem *)_action)->_sceneRegionId = 0;
+ _object1.setup(1627, 1, 1);
+ _object1.animate(ANIM_MODE_5, this);
+ }
+}
+
void SpeakerTeal3240::proc15() {
int v = _fieldF6;
Scene3240 *scene = (Scene3240 *)R2_GLOBALS._sceneManager._scene;
@@ -2665,5 +2919,50 @@ void SpeakerWebbster3400::proc15() {
}
}
+//----------------------------------------------------------------------------
+
+SpeakerDutyOfficer::SpeakerDutyOfficer(): VisualSpeaker() {
+ _speakerName = "DUTYOFFICER";
+ _color1 = 5;
+ _color2 = 0;
+ _fieldF6 = 0;
+ _textWidth = 300;
+ _hideObjects = false;
+ _object2 = NULL;
+ _displayMode = 1;
+ _numFrames = 0;
+}
+
+void SpeakerDutyOfficer::proc15() {
+ Scene180 *scene = (Scene180 *)R2_GLOBALS._sceneManager._scene;
+
+ int v = _fieldF6;
+
+ if (!_object2) {
+ _object2 = &scene->_object2;
+ _object2->hide();
+ _object1.postInit();
+ _object1.setPosition(_object2->_position);
+
+ if (_object2->_mover)
+ _object2->addMover(NULL);
+ }
+
+ switch (v) {
+ case 0:
+ _object1.animate(ANIM_MODE_2, NULL);
+ break;
+ case 1:
+ _action = NULL;
+ _object1.setup(76, 2, 1);
+ _object1.animate(ANIM_MODE_5, this);
+ break;
+ default:
+ signal();
+ break;
+ }
+}
+
+
} // End of namespace Ringworld2
} // End of namespace TsAGE
diff --git a/engines/tsage/ringworld2/ringworld2_speakers.h b/engines/tsage/ringworld2/ringworld2_speakers.h
index cbd440e1a9..e336564c5f 100644
--- a/engines/tsage/ringworld2/ringworld2_speakers.h
+++ b/engines/tsage/ringworld2/ringworld2_speakers.h
@@ -63,6 +63,13 @@ public:
void setDelay(int delay);
};
+class SpeakerGameText : public VisualSpeaker {
+public:
+ SpeakerGameText();
+
+ virtual Common::String getClassName() { return "SpeakerGameText"; }
+};
+
// Classes related to Captain
class SpeakerCaptain3210 : public VisualSpeaker {
@@ -82,6 +89,16 @@ public:
virtual Common::String getClassName() { return "SpeakerCaretaker2450"; }
};
+// Classes related to Chief
+
+class SpeakerChief1100 : public VisualSpeaker {
+public:
+ SpeakerChief1100();
+
+ virtual Common::String getClassName() { return "SpeakerChief1100"; }
+ virtual void proc15();
+};
+
// Classes related to Guard
class SpeakerGuard : public VisualSpeaker {
@@ -136,6 +153,12 @@ public:
virtual void proc15();
};
+class SpeakerMiranda1625 : public SpeakerMiranda {
+public:
+ virtual Common::String getClassName() { return "SpeakerMiranda1625"; }
+ virtual void proc15();
+};
+
class SpeakerMiranda3255 : public SpeakerMiranda {
public:
virtual Common::String getClassName() { return "SpeakerMiranda3255"; }
@@ -253,6 +276,12 @@ public:
virtual void proc15();
};
+class SpeakerQuinn1100 : public SpeakerQuinn {
+public:
+ virtual Common::String getClassName() { return "SpeakerQuinn1100"; }
+ virtual void proc15();
+};
+
class SpeakerQuinn2435 : public SpeakerQuinn {
public:
virtual Common::String getClassName() { return "SpeakerQuinn2435"; }
@@ -385,6 +414,18 @@ public:
virtual void proc15();
};
+class SpeakerSeeker1100 : public SpeakerSeeker {
+public:
+ virtual Common::String getClassName() { return "SpeakerSeeker1100"; }
+ virtual void proc15();
+};
+
+class SpeakerSeeker1900 : public SpeakerSeeker {
+public:
+ virtual Common::String getClassName() { return "SpeakerSeeker1900"; }
+ virtual void proc15();
+};
+
class SpeakerSeeker2435 : public SpeakerSeeker {
public:
virtual Common::String getClassName() { return "SpeakerSeeker2435"; }
@@ -455,14 +496,25 @@ public:
// Classes related to Soldier
-class SpeakerSoldier300 : public VisualSpeaker {
+class SpeakerSoldier : public VisualSpeaker {
public:
- SpeakerSoldier300();
+ SpeakerSoldier(int colour);
+ virtual Common::String getClassName() { return "SpeakerSoldier"; }
+};
+class SpeakerSoldier300 : public SpeakerSoldier {
+public:
+ SpeakerSoldier300() : SpeakerSoldier(60) {};
virtual Common::String getClassName() { return "SpeakerSoldier300"; }
virtual void proc15();
};
+class SpeakerSoldier1625 : public SpeakerSoldier {
+public:
+ SpeakerSoldier1625() : SpeakerSoldier(5) {};
+ virtual Common::String getClassName() { return "SpeakerSoldier1625"; }
+};
+
// Classes related to Teal
class SpeakerTeal : public VisualSpeaker {
@@ -483,6 +535,12 @@ public:
virtual void proc15();
};
+class SpeakerTeal1625 : public SpeakerTeal {
+public:
+ virtual Common::String getClassName() { return "SpeakerTeal1625"; }
+ virtual void proc15();
+};
+
class SpeakerTeal3240 : public SpeakerTeal {
public:
virtual Common::String getClassName() { return "SpeakerTeal3240"; }
@@ -565,6 +623,14 @@ public:
virtual void proc15();
};
+class SpeakerDutyOfficer: public VisualSpeaker {
+public:
+ SpeakerDutyOfficer();
+
+ virtual Common::String getClassName() { return "SpeakerDutyOfficer"; }
+ virtual void proc15();
+};
+
} // End of namespace Ringworld2
} // End of namespace TsAGE
diff --git a/engines/tsage/scenes.cpp b/engines/tsage/scenes.cpp
index 9d75808dbf..c091afe34c 100644
--- a/engines/tsage/scenes.cpp
+++ b/engines/tsage/scenes.cpp
@@ -164,7 +164,7 @@ void SceneManager::changeScene(int newSceneNumber) {
sceneObj->setObjectWrapper(NULL);
sceneObj->animate(ANIM_MODE_NONE, 0);
- sceneObj->_flags &= !OBJFLAG_PANES;
+ sceneObj->_flags &= ~OBJFLAG_PANES;
}
// Blank out the screen
diff --git a/engines/tsage/staticres.cpp b/engines/tsage/staticres.cpp
index cc93c4f35f..c254565aca 100644
--- a/engines/tsage/staticres.cpp
+++ b/engines/tsage/staticres.cpp
@@ -237,6 +237,217 @@ char const *const F7 = "F7";
char const *const F8 = "F8";
char const *const F10 = "F10";
+char const *const DONE_MSG = "Done";
+char const *const YES_MSG = " Yes ";
+char const *const NO_MSG = " No ";
+char const *const USE_INTERCEPTOR = "Do you want to use your interceptor card?";
+char const *const USE_DOUBLE_AGENT = "Do you want to use your double agent?";
+char const *const NEED_INSTRUCTIONS = "Do you want instructions?";
+char const *const WRONG_ANSWER_MSG = "Wrong respond value sent.";
+const byte k562CC[] = {
+ 20, 7, 41, 6,
+ 3, 6, 42, 11,
+ 10, 15, 43, 6,
+ 15, 1, 44, 7,
+ 1, 1, 2, 1,
+ 1, 1, 21, 12,
+ 5, 1, 36, 1,
+ 5, 1, 28, 2,
+ 9, 1, 10, 7,
+ 9, 1, 12, 10,
+ 19, 1, 10, 8,
+ 19, 1, 2, 13,
+ 25, 1, 31, 1,
+ 27, 1, 15, 6,
+ 27, 1, 20, 7,
+ 28, 1, 24, 4,
+ 6, 2, 22, 1,
+ 6, 2, 16, 5,
+ 12, 2, 40, 1,
+ 12, 2, 6, 11,
+ 18, 2, 21, 5,
+ 20, 5, 19, 4,
+ 20, 5, 18, 8,
+ 1, 6, 20, 11,
+ 1, 6, 18, 15,
+ 1, 6, 16, 4,
+ 7, 6, 6, 16,
+ 8, 6, 23, 9,
+ 8, 6, 38, 10,
+ 8, 6, 14, 13,
+ 8, 6, 6, 14,
+ 8, 6, 11, 15,
+ 10, 6, 3, 1,
+ 10, 6, 8, 2,
+ 10, 6, 13, 3,
+ 10, 6, 6, 15,
+ 17, 6, 4, 15,
+ 5, 7, 26, 11,
+ 25, 7, 27, 3,
+ 28, 7, 21, 5,
+ 2, 8, 23, 5,
+ 14, 8, 21, 5,
+ 14, 8, 22, 16,
+ 22, 8, 34, 3,
+ 22, 8, 24, 7,
+ 6, 9, 38, 5,
+ 6, 9, 32, 6,
+ 6, 9, 18, 7,
+ 9, 9, 34, 15,
+ 9, 9, 35, 16,
+ 18, 9, 1, 5,
+ 18, 9, 24, 11,
+ 26, 9, 21, 10,
+ 1, 10, 21, 9,
+ 1, 10, 12, 13,
+ 11, 10, 21, 16,
+ 15, 10, 8, 1,
+ 15, 10, 12, 6,
+ 15, 10, 14, 10,
+ 20, 10, 14, 10,
+ 20, 10, 39, 11,
+ 3, 11, 5, 9,
+ 3, 11, 4, 13,
+ 5, 11, 32, 7,
+ 5, 11, 20, 8,
+ 5, 11, 20, 11,
+ 7, 12, 22, 11,
+ 7, 12, 2, 12,
+ 7, 12, 23, 16,
+ 8, 12, 25, 9,
+ 13, 12, 23, 10,
+ 16, 12, 3, 11,
+ 17, 12, 25, 10,
+ 17, 12, 28, 15,
+ 25, 12, 8, 15,
+ 26, 12, 7, 14,
+ 1, 13, 8, 6,
+ 10, 13, 28, 11,
+ 21, 13, 25, 13,
+ 21, 13, 24, 16,
+ 25, 13, 25, 3,
+ 5, 14, 17, 6,
+ 5, 14, 23, 16,
+ 12, 14, 36, 15,
+ 12, 14, 17, 16,
+ 13, 14, 40, 13,
+ 13, 14, 38, 14,
+ 19, 14, 18, 10,
+ 2, 15, 4, 14,
+ 8, 15, 1, 13,
+ 12, 15, 21, 4,
+ 12, 15, 27, 7,
+ 12, 15, 28, 8,
+ 13, 15, 34, 1,
+ 13, 15, 31, 5,
+ 14, 15, 21, 16,
+ 15, 15, 29, 1,
+ 15, 15, 23, 13,
+ 25, 15, 24, 6,
+ 25, 15, 23, 11,
+ 28, 15, 8, 6,
+ 28, 15, 9, 10,
+ 1, 16, 1, 1,
+ 1, 16, 22, 5,
+ 7, 16, 3, 4,
+ 8, 16, 7, 1,
+ 11, 17, 4, 12,
+ 18, 17, 1, 13,
+ 22, 17, 21, 6,
+ 22, 17, 28, 15,
+ 27, 17, 12, 7,
+ 27, 17, 8, 8,
+ 27, 17, 14, 11,
+ 27, 17, 18, 15,
+ 27, 17, 2, 16,
+ 6, 18, 24, 7,
+ 14, 18, 21, 13,
+ 27, 18, 38, 4,
+ 28, 18, 20, 1,
+ 1, 18, 11, 15,
+ 9, 18, 7, 1,
+ 9, 18, 13, 12,
+ 16, 18, 32, 10,
+ 16, 18, 25, 13,
+ 16, 18, 31, 14,
+ 25, 18, 20, 7,
+ 28, 18, 21, 1
+};
+
+const byte k5A4D6[] = {
+ 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3,
+ 16, 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, 18,
+ 17, 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, 19,
+ 7, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12,
+ 6, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12,
+ 11, 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, 12,
+ 11, 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, 12,
+ 11, 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, 12,
+ 11, 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, 12,
+ 11, 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, 12,
+ 11, 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, 12,
+ 11, 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, 12,
+ 11, 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, 12,
+ 11, 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, 12,
+ 11, 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, 12,
+ 11, 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, 12,
+ 11, 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, 12,
+ 11, 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, 12,
+ 13, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 14
+};
+
+const byte k5A72E[] = {0, 98, 135, 183, 229, 81, 133, 185, 235, 75, 131, 187, 241, 70, 129, 190, 247};
+const byte k5A73F[] = {0, 42, 42, 42, 42, 67, 67, 67, 67, 92, 92, 92, 92, 116, 116, 116, 116};
+const byte k5A750[] = {
+ 9, 10, 7, 13, 7, 8, 9, 7, 9, 10,
+ 2, 3, 3, 2, 2, 2, 4, 3, 3, 4,
+ 3, 2, 3, 4, 3, 8, 10, 4, 0
+};
+const byte k5A76D[] = {
+ 3, 3, 3, 4, 3, 3, 3, 3, 1, 3,
+ 3, 3, 3, 7, 3, 7, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3
+};
+const byte k5A78A[] = {0, 8, 15, 16, 12, 7, 18, 17, 13, 6, 19, 20, 14, 5, 11, 10, 9};
+const byte k5A79B[] = {
+ 23, 3, 1,
+ 23, 4, 1,
+ 26, 3, 1,
+ 26, 4, 1,
+ 15, 16, 2,
+ 2, 16, 3,
+ 3, 16, 4,
+ 10, 7, 5,
+ 11, 7, 6,
+ 3, 0, 7,
+ 4, 0, 8,
+ 24, 11, 9,
+ 25, 11, 10,
+ 12, 8, 11,
+ 9, 11, 12
+};
+
+const byte k5A7F6[] = {
+ 4, 11, 6,
+ 5, 14, 5,
+ 5, 11, 6,
+ 5, 7, 5,
+ 6, 9, 6,
+ 7, 16, 7,
+ 7, 12, 7,
+ 8, 6, 5,
+ 9, 9, 7,
+ 10, 13, 9,
+ 10, 6, 8,
+ 11, 10, 9,
+ 12, 15, 10,
+ 13, 12, 11,
+ 14, 8, 9,
+ 15, 16, 1,
+ 15, 10, 11
+};
+
} // End of namespace Ringworld2
} // End of namespace TsAGE
diff --git a/engines/tsage/staticres.h b/engines/tsage/staticres.h
index 5b6f4393c4..e3daf73333 100644
--- a/engines/tsage/staticres.h
+++ b/engines/tsage/staticres.h
@@ -190,6 +190,25 @@ extern char const *const F7;
extern char const *const F8;
extern char const *const F10;
+extern char const *const DONE_MSG;
+extern char const *const YES_MSG;
+extern char const *const NO_MSG;
+extern char const *const USE_INTERCEPTOR;
+extern char const *const USE_DOUBLE_AGENT;
+extern char const *const NEED_INSTRUCTIONS;
+extern char const *const WRONG_ANSWER_MSG;
+
+// Scene 1550 arrays of constants
+extern const byte k562CC[];
+extern const byte k5A4D6[];
+extern const byte k5A72E[];
+extern const byte k5A73F[];
+extern const byte k5A750[];
+extern const byte k5A76D[];
+extern const byte k5A78A[];
+extern const byte k5A79B[];
+extern const byte k5A7F6[];
+
} // End of namespace Ringworld2
} // End of namespace TsAGE
diff --git a/engines/tsage/user_interface.cpp b/engines/tsage/user_interface.cpp
index 2d06e268e4..ca9fddc6ce 100644
--- a/engines/tsage/user_interface.cpp
+++ b/engines/tsage/user_interface.cpp
@@ -82,7 +82,7 @@ void UIQuestion::showDescription(CursorType cursor) {
}
break;
case GType_Ringworld2:
- if ((cursor == R2_9) || (cursor == R2_39)) {
+ if ((cursor == R2_COM_SCANNER) || (cursor == R2_COM_SCANNER_2)) {
// Show communicator
warning("TODO: Communicator");
} else {
@@ -199,9 +199,9 @@ void UIInventoryScroll::process(Event &event) {
// Draw the button as selected
toggle(true);
- event.handled = true;
- break;
- case EVENT_BUTTON_UP:
+ // Wait for the mouse to be released
+ BF_GLOBALS._events.waitForPress(EVENT_BUTTON_UP);
+
// Restore unselected version
toggle(false);
diff --git a/engines/tucker/saveload.cpp b/engines/tucker/saveload.cpp
index 5bc51acf84..5133bc15e8 100644
--- a/engines/tucker/saveload.cpp
+++ b/engines/tucker/saveload.cpp
@@ -49,7 +49,7 @@ static void saveOrLoadInt(Common::ReadStream &stream, int &i) {
i = stream.readSint32LE();
}
-template <class S>
+template<class S>
void TuckerEngine::saveOrLoadGameStateData(S &s) {
for (int i = 0; i < kFlagsTableSize; ++i) {
saveOrLoadInt(s, _flagsTable[i]);
diff --git a/engines/tucker/tucker.h b/engines/tucker/tucker.h
index 3daf75d44a..c9e4d986bb 100644
--- a/engines/tucker/tucker.h
+++ b/engines/tucker/tucker.h
@@ -563,7 +563,7 @@ protected:
void updateSprite_locationNum81_1(int i);
void updateSprite_locationNum82(int i);
- template <class S> void saveOrLoadGameStateData(S &s);
+ template<class S> void saveOrLoadGameStateData(S &s);
virtual Common::Error loadGameState(int num);
virtual Common::Error saveGameState(int num, const Common::String &description);
virtual bool canLoadGameStateCurrently();
diff --git a/graphics/VectorRendererSpec.cpp b/graphics/VectorRendererSpec.cpp
index ce363d3461..7817725664 100644
--- a/graphics/VectorRendererSpec.cpp
+++ b/graphics/VectorRendererSpec.cpp
@@ -77,7 +77,7 @@ inline frac_t fp_sqroot(uint32 x) {
HELPER MACROS for Bresenham's circle drawing algorithm
Note the proper spelling on this header.
*/
-#define BE_ALGORITHM() { \
+#define BE_ALGORITHM() do { \
if (f >= 0) { \
y--; \
ddF_y += 2; \
@@ -87,35 +87,63 @@ inline frac_t fp_sqroot(uint32 x) {
px += pitch; \
ddF_x += 2; \
f += ddF_x + 1; \
-}
+} while(0)
-#define BE_DRAWCIRCLE(ptr1,ptr2,ptr3,ptr4,x,y,px,py) { \
+#define BE_DRAWCIRCLE_TOP(ptr1,ptr2,x,y,px,py) do { \
*(ptr1 + (y) - (px)) = color; \
*(ptr1 + (x) - (py)) = color; \
*(ptr2 - (x) - (py)) = color; \
*(ptr2 - (y) - (px)) = color; \
+} while (0)
+
+#define BE_DRAWCIRCLE_BOTTOM(ptr3,ptr4,x,y,px,py) do { \
*(ptr3 - (y) + (px)) = color; \
*(ptr3 - (x) + (py)) = color; \
*(ptr4 + (x) + (py)) = color; \
*(ptr4 + (y) + (px)) = color; \
-}
+} while (0)
-#define BE_DRAWCIRCLE_XCOLOR(ptr1,ptr2,ptr3,ptr4,x,y,px,py) { \
+#define BE_DRAWCIRCLE(ptr1,ptr2,ptr3,ptr4,x,y,px,py) do { \
+ BE_DRAWCIRCLE_TOP(ptr1,ptr2,x,y,px,py); \
+ BE_DRAWCIRCLE_BOTTOM(ptr3,ptr4,x,y,px,py); \
+} while (0)
+
+#define BE_DRAWCIRCLE_BCOLOR(ptr1,ptr2,ptr3,ptr4,x,y,px,py) do { \
+ *(ptr1 + (y) - (px)) = color1; \
+ *(ptr1 + (x) - (py)) = color1; \
+ *(ptr2 - (x) - (py)) = color1; \
+ *(ptr2 - (y) - (px)) = color1; \
+ *(ptr3 - (y) + (px)) = color1; \
+ *(ptr3 - (x) + (py)) = color1; \
+ *(ptr4 + (x) + (py)) = color2; \
+ *(ptr4 + (y) + (px)) = color2; \
+} while (0)
+
+#define BE_DRAWCIRCLE_XCOLOR_TOP(ptr1,ptr2,x,y,px,py) do { \
*(ptr1 + (y) - (px)) = color1; \
*(ptr1 + (x) - (py)) = color2; \
*(ptr2 - (x) - (py)) = color2; \
*(ptr2 - (y) - (px)) = color1; \
+} while (0)
+
+#define BE_DRAWCIRCLE_XCOLOR_BOTTOM(ptr3,ptr4,x,y,px,py) do { \
*(ptr3 - (y) + (px)) = color3; \
*(ptr3 - (x) + (py)) = color4; \
*(ptr4 + (x) + (py)) = color4; \
*(ptr4 + (y) + (px)) = color3; \
-}
+} while (0)
-#define BE_RESET() { \
+#define BE_DRAWCIRCLE_XCOLOR(ptr1,ptr2,ptr3,ptr4,x,y,px,py) do { \
+ BE_DRAWCIRCLE_XCOLOR_TOP(ptr1,ptr2,x,y,px,py); \
+ BE_DRAWCIRCLE_XCOLOR_BOTTOM(ptr3,ptr4,x,y,px,py); \
+} while (0)
+
+
+#define BE_RESET() do { \
f = 1 - r; \
ddF_x = 0; ddF_y = -2 * r; \
x = 0; y = r; px = 0; py = pitch * r; \
-}
+} while (0)
#define TRIANGLE_MAINX() \
if (error_term >= 0) { \
@@ -140,19 +168,63 @@ inline frac_t fp_sqroot(uint32 x) {
ptr_left += pitch;
/** HELPER MACROS for WU's circle drawing algorithm **/
-#define WU_DRAWCIRCLE(ptr1,ptr2,ptr3,ptr4,x,y,px,py,a) { \
+#define WU_DRAWCIRCLE_TOP(ptr1,ptr2,x,y,px,py,a) do { \
this->blendPixelPtr(ptr1 + (y) - (px), color, a); \
this->blendPixelPtr(ptr1 + (x) - (py), color, a); \
this->blendPixelPtr(ptr2 - (x) - (py), color, a); \
this->blendPixelPtr(ptr2 - (y) - (px), color, a); \
+} while (0)
+
+#define WU_DRAWCIRCLE_BOTTOM(ptr3,ptr4,x,y,px,py,a) do { \
this->blendPixelPtr(ptr3 - (y) + (px), color, a); \
this->blendPixelPtr(ptr3 - (x) + (py), color, a); \
this->blendPixelPtr(ptr4 + (x) + (py), color, a); \
this->blendPixelPtr(ptr4 + (y) + (px), color, a); \
-}
+} while (0)
+
+#define WU_DRAWCIRCLE(ptr1,ptr2,ptr3,ptr4,x,y,px,py,a) do { \
+ WU_DRAWCIRCLE_TOP(ptr1,ptr2,x,y,px,py,a); \
+ WU_DRAWCIRCLE_BOTTOM(ptr3,ptr4,x,y,px,py,a); \
+} while (0)
+
+
+// Color depending on y
+// Note: this is only for the outer pixels
+#define WU_DRAWCIRCLE_XCOLOR_TOP(ptr1,ptr2,x,y,px,py,a,func) do { \
+ this->func(ptr1 + (y) - (px), color1, a); \
+ this->func(ptr1 + (x) - (py), color2, a); \
+ this->func(ptr2 - (x) - (py), color2, a); \
+ this->func(ptr2 - (y) - (px), color1, a); \
+} while (0)
+
+#define WU_DRAWCIRCLE_XCOLOR_BOTTOM(ptr3,ptr4,x,y,px,py,a,func) do { \
+ this->func(ptr3 - (y) + (px), color3, a); \
+ this->func(ptr3 - (x) + (py), color4, a); \
+ this->func(ptr4 + (x) + (py), color4, a); \
+ this->func(ptr4 + (y) + (px), color3, a); \
+} while (0)
+
+#define WU_DRAWCIRCLE_XCOLOR(ptr1,ptr2,ptr3,ptr4,x,y,px,py,a,func) do { \
+ WU_DRAWCIRCLE_XCOLOR_TOP(ptr1,ptr2,x,y,px,py,a,func); \
+ WU_DRAWCIRCLE_XCOLOR_BOTTOM(ptr3,ptr4,x,y,px,py,a,func); \
+} while (0)
+
+// Color depending on corner (tl,tr,bl: color1, br: color2)
+// Note: this is only for the outer pixels
+#define WU_DRAWCIRCLE_BCOLOR(ptr1,ptr2,ptr3,ptr4,x,y,px,py,a) do { \
+ this->blendPixelPtr(ptr1 + (y) - (px), color1, a); \
+ this->blendPixelPtr(ptr1 + (x) - (py), color1, a); \
+ this->blendPixelPtr(ptr2 - (x) - (py), color1, a); \
+ this->blendPixelPtr(ptr2 - (y) - (px), color1, a); \
+ this->blendPixelPtr(ptr3 - (y) + (px), color1, a); \
+ this->blendPixelPtr(ptr3 - (x) + (py), color1, a); \
+ this->blendPixelPtr(ptr4 + (x) + (py), color2, a); \
+ this->blendPixelPtr(ptr4 + (y) + (px), color2, a); \
+} while (0)
+
// optimized Wu's algorithm
-#define WU_ALGORITHM() { \
+#define WU_ALGORITHM() do { \
oldT = T; \
T = fp_sqroot(rsq - y*y) ^ 0xFFFF; \
py += pitch; \
@@ -160,8 +232,8 @@ inline frac_t fp_sqroot(uint32 x) {
x--; px -= pitch; \
} \
a2 = (T >> 8); \
- a1 = ~a2 >> 4; \
-}
+ a1 = ~a2; \
+} while (0)
namespace Graphics {
@@ -447,18 +519,10 @@ applyScreenShading(GUI::ThemeEngine::ShadingStyle shadingStyle) {
if (shadingStyle == GUI::ThemeEngine::kShadingDim) {
- int n = (pixels + 7) >> 3;
- switch (pixels % 8) {
- case 0: do {
- *ptr = (*ptr & colorMask) >> 1; ++ptr;
- case 7: *ptr = (*ptr & colorMask) >> 1; ++ptr;
- case 6: *ptr = (*ptr & colorMask) >> 1; ++ptr;
- case 5: *ptr = (*ptr & colorMask) >> 1; ++ptr;
- case 4: *ptr = (*ptr & colorMask) >> 1; ++ptr;
- case 3: *ptr = (*ptr & colorMask) >> 1; ++ptr;
- case 2: *ptr = (*ptr & colorMask) >> 1; ++ptr;
- case 1: *ptr = (*ptr & colorMask) >> 1; ++ptr;
- } while (--n > 0);
+ // TODO: Check how this interacts with kFeatureOverlaySupportsAlpha
+ for (int i = 0; i < pixels; ++i) {
+ *ptr = ((*ptr & colorMask) >> 1) | _alphaMask;
+ ++ptr;
}
} else if (shadingStyle == GUI::ThemeEngine::kShadingLuminance) {
@@ -473,8 +537,8 @@ applyScreenShading(GUI::ThemeEngine::ShadingStyle shadingStyle) {
template<typename PixelType>
inline void VectorRendererSpec<PixelType>::
blendPixelPtr(PixelType *ptr, PixelType color, uint8 alpha) {
- register int idst = *ptr;
- register int isrc = color;
+ int idst = *ptr;
+ int isrc = color;
*ptr = (PixelType)(
(_redMask & ((idst & _redMask) +
@@ -486,9 +550,53 @@ blendPixelPtr(PixelType *ptr, PixelType color, uint8 alpha) {
(_blueMask & ((idst & _blueMask) +
((int)(((int)(isrc & _blueMask) -
(int)(idst & _blueMask)) * alpha) >> 8))) |
- (_alphaMask & ((idst & _alphaMask) +
- ((alpha >> _format.aLoss) << _format.aShift) -
- (((int)(idst & _alphaMask) * alpha) >> 8))));
+ (idst & _alphaMask));
+}
+
+template<typename PixelType>
+inline void VectorRendererSpec<PixelType>::
+blendPixelDestAlphaPtr(PixelType *ptr, PixelType color, uint8 alpha) {
+ int idst = *ptr;
+ // This function is only used for corner pixels in rounded rectangles, so
+ // the performance hit of this if shouldn't be too high.
+ // We're also ignoring the cases where dst has intermediate alpha.
+ if ((idst & _alphaMask) == 0) {
+ // set color and alpha channels
+ *ptr = (PixelType)(color & (_redMask | _greenMask | _blueMask)) |
+ ((alpha >> _format.aLoss) << _format.aShift);
+ } else {
+ // blend color with background
+ blendPixelPtr(ptr, color, alpha);
+ }
+}
+
+template<typename PixelType>
+inline void VectorRendererSpec<PixelType>::
+darkenFill(PixelType *ptr, PixelType *end) {
+ PixelType mask = (PixelType)((3 << _format.rShift) | (3 << _format.gShift) | (3 << _format.bShift));
+
+ if (!g_system->hasFeature(OSystem::kFeatureOverlaySupportsAlpha)) {
+ // !kFeatureOverlaySupportsAlpha (but might have alpha bits)
+
+ while (ptr != end) {
+ *ptr = ((*ptr & ~mask) >> 2) | _alphaMask;
+ ++ptr;
+ }
+ } else {
+ // kFeatureOverlaySupportsAlpha
+ // assuming at least 3 alpha bits
+
+ mask |= 3 << _format.aShift;
+ PixelType addA = (PixelType)(255 >> _format.aLoss) << _format.aShift;
+ addA -= (addA >> 2);
+
+ while (ptr != end) {
+ // Darken the colour, and increase the alpha
+ // (0% -> 75%, 100% -> 100%)
+ *ptr = (PixelType)(((*ptr & ~mask) >> 2) + addA);
+ ++ptr;
+ }
+ }
}
/********************************************************************
@@ -674,36 +782,7 @@ drawRoundedSquare(int x, int y, int r, int w, int h) {
drawRoundedSquareShadow(x, y, r, w, h, Base::_shadowOffset);
}
- switch (Base::_fillMode) {
- case kFillDisabled:
- if (Base::_strokeWidth)
- drawRoundedSquareAlg(x, y, r, w, h, _fgColor, kFillDisabled);
- break;
-
- case kFillForeground:
- drawRoundedSquareAlg(x, y, r, w, h, _fgColor, kFillForeground);
- break;
-
- case kFillBackground:
- VectorRendererSpec::drawRoundedSquareAlg(x, y, r, w, h, _bgColor, kFillBackground);
- drawRoundedSquareAlg(x, y, r, w, h, _fgColor, kFillDisabled);
- break;
-
- case kFillGradient:
- if (Base::_strokeWidth > 1) {
- drawRoundedSquareAlg(x, y, r, w, h, _fgColor, kFillForeground);
- VectorRendererSpec::drawRoundedSquareAlg(x + Base::_strokeWidth/2, y + Base::_strokeWidth/2,
- r - Base::_strokeWidth/2, w - Base::_strokeWidth, h - Base::_strokeWidth, 0, kFillGradient);
- } else {
- VectorRendererSpec::drawRoundedSquareAlg(x, y, r, w, h, 0, kFillGradient);
- if (Base::_strokeWidth)
- drawRoundedSquareAlg(x, y, r, w, h, _fgColor, kFillDisabled);
- }
- break;
- }
-
- if (Base::_bevel)
- drawRoundedSquareFakeBevel(x, y, r, w, h, Base::_bevel);
+ drawRoundedSquareAlg(x, y, r, w, h, _fgColor, Base::_fillMode);
}
template<typename PixelType>
@@ -722,10 +801,14 @@ drawTab(int x, int y, int r, int w, int h) {
switch (Base::_fillMode) {
case kFillDisabled:
+ // FIXME: Implement this
return;
case kFillGradient:
case kFillBackground:
+ // FIXME: This is broken for the AA renderer.
+ // See the rounded rect alg for how to fix it. (The border should
+ // be drawn before the interior, both inside drawTabAlg.)
drawTabAlg(x, y, w, h, r, (Base::_fillMode == kFillBackground) ? _bgColor : _fgColor, Base::_fillMode);
if (Base::_strokeWidth)
drawTabAlg(x, y, w, h, r, _fgColor, kFillDisabled, (Base::_dynamicData >> 16), (Base::_dynamicData & 0xFFFF));
@@ -842,17 +925,10 @@ drawTabAlg(int x1, int y1, int w, int h, int r, PixelType color, VectorRenderer:
while (x++ < y) {
BE_ALGORITHM();
- *(ptr_tr + (y) - (px)) = color;
- *(ptr_tr + (x) - (py)) = color;
- *(ptr_tl - (x) - (py)) = color;
- *(ptr_tl - (y) - (px)) = color;
+ BE_DRAWCIRCLE_TOP(ptr_tr, ptr_tl, x, y, px, py);
- if (Base::_strokeWidth > 1) {
- *(ptr_tr + (y) - (px - pitch)) = color;
- *(ptr_tr + (x) - (py)) = color;
- *(ptr_tl - (x) - (py)) = color;
- *(ptr_tl - (y) - (px - pitch)) = color;
- }
+ if (Base::_strokeWidth > 1)
+ BE_DRAWCIRCLE_TOP(ptr_tr, ptr_tl, x, y, px - pitch, py);
}
}
@@ -898,18 +974,12 @@ drawTabAlg(int x1, int y1, int w, int h, int r, PixelType color, VectorRenderer:
gradientFill(ptr_tl - x - py, w - 2 * r + 2 * x, x1 + r - x - y, real_radius - y);
gradientFill(ptr_tl - y - px, w - 2 * r + 2 * y, x1 + r - y - x, real_radius - x);
- *(ptr_tr + (y) - (px)) = color1;
- *(ptr_tr + (x) - (py)) = color2;
- *(ptr_tl - (x) - (py)) = color2;
- *(ptr_tl - (y) - (px)) = color1;
+ BE_DRAWCIRCLE_XCOLOR_TOP(ptr_tr, ptr_tl, x, y, px, py);
} else {
colorFill<PixelType>(ptr_tl - x - py, ptr_tr + x - py, color);
colorFill<PixelType>(ptr_tl - y - px, ptr_tr + y - px, color);
- *(ptr_tr + (y) - (px)) = color;
- *(ptr_tr + (x) - (py)) = color;
- *(ptr_tl - (x) - (py)) = color;
- *(ptr_tl - (y) - (px)) = color;
+ BE_DRAWCIRCLE_TOP(ptr_tr, ptr_tl, x, y, px, py);
}
}
@@ -1013,8 +1083,9 @@ drawBevelSquareAlg(int x, int y, int w, int h, int bevel, PixelType top_color, P
PixelType *ptr_fill = (PixelType *)_activeSurface->getBasePtr(x, y);
if (fill) {
+ assert((_bgColor & ~_alphaMask) == 0); // only support black
while (height--) {
- blendFill(ptr_fill, ptr_fill + w, _bgColor, 200);
+ darkenFill(ptr_fill, ptr_fill + w);
ptr_fill += pitch;
}
}
@@ -1362,49 +1433,28 @@ drawRoundedSquareAlg(int x1, int y1, int r, int w, int h, PixelType color, Vecto
int f, ddF_x, ddF_y;
int x, y, px, py;
int pitch = _activeSurface->pitch / _activeSurface->format.bytesPerPixel;
- int sw = 0, sp = 0, hp = h * pitch;
- PixelType *ptr_tl = (PixelType *)Base::_activeSurface->getBasePtr(x1 + r, y1 + r);
- PixelType *ptr_tr = (PixelType *)Base::_activeSurface->getBasePtr(x1 + w - r, y1 + r);
- PixelType *ptr_bl = (PixelType *)Base::_activeSurface->getBasePtr(x1 + r, y1 + h - r);
- PixelType *ptr_br = (PixelType *)Base::_activeSurface->getBasePtr(x1 + w - r, y1 + h - r);
- PixelType *ptr_fill = (PixelType *)Base::_activeSurface->getBasePtr(x1, y1);
+ // TODO: Split this up into border, bevel and interior functions
- int real_radius = r;
- int short_h = h - (2 * r) + 2;
- int long_h = h;
-
- if (fill_m == kFillDisabled) {
- while (sw++ < Base::_strokeWidth) {
- colorFill<PixelType>(ptr_fill + sp + r, ptr_fill + w + 1 + sp - r, color);
- colorFill<PixelType>(ptr_fill + hp - sp + r, ptr_fill + w + hp + 1 - sp - r, color);
- sp += pitch;
-
- BE_RESET();
- r--;
-
- while (x++ < y) {
- BE_ALGORITHM();
- BE_DRAWCIRCLE(ptr_tr, ptr_tl, ptr_bl, ptr_br, x, y, px, py);
+ if (fill_m != kFillDisabled) {
+ PixelType *ptr_tl = (PixelType *)Base::_activeSurface->getBasePtr(x1 + r, y1 + r);
+ PixelType *ptr_tr = (PixelType *)Base::_activeSurface->getBasePtr(x1 + w - r, y1 + r);
+ PixelType *ptr_bl = (PixelType *)Base::_activeSurface->getBasePtr(x1 + r, y1 + h - r);
+ PixelType *ptr_br = (PixelType *)Base::_activeSurface->getBasePtr(x1 + w - r, y1 + h - r);
+ PixelType *ptr_fill = (PixelType *)Base::_activeSurface->getBasePtr(x1, y1);
- if (Base::_strokeWidth > 1) {
- BE_DRAWCIRCLE(ptr_tr, ptr_tl, ptr_bl, ptr_br, x - 1, y, px, py);
- BE_DRAWCIRCLE(ptr_tr, ptr_tl, ptr_bl, ptr_br, x, y, px - pitch, py);
- }
- }
- }
+ int real_radius = r;
+ int short_h = h - (2 * r) + 2;
+ int long_h = h;
- ptr_fill += pitch * real_radius;
- while (short_h--) {
- colorFill<PixelType>(ptr_fill, ptr_fill + Base::_strokeWidth, color);
- colorFill<PixelType>(ptr_fill + w - Base::_strokeWidth + 1, ptr_fill + w + 1, color);
- ptr_fill += pitch;
- }
- } else {
BE_RESET();
- PixelType color1, color2, color3, color4;
+
+ PixelType color1 = color;
+ if (fill_m == kFillBackground)
+ color1 = _bgColor;
if (fill_m == kFillGradient) {
+ PixelType color2, color3, color4;
precalcGradient(long_h);
while (x++ < y) {
@@ -1427,11 +1477,11 @@ drawRoundedSquareAlg(int x1, int y1, int r, int w, int h, PixelType color, Vecto
while (x++ < y) {
BE_ALGORITHM();
- colorFill<PixelType>(ptr_tl - x - py, ptr_tr + x - py, color);
- colorFill<PixelType>(ptr_tl - y - px, ptr_tr + y - px, color);
+ colorFill<PixelType>(ptr_tl - x - py, ptr_tr + x - py, color1);
+ colorFill<PixelType>(ptr_tl - y - px, ptr_tr + y - px, color1);
- colorFill<PixelType>(ptr_bl - x + py, ptr_br + x + py, color);
- colorFill<PixelType>(ptr_bl - y + px, ptr_br + y + px, color);
+ colorFill<PixelType>(ptr_bl - x + py, ptr_br + x + py, color1);
+ colorFill<PixelType>(ptr_bl - y + px, ptr_br + y + px, color1);
// do not remove - messes up the drawing at lower resolutions
BE_DRAWCIRCLE(ptr_tr, ptr_tl, ptr_bl, ptr_br, x, y, px, py);
@@ -1443,8 +1493,53 @@ drawRoundedSquareAlg(int x1, int y1, int r, int w, int h, PixelType color, Vecto
if (fill_m == kFillGradient) {
gradientFill(ptr_fill, w + 1, x1, real_radius++);
} else {
- colorFill<PixelType>(ptr_fill, ptr_fill + w + 1, color);
+ colorFill<PixelType>(ptr_fill, ptr_fill + w + 1, color1);
+ }
+ ptr_fill += pitch;
+ }
+ }
+
+
+ if (Base::_strokeWidth) {
+ int sw = 0, sp = 0, hp = h * pitch;
+
+ PixelType *ptr_tl = (PixelType *)Base::_activeSurface->getBasePtr(x1 + r, y1 + r);
+ PixelType *ptr_tr = (PixelType *)Base::_activeSurface->getBasePtr(x1 + w - r, y1 + r);
+ PixelType *ptr_bl = (PixelType *)Base::_activeSurface->getBasePtr(x1 + r, y1 + h - r);
+ PixelType *ptr_br = (PixelType *)Base::_activeSurface->getBasePtr(x1 + w - r, y1 + h - r);
+ PixelType *ptr_fill = (PixelType *)Base::_activeSurface->getBasePtr(x1, y1);
+
+ int real_radius = r;
+ int short_h = h - (2 * r) + 2;
+
+ // TODO: A gradient effect on the bevel
+ PixelType color1, color2;
+ color1 = Base::_bevel ? _bevelColor : color;
+ color2 = color;
+
+ while (sw++ < Base::_strokeWidth) {
+ colorFill<PixelType>(ptr_fill + sp + r, ptr_fill + w + 1 + sp - r, color1);
+ colorFill<PixelType>(ptr_fill + hp - sp + r, ptr_fill + w + hp + 1 - sp - r, color2);
+ sp += pitch;
+
+ BE_RESET();
+ r--;
+
+ while (x++ < y) {
+ BE_ALGORITHM();
+ BE_DRAWCIRCLE_BCOLOR(ptr_tr, ptr_tl, ptr_bl, ptr_br, x, y, px, py);
+
+ if (Base::_strokeWidth > 1) {
+ BE_DRAWCIRCLE_BCOLOR(ptr_tr, ptr_tl, ptr_bl, ptr_br, x - 1, y, px, py);
+ BE_DRAWCIRCLE_BCOLOR(ptr_tr, ptr_tl, ptr_bl, ptr_br, x, y, px - pitch, py);
+ }
}
+ }
+
+ ptr_fill += pitch * real_radius;
+ while (short_h--) {
+ colorFill<PixelType>(ptr_fill, ptr_fill + Base::_strokeWidth, color1);
+ colorFill<PixelType>(ptr_fill + w - Base::_strokeWidth + 1, ptr_fill + w + 1, color2);
ptr_fill += pitch;
}
}
@@ -1586,64 +1681,6 @@ drawRoundedSquareShadow(int x1, int y1, int r, int w, int h, int blur) {
}
}
-template<typename PixelType>
-void VectorRendererSpec<PixelType>::
-drawRoundedSquareFakeBevel(int x1, int y1, int r, int w, int h, int amount) {
- int x, y;
- const int pitch = _activeSurface->pitch / _activeSurface->format.bytesPerPixel;
- int px, py;
- int sw = 0, sp = 0;
-
- uint32 rsq = r*r;
- frac_t T = 0, oldT;
- uint8 a1, a2;
-
- PixelType color = _bevelColor; //_format.RGBToColor(63, 60, 17);
-
- PixelType *ptr_tl = (PixelType *)Base::_activeSurface->getBasePtr(x1 + r, y1 + r);
- PixelType *ptr_tr = (PixelType *)Base::_activeSurface->getBasePtr(x1 + w - r, y1 + r);
- PixelType *ptr_bl = (PixelType *)Base::_activeSurface->getBasePtr(x1 + r, y1 + h - r);
- PixelType *ptr_fill = (PixelType *)Base::_activeSurface->getBasePtr(x1, y1);
-
- int short_h = h - 2 * r;
-
- while (sw++ < amount) {
- colorFill<PixelType>(ptr_fill + sp + r, ptr_fill + w + 1 + sp - r, color);
- sp += pitch;
-
- x = r - (sw - 1);
- y = 0;
- T = 0;
- px = pitch * x;
- py = 0;
-
- while (x > y++) {
- WU_ALGORITHM();
-
- blendPixelPtr(ptr_tr + (y) - (px - pitch), color, a2);
- blendPixelPtr(ptr_tr + (x - 1) - (py), color, a2);
- blendPixelPtr(ptr_tl - (x - 1) - (py), color, a2);
- blendPixelPtr(ptr_tl - (y) - (px - pitch), color, a2);
- blendPixelPtr(ptr_bl - (y) + (px - pitch), color, a2);
- blendPixelPtr(ptr_bl - (x - 1) + (py), color, a2);
-
- blendPixelPtr(ptr_tr + (y) - (px), color, a1);
- blendPixelPtr(ptr_tr + (x) - (py), color, a1);
- blendPixelPtr(ptr_tl - (x) - (py), color, a1);
- blendPixelPtr(ptr_tl - (y) - (px), color, a1);
- blendPixelPtr(ptr_bl - (y) + (px), color, a1);
- blendPixelPtr(ptr_bl - (x) + (py), color, a1);
- }
- }
-
- ptr_fill += pitch * r;
- while (short_h-- >= 0) {
- colorFill<PixelType>(ptr_fill, ptr_fill + amount, color);
- ptr_fill += pitch;
- }
-}
-
-
/******************************************************************************/
@@ -1706,28 +1743,26 @@ drawLineAlg(int x1, int y1, int x2, int y2, int dx, int dy, PixelType color) {
Base::putPixel(x2, y2, color);
}
-/** ROUNDED SQUARES **/
+/** TAB ALGORITHM */
template<typename PixelType>
void VectorRendererAA<PixelType>::
-drawRoundedSquareAlg(int x1, int y1, int r, int w, int h, PixelType color, VectorRenderer::FillMode fill_m) {
- int x, y;
- const int pitch = Base::_activeSurface->pitch / Base::_activeSurface->format.bytesPerPixel;
- int px, py;
- int sw = 0, sp = 0, hp = h * pitch;
+drawTabAlg(int x1, int y1, int w, int h, int r, PixelType color, VectorRenderer::FillMode fill_m, int baseLeft, int baseRight) {
+ int x, y, px, py;
+ int pitch = Base::_activeSurface->pitch / Base::_activeSurface->format.bytesPerPixel;
+ int sw = 0, sp = 0, hp = 0;
- uint32 rsq = r*r;
frac_t T = 0, oldT;
uint8 a1, a2;
+ uint32 rsq = r*r;
PixelType *ptr_tl = (PixelType *)Base::_activeSurface->getBasePtr(x1 + r, y1 + r);
PixelType *ptr_tr = (PixelType *)Base::_activeSurface->getBasePtr(x1 + w - r, y1 + r);
- PixelType *ptr_bl = (PixelType *)Base::_activeSurface->getBasePtr(x1 + r, y1 + h - r);
- PixelType *ptr_br = (PixelType *)Base::_activeSurface->getBasePtr(x1 + w - r, y1 + h - r);
PixelType *ptr_fill = (PixelType *)Base::_activeSurface->getBasePtr(x1, y1);
- int short_h = h - 2 * r;
+ int real_radius = r;
- if (fill_m == VectorRenderer::kFillDisabled) {
+ if (fill_m == Base::kFillDisabled) {
+ color = 0;
while (sw++ < Base::_strokeWidth) {
colorFill<PixelType>(ptr_fill + sp + r, ptr_fill + w + 1 + sp - r, color);
colorFill<PixelType>(ptr_fill + hp - sp + r, ptr_fill + w + hp + 1 - sp - r, color);
@@ -1739,48 +1774,265 @@ drawRoundedSquareAlg(int x1, int y1, int r, int w, int h, PixelType color, Vecto
px = pitch * x;
py = 0;
+
while (x > y++) {
WU_ALGORITHM();
- if (sw != 1 && sw != Base::_strokeWidth)
- a2 = a1 = 255;
+ // sw == 1: outside, sw = _strokeWidth: inside
+ if (sw != Base::_strokeWidth)
+ a2 = 255;
- WU_DRAWCIRCLE(ptr_tr, ptr_tl, ptr_bl, ptr_br, (x - 1), y, (px - pitch), py, a2);
- WU_DRAWCIRCLE(ptr_tr, ptr_tl, ptr_bl, ptr_br, x, y, px, py, a1);
+ // inner arc
+ WU_DRAWCIRCLE_TOP(ptr_tr, ptr_tl, x, y, px, py, a2);
+
+ if (sw == 1) // outer arc
+ WU_DRAWCIRCLE_TOP(ptr_tr, ptr_tl, x, y, px - pitch, py, a1);
}
}
- ptr_fill += pitch * r;
- while (short_h-- >= 0) {
+ int short_h = h - r + 2;
+
+ ptr_fill += pitch * real_radius;
+ while (short_h--) {
colorFill<PixelType>(ptr_fill, ptr_fill + Base::_strokeWidth, color);
colorFill<PixelType>(ptr_fill + w - Base::_strokeWidth + 1, ptr_fill + w + 1, color);
ptr_fill += pitch;
}
+
+ if (baseLeft) {
+ sw = 0;
+ ptr_fill = (PixelType *)Base::_activeSurface->getBasePtr(x1, y1 + h + 1);
+ while (sw++ < Base::_strokeWidth) {
+ colorFill<PixelType>(ptr_fill - baseLeft, ptr_fill, color);
+ ptr_fill += pitch;
+ }
+ }
+
+ if (baseRight) {
+ sw = 0;
+ ptr_fill = (PixelType *)Base::_activeSurface->getBasePtr(x1 + w, y1 + h + 1);
+ while (sw++ < Base::_strokeWidth) {
+ colorFill<PixelType>(ptr_fill, ptr_fill + baseRight, color);
+ ptr_fill += pitch;
+ }
+ }
} else {
- x = r;
+ PixelType color1, color2;
+ color1 = color2 = color;
+
+ int long_h = h;
+ int short_h = h - real_radius + 2;
+ x = real_radius;
y = 0;
T = 0;
px = pitch * x;
py = 0;
- while (x > 1 + y++) {
+ Base::precalcGradient(long_h);
+
+ while (x > y++) {
WU_ALGORITHM();
- colorFill<PixelType>(ptr_tl - x - py, ptr_tr + x - py, color);
- colorFill<PixelType>(ptr_tl - y - px, ptr_tr + y - px, color);
+ if (fill_m == Base::kFillGradient) {
+ color1 = Base::calcGradient(real_radius - x, long_h);
+ color2 = Base::calcGradient(real_radius - y, long_h);
+
+ Base::gradientFill(ptr_tl - x - py + 1, w - 2 * r + 2 * x - 1, x1 + r - x - y + 1, real_radius - y);
+
+ // Only fill each horizontal line once (or we destroy
+ // the gradient effect at the edges)
+ if (T < oldT || y == 1)
+ Base::gradientFill(ptr_tl - y - px + 1, w - 2 * r + 2 * y - 1, x1 + r - y - x + 1, real_radius - x);
+
+ WU_DRAWCIRCLE_XCOLOR_TOP(ptr_tr, ptr_tl, x, y, px, py, a1, Base::blendPixelPtr);
+ } else {
+ colorFill<PixelType>(ptr_tl - x - py + 1, ptr_tr + x - py, color);
+ if (T < oldT || y == 1)
+ colorFill<PixelType>(ptr_tl - y - px + 1, ptr_tr + y - px, color);
+
+ WU_DRAWCIRCLE_TOP(ptr_tr, ptr_tl, x, y, px, py, a1);
+ }
+ }
+
+ ptr_fill += pitch * r;
+ while (short_h--) {
+ if (fill_m == Base::kFillGradient) {
+ Base::gradientFill(ptr_fill, w + 1, x1, real_radius++);
+ } else {
+ colorFill<PixelType>(ptr_fill, ptr_fill + w + 1, color);
+ }
+ ptr_fill += pitch;
+ }
+ }
+}
+
+
+/** ROUNDED SQUARES **/
+template<typename PixelType>
+void VectorRendererAA<PixelType>::
+drawRoundedSquareAlg(int x1, int y1, int r, int w, int h, PixelType color, VectorRenderer::FillMode fill_m) {
+ int x, y;
+ const int pitch = Base::_activeSurface->pitch / Base::_activeSurface->format.bytesPerPixel;
+ int px, py;
+
+ uint32 rsq = r*r;
+ frac_t T = 0, oldT;
+ uint8 a1, a2;
+
+ // TODO: Split this up into border, bevel and interior functions
+
+ if (Base::_strokeWidth) {
+ PixelType *ptr_tl = (PixelType *)Base::_activeSurface->getBasePtr(x1 + r, y1 + r);
+ PixelType *ptr_tr = (PixelType *)Base::_activeSurface->getBasePtr(x1 + w - r, y1 + r);
+ PixelType *ptr_bl = (PixelType *)Base::_activeSurface->getBasePtr(x1 + r, y1 + h - r);
+ PixelType *ptr_br = (PixelType *)Base::_activeSurface->getBasePtr(x1 + w - r, y1 + h - r);
+ PixelType *ptr_fill = (PixelType *)Base::_activeSurface->getBasePtr(x1, y1);
+
+ int sw = 0, sp = 0;
+ int short_h = h - 2 * r;
+ int hp = h * pitch;
- colorFill<PixelType>(ptr_bl - x + py, ptr_br + x + py, color);
- colorFill<PixelType>(ptr_bl - y + px, ptr_br + y + px, color);
+ int strokeWidth = Base::_strokeWidth;
+ // If we're going to fill the inside, draw a slightly thicker border
+ // so we can blend the inside on top of it.
+ if (fill_m != Base::kFillDisabled) strokeWidth++;
- WU_DRAWCIRCLE(ptr_tr, ptr_tl, ptr_bl, ptr_br, x, y, px, py, a1);
+ // TODO: A gradient effect on the bevel
+ PixelType color1, color2;
+ color1 = Base::_bevel ? Base::_bevelColor : color;
+ color2 = color;
+
+
+ while (sw++ < strokeWidth) {
+ colorFill<PixelType>(ptr_fill + sp + r, ptr_fill + w + 1 + sp - r, color1);
+ colorFill<PixelType>(ptr_fill + hp - sp + r, ptr_fill + w + hp + 1 - sp - r, color2);
+ sp += pitch;
+
+ x = r - (sw - 1);
+ y = 0;
+ T = 0;
+ px = pitch * x;
+ py = 0;
+
+ while (x > y++) {
+ WU_ALGORITHM();
+
+ // sw == 1: outside, sw = _strokeWidth: inside
+ // We always draw the outer edge AAed, but the inner edge
+ // only when the inside isn't filled
+ if (sw != strokeWidth || fill_m != Base::kFillDisabled)
+ a2 = 255;
+
+ // inner arc
+ WU_DRAWCIRCLE_BCOLOR(ptr_tr, ptr_tl, ptr_bl, ptr_br, (x - 1), y, (px - pitch), py, a2);
+
+ if (sw == 1) // outer arc
+ WU_DRAWCIRCLE_BCOLOR(ptr_tr, ptr_tl, ptr_bl, ptr_br, x, y, px, py, a1);
+ }
}
ptr_fill += pitch * r;
while (short_h-- >= 0) {
- colorFill<PixelType>(ptr_fill, ptr_fill + w + 1, color);
+ colorFill<PixelType>(ptr_fill, ptr_fill + Base::_strokeWidth, color1);
+ colorFill<PixelType>(ptr_fill + w - Base::_strokeWidth + 1, ptr_fill + w + 1, color2);
ptr_fill += pitch;
}
}
+
+ r -= Base::_strokeWidth;
+ x1 += Base::_strokeWidth;
+ y1 += Base::_strokeWidth;
+ w -= 2*Base::_strokeWidth;
+ h -= 2*Base::_strokeWidth;
+ rsq = r*r;
+
+ if (w <= 0 || h <= 0)
+ return; // Only border is visible
+
+ if (fill_m != Base::kFillDisabled) {
+ if (fill_m == Base::kFillBackground)
+ color = Base::_bgColor;
+
+ PixelType *ptr_tl = (PixelType *)Base::_activeSurface->getBasePtr(x1 + r, y1 + r);
+ PixelType *ptr_tr = (PixelType *)Base::_activeSurface->getBasePtr(x1 + w - r, y1 + r);
+ PixelType *ptr_bl = (PixelType *)Base::_activeSurface->getBasePtr(x1 + r, y1 + h - r);
+ PixelType *ptr_br = (PixelType *)Base::_activeSurface->getBasePtr(x1 + w - r, y1 + h - r);
+ PixelType *ptr_fill = (PixelType *)Base::_activeSurface->getBasePtr(x1, y1);
+
+ int short_h = h - 2 * r;
+ x = r;
+ y = 0;
+ T = 0;
+ px = pitch * x;
+ py = 0;
+
+ if (fill_m == Base::kFillGradient) {
+
+ Base::precalcGradient(h);
+
+ PixelType color1, color2, color3, color4;
+ while (x > y++) {
+ WU_ALGORITHM();
+
+ color1 = Base::calcGradient(r - x, h);
+ color2 = Base::calcGradient(r - y, h);
+ color3 = Base::calcGradient(h - r + x, h);
+ color4 = Base::calcGradient(h - r + y, h);
+
+ Base::gradientFill(ptr_tl - x - py + 1, w - 2 * r + 2 * x - 1, x1 + r - x - y + 1, r - y);
+
+ // Only fill each horizontal line once (or we destroy
+ // the gradient effect at the edges)
+ if (T < oldT || y == 1)
+ Base::gradientFill(ptr_tl - y - px + 1, w - 2 * r + 2 * y - 1, x1 + r - y - x + 1, r - x);
+
+ Base::gradientFill(ptr_bl - x + py + 1, w - 2 * r + 2 * x - 1, x1 + r - x - y + 1, h - r + y);
+
+ // Only fill each horizontal line once (or we destroy
+ // the gradient effect at the edges)
+ if (T < oldT || y == 1)
+ Base::gradientFill(ptr_bl - y + px + 1, w - 2 * r + 2 * y - 1, x1 + r - y - x + 1, h - r + x);
+
+ // This shape is used for dialog backgrounds.
+ // If we're drawing on top of an empty overlay background,
+ // and the overlay supports alpha, we have to do AA by
+ // setting the dest alpha channel, instead of blending with
+ // dest color channels.
+ if (!g_system->hasFeature(OSystem::kFeatureOverlaySupportsAlpha))
+ WU_DRAWCIRCLE_XCOLOR(ptr_tr, ptr_tl, ptr_bl, ptr_br, x, y, px, py, a1, blendPixelPtr);
+ else
+ WU_DRAWCIRCLE_XCOLOR(ptr_tr, ptr_tl, ptr_bl, ptr_br, x, y, px, py, a1, blendPixelDestAlphaPtr);
+ }
+
+ ptr_fill += pitch * r;
+ while (short_h-- >= 0) {
+ Base::gradientFill(ptr_fill, w + 1, x1, r++);
+ ptr_fill += pitch;
+ }
+
+ } else {
+
+ while (x > 1 + y++) {
+ WU_ALGORITHM();
+
+ colorFill<PixelType>(ptr_tl - x - py + 1, ptr_tr + x - py, color);
+ if (T < oldT || y == 1)
+ colorFill<PixelType>(ptr_tl - y - px + 1, ptr_tr + y - px, color);
+
+ colorFill<PixelType>(ptr_bl - x + py + 1, ptr_br + x + py, color);
+ if (T < oldT || y == 1)
+ colorFill<PixelType>(ptr_bl - y + px + 1, ptr_br + y + px, color);
+
+ WU_DRAWCIRCLE(ptr_tr, ptr_tl, ptr_bl, ptr_br, x, y, px, py, a1);
+ }
+
+ ptr_fill += pitch * r;
+ while (short_h-- >= 0) {
+ colorFill<PixelType>(ptr_fill, ptr_fill + w + 1, color);
+ ptr_fill += pitch;
+ }
+ }
+ }
}
/** CIRCLES **/
diff --git a/graphics/VectorRendererSpec.h b/graphics/VectorRendererSpec.h
index fe64f9774d..4ed80cb55f 100644
--- a/graphics/VectorRendererSpec.h
+++ b/graphics/VectorRendererSpec.h
@@ -103,7 +103,7 @@ protected:
* @param alpha Alpha intensity of the pixel (0-255)
*/
inline void blendPixel(int x, int y, PixelType color, uint8 alpha) {
- blendPixelPtr((PixelType*)Base::_activeSurface->getBasePtr(x, y), color, alpha);
+ blendPixelPtr((PixelType *)Base::_activeSurface->getBasePtr(x, y), color, alpha);
}
/**
@@ -121,6 +121,24 @@ protected:
inline void blendPixelPtr(PixelType *ptr, PixelType color, uint8 alpha);
/**
+ * Blends a single pixel on the surface in the given pixel pointer, using supplied color
+ * and Alpha intensity.
+ * If the destination pixel has 0 alpha, set the color and alpha channels,
+ * overwriting the destination pixel entirely.
+ * If the destination pixel has non-zero alpha, blend dest with src.
+ *
+ * This is implemented to prevent blendPixel() to calculate the surface pointer on each call.
+ * Optimized drawing algorithms should call this function when possible.
+ *
+ * @see blendPixel
+ * @param ptr Pointer to the pixel to blend on top of
+ * @param color Color of the pixel
+ * @param alpha Alpha intensity of the pixel (0-255)
+ */
+ inline void blendPixelDestAlphaPtr(PixelType *ptr, PixelType color, uint8 alpha);
+
+
+ /**
* PRIMITIVE DRAWING ALGORITHMS
*
* Generic algorithms for drawing all kinds of aliased primitive shapes.
@@ -172,7 +190,6 @@ protected:
*/
virtual void drawSquareShadow(int x, int y, int w, int h, int blur);
virtual void drawRoundedSquareShadow(int x, int y, int r, int w, int h, int blur);
- virtual void drawRoundedSquareFakeBevel(int x, int y, int r, int w, int h, int amount);
/**
* Calculates the color gradient on a given point.
@@ -202,6 +219,8 @@ protected:
while (first != last) blendPixelPtr(first++, color, alpha);
}
+ void darkenFill(PixelType *first, PixelType *last);
+
const PixelFormat _format;
const PixelType _redMask, _greenMask, _blueMask, _alphaMask;
@@ -278,6 +297,10 @@ protected:
// VectorRenderer::applyConvolutionMatrix(VectorRenderer::kConvolutionHardBlur,
// Common::Rect(x, y, x + w + blur * 2, y + h + blur * 2));
}
+
+ virtual void drawTabAlg(int x, int y, int w, int h, int r,
+ PixelType color, VectorRenderer::FillMode fill_m,
+ int baseLeft = 0, int baseRight = 0);
};
#endif
diff --git a/graphics/cursorman.cpp b/graphics/cursorman.cpp
index 1d4e482bf4..425714ea34 100644
--- a/graphics/cursorman.cpp
+++ b/graphics/cursorman.cpp
@@ -31,10 +31,10 @@ DECLARE_SINGLETON(Graphics::CursorManager);
namespace Graphics {
CursorManager::~CursorManager() {
- for (int i = 0; i < _cursorStack.size(); ++i)
+ for (Common::Stack<Cursor *>::size_type i = 0; i < _cursorStack.size(); ++i)
delete _cursorStack[i];
_cursorStack.clear();
- for (int i = 0; i < _cursorPaletteStack.size(); ++i)
+ for (Common::Stack<Palette *>::size_type i = 0; i < _cursorPaletteStack.size(); ++i)
delete _cursorPaletteStack[i];
_cursorPaletteStack.clear();
}
diff --git a/graphics/font.cpp b/graphics/font.cpp
index 3f7152a95e..3b00cd8568 100644
--- a/graphics/font.cpp
+++ b/graphics/font.cpp
@@ -26,11 +26,20 @@
namespace Graphics {
+int Font::getKerningOffset(byte left, byte right) const {
+ return 0;
+}
+
int Font::getStringWidth(const Common::String &str) const {
int space = 0;
+ uint last = 0;
+
+ for (uint i = 0; i < str.size(); ++i) {
+ const uint cur = str[i];
+ space += getCharWidth(cur) + getKerningOffset(last, cur);
+ last = cur;
+ }
- for (uint i = 0; i < str.size(); ++i)
- space += getCharWidth(str[i]);
return space;
}
@@ -65,17 +74,22 @@ void Font::drawString(Surface *dst, const Common::String &sOld, int x, int y, in
// for now.
const int halfWidth = (w - ellipsisWidth) / 2;
int w2 = 0;
+ uint last = 0;
for (i = 0; i < s.size(); ++i) {
- int charWidth = getCharWidth(s[i]);
+ const uint cur = s[i];
+ int charWidth = getCharWidth(cur) + getKerningOffset(last, cur);
if (w2 + charWidth > halfWidth)
break;
+ last = cur;
w2 += charWidth;
- str += s[i];
+ str += cur;
}
+
// At this point we know that the first 'i' chars are together 'w2'
// pixels wide. We took the first i-1, and add "..." to them.
str += "...";
+ last = '.';
// The original string is width wide. Of those we already skipped past
// w2 pixels, which means (width - w2) remain.
@@ -85,7 +99,9 @@ void Font::drawString(Surface *dst, const Common::String &sOld, int x, int y, in
// (width + ellipsisWidth - w)
int skip = width + ellipsisWidth - w;
for (; i < s.size() && skip > 0; ++i) {
- skip -= getCharWidth(s[i]);
+ const uint cur = s[i];
+ skip -= getCharWidth(cur) + getKerningOffset(last, cur);
+ last = cur;
}
// Append the remaining chars, if any
@@ -104,8 +120,12 @@ void Font::drawString(Surface *dst, const Common::String &sOld, int x, int y, in
x = x + w - width;
x += deltax;
+ uint last = 0;
for (i = 0; i < str.size(); ++i) {
- w = getCharWidth(str[i]);
+ const uint cur = str[i];
+ x += getKerningOffset(last, cur);
+ last = cur;
+ w = getCharWidth(cur);
if (x+w > rightX)
break;
if (x >= leftX)
@@ -153,16 +173,18 @@ int Font::wordWrapText(const Common::String &str, int maxWidth, Common::Array<Co
// of a line. If we encounter such a word, we have to wrap it over multiple
// lines.
+ uint last = 0;
for (Common::String::const_iterator x = str.begin(); x != str.end(); ++x) {
const byte c = *x;
- const int w = getCharWidth(c);
+ const int w = getCharWidth(c) + getKerningOffset(last, c);
+ last = c;
const bool wouldExceedWidth = (lineWidth + tmpWidth + w > maxWidth);
// If this char is a whitespace, then it represents a potential
// 'wrap point' where wrapping could take place. Everything that
// came before it can now safely be added to the line, as we know
// that it will not have to be wrapped.
- if (isspace(c)) {
+ if (Common::isSpace(c)) {
line += tmpStr;
lineWidth += tmpWidth;
@@ -186,9 +208,11 @@ int Font::wordWrapText(const Common::String &str, int maxWidth, Common::Array<Co
if (lineWidth > 0) {
wrapper.add(line, lineWidth);
// Trim left side
- while (tmpStr.size() && isspace(static_cast<unsigned char>(tmpStr[0]))) {
- tmpWidth -= getCharWidth(tmpStr[0]);
+ while (tmpStr.size() && Common::isSpace(tmpStr[0])) {
tmpStr.deleteChar(0);
+ // This is not very fast, but it is the simplest way to
+ // assure we do not mess something up because of kerning.
+ tmpWidth = getStringWidth(tmpStr);
}
} else {
wrapper.add(tmpStr, tmpWidth);
diff --git a/graphics/font.h b/graphics/font.h
index 9c0b4affc1..6819b42f52 100644
--- a/graphics/font.h
+++ b/graphics/font.h
@@ -73,6 +73,15 @@ public:
virtual int getCharWidth(byte chr) const = 0;
/**
+ * Query the kerning offset between two characters.
+ *
+ * @param left The left character. May be 0.
+ * @param right The right character. May be 0.
+ * @return The horizontal displacement.
+ */
+ virtual int getKerningOffset(byte left, byte right) const;
+
+ /**
* Draw a character at a specific point on a surface.
*
* Note that the point describes the top left edge point of the
diff --git a/graphics/fonts/bdf.cpp b/graphics/fonts/bdf.cpp
index 6fa886a905..6d4befa37c 100644
--- a/graphics/fonts/bdf.cpp
+++ b/graphics/fonts/bdf.cpp
@@ -67,7 +67,7 @@ int BdfFont::getCharWidth(byte chr) const {
template<typename PixelType>
void drawCharIntern(byte *ptr, uint pitch, const byte *src, int h, int width, int minX, int maxX, const PixelType color) {
- byte data;
+ byte data = 0;
while (h--) {
PixelType *dst = (PixelType *)ptr;
diff --git a/graphics/fonts/ttf.cpp b/graphics/fonts/ttf.cpp
new file mode 100644
index 0000000000..06231799ce
--- /dev/null
+++ b/graphics/fonts/ttf.cpp
@@ -0,0 +1,483 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * 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.
+ *
+ */
+
+// Since FreeType2 includes files, which contain forbidden symbols, we need to
+// allow all symbols here.
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+
+#include "common/scummsys.h"
+#ifdef USE_FREETYPE2
+
+#include "graphics/fonts/ttf.h"
+#include "graphics/font.h"
+#include "graphics/surface.h"
+
+#include "common/singleton.h"
+#include "common/stream.h"
+#include "common/hashmap.h"
+
+#include <ft2build.h>
+#include FT_FREETYPE_H
+#include FT_GLYPH_H
+
+namespace Graphics {
+
+namespace {
+
+inline int ftFloor26_6(FT_Pos x) {
+ return x / 64;
+}
+
+inline int ftCeil26_6(FT_Pos x) {
+ return (x + 63) / 64;
+}
+
+} // End of anonymous namespace
+
+class TTFLibrary : public Common::Singleton<TTFLibrary> {
+public:
+ TTFLibrary();
+ ~TTFLibrary();
+
+ /**
+ * Check whether FreeType2 is initialized properly.
+ */
+ bool isInitialized() const { return _initialized; }
+
+ bool loadFont(const uint8 *file, const uint32 size, FT_Face &face);
+ void closeFont(FT_Face &face);
+private:
+ FT_Library _library;
+ bool _initialized;
+};
+
+#define g_ttf ::Graphics::TTFLibrary::instance()
+
+TTFLibrary::TTFLibrary() : _library(), _initialized(false) {
+ if (!FT_Init_FreeType(&_library))
+ _initialized = true;
+}
+
+TTFLibrary::~TTFLibrary() {
+ if (_initialized) {
+ FT_Done_FreeType(_library);
+ _initialized = false;
+ }
+}
+
+bool TTFLibrary::loadFont(const uint8 *file, const uint32 size, FT_Face &face) {
+ assert(_initialized);
+
+ return (FT_New_Memory_Face(_library, file, size, 0, &face) == 0);
+}
+
+void TTFLibrary::closeFont(FT_Face &face) {
+ assert(_initialized);
+
+ FT_Done_Face(face);
+}
+
+class TTFFont : public Font {
+public:
+ TTFFont();
+ virtual ~TTFFont();
+
+ bool load(Common::SeekableReadStream &stream, int size, bool monochrome, const uint32 *mapping);
+
+ virtual int getFontHeight() const;
+
+ virtual int getMaxCharWidth() const;
+
+ virtual int getCharWidth(byte chr) const;
+
+ virtual int getKerningOffset(byte left, byte right) const;
+
+ virtual void drawChar(Surface *dst, byte chr, int x, int y, uint32 color) const;
+private:
+ bool _initialized;
+ FT_Face _face;
+
+ uint8 *_ttfFile;
+ uint32 _size;
+
+ int _width, _height;
+ int _ascent, _descent;
+
+ struct Glyph {
+ Surface image;
+ int xOffset, yOffset;
+ int advance;
+ };
+
+ bool cacheGlyph(Glyph &glyph, FT_UInt &slot, uint chr);
+ typedef Common::HashMap<byte, Glyph> GlyphCache;
+ GlyphCache _glyphs;
+
+ FT_UInt _glyphSlots[256];
+
+ bool _monochrome;
+ bool _hasKerning;
+};
+
+TTFFont::TTFFont()
+ : _initialized(false), _face(), _ttfFile(0), _size(0), _width(0), _height(0), _ascent(0),
+ _descent(0), _glyphs(), _glyphSlots(), _monochrome(false), _hasKerning(false) {
+}
+
+TTFFont::~TTFFont() {
+ if (_initialized) {
+ g_ttf.closeFont(_face);
+
+ delete[] _ttfFile;
+ _ttfFile = 0;
+
+ for (GlyphCache::iterator i = _glyphs.begin(), end = _glyphs.end(); i != end; ++i)
+ i->_value.image.free();
+
+ _initialized = false;
+ }
+}
+
+bool TTFFont::load(Common::SeekableReadStream &stream, int size, bool monochrome, const uint32 *mapping) {
+ if (!g_ttf.isInitialized())
+ return false;
+
+ _size = stream.size();
+ if (!_size)
+ return false;
+
+ _ttfFile = new uint8[_size];
+ assert(_ttfFile);
+
+ if (stream.read(_ttfFile, _size) != _size) {
+ delete[] _ttfFile;
+ _ttfFile = 0;
+
+ return false;
+ }
+
+ if (!g_ttf.loadFont(_ttfFile, _size, _face)) {
+ delete[] _ttfFile;
+ _ttfFile = 0;
+
+ return false;
+ }
+
+ // We only support scalable fonts.
+ if (!FT_IS_SCALABLE(_face)) {
+ delete[] _ttfFile;
+ _ttfFile = 0;
+
+ g_ttf.closeFont(_face);
+
+ return false;
+ }
+
+ // Check whether we have kerning support
+ _hasKerning = (FT_HAS_KERNING(_face) != 0);
+
+ if (FT_Set_Char_Size(_face, 0, size * 64, 0, 0)) {
+ delete[] _ttfFile;
+ _ttfFile = 0;
+
+ return false;
+ }
+
+ _monochrome = monochrome;
+
+ FT_Fixed yScale = _face->size->metrics.y_scale;
+ _ascent = ftCeil26_6(FT_MulFix(_face->ascender, yScale));
+ _descent = ftCeil26_6(FT_MulFix(_face->descender, yScale));
+
+ _width = ftCeil26_6(FT_MulFix(_face->max_advance_width, _face->size->metrics.x_scale));
+ _height = _ascent - _descent + 1;
+
+ if (!mapping) {
+ // Load all ISO-8859-1 characters.
+ for (uint i = 0; i < 256; ++i) {
+ if (!cacheGlyph(_glyphs[i], _glyphSlots[i], i))
+ _glyphSlots[i] = 0;
+ }
+ } else {
+ for (uint i = 0; i < 256; ++i) {
+ const uint32 unicode = mapping[i] & 0x7FFFFFFF;
+ const bool isRequired = (mapping[i] & 0x80000000) != 0;
+ // Check whether loading an important glyph fails and error out if
+ // that is the case.
+ if (!cacheGlyph(_glyphs[i], _glyphSlots[i], unicode)) {
+ _glyphSlots[i] = 0;
+ if (isRequired)
+ return false;
+ }
+ }
+ }
+
+ _initialized = (_glyphs.size() != 0);
+ return _initialized;
+}
+
+int TTFFont::getFontHeight() const {
+ return _height;
+}
+
+int TTFFont::getMaxCharWidth() const {
+ return _width;
+}
+
+int TTFFont::getCharWidth(byte chr) const {
+ GlyphCache::const_iterator glyphEntry = _glyphs.find(chr);
+ if (glyphEntry == _glyphs.end())
+ return 0;
+ else
+ return glyphEntry->_value.advance;
+}
+
+int TTFFont::getKerningOffset(byte left, byte right) const {
+ if (!_hasKerning)
+ return 0;
+
+ FT_UInt leftGlyph = _glyphSlots[left];
+ FT_UInt rightGlyph = _glyphSlots[right];
+
+ if (!leftGlyph || !rightGlyph)
+ return 0;
+
+ FT_Vector kerningVector;
+ FT_Get_Kerning(_face, leftGlyph, rightGlyph, FT_KERNING_DEFAULT, &kerningVector);
+ return (kerningVector.x / 64);
+}
+
+namespace {
+
+template<typename ColorType>
+void renderGlyph(uint8 *dstPos, const int dstPitch, const uint8 *srcPos, const int srcPitch, const int w, const int h, ColorType color, const PixelFormat &dstFormat) {
+ uint8 sR, sG, sB;
+ dstFormat.colorToRGB(color, sR, sG, sB);
+
+ for (int y = 0; y < h; ++y) {
+ ColorType *rDst = (ColorType *)dstPos;
+ const uint8 *src = srcPos;
+
+ for (int x = 0; x < w; ++x) {
+ if (*src == 255) {
+ *rDst = color;
+ } else if (*src) {
+ const uint8 a = *src;
+
+ uint8 dR, dG, dB;
+ dstFormat.colorToRGB(*rDst, dR, dG, dB);
+
+ dR = ((255 - a) * dR + a * sR) / 255;
+ dG = ((255 - a) * dG + a * sG) / 255;
+ dB = ((255 - a) * dB + a * sB) / 255;
+
+ *rDst = dstFormat.RGBToColor(dR, dG, dB);
+ }
+
+ ++rDst;
+ ++src;
+ }
+
+ dstPos += dstPitch;
+ srcPos += srcPitch;
+ }
+}
+
+} // End of anonymous namespace
+
+void TTFFont::drawChar(Surface *dst, byte chr, int x, int y, uint32 color) const {
+ GlyphCache::const_iterator glyphEntry = _glyphs.find(chr);
+ if (glyphEntry == _glyphs.end())
+ return;
+
+ const Glyph &glyph = glyphEntry->_value;
+
+ x += glyph.xOffset;
+ y += glyph.yOffset;
+
+ if (x > dst->w)
+ return;
+ if (y > dst->h)
+ return;
+
+ int w = glyph.image.w;
+ int h = glyph.image.h;
+
+ const uint8 *srcPos = (const uint8 *)glyph.image.getBasePtr(0, 0);
+
+ // Make sure we are not drawing outside the screen bounds
+ if (x < 0) {
+ srcPos -= x;
+ w += x;
+ x = 0;
+ }
+
+ if (x + w > dst->w)
+ w = dst->w - x;
+
+ if (w <= 0)
+ return;
+
+ if (y < 0) {
+ srcPos += y * glyph.image.pitch;
+ h += y;
+ y = 0;
+ }
+
+ if (y + h > dst->h)
+ h = dst->h - y;
+
+ if (h <= 0)
+ return;
+
+ uint8 *dstPos = (uint8 *)dst->getBasePtr(x, y);
+
+ if (dst->format.bytesPerPixel == 1) {
+ for (int cy = 0; cy < h; ++cy) {
+ uint8 *rDst = dstPos;
+ const uint8 *src = srcPos;
+
+ for (int cx = 0; cx < w; ++cx) {
+ // We assume a 1Bpp mode is a color indexed mode, thus we can
+ // not take advantage of anti-aliasing here.
+ if (*src >= 0x80)
+ *rDst = color;
+
+ ++rDst;
+ ++src;
+ }
+
+ dstPos += dst->pitch;
+ srcPos += glyph.image.pitch;
+ }
+ } else if (dst->format.bytesPerPixel == 2) {
+ renderGlyph<uint16>(dstPos, dst->pitch, srcPos, glyph.image.pitch, w, h, color, dst->format);
+ } else if (dst->format.bytesPerPixel == 4) {
+ renderGlyph<uint32>(dstPos, dst->pitch, srcPos, glyph.image.pitch, w, h, color, dst->format);
+ }
+}
+
+bool TTFFont::cacheGlyph(Glyph &glyph, FT_UInt &slot, uint chr) {
+ slot = FT_Get_Char_Index(_face, chr);
+ if (!slot)
+ return false;
+
+ // We use the light target and render mode to improve the looks of the
+ // glyphs. It is most noticable in FreeSansBold.ttf, where otherwise the
+ // 't' glyph looks like it is cut off on the right side.
+ if (FT_Load_Glyph(_face, slot, (_monochrome ? FT_LOAD_TARGET_MONO : FT_LOAD_TARGET_LIGHT)))
+ return false;
+
+ if (FT_Render_Glyph(_face->glyph, (_monochrome ? FT_RENDER_MODE_MONO : FT_RENDER_MODE_LIGHT)))
+ return false;
+
+ if (_face->glyph->format != FT_GLYPH_FORMAT_BITMAP)
+ return false;
+
+ FT_Glyph_Metrics &metrics = _face->glyph->metrics;
+
+ glyph.xOffset = ftFloor26_6(metrics.horiBearingX);
+ int xMax = glyph.xOffset + ftCeil26_6(metrics.width);
+ glyph.yOffset = _ascent - ftFloor26_6(metrics.horiBearingY);
+
+ glyph.advance = ftCeil26_6(metrics.horiAdvance);
+
+ // In case we got a negative xMin we adjust that, this might make some
+ // characters make a bit odd, but it's the only way we can assure no
+ // invalid memory writes with the current font API
+ if (glyph.xOffset < 0) {
+ xMax -= glyph.xOffset;
+ glyph.xOffset = 0;
+
+ if (xMax > glyph.advance)
+ glyph.advance = xMax;
+ }
+
+ const FT_Bitmap &bitmap = _face->glyph->bitmap;
+ glyph.image.create(bitmap.width, bitmap.rows, PixelFormat::createFormatCLUT8());
+
+ const uint8 *src = bitmap.buffer;
+ int srcPitch = bitmap.pitch;
+ if (srcPitch < 0) {
+ src += (bitmap.rows - 1) * srcPitch;
+ srcPitch = -srcPitch;
+ }
+
+ uint8 *dst = (uint8 *)glyph.image.getBasePtr(0, 0);
+ memset(dst, 0, glyph.image.h * glyph.image.pitch);
+
+ switch (bitmap.pixel_mode) {
+ case FT_PIXEL_MODE_MONO:
+ for (int y = 0; y < bitmap.rows; ++y) {
+ const uint8 *curSrc = src;
+ uint8 mask = 0;
+
+ for (int x = 0; x < bitmap.width; ++x) {
+ if ((x % 8) == 0)
+ mask = *curSrc++;
+
+ if (mask & 0x80)
+ *dst = 255;
+
+ mask <<= 1;
+ ++dst;
+ }
+
+ src += srcPitch;
+ }
+ break;
+
+ case FT_PIXEL_MODE_GRAY:
+ for (int y = 0; y < bitmap.rows; ++y) {
+ memcpy(dst, src, bitmap.width);
+ dst += glyph.image.pitch;
+ src += srcPitch;
+ }
+ break;
+
+ default:
+ warning("TTFFont::cacheGlyph: Unsupported pixel mode %d", bitmap.pixel_mode);
+ return false;
+ }
+
+ return true;
+}
+
+Font *loadTTFFont(Common::SeekableReadStream &stream, int size, bool monochrome, const uint32 *mapping) {
+ TTFFont *font = new TTFFont();
+
+ if (!font->load(stream, size, monochrome, mapping)) {
+ delete font;
+ return 0;
+ }
+
+ return font;
+}
+
+} // End of namespace Graphics
+
+namespace Common {
+DECLARE_SINGLETON(Graphics::TTFLibrary);
+} // End of namespace Common
+
+#endif
+
diff --git a/backends/platform/iphone/blit.cpp b/graphics/fonts/ttf.h
index 58de22bf75..7222d6e112 100644
--- a/backends/platform/iphone/blit.cpp
+++ b/graphics/fonts/ttf.h
@@ -8,41 +8,35 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* 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.
*
*/
+#ifndef GRAPHICS_FONTS_TTF_H
+#define GRAPHICS_FONTS_TTF_H
+
#include "common/scummsys.h"
-#include "blit_arm.h"
-
-void blitLandscapeScreenRect16bpp(uint16 *dst, uint16 *src, int width, int height, int screenWidth, int screenHeight)
-{
- for (int x = width; x > 0; x--) {
- for (int y = height; y > 0; y--) {
- *(dst++) = *src;
- src += screenWidth;
- }
- dst -= screenHeight + height;
- src += 1 - height * screenWidth;
- }
-}
-
-void blitLandscapeScreenRect8bpp(uint16 *dst, byte *src, int width, int height, uint16 *palette, int screenWidth, int screenHeight)
-{
- for (int x = width; x > 0; x--) {
- for (int y = height; y > 0; y--) {
- *(dst++) = palette[*src];
- src += screenWidth;
- }
- dst -= screenHeight + height;
- src += 1 - height * screenWidth;
- }
-}
+
+#ifdef USE_FREETYPE2
+
+#include "common/stream.h"
+
+namespace Graphics {
+
+class Font;
+Font *loadTTFFont(Common::SeekableReadStream &stream, int size, bool monochrome = false, const uint32 *mapping = 0);
+
+} // End of namespace Graphics
+
+#endif
+
+#endif
+
diff --git a/graphics/iff.cpp b/graphics/iff.cpp
index 4bb971f299..7434a6bebc 100644
--- a/graphics/iff.cpp
+++ b/graphics/iff.cpp
@@ -206,7 +206,7 @@ struct PBMLoader {
case ID_BODY:
if (_surface) {
_surface->create(_decoder._header.width, _decoder._header.height, PixelFormat::createFormatCLUT8());
- _decoder.loadBitmap((byte*)_surface->pixels, chunk._stream);
+ _decoder.loadBitmap((byte *)_surface->pixels, chunk._stream);
}
return true; // stop the parser
}
@@ -234,7 +234,7 @@ bool PackBitsReadStream::eos() const {
}
uint32 PackBitsReadStream::read(void *dataPtr, uint32 dataSize) {
- byte *out = (byte*)dataPtr;
+ byte *out = (byte *)dataPtr;
uint32 left = dataSize;
uint32 lenR = 0, lenW = 0;
diff --git a/graphics/imagedec.cpp b/graphics/imagedec.cpp
index eb595a750e..9552f095fa 100644
--- a/graphics/imagedec.cpp
+++ b/graphics/imagedec.cpp
@@ -117,7 +117,7 @@ Surface *BMPDecoder::decodeImage(Common::SeekableReadStream &stream, const Pixel
assert(newSurf);
newSurf->create(info.width, info.height, format);
assert(newSurf->pixels);
- OverlayColor *curPixel = (OverlayColor*)newSurf->pixels + (newSurf->h-1) * newSurf->w;
+ OverlayColor *curPixel = (OverlayColor *)newSurf->pixels + (newSurf->h-1) * newSurf->w;
int pitchAdd = info.width % 4;
for (int i = 0; i < newSurf->h; ++i) {
for (int i2 = 0; i2 < newSurf->w; ++i2) {
diff --git a/graphics/jpeg.cpp b/graphics/jpeg.cpp
index 8809477405..53e693a045 100644
--- a/graphics/jpeg.cpp
+++ b/graphics/jpeg.cpp
@@ -43,20 +43,6 @@ static const uint8 _zigZagOrder[64] = {
53, 60, 61, 54, 47, 55, 62, 63
};
-// IDCT table built with :
-// _idct8x8[x][y] = cos(((2 * x + 1) * y) * (M_PI / 16.0)) * 0.5;
-// _idct8x8[x][y] /= sqrt(2.0) if y == 0
-static const double _idct8x8[8][8] = {
- { 0.353553390593274, 0.490392640201615, 0.461939766255643, 0.415734806151273, 0.353553390593274, 0.277785116509801, 0.191341716182545, 0.097545161008064 },
- { 0.353553390593274, 0.415734806151273, 0.191341716182545, -0.097545161008064, -0.353553390593274, -0.490392640201615, -0.461939766255643, -0.277785116509801 },
- { 0.353553390593274, 0.277785116509801, -0.191341716182545, -0.490392640201615, -0.353553390593274, 0.097545161008064, 0.461939766255643, 0.415734806151273 },
- { 0.353553390593274, 0.097545161008064, -0.461939766255643, -0.277785116509801, 0.353553390593274, 0.415734806151273, -0.191341716182545, -0.490392640201615 },
- { 0.353553390593274, -0.097545161008064, -0.461939766255643, 0.277785116509801, 0.353553390593274, -0.415734806151273, -0.191341716182545, 0.490392640201615 },
- { 0.353553390593274, -0.277785116509801, -0.191341716182545, 0.490392640201615, -0.353553390593273, -0.097545161008064, 0.461939766255643, -0.415734806151273 },
- { 0.353553390593274, -0.415734806151273, 0.191341716182545, 0.097545161008064, -0.353553390593274, 0.490392640201615, -0.461939766255643, 0.277785116509801 },
- { 0.353553390593274, -0.490392640201615, 0.461939766255643, -0.415734806151273, 0.353553390593273, -0.277785116509801, 0.191341716182545, -0.097545161008064 }
-};
-
JPEG::JPEG() :
_stream(NULL), _w(0), _h(0), _numComp(0), _components(NULL), _numScanComp(0),
_scanComp(NULL), _currentComp(NULL) {
@@ -113,6 +99,7 @@ void JPEG::reset() {
// Reset member variables
_stream = NULL;
_w = _h = 0;
+ _restartInterval = 0;
// Free the components
for (int c = 0; c < _numComp; c++)
@@ -208,12 +195,18 @@ bool JPEG::read(Common::SeekableReadStream *stream) {
case 0xE0: // JFIF/JFXX segment
ok = readJFIF();
break;
+ case 0xDD: // Define Restart Interval
+ ok = readDRI();
+ break;
case 0xFE: // Comment
_stream->seek(_stream->readUint16BE() - 2, SEEK_CUR);
break;
default: { // Unknown marker
uint16 size = _stream->readUint16BE();
- warning("JPEG: Unknown marker %02X, skipping %d bytes", marker, size - 2);
+
+ if ((marker & 0xE0) != 0xE0)
+ warning("JPEG: Unknown marker %02X, skipping %d bytes", marker, size - 2);
+
_stream->seek(size - 2, SEEK_CUR);
}
}
@@ -234,8 +227,10 @@ bool JPEG::readJFIF() {
}
byte majorVersion = _stream->readByte();
byte minorVersion = _stream->readByte();
- if (majorVersion != 1 || minorVersion != 1)
- warning("JPEG::readJFIF() Non-v1.1 JPEGs may not be handled correctly");
+
+ if (majorVersion != 1 || (minorVersion != 1 && minorVersion != 2))
+ warning("JPEG::readJFIF() Non-v1.1/1.2 JPEGs may not be handled correctly");
+
/* byte densityUnits = */ _stream->readByte();
/* uint16 xDensity = */ _stream->readUint16BE();
/* uint16 yDensity = */ _stream->readUint16BE();
@@ -445,10 +440,28 @@ bool JPEG::readSOS() {
}
bool ok = true;
- for (int y = 0; ok && (y < yMCU); y++)
- for (int x = 0; ok && (x < xMCU); x++)
+ uint16 interval = _restartInterval;
+
+ for (int y = 0; ok && (y < yMCU); y++) {
+ for (int x = 0; ok && (x < xMCU); x++) {
ok = readMCU(x, y);
+ // If we have a restart interval, we'll need to reset a couple
+ // variables
+ if (_restartInterval != 0) {
+ interval--;
+
+ if (interval == 0) {
+ interval = _restartInterval;
+ _bitsNumber = 0;
+
+ for (byte i = 0; i < _numScanComp; i++)
+ _scanComp[i]->DCpredictor = 0;
+ }
+ }
+ }
+ }
+
// Trim Component surfaces back to image height and width
// Note: Code using jpeg must use surface.pitch correctly...
for (uint16 c = 0; c < _numScanComp; c++) {
@@ -489,6 +502,21 @@ bool JPEG::readDQT() {
return true;
}
+// Marker 0xDD (Define Restart Interval)
+bool JPEG::readDRI() {
+ debug(5, "JPEG: readDRI");
+ uint16 size = _stream->readUint16BE() - 2;
+
+ if (size != 2) {
+ warning("JPEG: Invalid DRI size %d", size);
+ return false;
+ }
+
+ _restartInterval = _stream->readUint16BE();
+ debug(5, "Restart interval: %d", _restartInterval);
+ return true;
+}
+
bool JPEG::readMCU(uint16 xMCU, uint16 yMCU) {
bool ok = true;
for (int c = 0; ok && (c < _numComp); c++) {
@@ -504,40 +532,63 @@ bool JPEG::readMCU(uint16 xMCU, uint16 yMCU) {
return ok;
}
-void JPEG::idct8x8(float result[64], const int16 dct[64]) {
- float tmp[64];
+// triple-butterfly-add (and possible rounding)
+#define xadd3(xa, xb, xc, xd, h) \
+ p = xa + xb; \
+ n = xa - xb; \
+ xa = p + xc + h; \
+ xb = n + xd + h; \
+ xc = p - xc + h; \
+ xd = n - xd + h;
+
+// butterfly-mul
+#define xmul(xa, xb, k1, k2, sh) \
+ n = k1 * (xa + xb); \
+ p = xa; \
+ xa = (n + (k2 - k1) * xb) >> sh; \
+ xb = (n - (k2 + k1) * p) >> sh;
+
+// IDCT based on public domain code from http://halicery.com/jpeg/idct.html
+void JPEG::idct1D8x8(int32 src[8], int32 dest[64], int32 ps, int32 half) {
+ int p, n;
+
+ src[0] <<= 9;
+ src[1] <<= 7;
+ src[3] *= 181;
+ src[4] <<= 9;
+ src[5] *= 181;
+ src[7] <<= 7;
+
+ // Even part
+ xmul(src[6], src[2], 277, 669, 0)
+ xadd3(src[0], src[4], src[6], src[2], half)
+
+ // Odd part
+ xadd3(src[1], src[7], src[3], src[5], 0)
+ xmul(src[5], src[3], 251, 50, 6)
+ xmul(src[1], src[7], 213, 142, 6)
+
+ dest[0 * 8] = (src[0] + src[1]) >> ps;
+ dest[1 * 8] = (src[4] + src[5]) >> ps;
+ dest[2 * 8] = (src[2] + src[3]) >> ps;
+ dest[3 * 8] = (src[6] + src[7]) >> ps;
+ dest[4 * 8] = (src[6] - src[7]) >> ps;
+ dest[5 * 8] = (src[2] - src[3]) >> ps;
+ dest[6 * 8] = (src[4] - src[5]) >> ps;
+ dest[7 * 8] = (src[0] - src[1]) >> ps;
+}
- // Apply 1D IDCT to rows
- for (int y = 0; y < 8; y++) {
- for (int x = 0; x < 8; x++) {
- tmp[y + x * 8] = dct[0] * _idct8x8[x][0]
- + dct[1] * _idct8x8[x][1]
- + dct[2] * _idct8x8[x][2]
- + dct[3] * _idct8x8[x][3]
- + dct[4] * _idct8x8[x][4]
- + dct[5] * _idct8x8[x][5]
- + dct[6] * _idct8x8[x][6]
- + dct[7] * _idct8x8[x][7];
- }
+void JPEG::idct2D8x8(int32 block[64]) {
+ int32 tmp[64];
- dct += 8;
- }
+ // Apply 1D IDCT to rows
+ for (int i = 0; i < 8; i++)
+ idct1D8x8(&block[i * 8], &tmp[i], 9, 1 << 8);
// Apply 1D IDCT to columns
- for (int x = 0; x < 8; x++) {
- const float *u = tmp + x * 8;
- for (int y = 0; y < 8; y++) {
- result[y * 8 + x] = u[0] * _idct8x8[y][0]
- + u[1] * _idct8x8[y][1]
- + u[2] * _idct8x8[y][2]
- + u[3] * _idct8x8[y][3]
- + u[4] * _idct8x8[y][4]
- + u[5] * _idct8x8[y][5]
- + u[6] * _idct8x8[y][6]
- + u[7] * _idct8x8[y][7];
- }
- }
-}
+ for (int i = 0; i < 8; i++)
+ idct1D8x8(&tmp[i * 8], &block[i], 12, 1 << 11);
+ }
bool JPEG::readDataUnit(uint16 x, uint16 y) {
// Prepare an empty data array
@@ -553,30 +604,29 @@ bool JPEG::readDataUnit(uint16 x, uint16 y) {
readAC(readData);
// Calculate the DCT coefficients from the input sequence
- int16 DCT[64];
+ int32 block[64];
for (uint8 i = 0; i < 64; i++) {
// Dequantize
- int16 val = readData[i];
+ int32 val = readData[i];
int16 quant = _quant[_currentComp->quantTableSelector][i];
val *= quant;
// Store the normalized coefficients, undoing the Zig-Zag
- DCT[_zigZagOrder[i]] = val;
+ block[_zigZagOrder[i]] = val;
}
// Apply the IDCT
- float result[64];
- idct8x8(result, DCT);
+ idct2D8x8(block);
// Level shift to make the values unsigned
for (int i = 0; i < 64; i++) {
- result[i] = result[i] + 128;
+ block[i] = block[i] + 128;
- if (result[i] < 0)
- result[i] = 0;
+ if (block[i] < 0)
+ block[i] = 0;
- if (result[i] > 255)
- result[i] = 255;
+ if (block[i] > 255)
+ block[i] = 255;
}
// Paint the component surface
@@ -594,7 +644,7 @@ bool JPEG::readDataUnit(uint16 x, uint16 y) {
for (uint8 i = 0; i < 8; i++) {
for (uint16 sH = 0; sH < scalingH; sH++) {
- *ptr = (byte)(result[j * 8 + i]);
+ *ptr = (byte)(block[j * 8 + i]);
ptr++;
}
}
@@ -647,7 +697,8 @@ void JPEG::readAC(int16 *out) {
int16 JPEG::readSignedBits(uint8 numBits) {
uint16 ret = 0;
- if (numBits > 16) error("requested %d bits", numBits); //XXX
+ if (numBits > 16)
+ error("requested %d bits", numBits); //XXX
// MSB=0 for negatives, 1 for positives
for (int i = 0; i < numBits; i++)
@@ -708,6 +759,9 @@ uint8 JPEG::readBit() {
// DNL marker: Define Number of Lines
// TODO: terminate scan
warning("DNL marker detected: terminate scan");
+ } else if (byte2 >= 0xD0 && byte2 <= 0xD7) {
+ debug(7, "RST%d marker detected", byte2 & 7);
+ _bitsData = _stream->readByte();
} else {
warning("Error: marker 0x%02X read in entropy data", byte2);
}
diff --git a/graphics/jpeg.h b/graphics/jpeg.h
index 27b91e8777..b87791470f 100644
--- a/graphics/jpeg.h
+++ b/graphics/jpeg.h
@@ -54,6 +54,7 @@ private:
Common::SeekableReadStream *_stream;
uint16 _w, _h;
+ uint16 _restartInterval;
// Image components
uint8 _numComp;
@@ -101,6 +102,7 @@ private:
bool readDHT();
bool readSOS();
bool readDQT();
+ bool readDRI();
// Helper functions
bool readMCU(uint16 xMCU, uint16 yMCU);
@@ -116,7 +118,8 @@ private:
uint8 _bitsNumber;
// Inverse Discrete Cosine Transformation
- void idct8x8(float dst[64], const int16 src[64]);
+ static void idct1D8x8(int32 src[8], int32 dest[64], int32 ps, int32 half);
+ static void idct2D8x8(int32 block[64]);
};
} // End of Graphics namespace
diff --git a/graphics/module.mk b/graphics/module.mk
index 02c88d98ba..1e84b2425d 100644
--- a/graphics/module.mk
+++ b/graphics/module.mk
@@ -9,6 +9,7 @@ MODULE_OBJS := \
fonts/consolefont.o \
fonts/newfont_big.o \
fonts/newfont.o \
+ fonts/ttf.o \
fonts/winfont.o \
iff.o \
imagedec.o \
diff --git a/graphics/pict.cpp b/graphics/pict.cpp
index ef262931b2..872f2f224a 100644
--- a/graphics/pict.cpp
+++ b/graphics/pict.cpp
@@ -466,7 +466,6 @@ void PictDecoder::skipBitsRect(Common::SeekableReadStream *stream, bool hasPalet
stream->readUint16BE();
uint16 packType;
- uint16 pixelSize; // FIXME: unused
// Top two bits signify PixMap vs BitMap
if (rowBytes & 0xC000) {
@@ -474,7 +473,7 @@ void PictDecoder::skipBitsRect(Common::SeekableReadStream *stream, bool hasPalet
stream->readUint16BE();
packType = stream->readUint16BE();
stream->skip(14);
- pixelSize = stream->readUint16BE();
+ stream->readUint16BE(); // pixelSize
stream->skip(16);
if (hasPalette) {
@@ -487,7 +486,6 @@ void PictDecoder::skipBitsRect(Common::SeekableReadStream *stream, bool hasPalet
} else {
// BitMap
packType = 0;
- pixelSize = 1;
}
stream->skip(18);
diff --git a/graphics/scaler/thumbnail_intern.cpp b/graphics/scaler/thumbnail_intern.cpp
index ef540b8cd8..88f3cc2077 100644
--- a/graphics/scaler/thumbnail_intern.cpp
+++ b/graphics/scaler/thumbnail_intern.cpp
@@ -46,7 +46,7 @@ void createThumbnail_2(const uint8 *src, uint32 srcPitch, uint8 *dstPtr, uint32
assert(height % 2 == 0);
for (int y = 0; y < height; y += 2) {
for (int x = 0; x < width; x += 2, dstPtr += 2) {
- *((uint16*)dstPtr) = quadBlockInterpolate<bitFormat>(src + 2 * x, srcPitch);
+ *((uint16 *)dstPtr) = quadBlockInterpolate<bitFormat>(src + 2 * x, srcPitch);
}
dstPtr += (dstPitch - 2 * width / 2);
src += 2 * srcPitch;
@@ -64,7 +64,7 @@ void createThumbnail_4(const uint8 *src, uint32 srcPitch, uint8 *dstPtr, uint32
uint16 downleft = quadBlockInterpolate<bitFormat>(src + srcPitch * 2 + 2 * x, srcPitch);
uint16 downright = quadBlockInterpolate<bitFormat>(src + srcPitch * 2 + 2 * (x + 2), srcPitch);
- *((uint16*)dstPtr) = interpolate16_1_1_1_1<Graphics::ColorMasks<bitFormat> >(upleft, upright, downleft, downright);
+ *((uint16 *)dstPtr) = interpolate16_1_1_1_1<Graphics::ColorMasks<bitFormat> >(upleft, upright, downleft, downright);
}
dstPtr += (dstPitch - 2 * width / 4);
src += 4 * srcPitch;
@@ -116,9 +116,9 @@ static bool grabScreen565(Graphics::Surface *surf) {
byte r = 0, g = 0, b = 0;
if (screenFormat.bytesPerPixel == 1) {
- r = palette[((uint8*)screen->pixels)[y * screen->pitch + x] * 3];
- g = palette[((uint8*)screen->pixels)[y * screen->pitch + x] * 3 + 1];
- b = palette[((uint8*)screen->pixels)[y * screen->pitch + x] * 3 + 2];
+ r = palette[((uint8 *)screen->pixels)[y * screen->pitch + x] * 3];
+ g = palette[((uint8 *)screen->pixels)[y * screen->pitch + x] * 3 + 1];
+ b = palette[((uint8 *)screen->pixels)[y * screen->pitch + x] * 3 + 2];
} else if (screenFormat.bytesPerPixel == 2) {
uint16 col = READ_UINT16(screen->getBasePtr(x, y));
screenFormat.colorToRGB(col, r, g, b);
diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp
index 461e9cff2a..2cb1635e20 100644
--- a/gui/ThemeEngine.cpp
+++ b/gui/ThemeEngine.cpp
@@ -34,6 +34,7 @@
#include "graphics/surface.h"
#include "graphics/VectorRenderer.h"
#include "graphics/fonts/bdf.h"
+#include "graphics/fonts/ttf.h"
#include "gui/widget.h"
#include "gui/ThemeEngine.h"
@@ -557,7 +558,7 @@ bool ThemeEngine::addTextData(const Common::String &drawDataId, TextData textId,
return true;
}
-bool ThemeEngine::addFont(TextData textId, const Common::String &file) {
+bool ThemeEngine::addFont(TextData textId, const Common::String &file, const Common::String &scalableFile, const int pointsize) {
if (textId == -1)
return false;
@@ -570,15 +571,21 @@ bool ThemeEngine::addFont(TextData textId, const Common::String &file) {
_texts[textId]->_fontPtr = _font;
} else {
Common::String localized = FontMan.genLocalizedFontFilename(file);
+ const Common::String charset
+#ifdef USE_TRANSLATION
+ (TransMan.getCurrentCharset())
+#endif
+ ;
+
// Try localized fonts
- _texts[textId]->_fontPtr = loadFont(localized, textId == kTextDataDefault);
+ _texts[textId]->_fontPtr = loadFont(localized, scalableFile, charset, pointsize, textId == kTextDataDefault);
if (!_texts[textId]->_fontPtr) {
// Try standard fonts
- _texts[textId]->_fontPtr = loadFont(file, textId == kTextDataDefault);
+ _texts[textId]->_fontPtr = loadFont(file, scalableFile, Common::String(), pointsize, textId == kTextDataDefault);
if (!_texts[textId]->_fontPtr)
- error("Couldn't load font '%s'", file.c_str());
+ error("Couldn't load font '%s'/'%s'", file.c_str(), scalableFile.c_str());
#ifdef USE_TRANSLATION
TransMan.setLanguage("C");
@@ -840,7 +847,7 @@ void ThemeEngine::queueBitmap(const Graphics::Surface *bitmap, const Common::Rec
ThemeItemBitmap *q = new ThemeItemBitmap(this, area, bitmap, alpha);
if (_buffering) {
- _bufferQueue.push_back(q);
+ _screenQueue.push_back(q);
} else {
q->drawSelf(true, false);
delete q;
@@ -899,7 +906,7 @@ void ThemeEngine::drawCheckbox(const Common::Rect &r, const Common::String &str,
r2.left = r2.right + checkBoxSize;
r2.right = r.right;
- queueDDText(getTextData(dd), getTextColor(dd), r2, str, false, false, _widgets[kDDCheckboxDefault]->_textAlignH, _widgets[dd]->_textAlignV);
+ queueDDText(getTextData(dd), getTextColor(dd), r2, str, true, false, _widgets[kDDCheckboxDefault]->_textAlignH, _widgets[dd]->_textAlignV);
}
void ThemeEngine::drawRadiobutton(const Common::Rect &r, const Common::String &str, bool checked, WidgetStateInfo state) {
@@ -925,7 +932,7 @@ void ThemeEngine::drawRadiobutton(const Common::Rect &r, const Common::String &s
r2.left = r2.right + checkBoxSize;
r2.right = r.right;
- queueDDText(getTextData(dd), getTextColor(dd), r2, str, false, false, _widgets[kDDRadiobuttonDefault]->_textAlignH, _widgets[dd]->_textAlignV);
+ queueDDText(getTextData(dd), getTextColor(dd), r2, str, true, false, _widgets[kDDRadiobuttonDefault]->_textAlignH, _widgets[dd]->_textAlignV);
}
void ThemeEngine::drawSlider(const Common::Rect &r, int width, WidgetStateInfo state) {
@@ -1366,6 +1373,10 @@ int ThemeEngine::getCharWidth(byte c, FontStyle font) const {
return ready() ? _texts[fontStyleToData(font)]->_fontPtr->getCharWidth(c) : 0;
}
+int ThemeEngine::getKerningOffset(byte left, byte right, FontStyle font) const {
+ return ready() ? _texts[fontStyleToData(font)]->_fontPtr->getKerningOffset(left, right) : 0;
+}
+
TextData ThemeEngine::getTextData(DrawData ddId) const {
return _widgets[ddId] ? (TextData)_widgets[ddId]->_textDataId : kTextDataNone;
}
@@ -1386,15 +1397,48 @@ DrawData ThemeEngine::parseDrawDataId(const Common::String &name) const {
* External data loading
*********************************************************/
-const Graphics::Font *ThemeEngine::loadFont(const Common::String &filename, const bool makeLocalizedFont) {
+const Graphics::Font *ThemeEngine::loadScalableFont(const Common::String &filename, const Common::String &charset, const int pointsize, Common::String &name) {
+#ifdef USE_FREETYPE2
+ name = Common::String::format("%s-%s@%d", filename.c_str(), charset.c_str(), pointsize);
+
// Try already loaded fonts.
- const Graphics::Font *font = FontMan.getFontByName(filename);
+ const Graphics::Font *font = FontMan.getFontByName(name);
if (font)
return font;
- Common::String cacheFilename = genCacheFilename(filename);
+ Common::ArchiveMemberList members;
+ _themeFiles.listMatchingMembers(members, filename);
+
+ for (Common::ArchiveMemberList::const_iterator i = members.begin(), end = members.end(); i != end; ++i) {
+ Common::SeekableReadStream *stream = (*i)->createReadStream();
+ if (stream) {
+ font = Graphics::loadTTFFont(*stream, pointsize, false,
+#ifdef USE_TRANSLATION
+ TransMan.getCharsetMapping()
+#else
+ 0
+#endif
+ );
+ delete stream;
+
+ if (font)
+ return font;
+ }
+ }
+#endif
+ return 0;
+}
+
+const Graphics::Font *ThemeEngine::loadFont(const Common::String &filename, Common::String &name) {
+ name = filename;
+
+ // Try already loaded fonts.
+ const Graphics::Font *font = FontMan.getFontByName(name);
+ if (font)
+ return font;
Common::ArchiveMemberList members;
+ const Common::String cacheFilename(genCacheFilename(filename));
_themeFiles.listMatchingMembers(members, cacheFilename);
_themeFiles.listMatchingMembers(members, filename);
@@ -1411,20 +1455,34 @@ const Graphics::Font *ThemeEngine::loadFont(const Common::String &filename, cons
}
}
delete stream;
- }
- if (font)
- break;
+ if (font)
+ return font;
+ }
}
+ return 0;
+}
+
+const Graphics::Font *ThemeEngine::loadFont(const Common::String &filename, const Common::String &scalableFilename, const Common::String &charset, const int pointsize, const bool makeLocalizedFont) {
+ Common::String fontName;
+
+ const Graphics::Font *font = 0;
+
+ // Prefer scalable fonts over non-scalable fonts
+ font = loadScalableFont(scalableFilename, charset, pointsize, fontName);
+ if (!font)
+ font = loadFont(filename, fontName);
+
// If the font is successfully loaded store it in the font manager.
if (font) {
- FontMan.assignFontToName(filename, font);
+ FontMan.assignFontToName(fontName, font);
// If this font should be the new default localized font, we set it up
// for that.
if (makeLocalizedFont)
- FontMan.setLocalizedFont(filename);
+ FontMan.setLocalizedFont(fontName);
}
+
return font;
}
diff --git a/gui/ThemeEngine.h b/gui/ThemeEngine.h
index 2377098957..f041f85ab9 100644
--- a/gui/ThemeEngine.h
+++ b/gui/ThemeEngine.h
@@ -35,7 +35,7 @@
#include "graphics/pixelformat.h"
-#define SCUMMVM_THEME_VERSION_STR "SCUMMVM_STX0.8.7"
+#define SCUMMVM_THEME_VERSION_STR "SCUMMVM_STX0.8.8"
class OSystem;
@@ -310,6 +310,8 @@ public:
int getCharWidth(byte c, FontStyle font = kFontStyleBold) const;
+ int getKerningOffset(byte left, byte right, FontStyle font = kFontStyleBold) const;
+
//@}
@@ -411,10 +413,12 @@ public:
* Interface for the ThemeParser class: Loads a font to use on the GUI from the given
* filename.
*
- * @param fontName Identifier name for the font.
- * @param file Name of the font file.
+ * @param fextId Identifier name for the font.
+ * @param file Filename of the non-scalable font version.
+ * @param scalableFile Filename of the scalable version. (Optional)
+ * @param pointsize Point size for the scalable font. (Optional)
*/
- bool addFont(TextData textId, const Common::String &file);
+ bool addFont(TextData textId, const Common::String &file, const Common::String &scalableFile, const int pointsize);
/**
* Interface for the ThemeParser class: adds a text color value.
@@ -536,8 +540,10 @@ protected:
*/
void unloadTheme();
- const Graphics::Font *loadFont(const Common::String &filename, const bool makeLocalizedFont);
+ const Graphics::Font *loadScalableFont(const Common::String &filename, const Common::String &charset, const int pointsize, Common::String &name);
+ const Graphics::Font *loadFont(const Common::String &filename, Common::String &name);
Common::String genCacheFilename(const Common::String &filename) const;
+ const Graphics::Font *loadFont(const Common::String &filename, const Common::String &scalableFilename, const Common::String &charset, const int pointsize, const bool makeLocalizedFont);
/**
* Actual Dirty Screen handling function.
diff --git a/gui/ThemeParser.cpp b/gui/ThemeParser.cpp
index ea50dcc061..9ccdedd564 100644
--- a/gui/ThemeParser.cpp
+++ b/gui/ThemeParser.cpp
@@ -176,8 +176,15 @@ bool ThemeParser::parserCallback_font(ParserNode *node) {
return true;
}
+ // Default to a point size of 12.
+ int pointsize = 12;
+ if (node->values.contains("point_size")) {
+ if (sscanf(node->values["point_size"].c_str(), "%d", &pointsize) != 1 || pointsize <= 0)
+ return parserError(Common::String::format("Font \"%s\" has invalid point size \"%s\"", node->values["id"].c_str(), node->values["point_size"].c_str()));
+ }
+
TextData textDataId = parseTextDataId(node->values["id"]);
- if (!_theme->addFont(textDataId, node->values["file"]))
+ if (!_theme->addFont(textDataId, node->values["file"], node->values["scalable_file"], pointsize))
return parserError("Error loading Font in theme engine.");
return true;
diff --git a/gui/ThemeParser.h b/gui/ThemeParser.h
index 1999850643..4b7e88cbf3 100644
--- a/gui/ThemeParser.h
+++ b/gui/ThemeParser.h
@@ -65,6 +65,8 @@ protected:
XML_PROP(id, true)
XML_PROP(file, true)
XML_PROP(resolution, false)
+ XML_PROP(scalable_file, false)
+ XML_PROP(point_size, false)
KEY_END()
XML_KEY(text_color)
diff --git a/gui/browser_osx.mm b/gui/browser_osx.mm
index 017b31b9a8..b8aa7c50ee 100644
--- a/gui/browser_osx.mm
+++ b/gui/browser_osx.mm
@@ -62,11 +62,7 @@ int BrowserDialog::runModal() {
NSOpenPanel * panel = [NSOpenPanel openPanel];
[panel setCanChooseDirectories:YES];
if ([panel runModalForTypes:nil] == NSOKButton) {
-#ifdef __POWERPC__
- const char *filename = [[panel filename] cString];
-#else
- const char *filename = [[panel filename] cStringUsingEncoding:NSUTF8StringEncoding];
-#endif
+ const char *filename = [[panel filename] UTF8String];
_choice = Common::FSNode(filename);
choiceMade = true;
}
diff --git a/gui/credits.h b/gui/credits.h
index dd839c2c3b..154f577fba 100644
--- a/gui/credits.h
+++ b/gui/credits.h
@@ -166,6 +166,8 @@ static const char *credits[] = {
"",
"C1""SAGA",
"C0""Torbj\366rn Andersson",
+"C0""Daniel Balsom",
+"C2""Original engine reimplementation author (retired)",
"C0""Filippos Karapetis",
"C0""Andrew Kurushin",
"C0""Eugene Sandulenko",
@@ -567,6 +569,8 @@ static const char *credits[] = {
"C2""Final MI1 CD music support, initial Ogg Vorbis support",
"C0""Andr\351 Souza",
"C2""SDL-based OpenGL renderer",
+"C0""Tom Frost",
+"C2""WebOS port contributions",
"",
"C1""FreeSCI Contributors",
"C0""Francois-R Boyer",
@@ -649,6 +653,8 @@ static const char *credits[] = {
"",
"C1""Special thanks to",
"",
+"C0""Daniel Balsom",
+"C2""For the original Reinherit (SAGA) code",
"C0""Sander Buskens",
"C2""For his work on the initial reversing of Monkey2",
"C0""Canadacow",
diff --git a/gui/gui-manager.cpp b/gui/gui-manager.cpp
index 3a665009cb..4fa60bfe07 100644
--- a/gui/gui-manager.cpp
+++ b/gui/gui-manager.cpp
@@ -112,17 +112,22 @@ void GuiManager::initKeymap() {
Action *act;
Keymap *guiMap = new Keymap(kGuiKeymapName);
- act = new Action(guiMap, "CLOS", _("Close"), kGenericActionType, kStartKeyType);
+ act = new Action(guiMap, "CLOS", _("Close"));
act->addKeyEvent(KeyState(KEYCODE_ESCAPE, ASCII_ESCAPE, 0));
act = new Action(guiMap, "CLIK", _("Mouse click"));
act->addLeftClickEvent();
- act = new Action(guiMap, "VIRT", _("Display keyboard"), kVirtualKeyboardActionType);
- act->addKeyEvent(KeyState(KEYCODE_F7, ASCII_F7, 0));
+#ifdef ENABLE_VKEYBD
+ act = new Action(guiMap, "VIRT", _("Display keyboard"));
+ act->addEvent(EVENT_VIRTUAL_KEYBOARD);
+#endif
+
+ act = new Action(guiMap, "REMP", _("Remap keys"));
+ act->addEvent(EVENT_KEYMAPPER_REMAP);
- act = new Action(guiMap, "REMP", _("Remap keys"), kKeyRemapActionType);
- act->addKeyEvent(KeyState(KEYCODE_F8, ASCII_F8, 0));
+ act = new Action(guiMap, "FULS", _("Toggle FullScreen"));
+ act->addKeyEvent(KeyState(KEYCODE_RETURN, ASCII_RETURN, KBD_ALT));
mapper->addGlobalKeymap(guiMap);
}
@@ -132,15 +137,7 @@ void GuiManager::pushKeymap() {
}
void GuiManager::popKeymap() {
- Common::Keymapper *keymapper = _system->getEventManager()->getKeymapper();
- if (!keymapper->getActiveStack().empty()) {
- Common::Keymapper::MapRecord topKeymap = keymapper->getActiveStack().top();
- // TODO: Don't use the keymap name as a way to discriminate GUI maps
- if(topKeymap.keymap->getName().equals(Common::kGuiKeymapName))
- keymapper->popKeymap();
- else
- warning("An attempt to pop non-gui keymap %s was blocked", topKeymap.keymap->getName().c_str());
- }
+ _system->getEventManager()->getKeymapper()->popKeymap(Common::kGuiKeymapName);
}
#endif
@@ -191,7 +188,7 @@ bool GuiManager::loadNewTheme(Common::String id, ThemeEngine::GraphicsMode gfx,
}
// refresh all dialogs
- for (int i = 0; i < _dialogStack.size(); ++i)
+ for (DialogStack::size_type i = 0; i < _dialogStack.size(); ++i)
_dialogStack[i]->reflowLayout();
// We need to redraw immediately. Otherwise
@@ -205,7 +202,6 @@ bool GuiManager::loadNewTheme(Common::String id, ThemeEngine::GraphicsMode gfx,
}
void GuiManager::redraw() {
- int i;
ThemeEngine::ShadingStyle shading;
if (_redrawStatus == kRedrawDisabled || _dialogStack.empty())
@@ -226,7 +222,7 @@ void GuiManager::redraw() {
_theme->clearAll();
_theme->openDialog(true, ThemeEngine::kShadingNone);
- for (i = 0; i < _dialogStack.size() - 1; i++)
+ for (DialogStack::size_type i = 0; i < _dialogStack.size() - 1; i++)
_dialogStack[i]->drawDialog();
_theme->finishBuffering();
@@ -285,18 +281,9 @@ void GuiManager::runLoop() {
uint32 lastRedraw = 0;
const uint32 waitTime = 1000 / 45;
-#ifdef ENABLE_KEYMAPPER
- // Due to circular reference with event manager and GUI
- // we cannot init keymap on the GUI creation. Thus, let's
- // try to do it on every launch, checking whether the
- // map is already existing
- initKeymap();
- pushKeymap();
-#endif
-
bool tooltipCheck = false;
- while (!_dialogStack.empty() && activeDialog == getTopDialog()) {
+ while (!_dialogStack.empty() && activeDialog == getTopDialog() && !eventMan->shouldQuit()) {
redraw();
// Don't "tickle" the dialog until the theme has had a chance
@@ -375,8 +362,6 @@ void GuiManager::runLoop() {
case Common::EVENT_WHEELDOWN:
activeDialog->handleMouseWheel(mouse.x, mouse.y, 1);
break;
- case Common::EVENT_QUIT:
- return;
case Common::EVENT_SCREEN_CHANGED:
screenChange();
break;
@@ -405,9 +390,16 @@ void GuiManager::runLoop() {
_system->delayMillis(10);
}
-#ifdef ENABLE_KEYMAPPER
- popKeymap();
-#endif
+ // WORKAROUND: When quitting we might not properly close the dialogs on
+ // the dialog stack, thus we do this here to avoid any problems.
+ // This is most noticable in bug #3481395 "LAUNCHER: Can't quit from unsupported game dialog".
+ // It seems that Dialog::runModal never removes the dialog from the dialog
+ // stack, thus if the dialog does not call Dialog::close to close itself
+ // it will never be removed. Since we can have multiple run loops being
+ // called we cannot rely on catching EVENT_QUIT in the event loop above,
+ // since it would only catch it for the top run loop.
+ if (eventMan->shouldQuit() && activeDialog == getTopDialog())
+ getTopDialog()->close();
if (didSaveState) {
_theme->disable();
@@ -419,6 +411,10 @@ void GuiManager::runLoop() {
#pragma mark -
void GuiManager::saveState() {
+#ifdef ENABLE_KEYMAPPER
+ initKeymap();
+ pushKeymap();
+#endif
// Backup old cursor
_lastClick.x = _lastClick.y = 0;
_lastClick.time = 0;
@@ -428,6 +424,9 @@ void GuiManager::saveState() {
}
void GuiManager::restoreState() {
+#ifdef ENABLE_KEYMAPPER
+ popKeymap();
+#endif
if (_useStdCursor) {
CursorMan.popCursor();
CursorMan.popCursorPalette();
@@ -515,7 +514,7 @@ void GuiManager::screenChange() {
_theme->refresh();
// refresh all dialogs
- for (int i = 0; i < _dialogStack.size(); ++i) {
+ for (DialogStack::size_type i = 0; i < _dialogStack.size(); ++i) {
_dialogStack[i]->reflowLayout();
}
// We need to redraw immediately. Otherwise
diff --git a/gui/gui-manager.h b/gui/gui-manager.h
index addd2e6611..49542fd001 100644
--- a/gui/gui-manager.h
+++ b/gui/gui-manager.h
@@ -81,6 +81,7 @@ public:
int getFontHeight(ThemeEngine::FontStyle style = ThemeEngine::kFontStyleBold) const { return _theme->getFontHeight(style); }
int getStringWidth(const Common::String &str, ThemeEngine::FontStyle style = ThemeEngine::kFontStyleBold) const { return _theme->getStringWidth(str, style); }
int getCharWidth(byte c, ThemeEngine::FontStyle style = ThemeEngine::kFontStyleBold) const { return _theme->getCharWidth(c, style); }
+ int getKerningOffset(byte left, byte right, ThemeEngine::FontStyle font = ThemeEngine::kFontStyleBold) const { return _theme->getKerningOffset(left, right, font); }
/**
* Tell the GuiManager to check whether the screen resolution has changed.
diff --git a/gui/launcher.cpp b/gui/launcher.cpp
index c737b81b33..5bb358452a 100644
--- a/gui/launcher.cpp
+++ b/gui/launcher.cpp
@@ -90,7 +90,7 @@ public:
protected:
bool tryInsertChar(byte c, int pos) {
- if (isalnum(c) || c == '-' || c == '_') {
+ if (Common::isAlnum(c) || c == '-' || c == '_') {
_editString.insertChar(c, pos);
return true;
}
@@ -1084,7 +1084,7 @@ void LauncherDialog::updateButtons() {
void LauncherDialog::reflowLayout() {
#ifndef DISABLE_FANCY_THEMES
if (g_gui.xmlEval()->getVar("Globals.ShowLauncherLogo") == 1 && g_gui.theme()->supportsImages()) {
- StaticTextWidget *ver = (StaticTextWidget*)findWidget("Launcher.Version");
+ StaticTextWidget *ver = (StaticTextWidget *)findWidget("Launcher.Version");
if (ver) {
ver->setAlign((Graphics::TextAlign)g_gui.xmlEval()->getVar("Launcher.Version.Align", Graphics::kTextAlignCenter));
ver->setLabel(gScummVMVersionDate);
@@ -1095,7 +1095,7 @@ void LauncherDialog::reflowLayout() {
_logo->useThemeTransparency(true);
_logo->setGfx(g_gui.theme()->getImageSurface(ThemeEngine::kImageLogo));
} else {
- StaticTextWidget *ver = (StaticTextWidget*)findWidget("Launcher.Version");
+ StaticTextWidget *ver = (StaticTextWidget *)findWidget("Launcher.Version");
if (ver) {
ver->setAlign((Graphics::TextAlign)g_gui.xmlEval()->getVar("Launcher.Version.Align", Graphics::kTextAlignCenter));
ver->setLabel(gScummVMFullVersion);
diff --git a/gui/options.cpp b/gui/options.cpp
index 4fa5a821fb..bfad81c07b 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -191,9 +191,9 @@ void OptionsDialog::open() {
int sel = 0;
for (int i = 0; p->code; ++p, ++i) {
if (renderMode == p->id)
- sel = i + 2;
+ sel = p->id;
}
- _renderModePopUp->setSelected(sel);
+ _renderModePopUp->setSelectedTag(sel);
}
#ifdef SMALL_SCREEN_DEVICE
@@ -748,13 +748,18 @@ void OptionsDialog::addGraphicControls(GuiObject *boss, const Common::String &pr
}
// RenderMode popup
+ const Common::String allFlags = renderType2GUIO((uint32)-1);
+ bool renderingTypeDefined = (strpbrk(_guioptions.c_str(), allFlags.c_str()) != NULL);
+
_renderModePopUpDesc = new StaticTextWidget(boss, prefix + "grRenderPopupDesc", _("Render mode:"), _("Special dithering modes supported by some games"));
_renderModePopUp = new PopUpWidget(boss, prefix + "grRenderPopup", _("Special dithering modes supported by some games"));
_renderModePopUp->appendEntry(_("<default>"), Common::kRenderDefault);
_renderModePopUp->appendEntry("");
const Common::RenderModeDescription *rm = Common::g_renderModes;
for (; rm->code; ++rm) {
- _renderModePopUp->appendEntry(_c(rm->description, context), rm->id);
+ Common::String renderGuiOption = renderType2GUIO(rm->id);
+ if ((_domain == Common::ConfigManager::kApplicationDomain) || (_domain != Common::ConfigManager::kApplicationDomain && !renderingTypeDefined) || (_guioptions.contains(renderGuiOption)))
+ _renderModePopUp->appendEntry(_c(rm->description, context), rm->id);
}
// Fullscreen checkbox
@@ -1033,6 +1038,30 @@ void OptionsDialog::saveMusicDeviceSetting(PopUpWidget *popup, Common::String se
ConfMan.removeKey(setting, _domain);
}
+Common::String OptionsDialog::renderType2GUIO(uint32 renderType) {
+ static const struct {
+ Common::RenderMode type;
+ const char *guio;
+ } renderGUIOMapping[] = {
+ { Common::kRenderHercG, GUIO_RENDERHERCGREEN },
+ { Common::kRenderHercA, GUIO_RENDERHERCAMBER },
+ { Common::kRenderCGA, GUIO_RENDERCGA },
+ { Common::kRenderEGA, GUIO_RENDEREGA },
+ { Common::kRenderVGA, GUIO_RENDERVGA },
+ { Common::kRenderAmiga, GUIO_RENDERAMIGA },
+ { Common::kRenderFMTowns, GUIO_RENDERFMTOWNS },
+ { Common::kRenderPC98, GUIO_RENDERPC98 }
+ };
+ Common::String res;
+
+ for (int i = 0; i < ARRAYSIZE(renderGUIOMapping); i++) {
+ if (renderType == renderGUIOMapping[i].type || renderType == (uint32)-1)
+ res += renderGUIOMapping[i].guio;
+ }
+
+ return res;
+}
+
int OptionsDialog::getSubtitleMode(bool subtitles, bool speech_mute) {
if (_guioptions.contains(GUIO_NOSUBTITLES))
return kSubtitlesSpeech; // Speech only
diff --git a/gui/options.h b/gui/options.h
index 92ce3e5df4..4e0187f50f 100644
--- a/gui/options.h
+++ b/gui/options.h
@@ -85,6 +85,8 @@ protected:
bool loadMusicDeviceSetting(PopUpWidget *popup, Common::String setting, MusicType preferredType = MT_AUTO);
void saveMusicDeviceSetting(PopUpWidget *popup, Common::String setting);
+ Common::String renderType2GUIO(uint32 renderType);
+
TabWidget *_tabWidget;
int _graphicsTabId;
diff --git a/gui/themes/default.inc b/gui/themes/default.inc
index 3204620ee3..bd28c2e85d 100644
--- a/gui/themes/default.inc
+++ b/gui/themes/default.inc
@@ -1,47 +1,644 @@
"<?xml version = '1.0'?>"
-"<layout_info resolution='y>399'> "
+"<render_info> "
+"<palette> "
+"<color name='black' "
+"rgb='0,0,0' "
+"/> "
+"<color name='lightgrey' "
+"rgb='104,104,104' "
+"/> "
+"<color name='darkgrey' "
+"rgb='64,64,64' "
+"/> "
+"<color name='green' "
+"rgb='32,160,32' "
+"/> "
+"<color name='green2' "
+"rgb='0,255,0' "
+"/> "
+"</palette> "
+"<fonts> "
+"<font id='text_default' "
+"file='helvb12.bdf' "
+"/> "
+"<font resolution='y<400' "
+"id='text_default' "
+"file='clR6x12.bdf' "
+"/> "
+"<font id='text_button' "
+"file='helvb12.bdf' "
+"/> "
+"<font resolution='y<400' "
+"id='text_button' "
+"file='clR6x12.bdf' "
+"/> "
+"<font id='text_normal' "
+"file='helvb12.bdf' "
+"/> "
+"<font resolution='y<400' "
+"id='text_normal' "
+"file='clR6x12.bdf' "
+"/> "
+"<font id='tooltip_normal' "
+"file='fixed5x8.bdf' "
+"/> "
+"<text_color id='color_normal' "
+"color='green' "
+"/> "
+"<text_color id='color_normal_inverted' "
+"color='black' "
+"/> "
+"<text_color id='color_normal_hover' "
+"color='green2' "
+"/> "
+"<text_color id='color_normal_disabled' "
+"color='lightgrey' "
+"/> "
+"<text_color id='color_alternative' "
+"color='lightgrey' "
+"/> "
+"<text_color id='color_alternative_inverted' "
+"color='255,255,255' "
+"/> "
+"<text_color id='color_alternative_hover' "
+"color='176,176,176' "
+"/> "
+"<text_color id='color_alternative_disabled' "
+"color='darkgrey' "
+"/> "
+"<text_color id='color_button' "
+"color='green' "
+"/> "
+"<text_color id='color_button_hover' "
+"color='green2' "
+"/> "
+"<text_color id='color_button_disabled' "
+"color='lightgrey' "
+"/> "
+"</fonts> "
+"<defaults fill='foreground' fg_color='darkgrey' bg_color='black' shadow='0' bevel_color='lightgrey'/> "
+"<drawdata id='text_selection' cache='false'> "
+"<drawstep func='square' "
+"fill='foreground' "
+"fg_color='lightgrey' "
+"/> "
+"</drawdata> "
+"<drawdata id='text_selection_focus' cache='false'> "
+"<drawstep func='square' "
+"fill='foreground' "
+"fg_color='green' "
+"/> "
+"</drawdata> "
+"<drawdata id='mainmenu_bg' cache='false'> "
+"<drawstep func='fill' "
+"fill='foreground' "
+"fg_color='black' "
+"/> "
+"</drawdata> "
+"<drawdata id='special_bg' cache='false'> "
+"<drawstep func='bevelsq' "
+"bevel='2' "
+"/> "
+"</drawdata> "
+"<drawdata id='tooltip_bg' cache='false'> "
+"<drawstep func='bevelsq' "
+"bevel='2' "
+"fill='foreground' "
+"fg_color='black' "
+"/> "
+"</drawdata> "
+"<drawdata id='separator' cache='false'> "
+"<drawstep func='square' "
+"fill='foreground' "
+"height='2' "
+"ypos='center' "
+"fg_color='lightgrey' "
+"/> "
+"</drawdata> "
+"<drawdata id='scrollbar_base' cache='false'> "
+"<drawstep func='bevelsq' "
+"bevel='2' "
+"/> "
+"</drawdata> "
+"<drawdata id='scrollbar_handle_hover' cache='false'> "
+"<drawstep func='square' "
+"fill='foreground' "
+"fg_color='green2' "
+"/> "
+"</drawdata> "
+"<drawdata id='scrollbar_handle_idle' cache='false'> "
+"<drawstep func='square' "
+"fill='foreground' "
+"fg_color='green' "
+"/> "
+"</drawdata> "
+"<drawdata id='scrollbar_button_idle' cache='false' resolution='y>399'> "
+"<drawstep func='bevelsq' "
+"bevel='2' "
+"fill='none' "
+"/> "
+"<drawstep func='triangle' "
+"fg_color='green' "
+"fill='foreground' "
+"width='10' "
+"height='10' "
+"xpos='right' "
+"ypos='center' "
+"padding='0,0,3,0' "
+"orientation='top' "
+"/> "
+"</drawdata> "
+"<drawdata id='scrollbar_button_idle' cache='false' resolution='y<400'> "
+"<drawstep func='bevelsq' "
+"bevel='2' "
+"fill='none' "
+"/> "
+"<drawstep func='triangle' "
+"fg_color='green' "
+"fill='foreground' "
+"width='5' "
+"height='5' "
+"xpos='right' "
+"ypos='center' "
+"padding='0,0,2,0' "
+"orientation='top' "
+"/> "
+"</drawdata> "
+"<drawdata id='scrollbar_button_hover' cache='false' resolution='y>399'> "
+"<drawstep func='bevelsq' "
+"bevel='2' "
+"fill='none' "
+"/> "
+"<drawstep func='triangle' "
+"fg_color='green' "
+"fill='foreground' "
+"width='10' "
+"height='10' "
+"xpos='right' "
+"ypos='center' "
+"padding='0,0,3,0' "
+"orientation='top' "
+"/> "
+"</drawdata> "
+"<drawdata id='scrollbar_button_hover' cache='false' resolution='y<400'> "
+"<drawstep func='bevelsq' "
+"bevel='2' "
+"fill='none' "
+"/> "
+"<drawstep func='triangle' "
+"fg_color='green' "
+"fill='foreground' "
+"width='5' "
+"height='5' "
+"xpos='right' "
+"ypos='center' "
+"padding='0,0,2,0' "
+"orientation='top' "
+"/> "
+"</drawdata> "
+"<drawdata id='tab_active' cache='false'> "
+"<text font='text_default' "
+"text_color='color_normal_hover' "
+"vertical_align='center' "
+"horizontal_align='center' "
+"/> "
+"<drawstep func='tab' "
+"bevel='2' "
+"radius='0' "
+"fill='none' "
+"/> "
+"</drawdata> "
+"<drawdata id='tab_inactive' cache='false'> "
+"<text font='text_default' "
+"text_color='color_normal' "
+"vertical_align='center' "
+"horizontal_align='center' "
+"/> "
+"<drawstep func='tab' "
+"bevel='2' "
+"radius='0' "
+"fill='none' "
+"/> "
+"</drawdata> "
+"<drawdata id='tab_background' cache='false'> "
+"</drawdata> "
+"<drawdata id='widget_slider' cache='false'> "
+"<drawstep func='bevelsq' "
+"bevel='2' "
+"fill='none' "
+"/> "
+"</drawdata> "
+"<drawdata id='slider_disabled' cache='false'> "
+"<drawstep func='square' "
+"fill='foreground' "
+"fg_color='lightgrey' "
+"/> "
+"</drawdata> "
+"<drawdata id='slider_full' cache='false'> "
+"<drawstep func='square' "
+"fill='foreground' "
+"fg_color='green' "
+"/> "
+"</drawdata> "
+"<drawdata id='slider_hover' cache='false'> "
+"<drawstep func='square' "
+"fill='foreground' "
+"fg_color='green2' "
+"/> "
+"</drawdata> "
+"<drawdata id='widget_small' cache='false'> "
+"<drawstep func='bevelsq' "
+"bevel='2' "
+"fill='none' "
+"/> "
+"</drawdata> "
+"<drawdata id='popup_idle' cache='false' resolution='y>399'> "
+"<drawstep func='bevelsq' "
+"bevel='2' "
+"fill='none' "
+"/> "
+"<drawstep func='triangle' "
+"fg_color='green' "
+"fill='foreground' "
+"width='10' "
+"height='5' "
+"xpos='right' "
+"ypos='10' "
+"padding='0,0,7,0' "
+"orientation='bottom' "
+"/> "
+"<drawstep func='triangle' "
+"fg_color='green' "
+"fill='foreground' "
+"width='10' "
+"height='5' "
+"xpos='right' "
+"ypos='4' "
+"padding='0,0,7,0' "
+"orientation='top' "
+"/> "
+"<text font='text_default' "
+"text_color='color_normal' "
+"vertical_align='center' "
+"horizontal_align='left' "
+"/> "
+"</drawdata> "
+"<drawdata id='popup_idle' cache='false' resolution='y<400'> "
+"<drawstep func='bevelsq' "
+"bevel='2' "
+"fill='none' "
+"/> "
+"<drawstep func='triangle' "
+"fg_color='green' "
+"fill='foreground' "
+"width='7' "
+"height='4' "
+"xpos='right' "
+"ypos='9' "
+"padding='0,0,3,0' "
+"orientation='bottom' "
+"/> "
+"<drawstep func='triangle' "
+"fg_color='green' "
+"fill='foreground' "
+"width='7' "
+"height='4' "
+"xpos='right' "
+"ypos='4' "
+"padding='0,0,3,0' "
+"orientation='top' "
+"/> "
+"<text font='text_default' "
+"text_color='color_normal' "
+"vertical_align='center' "
+"horizontal_align='left' "
+"/> "
+"</drawdata> "
+"<drawdata id='popup_disabled' cache='false' resolution='y>399'> "
+"<drawstep func='bevelsq' "
+"bevel='2' "
+"fill='none' "
+"/> "
+"<drawstep func='triangle' "
+"fg_color='green' "
+"fill='foreground' "
+"width='10' "
+"height='5' "
+"xpos='right' "
+"ypos='10' "
+"padding='0,0,7,0' "
+"orientation='bottom' "
+"/> "
+"<drawstep func='triangle' "
+"fg_color='green' "
+"fill='foreground' "
+"width='10' "
+"height='5' "
+"xpos='right' "
+"ypos='4' "
+"padding='0,0,7,0' "
+"orientation='top' "
+"/> "
+"<text font='text_default' "
+"text_color='color_normal_disabled' "
+"vertical_align='center' "
+"horizontal_align='left' "
+"/> "
+"</drawdata> "
+"<drawdata id='popup_disabled' cache='false' resolution='y<400'> "
+"<drawstep func='bevelsq' "
+"bevel='2' "
+"fill='none' "
+"/> "
+"<drawstep func='triangle' "
+"fg_color='green' "
+"fill='foreground' "
+"width='7' "
+"height='4' "
+"xpos='right' "
+"ypos='9' "
+"padding='0,0,3,0' "
+"orientation='bottom' "
+"/> "
+"<drawstep func='triangle' "
+"fg_color='green' "
+"fill='foreground' "
+"width='7' "
+"height='4' "
+"xpos='right' "
+"ypos='4' "
+"padding='0,0,3,0' "
+"orientation='top' "
+"/> "
+"<text font='text_default' "
+"text_color='color_normal' "
+"vertical_align='center' "
+"horizontal_align='left' "
+"/> "
+"</drawdata> "
+"<drawdata id='popup_hover' cache='false' resolution='y>399'> "
+"<drawstep func='bevelsq' "
+"bevel='2' "
+"fill='none' "
+"/> "
+"<drawstep func='triangle' "
+"fg_color='green' "
+"fill='foreground' "
+"width='10' "
+"height='5' "
+"xpos='right' "
+"ypos='10' "
+"padding='0,0,7,0' "
+"orientation='bottom' "
+"/> "
+"<drawstep func='triangle' "
+"fg_color='green' "
+"fill='foreground' "
+"width='10' "
+"height='5' "
+"xpos='right' "
+"ypos='4' "
+"padding='0,0,7,0' "
+"orientation='top' "
+"/> "
+"<text font='text_default' "
+"text_color='color_normal_hover' "
+"vertical_align='center' "
+"horizontal_align='left' "
+"/> "
+"</drawdata> "
+"<drawdata id='popup_hover' cache='false' resolution='y<400'> "
+"<drawstep func='bevelsq' "
+"bevel='2' "
+"fill='none' "
+"/> "
+"<drawstep func='triangle' "
+"fg_color='green' "
+"fill='foreground' "
+"width='7' "
+"height='4' "
+"xpos='right' "
+"ypos='9' "
+"padding='0,0,3,0' "
+"orientation='bottom' "
+"/> "
+"<drawstep func='triangle' "
+"fg_color='green' "
+"fill='foreground' "
+"width='7' "
+"height='4' "
+"xpos='right' "
+"ypos='4' "
+"padding='0,0,3,0' "
+"orientation='top' "
+"/> "
+"<text font='text_default' "
+"text_color='color_normal' "
+"vertical_align='center' "
+"horizontal_align='left' "
+"/> "
+"</drawdata> "
+"<drawdata id='widget_textedit' cache='false'> "
+"<drawstep func='bevelsq' "
+"bevel='2' "
+"fill='none' "
+"/> "
+"</drawdata> "
+"<drawdata id='plain_bg' cache='false'> "
+"<drawstep func='bevelsq' "
+"bevel='2' "
+"/> "
+"</drawdata> "
+"<drawdata id='caret' cache='false'> "
+"<drawstep func='square' "
+"fill='foreground' "
+"fg_color='lightgrey' "
+"/> "
+"</drawdata> "
+"<drawdata id='default_bg' cache='false'> "
+"<drawstep func='bevelsq' "
+"bevel='2' "
+"/> "
+"</drawdata> "
+"<drawdata id='button_idle' cache='false'> "
+"<text font='text_button' "
+"text_color='color_button' "
+"vertical_align='center' "
+"horizontal_align='center' "
+"/> "
+"<drawstep func='bevelsq' "
+"bevel='2' "
+"fill='none' "
+"/> "
+"</drawdata> "
+"<drawdata id='button_hover' cache='false'> "
+"<text font='text_button' "
+"text_color='color_button_hover' "
+"vertical_align='center' "
+"horizontal_align='center' "
+"/> "
+"<drawstep func='bevelsq' "
+"bevel='2' "
+"fill='none' "
+"/> "
+"</drawdata> "
+"<drawdata id='button_disabled' cache='false'> "
+"<text font='text_button' "
+"text_color='color_button_disabled' "
+"vertical_align='center' "
+"horizontal_align='center' "
+"/> "
+"<drawstep func='bevelsq' "
+"bevel='2' "
+"fill='none' "
+"/> "
+"</drawdata> "
+"<drawdata id='checkbox_disabled' cache='false'> "
+"<text font='text_default' "
+"text_color='color_normal_disabled' "
+"vertical_align='top' "
+"horizontal_align='left' "
+"/> "
+"<drawstep func='bevelsq' "
+"bevel='2' "
+"fill='none' "
+"/> "
+"</drawdata> "
+"<drawdata id='checkbox_selected' cache='false'> "
+"<text font='text_default' "
+"text_color='color_normal' "
+"vertical_align='top' "
+"horizontal_align='left' "
+"/> "
+"<drawstep func='bevelsq' "
+"bevel='2' "
+"fill='none' "
+"/> "
+"<drawstep func='cross' "
+"fill='foreground' "
+"stroke='2' "
+"fg_color='green' "
+"/> "
+"</drawdata> "
+"<drawdata id='checkbox_default' cache='false'> "
+"<text font='text_default' "
+"text_color='color_normal' "
+"vertical_align='top' "
+"horizontal_align='left' "
+"/> "
+"<drawstep func='bevelsq' "
+"bevel='2' "
+"fill='none' "
+"/> "
+"</drawdata> "
+"<drawdata id='radiobutton_default' cache='false'> "
+"<text font='text_default' "
+"text_color='color_normal' "
+"vertical_align='center' "
+"horizontal_align='left' "
+"/> "
+"<drawstep func='circle' "
+"width='7' "
+"height='7' "
+"radius='7' "
+"fill='background' "
+"bg_color='darkgrey' "
+"xpos='0' "
+"ypos='0' "
+"/> "
+"</drawdata> "
+"<drawdata id='radiobutton_selected' cache='false'> "
+"<text font='text_default' "
+"text_color='color_normal' "
+"vertical_align='center' "
+"horizontal_align='left' "
+"/> "
+"<drawstep func='circle' "
+"width='7' "
+"height='7' "
+"radius='7' "
+"fg_color='darkgrey' "
+"fill='none' "
+"xpos='0' "
+"ypos='0' "
+"/> "
+"<drawstep func='circle' "
+"width='7' "
+"height='7' "
+"radius='5' "
+"fg_color='green' "
+"fill='foreground' "
+"xpos='2' "
+"ypos='2' "
+"/> "
+"</drawdata> "
+"<drawdata id='radiobutton_disabled' cache='false'> "
+"<text font='text_default' "
+"text_color='color_normal_disabled' "
+"vertical_align='center' "
+"horizontal_align='left' "
+"/> "
+"<drawstep func='circle' "
+"width='7' "
+"height='7' "
+"radius='7' "
+"bg_color='lightgrey' "
+"fill='background' "
+"xpos='0' "
+"ypos='0' "
+"/> "
+"</drawdata> "
+"<drawdata id='widget_default' cache='false'> "
+"<drawstep func='bevelsq' "
+"bevel='2' "
+"/> "
+"</drawdata> "
+"<drawdata id='widget_small' cache='false'> "
+"<drawstep func='square' "
+"stroke='0' "
+"/> "
+"</drawdata> "
+"</render_info> "
+"<layout_info resolution='y<400'> "
"<globals> "
-"<def var='Line.Height' value='16' /> "
-"<def var='Font.Height' value='16' /> "
-"<def var='About.OuterBorder' value='80'/> "
-"<def var='Layout.Spacing' value='8' /> "
+"<def var='Line.Height' value='12' /> "
+"<def var='Font.Height' value='10' /> "
+"<def var='About.OuterBorder' value='10'/> "
+"<def var='Layout.Spacing' value='8'/> "
"<def var='ShowLauncherLogo' value='0'/> "
"<def var='ShowGlobalMenuLogo' value='0'/> "
"<def var='ShowSearchPic' value='0'/> "
-"<def var='SaveLoadChooser.ExtInfo.Visible' value='1'/> "
-"<def var='KeyMapper.Spacing' value='10'/> "
-"<def var='KeyMapper.LabelWidth' value='100'/> "
-"<def var='KeyMapper.ButtonWidth' value='80'/> "
-"<def var='Tooltip.MaxWidth' value='200'/> "
-"<def var='Tooltip.XDelta' value='16'/> "
-"<def var='Tooltip.YDelta' value='16'/> "
+"<def var='SaveLoadChooser.ExtInfo.Visible' value='0'/> "
+"<def var='KeyMapper.Spacing' value='5'/> "
+"<def var='KeyMapper.LabelWidth' value='80'/> "
+"<def var='KeyMapper.ButtonWidth' value='60'/> "
+"<def var='Tooltip.MaxWidth' value='70'/> "
+"<def var='Tooltip.XDelta' value='8'/> "
+"<def var='Tooltip.YDelta' value='8'/> "
+"<widget name='Button' "
+"size='72,16' "
+"/> "
+"<widget name='Slider' "
+"size='85,12' "
+"/> "
"<widget name='OptionsLabel' "
"size='110,Globals.Line.Height' "
"textalign='right' "
"/> "
"<widget name='SmallLabel' "
-"size='24,Globals.Line.Height' "
-"/> "
-"<widget name='ShortOptionsLabel' "
-"size='60,Globals.Line.Height' "
-"/> "
-"<widget name='Button' "
-"size='108,24' "
-"/> "
-"<widget name='Slider' "
-"size='128,18' "
+"size='18,Globals.Line.Height' "
"/> "
"<widget name='PopUp' "
-"size='-1,19' "
+"size='-1,15' "
"/> "
"<widget name='Checkbox' "
-"size='-1,14' "
+"size='-1,Globals.Line.Height' "
"/> "
"<widget name='Radiobutton' "
"size='-1,Globals.Line.Height' "
"/> "
"<widget name='ListWidget' "
-"padding='5,0,8,0' "
+"padding='5,0,0,0' "
"/> "
"<widget name='PopUpWidget' "
"padding='7,5,0,0' "
@@ -53,28 +650,28 @@
"padding='7,5,5,5' "
"/> "
"<widget name='Scrollbar' "
-"size='15,0' "
+"size='9,0' "
"/> "
"<widget name='TabWidget.Tab' "
-"size='75,27' "
-"padding='0,0,8,0' "
+"size='45,16' "
+"padding='0,0,2,0' "
"/> "
"<widget name='TabWidget.Body' "
-"padding='0,0,0,0' "
+"padding='0,0,0,-8' "
"/> "
"<widget name='TabWidget.NavButton' "
-"size='15,18' "
-"padding='0,3,4,0' "
+"size='32,18' "
+"padding='0,0,1,0' "
"/> "
"</globals> "
"<dialog name='Launcher' overlays='screen'> "
-"<layout type='vertical' center='true' padding='16,16,8,8'> "
+"<layout type='vertical' center='true' padding='6,6,2,2'> "
"<widget name='Version' "
"height='Globals.Line.Height' "
"/> "
-"<layout type='horizontal' spacing='5' padding='10,0,0,0'> "
+"<layout type='horizontal' spacing='5' padding='0,0,0,0'> "
"<widget name='SearchDesc' "
-"width='60' "
+"width='50' "
"height='Globals.Line.Height' "
"textalign='right' "
"/> "
@@ -89,39 +686,38 @@
"<space /> "
"</layout> "
"<widget name='GameList'/> "
-"<layout type='horizontal' padding='0,0,0,0' spacing='10'> "
+"<layout type='horizontal' padding='0,0,0,0' spacing='8'> "
"<widget name='LoadGameButton' "
-"height='20' "
+"height='12' "
"/> "
"<widget name='AddGameButton' "
-"height='20' "
+"height='12' "
"/> "
"<widget name='EditGameButton' "
-"height='20' "
+"height='12' "
"/> "
"<widget name='RemoveGameButton' "
-"height='20' "
+"height='12' "
"/> "
"</layout> "
-"<space size='4'/> "
-"<layout type='horizontal' padding='0,0,0,0' spacing='10'> "
+"<layout type='horizontal' padding='0,0,0,0' spacing='8'> "
"<widget name='QuitButton' "
-"height='20' "
+"height='12' "
"/> "
"<widget name='AboutButton' "
-"height='20' "
+"height='12' "
"/> "
"<widget name='OptionsButton' "
-"height='20' "
+"height='12' "
"/> "
"<widget name='StartButton' "
-"height='20' "
+"height='12' "
"/> "
"</layout> "
"</layout> "
"</dialog> "
-"<dialog name='Browser' overlays='Dialog.Launcher.GameList' shading='dim'> "
-"<layout type='vertical' padding='8,8,8,8'> "
+"<dialog name='Browser' overlays='screen' inset='8' shading='dim'> "
+"<layout type='vertical' padding='8,8,0,4'> "
"<widget name='Headline' "
"height='Globals.Line.Height' "
"/> "
@@ -129,7 +725,7 @@
"height='Globals.Line.Height' "
"/> "
"<widget name='List'/> "
-"<layout type='horizontal' padding='0,0,16,0'> "
+"<layout type='horizontal' padding='0,0,8,0'> "
"<widget name='Up' "
"type='Button' "
"/> "
@@ -143,10 +739,10 @@
"</layout> "
"</layout> "
"</dialog> "
-"<dialog name='GlobalOptions' overlays='Dialog.Launcher.GameList' shading='dim'> "
+"<dialog name='GlobalOptions' overlays='screen' inset='16' shading='dim'> "
"<layout type='vertical' padding='0,0,0,0'> "
"<widget name='TabWidget'/> "
-"<layout type='horizontal' padding='16,16,16,16'> "
+"<layout type='horizontal' padding='8,8,8,8'> "
"<space/> "
"<widget name='Cancel' "
"type='Button' "
@@ -159,7 +755,7 @@
"</dialog> "
"<dialog name='GlobalOptions_Graphics' overlays='Dialog.GlobalOptions.TabWidget'> "
"<layout type='vertical' padding='16,16,16,16' spacing='8'> "
-"<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'> "
+"<layout type='horizontal' padding='0,0,0,0' spacing='6' center='true'> "
"<widget name='grModePopupDesc' "
"type='OptionsLabel' "
"/> "
@@ -167,7 +763,7 @@
"type='PopUp' "
"/> "
"</layout> "
-"<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'> "
+"<layout type='horizontal' padding='0,0,0,0' spacing='6' center='true'> "
"<widget name='grRenderPopupDesc' "
"type='OptionsLabel' "
"/> "
@@ -188,7 +784,7 @@
"</dialog> "
"<dialog name='GlobalOptions_Audio' overlays='Dialog.GlobalOptions.TabWidget'> "
"<layout type='vertical' padding='16,16,16,16' spacing='8'> "
-"<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'> "
+"<layout type='horizontal' padding='0,0,0,0' spacing='6' center='true'> "
"<widget name='auMidiPopupDesc' "
"type='OptionsLabel' "
"/> "
@@ -196,7 +792,7 @@
"type='PopUp' "
"/> "
"</layout> "
-"<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'> "
+"<layout type='horizontal' padding='0,0,0,0' spacing='6' center='true'> "
"<widget name='auOPLPopupDesc' "
"type='OptionsLabel' "
"/> "
@@ -204,7 +800,7 @@
"type='PopUp' "
"/> "
"</layout> "
-"<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'> "
+"<layout type='horizontal' padding='0,0,0,0' spacing='6' center='true'> "
"<widget name='auSampleRatePopupDesc' "
"type='OptionsLabel' "
"/> "
@@ -212,7 +808,7 @@
"type='PopUp' "
"/> "
"</layout> "
-"<layout type='horizontal' padding='0,0,0,0' spacing='10'> "
+"<layout type='horizontal' padding='0,0,0,0' spacing='3' center='true'> "
"<widget name='subToggleDesc' "
"type='OptionsLabel' "
"/> "
@@ -226,7 +822,7 @@
"type='Radiobutton' "
"/> "
"</layout> "
-"<layout type='horizontal' padding='0,0,0,0' spacing='10'> "
+"<layout type='horizontal' padding='0,0,0,0' spacing='6' center='true'> "
"<widget name='subSubtitleSpeedDesc' "
"type='OptionsLabel' "
"/> "
@@ -240,9 +836,8 @@
"</layout> "
"</dialog> "
"<dialog name='GlobalOptions_Volume' overlays='Dialog.GlobalOptions.TabWidget'> "
-"<layout type='horizontal' padding='16,16,16,16' spacing='8'> "
-"<layout type='vertical' padding='0,0,0,0' spacing='8'> "
-"<layout type='horizontal' padding='0,0,0,0'> "
+"<layout type='vertical' padding='16,16,16,16' spacing='8'> "
+"<layout type='horizontal' padding='0,0,0,0' spacing='6' center='true'> "
"<widget name='vcMusicText' "
"type='OptionsLabel' "
"/> "
@@ -253,7 +848,7 @@
"type='SmallLabel' "
"/> "
"</layout> "
-"<layout type='horizontal' padding='0,0,0,0'> "
+"<layout type='horizontal' padding='0,0,0,0' spacing='6' center='true'> "
"<widget name='vcSfxText' "
"type='OptionsLabel' "
"/> "
@@ -264,7 +859,7 @@
"type='SmallLabel' "
"/> "
"</layout> "
-"<layout type='horizontal' padding='0,0,0,0'> "
+"<layout type='horizontal' padding='0,0,0,0' spacing='6' center='true'> "
"<widget name='vcSpeechText' "
"type='OptionsLabel' "
"/> "
@@ -275,8 +870,8 @@
"type='SmallLabel' "
"/> "
"</layout> "
-"</layout> "
-"<layout type='vertical' padding='24,0,24,0' center='true'> "
+"<layout type='horizontal' padding='0,0,0,0' spacing='6' center='true'> "
+"<space size='110' /> "
"<widget name='vcMuteCheckbox' "
"type='Checkbox' "
"/> "
@@ -285,7 +880,7 @@
"</dialog> "
"<dialog name='GlobalOptions_MIDI' overlays='Dialog.GlobalOptions.TabWidget'> "
"<layout type='vertical' padding='16,16,16,16' spacing='8'> "
-"<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'> "
+"<layout type='horizontal' padding='0,0,0,0' spacing='6' center='true'> "
"<widget name='auPrefGmPopupDesc' "
"type='OptionsLabel' "
"/> "
@@ -293,7 +888,7 @@
"type='PopUp' "
"/> "
"</layout> "
-"<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'> "
+"<layout type='horizontal' padding='0,0,0,0' spacing='16' center='true'> "
"<widget name='mcFontButton' "
"type='Button' "
"/> "
@@ -308,7 +903,7 @@
"<widget name='mcMixedCheckbox' "
"type='Checkbox' "
"/> "
-"<layout type='horizontal' padding='0,0,0,0'> "
+"<layout type='horizontal' padding='0,0,0,0' spacing='6' center='true'> "
"<widget name='mcMidiGainText' "
"type='OptionsLabel' "
"/> "
@@ -324,7 +919,7 @@
"</dialog> "
"<dialog name='GlobalOptions_MT32' overlays='Dialog.GlobalOptions.TabWidget'> "
"<layout type='vertical' padding='16,16,16,16' spacing='8'> "
-"<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'> "
+"<layout type='horizontal' padding='0,0,0,0' spacing='6' center='true'> "
"<widget name='auPrefMt32PopupDesc' "
"type='OptionsLabel' "
"/> "
@@ -342,7 +937,7 @@
"</dialog> "
"<dialog name='GlobalOptions_Paths' overlays='Dialog.GlobalOptions.TabWidget'> "
"<layout type='vertical' padding='16,16,16,16' spacing='8'> "
-"<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'> "
+"<layout type='horizontal' padding='0,0,0,0' spacing='16'> "
"<widget name='SaveButton' "
"type='Button' "
"/> "
@@ -354,7 +949,7 @@
"width='Globals.Line.Height' "
"/> "
"</layout> "
-"<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'> "
+"<layout type='horizontal' padding='0,0,0,0' spacing='16'> "
"<widget name='ThemeButton' "
"type='Button' "
"/> "
@@ -366,7 +961,7 @@
"width='Globals.Line.Height' "
"/> "
"</layout> "
-"<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'> "
+"<layout type='horizontal' padding='0,0,0,0' spacing='16'> "
"<widget name='ExtraButton' "
"type='Button' "
"/> "
@@ -390,7 +985,7 @@
"</dialog> "
"<dialog name='GlobalOptions_Misc' overlays='Dialog.GlobalOptions.TabWidget'> "
"<layout type='vertical' padding='16,16,16,16' spacing='8'> "
-"<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'> "
+"<layout type='horizontal' padding='0,0,0,0' spacing='16'> "
"<widget name='ThemeButton' "
"type='Button' "
"/> "
@@ -398,25 +993,31 @@
"height='Globals.Line.Height' "
"/> "
"</layout> "
-"<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'> "
+"<layout type='horizontal' padding='0,0,0,0' spacing='6' center='true'> "
"<widget name='RendererPopupDesc' "
-"type='OptionsLabel' "
+"width='80' "
+"height='Globals.Line.Height' "
+"textalign='right' "
"/> "
"<widget name='RendererPopup' "
"type='PopUp' "
"/> "
"</layout> "
-"<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'> "
+"<layout type='horizontal' padding='0,0,0,0' spacing='6' center='true'> "
"<widget name='AutosavePeriodPopupDesc' "
-"type='OptionsLabel' "
+"width='80' "
+"height='Globals.Line.Height' "
+"textalign='right' "
"/> "
"<widget name='AutosavePeriodPopup' "
"type='PopUp' "
"/> "
"</layout> "
-"<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'> "
+"<layout type='horizontal' padding='0,0,0,0' spacing='6' center='true'> "
"<widget name='GuiLanguagePopupDesc' "
-"type='OptionsLabel' "
+"width='80' "
+"height='Globals.Line.Height' "
+"textalign='right' "
"/> "
"<widget name='GuiLanguagePopup' "
"type='PopUp' "
@@ -451,10 +1052,10 @@
"</layout> "
"</layout> "
"</dialog> "
-"<dialog name='GameOptions' overlays='Dialog.Launcher.GameList' shading='dim'> "
+"<dialog name='GameOptions' overlays='screen' inset='16' shading='dim'> "
"<layout type='vertical' padding='0,0,0,0' spacing='16'> "
"<widget name='TabWidget'/> "
-"<layout type='horizontal' padding='16,16,16,4'> "
+"<layout type='horizontal' padding='8,8,8,8'> "
"<space/> "
"<widget name='Cancel' "
"type='Button' "
@@ -466,7 +1067,7 @@
"</layout> "
"</dialog> "
"<dialog name='GameOptions_Graphics' overlays='Dialog.GlobalOptions.TabWidget'> "
-"<layout type='vertical' padding='16,16,16,16' spacing='8'> "
+"<layout type='vertical' padding='8,8,8,8' spacing='6'> "
"<widget name='EnableTabCheckbox' "
"type='Checkbox' "
"/> "
@@ -474,7 +1075,7 @@
"</layout> "
"</dialog> "
"<dialog name='GameOptions_Audio' overlays='Dialog.GlobalOptions.TabWidget'> "
-"<layout type='vertical' padding='16,16,16,16' spacing='8'> "
+"<layout type='vertical' padding='8,8,8,8' spacing='6'> "
"<widget name='EnableTabCheckbox' "
"type='Checkbox' "
"/> "
@@ -482,7 +1083,7 @@
"</layout> "
"</dialog> "
"<dialog name='GameOptions_MIDI' overlays='Dialog.GlobalOptions.TabWidget'> "
-"<layout type='vertical' padding='16,16,16,16' spacing='8'> "
+"<layout type='vertical' padding='8,8,8,8' spacing='6'> "
"<widget name='EnableTabCheckbox' "
"type='Checkbox' "
"/> "
@@ -490,7 +1091,7 @@
"</layout> "
"</dialog> "
"<dialog name='GameOptions_MT32' overlays='Dialog.GlobalOptions.TabWidget'> "
-"<layout type='vertical' padding='16,16,16,16' spacing='8'> "
+"<layout type='vertical' padding='8,8,8,8' spacing='6'> "
"<widget name='EnableTabCheckbox' "
"type='Checkbox' "
"/> "
@@ -498,7 +1099,7 @@
"</layout> "
"</dialog> "
"<dialog name='GameOptions_Volume' overlays='Dialog.GlobalOptions.TabWidget'> "
-"<layout type='vertical' padding='16,16,16,16' spacing='8'> "
+"<layout type='vertical' padding='8,8,8,8' spacing='6'> "
"<widget name='EnableTabCheckbox' "
"type='Checkbox' "
"/> "
@@ -506,34 +1107,43 @@
"</layout> "
"</dialog> "
"<dialog name='GameOptions_Game' overlays='Dialog.GameOptions.TabWidget' shading='dim'> "
-"<layout type='vertical' padding='16,16,16,16'> "
-"<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'> "
+"<layout type='vertical' padding='8,8,8,8'> "
+"<layout type='horizontal' padding='0,0,0,0' spacing='6' center='true'> "
"<widget name='Id' "
-"type='OptionsLabel' "
+"width='35' "
+"height='Globals.Line.Height' "
+"textalign='right' "
"/> "
"<widget name='Domain' "
"type='PopUp' "
"/> "
"</layout> "
-"<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'> "
+"<layout type='horizontal' padding='0,0,0,0' spacing='6' center='true'> "
"<widget name='Name' "
-"type='OptionsLabel' "
+"width='35' "
+"height='Globals.Line.Height' "
+"textalign='right' "
"/> "
"<widget name='Desc' "
"type='PopUp' "
"/> "
"</layout> "
-"<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'> "
+"<space size='8'/> "
+"<layout type='horizontal' padding='0,0,0,0' spacing='6' center='true'> "
"<widget name='LangPopupDesc' "
-"type='OptionsLabel' "
+"width='60' "
+"height='Globals.Line.Height' "
+"textalign='right' "
"/> "
"<widget name='LangPopup' "
"type='PopUp' "
"/> "
"</layout> "
-"<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'> "
+"<layout type='horizontal' padding='0,0,0,0' spacing='6' center='true'> "
"<widget name='PlatformPopupDesc' "
-"type='OptionsLabel' "
+"width='60' "
+"height='Globals.Line.Height' "
+"textalign='right' "
"/> "
"<widget name='PlatformPopup' "
"type='PopUp' "
@@ -542,8 +1152,8 @@
"</layout> "
"</dialog> "
"<dialog name='GameOptions_Paths' overlays='Dialog.GameOptions.TabWidget' shading='dim'> "
-"<layout type='vertical' padding='16,16,16,16'> "
-"<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'> "
+"<layout type='vertical' padding='8,8,8,8'> "
+"<layout type='horizontal' padding='0,0,0,0' spacing='16' center='true'> "
"<widget name='Savepath' "
"type='Button' "
"/> "
@@ -555,7 +1165,7 @@
"width='Globals.Line.Height' "
"/> "
"</layout> "
-"<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'> "
+"<layout type='horizontal' padding='0,0,0,0' spacing='16' center='true'> "
"<widget name='Extrapath' "
"type='Button' "
"/> "
@@ -567,7 +1177,7 @@
"width='Globals.Line.Height' "
"/> "
"</layout> "
-"<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'> "
+"<layout type='horizontal' padding='0,0,0,0' spacing='16' center='true'> "
"<widget name='Gamepath' "
"type='Button' "
"/> "
@@ -578,57 +1188,55 @@
"</layout> "
"</dialog> "
"<dialog name='GlobalMenu' overlays='screen_center'> "
-"<layout type='vertical' padding='16,16,16,16' center='true'> "
+"<layout type='vertical' padding='2,2,4,6' center='true' spacing='6'> "
"<widget name='Title' "
-"width='210' "
-"height='Globals.Line.Height' "
+"width='160' "
+"height='4' "
"/> "
"<widget name='Version' "
-"width='210' "
-"height='Globals.Line.Height' "
-"/> "
-"<widget name='Resume' "
-"width='150' "
-"height='Globals.Button.Height' "
+"width='160' "
+"height='4' "
"/> "
-"<space size='10'/> "
+"<space size='1'/> "
"<widget name='Load' "
-"width='150' "
-"height='Globals.Button.Height' "
+"width='120' "
+"height='12' "
"/> "
"<widget name='Save' "
-"width='150' "
-"height='Globals.Button.Height' "
+"width='120' "
+"height='12' "
"/> "
-"<space size='10'/> "
+"<space size='1'/> "
"<widget name='Options' "
-"width='150' "
-"height='Globals.Button.Height' "
+"width='120' "
+"height='12' "
"/> "
"<widget name='Help' "
-"width='150' "
-"height='Globals.Button.Height' "
+"width='120' "
+"height='12' "
"/> "
"<widget name='About' "
-"width='150' "
-"height='Globals.Button.Height' "
+"width='120' "
+"height='12' "
+"/> "
+"<space size='1'/> "
+"<widget name='Resume' "
+"width='120' "
+"height='12' "
"/> "
-"<space size='10'/> "
"<widget name='RTL' "
-"width='150' "
-"height='Globals.Button.Height' "
+"width='120' "
+"height='12' "
"/> "
"<widget name='Quit' "
-"width='150' "
-"height='Globals.Button.Height' "
+"width='120' "
+"height='12' "
"/> "
"</layout> "
"</dialog> "
"<dialog name='GlobalConfig' overlays='screen_center'> "
"<layout type='vertical' padding='8,8,8,8'> "
-"<layout type='horizontal' padding='0,0,0,0'> "
-"<layout type='vertical' padding='0,0,0,0' center='true'> "
-"<layout type='horizontal' padding='0,0,0,0' spacing='8'> "
+"<layout type='horizontal' padding='0,0,0,0' spacing='6' center='true'> "
"<widget name='vcMusicText' "
"type='OptionsLabel' "
"/> "
@@ -639,7 +1247,7 @@
"type='SmallLabel' "
"/> "
"</layout> "
-"<layout type='horizontal' padding='0,0,0,0' spacing='8'> "
+"<layout type='horizontal' padding='0,0,0,0' spacing='6' center='true'> "
"<widget name='vcSfxText' "
"type='OptionsLabel' "
"/> "
@@ -650,7 +1258,7 @@
"type='SmallLabel' "
"/> "
"</layout> "
-"<layout type='horizontal' padding='0,0,0,0' spacing='8'> "
+"<layout type='horizontal' padding='0,0,0,0' spacing='6' center='true'> "
"<widget name='vcSpeechText' "
"type='OptionsLabel' "
"/> "
@@ -661,33 +1269,34 @@
"type='SmallLabel' "
"/> "
"</layout> "
-"</layout> "
-"<layout type='vertical' padding='24,24,24,24' center='true'> "
+"<layout type='horizontal' padding='0,0,0,0' spacing='6' center='true'> "
+"<space size='110' /> "
"<widget name='vcMuteCheckbox' "
"type='Checkbox' "
-"width='80' "
+"width='80' "
"/> "
"</layout> "
-"</layout> "
-"<space size='8' /> "
-"<layout type='horizontal' padding='0,0,0,0' spacing='10'> "
+"<layout type='vertical' padding='0,0,0,0' spacing='1' center='true'> "
"<widget name='subToggleDesc' "
"type='OptionsLabel' "
"/> "
+"<layout type='horizontal' padding='0,0,0,0' spacing='6' center='true'> "
"<widget name='subToggleSpeechOnly' "
"type='Radiobutton' "
-"width='100' "
+"width='90' "
"/> "
"<widget name='subToggleSubOnly' "
"type='Radiobutton' "
-"width='100' "
+"width='90' "
"/> "
"<widget name='subToggleSubBoth' "
"type='Radiobutton' "
-"width='100' "
+"width='90' "
"/> "
"</layout> "
-"<layout type='horizontal' padding='0,0,0,0' spacing='10'> "
+"</layout> "
+"<space size='2' /> "
+"<layout type='horizontal' padding='0,0,0,0' spacing='6' center='true'> "
"<widget name='subSubtitleSpeedDesc' "
"type='OptionsLabel' "
"/> "
@@ -698,8 +1307,8 @@
"type='SmallLabel' "
"/> "
"</layout> "
-"<space size='60'/> "
-"<layout type='horizontal' padding='0,0,0,0' spacing='10'> "
+"<space size='16'/> "
+"<layout type='horizontal' padding='0,0,0,0' spacing='4'> "
"<widget name='Keys' "
"type='Button' "
"/> "
@@ -714,23 +1323,15 @@
"</layout> "
"</dialog> "
"<dialog name='SaveLoadChooser' overlays='screen' inset='8' shading='dim'> "
-"<layout type='vertical' padding='8,8,8,32' center='true'> "
-"<widget name='Title' "
-"height='Globals.Line.Height' "
-"/> "
-"<layout type='horizontal' padding='0,0,0,16' spacing='16'> "
+"<layout type='vertical' padding='8,8,8,8' center='true'> "
+"<widget name='Title' height='Globals.Line.Height'/> "
"<widget name='List' /> "
-"<widget name='Thumbnail' "
-"width='180' "
-"height='200' "
-"/> "
-"</layout> "
-"<layout type='horizontal' padding='0,0,0,0'> "
+"<layout type='horizontal' padding='0,0,16,0'> "
"<space/> "
"<widget name='Delete' "
"type='Button' "
"/> "
-"<space size='32'/> "
+"<space size='16'/> "
"<widget name='Cancel' "
"type='Button' "
"/> "
@@ -740,16 +1341,16 @@
"</layout> "
"</layout> "
"</dialog> "
-"<dialog name='ScummHelp' overlays='screen_center'> "
-"<layout type='vertical' padding='8,8,8,8' center='true'> "
+"<dialog name='ScummHelp' overlays='screen'> "
+"<layout type='vertical' padding='8,8,8,8'> "
"<widget name='Title' "
-"width='320' "
+"width='180' "
"height='Globals.Line.Height' "
"/> "
"<widget name='HelpText' "
-"height='200' "
+"height='140' "
"/> "
-"<layout type='horizontal' padding='0,0,16,0'> "
+"<layout type='horizontal' padding='0,0,0,0'> "
"<widget name='Prev' "
"type='Button' "
"/> "
@@ -766,7 +1367,7 @@
"<dialog name='LoomTownsDifficultyDialog' overlays='screen_center'> "
"<layout type='vertical' padding='8,8,8,8' center='true'> "
"<widget name='Description1' "
-"width='320' "
+"width='280' "
"height='Globals.Line.Height' "
"/> "
"<widget name='Description2' "
@@ -784,20 +1385,20 @@
"</layout> "
"</dialog> "
"<dialog name='MassAdd' overlays='screen_center' shading='dim'> "
-"<layout type='vertical' padding='8,8,32,8' center='true'> "
+"<layout type='vertical' padding='4,4,16,4' center='true'> "
"<widget name='DirProgressText' "
-"width='480' "
+"width='280' "
"height='Globals.Line.Height' "
"/> "
"<widget name='GameProgressText' "
-"width='480' "
+"width='280' "
"height='Globals.Line.Height' "
"/> "
"<widget name='GameList' "
-"width='480' "
-"height='250' "
+"width='280' "
+"height='100' "
"/> "
-"<layout type='horizontal' padding='8,8,8,8'> "
+"<layout type='horizontal' padding='4,4,4,4'> "
"<widget name='Ok' "
"type='Button' "
"/> "
@@ -808,20 +1409,20 @@
"</layout> "
"</dialog> "
"<dialog name='KeyMapper' overlays='screen_center' shading='dim'> "
-"<layout type='vertical' padding='8,8,32,8' spacing='10' center='true'> "
+"<layout type='vertical' padding='8,8,8,8' spacing='10' center='true'> "
"<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'> "
"<widget name='PopupDesc' "
"type='OptionsLabel' "
"/> "
"<widget name='Popup' "
"type='PopUp' "
-"width='400' "
+"width='150' "
"height='Globals.Line.Height' "
"/> "
"</layout> "
"<widget name='KeymapArea' "
-"width='600' "
-"height='280' "
+"width='300' "
+"height='120' "
"/> "
"<widget name='Close' "
"type='Button' "
@@ -829,46 +1430,49 @@
"</layout> "
"</dialog> "
"</layout_info> "
-"<layout_info resolution='y<400'> "
+"<layout_info resolution='y>399'> "
"<globals> "
-"<def var='Line.Height' value='12' /> "
-"<def var='Font.Height' value='10' /> "
-"<def var='About.OuterBorder' value='10'/> "
-"<def var='Layout.Spacing' value='8'/> "
+"<def var='Line.Height' value='16' /> "
+"<def var='Font.Height' value='16' /> "
+"<def var='About.OuterBorder' value='80'/> "
+"<def var='Layout.Spacing' value='8' /> "
"<def var='ShowLauncherLogo' value='0'/> "
"<def var='ShowGlobalMenuLogo' value='0'/> "
"<def var='ShowSearchPic' value='0'/> "
-"<def var='SaveLoadChooser.ExtInfo.Visible' value='0'/> "
-"<def var='KeyMapper.Spacing' value='5'/> "
-"<def var='KeyMapper.LabelWidth' value='80'/> "
-"<def var='KeyMapper.ButtonWidth' value='60'/> "
-"<def var='Tooltip.MaxWidth' value='70'/> "
-"<def var='Tooltip.XDelta' value='8'/> "
-"<def var='Tooltip.YDelta' value='8'/> "
-"<widget name='Button' "
-"size='72,16' "
-"/> "
-"<widget name='Slider' "
-"size='85,12' "
-"/> "
+"<def var='SaveLoadChooser.ExtInfo.Visible' value='1'/> "
+"<def var='KeyMapper.Spacing' value='10'/> "
+"<def var='KeyMapper.LabelWidth' value='100'/> "
+"<def var='KeyMapper.ButtonWidth' value='80'/> "
+"<def var='Tooltip.MaxWidth' value='200'/> "
+"<def var='Tooltip.XDelta' value='16'/> "
+"<def var='Tooltip.YDelta' value='16'/> "
"<widget name='OptionsLabel' "
"size='110,Globals.Line.Height' "
"textalign='right' "
"/> "
"<widget name='SmallLabel' "
-"size='18,Globals.Line.Height' "
+"size='24,Globals.Line.Height' "
+"/> "
+"<widget name='ShortOptionsLabel' "
+"size='60,Globals.Line.Height' "
+"/> "
+"<widget name='Button' "
+"size='108,24' "
+"/> "
+"<widget name='Slider' "
+"size='128,18' "
"/> "
"<widget name='PopUp' "
-"size='-1,15' "
+"size='-1,19' "
"/> "
"<widget name='Checkbox' "
-"size='-1,Globals.Line.Height' "
+"size='-1,14' "
"/> "
"<widget name='Radiobutton' "
"size='-1,Globals.Line.Height' "
"/> "
"<widget name='ListWidget' "
-"padding='5,0,0,0' "
+"padding='5,0,8,0' "
"/> "
"<widget name='PopUpWidget' "
"padding='7,5,0,0' "
@@ -880,28 +1484,28 @@
"padding='7,5,5,5' "
"/> "
"<widget name='Scrollbar' "
-"size='9,0' "
+"size='15,0' "
"/> "
"<widget name='TabWidget.Tab' "
-"size='45,16' "
-"padding='0,0,2,0' "
+"size='75,27' "
+"padding='0,0,8,0' "
"/> "
"<widget name='TabWidget.Body' "
-"padding='0,0,0,-8' "
+"padding='0,0,0,0' "
"/> "
"<widget name='TabWidget.NavButton' "
-"size='32,18' "
-"padding='0,0,1,0' "
+"size='15,18' "
+"padding='0,3,4,0' "
"/> "
"</globals> "
"<dialog name='Launcher' overlays='screen'> "
-"<layout type='vertical' center='true' padding='6,6,2,2'> "
+"<layout type='vertical' center='true' padding='16,16,8,8'> "
"<widget name='Version' "
"height='Globals.Line.Height' "
"/> "
-"<layout type='horizontal' spacing='5' padding='0,0,0,0'> "
+"<layout type='horizontal' spacing='5' padding='10,0,0,0'> "
"<widget name='SearchDesc' "
-"width='50' "
+"width='60' "
"height='Globals.Line.Height' "
"textalign='right' "
"/> "
@@ -916,38 +1520,39 @@
"<space /> "
"</layout> "
"<widget name='GameList'/> "
-"<layout type='horizontal' padding='0,0,0,0' spacing='8'> "
+"<layout type='horizontal' padding='0,0,0,0' spacing='10'> "
"<widget name='LoadGameButton' "
-"height='12' "
+"height='20' "
"/> "
"<widget name='AddGameButton' "
-"height='12' "
+"height='20' "
"/> "
"<widget name='EditGameButton' "
-"height='12' "
+"height='20' "
"/> "
"<widget name='RemoveGameButton' "
-"height='12' "
+"height='20' "
"/> "
"</layout> "
-"<layout type='horizontal' padding='0,0,0,0' spacing='8'> "
+"<space size='4'/> "
+"<layout type='horizontal' padding='0,0,0,0' spacing='10'> "
"<widget name='QuitButton' "
-"height='12' "
+"height='20' "
"/> "
"<widget name='AboutButton' "
-"height='12' "
+"height='20' "
"/> "
"<widget name='OptionsButton' "
-"height='12' "
+"height='20' "
"/> "
"<widget name='StartButton' "
-"height='12' "
+"height='20' "
"/> "
"</layout> "
"</layout> "
"</dialog> "
-"<dialog name='Browser' overlays='screen' inset='8' shading='dim'> "
-"<layout type='vertical' padding='8,8,0,4'> "
+"<dialog name='Browser' overlays='Dialog.Launcher.GameList' shading='dim'> "
+"<layout type='vertical' padding='8,8,8,8'> "
"<widget name='Headline' "
"height='Globals.Line.Height' "
"/> "
@@ -955,7 +1560,7 @@
"height='Globals.Line.Height' "
"/> "
"<widget name='List'/> "
-"<layout type='horizontal' padding='0,0,8,0'> "
+"<layout type='horizontal' padding='0,0,16,0'> "
"<widget name='Up' "
"type='Button' "
"/> "
@@ -969,10 +1574,10 @@
"</layout> "
"</layout> "
"</dialog> "
-"<dialog name='GlobalOptions' overlays='screen' inset='16' shading='dim'> "
+"<dialog name='GlobalOptions' overlays='Dialog.Launcher.GameList' shading='dim'> "
"<layout type='vertical' padding='0,0,0,0'> "
"<widget name='TabWidget'/> "
-"<layout type='horizontal' padding='8,8,8,8'> "
+"<layout type='horizontal' padding='16,16,16,16'> "
"<space/> "
"<widget name='Cancel' "
"type='Button' "
@@ -985,7 +1590,7 @@
"</dialog> "
"<dialog name='GlobalOptions_Graphics' overlays='Dialog.GlobalOptions.TabWidget'> "
"<layout type='vertical' padding='16,16,16,16' spacing='8'> "
-"<layout type='horizontal' padding='0,0,0,0' spacing='6' center='true'> "
+"<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'> "
"<widget name='grModePopupDesc' "
"type='OptionsLabel' "
"/> "
@@ -993,7 +1598,7 @@
"type='PopUp' "
"/> "
"</layout> "
-"<layout type='horizontal' padding='0,0,0,0' spacing='6' center='true'> "
+"<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'> "
"<widget name='grRenderPopupDesc' "
"type='OptionsLabel' "
"/> "
@@ -1014,7 +1619,7 @@
"</dialog> "
"<dialog name='GlobalOptions_Audio' overlays='Dialog.GlobalOptions.TabWidget'> "
"<layout type='vertical' padding='16,16,16,16' spacing='8'> "
-"<layout type='horizontal' padding='0,0,0,0' spacing='6' center='true'> "
+"<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'> "
"<widget name='auMidiPopupDesc' "
"type='OptionsLabel' "
"/> "
@@ -1022,7 +1627,7 @@
"type='PopUp' "
"/> "
"</layout> "
-"<layout type='horizontal' padding='0,0,0,0' spacing='6' center='true'> "
+"<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'> "
"<widget name='auOPLPopupDesc' "
"type='OptionsLabel' "
"/> "
@@ -1030,7 +1635,7 @@
"type='PopUp' "
"/> "
"</layout> "
-"<layout type='horizontal' padding='0,0,0,0' spacing='6' center='true'> "
+"<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'> "
"<widget name='auSampleRatePopupDesc' "
"type='OptionsLabel' "
"/> "
@@ -1038,7 +1643,7 @@
"type='PopUp' "
"/> "
"</layout> "
-"<layout type='horizontal' padding='0,0,0,0' spacing='3' center='true'> "
+"<layout type='horizontal' padding='0,0,0,0' spacing='10'> "
"<widget name='subToggleDesc' "
"type='OptionsLabel' "
"/> "
@@ -1052,7 +1657,7 @@
"type='Radiobutton' "
"/> "
"</layout> "
-"<layout type='horizontal' padding='0,0,0,0' spacing='6' center='true'> "
+"<layout type='horizontal' padding='0,0,0,0' spacing='10'> "
"<widget name='subSubtitleSpeedDesc' "
"type='OptionsLabel' "
"/> "
@@ -1066,8 +1671,9 @@
"</layout> "
"</dialog> "
"<dialog name='GlobalOptions_Volume' overlays='Dialog.GlobalOptions.TabWidget'> "
-"<layout type='vertical' padding='16,16,16,16' spacing='8'> "
-"<layout type='horizontal' padding='0,0,0,0' spacing='6' center='true'> "
+"<layout type='horizontal' padding='16,16,16,16' spacing='8'> "
+"<layout type='vertical' padding='0,0,0,0' spacing='8'> "
+"<layout type='horizontal' padding='0,0,0,0'> "
"<widget name='vcMusicText' "
"type='OptionsLabel' "
"/> "
@@ -1078,7 +1684,7 @@
"type='SmallLabel' "
"/> "
"</layout> "
-"<layout type='horizontal' padding='0,0,0,0' spacing='6' center='true'> "
+"<layout type='horizontal' padding='0,0,0,0'> "
"<widget name='vcSfxText' "
"type='OptionsLabel' "
"/> "
@@ -1089,7 +1695,7 @@
"type='SmallLabel' "
"/> "
"</layout> "
-"<layout type='horizontal' padding='0,0,0,0' spacing='6' center='true'> "
+"<layout type='horizontal' padding='0,0,0,0'> "
"<widget name='vcSpeechText' "
"type='OptionsLabel' "
"/> "
@@ -1100,8 +1706,8 @@
"type='SmallLabel' "
"/> "
"</layout> "
-"<layout type='horizontal' padding='0,0,0,0' spacing='6' center='true'> "
-"<space size='110' /> "
+"</layout> "
+"<layout type='vertical' padding='24,0,24,0' center='true'> "
"<widget name='vcMuteCheckbox' "
"type='Checkbox' "
"/> "
@@ -1110,7 +1716,7 @@
"</dialog> "
"<dialog name='GlobalOptions_MIDI' overlays='Dialog.GlobalOptions.TabWidget'> "
"<layout type='vertical' padding='16,16,16,16' spacing='8'> "
-"<layout type='horizontal' padding='0,0,0,0' spacing='6' center='true'> "
+"<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'> "
"<widget name='auPrefGmPopupDesc' "
"type='OptionsLabel' "
"/> "
@@ -1118,7 +1724,7 @@
"type='PopUp' "
"/> "
"</layout> "
-"<layout type='horizontal' padding='0,0,0,0' spacing='16' center='true'> "
+"<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'> "
"<widget name='mcFontButton' "
"type='Button' "
"/> "
@@ -1133,7 +1739,7 @@
"<widget name='mcMixedCheckbox' "
"type='Checkbox' "
"/> "
-"<layout type='horizontal' padding='0,0,0,0' spacing='6' center='true'> "
+"<layout type='horizontal' padding='0,0,0,0'> "
"<widget name='mcMidiGainText' "
"type='OptionsLabel' "
"/> "
@@ -1149,7 +1755,7 @@
"</dialog> "
"<dialog name='GlobalOptions_MT32' overlays='Dialog.GlobalOptions.TabWidget'> "
"<layout type='vertical' padding='16,16,16,16' spacing='8'> "
-"<layout type='horizontal' padding='0,0,0,0' spacing='6' center='true'> "
+"<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'> "
"<widget name='auPrefMt32PopupDesc' "
"type='OptionsLabel' "
"/> "
@@ -1167,7 +1773,7 @@
"</dialog> "
"<dialog name='GlobalOptions_Paths' overlays='Dialog.GlobalOptions.TabWidget'> "
"<layout type='vertical' padding='16,16,16,16' spacing='8'> "
-"<layout type='horizontal' padding='0,0,0,0' spacing='16'> "
+"<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'> "
"<widget name='SaveButton' "
"type='Button' "
"/> "
@@ -1179,7 +1785,7 @@
"width='Globals.Line.Height' "
"/> "
"</layout> "
-"<layout type='horizontal' padding='0,0,0,0' spacing='16'> "
+"<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'> "
"<widget name='ThemeButton' "
"type='Button' "
"/> "
@@ -1191,7 +1797,7 @@
"width='Globals.Line.Height' "
"/> "
"</layout> "
-"<layout type='horizontal' padding='0,0,0,0' spacing='16'> "
+"<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'> "
"<widget name='ExtraButton' "
"type='Button' "
"/> "
@@ -1215,7 +1821,7 @@
"</dialog> "
"<dialog name='GlobalOptions_Misc' overlays='Dialog.GlobalOptions.TabWidget'> "
"<layout type='vertical' padding='16,16,16,16' spacing='8'> "
-"<layout type='horizontal' padding='0,0,0,0' spacing='16'> "
+"<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'> "
"<widget name='ThemeButton' "
"type='Button' "
"/> "
@@ -1223,31 +1829,25 @@
"height='Globals.Line.Height' "
"/> "
"</layout> "
-"<layout type='horizontal' padding='0,0,0,0' spacing='6' center='true'> "
+"<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'> "
"<widget name='RendererPopupDesc' "
-"width='80' "
-"height='Globals.Line.Height' "
-"textalign='right' "
+"type='OptionsLabel' "
"/> "
"<widget name='RendererPopup' "
"type='PopUp' "
"/> "
"</layout> "
-"<layout type='horizontal' padding='0,0,0,0' spacing='6' center='true'> "
+"<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'> "
"<widget name='AutosavePeriodPopupDesc' "
-"width='80' "
-"height='Globals.Line.Height' "
-"textalign='right' "
+"type='OptionsLabel' "
"/> "
"<widget name='AutosavePeriodPopup' "
"type='PopUp' "
"/> "
"</layout> "
-"<layout type='horizontal' padding='0,0,0,0' spacing='6' center='true'> "
+"<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'> "
"<widget name='GuiLanguagePopupDesc' "
-"width='80' "
-"height='Globals.Line.Height' "
-"textalign='right' "
+"type='OptionsLabel' "
"/> "
"<widget name='GuiLanguagePopup' "
"type='PopUp' "
@@ -1282,10 +1882,10 @@
"</layout> "
"</layout> "
"</dialog> "
-"<dialog name='GameOptions' overlays='screen' inset='16' shading='dim'> "
+"<dialog name='GameOptions' overlays='Dialog.Launcher.GameList' shading='dim'> "
"<layout type='vertical' padding='0,0,0,0' spacing='16'> "
"<widget name='TabWidget'/> "
-"<layout type='horizontal' padding='8,8,8,8'> "
+"<layout type='horizontal' padding='16,16,16,4'> "
"<space/> "
"<widget name='Cancel' "
"type='Button' "
@@ -1297,7 +1897,7 @@
"</layout> "
"</dialog> "
"<dialog name='GameOptions_Graphics' overlays='Dialog.GlobalOptions.TabWidget'> "
-"<layout type='vertical' padding='8,8,8,8' spacing='6'> "
+"<layout type='vertical' padding='16,16,16,16' spacing='8'> "
"<widget name='EnableTabCheckbox' "
"type='Checkbox' "
"/> "
@@ -1305,7 +1905,7 @@
"</layout> "
"</dialog> "
"<dialog name='GameOptions_Audio' overlays='Dialog.GlobalOptions.TabWidget'> "
-"<layout type='vertical' padding='8,8,8,8' spacing='6'> "
+"<layout type='vertical' padding='16,16,16,16' spacing='8'> "
"<widget name='EnableTabCheckbox' "
"type='Checkbox' "
"/> "
@@ -1313,7 +1913,7 @@
"</layout> "
"</dialog> "
"<dialog name='GameOptions_MIDI' overlays='Dialog.GlobalOptions.TabWidget'> "
-"<layout type='vertical' padding='8,8,8,8' spacing='6'> "
+"<layout type='vertical' padding='16,16,16,16' spacing='8'> "
"<widget name='EnableTabCheckbox' "
"type='Checkbox' "
"/> "
@@ -1321,7 +1921,7 @@
"</layout> "
"</dialog> "
"<dialog name='GameOptions_MT32' overlays='Dialog.GlobalOptions.TabWidget'> "
-"<layout type='vertical' padding='8,8,8,8' spacing='6'> "
+"<layout type='vertical' padding='16,16,16,16' spacing='8'> "
"<widget name='EnableTabCheckbox' "
"type='Checkbox' "
"/> "
@@ -1329,7 +1929,7 @@
"</layout> "
"</dialog> "
"<dialog name='GameOptions_Volume' overlays='Dialog.GlobalOptions.TabWidget'> "
-"<layout type='vertical' padding='8,8,8,8' spacing='6'> "
+"<layout type='vertical' padding='16,16,16,16' spacing='8'> "
"<widget name='EnableTabCheckbox' "
"type='Checkbox' "
"/> "
@@ -1337,43 +1937,34 @@
"</layout> "
"</dialog> "
"<dialog name='GameOptions_Game' overlays='Dialog.GameOptions.TabWidget' shading='dim'> "
-"<layout type='vertical' padding='8,8,8,8'> "
-"<layout type='horizontal' padding='0,0,0,0' spacing='6' center='true'> "
+"<layout type='vertical' padding='16,16,16,16'> "
+"<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'> "
"<widget name='Id' "
-"width='35' "
-"height='Globals.Line.Height' "
-"textalign='right' "
+"type='OptionsLabel' "
"/> "
"<widget name='Domain' "
"type='PopUp' "
"/> "
"</layout> "
-"<layout type='horizontal' padding='0,0,0,0' spacing='6' center='true'> "
+"<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'> "
"<widget name='Name' "
-"width='35' "
-"height='Globals.Line.Height' "
-"textalign='right' "
+"type='OptionsLabel' "
"/> "
"<widget name='Desc' "
"type='PopUp' "
"/> "
"</layout> "
-"<space size='8'/> "
-"<layout type='horizontal' padding='0,0,0,0' spacing='6' center='true'> "
+"<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'> "
"<widget name='LangPopupDesc' "
-"width='60' "
-"height='Globals.Line.Height' "
-"textalign='right' "
+"type='OptionsLabel' "
"/> "
"<widget name='LangPopup' "
"type='PopUp' "
"/> "
"</layout> "
-"<layout type='horizontal' padding='0,0,0,0' spacing='6' center='true'> "
+"<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'> "
"<widget name='PlatformPopupDesc' "
-"width='60' "
-"height='Globals.Line.Height' "
-"textalign='right' "
+"type='OptionsLabel' "
"/> "
"<widget name='PlatformPopup' "
"type='PopUp' "
@@ -1382,8 +1973,8 @@
"</layout> "
"</dialog> "
"<dialog name='GameOptions_Paths' overlays='Dialog.GameOptions.TabWidget' shading='dim'> "
-"<layout type='vertical' padding='8,8,8,8'> "
-"<layout type='horizontal' padding='0,0,0,0' spacing='16' center='true'> "
+"<layout type='vertical' padding='16,16,16,16'> "
+"<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'> "
"<widget name='Savepath' "
"type='Button' "
"/> "
@@ -1395,7 +1986,7 @@
"width='Globals.Line.Height' "
"/> "
"</layout> "
-"<layout type='horizontal' padding='0,0,0,0' spacing='16' center='true'> "
+"<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'> "
"<widget name='Extrapath' "
"type='Button' "
"/> "
@@ -1407,7 +1998,7 @@
"width='Globals.Line.Height' "
"/> "
"</layout> "
-"<layout type='horizontal' padding='0,0,0,0' spacing='16' center='true'> "
+"<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'> "
"<widget name='Gamepath' "
"type='Button' "
"/> "
@@ -1418,55 +2009,57 @@
"</layout> "
"</dialog> "
"<dialog name='GlobalMenu' overlays='screen_center'> "
-"<layout type='vertical' padding='2,2,4,6' center='true' spacing='6'> "
+"<layout type='vertical' padding='16,16,16,16' center='true'> "
"<widget name='Title' "
-"width='160' "
-"height='4' "
+"width='210' "
+"height='Globals.Line.Height' "
"/> "
"<widget name='Version' "
-"width='160' "
-"height='4' "
+"width='210' "
+"height='Globals.Line.Height' "
"/> "
-"<space size='1'/> "
+"<widget name='Resume' "
+"width='150' "
+"height='Globals.Button.Height' "
+"/> "
+"<space size='10'/> "
"<widget name='Load' "
-"width='120' "
-"height='12' "
+"width='150' "
+"height='Globals.Button.Height' "
"/> "
"<widget name='Save' "
-"width='120' "
-"height='12' "
+"width='150' "
+"height='Globals.Button.Height' "
"/> "
-"<space size='1'/> "
+"<space size='10'/> "
"<widget name='Options' "
-"width='120' "
-"height='12' "
+"width='150' "
+"height='Globals.Button.Height' "
"/> "
"<widget name='Help' "
-"width='120' "
-"height='12' "
+"width='150' "
+"height='Globals.Button.Height' "
"/> "
"<widget name='About' "
-"width='120' "
-"height='12' "
-"/> "
-"<space size='1'/> "
-"<widget name='Resume' "
-"width='120' "
-"height='12' "
+"width='150' "
+"height='Globals.Button.Height' "
"/> "
+"<space size='10'/> "
"<widget name='RTL' "
-"width='120' "
-"height='12' "
+"width='150' "
+"height='Globals.Button.Height' "
"/> "
"<widget name='Quit' "
-"width='120' "
-"height='12' "
+"width='150' "
+"height='Globals.Button.Height' "
"/> "
"</layout> "
"</dialog> "
"<dialog name='GlobalConfig' overlays='screen_center'> "
"<layout type='vertical' padding='8,8,8,8'> "
-"<layout type='horizontal' padding='0,0,0,0' spacing='6' center='true'> "
+"<layout type='horizontal' padding='0,0,0,0'> "
+"<layout type='vertical' padding='0,0,0,0' center='true'> "
+"<layout type='horizontal' padding='0,0,0,0' spacing='8'> "
"<widget name='vcMusicText' "
"type='OptionsLabel' "
"/> "
@@ -1477,7 +2070,7 @@
"type='SmallLabel' "
"/> "
"</layout> "
-"<layout type='horizontal' padding='0,0,0,0' spacing='6' center='true'> "
+"<layout type='horizontal' padding='0,0,0,0' spacing='8'> "
"<widget name='vcSfxText' "
"type='OptionsLabel' "
"/> "
@@ -1488,7 +2081,7 @@
"type='SmallLabel' "
"/> "
"</layout> "
-"<layout type='horizontal' padding='0,0,0,0' spacing='6' center='true'> "
+"<layout type='horizontal' padding='0,0,0,0' spacing='8'> "
"<widget name='vcSpeechText' "
"type='OptionsLabel' "
"/> "
@@ -1499,34 +2092,33 @@
"type='SmallLabel' "
"/> "
"</layout> "
-"<layout type='horizontal' padding='0,0,0,0' spacing='6' center='true'> "
-"<space size='110' /> "
+"</layout> "
+"<layout type='vertical' padding='24,24,24,24' center='true'> "
"<widget name='vcMuteCheckbox' "
"type='Checkbox' "
-"width='80' "
+"width='80' "
"/> "
"</layout> "
-"<layout type='vertical' padding='0,0,0,0' spacing='1' center='true'> "
+"</layout> "
+"<space size='8' /> "
+"<layout type='horizontal' padding='0,0,0,0' spacing='10'> "
"<widget name='subToggleDesc' "
"type='OptionsLabel' "
"/> "
-"<layout type='horizontal' padding='0,0,0,0' spacing='6' center='true'> "
"<widget name='subToggleSpeechOnly' "
"type='Radiobutton' "
-"width='90' "
+"width='100' "
"/> "
"<widget name='subToggleSubOnly' "
"type='Radiobutton' "
-"width='90' "
+"width='100' "
"/> "
"<widget name='subToggleSubBoth' "
"type='Radiobutton' "
-"width='90' "
+"width='100' "
"/> "
"</layout> "
-"</layout> "
-"<space size='2' /> "
-"<layout type='horizontal' padding='0,0,0,0' spacing='6' center='true'> "
+"<layout type='horizontal' padding='0,0,0,0' spacing='10'> "
"<widget name='subSubtitleSpeedDesc' "
"type='OptionsLabel' "
"/> "
@@ -1537,8 +2129,8 @@
"type='SmallLabel' "
"/> "
"</layout> "
-"<space size='16'/> "
-"<layout type='horizontal' padding='0,0,0,0' spacing='4'> "
+"<space size='60'/> "
+"<layout type='horizontal' padding='0,0,0,0' spacing='10'> "
"<widget name='Keys' "
"type='Button' "
"/> "
@@ -1553,15 +2145,23 @@
"</layout> "
"</dialog> "
"<dialog name='SaveLoadChooser' overlays='screen' inset='8' shading='dim'> "
-"<layout type='vertical' padding='8,8,8,8' center='true'> "
-"<widget name='Title' height='Globals.Line.Height'/> "
+"<layout type='vertical' padding='8,8,8,32' center='true'> "
+"<widget name='Title' "
+"height='Globals.Line.Height' "
+"/> "
+"<layout type='horizontal' padding='0,0,0,16' spacing='16'> "
"<widget name='List' /> "
-"<layout type='horizontal' padding='0,0,16,0'> "
+"<widget name='Thumbnail' "
+"width='180' "
+"height='200' "
+"/> "
+"</layout> "
+"<layout type='horizontal' padding='0,0,0,0'> "
"<space/> "
"<widget name='Delete' "
"type='Button' "
"/> "
-"<space size='16'/> "
+"<space size='32'/> "
"<widget name='Cancel' "
"type='Button' "
"/> "
@@ -1571,16 +2171,16 @@
"</layout> "
"</layout> "
"</dialog> "
-"<dialog name='ScummHelp' overlays='screen'> "
-"<layout type='vertical' padding='8,8,8,8'> "
+"<dialog name='ScummHelp' overlays='screen_center'> "
+"<layout type='vertical' padding='8,8,8,8' center='true'> "
"<widget name='Title' "
-"width='180' "
+"width='320' "
"height='Globals.Line.Height' "
"/> "
"<widget name='HelpText' "
-"height='140' "
+"height='200' "
"/> "
-"<layout type='horizontal' padding='0,0,0,0'> "
+"<layout type='horizontal' padding='0,0,16,0'> "
"<widget name='Prev' "
"type='Button' "
"/> "
@@ -1597,7 +2197,7 @@
"<dialog name='LoomTownsDifficultyDialog' overlays='screen_center'> "
"<layout type='vertical' padding='8,8,8,8' center='true'> "
"<widget name='Description1' "
-"width='280' "
+"width='320' "
"height='Globals.Line.Height' "
"/> "
"<widget name='Description2' "
@@ -1615,20 +2215,20 @@
"</layout> "
"</dialog> "
"<dialog name='MassAdd' overlays='screen_center' shading='dim'> "
-"<layout type='vertical' padding='4,4,16,4' center='true'> "
+"<layout type='vertical' padding='8,8,32,8' center='true'> "
"<widget name='DirProgressText' "
-"width='280' "
+"width='480' "
"height='Globals.Line.Height' "
"/> "
"<widget name='GameProgressText' "
-"width='280' "
+"width='480' "
"height='Globals.Line.Height' "
"/> "
"<widget name='GameList' "
-"width='280' "
-"height='100' "
+"width='480' "
+"height='250' "
"/> "
-"<layout type='horizontal' padding='4,4,4,4'> "
+"<layout type='horizontal' padding='8,8,8,8'> "
"<widget name='Ok' "
"type='Button' "
"/> "
@@ -1639,20 +2239,20 @@
"</layout> "
"</dialog> "
"<dialog name='KeyMapper' overlays='screen_center' shading='dim'> "
-"<layout type='vertical' padding='8,8,8,8' spacing='10' center='true'> "
+"<layout type='vertical' padding='8,8,32,8' spacing='10' center='true'> "
"<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'> "
"<widget name='PopupDesc' "
"type='OptionsLabel' "
"/> "
"<widget name='Popup' "
"type='PopUp' "
-"width='150' "
+"width='400' "
"height='Globals.Line.Height' "
"/> "
"</layout> "
"<widget name='KeymapArea' "
-"width='300' "
-"height='120' "
+"width='600' "
+"height='280' "
"/> "
"<widget name='Close' "
"type='Button' "
@@ -1660,603 +2260,3 @@
"</layout> "
"</dialog> "
"</layout_info> "
-"<render_info> "
-"<palette> "
-"<color name='black' "
-"rgb='0,0,0' "
-"/> "
-"<color name='lightgrey' "
-"rgb='104,104,104' "
-"/> "
-"<color name='darkgrey' "
-"rgb='64,64,64' "
-"/> "
-"<color name='green' "
-"rgb='32,160,32' "
-"/> "
-"<color name='green2' "
-"rgb='0,255,0' "
-"/> "
-"</palette> "
-"<fonts> "
-"<font id='text_default' "
-"file='helvb12.bdf' "
-"/> "
-"<font resolution='y<400' "
-"id='text_default' "
-"file='clR6x12.bdf' "
-"/> "
-"<font id='text_button' "
-"file='helvb12.bdf' "
-"/> "
-"<font resolution='y<400' "
-"id='text_button' "
-"file='clR6x12.bdf' "
-"/> "
-"<font id='text_normal' "
-"file='helvb12.bdf' "
-"/> "
-"<font resolution='y<400' "
-"id='text_normal' "
-"file='clR6x12.bdf' "
-"/> "
-"<font id='tooltip_normal' "
-"file='fixed5x8.bdf' "
-"/> "
-"<text_color id='color_normal' "
-"color='green' "
-"/> "
-"<text_color id='color_normal_inverted' "
-"color='black' "
-"/> "
-"<text_color id='color_normal_hover' "
-"color='green2' "
-"/> "
-"<text_color id='color_normal_disabled' "
-"color='lightgrey' "
-"/> "
-"<text_color id='color_alternative' "
-"color='lightgrey' "
-"/> "
-"<text_color id='color_alternative_inverted' "
-"color='255,255,255' "
-"/> "
-"<text_color id='color_alternative_hover' "
-"color='176,176,176' "
-"/> "
-"<text_color id='color_alternative_disabled' "
-"color='darkgrey' "
-"/> "
-"<text_color id='color_button' "
-"color='green' "
-"/> "
-"<text_color id='color_button_hover' "
-"color='green2' "
-"/> "
-"<text_color id='color_button_disabled' "
-"color='lightgrey' "
-"/> "
-"</fonts> "
-"<defaults fill='foreground' fg_color='darkgrey' bg_color='black' shadow='0' bevel_color='lightgrey'/> "
-"<drawdata id='text_selection' cache='false'> "
-"<drawstep func='square' "
-"fill='foreground' "
-"fg_color='lightgrey' "
-"/> "
-"</drawdata> "
-"<drawdata id='text_selection_focus' cache='false'> "
-"<drawstep func='square' "
-"fill='foreground' "
-"fg_color='green' "
-"/> "
-"</drawdata> "
-"<drawdata id='mainmenu_bg' cache='false'> "
-"<drawstep func='fill' "
-"fill='foreground' "
-"fg_color='black' "
-"/> "
-"</drawdata> "
-"<drawdata id='special_bg' cache='false'> "
-"<drawstep func='bevelsq' "
-"bevel='2' "
-"/> "
-"</drawdata> "
-"<drawdata id='tooltip_bg' cache='false'> "
-"<drawstep func='bevelsq' "
-"bevel='2' "
-"fill='foreground' "
-"fg_color='black' "
-"/> "
-"</drawdata> "
-"<drawdata id='separator' cache='false'> "
-"<drawstep func='square' "
-"fill='foreground' "
-"height='2' "
-"ypos='center' "
-"fg_color='lightgrey' "
-"/> "
-"</drawdata> "
-"<drawdata id='scrollbar_base' cache='false'> "
-"<drawstep func='bevelsq' "
-"bevel='2' "
-"/> "
-"</drawdata> "
-"<drawdata id='scrollbar_handle_hover' cache='false'> "
-"<drawstep func='square' "
-"fill='foreground' "
-"fg_color='green2' "
-"/> "
-"</drawdata> "
-"<drawdata id='scrollbar_handle_idle' cache='false'> "
-"<drawstep func='square' "
-"fill='foreground' "
-"fg_color='green' "
-"/> "
-"</drawdata> "
-"<drawdata id='scrollbar_button_idle' cache='false' resolution='y>399'> "
-"<drawstep func='bevelsq' "
-"bevel='2' "
-"fill='none' "
-"/> "
-"<drawstep func='triangle' "
-"fg_color='green' "
-"fill='foreground' "
-"width='10' "
-"height='10' "
-"xpos='right' "
-"ypos='center' "
-"padding='0,0,3,0' "
-"orientation='top' "
-"/> "
-"</drawdata> "
-"<drawdata id='scrollbar_button_idle' cache='false' resolution='y<400'> "
-"<drawstep func='bevelsq' "
-"bevel='2' "
-"fill='none' "
-"/> "
-"<drawstep func='triangle' "
-"fg_color='green' "
-"fill='foreground' "
-"width='5' "
-"height='5' "
-"xpos='right' "
-"ypos='center' "
-"padding='0,0,2,0' "
-"orientation='top' "
-"/> "
-"</drawdata> "
-"<drawdata id='scrollbar_button_hover' cache='false' resolution='y>399'> "
-"<drawstep func='bevelsq' "
-"bevel='2' "
-"fill='none' "
-"/> "
-"<drawstep func='triangle' "
-"fg_color='green' "
-"fill='foreground' "
-"width='10' "
-"height='10' "
-"xpos='right' "
-"ypos='center' "
-"padding='0,0,3,0' "
-"orientation='top' "
-"/> "
-"</drawdata> "
-"<drawdata id='scrollbar_button_hover' cache='false' resolution='y<400'> "
-"<drawstep func='bevelsq' "
-"bevel='2' "
-"fill='none' "
-"/> "
-"<drawstep func='triangle' "
-"fg_color='green' "
-"fill='foreground' "
-"width='5' "
-"height='5' "
-"xpos='right' "
-"ypos='center' "
-"padding='0,0,2,0' "
-"orientation='top' "
-"/> "
-"</drawdata> "
-"<drawdata id='tab_active' cache='false'> "
-"<text font='text_default' "
-"text_color='color_normal_hover' "
-"vertical_align='center' "
-"horizontal_align='center' "
-"/> "
-"<drawstep func='tab' "
-"bevel='2' "
-"radius='0' "
-"fill='none' "
-"/> "
-"</drawdata> "
-"<drawdata id='tab_inactive' cache='false'> "
-"<text font='text_default' "
-"text_color='color_normal' "
-"vertical_align='center' "
-"horizontal_align='center' "
-"/> "
-"<drawstep func='tab' "
-"bevel='2' "
-"radius='0' "
-"fill='none' "
-"/> "
-"</drawdata> "
-"<drawdata id='tab_background' cache='false'> "
-"</drawdata> "
-"<drawdata id='widget_slider' cache='false'> "
-"<drawstep func='bevelsq' "
-"bevel='2' "
-"fill='none' "
-"/> "
-"</drawdata> "
-"<drawdata id='slider_disabled' cache='false'> "
-"<drawstep func='square' "
-"fill='foreground' "
-"fg_color='lightgrey' "
-"/> "
-"</drawdata> "
-"<drawdata id='slider_full' cache='false'> "
-"<drawstep func='square' "
-"fill='foreground' "
-"fg_color='green' "
-"/> "
-"</drawdata> "
-"<drawdata id='slider_hover' cache='false'> "
-"<drawstep func='square' "
-"fill='foreground' "
-"fg_color='green2' "
-"/> "
-"</drawdata> "
-"<drawdata id='widget_small' cache='false'> "
-"<drawstep func='bevelsq' "
-"bevel='2' "
-"fill='none' "
-"/> "
-"</drawdata> "
-"<drawdata id='popup_idle' cache='false' resolution='y>399'> "
-"<drawstep func='bevelsq' "
-"bevel='2' "
-"fill='none' "
-"/> "
-"<drawstep func='triangle' "
-"fg_color='green' "
-"fill='foreground' "
-"width='10' "
-"height='5' "
-"xpos='right' "
-"ypos='10' "
-"padding='0,0,7,0' "
-"orientation='bottom' "
-"/> "
-"<drawstep func='triangle' "
-"fg_color='green' "
-"fill='foreground' "
-"width='10' "
-"height='5' "
-"xpos='right' "
-"ypos='4' "
-"padding='0,0,7,0' "
-"orientation='top' "
-"/> "
-"<text font='text_default' "
-"text_color='color_normal' "
-"vertical_align='center' "
-"horizontal_align='left' "
-"/> "
-"</drawdata> "
-"<drawdata id='popup_idle' cache='false' resolution='y<400'> "
-"<drawstep func='bevelsq' "
-"bevel='2' "
-"fill='none' "
-"/> "
-"<drawstep func='triangle' "
-"fg_color='green' "
-"fill='foreground' "
-"width='7' "
-"height='4' "
-"xpos='right' "
-"ypos='9' "
-"padding='0,0,3,0' "
-"orientation='bottom' "
-"/> "
-"<drawstep func='triangle' "
-"fg_color='green' "
-"fill='foreground' "
-"width='7' "
-"height='4' "
-"xpos='right' "
-"ypos='4' "
-"padding='0,0,3,0' "
-"orientation='top' "
-"/> "
-"<text font='text_default' "
-"text_color='color_normal' "
-"vertical_align='center' "
-"horizontal_align='left' "
-"/> "
-"</drawdata> "
-"<drawdata id='popup_disabled' cache='false' resolution='y>399'> "
-"<drawstep func='bevelsq' "
-"bevel='2' "
-"fill='none' "
-"/> "
-"<drawstep func='triangle' "
-"fg_color='green' "
-"fill='foreground' "
-"width='10' "
-"height='5' "
-"xpos='right' "
-"ypos='10' "
-"padding='0,0,7,0' "
-"orientation='bottom' "
-"/> "
-"<drawstep func='triangle' "
-"fg_color='green' "
-"fill='foreground' "
-"width='10' "
-"height='5' "
-"xpos='right' "
-"ypos='4' "
-"padding='0,0,7,0' "
-"orientation='top' "
-"/> "
-"<text font='text_default' "
-"text_color='color_normal_disabled' "
-"vertical_align='center' "
-"horizontal_align='left' "
-"/> "
-"</drawdata> "
-"<drawdata id='popup_disabled' cache='false' resolution='y<400'> "
-"<drawstep func='bevelsq' "
-"bevel='2' "
-"fill='none' "
-"/> "
-"<drawstep func='triangle' "
-"fg_color='green' "
-"fill='foreground' "
-"width='7' "
-"height='4' "
-"xpos='right' "
-"ypos='9' "
-"padding='0,0,3,0' "
-"orientation='bottom' "
-"/> "
-"<drawstep func='triangle' "
-"fg_color='green' "
-"fill='foreground' "
-"width='7' "
-"height='4' "
-"xpos='right' "
-"ypos='4' "
-"padding='0,0,3,0' "
-"orientation='top' "
-"/> "
-"<text font='text_default' "
-"text_color='color_normal' "
-"vertical_align='center' "
-"horizontal_align='left' "
-"/> "
-"</drawdata> "
-"<drawdata id='popup_hover' cache='false' resolution='y>399'> "
-"<drawstep func='bevelsq' "
-"bevel='2' "
-"fill='none' "
-"/> "
-"<drawstep func='triangle' "
-"fg_color='green' "
-"fill='foreground' "
-"width='10' "
-"height='5' "
-"xpos='right' "
-"ypos='10' "
-"padding='0,0,7,0' "
-"orientation='bottom' "
-"/> "
-"<drawstep func='triangle' "
-"fg_color='green' "
-"fill='foreground' "
-"width='10' "
-"height='5' "
-"xpos='right' "
-"ypos='4' "
-"padding='0,0,7,0' "
-"orientation='top' "
-"/> "
-"<text font='text_default' "
-"text_color='color_normal_hover' "
-"vertical_align='center' "
-"horizontal_align='left' "
-"/> "
-"</drawdata> "
-"<drawdata id='popup_hover' cache='false' resolution='y<400'> "
-"<drawstep func='bevelsq' "
-"bevel='2' "
-"fill='none' "
-"/> "
-"<drawstep func='triangle' "
-"fg_color='green' "
-"fill='foreground' "
-"width='7' "
-"height='4' "
-"xpos='right' "
-"ypos='9' "
-"padding='0,0,3,0' "
-"orientation='bottom' "
-"/> "
-"<drawstep func='triangle' "
-"fg_color='green' "
-"fill='foreground' "
-"width='7' "
-"height='4' "
-"xpos='right' "
-"ypos='4' "
-"padding='0,0,3,0' "
-"orientation='top' "
-"/> "
-"<text font='text_default' "
-"text_color='color_normal' "
-"vertical_align='center' "
-"horizontal_align='left' "
-"/> "
-"</drawdata> "
-"<drawdata id='widget_textedit' cache='false'> "
-"<drawstep func='bevelsq' "
-"bevel='2' "
-"fill='none' "
-"/> "
-"</drawdata> "
-"<drawdata id='plain_bg' cache='false'> "
-"<drawstep func='bevelsq' "
-"bevel='2' "
-"/> "
-"</drawdata> "
-"<drawdata id='caret' cache='false'> "
-"<drawstep func='square' "
-"fill='foreground' "
-"fg_color='lightgrey' "
-"/> "
-"</drawdata> "
-"<drawdata id='default_bg' cache='false'> "
-"<drawstep func='bevelsq' "
-"bevel='2' "
-"/> "
-"</drawdata> "
-"<drawdata id='button_idle' cache='false'> "
-"<text font='text_button' "
-"text_color='color_button' "
-"vertical_align='center' "
-"horizontal_align='center' "
-"/> "
-"<drawstep func='bevelsq' "
-"bevel='2' "
-"fill='none' "
-"/> "
-"</drawdata> "
-"<drawdata id='button_hover' cache='false'> "
-"<text font='text_button' "
-"text_color='color_button_hover' "
-"vertical_align='center' "
-"horizontal_align='center' "
-"/> "
-"<drawstep func='bevelsq' "
-"bevel='2' "
-"fill='none' "
-"/> "
-"</drawdata> "
-"<drawdata id='button_disabled' cache='false'> "
-"<text font='text_button' "
-"text_color='color_button_disabled' "
-"vertical_align='center' "
-"horizontal_align='center' "
-"/> "
-"<drawstep func='bevelsq' "
-"bevel='2' "
-"fill='none' "
-"/> "
-"</drawdata> "
-"<drawdata id='checkbox_disabled' cache='false'> "
-"<text font='text_default' "
-"text_color='color_normal_disabled' "
-"vertical_align='top' "
-"horizontal_align='left' "
-"/> "
-"<drawstep func='bevelsq' "
-"bevel='2' "
-"fill='none' "
-"/> "
-"</drawdata> "
-"<drawdata id='checkbox_selected' cache='false'> "
-"<text font='text_default' "
-"text_color='color_normal' "
-"vertical_align='top' "
-"horizontal_align='left' "
-"/> "
-"<drawstep func='bevelsq' "
-"bevel='2' "
-"fill='none' "
-"/> "
-"<drawstep func='cross' "
-"fill='foreground' "
-"stroke='2' "
-"fg_color='green' "
-"/> "
-"</drawdata> "
-"<drawdata id='checkbox_default' cache='false'> "
-"<text font='text_default' "
-"text_color='color_normal' "
-"vertical_align='top' "
-"horizontal_align='left' "
-"/> "
-"<drawstep func='bevelsq' "
-"bevel='2' "
-"fill='none' "
-"/> "
-"</drawdata> "
-"<drawdata id='radiobutton_default' cache='false'> "
-"<text font='text_default' "
-"text_color='color_normal' "
-"vertical_align='center' "
-"horizontal_align='left' "
-"/> "
-"<drawstep func='circle' "
-"width='7' "
-"height='7' "
-"radius='7' "
-"fill='background' "
-"bg_color='darkgrey' "
-"xpos='0' "
-"ypos='0' "
-"/> "
-"</drawdata> "
-"<drawdata id='radiobutton_selected' cache='false'> "
-"<text font='text_default' "
-"text_color='color_normal' "
-"vertical_align='center' "
-"horizontal_align='left' "
-"/> "
-"<drawstep func='circle' "
-"width='7' "
-"height='7' "
-"radius='7' "
-"fg_color='darkgrey' "
-"fill='none' "
-"xpos='0' "
-"ypos='0' "
-"/> "
-"<drawstep func='circle' "
-"width='7' "
-"height='7' "
-"radius='5' "
-"fg_color='green' "
-"fill='foreground' "
-"xpos='2' "
-"ypos='2' "
-"/> "
-"</drawdata> "
-"<drawdata id='radiobutton_disabled' cache='false'> "
-"<text font='text_default' "
-"text_color='color_normal_disabled' "
-"vertical_align='center' "
-"horizontal_align='left' "
-"/> "
-"<drawstep func='circle' "
-"width='7' "
-"height='7' "
-"radius='7' "
-"bg_color='lightgrey' "
-"fill='background' "
-"xpos='0' "
-"ypos='0' "
-"/> "
-"</drawdata> "
-"<drawdata id='widget_default' cache='false'> "
-"<drawstep func='bevelsq' "
-"bevel='2' "
-"/> "
-"</drawdata> "
-"<drawdata id='widget_small' cache='false'> "
-"<drawstep func='square' "
-"stroke='0' "
-"/> "
-"</drawdata> "
-"</render_info> "
diff --git a/gui/themes/fonts/FreeMonoBold.ttf b/gui/themes/fonts/FreeMonoBold.ttf
new file mode 100644
index 0000000000..3bce6129ae
--- /dev/null
+++ b/gui/themes/fonts/FreeMonoBold.ttf
Binary files differ
diff --git a/gui/themes/fonts/FreeSans.ttf b/gui/themes/fonts/FreeSans.ttf
new file mode 100644
index 0000000000..9db958532c
--- /dev/null
+++ b/gui/themes/fonts/FreeSans.ttf
Binary files differ
diff --git a/gui/themes/fonts/FreeSansBold.ttf b/gui/themes/fonts/FreeSansBold.ttf
new file mode 100644
index 0000000000..63644e7437
--- /dev/null
+++ b/gui/themes/fonts/FreeSansBold.ttf
Binary files differ
diff --git a/gui/themes/fonts/README b/gui/themes/fonts/README
index 594bfc3ea4..b36d89889c 100644
--- a/gui/themes/fonts/README
+++ b/gui/themes/fonts/README
@@ -1,3 +1,5 @@
These are fonts used in ScummVM. Most of them come from Xorg.
+The GNU FreeFont files are distributed under the license in COPYING.FREEFONT.
+
Also other potentially usable fonts are stored here as well.
diff --git a/gui/themes/scummclassic.zip b/gui/themes/scummclassic.zip
index c2df75c662..8b2a3e7899 100644
--- a/gui/themes/scummclassic.zip
+++ b/gui/themes/scummclassic.zip
Binary files differ
diff --git a/gui/themes/scummclassic/THEMERC b/gui/themes/scummclassic/THEMERC
index 0e1dcc5129..f3904cbb6d 100644
--- a/gui/themes/scummclassic/THEMERC
+++ b/gui/themes/scummclassic/THEMERC
@@ -1 +1 @@
-[SCUMMVM_STX0.8.7:ScummVM Classic Theme:No Author]
+[SCUMMVM_STX0.8.8:ScummVM Classic Theme:No Author]
diff --git a/gui/themes/scummmodern.zip b/gui/themes/scummmodern.zip
index cba92201d3..84416636bc 100644
--- a/gui/themes/scummmodern.zip
+++ b/gui/themes/scummmodern.zip
Binary files differ
diff --git a/gui/themes/scummmodern/FreeMonoBold.ttf b/gui/themes/scummmodern/FreeMonoBold.ttf
new file mode 100644
index 0000000000..3bce6129ae
--- /dev/null
+++ b/gui/themes/scummmodern/FreeMonoBold.ttf
Binary files differ
diff --git a/gui/themes/scummmodern/FreeSans.ttf b/gui/themes/scummmodern/FreeSans.ttf
new file mode 100644
index 0000000000..9db958532c
--- /dev/null
+++ b/gui/themes/scummmodern/FreeSans.ttf
Binary files differ
diff --git a/gui/themes/scummmodern/FreeSansBold.ttf b/gui/themes/scummmodern/FreeSansBold.ttf
new file mode 100644
index 0000000000..63644e7437
--- /dev/null
+++ b/gui/themes/scummmodern/FreeSansBold.ttf
Binary files differ
diff --git a/gui/themes/scummmodern/THEMERC b/gui/themes/scummmodern/THEMERC
index d3abf43141..32bd36241e 100644
--- a/gui/themes/scummmodern/THEMERC
+++ b/gui/themes/scummmodern/THEMERC
@@ -1 +1 @@
-[SCUMMVM_STX0.8.7:ScummVM Modern Theme:No Author]
+[SCUMMVM_STX0.8.8:ScummVM Modern Theme:No Author]
diff --git a/gui/themes/scummmodern/eraser.bmp b/gui/themes/scummmodern/eraser.bmp
index 782b13dc62..b927a6384f 100644
--- a/gui/themes/scummmodern/eraser.bmp
+++ b/gui/themes/scummmodern/eraser.bmp
Binary files differ
diff --git a/gui/themes/scummmodern/scummmodern_gfx.stx b/gui/themes/scummmodern/scummmodern_gfx.stx
index cb9f9fd2a3..b420ce0903 100644
--- a/gui/themes/scummmodern/scummmodern_gfx.stx
+++ b/gui/themes/scummmodern/scummmodern_gfx.stx
@@ -105,27 +105,38 @@
<fonts>
<font id = 'text_default'
file = 'helvb12.bdf'
+ scalable_file = 'FreeSansBold.ttf'
/>
<font resolution = 'y<400'
id = 'text_default'
file = 'clR6x12.bdf'
+ scalable_file = 'FreeSans.ttf'
+ point_size = '11'
/>
<font id = 'text_button'
file = 'helvb12.bdf'
+ scalable_file = 'FreeSansBold.ttf'
/>
<font resolution = 'y<400'
id = 'text_button'
file = 'clR6x12.bdf'
+ scalable_file = 'FreeSans.ttf'
+ point_size = '11'
/>
<font id = 'text_normal'
file = 'helvb12.bdf'
+ scalable_file = 'FreeSansBold.ttf'
/>
<font resolution = 'y<400'
id = 'text_normal'
file = 'clR6x12.bdf'
+ scalable_file = 'FreeSans.ttf'
+ point_size = '11'
/>
<font id = 'tooltip_normal'
file = 'fixed5x8.bdf'
+ scalable_file = 'FreeMonoBold.ttf'
+ point_size = '8'
/>
<text_color id = 'color_normal'
@@ -387,7 +398,7 @@
<!-- Background of the slider widget -->
<drawdata id = 'widget_slider' cache = 'false'>
<drawstep func = 'roundedsq'
- stroke = '0'
+ stroke = '1'
radius = '5'
fill = 'foreground'
fg_color = 'paleyellow'
@@ -676,6 +687,7 @@
radius = '5'
fg_color = 'paleyellow'
shadow = '0'
+ stroke = '1'
bevel = '1'
bevel_color = 'shadowcolor'
/>
diff --git a/gui/themes/scummtheme.py b/gui/themes/scummtheme.py
index e4e9549265..4c55fd79de 100755
--- a/gui/themes/scummtheme.py
+++ b/gui/themes/scummtheme.py
@@ -5,7 +5,7 @@ import re
import os
import zipfile
-THEME_FILE_EXTENSIONS = ('.stx', '.bmp', '.fcc')
+THEME_FILE_EXTENSIONS = ('.stx', '.bmp', '.fcc', '.ttf')
def buildTheme(themeName):
if not os.path.isdir(themeName) or not os.path.isfile(os.path.join(themeName, "THEMERC")):
diff --git a/gui/themes/translations.dat b/gui/themes/translations.dat
index 447b7b97dd..0dcd6065a8 100644
--- a/gui/themes/translations.dat
+++ b/gui/themes/translations.dat
Binary files differ
diff --git a/gui/widget.cpp b/gui/widget.cpp
index 82007c588f..0e2fd248b1 100644
--- a/gui/widget.cpp
+++ b/gui/widget.cpp
@@ -245,16 +245,16 @@ void StaticTextWidget::setValue(int value) {
}
void StaticTextWidget::setLabel(const Common::String &label) {
- if (_label != label) {
- _label = label;
-
- // when changing the label, add the CLEARBG flag
- // so the widget is completely redrawn, otherwise
- // the new text is drawn on top of the old one.
- setFlags(WIDGET_CLEARBG);
- draw();
- clearFlags(WIDGET_CLEARBG);
- }
+ if (_label != label) {
+ _label = label;
+
+ // when changing the label, add the CLEARBG flag
+ // so the widget is completely redrawn, otherwise
+ // the new text is drawn on top of the old one.
+ setFlags(WIDGET_CLEARBG);
+ draw();
+ clearFlags(WIDGET_CLEARBG);
+ }
}
void StaticTextWidget::setAlign(Graphics::TextAlign align) {
diff --git a/gui/widgets/editable.cpp b/gui/widgets/editable.cpp
index 4a0ee54828..6fae9346b2 100644
--- a/gui/widgets/editable.cpp
+++ b/gui/widgets/editable.cpp
@@ -238,8 +238,13 @@ void EditableWidget::defaultKeyDownHandler(Common::KeyState &state, bool &dirty,
int EditableWidget::getCaretOffset() const {
int caretpos = 0;
- for (int i = 0; i < _caretPos; i++)
- caretpos += g_gui.getCharWidth(_editString[i], _font);
+
+ uint last = 0;
+ for (int i = 0; i < _caretPos; ++i) {
+ const uint cur = _editString[i];
+ caretpos += g_gui.getCharWidth(cur, _font) + g_gui.getKerningOffset(last, cur, _font);
+ last = cur;
+ }
caretpos -= _editScrollOffset;
@@ -270,6 +275,8 @@ void EditableWidget::drawCaret(bool erase) {
if ((uint)_caretPos < _editString.size()) {
GUI::EditableWidget::String chr(_editString[_caretPos]);
int chrWidth = g_gui.getCharWidth(_editString[_caretPos], _font);
+ const uint last = (_caretPos > 0) ? _editString[_caretPos - 1] : 0;
+ x += g_gui.getKerningOffset(last, _editString[_caretPos], _font);
g_gui.theme()->drawText(Common::Rect(x, y, x + chrWidth, y + editRect.height() - 2), chr, _state, Graphics::kTextAlignLeft, _inversion, 0, false, _font);
}
}
diff --git a/gui/widgets/edittext.cpp b/gui/widgets/edittext.cpp
index 0337fe1e87..af8ab8aa5b 100644
--- a/gui/widgets/edittext.cpp
+++ b/gui/widgets/edittext.cpp
@@ -67,10 +67,13 @@ void EditTextWidget::handleMouseDown(int x, int y, int button, int clickCount) {
int width = 0;
uint i;
+ uint last = 0;
for (i = 0; i < _editString.size(); ++i) {
- width += g_gui.theme()->getCharWidth(_editString[i], _font);
+ const uint cur = _editString[i];
+ width += g_gui.getCharWidth(cur, _font) + g_gui.getKerningOffset(last, cur, _font);
if (width >= x)
break;
+ last = cur;
}
if (setCaretPos(i))
draw();
diff --git a/po/POTFILES b/po/POTFILES
index 9898958222..33492c0c6f 100644
--- a/po/POTFILES
+++ b/po/POTFILES
@@ -64,6 +64,7 @@ backends/keymapper/remap-dialog.cpp
backends/midi/windows.cpp
backends/platform/ds/arm9/source/dsoptions.cpp
backends/platform/iphone/osys_events.cpp
+backends/platform/maemo/maemo.cpp
backends/platform/sdl/macosx/appmenu_osx.mm
backends/graphics/surfacesdl/surfacesdl-graphics.cpp
backends/graphics/opengl/opengl-graphics.cpp
diff --git a/po/ca_ES.po b/po/ca_ES.po
index 0b06dc683a..6dc8b6a008 100644
--- a/po/ca_ES.po
+++ b/po/ca_ES.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ScummVM 1.3.0svn\n"
"Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n"
-"POT-Creation-Date: 2011-12-26 15:26+0100\n"
+"POT-Creation-Date: 2012-02-16 12:32+0200\n"
"PO-Revision-Date: 2011-10-04 20:51+0100\n"
"Last-Translator: Jordi Vilalta Prat <jvprat@jvprat.com>\n"
"Language-Team: Catalan <scummvm-devel@lists.sf.net>\n"
@@ -45,7 +45,7 @@ msgstr "Amunt"
#: gui/browser.cpp:69 gui/chooser.cpp:45 gui/KeysDialog.cpp:43
#: gui/launcher.cpp:319 gui/massadd.cpp:94 gui/options.cpp:1221
#: gui/saveload.cpp:63 gui/saveload.cpp:155 gui/themebrowser.cpp:54
-#: engines/engine.cpp:436 engines/scumm/dialogs.cpp:190
+#: engines/engine.cpp:438 engines/scumm/dialogs.cpp:190
#: engines/sword1/control.cpp:865 engines/parallaction/saveload.cpp:281
#: backends/platform/wii/options.cpp:48
#: backends/events/default/default-events.cpp:222
@@ -57,25 +57,30 @@ msgstr "CancelЗla"
msgid "Choose"
msgstr "Escull"
-#: gui/gui-manager.cpp:116 engines/scumm/help.cpp:125
+#: gui/gui-manager.cpp:115 engines/scumm/help.cpp:125
#: engines/scumm/help.cpp:140 engines/scumm/help.cpp:165
#: engines/scumm/help.cpp:191 engines/scumm/help.cpp:209
#: backends/keymapper/remap-dialog.cpp:52
msgid "Close"
msgstr "Tanca"
-#: gui/gui-manager.cpp:119
+#: gui/gui-manager.cpp:118
msgid "Mouse click"
msgstr "Clic del ratolэ"
-#: gui/gui-manager.cpp:122 base/main.cpp:283
+#: gui/gui-manager.cpp:121 base/main.cpp:289
msgid "Display keyboard"
msgstr "Mostra el teclat"
-#: gui/gui-manager.cpp:125 base/main.cpp:286
+#: gui/gui-manager.cpp:124 base/main.cpp:292
msgid "Remap keys"
msgstr "Assigna les tecles"
+#: gui/gui-manager.cpp:127 base/main.cpp:295
+#, fuzzy
+msgid "Toggle FullScreen"
+msgstr "Commuta la pantalla completa"
+
#: gui/KeysDialog.h:36 gui/KeysDialog.cpp:145
msgid "Choose an action to map"
msgstr "SelЗleccioneu una acciѓ a assignar"
@@ -86,11 +91,11 @@ msgstr "Assigna"
#: gui/KeysDialog.cpp:42 gui/launcher.cpp:320 gui/launcher.cpp:959
#: gui/launcher.cpp:963 gui/massadd.cpp:91 gui/options.cpp:1222
-#: engines/engine.cpp:359 engines/engine.cpp:370 engines/scumm/dialogs.cpp:192
-#: engines/scumm/scumm.cpp:1784 engines/agos/animation.cpp:551
+#: engines/engine.cpp:361 engines/engine.cpp:372 engines/scumm/dialogs.cpp:192
+#: engines/scumm/scumm.cpp:1775 engines/agos/animation.cpp:551
#: engines/groovie/script.cpp:420 engines/sky/compact.cpp:131
-#: engines/sky/compact.cpp:141 engines/sword1/animation.cpp:345
-#: engines/sword1/animation.cpp:355 engines/sword1/animation.cpp:361
+#: engines/sky/compact.cpp:141 engines/sword1/animation.cpp:449
+#: engines/sword1/animation.cpp:459 engines/sword1/animation.cpp:465
#: engines/sword1/control.cpp:865 engines/sword1/logic.cpp:1633
#: engines/sword2/animation.cpp:379 engines/sword2/animation.cpp:389
#: engines/sword2/animation.cpp:398 engines/parallaction/saveload.cpp:281
@@ -346,7 +351,7 @@ msgstr ""
msgid "~Q~uit"
msgstr "~T~anca"
-#: gui/launcher.cpp:578 backends/platform/sdl/macosx/appmenu_osx.mm:80
+#: gui/launcher.cpp:578 backends/platform/sdl/macosx/appmenu_osx.mm:96
msgid "Quit ScummVM"
msgstr "Surt de ScummVM"
@@ -354,7 +359,7 @@ msgstr "Surt de ScummVM"
msgid "A~b~out..."
msgstr "~Q~uant a..."
-#: gui/launcher.cpp:579 backends/platform/sdl/macosx/appmenu_osx.mm:61
+#: gui/launcher.cpp:579 backends/platform/sdl/macosx/appmenu_osx.mm:70
msgid "About ScummVM"
msgstr "Quant a ScummVM"
@@ -601,7 +606,7 @@ msgstr "Modes de tramat especials suportats per alguns jocs"
#: gui/options.cpp:761
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2248
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:476
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:472
msgid "Fullscreen mode"
msgstr "Mode pantalla completa"
@@ -968,28 +973,28 @@ msgstr "Partida sense tэtol"
msgid "Select a Theme"
msgstr "Seleccioneu un Tema"
-#: gui/ThemeEngine.cpp:329
+#: gui/ThemeEngine.cpp:333
msgid "Disabled GFX"
msgstr "GFX desactivats"
-#: gui/ThemeEngine.cpp:329
+#: gui/ThemeEngine.cpp:333
msgctxt "lowres"
msgid "Disabled GFX"
msgstr "GFX desactivats"
-#: gui/ThemeEngine.cpp:330
+#: gui/ThemeEngine.cpp:334
msgid "Standard Renderer (16bpp)"
msgstr "Pintat estрndard (16bpp)"
-#: gui/ThemeEngine.cpp:330
+#: gui/ThemeEngine.cpp:334
msgid "Standard (16bpp)"
msgstr "Estрndard (16bpp)"
-#: gui/ThemeEngine.cpp:332
+#: gui/ThemeEngine.cpp:336
msgid "Antialiased Renderer (16bpp)"
msgstr "Pintat amb antialias (16bpp)"
-#: gui/ThemeEngine.cpp:332
+#: gui/ThemeEngine.cpp:336
msgid "Antialiased (16bpp)"
msgstr "Amb antialias (16bpp)"
@@ -1002,30 +1007,30 @@ msgstr "Neteja el valor"
msgid "Engine does not support debug level '%s'"
msgstr "El motor no suporta el nivell de depuraciѓ '%s'"
-#: base/main.cpp:271
+#: base/main.cpp:277
msgid "Menu"
msgstr "Menњ"
-#: base/main.cpp:274 backends/platform/symbian/src/SymbianActions.cpp:45
+#: base/main.cpp:280 backends/platform/symbian/src/SymbianActions.cpp:45
#: backends/platform/wince/CEActionsPocket.cpp:45
#: backends/platform/wince/CEActionsSmartphone.cpp:46
msgid "Skip"
msgstr "Salta"
-#: base/main.cpp:277 backends/platform/symbian/src/SymbianActions.cpp:50
+#: base/main.cpp:283 backends/platform/symbian/src/SymbianActions.cpp:50
#: backends/platform/wince/CEActionsPocket.cpp:42
msgid "Pause"
msgstr "Pausa"
-#: base/main.cpp:280
+#: base/main.cpp:286
msgid "Skip line"
msgstr "Salta la lэnia"
-#: base/main.cpp:439
+#: base/main.cpp:455
msgid "Error running game:"
msgstr "Error al executar el joc:"
-#: base/main.cpp:463
+#: base/main.cpp:479
msgid "Could not find any engine capable of running the selected game"
msgstr "No s'ha pogut trobar cap motor capaч d'executar el joc seleccionat"
@@ -1197,23 +1202,23 @@ msgstr "~C~ancelЗla"
msgid "~K~eys"
msgstr "~T~ecles"
-#: engines/engine.cpp:233
+#: engines/engine.cpp:235
msgid "Could not initialize color format."
msgstr "No s'ha pogut iniciar el format de color."
-#: engines/engine.cpp:241
+#: engines/engine.cpp:243
msgid "Could not switch to video mode: '"
msgstr "No s'ha pogut canviar al mode de vэdeo: '"
-#: engines/engine.cpp:250
+#: engines/engine.cpp:252
msgid "Could not apply aspect ratio setting."
msgstr "No s'ha pogut aplicar la configuraciѓ de la relaciѓ d'aspecte."
-#: engines/engine.cpp:255
+#: engines/engine.cpp:257
msgid "Could not apply fullscreen setting."
msgstr "No s'ha pogut aplicar l'ajust de pantalla completa."
-#: engines/engine.cpp:355
+#: engines/engine.cpp:357
msgid ""
"You appear to be playing this game directly\n"
"from the CD. This is known to cause problems,\n"
@@ -1227,7 +1232,7 @@ msgstr ""
"els fitxers de dades al disc dur.\n"
"Consulteu el fitxer README per a mщs detalls."
-#: engines/engine.cpp:366
+#: engines/engine.cpp:368
msgid ""
"This game has audio tracks in its disk. These\n"
"tracks need to be ripped from the disk using\n"
@@ -1241,7 +1246,7 @@ msgstr ""
"tal de poder sentir la mњsica del joc.\n"
"Consulteu el fitxer README per a mщs detalls."
-#: engines/engine.cpp:433
+#: engines/engine.cpp:435
msgid ""
"WARNING: The game you are about to start is not yet fully supported by "
"ScummVM. As such, it is likely to be unstable, and any saves you make might "
@@ -1251,7 +1256,7 @@ msgstr ""
"pel ScummVM. Com a tal, probablement serр inestable, i pot ser que les "
"partides que deseu no funcionin en versions futures de ScummVM."
-#: engines/engine.cpp:436
+#: engines/engine.cpp:438
msgid "Start anyway"
msgstr "Inicia de totes maneres"
@@ -1903,7 +1908,7 @@ msgstr "Vola a la dreta"
msgid "Fly to lower right"
msgstr "Vola avall i a la dreta"
-#: engines/scumm/scumm.cpp:1782
+#: engines/scumm/scumm.cpp:1773
#, c-format
msgid ""
"Native MIDI support requires the Roland Upgrade from LucasArts,\n"
@@ -1912,7 +1917,7 @@ msgstr ""
"El suport de MIDI natiu requereix l'actualitzaciѓ Roland de LucasArts,\n"
"perђ no s'ha trobat %s. S'utilitzarр AdLib."
-#: engines/scumm/scumm.cpp:2272 engines/agos/saveload.cpp:189
+#: engines/scumm/scumm.cpp:2271 engines/agos/saveload.cpp:189
#, c-format
msgid ""
"Failed to save game state to file:\n"
@@ -1923,7 +1928,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2279 engines/agos/saveload.cpp:154
+#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:154
#, c-format
msgid ""
"Failed to load game state from file:\n"
@@ -1934,7 +1939,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2291 engines/agos/saveload.cpp:197
+#: engines/scumm/scumm.cpp:2290 engines/agos/saveload.cpp:197
#, c-format
msgid ""
"Successfully saved game state in file:\n"
@@ -1945,7 +1950,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2506
+#: engines/scumm/scumm.cpp:2505
msgid ""
"Usually, Maniac Mansion would start now. But ScummVM doesn't do that yet. To "
"play it, go to 'Add Game' in the ScummVM start menu and select the 'Maniac' "
@@ -1995,11 +2000,11 @@ msgid "Cutscene file '%s' not found!"
msgstr "No s'ha trobat el fitxer d'escena '%s'!"
#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1283
-#: engines/tinsel/saveload.cpp:482
+#: engines/tinsel/saveload.cpp:500
msgid "Failed to load game state from file."
msgstr "No s'ha pogut carregar l'estat del joc del fitxer."
-#: engines/gob/inter_v2.cpp:1353 engines/tinsel/saveload.cpp:495
+#: engines/gob/inter_v2.cpp:1353 engines/tinsel/saveload.cpp:513
msgid "Failed to save game state to file."
msgstr "No s'ha pogut desar l'estat del joc al fitxer."
@@ -2011,56 +2016,56 @@ msgstr "No s'ha pogut esborrar el fitxer."
msgid "Failed to save game"
msgstr "No s'ha pogut desar l'estat del joc"
-#: engines/kyra/lol.cpp:572
+#: engines/kyra/lol.cpp:478
msgid "Attack 1"
msgstr ""
-#: engines/kyra/lol.cpp:573
+#: engines/kyra/lol.cpp:479
msgid "Attack 2"
msgstr ""
-#: engines/kyra/lol.cpp:574
+#: engines/kyra/lol.cpp:480
msgid "Attack 3"
msgstr ""
-#: engines/kyra/lol.cpp:575
+#: engines/kyra/lol.cpp:481
msgid "Move Forward"
msgstr ""
-#: engines/kyra/lol.cpp:576
+#: engines/kyra/lol.cpp:482
msgid "Move Back"
msgstr ""
-#: engines/kyra/lol.cpp:577
+#: engines/kyra/lol.cpp:483
msgid "Slide Left"
msgstr ""
-#: engines/kyra/lol.cpp:578
+#: engines/kyra/lol.cpp:484
#, fuzzy
msgid "Slide Right"
msgstr "Dreta"
-#: engines/kyra/lol.cpp:579
+#: engines/kyra/lol.cpp:485
#, fuzzy
msgid "Turn Left"
msgstr "Apaga"
-#: engines/kyra/lol.cpp:580
+#: engines/kyra/lol.cpp:486
#, fuzzy
msgid "Turn Right"
msgstr "Cursor Dreta"
-#: engines/kyra/lol.cpp:581
+#: engines/kyra/lol.cpp:487
#, fuzzy
msgid "Rest"
msgstr "Restaura"
-#: engines/kyra/lol.cpp:582
+#: engines/kyra/lol.cpp:488
#, fuzzy
msgid "Options"
msgstr "~O~pcions"
-#: engines/kyra/lol.cpp:583
+#: engines/kyra/lol.cpp:489
#, fuzzy
msgid "Choose Spell"
msgstr "Escull"
@@ -2095,17 +2100,17 @@ msgstr ""
"El fitxer \"sky.cpt\" tщ una mida incorrecta.\n"
"Torneu a baixar-lo de www.scummvm.org"
-#: engines/sword1/animation.cpp:345 engines/sword2/animation.cpp:379
+#: engines/sword1/animation.cpp:449 engines/sword2/animation.cpp:379
msgid "DXA cutscenes found but ScummVM has been built without zlib support"
msgstr ""
"S'han trobat escenes en DXA, perђ s'ha compilat el ScummVM sense suport de "
"zlib"
-#: engines/sword1/animation.cpp:355 engines/sword2/animation.cpp:389
+#: engines/sword1/animation.cpp:459 engines/sword2/animation.cpp:389
msgid "MPEG2 cutscenes are no longer supported"
msgstr "Les escenes MPEG2 ja no estan suportades"
-#: engines/sword1/animation.cpp:360 engines/sword2/animation.cpp:397
+#: engines/sword1/animation.cpp:464 engines/sword2/animation.cpp:397
#, c-format
msgid "Cutscene '%s' not found"
msgstr "No s'ha trobat l'escena '%s'"
@@ -2268,11 +2273,11 @@ msgstr "Emulador d'Apple II GS (NO IMPLEMENTAT)"
msgid "C64 Audio Emulator"
msgstr "Emulador d'рudio C64"
-#: audio/softsynth/mt32.cpp:329
+#: audio/softsynth/mt32.cpp:293
msgid "Initializing MT-32 Emulator"
msgstr "Iniciant l'Emulador de MT-32"
-#: audio/softsynth/mt32.cpp:543
+#: audio/softsynth/mt32.cpp:512
msgid "MT-32 Emulator"
msgstr "Emulador de MT-32"
@@ -2288,15 +2293,20 @@ msgstr "Emulador d'IBM PCjr"
msgid "Keymap:"
msgstr "Assignacions de teclat:"
-#: backends/keymapper/remap-dialog.cpp:64
+#: backends/keymapper/remap-dialog.cpp:66
+#, fuzzy
+msgid " (Effective)"
+msgstr " (Actiu)"
+
+#: backends/keymapper/remap-dialog.cpp:106
msgid " (Active)"
msgstr " (Actiu)"
-#: backends/keymapper/remap-dialog.cpp:98
+#: backends/keymapper/remap-dialog.cpp:116
msgid " (Global)"
msgstr " (Global)"
-#: backends/keymapper/remap-dialog.cpp:108
+#: backends/keymapper/remap-dialog.cpp:126
msgid " (Game)"
msgstr " (Joc)"
@@ -2392,24 +2402,48 @@ msgstr "Mode Touchpad activat."
msgid "Touchpad mode disabled."
msgstr "Mode Touchpad desactivat."
-#: backends/platform/sdl/macosx/appmenu_osx.mm:67
+#: backends/platform/maemo/maemo.cpp:178
+msgid "Click Mode"
+msgstr ""
+
+#: backends/platform/maemo/maemo.cpp:184
+#: backends/platform/symbian/src/SymbianActions.cpp:42
+#: backends/platform/wince/CEActionsPocket.cpp:60
+#: backends/platform/wince/CEActionsSmartphone.cpp:43
+#: backends/platform/bada/form.cpp:281
+msgid "Left Click"
+msgstr "Clic esquerre"
+
+#: backends/platform/maemo/maemo.cpp:187
+#, fuzzy
+msgid "Middle Click"
+msgstr "Element mig esquerre"
+
+#: backends/platform/maemo/maemo.cpp:190
+#: backends/platform/symbian/src/SymbianActions.cpp:43
+#: backends/platform/wince/CEActionsSmartphone.cpp:44
+#: backends/platform/bada/form.cpp:273
+msgid "Right Click"
+msgstr "Clic dret"
+
+#: backends/platform/sdl/macosx/appmenu_osx.mm:78
msgid "Hide ScummVM"
msgstr "Amaga ScummVM"
-#: backends/platform/sdl/macosx/appmenu_osx.mm:70
+#: backends/platform/sdl/macosx/appmenu_osx.mm:83
msgid "Hide Others"
msgstr "Oculta els altres"
-#: backends/platform/sdl/macosx/appmenu_osx.mm:74
+#: backends/platform/sdl/macosx/appmenu_osx.mm:88
msgid "Show All"
msgstr "Mostra-ho tot"
-#: backends/platform/sdl/macosx/appmenu_osx.mm:92
-#: backends/platform/sdl/macosx/appmenu_osx.mm:99
+#: backends/platform/sdl/macosx/appmenu_osx.mm:110
+#: backends/platform/sdl/macosx/appmenu_osx.mm:121
msgid "Window"
msgstr "Finestra"
-#: backends/platform/sdl/macosx/appmenu_osx.mm:95
+#: backends/platform/sdl/macosx/appmenu_osx.mm:115
msgid "Minimize"
msgstr "Minimitza"
@@ -2423,12 +2457,12 @@ msgid "Normal (no scaling)"
msgstr "Normal (no escalat)"
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2147
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:537
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:533
msgid "Enabled aspect ratio correction"
msgstr "S'ha activat la correcciѓ de la relaciѓ d'aspecte"
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2153
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:542
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:538
msgid "Disabled aspect ratio correction"
msgstr "S'ha desactivat la correcciѓ de la relaciѓ d'aspecte"
@@ -2437,7 +2471,7 @@ msgid "Active graphics filter:"
msgstr "Filtre de grрfics actiu:"
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2250
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:481
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:477
msgid "Windowed mode"
msgstr "Mode de finestra"
@@ -2461,11 +2495,11 @@ msgstr "Mode de vэdeo actual"
msgid "Current scale"
msgstr "Escala actual"
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:562
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:558
msgid "Active filter mode: Linear"
msgstr "Mode de filtre actiu: Lineal"
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:564
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:560
msgid "Active filter mode: Nearest"
msgstr "Mode de filtre actiu: Prђxim"
@@ -2489,19 +2523,6 @@ msgstr "Esquerra"
msgid "Right"
msgstr "Dreta"
-#: backends/platform/symbian/src/SymbianActions.cpp:42
-#: backends/platform/wince/CEActionsPocket.cpp:60
-#: backends/platform/wince/CEActionsSmartphone.cpp:43
-#: backends/platform/bada/form.cpp:281
-msgid "Left Click"
-msgstr "Clic esquerre"
-
-#: backends/platform/symbian/src/SymbianActions.cpp:43
-#: backends/platform/wince/CEActionsSmartphone.cpp:44
-#: backends/platform/bada/form.cpp:273
-msgid "Right Click"
-msgstr "Clic dret"
-
#: backends/platform/symbian/src/SymbianActions.cpp:46
#: backends/platform/wince/CEActionsSmartphone.cpp:47
msgid "Zone"
@@ -2864,11 +2885,11 @@ msgstr "Mostra el teclat numшric"
msgid "Control Mouse"
msgstr "Controla el ratolэ"
-#: backends/events/maemosdl/maemosdl-events.cpp:129
+#: backends/events/maemosdl/maemosdl-events.cpp:192
msgid "Clicking Enabled"
msgstr "Clicat activat"
-#: backends/events/maemosdl/maemosdl-events.cpp:129
+#: backends/events/maemosdl/maemosdl-events.cpp:192
msgid "Clicking Disabled"
msgstr "Clicat desactivat"
diff --git a/po/cs_CZ.po b/po/cs_CZ.po
index adea4448d1..433a6f620c 100644
--- a/po/cs_CZ.po
+++ b/po/cs_CZ.po
@@ -7,14 +7,14 @@ msgid ""
msgstr ""
"Project-Id-Version: ScummVM 1.4.0git\n"
"Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n"
-"POT-Creation-Date: 2011-12-26 15:26+0100\n"
+"POT-Creation-Date: 2012-02-16 12:32+0200\n"
"PO-Revision-Date: 2011-12-27 17:46+0100\n"
"Last-Translator: Zbynьk Schwarz <zbynek.schwarz@gmail.com>\n"
"Language-Team: \n"
+"Language: Cesky\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=iso-8859-2\n"
"Content-Transfer-Encoding: 8bit\n"
-"Language: Cesky\n"
"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2\n"
"X-Poedit-Language: Czech\n"
"X-Poedit-Country: CZECH REPUBLIC\n"
@@ -49,7 +49,7 @@ msgstr "Jэt nahoru"
#: gui/browser.cpp:69 gui/chooser.cpp:45 gui/KeysDialog.cpp:43
#: gui/launcher.cpp:319 gui/massadd.cpp:94 gui/options.cpp:1221
#: gui/saveload.cpp:63 gui/saveload.cpp:155 gui/themebrowser.cpp:54
-#: engines/engine.cpp:436 engines/scumm/dialogs.cpp:190
+#: engines/engine.cpp:438 engines/scumm/dialogs.cpp:190
#: engines/sword1/control.cpp:865 engines/parallaction/saveload.cpp:281
#: backends/platform/wii/options.cpp:48
#: backends/events/default/default-events.cpp:222
@@ -61,25 +61,30 @@ msgstr "ZruЙit"
msgid "Choose"
msgstr "Zvolit"
-#: gui/gui-manager.cpp:116 engines/scumm/help.cpp:125
+#: gui/gui-manager.cpp:115 engines/scumm/help.cpp:125
#: engines/scumm/help.cpp:140 engines/scumm/help.cpp:165
#: engines/scumm/help.cpp:191 engines/scumm/help.cpp:209
#: backends/keymapper/remap-dialog.cpp:52
msgid "Close"
msgstr "Zavјэt"
-#: gui/gui-manager.cpp:119
+#: gui/gui-manager.cpp:118
msgid "Mouse click"
msgstr "Kliknutэ myЙэ"
-#: gui/gui-manager.cpp:122 base/main.cpp:283
+#: gui/gui-manager.cpp:121 base/main.cpp:289
msgid "Display keyboard"
msgstr "Zobrazit klсvesnici"
-#: gui/gui-manager.cpp:125 base/main.cpp:286
+#: gui/gui-manager.cpp:124 base/main.cpp:292
msgid "Remap keys"
msgstr "Pјemapovat klсvesy"
+#: gui/gui-manager.cpp:127 base/main.cpp:295
+#, fuzzy
+msgid "Toggle FullScreen"
+msgstr "Zapnout celou obrazovku"
+
#: gui/KeysDialog.h:36 gui/KeysDialog.cpp:145
msgid "Choose an action to map"
msgstr "Zvolte шinnost k mapovсnэ"
@@ -90,11 +95,11 @@ msgstr "Mapovat"
#: gui/KeysDialog.cpp:42 gui/launcher.cpp:320 gui/launcher.cpp:959
#: gui/launcher.cpp:963 gui/massadd.cpp:91 gui/options.cpp:1222
-#: engines/engine.cpp:359 engines/engine.cpp:370 engines/scumm/dialogs.cpp:192
-#: engines/scumm/scumm.cpp:1784 engines/agos/animation.cpp:551
+#: engines/engine.cpp:361 engines/engine.cpp:372 engines/scumm/dialogs.cpp:192
+#: engines/scumm/scumm.cpp:1775 engines/agos/animation.cpp:551
#: engines/groovie/script.cpp:420 engines/sky/compact.cpp:131
-#: engines/sky/compact.cpp:141 engines/sword1/animation.cpp:345
-#: engines/sword1/animation.cpp:355 engines/sword1/animation.cpp:361
+#: engines/sky/compact.cpp:141 engines/sword1/animation.cpp:449
+#: engines/sword1/animation.cpp:459 engines/sword1/animation.cpp:465
#: engines/sword1/control.cpp:865 engines/sword1/logic.cpp:1633
#: engines/sword2/animation.cpp:379 engines/sword2/animation.cpp:389
#: engines/sword2/animation.cpp:398 engines/parallaction/saveload.cpp:281
@@ -347,7 +352,7 @@ msgstr "Toto ID hry je uО zabranщ. Vyberte si, prosэm, jinщ."
msgid "~Q~uit"
msgstr "~U~konшit"
-#: gui/launcher.cpp:578 backends/platform/sdl/macosx/appmenu_osx.mm:80
+#: gui/launcher.cpp:578 backends/platform/sdl/macosx/appmenu_osx.mm:96
msgid "Quit ScummVM"
msgstr "Ukonшit ScummVM"
@@ -355,7 +360,7 @@ msgstr "Ukonшit ScummVM"
msgid "A~b~out..."
msgstr "~O~ Programu..."
-#: gui/launcher.cpp:579 backends/platform/sdl/macosx/appmenu_osx.mm:61
+#: gui/launcher.cpp:579 backends/platform/sdl/macosx/appmenu_osx.mm:70
msgid "About ScummVM"
msgstr "O ScummVM"
@@ -598,7 +603,7 @@ msgstr "Speciсlnэ reОimy chvьnэ podporovanщ nьkter§mi hrami"
#: gui/options.cpp:761
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2248
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:476
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:472
msgid "Fullscreen mode"
msgstr "ReОim celщ obrazovky"
@@ -958,28 +963,28 @@ msgstr "Bezejmenn§ uloОen§ stav"
msgid "Select a Theme"
msgstr "Vyberte Vzhled"
-#: gui/ThemeEngine.cpp:329
+#: gui/ThemeEngine.cpp:333
msgid "Disabled GFX"
msgstr "GFX zakсzсno"
-#: gui/ThemeEngine.cpp:329
+#: gui/ThemeEngine.cpp:333
msgctxt "lowres"
msgid "Disabled GFX"
msgstr "GFX zakсzсno"
-#: gui/ThemeEngine.cpp:330
+#: gui/ThemeEngine.cpp:334
msgid "Standard Renderer (16bpp)"
msgstr "Standardnэ Vykreslovaш (16bpp)"
-#: gui/ThemeEngine.cpp:330
+#: gui/ThemeEngine.cpp:334
msgid "Standard (16bpp)"
msgstr "Standardnэ (16bpp)"
-#: gui/ThemeEngine.cpp:332
+#: gui/ThemeEngine.cpp:336
msgid "Antialiased Renderer (16bpp)"
msgstr "Vykreslovaш s vyhlazen§mi hranami (16bpp)"
-#: gui/ThemeEngine.cpp:332
+#: gui/ThemeEngine.cpp:336
msgid "Antialiased (16bpp)"
msgstr "S vyhlazen§mi hranami (16bpp)"
@@ -992,30 +997,30 @@ msgstr "Vyшistit hodnotu"
msgid "Engine does not support debug level '%s'"
msgstr "Jсdro nepodporuje њroveђ ladьnэ '%s'"
-#: base/main.cpp:271
+#: base/main.cpp:277
msgid "Menu"
msgstr "Menu"
-#: base/main.cpp:274 backends/platform/symbian/src/SymbianActions.cpp:45
+#: base/main.cpp:280 backends/platform/symbian/src/SymbianActions.cpp:45
#: backends/platform/wince/CEActionsPocket.cpp:45
#: backends/platform/wince/CEActionsSmartphone.cpp:46
msgid "Skip"
msgstr "Pјeskoшit"
-#: base/main.cpp:277 backends/platform/symbian/src/SymbianActions.cpp:50
+#: base/main.cpp:283 backends/platform/symbian/src/SymbianActions.cpp:50
#: backends/platform/wince/CEActionsPocket.cpp:42
msgid "Pause"
msgstr "Pauza"
-#: base/main.cpp:280
+#: base/main.cpp:286
msgid "Skip line"
msgstr "Pјeskoшit јсdek"
-#: base/main.cpp:439
+#: base/main.cpp:455
msgid "Error running game:"
msgstr "Chyba pјi spuЙtьnэ hry:"
-#: base/main.cpp:463
+#: base/main.cpp:479
msgid "Could not find any engine capable of running the selected game"
msgstr "Nelze nalщzt Осdnщ jсdro schopnщ vybranou hru spustit"
@@ -1187,23 +1192,23 @@ msgstr "~Z~ruЙit"
msgid "~K~eys"
msgstr "~K~lсvesy"
-#: engines/engine.cpp:233
+#: engines/engine.cpp:235
msgid "Could not initialize color format."
msgstr "Nelze zavщst barevn§ formсt."
-#: engines/engine.cpp:241
+#: engines/engine.cpp:243
msgid "Could not switch to video mode: '"
msgstr "Nelze pјepnout na reОim obrazu: '"
-#: engines/engine.cpp:250
+#: engines/engine.cpp:252
msgid "Could not apply aspect ratio setting."
msgstr "Nelze pouОэt nastavenэ pomьru stran."
-#: engines/engine.cpp:255
+#: engines/engine.cpp:257
msgid "Could not apply fullscreen setting."
msgstr "Nelze pouОэt nastavenэ celщ obrazovky."
-#: engines/engine.cpp:355
+#: engines/engine.cpp:357
msgid ""
"You appear to be playing this game directly\n"
"from the CD. This is known to cause problems,\n"
@@ -1217,7 +1222,7 @@ msgstr ""
"datovщ soubory na VсЙ pevn§ disk.\n"
"Pro podrobnosti si pјeшtьte README."
-#: engines/engine.cpp:366
+#: engines/engine.cpp:368
msgid ""
"This game has audio tracks in its disk. These\n"
"tracks need to be ripped from the disk using\n"
@@ -1231,7 +1236,7 @@ msgstr ""
"abyste mohli poslouchat hudbu ve hјe.\n"
"Pro podrobnosti si pјeшtьte README."
-#: engines/engine.cpp:433
+#: engines/engine.cpp:435
msgid ""
"WARNING: The game you are about to start is not yet fully supported by "
"ScummVM. As such, it is likely to be unstable, and any saves you make might "
@@ -1241,7 +1246,7 @@ msgstr ""
"ScummVM. Proto je moОnщ, Оe bude nestabilnэ a jakщkoli uloОenщ hry nemusэ "
"fungovat v budoucэch verzэch ScummVM."
-#: engines/engine.cpp:436
+#: engines/engine.cpp:438
msgid "Start anyway"
msgstr "Pјesto spustit"
@@ -1892,7 +1897,7 @@ msgstr "Letьt doprava"
msgid "Fly to lower right"
msgstr "Letьt doprava dolљ"
-#: engines/scumm/scumm.cpp:1782
+#: engines/scumm/scumm.cpp:1773
#, c-format
msgid ""
"Native MIDI support requires the Roland Upgrade from LucasArts,\n"
@@ -1901,7 +1906,7 @@ msgstr ""
"Pјirozenс podpora MIDI vyОaduje Aktualizaci Roland od LucasArts,\n"
"ale %s chybэ. Mэsto toho je pouОit AdLib."
-#: engines/scumm/scumm.cpp:2272 engines/agos/saveload.cpp:189
+#: engines/scumm/scumm.cpp:2271 engines/agos/saveload.cpp:189
#, c-format
msgid ""
"Failed to save game state to file:\n"
@@ -1912,7 +1917,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2279 engines/agos/saveload.cpp:154
+#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:154
#, c-format
msgid ""
"Failed to load game state from file:\n"
@@ -1923,7 +1928,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2291 engines/agos/saveload.cpp:197
+#: engines/scumm/scumm.cpp:2290 engines/agos/saveload.cpp:197
#, c-format
msgid ""
"Successfully saved game state in file:\n"
@@ -1934,7 +1939,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2506
+#: engines/scumm/scumm.cpp:2505
msgid ""
"Usually, Maniac Mansion would start now. But ScummVM doesn't do that yet. To "
"play it, go to 'Add Game' in the ScummVM start menu and select the 'Maniac' "
@@ -1984,11 +1989,11 @@ msgid "Cutscene file '%s' not found!"
msgstr "Soubor videa '%s' nenalezen'"
#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1283
-#: engines/tinsel/saveload.cpp:482
+#: engines/tinsel/saveload.cpp:500
msgid "Failed to load game state from file."
msgstr "Nelze naшэst stav hry ze souboru."
-#: engines/gob/inter_v2.cpp:1353 engines/tinsel/saveload.cpp:495
+#: engines/gob/inter_v2.cpp:1353 engines/tinsel/saveload.cpp:513
msgid "Failed to save game state to file."
msgstr "Nelze uloОit stav hry do souboru."
@@ -2000,51 +2005,51 @@ msgstr "Nelze smazat soubor."
msgid "Failed to save game"
msgstr "Nelze uloОit hru."
-#: engines/kyra/lol.cpp:572
+#: engines/kyra/lol.cpp:478
msgid "Attack 1"
msgstr "кtok 1"
-#: engines/kyra/lol.cpp:573
+#: engines/kyra/lol.cpp:479
msgid "Attack 2"
msgstr "кtok 2"
-#: engines/kyra/lol.cpp:574
+#: engines/kyra/lol.cpp:480
msgid "Attack 3"
msgstr "кtok 3"
-#: engines/kyra/lol.cpp:575
+#: engines/kyra/lol.cpp:481
msgid "Move Forward"
msgstr "Vpјed"
-#: engines/kyra/lol.cpp:576
+#: engines/kyra/lol.cpp:482
msgid "Move Back"
msgstr "Vzad"
-#: engines/kyra/lol.cpp:577
+#: engines/kyra/lol.cpp:483
msgid "Slide Left"
msgstr "Pјesunout se Doleva"
-#: engines/kyra/lol.cpp:578
+#: engines/kyra/lol.cpp:484
msgid "Slide Right"
msgstr "Pјesunout se Doprava"
-#: engines/kyra/lol.cpp:579
+#: engines/kyra/lol.cpp:485
msgid "Turn Left"
msgstr "Otoшit se doleva"
-#: engines/kyra/lol.cpp:580
+#: engines/kyra/lol.cpp:486
msgid "Turn Right"
msgstr "Otoшit se doprava"
-#: engines/kyra/lol.cpp:581
+#: engines/kyra/lol.cpp:487
msgid "Rest"
msgstr "Odpoшinout si"
-#: engines/kyra/lol.cpp:582
+#: engines/kyra/lol.cpp:488
msgid "Options"
msgstr "Volby"
-#: engines/kyra/lol.cpp:583
+#: engines/kyra/lol.cpp:489
msgid "Choose Spell"
msgstr "Zvolit Kouzlo"
@@ -2078,15 +2083,15 @@ msgstr ""
"Soubor \"sky.cpt\" mс nesprсvnou velikost.\n"
"Stсhnьte si ho, prosэm, (znovu) z www.scummvm.org"
-#: engines/sword1/animation.cpp:345 engines/sword2/animation.cpp:379
+#: engines/sword1/animation.cpp:449 engines/sword2/animation.cpp:379
msgid "DXA cutscenes found but ScummVM has been built without zlib support"
msgstr "Videa DXA nalezena, ale ScummVM byl sestaven bez podpory zlib"
-#: engines/sword1/animation.cpp:355 engines/sword2/animation.cpp:389
+#: engines/sword1/animation.cpp:459 engines/sword2/animation.cpp:389
msgid "MPEG2 cutscenes are no longer supported"
msgstr "Videa MPGE2 jiО nejsou podporovсna"
-#: engines/sword1/animation.cpp:360 engines/sword2/animation.cpp:397
+#: engines/sword1/animation.cpp:464 engines/sword2/animation.cpp:397
#, c-format
msgid "Cutscene '%s' not found"
msgstr "Video '%s' nenalezeno"
@@ -2248,11 +2253,11 @@ msgstr "Apple II GS Emulсtor (NENЭ ZAVEDEN)"
msgid "C64 Audio Emulator"
msgstr "Emulсtor zvuku C64"
-#: audio/softsynth/mt32.cpp:329
+#: audio/softsynth/mt32.cpp:293
msgid "Initializing MT-32 Emulator"
msgstr "Zavсdэm MT-32 Emulсtor"
-#: audio/softsynth/mt32.cpp:543
+#: audio/softsynth/mt32.cpp:512
msgid "MT-32 Emulator"
msgstr "MT-32 Emulсtor"
@@ -2268,15 +2273,20 @@ msgstr "IBM PCjr Emulсtor"
msgid "Keymap:"
msgstr "Mapa Klсves:"
-#: backends/keymapper/remap-dialog.cpp:64
+#: backends/keymapper/remap-dialog.cpp:66
+#, fuzzy
+msgid " (Effective)"
+msgstr "(Aktivnэ)"
+
+#: backends/keymapper/remap-dialog.cpp:106
msgid " (Active)"
msgstr "(Aktivnэ)"
-#: backends/keymapper/remap-dialog.cpp:98
+#: backends/keymapper/remap-dialog.cpp:116
msgid " (Global)"
msgstr "(Globсlnэ)"
-#: backends/keymapper/remap-dialog.cpp:108
+#: backends/keymapper/remap-dialog.cpp:126
msgid " (Game)"
msgstr "(Hra)"
@@ -2372,24 +2382,48 @@ msgstr "Touchpad reОim zapnut"
msgid "Touchpad mode disabled."
msgstr "Touchpad reОim vypnut"
-#: backends/platform/sdl/macosx/appmenu_osx.mm:67
+#: backends/platform/maemo/maemo.cpp:178
+msgid "Click Mode"
+msgstr ""
+
+#: backends/platform/maemo/maemo.cpp:184
+#: backends/platform/symbian/src/SymbianActions.cpp:42
+#: backends/platform/wince/CEActionsPocket.cpp:60
+#: backends/platform/wince/CEActionsSmartphone.cpp:43
+#: backends/platform/bada/form.cpp:281
+msgid "Left Click"
+msgstr "Levщ Kliknutэ"
+
+#: backends/platform/maemo/maemo.cpp:187
+#, fuzzy
+msgid "Middle Click"
+msgstr "PoloОka vlevo uprostјed"
+
+#: backends/platform/maemo/maemo.cpp:190
+#: backends/platform/symbian/src/SymbianActions.cpp:43
+#: backends/platform/wince/CEActionsSmartphone.cpp:44
+#: backends/platform/bada/form.cpp:273
+msgid "Right Click"
+msgstr "Pravщ kliknutэ"
+
+#: backends/platform/sdl/macosx/appmenu_osx.mm:78
msgid "Hide ScummVM"
msgstr "Skr§t ScummVM"
-#: backends/platform/sdl/macosx/appmenu_osx.mm:70
+#: backends/platform/sdl/macosx/appmenu_osx.mm:83
msgid "Hide Others"
msgstr "Skr§t Ostatnэ"
-#: backends/platform/sdl/macosx/appmenu_osx.mm:74
+#: backends/platform/sdl/macosx/appmenu_osx.mm:88
msgid "Show All"
msgstr "Zobrazit VЙe"
-#: backends/platform/sdl/macosx/appmenu_osx.mm:92
-#: backends/platform/sdl/macosx/appmenu_osx.mm:99
+#: backends/platform/sdl/macosx/appmenu_osx.mm:110
+#: backends/platform/sdl/macosx/appmenu_osx.mm:121
msgid "Window"
msgstr "Okno"
-#: backends/platform/sdl/macosx/appmenu_osx.mm:95
+#: backends/platform/sdl/macosx/appmenu_osx.mm:115
msgid "Minimize"
msgstr "Minimalizovat"
@@ -2403,12 +2437,12 @@ msgid "Normal (no scaling)"
msgstr "Normсlnэ (bez zmьny velikosti)"
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2147
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:537
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:533
msgid "Enabled aspect ratio correction"
msgstr "Povolena korekce pomьru stran"
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2153
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:542
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:538
msgid "Disabled aspect ratio correction"
msgstr "Zakсzсna korekce pomьru stran"
@@ -2417,7 +2451,7 @@ msgid "Active graphics filter:"
msgstr "Aktivnэ grafick§ filtr:"
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2250
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:481
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:477
msgid "Windowed mode"
msgstr "ReОim do okna"
@@ -2441,11 +2475,11 @@ msgstr "Souшasn§ reОim obrazu"
msgid "Current scale"
msgstr "Souшasnс velikost"
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:562
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:558
msgid "Active filter mode: Linear"
msgstr "Aktivnэ reОim filtru: Lineсrnэ"
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:564
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:560
msgid "Active filter mode: Nearest"
msgstr "Aktivnэ reОim filtru: NejbliОЙэ"
@@ -2469,19 +2503,6 @@ msgstr "Doleva"
msgid "Right"
msgstr "Doprava"
-#: backends/platform/symbian/src/SymbianActions.cpp:42
-#: backends/platform/wince/CEActionsPocket.cpp:60
-#: backends/platform/wince/CEActionsSmartphone.cpp:43
-#: backends/platform/bada/form.cpp:281
-msgid "Left Click"
-msgstr "Levщ Kliknutэ"
-
-#: backends/platform/symbian/src/SymbianActions.cpp:43
-#: backends/platform/wince/CEActionsSmartphone.cpp:44
-#: backends/platform/bada/form.cpp:273
-msgid "Right Click"
-msgstr "Pravщ kliknutэ"
-
#: backends/platform/symbian/src/SymbianActions.cpp:46
#: backends/platform/wince/CEActionsSmartphone.cpp:47
msgid "Zone"
@@ -2846,11 +2867,11 @@ msgstr "Zobrazit Klсvesnici"
msgid "Control Mouse"
msgstr "Ovlсdсnэ MyЙi"
-#: backends/events/maemosdl/maemosdl-events.cpp:129
+#: backends/events/maemosdl/maemosdl-events.cpp:192
msgid "Clicking Enabled"
msgstr "Kliknutэ Povoleno"
-#: backends/events/maemosdl/maemosdl-events.cpp:129
+#: backends/events/maemosdl/maemosdl-events.cpp:192
msgid "Clicking Disabled"
msgstr "Kliknutэ Zakсzсno"
diff --git a/po/da_DA.po b/po/da_DA.po
index 0147186338..e31affb0f7 100644
--- a/po/da_DA.po
+++ b/po/da_DA.po
@@ -1,12 +1,12 @@
# Copyright (C) 2010-2012 ScummVM Team
# This file is distributed under the same license as the ScummVM package.
# Steffen Nyeland <steffen@nyeland.dk>, 2010.
-#
+#
msgid ""
msgstr ""
"Project-Id-Version: ScummVM 1.3.0svn\n"
"Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n"
-"POT-Creation-Date: 2011-12-26 15:26+0100\n"
+"POT-Creation-Date: 2012-02-16 12:32+0200\n"
"PO-Revision-Date: 2011-01-08 22:53+0100\n"
"Last-Translator: Steffen Nyeland <steffen@nyeland.dk>\n"
"Language-Team: Steffen Nyeland <steffen@nyeland.dk>\n"
@@ -45,7 +45,7 @@ msgstr "Gх op"
#: gui/browser.cpp:69 gui/chooser.cpp:45 gui/KeysDialog.cpp:43
#: gui/launcher.cpp:319 gui/massadd.cpp:94 gui/options.cpp:1221
#: gui/saveload.cpp:63 gui/saveload.cpp:155 gui/themebrowser.cpp:54
-#: engines/engine.cpp:436 engines/scumm/dialogs.cpp:190
+#: engines/engine.cpp:438 engines/scumm/dialogs.cpp:190
#: engines/sword1/control.cpp:865 engines/parallaction/saveload.cpp:281
#: backends/platform/wii/options.cpp:48
#: backends/events/default/default-events.cpp:222
@@ -57,25 +57,30 @@ msgstr "Fortryd"
msgid "Choose"
msgstr "Vцlg"
-#: gui/gui-manager.cpp:116 engines/scumm/help.cpp:125
+#: gui/gui-manager.cpp:115 engines/scumm/help.cpp:125
#: engines/scumm/help.cpp:140 engines/scumm/help.cpp:165
#: engines/scumm/help.cpp:191 engines/scumm/help.cpp:209
#: backends/keymapper/remap-dialog.cpp:52
msgid "Close"
msgstr "Luk"
-#: gui/gui-manager.cpp:119
+#: gui/gui-manager.cpp:118
msgid "Mouse click"
msgstr "Muse klik"
-#: gui/gui-manager.cpp:122 base/main.cpp:283
+#: gui/gui-manager.cpp:121 base/main.cpp:289
msgid "Display keyboard"
msgstr "Vis tastatur"
-#: gui/gui-manager.cpp:125 base/main.cpp:286
+#: gui/gui-manager.cpp:124 base/main.cpp:292
msgid "Remap keys"
msgstr "Kortlцg taster"
+#: gui/gui-manager.cpp:127 base/main.cpp:295
+#, fuzzy
+msgid "Toggle FullScreen"
+msgstr "Skift fuldskцrm"
+
#: gui/KeysDialog.h:36 gui/KeysDialog.cpp:145
msgid "Choose an action to map"
msgstr "Vцlg en handling at kortlцgge"
@@ -86,11 +91,11 @@ msgstr "Kortlцg"
#: gui/KeysDialog.cpp:42 gui/launcher.cpp:320 gui/launcher.cpp:959
#: gui/launcher.cpp:963 gui/massadd.cpp:91 gui/options.cpp:1222
-#: engines/engine.cpp:359 engines/engine.cpp:370 engines/scumm/dialogs.cpp:192
-#: engines/scumm/scumm.cpp:1784 engines/agos/animation.cpp:551
+#: engines/engine.cpp:361 engines/engine.cpp:372 engines/scumm/dialogs.cpp:192
+#: engines/scumm/scumm.cpp:1775 engines/agos/animation.cpp:551
#: engines/groovie/script.cpp:420 engines/sky/compact.cpp:131
-#: engines/sky/compact.cpp:141 engines/sword1/animation.cpp:345
-#: engines/sword1/animation.cpp:355 engines/sword1/animation.cpp:361
+#: engines/sky/compact.cpp:141 engines/sword1/animation.cpp:449
+#: engines/sword1/animation.cpp:459 engines/sword1/animation.cpp:465
#: engines/sword1/control.cpp:865 engines/sword1/logic.cpp:1633
#: engines/sword2/animation.cpp:379 engines/sword2/animation.cpp:389
#: engines/sword2/animation.cpp:398 engines/parallaction/saveload.cpp:281
@@ -345,15 +350,15 @@ msgstr "Dette spil ID er allerede i brug. Vцlg venligst et andet."
msgid "~Q~uit"
msgstr "~A~fslut"
-#: gui/launcher.cpp:578 backends/platform/sdl/macosx/appmenu_osx.mm:80
+#: gui/launcher.cpp:578 backends/platform/sdl/macosx/appmenu_osx.mm:96
msgid "Quit ScummVM"
-msgstr "Afslut ScummVM"
+msgstr "Slut ScummVM"
#: gui/launcher.cpp:579
msgid "A~b~out..."
msgstr "~O~m..."
-#: gui/launcher.cpp:579 backends/platform/sdl/macosx/appmenu_osx.mm:61
+#: gui/launcher.cpp:579 backends/platform/sdl/macosx/appmenu_osx.mm:70
msgid "About ScummVM"
msgstr "Om ScummVM"
@@ -597,7 +602,7 @@ msgstr "Speciel farvereduceringstilstand understјttet a nogle spil"
#: gui/options.cpp:761
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2248
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:476
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:472
msgid "Fullscreen mode"
msgstr "Fuldskцrms tilstand"
@@ -956,28 +961,28 @@ msgstr "Unavngivet gemmetilstand"
msgid "Select a Theme"
msgstr "Vцlg et tema"
-#: gui/ThemeEngine.cpp:329
+#: gui/ThemeEngine.cpp:333
msgid "Disabled GFX"
msgstr "Deaktiveret GFX"
-#: gui/ThemeEngine.cpp:329
+#: gui/ThemeEngine.cpp:333
msgctxt "lowres"
msgid "Disabled GFX"
msgstr "Deaktiveret GFX"
-#: gui/ThemeEngine.cpp:330
+#: gui/ThemeEngine.cpp:334
msgid "Standard Renderer (16bpp)"
msgstr "Standard renderer (16bpp)"
-#: gui/ThemeEngine.cpp:330
+#: gui/ThemeEngine.cpp:334
msgid "Standard (16bpp)"
msgstr "Standard (16bpp)"
-#: gui/ThemeEngine.cpp:332
+#: gui/ThemeEngine.cpp:336
msgid "Antialiased Renderer (16bpp)"
msgstr "Antialias renderer (16bpp)"
-#: gui/ThemeEngine.cpp:332
+#: gui/ThemeEngine.cpp:336
msgid "Antialiased (16bpp)"
msgstr "Antialias (16bpp)"
@@ -990,30 +995,30 @@ msgstr "Slet vцrdi"
msgid "Engine does not support debug level '%s'"
msgstr "Motor understјtter ikke fejlfindingsniveau '%s'"
-#: base/main.cpp:271
+#: base/main.cpp:277
msgid "Menu"
msgstr "Menu"
-#: base/main.cpp:274 backends/platform/symbian/src/SymbianActions.cpp:45
+#: base/main.cpp:280 backends/platform/symbian/src/SymbianActions.cpp:45
#: backends/platform/wince/CEActionsPocket.cpp:45
#: backends/platform/wince/CEActionsSmartphone.cpp:46
msgid "Skip"
msgstr "Spring over"
-#: base/main.cpp:277 backends/platform/symbian/src/SymbianActions.cpp:50
+#: base/main.cpp:283 backends/platform/symbian/src/SymbianActions.cpp:50
#: backends/platform/wince/CEActionsPocket.cpp:42
msgid "Pause"
msgstr "Pause"
-#: base/main.cpp:280
+#: base/main.cpp:286
msgid "Skip line"
msgstr "Spring linje over"
-#: base/main.cpp:439
+#: base/main.cpp:455
msgid "Error running game:"
msgstr "Fejl ved kјrsel af spil:"
-#: base/main.cpp:463
+#: base/main.cpp:479
msgid "Could not find any engine capable of running the selected game"
msgstr "Kunne ikke finde nogen motor istand til at afvikle det valgte spil"
@@ -1189,25 +1194,25 @@ msgstr "~F~ortryd"
msgid "~K~eys"
msgstr "~T~aster"
-#: engines/engine.cpp:233
+#: engines/engine.cpp:235
msgid "Could not initialize color format."
msgstr ""
-#: engines/engine.cpp:241
+#: engines/engine.cpp:243
#, fuzzy
msgid "Could not switch to video mode: '"
msgstr "Aktuel videotilstand:"
-#: engines/engine.cpp:250
+#: engines/engine.cpp:252
#, fuzzy
msgid "Could not apply aspect ratio setting."
msgstr "Skift billedformat korrektion"
-#: engines/engine.cpp:255
+#: engines/engine.cpp:257
msgid "Could not apply fullscreen setting."
msgstr ""
-#: engines/engine.cpp:355
+#: engines/engine.cpp:357
msgid ""
"You appear to be playing this game directly\n"
"from the CD. This is known to cause problems,\n"
@@ -1216,7 +1221,7 @@ msgid ""
"See the README file for details."
msgstr ""
-#: engines/engine.cpp:366
+#: engines/engine.cpp:368
msgid ""
"This game has audio tracks in its disk. These\n"
"tracks need to be ripped from the disk using\n"
@@ -1225,14 +1230,14 @@ msgid ""
"See the README file for details."
msgstr ""
-#: engines/engine.cpp:433
+#: engines/engine.cpp:435
msgid ""
"WARNING: The game you are about to start is not yet fully supported by "
"ScummVM. As such, it is likely to be unstable, and any saves you make might "
"not work in future versions of ScummVM."
msgstr ""
-#: engines/engine.cpp:436
+#: engines/engine.cpp:438
msgid "Start anyway"
msgstr ""
@@ -1892,14 +1897,14 @@ msgstr "Flyv til hјjre"
msgid "Fly to lower right"
msgstr "Flyv nederst til hјjre"
-#: engines/scumm/scumm.cpp:1782
+#: engines/scumm/scumm.cpp:1773
#, c-format
msgid ""
"Native MIDI support requires the Roland Upgrade from LucasArts,\n"
"but %s is missing. Using AdLib instead."
msgstr ""
-#: engines/scumm/scumm.cpp:2272 engines/agos/saveload.cpp:189
+#: engines/scumm/scumm.cpp:2271 engines/agos/saveload.cpp:189
#, c-format
msgid ""
"Failed to save game state to file:\n"
@@ -1910,7 +1915,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2279 engines/agos/saveload.cpp:154
+#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:154
#, c-format
msgid ""
"Failed to load game state from file:\n"
@@ -1921,7 +1926,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2291 engines/agos/saveload.cpp:197
+#: engines/scumm/scumm.cpp:2290 engines/agos/saveload.cpp:197
#, c-format
msgid ""
"Successfully saved game state in file:\n"
@@ -1932,7 +1937,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2506
+#: engines/scumm/scumm.cpp:2505
msgid ""
"Usually, Maniac Mansion would start now. But ScummVM doesn't do that yet. To "
"play it, go to 'Add Game' in the ScummVM start menu and select the 'Maniac' "
@@ -1980,7 +1985,7 @@ msgid "Cutscene file '%s' not found!"
msgstr ""
#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1283
-#: engines/tinsel/saveload.cpp:482
+#: engines/tinsel/saveload.cpp:500
#, fuzzy
msgid "Failed to load game state from file."
msgstr ""
@@ -1988,7 +1993,7 @@ msgstr ""
"\n"
"%s"
-#: engines/gob/inter_v2.cpp:1353 engines/tinsel/saveload.cpp:495
+#: engines/gob/inter_v2.cpp:1353 engines/tinsel/saveload.cpp:513
#, fuzzy
msgid "Failed to save game state to file."
msgstr ""
@@ -2012,56 +2017,56 @@ msgstr ""
"\n"
"%s"
-#: engines/kyra/lol.cpp:572
+#: engines/kyra/lol.cpp:478
msgid "Attack 1"
msgstr ""
-#: engines/kyra/lol.cpp:573
+#: engines/kyra/lol.cpp:479
msgid "Attack 2"
msgstr ""
-#: engines/kyra/lol.cpp:574
+#: engines/kyra/lol.cpp:480
msgid "Attack 3"
msgstr ""
-#: engines/kyra/lol.cpp:575
+#: engines/kyra/lol.cpp:481
msgid "Move Forward"
msgstr ""
-#: engines/kyra/lol.cpp:576
+#: engines/kyra/lol.cpp:482
msgid "Move Back"
msgstr ""
-#: engines/kyra/lol.cpp:577
+#: engines/kyra/lol.cpp:483
msgid "Slide Left"
msgstr ""
-#: engines/kyra/lol.cpp:578
+#: engines/kyra/lol.cpp:484
#, fuzzy
msgid "Slide Right"
msgstr "Hјjre"
-#: engines/kyra/lol.cpp:579
+#: engines/kyra/lol.cpp:485
#, fuzzy
msgid "Turn Left"
msgstr "Sluk"
-#: engines/kyra/lol.cpp:580
+#: engines/kyra/lol.cpp:486
#, fuzzy
msgid "Turn Right"
msgstr "Pil til hјjre"
-#: engines/kyra/lol.cpp:581
+#: engines/kyra/lol.cpp:487
#, fuzzy
msgid "Rest"
msgstr "Gendan"
-#: engines/kyra/lol.cpp:582
+#: engines/kyra/lol.cpp:488
#, fuzzy
msgid "Options"
msgstr "~I~ndstillinger"
-#: engines/kyra/lol.cpp:583
+#: engines/kyra/lol.cpp:489
#, fuzzy
msgid "Choose Spell"
msgstr "Vцlg"
@@ -2087,15 +2092,15 @@ msgid ""
"Please (re)download it from www.scummvm.org"
msgstr ""
-#: engines/sword1/animation.cpp:345 engines/sword2/animation.cpp:379
+#: engines/sword1/animation.cpp:449 engines/sword2/animation.cpp:379
msgid "DXA cutscenes found but ScummVM has been built without zlib support"
msgstr ""
-#: engines/sword1/animation.cpp:355 engines/sword2/animation.cpp:389
+#: engines/sword1/animation.cpp:459 engines/sword2/animation.cpp:389
msgid "MPEG2 cutscenes are no longer supported"
msgstr ""
-#: engines/sword1/animation.cpp:360 engines/sword2/animation.cpp:397
+#: engines/sword1/animation.cpp:464 engines/sword2/animation.cpp:397
#, c-format
msgid "Cutscene '%s' not found"
msgstr ""
@@ -2230,12 +2235,12 @@ msgstr "Apple II GS emulator (IKKE IMPLEMENTERET)"
msgid "C64 Audio Emulator"
msgstr "C64 lyd emulator"
-#: audio/softsynth/mt32.cpp:329
+#: audio/softsynth/mt32.cpp:293
#, fuzzy
msgid "Initializing MT-32 Emulator"
msgstr "Initialisere MT-32 emulator"
-#: audio/softsynth/mt32.cpp:543
+#: audio/softsynth/mt32.cpp:512
msgid "MT-32 Emulator"
msgstr "MT-32 emulator"
@@ -2251,15 +2256,20 @@ msgstr "IBM PCjr emulator"
msgid "Keymap:"
msgstr "Tasteoversigt:"
-#: backends/keymapper/remap-dialog.cpp:64
+#: backends/keymapper/remap-dialog.cpp:66
+#, fuzzy
+msgid " (Effective)"
+msgstr " (Aktiv)"
+
+#: backends/keymapper/remap-dialog.cpp:106
msgid " (Active)"
msgstr " (Aktiv)"
-#: backends/keymapper/remap-dialog.cpp:98
+#: backends/keymapper/remap-dialog.cpp:116
msgid " (Global)"
msgstr " (Global)"
-#: backends/keymapper/remap-dialog.cpp:108
+#: backends/keymapper/remap-dialog.cpp:126
msgid " (Game)"
msgstr " (Spil)"
@@ -2357,28 +2367,51 @@ msgstr "Pegeplade tilstand aktiveret."
msgid "Touchpad mode disabled."
msgstr "Pegeplade tilstand deaktiveret."
-#: backends/platform/sdl/macosx/appmenu_osx.mm:67
+#: backends/platform/maemo/maemo.cpp:178
+msgid "Click Mode"
+msgstr ""
+
+#: backends/platform/maemo/maemo.cpp:184
+#: backends/platform/symbian/src/SymbianActions.cpp:42
+#: backends/platform/wince/CEActionsPocket.cpp:60
+#: backends/platform/wince/CEActionsSmartphone.cpp:43
+#: backends/platform/bada/form.cpp:281
+msgid "Left Click"
+msgstr "Venstre klik"
+
+#: backends/platform/maemo/maemo.cpp:187
+#, fuzzy
+msgid "Middle Click"
+msgstr "Midterste hјjre punkt"
+
+#: backends/platform/maemo/maemo.cpp:190
+#: backends/platform/symbian/src/SymbianActions.cpp:43
+#: backends/platform/wince/CEActionsSmartphone.cpp:44
+#: backends/platform/bada/form.cpp:273
+msgid "Right Click"
+msgstr "Hјjre klik"
+
+#: backends/platform/sdl/macosx/appmenu_osx.mm:78
#, fuzzy
msgid "Hide ScummVM"
-msgstr "Afslut ScummVM"
+msgstr "Skjul ScummVM"
-#: backends/platform/sdl/macosx/appmenu_osx.mm:70
+#: backends/platform/sdl/macosx/appmenu_osx.mm:83
msgid "Hide Others"
-msgstr ""
+msgstr "Skjul andre"
-#: backends/platform/sdl/macosx/appmenu_osx.mm:74
+#: backends/platform/sdl/macosx/appmenu_osx.mm:88
msgid "Show All"
-msgstr ""
+msgstr "Vis alle"
-#: backends/platform/sdl/macosx/appmenu_osx.mm:92
-#: backends/platform/sdl/macosx/appmenu_osx.mm:99
-#, fuzzy
+#: backends/platform/sdl/macosx/appmenu_osx.mm:110
+#: backends/platform/sdl/macosx/appmenu_osx.mm:121
msgid "Window"
-msgstr "Windows MIDI"
+msgstr "Vindue"
-#: backends/platform/sdl/macosx/appmenu_osx.mm:95
+#: backends/platform/sdl/macosx/appmenu_osx.mm:115
msgid "Minimize"
-msgstr ""
+msgstr "Minimer"
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:45
msgid "Normal (no scaling)"
@@ -2390,13 +2423,13 @@ msgid "Normal (no scaling)"
msgstr "Normal (ingen skalering)"
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2147
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:537
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:533
#, fuzzy
msgid "Enabled aspect ratio correction"
msgstr "Skift billedformat korrektion"
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2153
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:542
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:538
#, fuzzy
msgid "Disabled aspect ratio correction"
msgstr "Skift billedformat korrektion"
@@ -2407,7 +2440,7 @@ msgid "Active graphics filter:"
msgstr "Skift mellem grafik filtre"
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2250
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:481
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:477
#, fuzzy
msgid "Windowed mode"
msgstr "Rendere tilstand:"
@@ -2433,11 +2466,11 @@ msgstr "Aktuel videotilstand:"
msgid "Current scale"
msgstr ""
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:562
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:558
msgid "Active filter mode: Linear"
msgstr ""
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:564
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:560
msgid "Active filter mode: Nearest"
msgstr ""
@@ -2461,19 +2494,6 @@ msgstr "Venstre"
msgid "Right"
msgstr "Hјjre"
-#: backends/platform/symbian/src/SymbianActions.cpp:42
-#: backends/platform/wince/CEActionsPocket.cpp:60
-#: backends/platform/wince/CEActionsSmartphone.cpp:43
-#: backends/platform/bada/form.cpp:281
-msgid "Left Click"
-msgstr "Venstre klik"
-
-#: backends/platform/symbian/src/SymbianActions.cpp:43
-#: backends/platform/wince/CEActionsSmartphone.cpp:44
-#: backends/platform/bada/form.cpp:273
-msgid "Right Click"
-msgstr "Hјjre klik"
-
#: backends/platform/symbian/src/SymbianActions.cpp:46
#: backends/platform/wince/CEActionsSmartphone.cpp:47
msgid "Zone"
@@ -2848,11 +2868,11 @@ msgstr "Vis tastatur"
msgid "Control Mouse"
msgstr ""
-#: backends/events/maemosdl/maemosdl-events.cpp:129
+#: backends/events/maemosdl/maemosdl-events.cpp:192
msgid "Clicking Enabled"
msgstr ""
-#: backends/events/maemosdl/maemosdl-events.cpp:129
+#: backends/events/maemosdl/maemosdl-events.cpp:192
msgid "Clicking Disabled"
msgstr ""
diff --git a/po/de_DE.po b/po/de_DE.po
index 86a2ddf086..e62f81de4d 100644
--- a/po/de_DE.po
+++ b/po/de_DE.po
@@ -1,14 +1,14 @@
# German translation for ScummVM.
# Copyright (C) 2010-2012 ScummVM Team
# This file is distributed under the same license as the ScummVM package.
-# Simon Sawatzki <SimSaw@gmx.de>, Lothar Serra Mari <Lothar@Windowsbase.de>, 2011.
-#
+# Simon Sawatzki <SimSaw@gmx.de>, Lothar Serra Mari <Lothar@Windowsbase.de>, 2012.
+#
msgid ""
msgstr ""
"Project-Id-Version: ScummVM 1.4.0git\n"
"Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n"
-"POT-Creation-Date: 2011-12-26 15:26+0100\n"
-"PO-Revision-Date: 2011-10-15 18:15+0100\n"
+"POT-Creation-Date: 2012-02-16 12:32+0200\n"
+"PO-Revision-Date: 2012-01-29 21:11+0100\n"
"Last-Translator: Simon Sawatzki <SimSaw@gmx.de>\n"
"Language-Team: Simon Sawatzki <SimSaw@gmx.de> (Lead), Lothar Serra Mari "
"<Lothar@Windowsbase.de> (Contributor)\n"
@@ -47,7 +47,7 @@ msgstr "Pfad hoch"
#: gui/browser.cpp:69 gui/chooser.cpp:45 gui/KeysDialog.cpp:43
#: gui/launcher.cpp:319 gui/massadd.cpp:94 gui/options.cpp:1221
#: gui/saveload.cpp:63 gui/saveload.cpp:155 gui/themebrowser.cpp:54
-#: engines/engine.cpp:436 engines/scumm/dialogs.cpp:190
+#: engines/engine.cpp:438 engines/scumm/dialogs.cpp:190
#: engines/sword1/control.cpp:865 engines/parallaction/saveload.cpp:281
#: backends/platform/wii/options.cpp:48
#: backends/events/default/default-events.cpp:222
@@ -59,25 +59,30 @@ msgstr "Abbrechen"
msgid "Choose"
msgstr "Auswфhlen"
-#: gui/gui-manager.cpp:116 engines/scumm/help.cpp:125
+#: gui/gui-manager.cpp:115 engines/scumm/help.cpp:125
#: engines/scumm/help.cpp:140 engines/scumm/help.cpp:165
#: engines/scumm/help.cpp:191 engines/scumm/help.cpp:209
#: backends/keymapper/remap-dialog.cpp:52
msgid "Close"
msgstr "Schlieпen"
-#: gui/gui-manager.cpp:119
+#: gui/gui-manager.cpp:118
msgid "Mouse click"
msgstr "Mausklick"
-#: gui/gui-manager.cpp:122 base/main.cpp:283
+#: gui/gui-manager.cpp:121 base/main.cpp:289
msgid "Display keyboard"
msgstr "Tastatur anzeigen"
-#: gui/gui-manager.cpp:125 base/main.cpp:286
+#: gui/gui-manager.cpp:124 base/main.cpp:292
msgid "Remap keys"
msgstr "Tasten neu zuweisen"
+#: gui/gui-manager.cpp:127 base/main.cpp:295
+#, fuzzy
+msgid "Toggle FullScreen"
+msgstr "Vollbild-/Fenster-Modus"
+
#: gui/KeysDialog.h:36 gui/KeysDialog.cpp:145
msgid "Choose an action to map"
msgstr "Eine Aktion zum Zuweisen auswфhlen"
@@ -88,11 +93,11 @@ msgstr "Zuweisen"
#: gui/KeysDialog.cpp:42 gui/launcher.cpp:320 gui/launcher.cpp:959
#: gui/launcher.cpp:963 gui/massadd.cpp:91 gui/options.cpp:1222
-#: engines/engine.cpp:359 engines/engine.cpp:370 engines/scumm/dialogs.cpp:192
-#: engines/scumm/scumm.cpp:1784 engines/agos/animation.cpp:551
+#: engines/engine.cpp:361 engines/engine.cpp:372 engines/scumm/dialogs.cpp:192
+#: engines/scumm/scumm.cpp:1775 engines/agos/animation.cpp:551
#: engines/groovie/script.cpp:420 engines/sky/compact.cpp:131
-#: engines/sky/compact.cpp:141 engines/sword1/animation.cpp:345
-#: engines/sword1/animation.cpp:355 engines/sword1/animation.cpp:361
+#: engines/sky/compact.cpp:141 engines/sword1/animation.cpp:449
+#: engines/sword1/animation.cpp:459 engines/sword1/animation.cpp:465
#: engines/sword1/control.cpp:865 engines/sword1/logic.cpp:1633
#: engines/sword2/animation.cpp:379 engines/sword2/animation.cpp:389
#: engines/sword2/animation.cpp:398 engines/parallaction/saveload.cpp:281
@@ -347,7 +352,7 @@ msgstr "Diese Spielkennung ist schon vergeben. Bitte eine andere wфhlen."
msgid "~Q~uit"
msgstr "~B~eenden"
-#: gui/launcher.cpp:578 backends/platform/sdl/macosx/appmenu_osx.mm:80
+#: gui/launcher.cpp:578 backends/platform/sdl/macosx/appmenu_osx.mm:96
msgid "Quit ScummVM"
msgstr "ScummVM beenden"
@@ -355,7 +360,7 @@ msgstr "ScummVM beenden"
msgid "A~b~out..."
msgstr "мbe~r~"
-#: gui/launcher.cpp:579 backends/platform/sdl/macosx/appmenu_osx.mm:61
+#: gui/launcher.cpp:579 backends/platform/sdl/macosx/appmenu_osx.mm:70
msgid "About ScummVM"
msgstr "мber ScummVM"
@@ -603,7 +608,7 @@ msgstr ""
#: gui/options.cpp:761
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2248
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:476
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:472
msgid "Fullscreen mode"
msgstr "Vollbildmodus"
@@ -973,28 +978,28 @@ msgstr "Unbenannt"
msgid "Select a Theme"
msgstr "Thema auswфhlen"
-#: gui/ThemeEngine.cpp:329
+#: gui/ThemeEngine.cpp:333
msgid "Disabled GFX"
msgstr "GFX ausgeschaltet"
-#: gui/ThemeEngine.cpp:329
+#: gui/ThemeEngine.cpp:333
msgctxt "lowres"
msgid "Disabled GFX"
msgstr "GFX ausgeschaltet"
-#: gui/ThemeEngine.cpp:330
+#: gui/ThemeEngine.cpp:334
msgid "Standard Renderer (16bpp)"
msgstr "Standard-Renderer (16bpp)"
-#: gui/ThemeEngine.cpp:330
+#: gui/ThemeEngine.cpp:334
msgid "Standard (16bpp)"
msgstr "Standard (16bpp)"
-#: gui/ThemeEngine.cpp:332
+#: gui/ThemeEngine.cpp:336
msgid "Antialiased Renderer (16bpp)"
msgstr "Kantenglфttung (16bpp)"
-#: gui/ThemeEngine.cpp:332
+#: gui/ThemeEngine.cpp:336
msgid "Antialiased (16bpp)"
msgstr "Kantenglфttung (16bpp)"
@@ -1007,30 +1012,30 @@ msgstr "Wert lіschen"
msgid "Engine does not support debug level '%s'"
msgstr "Engine unterstќtzt den Debug-Level \"%s\" nicht."
-#: base/main.cpp:271
+#: base/main.cpp:277
msgid "Menu"
msgstr "Menќ"
-#: base/main.cpp:274 backends/platform/symbian/src/SymbianActions.cpp:45
+#: base/main.cpp:280 backends/platform/symbian/src/SymbianActions.cpp:45
#: backends/platform/wince/CEActionsPocket.cpp:45
#: backends/platform/wince/CEActionsSmartphone.cpp:46
msgid "Skip"
msgstr "мberspringen"
-#: base/main.cpp:277 backends/platform/symbian/src/SymbianActions.cpp:50
+#: base/main.cpp:283 backends/platform/symbian/src/SymbianActions.cpp:50
#: backends/platform/wince/CEActionsPocket.cpp:42
msgid "Pause"
msgstr "Pause"
-#: base/main.cpp:280
+#: base/main.cpp:286
msgid "Skip line"
msgstr "Zeile ќberspringen"
-#: base/main.cpp:439
+#: base/main.cpp:455
msgid "Error running game:"
msgstr "Fehler beim Ausfќhren des Spiels:"
-#: base/main.cpp:463
+#: base/main.cpp:479
msgid "Could not find any engine capable of running the selected game"
msgstr "Konnte keine Spiel-Engine finden, die dieses Spiel starten kann."
@@ -1206,23 +1211,23 @@ msgstr "~A~bbrechen"
msgid "~K~eys"
msgstr "~T~asten"
-#: engines/engine.cpp:233
+#: engines/engine.cpp:235
msgid "Could not initialize color format."
msgstr "Konnte Farbenformat nicht initialisieren."
-#: engines/engine.cpp:241
+#: engines/engine.cpp:243
msgid "Could not switch to video mode: '"
msgstr "Konnte nicht zu Grafikmodus wechseln: '"
-#: engines/engine.cpp:250
+#: engines/engine.cpp:252
msgid "Could not apply aspect ratio setting."
msgstr "Konnte Einstellung fќr Seitenverhфltniskorrektur nicht anwenden."
-#: engines/engine.cpp:255
+#: engines/engine.cpp:257
msgid "Could not apply fullscreen setting."
msgstr "Konnte Einstellung fќr Vollbildmodus nicht anwenden."
-#: engines/engine.cpp:355
+#: engines/engine.cpp:357
msgid ""
"You appear to be playing this game directly\n"
"from the CD. This is known to cause problems,\n"
@@ -1238,7 +1243,7 @@ msgstr ""
"Lesen Sie die Liesmich-Datei fќr\n"
"weitere Informationen."
-#: engines/engine.cpp:366
+#: engines/engine.cpp:368
msgid ""
"This game has audio tracks in its disk. These\n"
"tracks need to be ripped from the disk using\n"
@@ -1253,7 +1258,7 @@ msgstr ""
"Spiel hіren zu kіnnen. Lesen Sie die\n"
"Liesmich-Datei fќr weitere Informationen."
-#: engines/engine.cpp:433
+#: engines/engine.cpp:435
msgid ""
"WARNING: The game you are about to start is not yet fully supported by "
"ScummVM. As such, it is likely to be unstable, and any saves you make might "
@@ -1264,7 +1269,7 @@ msgstr ""
"und jegliche Spielstфnde, die Sie erstellen, kіnnten in zukќnftigen "
"Versionen von ScummVM nicht mehr funktionieren."
-#: engines/engine.cpp:436
+#: engines/engine.cpp:438
msgid "Start anyway"
msgstr "Trotzdem starten"
@@ -1384,24 +1389,23 @@ msgstr "Sprache & Text"
#: engines/scumm/dialogs.cpp:653
msgid "Select a Proficiency Level."
-msgstr ""
+msgstr "Wфhle einen Schwierigkeitsgrad."
#: engines/scumm/dialogs.cpp:655
msgid "Refer to your Loom(TM) manual for help."
-msgstr ""
+msgstr "Fќr Hilfe schaue ins Loom-Handbuch."
#: engines/scumm/dialogs.cpp:658
-#, fuzzy
msgid "Standard"
-msgstr "Standard (16bpp)"
+msgstr "Standard"
#: engines/scumm/dialogs.cpp:659
msgid "Practice"
-msgstr ""
+msgstr "Anfфnger"
#: engines/scumm/dialogs.cpp:660
msgid "Expert"
-msgstr ""
+msgstr "Experte"
#: engines/scumm/help.cpp:73
msgid "Common keyboard commands:"
@@ -1916,7 +1920,7 @@ msgstr "Nach rechts fliegen"
msgid "Fly to lower right"
msgstr "Nach unten rechts fliegen"
-#: engines/scumm/scumm.cpp:1782
+#: engines/scumm/scumm.cpp:1773
#, c-format
msgid ""
"Native MIDI support requires the Roland Upgrade from LucasArts,\n"
@@ -1925,7 +1929,7 @@ msgstr ""
"Systemeigene MIDI-мnterstќtzung erfordert das Roland-Upgrade von LucasArts,\n"
"aber %s fehlt. Stattdessen wird AdLib verwendet."
-#: engines/scumm/scumm.cpp:2272 engines/agos/saveload.cpp:189
+#: engines/scumm/scumm.cpp:2271 engines/agos/saveload.cpp:189
#, c-format
msgid ""
"Failed to save game state to file:\n"
@@ -1936,7 +1940,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2279 engines/agos/saveload.cpp:154
+#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:154
#, c-format
msgid ""
"Failed to load game state from file:\n"
@@ -1947,7 +1951,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2291 engines/agos/saveload.cpp:197
+#: engines/scumm/scumm.cpp:2290 engines/agos/saveload.cpp:197
#, c-format
msgid ""
"Successfully saved game state in file:\n"
@@ -1958,7 +1962,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2506
+#: engines/scumm/scumm.cpp:2505
msgid ""
"Usually, Maniac Mansion would start now. But ScummVM doesn't do that yet. To "
"play it, go to 'Add Game' in the ScummVM start menu and select the 'Maniac' "
@@ -2009,11 +2013,11 @@ msgid "Cutscene file '%s' not found!"
msgstr "Zwischensequenz \"%s\" nicht gefunden!"
#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1283
-#: engines/tinsel/saveload.cpp:482
+#: engines/tinsel/saveload.cpp:500
msgid "Failed to load game state from file."
msgstr "Konnte Spielstand aus Datei nicht laden."
-#: engines/gob/inter_v2.cpp:1353 engines/tinsel/saveload.cpp:495
+#: engines/gob/inter_v2.cpp:1353 engines/tinsel/saveload.cpp:513
msgid "Failed to save game state to file."
msgstr "Konnte Spielstand nicht in Datei speichern."
@@ -2025,59 +2029,53 @@ msgstr "Konnte Datei nicht lіschen."
msgid "Failed to save game"
msgstr "Konnte Spielstand nicht speichern."
-#: engines/kyra/lol.cpp:572
+#: engines/kyra/lol.cpp:478
msgid "Attack 1"
-msgstr ""
+msgstr "Attacke 1"
-#: engines/kyra/lol.cpp:573
+#: engines/kyra/lol.cpp:479
msgid "Attack 2"
-msgstr ""
+msgstr "Attacke 2"
-#: engines/kyra/lol.cpp:574
+#: engines/kyra/lol.cpp:480
msgid "Attack 3"
-msgstr ""
+msgstr "Attacke 3"
-#: engines/kyra/lol.cpp:575
+#: engines/kyra/lol.cpp:481
msgid "Move Forward"
-msgstr ""
+msgstr "Nach vorn bewegen"
-#: engines/kyra/lol.cpp:576
+#: engines/kyra/lol.cpp:482
msgid "Move Back"
-msgstr ""
+msgstr "Nach hinten bewegen"
-#: engines/kyra/lol.cpp:577
+#: engines/kyra/lol.cpp:483
msgid "Slide Left"
-msgstr ""
+msgstr "Nach links rutschen"
-#: engines/kyra/lol.cpp:578
-#, fuzzy
+#: engines/kyra/lol.cpp:484
msgid "Slide Right"
-msgstr "Rechts"
+msgstr "Nach rechts rutschen"
-#: engines/kyra/lol.cpp:579
-#, fuzzy
+#: engines/kyra/lol.cpp:485
msgid "Turn Left"
-msgstr "Schalt aus"
+msgstr "Nach links drehen"
-#: engines/kyra/lol.cpp:580
-#, fuzzy
+#: engines/kyra/lol.cpp:486
msgid "Turn Right"
-msgstr "Zeiger nach rechts"
+msgstr "Nach rechts drehen"
-#: engines/kyra/lol.cpp:581
-#, fuzzy
+#: engines/kyra/lol.cpp:487
msgid "Rest"
-msgstr "Laden"
+msgstr "Ausruhen"
-#: engines/kyra/lol.cpp:582
-#, fuzzy
+#: engines/kyra/lol.cpp:488
msgid "Options"
-msgstr "~O~ptionen"
+msgstr "Optionen"
-#: engines/kyra/lol.cpp:583
-#, fuzzy
+#: engines/kyra/lol.cpp:489
msgid "Choose Spell"
-msgstr "Auswфhlen"
+msgstr "Zauberspruch auswфhlen"
#: engines/kyra/sound_midi.cpp:475
msgid ""
@@ -2112,17 +2110,17 @@ msgstr ""
"Bitte laden Sie diese Datei (erneut) von\n"
"www.scummvm.org herunter."
-#: engines/sword1/animation.cpp:345 engines/sword2/animation.cpp:379
+#: engines/sword1/animation.cpp:449 engines/sword2/animation.cpp:379
msgid "DXA cutscenes found but ScummVM has been built without zlib support"
msgstr ""
"DXA-Zwischensequenzen gefunden, aber ScummVM wurde ohne Zlib-Unterstќtzung "
"erstellt."
-#: engines/sword1/animation.cpp:355 engines/sword2/animation.cpp:389
+#: engines/sword1/animation.cpp:459 engines/sword2/animation.cpp:389
msgid "MPEG2 cutscenes are no longer supported"
msgstr "MPEG2-Zwischensequenzen werden nicht mehr unterstќtzt."
-#: engines/sword1/animation.cpp:360 engines/sword2/animation.cpp:397
+#: engines/sword1/animation.cpp:464 engines/sword2/animation.cpp:397
#, c-format
msgid "Cutscene '%s' not found"
msgstr "Zwischensequenz \"%s\" gefunden"
@@ -2285,11 +2283,11 @@ msgstr "Apple-II-GS-Emulator (NICHT INTEGRIERT)"
msgid "C64 Audio Emulator"
msgstr "C64-Audio-Emulator"
-#: audio/softsynth/mt32.cpp:329
+#: audio/softsynth/mt32.cpp:293
msgid "Initializing MT-32 Emulator"
msgstr "MT-32-Emulator wird gestartet"
-#: audio/softsynth/mt32.cpp:543
+#: audio/softsynth/mt32.cpp:512
msgid "MT-32 Emulator"
msgstr "MT-32-Emulation"
@@ -2305,15 +2303,20 @@ msgstr "IBM-PCjr-Emulator"
msgid "Keymap:"
msgstr "Tasten-Layout:"
-#: backends/keymapper/remap-dialog.cpp:64
+#: backends/keymapper/remap-dialog.cpp:66
+#, fuzzy
+msgid " (Effective)"
+msgstr " (Aktiv)"
+
+#: backends/keymapper/remap-dialog.cpp:106
msgid " (Active)"
msgstr " (Aktiv)"
-#: backends/keymapper/remap-dialog.cpp:98
+#: backends/keymapper/remap-dialog.cpp:116
msgid " (Global)"
msgstr " (Global)"
-#: backends/keymapper/remap-dialog.cpp:108
+#: backends/keymapper/remap-dialog.cpp:126
msgid " (Game)"
msgstr " (Spiel)"
@@ -2409,26 +2412,50 @@ msgstr "Touchpad-Modus aktiviert."
msgid "Touchpad mode disabled."
msgstr "Touchpad-Modus ausgeschaltet."
-#: backends/platform/sdl/macosx/appmenu_osx.mm:67
+#: backends/platform/maemo/maemo.cpp:178
+msgid "Click Mode"
+msgstr ""
+
+#: backends/platform/maemo/maemo.cpp:184
+#: backends/platform/symbian/src/SymbianActions.cpp:42
+#: backends/platform/wince/CEActionsPocket.cpp:60
+#: backends/platform/wince/CEActionsSmartphone.cpp:43
+#: backends/platform/bada/form.cpp:281
+msgid "Left Click"
+msgstr "Linksklick"
+
+#: backends/platform/maemo/maemo.cpp:187
+#, fuzzy
+msgid "Middle Click"
+msgstr "Mittlerer linker Gegenstand"
+
+#: backends/platform/maemo/maemo.cpp:190
+#: backends/platform/symbian/src/SymbianActions.cpp:43
+#: backends/platform/wince/CEActionsSmartphone.cpp:44
+#: backends/platform/bada/form.cpp:273
+msgid "Right Click"
+msgstr "Rechtsklick"
+
+#: backends/platform/sdl/macosx/appmenu_osx.mm:78
msgid "Hide ScummVM"
-msgstr "ScummVM verbergen"
+msgstr "ScummVM ausblenden"
-#: backends/platform/sdl/macosx/appmenu_osx.mm:70
+#: backends/platform/sdl/macosx/appmenu_osx.mm:83
msgid "Hide Others"
-msgstr "Andere verbergen"
+msgstr "Andere ausblenden"
-#: backends/platform/sdl/macosx/appmenu_osx.mm:74
+#: backends/platform/sdl/macosx/appmenu_osx.mm:88
msgid "Show All"
-msgstr "Alles zeigen"
+msgstr "Alle einblenden"
-#: backends/platform/sdl/macosx/appmenu_osx.mm:92
-#: backends/platform/sdl/macosx/appmenu_osx.mm:99
+#: backends/platform/sdl/macosx/appmenu_osx.mm:110
+#: backends/platform/sdl/macosx/appmenu_osx.mm:121
msgid "Window"
msgstr "Fenster"
-#: backends/platform/sdl/macosx/appmenu_osx.mm:95
+#: backends/platform/sdl/macosx/appmenu_osx.mm:115
msgid "Minimize"
-msgstr "Minimieren"
+msgstr "Im Dock ablegen"
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:45
msgid "Normal (no scaling)"
@@ -2440,12 +2467,12 @@ msgid "Normal (no scaling)"
msgstr "Normal ohn.Skalieren"
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2147
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:537
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:533
msgid "Enabled aspect ratio correction"
msgstr "Seitenverhфltniskorrektur an"
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2153
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:542
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:538
msgid "Disabled aspect ratio correction"
msgstr "Seitenverhфltniskorrektur aus"
@@ -2454,7 +2481,7 @@ msgid "Active graphics filter:"
msgstr "Aktiver Grafikfilter:"
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2250
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:481
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:477
msgid "Windowed mode"
msgstr "Fenstermodus"
@@ -2478,11 +2505,11 @@ msgstr "Aktueller Grafikmodus"
msgid "Current scale"
msgstr "Aktueller Vergrіпerungsfaktor"
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:562
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:558
msgid "Active filter mode: Linear"
msgstr "Aktiver Filtermodus: linear"
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:564
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:560
msgid "Active filter mode: Nearest"
msgstr "Aktiver Filtermodus: nфchste Nachbarn"
@@ -2506,19 +2533,6 @@ msgstr "Links"
msgid "Right"
msgstr "Rechts"
-#: backends/platform/symbian/src/SymbianActions.cpp:42
-#: backends/platform/wince/CEActionsPocket.cpp:60
-#: backends/platform/wince/CEActionsSmartphone.cpp:43
-#: backends/platform/bada/form.cpp:281
-msgid "Left Click"
-msgstr "Linksklick"
-
-#: backends/platform/symbian/src/SymbianActions.cpp:43
-#: backends/platform/wince/CEActionsSmartphone.cpp:44
-#: backends/platform/bada/form.cpp:273
-msgid "Right Click"
-msgstr "Rechtsklick"
-
#: backends/platform/symbian/src/SymbianActions.cpp:46
#: backends/platform/wince/CEActionsSmartphone.cpp:47
msgid "Zone"
@@ -2883,11 +2897,11 @@ msgstr "Ziffernblock zeigen"
msgid "Control Mouse"
msgstr "Maus steuern"
-#: backends/events/maemosdl/maemosdl-events.cpp:129
+#: backends/events/maemosdl/maemosdl-events.cpp:192
msgid "Clicking Enabled"
msgstr "Klicken aktiviert"
-#: backends/events/maemosdl/maemosdl-events.cpp:129
+#: backends/events/maemosdl/maemosdl-events.cpp:192
msgid "Clicking Disabled"
msgstr "Klicken deaktiviert"
diff --git a/po/es_ES.po b/po/es_ES.po
index b4712dd412..64274ceb24 100644
--- a/po/es_ES.po
+++ b/po/es_ES.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ScummVM 1.4.0svn\n"
"Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n"
-"POT-Creation-Date: 2011-12-26 15:26+0100\n"
+"POT-Creation-Date: 2012-02-16 12:32+0200\n"
"PO-Revision-Date: 2011-10-23 21:53+0100\n"
"Last-Translator: Tomсs Maidagan\n"
"Language-Team: \n"
@@ -45,7 +45,7 @@ msgstr "Arriba"
#: gui/browser.cpp:69 gui/chooser.cpp:45 gui/KeysDialog.cpp:43
#: gui/launcher.cpp:319 gui/massadd.cpp:94 gui/options.cpp:1221
#: gui/saveload.cpp:63 gui/saveload.cpp:155 gui/themebrowser.cpp:54
-#: engines/engine.cpp:436 engines/scumm/dialogs.cpp:190
+#: engines/engine.cpp:438 engines/scumm/dialogs.cpp:190
#: engines/sword1/control.cpp:865 engines/parallaction/saveload.cpp:281
#: backends/platform/wii/options.cpp:48
#: backends/events/default/default-events.cpp:222
@@ -57,25 +57,30 @@ msgstr "Cancelar"
msgid "Choose"
msgstr "Aceptar"
-#: gui/gui-manager.cpp:116 engines/scumm/help.cpp:125
+#: gui/gui-manager.cpp:115 engines/scumm/help.cpp:125
#: engines/scumm/help.cpp:140 engines/scumm/help.cpp:165
#: engines/scumm/help.cpp:191 engines/scumm/help.cpp:209
#: backends/keymapper/remap-dialog.cpp:52
msgid "Close"
msgstr "Cerrar"
-#: gui/gui-manager.cpp:119
+#: gui/gui-manager.cpp:118
msgid "Mouse click"
msgstr "Clic de ratѓn"
-#: gui/gui-manager.cpp:122 base/main.cpp:283
+#: gui/gui-manager.cpp:121 base/main.cpp:289
msgid "Display keyboard"
msgstr "Mostrar el teclado"
-#: gui/gui-manager.cpp:125 base/main.cpp:286
+#: gui/gui-manager.cpp:124 base/main.cpp:292
msgid "Remap keys"
msgstr "Asignar teclas"
+#: gui/gui-manager.cpp:127 base/main.cpp:295
+#, fuzzy
+msgid "Toggle FullScreen"
+msgstr "Activar pantalla completa"
+
#: gui/KeysDialog.h:36 gui/KeysDialog.cpp:145
msgid "Choose an action to map"
msgstr "Elige la acciѓn a asociar"
@@ -86,11 +91,11 @@ msgstr "Asignar"
#: gui/KeysDialog.cpp:42 gui/launcher.cpp:320 gui/launcher.cpp:959
#: gui/launcher.cpp:963 gui/massadd.cpp:91 gui/options.cpp:1222
-#: engines/engine.cpp:359 engines/engine.cpp:370 engines/scumm/dialogs.cpp:192
-#: engines/scumm/scumm.cpp:1784 engines/agos/animation.cpp:551
+#: engines/engine.cpp:361 engines/engine.cpp:372 engines/scumm/dialogs.cpp:192
+#: engines/scumm/scumm.cpp:1775 engines/agos/animation.cpp:551
#: engines/groovie/script.cpp:420 engines/sky/compact.cpp:131
-#: engines/sky/compact.cpp:141 engines/sword1/animation.cpp:345
-#: engines/sword1/animation.cpp:355 engines/sword1/animation.cpp:361
+#: engines/sky/compact.cpp:141 engines/sword1/animation.cpp:449
+#: engines/sword1/animation.cpp:459 engines/sword1/animation.cpp:465
#: engines/sword1/control.cpp:865 engines/sword1/logic.cpp:1633
#: engines/sword2/animation.cpp:379 engines/sword2/animation.cpp:389
#: engines/sword2/animation.cpp:398 engines/parallaction/saveload.cpp:281
@@ -345,15 +350,15 @@ msgstr "Esta ID ya estс siendo usada. Por favor, elige otra."
msgid "~Q~uit"
msgstr "~S~alir"
-#: gui/launcher.cpp:578 backends/platform/sdl/macosx/appmenu_osx.mm:80
+#: gui/launcher.cpp:578 backends/platform/sdl/macosx/appmenu_osx.mm:96
msgid "Quit ScummVM"
-msgstr "Cerrar ScummVM"
+msgstr "Salir de ScummVM"
#: gui/launcher.cpp:579
msgid "A~b~out..."
msgstr "Acerca ~d~e"
-#: gui/launcher.cpp:579 backends/platform/sdl/macosx/appmenu_osx.mm:61
+#: gui/launcher.cpp:579 backends/platform/sdl/macosx/appmenu_osx.mm:70
msgid "About ScummVM"
msgstr "Acerca de ScummVM"
@@ -597,7 +602,7 @@ msgstr "Modos especiales de expansiѓn soportados por algunos juegos"
#: gui/options.cpp:761
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2248
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:476
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:472
msgid "Fullscreen mode"
msgstr "Pantalla completa"
@@ -963,28 +968,28 @@ msgstr "Partida sin nombre"
msgid "Select a Theme"
msgstr "Selecciona un tema"
-#: gui/ThemeEngine.cpp:329
+#: gui/ThemeEngine.cpp:333
msgid "Disabled GFX"
msgstr "GFX desactivados"
-#: gui/ThemeEngine.cpp:329
+#: gui/ThemeEngine.cpp:333
msgctxt "lowres"
msgid "Disabled GFX"
msgstr "GFX desactivados"
-#: gui/ThemeEngine.cpp:330
+#: gui/ThemeEngine.cpp:334
msgid "Standard Renderer (16bpp)"
msgstr "Estсndar (16bpp)"
-#: gui/ThemeEngine.cpp:330
+#: gui/ThemeEngine.cpp:334
msgid "Standard (16bpp)"
msgstr "Estсndar (16bpp)"
-#: gui/ThemeEngine.cpp:332
+#: gui/ThemeEngine.cpp:336
msgid "Antialiased Renderer (16bpp)"
msgstr "Suavizado (16bpp)"
-#: gui/ThemeEngine.cpp:332
+#: gui/ThemeEngine.cpp:336
msgid "Antialiased (16bpp)"
msgstr "Suavizado (16bpp)"
@@ -997,30 +1002,30 @@ msgstr "Eliminar valor"
msgid "Engine does not support debug level '%s'"
msgstr "El motor no soporta el nivel de debug '%s'"
-#: base/main.cpp:271
+#: base/main.cpp:277
msgid "Menu"
msgstr "Menњ"
-#: base/main.cpp:274 backends/platform/symbian/src/SymbianActions.cpp:45
+#: base/main.cpp:280 backends/platform/symbian/src/SymbianActions.cpp:45
#: backends/platform/wince/CEActionsPocket.cpp:45
#: backends/platform/wince/CEActionsSmartphone.cpp:46
msgid "Skip"
msgstr "Saltar"
-#: base/main.cpp:277 backends/platform/symbian/src/SymbianActions.cpp:50
+#: base/main.cpp:283 backends/platform/symbian/src/SymbianActions.cpp:50
#: backends/platform/wince/CEActionsPocket.cpp:42
msgid "Pause"
msgstr "Pausar"
-#: base/main.cpp:280
+#: base/main.cpp:286
msgid "Skip line"
msgstr "Saltar frase"
-#: base/main.cpp:439
+#: base/main.cpp:455
msgid "Error running game:"
msgstr "Error al ejecutar el juego:"
-#: base/main.cpp:463
+#: base/main.cpp:479
msgid "Could not find any engine capable of running the selected game"
msgstr "No se ha podido encontrar ningњn motor capaz de ejecutar el juego"
@@ -1192,23 +1197,23 @@ msgstr "~C~ancelar"
msgid "~K~eys"
msgstr "~T~eclas"
-#: engines/engine.cpp:233
+#: engines/engine.cpp:235
msgid "Could not initialize color format."
msgstr "No se ha podido iniciar el formato de color."
-#: engines/engine.cpp:241
+#: engines/engine.cpp:243
msgid "Could not switch to video mode: '"
msgstr "No se ha podido cambiar al modo de video: '"
-#: engines/engine.cpp:250
+#: engines/engine.cpp:252
msgid "Could not apply aspect ratio setting."
msgstr "No se ha podido aplicar el ajuste de correcciѓn de aspecto"
-#: engines/engine.cpp:255
+#: engines/engine.cpp:257
msgid "Could not apply fullscreen setting."
msgstr "No se ha podido aplicar el ajuste de pantalla completa."
-#: engines/engine.cpp:355
+#: engines/engine.cpp:357
msgid ""
"You appear to be playing this game directly\n"
"from the CD. This is known to cause problems,\n"
@@ -1222,7 +1227,7 @@ msgstr ""
"copiar los archivos del juego al disco duro.\n"
"Consulta el archivo README para mсs detalles."
-#: engines/engine.cpp:366
+#: engines/engine.cpp:368
msgid ""
"This game has audio tracks in its disk. These\n"
"tracks need to be ripped from the disk using\n"
@@ -1236,7 +1241,7 @@ msgstr ""
"poder escuchar la mњsica del juego.\n"
"Consulta el archivo README para mсs detalles."
-#: engines/engine.cpp:433
+#: engines/engine.cpp:435
msgid ""
"WARNING: The game you are about to start is not yet fully supported by "
"ScummVM. As such, it is likely to be unstable, and any saves you make might "
@@ -1246,7 +1251,7 @@ msgstr ""
"ScummVM. Por lo tanto, puede que sea inestable, y que las partidas que "
"guardes no funcionen en versiones futuras de ScummVM."
-#: engines/engine.cpp:436
+#: engines/engine.cpp:438
msgid "Start anyway"
msgstr "Jugar de todos modos"
@@ -1898,7 +1903,7 @@ msgstr "Volar a la derecha"
msgid "Fly to lower right"
msgstr "Volar abajo y a la derecha"
-#: engines/scumm/scumm.cpp:1782
+#: engines/scumm/scumm.cpp:1773
#, c-format
msgid ""
"Native MIDI support requires the Roland Upgrade from LucasArts,\n"
@@ -1907,7 +1912,7 @@ msgstr ""
"El soporte MIDI nativo requiere la actualizaciѓn Roland de LucasArts,\n"
"pero %s no estс disponible. Se usarс AdLib."
-#: engines/scumm/scumm.cpp:2272 engines/agos/saveload.cpp:189
+#: engines/scumm/scumm.cpp:2271 engines/agos/saveload.cpp:189
#, c-format
msgid ""
"Failed to save game state to file:\n"
@@ -1918,7 +1923,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2279 engines/agos/saveload.cpp:154
+#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:154
#, c-format
msgid ""
"Failed to load game state from file:\n"
@@ -1929,7 +1934,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2291 engines/agos/saveload.cpp:197
+#: engines/scumm/scumm.cpp:2290 engines/agos/saveload.cpp:197
#, c-format
msgid ""
"Successfully saved game state in file:\n"
@@ -1940,7 +1945,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2506
+#: engines/scumm/scumm.cpp:2505
msgid ""
"Usually, Maniac Mansion would start now. But ScummVM doesn't do that yet. To "
"play it, go to 'Add Game' in the ScummVM start menu and select the 'Maniac' "
@@ -1990,11 +1995,11 @@ msgid "Cutscene file '%s' not found!"
msgstr "No se ha encontrado el vэdeo '%s'"
#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1283
-#: engines/tinsel/saveload.cpp:482
+#: engines/tinsel/saveload.cpp:500
msgid "Failed to load game state from file."
msgstr "Fallo al cargar el estado del juego desde el archivo."
-#: engines/gob/inter_v2.cpp:1353 engines/tinsel/saveload.cpp:495
+#: engines/gob/inter_v2.cpp:1353 engines/tinsel/saveload.cpp:513
msgid "Failed to save game state to file."
msgstr "Fallo al guardar el estado del juego en el archivo."
@@ -2006,56 +2011,56 @@ msgstr "Fallo al borrar el archivo."
msgid "Failed to save game"
msgstr "Fallo al guardar la partida"
-#: engines/kyra/lol.cpp:572
+#: engines/kyra/lol.cpp:478
msgid "Attack 1"
msgstr ""
-#: engines/kyra/lol.cpp:573
+#: engines/kyra/lol.cpp:479
msgid "Attack 2"
msgstr ""
-#: engines/kyra/lol.cpp:574
+#: engines/kyra/lol.cpp:480
msgid "Attack 3"
msgstr ""
-#: engines/kyra/lol.cpp:575
+#: engines/kyra/lol.cpp:481
msgid "Move Forward"
msgstr ""
-#: engines/kyra/lol.cpp:576
+#: engines/kyra/lol.cpp:482
msgid "Move Back"
msgstr ""
-#: engines/kyra/lol.cpp:577
+#: engines/kyra/lol.cpp:483
msgid "Slide Left"
msgstr ""
-#: engines/kyra/lol.cpp:578
+#: engines/kyra/lol.cpp:484
#, fuzzy
msgid "Slide Right"
msgstr "Derecha"
-#: engines/kyra/lol.cpp:579
+#: engines/kyra/lol.cpp:485
#, fuzzy
msgid "Turn Left"
msgstr "Apagar"
-#: engines/kyra/lol.cpp:580
+#: engines/kyra/lol.cpp:486
#, fuzzy
msgid "Turn Right"
msgstr "Derecha"
-#: engines/kyra/lol.cpp:581
+#: engines/kyra/lol.cpp:487
#, fuzzy
msgid "Rest"
msgstr "Cargar"
-#: engines/kyra/lol.cpp:582
+#: engines/kyra/lol.cpp:488
#, fuzzy
msgid "Options"
msgstr "~O~pciones"
-#: engines/kyra/lol.cpp:583
+#: engines/kyra/lol.cpp:489
#, fuzzy
msgid "Choose Spell"
msgstr "Aceptar"
@@ -2090,16 +2095,16 @@ msgstr ""
"El archivo \"sky.cpt\" tiene un tamaёo incorrecto.\n"
"Por favor, vuelve a bajarlo de www.scummvm.org"
-#: engines/sword1/animation.cpp:345 engines/sword2/animation.cpp:379
+#: engines/sword1/animation.cpp:449 engines/sword2/animation.cpp:379
msgid "DXA cutscenes found but ScummVM has been built without zlib support"
msgstr ""
"Se han encontrado vэdeos DXA, pero se ha compilado ScummVM sin soporte zlib"
-#: engines/sword1/animation.cpp:355 engines/sword2/animation.cpp:389
+#: engines/sword1/animation.cpp:459 engines/sword2/animation.cpp:389
msgid "MPEG2 cutscenes are no longer supported"
msgstr "Los vэdeos MPEG2 ya no son compatibles"
-#: engines/sword1/animation.cpp:360 engines/sword2/animation.cpp:397
+#: engines/sword1/animation.cpp:464 engines/sword2/animation.cpp:397
#, c-format
msgid "Cutscene '%s' not found"
msgstr "No se ha encontrado el vэdeo '%s'"
@@ -2262,11 +2267,11 @@ msgstr "Emulador de Apple II GS (NO IMPLEMENTADO)"
msgid "C64 Audio Emulator"
msgstr "Emulador de C64 Audio"
-#: audio/softsynth/mt32.cpp:329
+#: audio/softsynth/mt32.cpp:293
msgid "Initializing MT-32 Emulator"
msgstr "Iniciando el emulador de MT-32"
-#: audio/softsynth/mt32.cpp:543
+#: audio/softsynth/mt32.cpp:512
msgid "MT-32 Emulator"
msgstr "Emulador de MT-32"
@@ -2282,15 +2287,20 @@ msgstr "Emulador de IBM PCjr"
msgid "Keymap:"
msgstr "Asignaciѓn de teclas:"
-#: backends/keymapper/remap-dialog.cpp:64
+#: backends/keymapper/remap-dialog.cpp:66
+#, fuzzy
+msgid " (Effective)"
+msgstr "(Activa)"
+
+#: backends/keymapper/remap-dialog.cpp:106
msgid " (Active)"
msgstr "(Activa)"
-#: backends/keymapper/remap-dialog.cpp:98
+#: backends/keymapper/remap-dialog.cpp:116
msgid " (Global)"
msgstr "(General)"
-#: backends/keymapper/remap-dialog.cpp:108
+#: backends/keymapper/remap-dialog.cpp:126
msgid " (Game)"
msgstr "(Juego)"
@@ -2386,24 +2396,48 @@ msgstr "Modo Touchpad activado."
msgid "Touchpad mode disabled."
msgstr "Modo Touchpad desactivado."
-#: backends/platform/sdl/macosx/appmenu_osx.mm:67
+#: backends/platform/maemo/maemo.cpp:178
+msgid "Click Mode"
+msgstr ""
+
+#: backends/platform/maemo/maemo.cpp:184
+#: backends/platform/symbian/src/SymbianActions.cpp:42
+#: backends/platform/wince/CEActionsPocket.cpp:60
+#: backends/platform/wince/CEActionsSmartphone.cpp:43
+#: backends/platform/bada/form.cpp:281
+msgid "Left Click"
+msgstr "Clic izquierdo"
+
+#: backends/platform/maemo/maemo.cpp:187
+#, fuzzy
+msgid "Middle Click"
+msgstr "Objeto izquierdo del medio"
+
+#: backends/platform/maemo/maemo.cpp:190
+#: backends/platform/symbian/src/SymbianActions.cpp:43
+#: backends/platform/wince/CEActionsSmartphone.cpp:44
+#: backends/platform/bada/form.cpp:273
+msgid "Right Click"
+msgstr "Clic derecho"
+
+#: backends/platform/sdl/macosx/appmenu_osx.mm:78
msgid "Hide ScummVM"
-msgstr "Oculta ScummVM"
+msgstr "Ocultar ScummVM"
-#: backends/platform/sdl/macosx/appmenu_osx.mm:70
+#: backends/platform/sdl/macosx/appmenu_osx.mm:83
msgid "Hide Others"
msgstr "Ocultar otros"
-#: backends/platform/sdl/macosx/appmenu_osx.mm:74
+#: backends/platform/sdl/macosx/appmenu_osx.mm:88
msgid "Show All"
msgstr "Mostrar todo"
-#: backends/platform/sdl/macosx/appmenu_osx.mm:92
-#: backends/platform/sdl/macosx/appmenu_osx.mm:99
+#: backends/platform/sdl/macosx/appmenu_osx.mm:110
+#: backends/platform/sdl/macosx/appmenu_osx.mm:121
msgid "Window"
msgstr "Ventana"
-#: backends/platform/sdl/macosx/appmenu_osx.mm:95
+#: backends/platform/sdl/macosx/appmenu_osx.mm:115
msgid "Minimize"
msgstr "Minimizar"
@@ -2417,12 +2451,12 @@ msgid "Normal (no scaling)"
msgstr "Normal"
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2147
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:537
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:533
msgid "Enabled aspect ratio correction"
msgstr "Activar la correcciѓn de aspecto"
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2153
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:542
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:538
msgid "Disabled aspect ratio correction"
msgstr "Desactivar la correcciѓn de aspecto"
@@ -2431,7 +2465,7 @@ msgid "Active graphics filter:"
msgstr "Filtro de grсficos activo:"
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2250
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:481
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:477
msgid "Windowed mode"
msgstr "Modo ventana"
@@ -2455,11 +2489,11 @@ msgstr "Modo de vэdeo actual"
msgid "Current scale"
msgstr "Escala actual"
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:562
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:558
msgid "Active filter mode: Linear"
msgstr "Modo de filtro activo: lineal"
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:564
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:560
msgid "Active filter mode: Nearest"
msgstr "Modo de filtro activo: el mсs cercano"
@@ -2483,19 +2517,6 @@ msgstr "Izquierda"
msgid "Right"
msgstr "Derecha"
-#: backends/platform/symbian/src/SymbianActions.cpp:42
-#: backends/platform/wince/CEActionsPocket.cpp:60
-#: backends/platform/wince/CEActionsSmartphone.cpp:43
-#: backends/platform/bada/form.cpp:281
-msgid "Left Click"
-msgstr "Clic izquierdo"
-
-#: backends/platform/symbian/src/SymbianActions.cpp:43
-#: backends/platform/wince/CEActionsSmartphone.cpp:44
-#: backends/platform/bada/form.cpp:273
-msgid "Right Click"
-msgstr "Clic derecho"
-
#: backends/platform/symbian/src/SymbianActions.cpp:46
#: backends/platform/wince/CEActionsSmartphone.cpp:47
msgid "Zone"
@@ -2859,11 +2880,11 @@ msgstr "Mostrar el teclado numщrico"
msgid "Control Mouse"
msgstr "Control del ratѓn"
-#: backends/events/maemosdl/maemosdl-events.cpp:129
+#: backends/events/maemosdl/maemosdl-events.cpp:192
msgid "Clicking Enabled"
msgstr "Clic activado"
-#: backends/events/maemosdl/maemosdl-events.cpp:129
+#: backends/events/maemosdl/maemosdl-events.cpp:192
msgid "Clicking Disabled"
msgstr "Clic desactivado"
diff --git a/po/fr_FR.po b/po/fr_FR.po
index c952fb3a35..2523293efe 100644
--- a/po/fr_FR.po
+++ b/po/fr_FR.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ScummVM 1.3.0svn\n"
"Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n"
-"POT-Creation-Date: 2011-12-26 15:26+0100\n"
+"POT-Creation-Date: 2012-02-16 12:32+0200\n"
"PO-Revision-Date: 2011-10-23 14:52+0100\n"
"Last-Translator: Thierry Crozat <criezy@scummvm.org>\n"
"Language-Team: French <scummvm-devel@lists.sf.net>\n"
@@ -46,7 +46,7 @@ msgstr "Remonter"
#: gui/browser.cpp:69 gui/chooser.cpp:45 gui/KeysDialog.cpp:43
#: gui/launcher.cpp:319 gui/massadd.cpp:94 gui/options.cpp:1221
#: gui/saveload.cpp:63 gui/saveload.cpp:155 gui/themebrowser.cpp:54
-#: engines/engine.cpp:436 engines/scumm/dialogs.cpp:190
+#: engines/engine.cpp:438 engines/scumm/dialogs.cpp:190
#: engines/sword1/control.cpp:865 engines/parallaction/saveload.cpp:281
#: backends/platform/wii/options.cpp:48
#: backends/events/default/default-events.cpp:222
@@ -58,25 +58,29 @@ msgstr "Annuler"
msgid "Choose"
msgstr "Choisir"
-#: gui/gui-manager.cpp:116 engines/scumm/help.cpp:125
+#: gui/gui-manager.cpp:115 engines/scumm/help.cpp:125
#: engines/scumm/help.cpp:140 engines/scumm/help.cpp:165
#: engines/scumm/help.cpp:191 engines/scumm/help.cpp:209
#: backends/keymapper/remap-dialog.cpp:52
msgid "Close"
msgstr "Fermer"
-#: gui/gui-manager.cpp:119
+#: gui/gui-manager.cpp:118
msgid "Mouse click"
msgstr "Clic de souris"
-#: gui/gui-manager.cpp:122 base/main.cpp:283
+#: gui/gui-manager.cpp:121 base/main.cpp:289
msgid "Display keyboard"
msgstr "Afficher le clavier"
-#: gui/gui-manager.cpp:125 base/main.cpp:286
+#: gui/gui-manager.cpp:124 base/main.cpp:292
msgid "Remap keys"
msgstr "Changer l'affectation des touches"
+#: gui/gui-manager.cpp:127 base/main.cpp:295
+msgid "Toggle FullScreen"
+msgstr "Basculer en plein щcran"
+
#: gui/KeysDialog.h:36 gui/KeysDialog.cpp:145
msgid "Choose an action to map"
msgstr "Sщlectionnez une action р affecter"
@@ -87,11 +91,11 @@ msgstr "Affecter"
#: gui/KeysDialog.cpp:42 gui/launcher.cpp:320 gui/launcher.cpp:959
#: gui/launcher.cpp:963 gui/massadd.cpp:91 gui/options.cpp:1222
-#: engines/engine.cpp:359 engines/engine.cpp:370 engines/scumm/dialogs.cpp:192
-#: engines/scumm/scumm.cpp:1784 engines/agos/animation.cpp:551
+#: engines/engine.cpp:361 engines/engine.cpp:372 engines/scumm/dialogs.cpp:192
+#: engines/scumm/scumm.cpp:1775 engines/agos/animation.cpp:551
#: engines/groovie/script.cpp:420 engines/sky/compact.cpp:131
-#: engines/sky/compact.cpp:141 engines/sword1/animation.cpp:345
-#: engines/sword1/animation.cpp:355 engines/sword1/animation.cpp:361
+#: engines/sky/compact.cpp:141 engines/sword1/animation.cpp:449
+#: engines/sword1/animation.cpp:459 engines/sword1/animation.cpp:465
#: engines/sword1/control.cpp:865 engines/sword1/logic.cpp:1633
#: engines/sword2/animation.cpp:379 engines/sword2/animation.cpp:389
#: engines/sword2/animation.cpp:398 engines/parallaction/saveload.cpp:281
@@ -346,7 +350,7 @@ msgstr "Cet ID est dщjр utilisщ par un autre jeu. Choisissez en un autre svp."
msgid "~Q~uit"
msgstr "~Q~uitter"
-#: gui/launcher.cpp:578 backends/platform/sdl/macosx/appmenu_osx.mm:80
+#: gui/launcher.cpp:578 backends/platform/sdl/macosx/appmenu_osx.mm:96
msgid "Quit ScummVM"
msgstr "Quitter ScummVM"
@@ -354,7 +358,7 @@ msgstr "Quitter ScummVM"
msgid "A~b~out..."
msgstr "Р ~P~ropos..."
-#: gui/launcher.cpp:579 backends/platform/sdl/macosx/appmenu_osx.mm:61
+#: gui/launcher.cpp:579 backends/platform/sdl/macosx/appmenu_osx.mm:70
msgid "About ScummVM"
msgstr "Р propos de ScummVM"
@@ -600,7 +604,7 @@ msgstr "Mode spщcial de tramage supportщ par certains jeux"
#: gui/options.cpp:761
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2248
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:476
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:472
msgid "Fullscreen mode"
msgstr "Plein щcran"
@@ -969,28 +973,28 @@ msgstr "Sauvegarde sans nom"
msgid "Select a Theme"
msgstr "Sщlectionnez un Thшme"
-#: gui/ThemeEngine.cpp:329
+#: gui/ThemeEngine.cpp:333
msgid "Disabled GFX"
msgstr "GFX dщsactivщ"
-#: gui/ThemeEngine.cpp:329
+#: gui/ThemeEngine.cpp:333
msgctxt "lowres"
msgid "Disabled GFX"
msgstr "GFX dщsactivщ"
-#: gui/ThemeEngine.cpp:330
+#: gui/ThemeEngine.cpp:334
msgid "Standard Renderer (16bpp)"
msgstr "Rendu Standard (16bpp)"
-#: gui/ThemeEngine.cpp:330
+#: gui/ThemeEngine.cpp:334
msgid "Standard (16bpp)"
msgstr "Standard (16bpp)"
-#: gui/ThemeEngine.cpp:332
+#: gui/ThemeEngine.cpp:336
msgid "Antialiased Renderer (16bpp)"
msgstr "Rendu Anti-crщnelщ (16 bpp)"
-#: gui/ThemeEngine.cpp:332
+#: gui/ThemeEngine.cpp:336
msgid "Antialiased (16bpp)"
msgstr "Anti-crщnelщ (16 bpp)"
@@ -1003,30 +1007,30 @@ msgstr "Effacer la valeur"
msgid "Engine does not support debug level '%s'"
msgstr "Le niveau de debug '%s' n'est pas supportщ par ce moteur de jeu"
-#: base/main.cpp:271
+#: base/main.cpp:277
msgid "Menu"
msgstr "Menu"
-#: base/main.cpp:274 backends/platform/symbian/src/SymbianActions.cpp:45
+#: base/main.cpp:280 backends/platform/symbian/src/SymbianActions.cpp:45
#: backends/platform/wince/CEActionsPocket.cpp:45
#: backends/platform/wince/CEActionsSmartphone.cpp:46
msgid "Skip"
msgstr "Passer"
-#: base/main.cpp:277 backends/platform/symbian/src/SymbianActions.cpp:50
+#: base/main.cpp:283 backends/platform/symbian/src/SymbianActions.cpp:50
#: backends/platform/wince/CEActionsPocket.cpp:42
msgid "Pause"
msgstr "Mettre en pause"
-#: base/main.cpp:280
+#: base/main.cpp:286
msgid "Skip line"
msgstr "Passer la phrase"
-#: base/main.cpp:439
+#: base/main.cpp:455
msgid "Error running game:"
msgstr "Erreur lors de l'щxщcution du jeu:"
-#: base/main.cpp:463
+#: base/main.cpp:479
msgid "Could not find any engine capable of running the selected game"
msgstr "Impossible de trouver un moteur pour exщcuter le jeu sщlectionnщ"
@@ -1200,23 +1204,23 @@ msgstr "~A~nnuler"
msgid "~K~eys"
msgstr "~T~ouches"
-#: engines/engine.cpp:233
+#: engines/engine.cpp:235
msgid "Could not initialize color format."
msgstr "Impossible d'initialiser le format des couleurs."
-#: engines/engine.cpp:241
+#: engines/engine.cpp:243
msgid "Could not switch to video mode: '"
msgstr "Impossible de changer le mode vidщo р: '"
-#: engines/engine.cpp:250
+#: engines/engine.cpp:252
msgid "Could not apply aspect ratio setting."
msgstr "Impossible d'appliquer la correction du rapport d'aspect."
-#: engines/engine.cpp:255
+#: engines/engine.cpp:257
msgid "Could not apply fullscreen setting."
msgstr "Impossible d'appliquer l'option plein щcran."
-#: engines/engine.cpp:355
+#: engines/engine.cpp:357
msgid ""
"You appear to be playing this game directly\n"
"from the CD. This is known to cause problems,\n"
@@ -1230,7 +1234,7 @@ msgstr ""
"donnщes du jeu sur votre disque dur.\n"
"Lisez le fichier README pour plus de dщtails."
-#: engines/engine.cpp:366
+#: engines/engine.cpp:368
msgid ""
"This game has audio tracks in its disk. These\n"
"tracks need to be ripped from the disk using\n"
@@ -1244,7 +1248,7 @@ msgstr ""
"logiciel appropriщ.\n"
"Lisez le fichier README pour plus de dщtails."
-#: engines/engine.cpp:433
+#: engines/engine.cpp:435
msgid ""
"WARNING: The game you are about to start is not yet fully supported by "
"ScummVM. As such, it is likely to be unstable, and any saves you make might "
@@ -1254,7 +1258,7 @@ msgstr ""
"complшtement supportщ par ScummVM. Il est donc instable et les sauvegardes "
"peuvent ne pas marcher avec une future version de ScummVM."
-#: engines/engine.cpp:436
+#: engines/engine.cpp:438
msgid "Start anyway"
msgstr "Jouer quand mъme"
@@ -1381,9 +1385,8 @@ msgid "Refer to your Loom(TM) manual for help."
msgstr ""
#: engines/scumm/dialogs.cpp:658
-#, fuzzy
msgid "Standard"
-msgstr "Standard (16bpp)"
+msgstr "Standard"
#: engines/scumm/dialogs.cpp:659
msgid "Practice"
@@ -1906,7 +1909,7 @@ msgstr "Voler vers la droite"
msgid "Fly to lower right"
msgstr "Voler vers la bas р droite"
-#: engines/scumm/scumm.cpp:1782
+#: engines/scumm/scumm.cpp:1773
#, c-format
msgid ""
"Native MIDI support requires the Roland Upgrade from LucasArts,\n"
@@ -1915,7 +1918,7 @@ msgstr ""
"Support MIDI natif requiшre la mise р jour Roland de LucasArt,\n"
"mais %s manque. Utilise AdLib р la place."
-#: engines/scumm/scumm.cpp:2272 engines/agos/saveload.cpp:189
+#: engines/scumm/scumm.cpp:2271 engines/agos/saveload.cpp:189
#, c-format
msgid ""
"Failed to save game state to file:\n"
@@ -1926,7 +1929,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2279 engines/agos/saveload.cpp:154
+#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:154
#, c-format
msgid ""
"Failed to load game state from file:\n"
@@ -1937,7 +1940,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2291 engines/agos/saveload.cpp:197
+#: engines/scumm/scumm.cpp:2290 engines/agos/saveload.cpp:197
#, c-format
msgid ""
"Successfully saved game state in file:\n"
@@ -1948,7 +1951,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2506
+#: engines/scumm/scumm.cpp:2505
msgid ""
"Usually, Maniac Mansion would start now. But ScummVM doesn't do that yet. To "
"play it, go to 'Add Game' in the ScummVM start menu and select the 'Maniac' "
@@ -1999,11 +2002,11 @@ msgid "Cutscene file '%s' not found!"
msgstr "Fichier de sщquence '%s' non trouvщ!"
#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1283
-#: engines/tinsel/saveload.cpp:482
+#: engines/tinsel/saveload.cpp:500
msgid "Failed to load game state from file."
msgstr "Щchec du chargement de l'щtat du jeu depuis le disque."
-#: engines/gob/inter_v2.cpp:1353 engines/tinsel/saveload.cpp:495
+#: engines/gob/inter_v2.cpp:1353 engines/tinsel/saveload.cpp:513
msgid "Failed to save game state to file."
msgstr "Щchec de l'enregistrement de l'щtat du jeu sur le disque."
@@ -2015,59 +2018,51 @@ msgstr "Щchec de la suppression du fichier."
msgid "Failed to save game"
msgstr "Щchec de la sauvegarde."
-#: engines/kyra/lol.cpp:572
+#: engines/kyra/lol.cpp:478
msgid "Attack 1"
-msgstr ""
+msgstr "Attaque 1"
-#: engines/kyra/lol.cpp:573
+#: engines/kyra/lol.cpp:479
msgid "Attack 2"
-msgstr ""
+msgstr "Attaque 2"
-#: engines/kyra/lol.cpp:574
+#: engines/kyra/lol.cpp:480
msgid "Attack 3"
-msgstr ""
+msgstr "Attaque 3"
-#: engines/kyra/lol.cpp:575
+#: engines/kyra/lol.cpp:481
msgid "Move Forward"
-msgstr ""
+msgstr "Avancer"
-#: engines/kyra/lol.cpp:576
+#: engines/kyra/lol.cpp:482
msgid "Move Back"
-msgstr ""
+msgstr "Reculer"
-#: engines/kyra/lol.cpp:577
-msgid "Slide Left"
-msgstr ""
+#: engines/kyra/lol.cpp:483
+msgstr "Faire un pas vers la Gauche"
-#: engines/kyra/lol.cpp:578
-#, fuzzy
-msgid "Slide Right"
-msgstr "Droite"
+#: engines/kyra/lol.cpp:484
+msgstr "Faire un pas vers la Droite"
-#: engines/kyra/lol.cpp:579
-#, fuzzy
+#: engines/kyra/lol.cpp:485
msgid "Turn Left"
-msgstr "Щteindre"
+msgstr "Tourner vers la Gauche"
-#: engines/kyra/lol.cpp:580
-#, fuzzy
+#: engines/kyra/lol.cpp:486
msgid "Turn Right"
-msgstr "Droit"
+msgstr "Tourner vers la Droite"
-#: engines/kyra/lol.cpp:581
-#, fuzzy
+#: engines/kyra/lol.cpp:487
msgid "Rest"
-msgstr "Charger"
+msgstr "Se Reposer"
-#: engines/kyra/lol.cpp:582
-#, fuzzy
+#: engines/kyra/lol.cpp:488
msgid "Options"
-msgstr "~O~ptions"
+msgstr "Options"
-#: engines/kyra/lol.cpp:583
-#, fuzzy
+#: engines/kyra/lol.cpp:489
msgid "Choose Spell"
-msgstr "Choisir"
+msgstr "Choisir un Sort"
#: engines/kyra/sound_midi.cpp:475
msgid ""
@@ -2099,17 +2094,17 @@ msgstr ""
"Le fichier \"sky.cpt\" a une taille incorrecte.\n"
"Vous pouvez le (re)tщlщcharger sur www.scummvm.org"
-#: engines/sword1/animation.cpp:345 engines/sword2/animation.cpp:379
+#: engines/sword1/animation.cpp:449 engines/sword2/animation.cpp:379
msgid "DXA cutscenes found but ScummVM has been built without zlib support"
msgstr ""
"Les sщquences DXA sont prщsente mais ScummVM a щtщ compilщ sans le support "
"zlib."
-#: engines/sword1/animation.cpp:355 engines/sword2/animation.cpp:389
+#: engines/sword1/animation.cpp:459 engines/sword2/animation.cpp:389
msgid "MPEG2 cutscenes are no longer supported"
msgstr "Les sщquences MPEG2 ne sont plus supportщes"
-#: engines/sword1/animation.cpp:360 engines/sword2/animation.cpp:397
+#: engines/sword1/animation.cpp:464 engines/sword2/animation.cpp:397
#, c-format
msgid "Cutscene '%s' not found"
msgstr "Sщquence '%s' non trouvщ"
@@ -2270,11 +2265,11 @@ msgstr "Щmulateur Apple II GS (PAS IMPLЩMENTЩ)"
msgid "C64 Audio Emulator"
msgstr "Щmulateur C64 Audio"
-#: audio/softsynth/mt32.cpp:329
+#: audio/softsynth/mt32.cpp:293
msgid "Initializing MT-32 Emulator"
msgstr "Initialisation de l'Щmulateur MT-32"
-#: audio/softsynth/mt32.cpp:543
+#: audio/softsynth/mt32.cpp:512
msgid "MT-32 Emulator"
msgstr "Щmulateur MT-32"
@@ -2290,15 +2285,20 @@ msgstr "Щmulateur IBM PCjr"
msgid "Keymap:"
msgstr "Affectation des touches:"
-#: backends/keymapper/remap-dialog.cpp:64
+#: backends/keymapper/remap-dialog.cpp:66
+#, fuzzy
+msgid " (Effective)"
+msgstr "(Actif)"
+
+#: backends/keymapper/remap-dialog.cpp:106
msgid " (Active)"
msgstr "(Actif)"
-#: backends/keymapper/remap-dialog.cpp:98
+#: backends/keymapper/remap-dialog.cpp:116
msgid " (Global)"
msgstr "(Global)"
-#: backends/keymapper/remap-dialog.cpp:108
+#: backends/keymapper/remap-dialog.cpp:126
msgid " (Game)"
msgstr "(Jeu)"
@@ -2394,26 +2394,49 @@ msgstr "Mode touchpad activщ"
msgid "Touchpad mode disabled."
msgstr "Mode touchpad dщsactivщ"
-#: backends/platform/sdl/macosx/appmenu_osx.mm:67
+#: backends/platform/maemo/maemo.cpp:178
+msgid "Click Mode"
+msgstr "Mode Clic"
+
+#: backends/platform/maemo/maemo.cpp:184
+#: backends/platform/symbian/src/SymbianActions.cpp:42
+#: backends/platform/wince/CEActionsPocket.cpp:60
+#: backends/platform/wince/CEActionsSmartphone.cpp:43
+#: backends/platform/bada/form.cpp:281
+msgid "Left Click"
+msgstr "Clic Gauche"
+
+#: backends/platform/maemo/maemo.cpp:187
+msgid "Middle Click"
+msgstr "Clic Milieu"
+
+#: backends/platform/maemo/maemo.cpp:190
+#: backends/platform/symbian/src/SymbianActions.cpp:43
+#: backends/platform/wince/CEActionsSmartphone.cpp:44
+#: backends/platform/bada/form.cpp:273
+msgid "Right Click"
+msgstr "Clic Droit"
+
+#: backends/platform/sdl/macosx/appmenu_osx.mm:78
msgid "Hide ScummVM"
-msgstr "Cacher ScummVM"
+msgstr "Masquer ScummVM"
-#: backends/platform/sdl/macosx/appmenu_osx.mm:70
+#: backends/platform/sdl/macosx/appmenu_osx.mm:83
msgid "Hide Others"
-msgstr "Masquer les Autres"
+msgstr "Masquer les autres"
-#: backends/platform/sdl/macosx/appmenu_osx.mm:74
+#: backends/platform/sdl/macosx/appmenu_osx.mm:88
msgid "Show All"
-msgstr "Tout Afficher"
+msgstr "Tout afficher"
-#: backends/platform/sdl/macosx/appmenu_osx.mm:92
-#: backends/platform/sdl/macosx/appmenu_osx.mm:99
+#: backends/platform/sdl/macosx/appmenu_osx.mm:110
+#: backends/platform/sdl/macosx/appmenu_osx.mm:121
msgid "Window"
msgstr "Fenъtre"
-#: backends/platform/sdl/macosx/appmenu_osx.mm:95
+#: backends/platform/sdl/macosx/appmenu_osx.mm:115
msgid "Minimize"
-msgstr "Minimiser"
+msgstr "Placer dans le Dock"
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:45
msgid "Normal (no scaling)"
@@ -2425,12 +2448,12 @@ msgid "Normal (no scaling)"
msgstr "Normal"
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2147
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:537
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:533
msgid "Enabled aspect ratio correction"
msgstr "Activer la correction du rapport d'aspect"
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2153
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:542
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:538
msgid "Disabled aspect ratio correction"
msgstr "Dщsactiver la correction du rapport d'aspect"
@@ -2439,7 +2462,7 @@ msgid "Active graphics filter:"
msgstr "Mode graphique actif:"
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2250
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:481
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:477
msgid "Windowed mode"
msgstr "Mode Fenъtre"
@@ -2463,11 +2486,11 @@ msgstr "Mode vidщo actuel"
msgid "Current scale"
msgstr "Щchelle actuelle"
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:562
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:558
msgid "Active filter mode: Linear"
msgstr "Filtre actif: Linщaire"
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:564
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:560
msgid "Active filter mode: Nearest"
msgstr "Filtre actif: Plus proche"
@@ -2491,19 +2514,6 @@ msgstr "Gauche"
msgid "Right"
msgstr "Droite"
-#: backends/platform/symbian/src/SymbianActions.cpp:42
-#: backends/platform/wince/CEActionsPocket.cpp:60
-#: backends/platform/wince/CEActionsSmartphone.cpp:43
-#: backends/platform/bada/form.cpp:281
-msgid "Left Click"
-msgstr "Clic Gauche"
-
-#: backends/platform/symbian/src/SymbianActions.cpp:43
-#: backends/platform/wince/CEActionsSmartphone.cpp:44
-#: backends/platform/bada/form.cpp:273
-msgid "Right Click"
-msgstr "Clic Droit"
-
#: backends/platform/symbian/src/SymbianActions.cpp:46
#: backends/platform/wince/CEActionsSmartphone.cpp:47
msgid "Zone"
@@ -2868,11 +2878,11 @@ msgstr "Afficher le clavier"
msgid "Control Mouse"
msgstr "Contrєles la Souris"
-#: backends/events/maemosdl/maemosdl-events.cpp:129
+#: backends/events/maemosdl/maemosdl-events.cpp:192
msgid "Clicking Enabled"
msgstr "Clic Activщ"
-#: backends/events/maemosdl/maemosdl-events.cpp:129
+#: backends/events/maemosdl/maemosdl-events.cpp:192
msgid "Clicking Disabled"
msgstr "Clic Dщsactivщ"
diff --git a/po/hu_HU.po b/po/hu_HU.po
index b9549a3969..b4802eacba 100644
--- a/po/hu_HU.po
+++ b/po/hu_HU.po
@@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: ScummVM 1.3.0svn\n"
"Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n"
-"POT-Creation-Date: 2011-12-26 15:26+0100\n"
-"PO-Revision-Date: 2011-12-31 08:50+0100\n"
+"POT-Creation-Date: 2012-02-16 12:32+0200\n"
+"PO-Revision-Date: 2012-02-17 07:10+0100\n"
"Last-Translator: Gruby <grubycza@hotmail.com>\n"
"Language-Team: Hungarian\n"
"MIME-Version: 1.0\n"
@@ -49,7 +49,7 @@ msgstr "Feljebb"
#: gui/browser.cpp:69 gui/chooser.cpp:45 gui/KeysDialog.cpp:43
#: gui/launcher.cpp:319 gui/massadd.cpp:94 gui/options.cpp:1221
#: gui/saveload.cpp:63 gui/saveload.cpp:155 gui/themebrowser.cpp:54
-#: engines/engine.cpp:436 engines/scumm/dialogs.cpp:190
+#: engines/engine.cpp:438 engines/scumm/dialogs.cpp:190
#: engines/sword1/control.cpp:865 engines/parallaction/saveload.cpp:281
#: backends/platform/wii/options.cpp:48
#: backends/events/default/default-events.cpp:222
@@ -61,25 +61,29 @@ msgstr "Mщgse"
msgid "Choose"
msgstr "Vсlaszt"
-#: gui/gui-manager.cpp:116 engines/scumm/help.cpp:125
+#: gui/gui-manager.cpp:115 engines/scumm/help.cpp:125
#: engines/scumm/help.cpp:140 engines/scumm/help.cpp:165
#: engines/scumm/help.cpp:191 engines/scumm/help.cpp:209
#: backends/keymapper/remap-dialog.cpp:52
msgid "Close"
msgstr "Bezсr"
-#: gui/gui-manager.cpp:119
+#: gui/gui-manager.cpp:118
msgid "Mouse click"
msgstr "Egщrkattintсs"
-#: gui/gui-manager.cpp:122 base/main.cpp:283
+#: gui/gui-manager.cpp:121 base/main.cpp:289
msgid "Display keyboard"
msgstr "Billentyћzet beсllэtсsok"
-#: gui/gui-manager.cpp:125 base/main.cpp:286
+#: gui/gui-manager.cpp:124 base/main.cpp:292
msgid "Remap keys"
msgstr "Billentyћk сtсllэtсsa"
+#: gui/gui-manager.cpp:127 base/main.cpp:295
+msgid "Toggle FullScreen"
+msgstr "Teljeskщpernyѕ kapcsolѓ"
+
#: gui/KeysDialog.h:36 gui/KeysDialog.cpp:145
msgid "Choose an action to map"
msgstr "Vсlassz mћveletet a kiosztсshoz"
@@ -90,11 +94,11 @@ msgstr "Kiosztсs"
#: gui/KeysDialog.cpp:42 gui/launcher.cpp:320 gui/launcher.cpp:959
#: gui/launcher.cpp:963 gui/massadd.cpp:91 gui/options.cpp:1222
-#: engines/engine.cpp:359 engines/engine.cpp:370 engines/scumm/dialogs.cpp:192
-#: engines/scumm/scumm.cpp:1784 engines/agos/animation.cpp:551
+#: engines/engine.cpp:361 engines/engine.cpp:372 engines/scumm/dialogs.cpp:192
+#: engines/scumm/scumm.cpp:1775 engines/agos/animation.cpp:551
#: engines/groovie/script.cpp:420 engines/sky/compact.cpp:131
-#: engines/sky/compact.cpp:141 engines/sword1/animation.cpp:345
-#: engines/sword1/animation.cpp:355 engines/sword1/animation.cpp:361
+#: engines/sky/compact.cpp:141 engines/sword1/animation.cpp:449
+#: engines/sword1/animation.cpp:459 engines/sword1/animation.cpp:465
#: engines/sword1/control.cpp:865 engines/sword1/logic.cpp:1633
#: engines/sword2/animation.cpp:379 engines/sword2/animation.cpp:389
#: engines/sword2/animation.cpp:398 engines/parallaction/saveload.cpp:281
@@ -347,7 +351,7 @@ msgstr "Ez a jсtщkazonosэtѓ ID mсr foglalt, Vсlassz egy mсsikat."
msgid "~Q~uit"
msgstr "Kilщpщs"
-#: gui/launcher.cpp:578 backends/platform/sdl/macosx/appmenu_osx.mm:80
+#: gui/launcher.cpp:578 backends/platform/sdl/macosx/appmenu_osx.mm:96
msgid "Quit ScummVM"
msgstr "ScummVM bezсrсsa"
@@ -355,7 +359,7 @@ msgstr "ScummVM bezсrсsa"
msgid "A~b~out..."
msgstr "Nщvjegy"
-#: gui/launcher.cpp:579 backends/platform/sdl/macosx/appmenu_osx.mm:61
+#: gui/launcher.cpp:579 backends/platform/sdl/macosx/appmenu_osx.mm:70
msgid "About ScummVM"
msgstr "ScummVM nщvjegy"
@@ -599,7 +603,7 @@ msgstr "Nщhсny jсtщk tсmogatja a speciсlis сrnyalсsi mѓdokat"
#: gui/options.cpp:761
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2248
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:476
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:472
msgid "Fullscreen mode"
msgstr "Teljeskщpernyѕs mѓd:"
@@ -957,28 +961,28 @@ msgstr "Nщvtelen jсtщkсllсs"
msgid "Select a Theme"
msgstr "Vсlassz tщmсt"
-#: gui/ThemeEngine.cpp:329
+#: gui/ThemeEngine.cpp:333
msgid "Disabled GFX"
msgstr "GFX letiltva"
-#: gui/ThemeEngine.cpp:329
+#: gui/ThemeEngine.cpp:333
msgctxt "lowres"
msgid "Disabled GFX"
msgstr "GFX letiltva"
-#: gui/ThemeEngine.cpp:330
+#: gui/ThemeEngine.cpp:334
msgid "Standard Renderer (16bpp)"
msgstr "Standard lekщpezѕ (16bpp)"
-#: gui/ThemeEngine.cpp:330
+#: gui/ThemeEngine.cpp:334
msgid "Standard (16bpp)"
msgstr "Standard (16bpp)"
-#: gui/ThemeEngine.cpp:332
+#: gui/ThemeEngine.cpp:336
msgid "Antialiased Renderer (16bpp)"
msgstr "Щlsimэtсsos lekщpezѕ (16bpp)"
-#: gui/ThemeEngine.cpp:332
+#: gui/ThemeEngine.cpp:336
msgid "Antialiased (16bpp)"
msgstr "Щlsimэtott (16bpp)"
@@ -991,30 +995,30 @@ msgstr "Щrtщk tіrlщse"
msgid "Engine does not support debug level '%s'"
msgstr "A motor nem tсmogatja a '%s' debug szintet"
-#: base/main.cpp:271
+#: base/main.cpp:277
msgid "Menu"
msgstr "Menќ"
-#: base/main.cpp:274 backends/platform/symbian/src/SymbianActions.cpp:45
+#: base/main.cpp:280 backends/platform/symbian/src/SymbianActions.cpp:45
#: backends/platform/wince/CEActionsPocket.cpp:45
#: backends/platform/wince/CEActionsSmartphone.cpp:46
msgid "Skip"
msgstr "Tovсbb"
-#: base/main.cpp:277 backends/platform/symbian/src/SymbianActions.cpp:50
+#: base/main.cpp:283 backends/platform/symbian/src/SymbianActions.cpp:50
#: backends/platform/wince/CEActionsPocket.cpp:42
msgid "Pause"
msgstr "Szќnet"
-#: base/main.cpp:280
+#: base/main.cpp:286
msgid "Skip line"
msgstr "Sor сtlщpщse"
-#: base/main.cpp:439
+#: base/main.cpp:455
msgid "Error running game:"
msgstr "Hiba a jсtщk futtatсsakor:"
-#: base/main.cpp:463
+#: base/main.cpp:479
msgid "Could not find any engine capable of running the selected game"
msgstr "Nem talсlhatѓ olyan jсtщkmotor ami a vсlasztott jсtщkot tсmogatja"
@@ -1185,23 +1189,23 @@ msgstr "Mщgse"
msgid "~K~eys"
msgstr "Billentyќk"
-#: engines/engine.cpp:233
+#: engines/engine.cpp:235
msgid "Could not initialize color format."
msgstr "Szэn formсtum nincs alkalmazva"
-#: engines/engine.cpp:241
+#: engines/engine.cpp:243
msgid "Could not switch to video mode: '"
msgstr "Videѓmѓd nincs сtсllэtva: ' "
-#: engines/engine.cpp:250
+#: engines/engine.cpp:252
msgid "Could not apply aspect ratio setting."
msgstr "Mщretarсny korrekciѓ nem vсltozott."
-#: engines/engine.cpp:255
+#: engines/engine.cpp:257
msgid "Could not apply fullscreen setting."
msgstr "Teljeskщpernyѕs beсllэtсs nincs alkalmazva"
-#: engines/engine.cpp:355
+#: engines/engine.cpp:357
msgid ""
"You appear to be playing this game directly\n"
"from the CD. This is known to cause problems,\n"
@@ -1215,7 +1219,7 @@ msgstr ""
"adatfсjljait a merevlemezedre.\n"
"Nщzd meg a README fсjlt a rщszletekщrt."
-#: engines/engine.cpp:366
+#: engines/engine.cpp:368
msgid ""
"This game has audio tracks in its disk. These\n"
"tracks need to be ripped from the disk using\n"
@@ -1229,7 +1233,7 @@ msgstr ""
"hogy a jсtщk zenщje hallhatѓ legyen.\n"
"Nщzd meg a README fсjlt a rщszletekщrt."
-#: engines/engine.cpp:433
+#: engines/engine.cpp:435
msgid ""
"WARNING: The game you are about to start is not yet fully supported by "
"ScummVM. As such, it is likely to be unstable, and any saves you make might "
@@ -1239,7 +1243,7 @@ msgstr ""
"ScummVM. Szсmэts rс hogy nem stabilan fut, щs a mentщsek nem mћkіdnek a "
"jіvѕbeni ScummVM verziѓkkal."
-#: engines/engine.cpp:436
+#: engines/engine.cpp:438
msgid "Start anyway"
msgstr "Indэtсs эgy is"
@@ -1890,7 +1894,7 @@ msgstr "Jobbra repќlщs"
msgid "Fly to lower right"
msgstr "Jobbra le repќlщs"
-#: engines/scumm/scumm.cpp:1782
+#: engines/scumm/scumm.cpp:1773
#, c-format
msgid ""
"Native MIDI support requires the Roland Upgrade from LucasArts,\n"
@@ -1899,7 +1903,7 @@ msgstr ""
"Native MIDI tсmogatсshoz kell a Roland Upgrade a LucasArts-tѓl,\n"
"a %s hiсnyzik. AdLib-ot hasznсlok helyette."
-#: engines/scumm/scumm.cpp:2272 engines/agos/saveload.cpp:189
+#: engines/scumm/scumm.cpp:2271 engines/agos/saveload.cpp:189
#, c-format
msgid ""
"Failed to save game state to file:\n"
@@ -1910,7 +1914,7 @@ msgstr ""
"\n"
"%s fсjlba nem sikerќlt"
-#: engines/scumm/scumm.cpp:2279 engines/agos/saveload.cpp:154
+#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:154
#, c-format
msgid ""
"Failed to load game state from file:\n"
@@ -1921,7 +1925,7 @@ msgstr ""
"\n"
"%s fсjlbѓl nem sikerќlt"
-#: engines/scumm/scumm.cpp:2291 engines/agos/saveload.cpp:197
+#: engines/scumm/scumm.cpp:2290 engines/agos/saveload.cpp:197
#, c-format
msgid ""
"Successfully saved game state in file:\n"
@@ -1932,7 +1936,7 @@ msgstr ""
"\n"
"%s fсjlba elkщszќlt"
-#: engines/scumm/scumm.cpp:2506
+#: engines/scumm/scumm.cpp:2505
msgid ""
"Usually, Maniac Mansion would start now. But ScummVM doesn't do that yet. To "
"play it, go to 'Add Game' in the ScummVM start menu and select the 'Maniac' "
@@ -1982,11 +1986,11 @@ msgid "Cutscene file '%s' not found!"
msgstr "'%s' сtvezetѕ fсjl nem talсlhatѓ"
#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1283
-#: engines/tinsel/saveload.cpp:482
+#: engines/tinsel/saveload.cpp:500
msgid "Failed to load game state from file."
msgstr "Jсtщkсllсs betіltщse fсjlbѓl nem sikerќlt."
-#: engines/gob/inter_v2.cpp:1353 engines/tinsel/saveload.cpp:495
+#: engines/gob/inter_v2.cpp:1353 engines/tinsel/saveload.cpp:513
msgid "Failed to save game state to file."
msgstr "Jсtщkсllсs mentщse fсjlba nem sikerќlt."
@@ -1998,51 +2002,51 @@ msgstr "Fсjl tіrlщs sikertelen."
msgid "Failed to save game"
msgstr "Jсtщk mentщs nem sikerќlt"
-#: engines/kyra/lol.cpp:572
+#: engines/kyra/lol.cpp:478
msgid "Attack 1"
msgstr "Tсmadсs 1"
-#: engines/kyra/lol.cpp:573
+#: engines/kyra/lol.cpp:479
msgid "Attack 2"
msgstr "Tсmadсs 2"
-#: engines/kyra/lol.cpp:574
+#: engines/kyra/lol.cpp:480
msgid "Attack 3"
msgstr "Tсmadсs 3"
-#: engines/kyra/lol.cpp:575
+#: engines/kyra/lol.cpp:481
msgid "Move Forward"
msgstr "Mozgсs elѕre"
-#: engines/kyra/lol.cpp:576
+#: engines/kyra/lol.cpp:482
msgid "Move Back"
msgstr "Mozgсs hсtra"
-#: engines/kyra/lol.cpp:577
+#: engines/kyra/lol.cpp:483
msgid "Slide Left"
msgstr "Siklсs balra"
-#: engines/kyra/lol.cpp:578
+#: engines/kyra/lol.cpp:484
msgid "Slide Right"
msgstr "Siklсs jobbra"
-#: engines/kyra/lol.cpp:579
+#: engines/kyra/lol.cpp:485
msgid "Turn Left"
msgstr "Balra fordul"
-#: engines/kyra/lol.cpp:580
+#: engines/kyra/lol.cpp:486
msgid "Turn Right"
msgstr "Jobbra fordul"
-#: engines/kyra/lol.cpp:581
+#: engines/kyra/lol.cpp:487
msgid "Rest"
msgstr "Pihenщs"
-#: engines/kyra/lol.cpp:582
+#: engines/kyra/lol.cpp:488
msgid "Options"
msgstr "Opciѓk"
-#: engines/kyra/lol.cpp:583
+#: engines/kyra/lol.cpp:489
msgid "Choose Spell"
msgstr "Vсlassz varсzslatot"
@@ -2076,15 +2080,15 @@ msgstr ""
"A \"sky.cpt\" fсjl mщrete nem megfelelѕ.\n"
"Tіltsd le a www.scummvm.org oldalсrѓl"
-#: engines/sword1/animation.cpp:345 engines/sword2/animation.cpp:379
+#: engines/sword1/animation.cpp:449 engines/sword2/animation.cpp:379
msgid "DXA cutscenes found but ScummVM has been built without zlib support"
msgstr "DXA сtvezetѕ elщrhetѕ, de a ScummVM zlib tсmogatсs nincs lefordэtva"
-#: engines/sword1/animation.cpp:355 engines/sword2/animation.cpp:389
+#: engines/sword1/animation.cpp:459 engines/sword2/animation.cpp:389
msgid "MPEG2 cutscenes are no longer supported"
msgstr "MPEG2 сtvezetѕk mсr nem tсmogatottak"
-#: engines/sword1/animation.cpp:360 engines/sword2/animation.cpp:397
+#: engines/sword1/animation.cpp:464 engines/sword2/animation.cpp:397
#, c-format
msgid "Cutscene '%s' not found"
msgstr "'%s' сtvezetѕ nem talсlhatѓ"
@@ -2244,11 +2248,11 @@ msgstr "Apple II GS Emulсtor (NEM TСMOGATOTT)"
msgid "C64 Audio Emulator"
msgstr "C64 Audio Emulсtor"
-#: audio/softsynth/mt32.cpp:329
+#: audio/softsynth/mt32.cpp:293
msgid "Initializing MT-32 Emulator"
msgstr "MT-32 Emulсtor inicializсlсsa"
-#: audio/softsynth/mt32.cpp:543
+#: audio/softsynth/mt32.cpp:512
msgid "MT-32 Emulator"
msgstr "MT-32 Emulсtor"
@@ -2264,15 +2268,19 @@ msgstr "IBM PCjr Emulсtor"
msgid "Keymap:"
msgstr "Billentyћzet kiosztсs:"
-#: backends/keymapper/remap-dialog.cpp:64
+#: backends/keymapper/remap-dialog.cpp:66
+msgid " (Effective)"
+msgstr " (Tщnyleges)"
+
+#: backends/keymapper/remap-dialog.cpp:106
msgid " (Active)"
msgstr " (Aktэv)"
-#: backends/keymapper/remap-dialog.cpp:98
+#: backends/keymapper/remap-dialog.cpp:116
msgid " (Global)"
msgstr " (Globсlis)"
-#: backends/keymapper/remap-dialog.cpp:108
+#: backends/keymapper/remap-dialog.cpp:126
msgid " (Game)"
msgstr " (Jсtщk)"
@@ -2368,24 +2376,47 @@ msgstr "Touchpad mѓd engedщlyezve."
msgid "Touchpad mode disabled."
msgstr "Touchpad mѓd letiltva."
-#: backends/platform/sdl/macosx/appmenu_osx.mm:67
+#: backends/platform/maemo/maemo.cpp:178
+msgid "Click Mode"
+msgstr "Kattintсs Mѓd"
+
+#: backends/platform/maemo/maemo.cpp:184
+#: backends/platform/symbian/src/SymbianActions.cpp:42
+#: backends/platform/wince/CEActionsPocket.cpp:60
+#: backends/platform/wince/CEActionsSmartphone.cpp:43
+#: backends/platform/bada/form.cpp:281
+msgid "Left Click"
+msgstr "Bal katt"
+
+#: backends/platform/maemo/maemo.cpp:187
+msgid "Middle Click"
+msgstr "Kіzщpsѕ katt"
+
+#: backends/platform/maemo/maemo.cpp:190
+#: backends/platform/symbian/src/SymbianActions.cpp:43
+#: backends/platform/wince/CEActionsSmartphone.cpp:44
+#: backends/platform/bada/form.cpp:273
+msgid "Right Click"
+msgstr "Jobb katt"
+
+#: backends/platform/sdl/macosx/appmenu_osx.mm:78
msgid "Hide ScummVM"
msgstr "ScummVM elrejtщse"
-#: backends/platform/sdl/macosx/appmenu_osx.mm:70
+#: backends/platform/sdl/macosx/appmenu_osx.mm:83
msgid "Hide Others"
msgstr "Tіbbi elrejtщse"
-#: backends/platform/sdl/macosx/appmenu_osx.mm:74
+#: backends/platform/sdl/macosx/appmenu_osx.mm:88
msgid "Show All"
msgstr "Mutasd mind"
-#: backends/platform/sdl/macosx/appmenu_osx.mm:92
-#: backends/platform/sdl/macosx/appmenu_osx.mm:99
+#: backends/platform/sdl/macosx/appmenu_osx.mm:110
+#: backends/platform/sdl/macosx/appmenu_osx.mm:121
msgid "Window"
msgstr "Ablak"
-#: backends/platform/sdl/macosx/appmenu_osx.mm:95
+#: backends/platform/sdl/macosx/appmenu_osx.mm:115
msgid "Minimize"
msgstr "Kis mщret"
@@ -2399,12 +2430,12 @@ msgid "Normal (no scaling)"
msgstr "Normсl (nincs сtmщretezщs)"
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2147
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:537
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:533
msgid "Enabled aspect ratio correction"
msgstr "Mщretarсny korrekciѓ engedщlyezve"
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2153
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:542
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:538
msgid "Disabled aspect ratio correction"
msgstr "Mщretarсny korrekciѓ letiltva"
@@ -2413,7 +2444,7 @@ msgid "Active graphics filter:"
msgstr "Aktэv grafikus szћrѕk:"
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2250
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:481
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:477
msgid "Windowed mode"
msgstr "Ablakos mѓd"
@@ -2437,11 +2468,11 @@ msgstr "Jelenlegi videѓmѓd"
msgid "Current scale"
msgstr "Aktuсlis mщretezщs"
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:562
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:558
msgid "Active filter mode: Linear"
msgstr "Aktэv filter mѓd: Lineсris"
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:564
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:560
msgid "Active filter mode: Nearest"
msgstr "Aktэv filter mѓd: Kіzelэtѕ"
@@ -2465,19 +2496,6 @@ msgstr "Bal"
msgid "Right"
msgstr "Jobb"
-#: backends/platform/symbian/src/SymbianActions.cpp:42
-#: backends/platform/wince/CEActionsPocket.cpp:60
-#: backends/platform/wince/CEActionsSmartphone.cpp:43
-#: backends/platform/bada/form.cpp:281
-msgid "Left Click"
-msgstr "Bal katt"
-
-#: backends/platform/symbian/src/SymbianActions.cpp:43
-#: backends/platform/wince/CEActionsSmartphone.cpp:44
-#: backends/platform/bada/form.cpp:273
-msgid "Right Click"
-msgstr "Jobb katt"
-
#: backends/platform/symbian/src/SymbianActions.cpp:46
#: backends/platform/wince/CEActionsSmartphone.cpp:47
msgid "Zone"
@@ -2838,11 +2856,11 @@ msgstr "Kщzi billentyћzet"
msgid "Control Mouse"
msgstr "Egщr irсnyitсs"
-#: backends/events/maemosdl/maemosdl-events.cpp:129
+#: backends/events/maemosdl/maemosdl-events.cpp:192
msgid "Clicking Enabled"
msgstr "Kattintсs engedve"
-#: backends/events/maemosdl/maemosdl-events.cpp:129
+#: backends/events/maemosdl/maemosdl-events.cpp:192
msgid "Clicking Disabled"
msgstr "Kattintсs tiltva"
diff --git a/po/iso-8859-2.cp b/po/iso-8859-2.cp
new file mode 100644
index 0000000000..f8e673bf70
--- /dev/null
+++ b/po/iso-8859-2.cp
@@ -0,0 +1,320 @@
+# 0x00 ( 0)
+0 0 # Not required
+1 0 # Not required
+2 0 # Not required
+3 0 # Not required
+# 0x04 ( 4)
+4 0 # Not required
+5 0 # Not required
+6 0 # Not required
+7 0 # Not required
+# 0x08 ( 8)
+8 0 # Not required
+9 0 # Not required
+10 0 # Not required
+11 0 # Not required
+# 0x0C ( 12)
+12 0 # Not required
+13 0 # Not required
+14 0 # Not required
+15 0 # Not required
+# 0x10 ( 16)
+16 0 # Not required
+17 0 # Not required
+18 0 # Not required
+19 0 # Not required
+# 0x14 ( 20)
+20 0 # Not required
+21 0 # Not required
+22 0 # Not required
+23 0 # Not required
+# 0x18 ( 24)
+24 0 # Not required
+25 0 # Not required
+26 0 # Not required
+27 0 # Not required
+# 0x1C ( 28)
+28 0 # Not required
+29 0 # Not required
+30 0 # Not required
+31 0 # Not required
+# 0x20 ( 32)
+32
+33
+34
+35
+# 0x24 ( 36)
+36
+37
+38
+39
+# 0x28 ( 40)
+40
+41
+42
+43
+# 0x2C ( 44)
+44
+45
+46
+47
+# 0x30 ( 48)
+48
+49
+50
+51
+# 0x34 ( 52)
+52
+53
+54
+55
+# 0x38 ( 56)
+56
+57
+58
+59
+# 0x3C ( 60)
+60
+61
+62
+63
+# 0x40 ( 64)
+64
+65
+66
+67
+# 0x44 ( 68)
+68
+69
+70
+71
+# 0x48 ( 72)
+72
+73
+74
+75
+# 0x4C ( 76)
+76
+77
+78
+79
+# 0x50 ( 80)
+80
+81
+82
+83
+# 0x54 ( 84)
+84
+85
+86
+87
+# 0x58 ( 88)
+88
+89
+90
+91
+# 0x5C ( 92)
+92
+93
+94
+95
+# 0x60 ( 96)
+96
+97
+98
+99
+# 0x64 (100)
+100
+101
+102
+103
+# 0x68 (104)
+104
+105
+106
+107
+# 0x6C (108)
+108
+109
+110
+111
+# 0x70 (112)
+112
+113
+114
+115
+# 0x74 (116)
+116
+117
+118
+119
+# 0x78 (120)
+120
+121
+122
+123
+# 0x7C (124)
+124
+125
+126
+127 0 # Not required
+# 0x80 (128)
+128 0 # Not required
+129 0 # Not required
+130 0 # Not required
+131 0 # Not required
+# 0x84 (132)
+132 0 # Not required
+133 0 # Not required
+134 0 # Not required
+135 0 # Not required
+# 0x88 (136)
+136 0 # Not required
+137 0 # Not required
+138 0 # Not required
+139 0 # Not required
+# 0x8C (140)
+140 0 # Not required
+141 0 # Not required
+142 0 # Not required
+143 0 # Not required
+# 0x90 (144)
+144 0 # Not required
+145 0 # Not required
+146 0 # Not required
+147 0 # Not required
+# 0x94 (148)
+148 0 # Not required
+149 0 # Not required
+150 0 # Not required
+151 0 # Not required
+# 0x98 (152)
+152 0 # Not required
+153 0 # Not required
+154 0 # Not required
+155 0 # Not required
+# 0x9C (156)
+156 0 # Not required
+157 0 # Not required
+158 0 # Not required
+159 0 # Not required
+# 0xA0 (160)
+160
+260
+728
+321
+# 0xA4 (164)
+164
+317
+346
+167
+# 0xA8 (168)
+168
+352
+350
+356
+# 0xAC (172)
+377
+173
+381
+379
+# 0xB0 (176)
+176
+261
+731
+322
+# 0xB4 (180)
+180
+318
+347
+711
+# 0xB8 (184)
+184
+353
+351
+357
+# 0xBC (188)
+378
+733
+382
+380
+# 0xC0 (192)
+340
+193
+194
+258
+# 0xC4 (196)
+196
+313
+262
+199
+# 0xC8 (200)
+268
+201
+280
+203
+# 0xCC (204)
+282
+205
+206
+270
+# 0xD0 (208)
+272
+323
+327
+211
+# 0xD4 (212)
+212
+336
+214
+215
+# 0xD8 (216)
+344
+366
+218
+368
+# 0xDC (220)
+220
+221
+354
+223
+# 0xE0 (224)
+341
+225
+226
+259
+# 0xE4 (228)
+228
+314
+263
+231
+# 0xE8 (232)
+269
+233
+281
+235
+# 0xEC (236)
+283
+237
+238
+271
+# 0xF0 (240)
+273
+324
+328
+243
+# 0xF4 (244)
+244
+337
+246
+247
+# 0xF8 (248)
+345
+367
+250
+369
+# 0xFC (252)
+252
+253
+355
+729
diff --git a/po/iso-8859-5.cp b/po/iso-8859-5.cp
new file mode 100644
index 0000000000..47350101b2
--- /dev/null
+++ b/po/iso-8859-5.cp
@@ -0,0 +1,320 @@
+# 0x00 ( 0)
+0 0 # Not required
+1 0 # Not required
+2 0 # Not required
+3 0 # Not required
+# 0x04 ( 4)
+4 0 # Not required
+5 0 # Not required
+6 0 # Not required
+7 0 # Not required
+# 0x08 ( 8)
+8 0 # Not required
+9 0 # Not required
+10 0 # Not required
+11 0 # Not required
+# 0x0C ( 12)
+12 0 # Not required
+13 0 # Not required
+14 0 # Not required
+15 0 # Not required
+# 0x10 ( 16)
+16 0 # Not required
+17 0 # Not required
+18 0 # Not required
+19 0 # Not required
+# 0x14 ( 20)
+20 0 # Not required
+21 0 # Not required
+22 0 # Not required
+23 0 # Not required
+# 0x18 ( 24)
+24 0 # Not required
+25 0 # Not required
+26 0 # Not required
+27 0 # Not required
+# 0x1C ( 28)
+28 0 # Not required
+29 0 # Not required
+30 0 # Not required
+31 0 # Not required
+# 0x20 ( 32)
+32
+33
+34
+35
+# 0x24 ( 36)
+36
+37
+38
+39
+# 0x28 ( 40)
+40
+41
+42
+43
+# 0x2C ( 44)
+44
+45
+46
+47
+# 0x30 ( 48)
+48
+49
+50
+51
+# 0x34 ( 52)
+52
+53
+54
+55
+# 0x38 ( 56)
+56
+57
+58
+59
+# 0x3C ( 60)
+60
+61
+62
+63
+# 0x40 ( 64)
+64
+65
+66
+67
+# 0x44 ( 68)
+68
+69
+70
+71
+# 0x48 ( 72)
+72
+73
+74
+75
+# 0x4C ( 76)
+76
+77
+78
+79
+# 0x50 ( 80)
+80
+81
+82
+83
+# 0x54 ( 84)
+84
+85
+86
+87
+# 0x58 ( 88)
+88
+89
+90
+91
+# 0x5C ( 92)
+92
+93
+94
+95
+# 0x60 ( 96)
+96
+97
+98
+99
+# 0x64 (100)
+100
+101
+102
+103
+# 0x68 (104)
+104
+105
+106
+107
+# 0x6C (108)
+108
+109
+110
+111
+# 0x70 (112)
+112
+113
+114
+115
+# 0x74 (116)
+116
+117
+118
+119
+# 0x78 (120)
+120
+121
+122
+123
+# 0x7C (124)
+124
+125
+126
+127 0 # Not required
+# 0x80 (128)
+128 0 # Not required
+129 0 # Not required
+130 0 # Not required
+131 0 # Not required
+# 0x84 (132)
+132 0 # Not required
+133 0 # Not required
+134 0 # Not required
+135 0 # Not required
+# 0x88 (136)
+136 0 # Not required
+137 0 # Not required
+138 0 # Not required
+139 0 # Not required
+# 0x8C (140)
+140 0 # Not required
+141 0 # Not required
+142 0 # Not required
+143 0 # Not required
+# 0x90 (144)
+144 0 # Not required
+145 0 # Not required
+146 0 # Not required
+147 0 # Not required
+# 0x94 (148)
+148 0 # Not required
+149 0 # Not required
+150 0 # Not required
+151 0 # Not required
+# 0x98 (152)
+152 0 # Not required
+153 0 # Not required
+154 0 # Not required
+155 0 # Not required
+# 0x9C (156)
+156 0 # Not required
+157 0 # Not required
+158 0 # Not required
+159 0 # Not required
+# 0xA0 (160)
+160
+1025
+1026
+1027
+# 0xA4 (164)
+1028
+1029
+1030
+1031
+# 0xA8 (168)
+1032
+1033
+1034
+1035
+# 0xAC (172)
+1036
+173
+1038
+1039
+# 0xB0 (176)
+1040
+1041
+1042
+1043
+# 0xB4 (180)
+1044
+1045
+1046
+1047
+# 0xB8 (184)
+1048
+1049
+1050
+1051
+# 0xBC (188)
+1052
+1053
+1054
+1055
+# 0xC0 (192)
+1056
+1057
+1058
+1059
+# 0xC4 (196)
+1060
+1061
+1062
+1063
+# 0xC8 (200)
+1064
+1065
+1066
+1067
+# 0xCC (204)
+1068
+1069
+1070
+1071
+# 0xD0 (208)
+1072
+1073
+1074
+1075
+# 0xD4 (212)
+1076
+1077
+1078
+1079
+# 0xD8 (216)
+1080
+1081
+1082
+1083
+# 0xDC (220)
+1084
+1085
+1086
+1087
+# 0xE0 (224)
+1088
+1089
+1090
+1091
+# 0xE4 (228)
+1092
+1093
+1094
+1095
+# 0xE8 (232)
+1096
+1097
+1098
+1099
+# 0xEC (236)
+1100
+1101
+1102
+1103
+# 0xF0 (240)
+8470
+1105
+1106
+1107
+# 0xF4 (244)
+1108
+1109
+1110
+1111
+# 0xF8 (248)
+1112
+1113
+1114
+1115
+# 0xFC (252)
+1116
+167
+1118
+1119
diff --git a/po/it_IT.po b/po/it_IT.po
index ce8101055b..43ae6cb60d 100644
--- a/po/it_IT.po
+++ b/po/it_IT.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ScummVM 1.3.0svn\n"
"Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n"
-"POT-Creation-Date: 2011-12-26 15:26+0100\n"
+"POT-Creation-Date: 2012-02-16 12:32+0200\n"
"PO-Revision-Date: 2011-10-08 17:29+0100\n"
"Last-Translator: Matteo 'Maff' Angelino <matteo.maff at gmail dot com>\n"
"Language-Team: Italian\n"
@@ -45,7 +45,7 @@ msgstr "Su"
#: gui/browser.cpp:69 gui/chooser.cpp:45 gui/KeysDialog.cpp:43
#: gui/launcher.cpp:319 gui/massadd.cpp:94 gui/options.cpp:1221
#: gui/saveload.cpp:63 gui/saveload.cpp:155 gui/themebrowser.cpp:54
-#: engines/engine.cpp:436 engines/scumm/dialogs.cpp:190
+#: engines/engine.cpp:438 engines/scumm/dialogs.cpp:190
#: engines/sword1/control.cpp:865 engines/parallaction/saveload.cpp:281
#: backends/platform/wii/options.cpp:48
#: backends/events/default/default-events.cpp:222
@@ -57,25 +57,30 @@ msgstr "Annulla"
msgid "Choose"
msgstr "Scegli"
-#: gui/gui-manager.cpp:116 engines/scumm/help.cpp:125
+#: gui/gui-manager.cpp:115 engines/scumm/help.cpp:125
#: engines/scumm/help.cpp:140 engines/scumm/help.cpp:165
#: engines/scumm/help.cpp:191 engines/scumm/help.cpp:209
#: backends/keymapper/remap-dialog.cpp:52
msgid "Close"
msgstr "Chiudi"
-#: gui/gui-manager.cpp:119
+#: gui/gui-manager.cpp:118
msgid "Mouse click"
msgstr "Clic del mouse"
-#: gui/gui-manager.cpp:122 base/main.cpp:283
+#: gui/gui-manager.cpp:121 base/main.cpp:289
msgid "Display keyboard"
msgstr "Mostra tastiera"
-#: gui/gui-manager.cpp:125 base/main.cpp:286
+#: gui/gui-manager.cpp:124 base/main.cpp:292
msgid "Remap keys"
msgstr "Riprogramma tasti"
+#: gui/gui-manager.cpp:127 base/main.cpp:295
+#, fuzzy
+msgid "Toggle FullScreen"
+msgstr "Attiva / disattiva schermo intero"
+
#: gui/KeysDialog.h:36 gui/KeysDialog.cpp:145
msgid "Choose an action to map"
msgstr "Scegli un'azione da mappare"
@@ -86,11 +91,11 @@ msgstr "Mappa"
#: gui/KeysDialog.cpp:42 gui/launcher.cpp:320 gui/launcher.cpp:959
#: gui/launcher.cpp:963 gui/massadd.cpp:91 gui/options.cpp:1222
-#: engines/engine.cpp:359 engines/engine.cpp:370 engines/scumm/dialogs.cpp:192
-#: engines/scumm/scumm.cpp:1784 engines/agos/animation.cpp:551
+#: engines/engine.cpp:361 engines/engine.cpp:372 engines/scumm/dialogs.cpp:192
+#: engines/scumm/scumm.cpp:1775 engines/agos/animation.cpp:551
#: engines/groovie/script.cpp:420 engines/sky/compact.cpp:131
-#: engines/sky/compact.cpp:141 engines/sword1/animation.cpp:345
-#: engines/sword1/animation.cpp:355 engines/sword1/animation.cpp:361
+#: engines/sky/compact.cpp:141 engines/sword1/animation.cpp:449
+#: engines/sword1/animation.cpp:459 engines/sword1/animation.cpp:465
#: engines/sword1/control.cpp:865 engines/sword1/logic.cpp:1633
#: engines/sword2/animation.cpp:379 engines/sword2/animation.cpp:389
#: engines/sword2/animation.cpp:398 engines/parallaction/saveload.cpp:281
@@ -344,15 +349,15 @@ msgstr "Questo ID di gioco ш giр in uso. Si prega di sceglierne un'altro."
msgid "~Q~uit"
msgstr "C~h~iudi"
-#: gui/launcher.cpp:578 backends/platform/sdl/macosx/appmenu_osx.mm:80
+#: gui/launcher.cpp:578 backends/platform/sdl/macosx/appmenu_osx.mm:96
msgid "Quit ScummVM"
-msgstr "Chiudi ScummVM"
+msgstr "Esci da ScummVM"
#: gui/launcher.cpp:579
msgid "A~b~out..."
msgstr "~I~nfo..."
-#: gui/launcher.cpp:579 backends/platform/sdl/macosx/appmenu_osx.mm:61
+#: gui/launcher.cpp:579 backends/platform/sdl/macosx/appmenu_osx.mm:70
msgid "About ScummVM"
msgstr "Informazioni su ScummVM"
@@ -599,7 +604,7 @@ msgstr "Modalitр di resa grafica speciali supportate da alcuni giochi"
#: gui/options.cpp:761
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2248
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:476
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:472
msgid "Fullscreen mode"
msgstr "Modalitр a schermo intero"
@@ -963,28 +968,28 @@ msgstr "Salvataggio senza titolo"
msgid "Select a Theme"
msgstr "Seleziona un tema"
-#: gui/ThemeEngine.cpp:329
+#: gui/ThemeEngine.cpp:333
msgid "Disabled GFX"
msgstr "Grafica disattivata"
-#: gui/ThemeEngine.cpp:329
+#: gui/ThemeEngine.cpp:333
msgctxt "lowres"
msgid "Disabled GFX"
msgstr "Grafica disattivata"
-#: gui/ThemeEngine.cpp:330
+#: gui/ThemeEngine.cpp:334
msgid "Standard Renderer (16bpp)"
msgstr "Renderer standard (16bpp)"
-#: gui/ThemeEngine.cpp:330
+#: gui/ThemeEngine.cpp:334
msgid "Standard (16bpp)"
msgstr "Standard (16bpp)"
-#: gui/ThemeEngine.cpp:332
+#: gui/ThemeEngine.cpp:336
msgid "Antialiased Renderer (16bpp)"
msgstr "Renderer con antialiasing (16bpp)"
-#: gui/ThemeEngine.cpp:332
+#: gui/ThemeEngine.cpp:336
msgid "Antialiased (16bpp)"
msgstr "Con antialiasing (16bpp)"
@@ -997,30 +1002,30 @@ msgstr "Cancella"
msgid "Engine does not support debug level '%s'"
msgstr "Il motore non supporta il livello di debug '%s'"
-#: base/main.cpp:271
+#: base/main.cpp:277
msgid "Menu"
msgstr "Menu"
-#: base/main.cpp:274 backends/platform/symbian/src/SymbianActions.cpp:45
+#: base/main.cpp:280 backends/platform/symbian/src/SymbianActions.cpp:45
#: backends/platform/wince/CEActionsPocket.cpp:45
#: backends/platform/wince/CEActionsSmartphone.cpp:46
msgid "Skip"
msgstr "Salta"
-#: base/main.cpp:277 backends/platform/symbian/src/SymbianActions.cpp:50
+#: base/main.cpp:283 backends/platform/symbian/src/SymbianActions.cpp:50
#: backends/platform/wince/CEActionsPocket.cpp:42
msgid "Pause"
msgstr "Pausa"
-#: base/main.cpp:280
+#: base/main.cpp:286
msgid "Skip line"
msgstr "Salta battuta"
-#: base/main.cpp:439
+#: base/main.cpp:455
msgid "Error running game:"
msgstr "Errore nell'esecuzione del gioco:"
-#: base/main.cpp:463
+#: base/main.cpp:479
msgid "Could not find any engine capable of running the selected game"
msgstr ""
"Impossibile trovare un motore in grado di eseguire il gioco selezionato"
@@ -1193,23 +1198,23 @@ msgstr "~A~nnulla"
msgid "~K~eys"
msgstr "~T~asti"
-#: engines/engine.cpp:233
+#: engines/engine.cpp:235
msgid "Could not initialize color format."
msgstr "Impossibile inizializzare il formato colore."
-#: engines/engine.cpp:241
+#: engines/engine.cpp:243
msgid "Could not switch to video mode: '"
msgstr "Impossibile cambiare la modalitр video: '"
-#: engines/engine.cpp:250
+#: engines/engine.cpp:252
msgid "Could not apply aspect ratio setting."
msgstr "Impossibile applicare l'impostazione proporzioni"
-#: engines/engine.cpp:255
+#: engines/engine.cpp:257
msgid "Could not apply fullscreen setting."
msgstr "Impossibile applicare l'impostazione schermo intero."
-#: engines/engine.cpp:355
+#: engines/engine.cpp:357
msgid ""
"You appear to be playing this game directly\n"
"from the CD. This is known to cause problems,\n"
@@ -1223,7 +1228,7 @@ msgstr ""
"sull'hard disk.\n"
"Vedi il file README per i dettagli."
-#: engines/engine.cpp:366
+#: engines/engine.cpp:368
msgid ""
"This game has audio tracks in its disk. These\n"
"tracks need to be ripped from the disk using\n"
@@ -1237,7 +1242,7 @@ msgstr ""
"la musica del gioco.\n"
"Vedi il file README per i dettagli."
-#: engines/engine.cpp:433
+#: engines/engine.cpp:435
msgid ""
"WARNING: The game you are about to start is not yet fully supported by "
"ScummVM. As such, it is likely to be unstable, and any saves you make might "
@@ -1247,7 +1252,7 @@ msgstr ""
"ScummVM. Ш quindi possibile che sia instabile, e i salvataggi potrebbero non "
"funzionare con future versioni di ScummVM."
-#: engines/engine.cpp:436
+#: engines/engine.cpp:438
msgid "Start anyway"
msgstr "Avvia comunque"
@@ -1899,7 +1904,7 @@ msgstr "Vola a destra"
msgid "Fly to lower right"
msgstr "Vola in basso a destra"
-#: engines/scumm/scumm.cpp:1782
+#: engines/scumm/scumm.cpp:1773
#, c-format
msgid ""
"Native MIDI support requires the Roland Upgrade from LucasArts,\n"
@@ -1908,7 +1913,7 @@ msgstr ""
"Il supporto nativo MIDI richiede il Roland Upgrade della LucasArts,\n"
"ma %s non ш presente. Verrр usato AdLib."
-#: engines/scumm/scumm.cpp:2272 engines/agos/saveload.cpp:189
+#: engines/scumm/scumm.cpp:2271 engines/agos/saveload.cpp:189
#, c-format
msgid ""
"Failed to save game state to file:\n"
@@ -1919,7 +1924,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2279 engines/agos/saveload.cpp:154
+#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:154
#, c-format
msgid ""
"Failed to load game state from file:\n"
@@ -1930,7 +1935,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2291 engines/agos/saveload.cpp:197
+#: engines/scumm/scumm.cpp:2290 engines/agos/saveload.cpp:197
#, c-format
msgid ""
"Successfully saved game state in file:\n"
@@ -1941,7 +1946,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2506
+#: engines/scumm/scumm.cpp:2505
msgid ""
"Usually, Maniac Mansion would start now. But ScummVM doesn't do that yet. To "
"play it, go to 'Add Game' in the ScummVM start menu and select the 'Maniac' "
@@ -1992,11 +1997,11 @@ msgid "Cutscene file '%s' not found!"
msgstr "File della scena di intermezzo '%s' non trovato!"
#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1283
-#: engines/tinsel/saveload.cpp:482
+#: engines/tinsel/saveload.cpp:500
msgid "Failed to load game state from file."
msgstr "Impossibile caricare il gioco dal file."
-#: engines/gob/inter_v2.cpp:1353 engines/tinsel/saveload.cpp:495
+#: engines/gob/inter_v2.cpp:1353 engines/tinsel/saveload.cpp:513
msgid "Failed to save game state to file."
msgstr "Impossibile salvare il gioco nel file."
@@ -2008,56 +2013,56 @@ msgstr "Impossibile eliminare il file."
msgid "Failed to save game"
msgstr "Impossibile salvare il gioco"
-#: engines/kyra/lol.cpp:572
+#: engines/kyra/lol.cpp:478
msgid "Attack 1"
msgstr ""
-#: engines/kyra/lol.cpp:573
+#: engines/kyra/lol.cpp:479
msgid "Attack 2"
msgstr ""
-#: engines/kyra/lol.cpp:574
+#: engines/kyra/lol.cpp:480
msgid "Attack 3"
msgstr ""
-#: engines/kyra/lol.cpp:575
+#: engines/kyra/lol.cpp:481
msgid "Move Forward"
msgstr ""
-#: engines/kyra/lol.cpp:576
+#: engines/kyra/lol.cpp:482
msgid "Move Back"
msgstr ""
-#: engines/kyra/lol.cpp:577
+#: engines/kyra/lol.cpp:483
msgid "Slide Left"
msgstr ""
-#: engines/kyra/lol.cpp:578
+#: engines/kyra/lol.cpp:484
#, fuzzy
msgid "Slide Right"
msgstr "Destra"
-#: engines/kyra/lol.cpp:579
+#: engines/kyra/lol.cpp:485
#, fuzzy
msgid "Turn Left"
msgstr "Spegni"
-#: engines/kyra/lol.cpp:580
+#: engines/kyra/lol.cpp:486
#, fuzzy
msgid "Turn Right"
msgstr "Cursore a destra"
-#: engines/kyra/lol.cpp:581
+#: engines/kyra/lol.cpp:487
#, fuzzy
msgid "Rest"
msgstr "Ripristina"
-#: engines/kyra/lol.cpp:582
+#: engines/kyra/lol.cpp:488
#, fuzzy
msgid "Options"
msgstr "~O~pzioni"
-#: engines/kyra/lol.cpp:583
+#: engines/kyra/lol.cpp:489
#, fuzzy
msgid "Choose Spell"
msgstr "Scegli"
@@ -2092,17 +2097,17 @@ msgstr ""
"Il file \"sky.cpt\" non ha una dimensione corretta.\n"
"Si prega di (ri)scaricarlo da www.scummvm.org"
-#: engines/sword1/animation.cpp:345 engines/sword2/animation.cpp:379
+#: engines/sword1/animation.cpp:449 engines/sword2/animation.cpp:379
msgid "DXA cutscenes found but ScummVM has been built without zlib support"
msgstr ""
"Sono state trovare scene di intermezzo DXA ma ScummVM ш stato compilato "
"senza il supporto zlib"
-#: engines/sword1/animation.cpp:355 engines/sword2/animation.cpp:389
+#: engines/sword1/animation.cpp:459 engines/sword2/animation.cpp:389
msgid "MPEG2 cutscenes are no longer supported"
msgstr "Le scene di intermezzo MPEG2 non sono piљ supportate"
-#: engines/sword1/animation.cpp:360 engines/sword2/animation.cpp:397
+#: engines/sword1/animation.cpp:464 engines/sword2/animation.cpp:397
#, c-format
msgid "Cutscene '%s' not found"
msgstr "Scena di intermezzo '%s' non trovata"
@@ -2265,11 +2270,11 @@ msgstr "Emulatore Apple II GS (NON IMPLEMENTATO)"
msgid "C64 Audio Emulator"
msgstr "Emulatore audio C64"
-#: audio/softsynth/mt32.cpp:329
+#: audio/softsynth/mt32.cpp:293
msgid "Initializing MT-32 Emulator"
msgstr "Avvio in corso dell'emulatore MT-32"
-#: audio/softsynth/mt32.cpp:543
+#: audio/softsynth/mt32.cpp:512
msgid "MT-32 Emulator"
msgstr "Emulatore MT-32"
@@ -2285,15 +2290,20 @@ msgstr "Emulatore IBM PCjr"
msgid "Keymap:"
msgstr "Mappa tasti:"
-#: backends/keymapper/remap-dialog.cpp:64
+#: backends/keymapper/remap-dialog.cpp:66
+#, fuzzy
+msgid " (Effective)"
+msgstr " (Attivo)"
+
+#: backends/keymapper/remap-dialog.cpp:106
msgid " (Active)"
msgstr " (Attivo)"
-#: backends/keymapper/remap-dialog.cpp:98
+#: backends/keymapper/remap-dialog.cpp:116
msgid " (Global)"
msgstr " (Globale)"
-#: backends/keymapper/remap-dialog.cpp:108
+#: backends/keymapper/remap-dialog.cpp:126
msgid " (Game)"
msgstr " (Gioco)"
@@ -2389,26 +2399,50 @@ msgstr "Modalitр touchpad attivata."
msgid "Touchpad mode disabled."
msgstr "Modalitр touchpad disattivata."
-#: backends/platform/sdl/macosx/appmenu_osx.mm:67
+#: backends/platform/maemo/maemo.cpp:178
+msgid "Click Mode"
+msgstr ""
+
+#: backends/platform/maemo/maemo.cpp:184
+#: backends/platform/symbian/src/SymbianActions.cpp:42
+#: backends/platform/wince/CEActionsPocket.cpp:60
+#: backends/platform/wince/CEActionsSmartphone.cpp:43
+#: backends/platform/bada/form.cpp:281
+msgid "Left Click"
+msgstr "Clic sinistro"
+
+#: backends/platform/maemo/maemo.cpp:187
+#, fuzzy
+msgid "Middle Click"
+msgstr "Oggetto al centro a sinistra"
+
+#: backends/platform/maemo/maemo.cpp:190
+#: backends/platform/symbian/src/SymbianActions.cpp:43
+#: backends/platform/wince/CEActionsSmartphone.cpp:44
+#: backends/platform/bada/form.cpp:273
+msgid "Right Click"
+msgstr "Clic destro"
+
+#: backends/platform/sdl/macosx/appmenu_osx.mm:78
msgid "Hide ScummVM"
msgstr "Nascondi ScummVM"
-#: backends/platform/sdl/macosx/appmenu_osx.mm:70
+#: backends/platform/sdl/macosx/appmenu_osx.mm:83
msgid "Hide Others"
-msgstr "Nascondi altri"
+msgstr "Nascondi altre"
-#: backends/platform/sdl/macosx/appmenu_osx.mm:74
+#: backends/platform/sdl/macosx/appmenu_osx.mm:88
msgid "Show All"
-msgstr "Mostra tutti"
+msgstr "Mostra tutte"
-#: backends/platform/sdl/macosx/appmenu_osx.mm:92
-#: backends/platform/sdl/macosx/appmenu_osx.mm:99
+#: backends/platform/sdl/macosx/appmenu_osx.mm:110
+#: backends/platform/sdl/macosx/appmenu_osx.mm:121
msgid "Window"
msgstr "Finestra"
-#: backends/platform/sdl/macosx/appmenu_osx.mm:95
+#: backends/platform/sdl/macosx/appmenu_osx.mm:115
msgid "Minimize"
-msgstr "Minimizza"
+msgstr "Contrai"
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:45
msgid "Normal (no scaling)"
@@ -2420,12 +2454,12 @@ msgid "Normal (no scaling)"
msgstr "Normale (no ridim.)"
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2147
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:537
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:533
msgid "Enabled aspect ratio correction"
msgstr "Correzione proporzioni attivata"
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2153
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:542
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:538
msgid "Disabled aspect ratio correction"
msgstr "Correzione proporzioni disattivata"
@@ -2434,7 +2468,7 @@ msgid "Active graphics filter:"
msgstr "Filtro grafico attivo:"
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2250
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:481
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:477
msgid "Windowed mode"
msgstr "Modalitр finestra"
@@ -2458,11 +2492,11 @@ msgstr "Modalitр visualizzazione attuale"
msgid "Current scale"
msgstr "Dimensioni attuali"
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:562
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:558
msgid "Active filter mode: Linear"
msgstr "Modalitр filtro attiva: Lineare"
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:564
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:560
msgid "Active filter mode: Nearest"
msgstr "Modalitр filtro attiva: Piљ vicino"
@@ -2486,19 +2520,6 @@ msgstr "Sinistra"
msgid "Right"
msgstr "Destra"
-#: backends/platform/symbian/src/SymbianActions.cpp:42
-#: backends/platform/wince/CEActionsPocket.cpp:60
-#: backends/platform/wince/CEActionsSmartphone.cpp:43
-#: backends/platform/bada/form.cpp:281
-msgid "Left Click"
-msgstr "Clic sinistro"
-
-#: backends/platform/symbian/src/SymbianActions.cpp:43
-#: backends/platform/wince/CEActionsSmartphone.cpp:44
-#: backends/platform/bada/form.cpp:273
-msgid "Right Click"
-msgstr "Clic destro"
-
#: backends/platform/symbian/src/SymbianActions.cpp:46
#: backends/platform/wince/CEActionsSmartphone.cpp:47
msgid "Zone"
@@ -2865,11 +2886,11 @@ msgstr "Mostra tastiera"
msgid "Control Mouse"
msgstr ""
-#: backends/events/maemosdl/maemosdl-events.cpp:129
+#: backends/events/maemosdl/maemosdl-events.cpp:192
msgid "Clicking Enabled"
msgstr ""
-#: backends/events/maemosdl/maemosdl-events.cpp:129
+#: backends/events/maemosdl/maemosdl-events.cpp:192
msgid "Clicking Disabled"
msgstr ""
diff --git a/po/module.mk b/po/module.mk
index ef3e0589fc..a9295656db 100644
--- a/po/module.mk
+++ b/po/module.mk
@@ -1,5 +1,6 @@
POTFILE := $(srcdir)/po/scummvm.pot
POFILES := $(wildcard $(srcdir)/po/*.po)
+CPFILES := $(wildcard $(srcdir)/po/*.cp)
updatepot:
xgettext -f $(srcdir)/po/POTFILES -D $(srcdir) -d scummvm --c++ -k_ -k_s -k_c:1,2c -k_sc:1,2c --add-comments=I18N\
@@ -34,12 +35,12 @@ updatepot:
fi;
translations-dat: devtools/create_translations
- devtools/create_translations/create_translations $(POFILES)
+ devtools/create_translations/create_translations $(POFILES) $(CPFILES)
mv translations.dat $(srcdir)/gui/themes/
-update-translations: updatepot $(POFILES) translations-dat
+update-translations: updatepot $(POFILES) $(CPFILES) translations-dat
-update-translations: updatepot $(POFILES)
+update-translations: updatepot $(POFILES) $(CPFILES)
@$(foreach file, $(POFILES), echo -n $(notdir $(basename $(file)))": ";msgfmt --statistic $(file);)
@rm -f messages.mo
diff --git a/po/nb_NO.po b/po/nb_NO.po
index 7675ca2e32..a4cf94e210 100644
--- a/po/nb_NO.po
+++ b/po/nb_NO.po
@@ -2,12 +2,12 @@
# Copyright (C) 2010-2012 ScummVM Team
# This file is distributed under the same license as the ScummVM package.
# Einar Johan T. Sјmхen <einarjohants@gmail.com>, 2010.
-#
+#
msgid ""
msgstr ""
"Project-Id-Version: ScummVM 1.3.0svn\n"
"Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n"
-"POT-Creation-Date: 2011-12-26 15:26+0100\n"
+"POT-Creation-Date: 2012-02-16 12:32+0200\n"
"PO-Revision-Date: 2011-04-25 22:56+0100\n"
"Last-Translator: Einar Johan T. Sјmхen <einarjohants@gmail.com>\n"
"Language-Team: somaen <einarjohants@gmail.com>\n"
@@ -49,7 +49,7 @@ msgstr "Gх tilbake"
#: gui/browser.cpp:69 gui/chooser.cpp:45 gui/KeysDialog.cpp:43
#: gui/launcher.cpp:319 gui/massadd.cpp:94 gui/options.cpp:1221
#: gui/saveload.cpp:63 gui/saveload.cpp:155 gui/themebrowser.cpp:54
-#: engines/engine.cpp:436 engines/scumm/dialogs.cpp:190
+#: engines/engine.cpp:438 engines/scumm/dialogs.cpp:190
#: engines/sword1/control.cpp:865 engines/parallaction/saveload.cpp:281
#: backends/platform/wii/options.cpp:48
#: backends/events/default/default-events.cpp:222
@@ -61,25 +61,30 @@ msgstr "Avbryt"
msgid "Choose"
msgstr "Velg"
-#: gui/gui-manager.cpp:116 engines/scumm/help.cpp:125
+#: gui/gui-manager.cpp:115 engines/scumm/help.cpp:125
#: engines/scumm/help.cpp:140 engines/scumm/help.cpp:165
#: engines/scumm/help.cpp:191 engines/scumm/help.cpp:209
#: backends/keymapper/remap-dialog.cpp:52
msgid "Close"
msgstr "Lukk"
-#: gui/gui-manager.cpp:119
+#: gui/gui-manager.cpp:118
msgid "Mouse click"
msgstr "Musklikk"
-#: gui/gui-manager.cpp:122 base/main.cpp:283
+#: gui/gui-manager.cpp:121 base/main.cpp:289
msgid "Display keyboard"
msgstr "Vis tastatur"
-#: gui/gui-manager.cpp:125 base/main.cpp:286
+#: gui/gui-manager.cpp:124 base/main.cpp:292
msgid "Remap keys"
msgstr "Omkoble taster"
+#: gui/gui-manager.cpp:127 base/main.cpp:295
+#, fuzzy
+msgid "Toggle FullScreen"
+msgstr "Veksle fullskjerm"
+
#: gui/KeysDialog.h:36 gui/KeysDialog.cpp:145
msgid "Choose an action to map"
msgstr "Velg en handling for kobling"
@@ -90,11 +95,11 @@ msgstr "Koble"
#: gui/KeysDialog.cpp:42 gui/launcher.cpp:320 gui/launcher.cpp:959
#: gui/launcher.cpp:963 gui/massadd.cpp:91 gui/options.cpp:1222
-#: engines/engine.cpp:359 engines/engine.cpp:370 engines/scumm/dialogs.cpp:192
-#: engines/scumm/scumm.cpp:1784 engines/agos/animation.cpp:551
+#: engines/engine.cpp:361 engines/engine.cpp:372 engines/scumm/dialogs.cpp:192
+#: engines/scumm/scumm.cpp:1775 engines/agos/animation.cpp:551
#: engines/groovie/script.cpp:420 engines/sky/compact.cpp:131
-#: engines/sky/compact.cpp:141 engines/sword1/animation.cpp:345
-#: engines/sword1/animation.cpp:355 engines/sword1/animation.cpp:361
+#: engines/sky/compact.cpp:141 engines/sword1/animation.cpp:449
+#: engines/sword1/animation.cpp:459 engines/sword1/animation.cpp:465
#: engines/sword1/control.cpp:865 engines/sword1/logic.cpp:1633
#: engines/sword2/animation.cpp:379 engines/sword2/animation.cpp:389
#: engines/sword2/animation.cpp:398 engines/parallaction/saveload.cpp:281
@@ -349,7 +354,7 @@ msgstr "Denne spill-IDen er allerede i bruk. Vennligst velg en annen."
msgid "~Q~uit"
msgstr "~A~vslutt"
-#: gui/launcher.cpp:578 backends/platform/sdl/macosx/appmenu_osx.mm:80
+#: gui/launcher.cpp:578 backends/platform/sdl/macosx/appmenu_osx.mm:96
msgid "Quit ScummVM"
msgstr "Avslutt ScummVM"
@@ -357,7 +362,7 @@ msgstr "Avslutt ScummVM"
msgid "A~b~out..."
msgstr "~O~m..."
-#: gui/launcher.cpp:579 backends/platform/sdl/macosx/appmenu_osx.mm:61
+#: gui/launcher.cpp:579 backends/platform/sdl/macosx/appmenu_osx.mm:70
msgid "About ScummVM"
msgstr "Om ScummVM"
@@ -601,7 +606,7 @@ msgstr "Spesiel dithering-modus stјttet av enkelte spill"
#: gui/options.cpp:761
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2248
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:476
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:472
msgid "Fullscreen mode"
msgstr "Fullskjermsmodus"
@@ -960,28 +965,28 @@ msgstr "Ikke navngitt spilltilstand"
msgid "Select a Theme"
msgstr "Velg et tema"
-#: gui/ThemeEngine.cpp:329
+#: gui/ThemeEngine.cpp:333
msgid "Disabled GFX"
msgstr "Deaktivert GFX"
-#: gui/ThemeEngine.cpp:329
+#: gui/ThemeEngine.cpp:333
msgctxt "lowres"
msgid "Disabled GFX"
msgstr "Deaktivert GFX"
-#: gui/ThemeEngine.cpp:330
+#: gui/ThemeEngine.cpp:334
msgid "Standard Renderer (16bpp)"
msgstr "Standard Tegner (16bpp)"
-#: gui/ThemeEngine.cpp:330
+#: gui/ThemeEngine.cpp:334
msgid "Standard (16bpp)"
msgstr "Standard (16bpp)"
-#: gui/ThemeEngine.cpp:332
+#: gui/ThemeEngine.cpp:336
msgid "Antialiased Renderer (16bpp)"
msgstr "Antialiased Tegner (16bpp)"
-#: gui/ThemeEngine.cpp:332
+#: gui/ThemeEngine.cpp:336
msgid "Antialiased (16bpp)"
msgstr "Antialiased (16bpp)"
@@ -994,30 +999,30 @@ msgstr "Tјm verdi"
msgid "Engine does not support debug level '%s'"
msgstr "Motoren stјtter ikke debug-nivх '%s'"
-#: base/main.cpp:271
+#: base/main.cpp:277
msgid "Menu"
msgstr "Meny"
-#: base/main.cpp:274 backends/platform/symbian/src/SymbianActions.cpp:45
+#: base/main.cpp:280 backends/platform/symbian/src/SymbianActions.cpp:45
#: backends/platform/wince/CEActionsPocket.cpp:45
#: backends/platform/wince/CEActionsSmartphone.cpp:46
msgid "Skip"
msgstr "Hopp over"
-#: base/main.cpp:277 backends/platform/symbian/src/SymbianActions.cpp:50
+#: base/main.cpp:283 backends/platform/symbian/src/SymbianActions.cpp:50
#: backends/platform/wince/CEActionsPocket.cpp:42
msgid "Pause"
msgstr "Pause"
-#: base/main.cpp:280
+#: base/main.cpp:286
msgid "Skip line"
msgstr "Hopp over linje"
-#: base/main.cpp:439
+#: base/main.cpp:455
msgid "Error running game:"
msgstr "Problem ved kjјring av spill:"
-#: base/main.cpp:463
+#: base/main.cpp:479
msgid "Could not find any engine capable of running the selected game"
msgstr "Kunne ikke finne noen motor som kunne kjјre det valgte spillet"
@@ -1186,25 +1191,25 @@ msgstr "~A~vbryt"
msgid "~K~eys"
msgstr "~T~aster"
-#: engines/engine.cpp:233
+#: engines/engine.cpp:235
msgid "Could not initialize color format."
msgstr ""
-#: engines/engine.cpp:241
+#: engines/engine.cpp:243
#, fuzzy
msgid "Could not switch to video mode: '"
msgstr "Nхvцrende videomodus:"
-#: engines/engine.cpp:250
+#: engines/engine.cpp:252
#, fuzzy
msgid "Could not apply aspect ratio setting."
msgstr "Veksle aspekt-rate korrigering"
-#: engines/engine.cpp:255
+#: engines/engine.cpp:257
msgid "Could not apply fullscreen setting."
msgstr ""
-#: engines/engine.cpp:355
+#: engines/engine.cpp:357
msgid ""
"You appear to be playing this game directly\n"
"from the CD. This is known to cause problems,\n"
@@ -1213,7 +1218,7 @@ msgid ""
"See the README file for details."
msgstr ""
-#: engines/engine.cpp:366
+#: engines/engine.cpp:368
msgid ""
"This game has audio tracks in its disk. These\n"
"tracks need to be ripped from the disk using\n"
@@ -1222,14 +1227,14 @@ msgid ""
"See the README file for details."
msgstr ""
-#: engines/engine.cpp:433
+#: engines/engine.cpp:435
msgid ""
"WARNING: The game you are about to start is not yet fully supported by "
"ScummVM. As such, it is likely to be unstable, and any saves you make might "
"not work in future versions of ScummVM."
msgstr ""
-#: engines/engine.cpp:436
+#: engines/engine.cpp:438
msgid "Start anyway"
msgstr ""
@@ -1889,14 +1894,14 @@ msgstr "Fly til hјyre"
msgid "Fly to lower right"
msgstr "Fly til nedre hјyre"
-#: engines/scumm/scumm.cpp:1782
+#: engines/scumm/scumm.cpp:1773
#, c-format
msgid ""
"Native MIDI support requires the Roland Upgrade from LucasArts,\n"
"but %s is missing. Using AdLib instead."
msgstr ""
-#: engines/scumm/scumm.cpp:2272 engines/agos/saveload.cpp:189
+#: engines/scumm/scumm.cpp:2271 engines/agos/saveload.cpp:189
#, c-format
msgid ""
"Failed to save game state to file:\n"
@@ -1907,7 +1912,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2279 engines/agos/saveload.cpp:154
+#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:154
#, c-format
msgid ""
"Failed to load game state from file:\n"
@@ -1918,7 +1923,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2291 engines/agos/saveload.cpp:197
+#: engines/scumm/scumm.cpp:2290 engines/agos/saveload.cpp:197
#, c-format
msgid ""
"Successfully saved game state in file:\n"
@@ -1929,7 +1934,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2506
+#: engines/scumm/scumm.cpp:2505
msgid ""
"Usually, Maniac Mansion would start now. But ScummVM doesn't do that yet. To "
"play it, go to 'Add Game' in the ScummVM start menu and select the 'Maniac' "
@@ -1980,7 +1985,7 @@ msgid "Cutscene file '%s' not found!"
msgstr ""
#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1283
-#: engines/tinsel/saveload.cpp:482
+#: engines/tinsel/saveload.cpp:500
#, fuzzy
msgid "Failed to load game state from file."
msgstr ""
@@ -1988,7 +1993,7 @@ msgstr ""
"\n"
"%s"
-#: engines/gob/inter_v2.cpp:1353 engines/tinsel/saveload.cpp:495
+#: engines/gob/inter_v2.cpp:1353 engines/tinsel/saveload.cpp:513
#, fuzzy
msgid "Failed to save game state to file."
msgstr ""
@@ -2012,56 +2017,56 @@ msgstr ""
"\n"
"%s"
-#: engines/kyra/lol.cpp:572
+#: engines/kyra/lol.cpp:478
msgid "Attack 1"
msgstr ""
-#: engines/kyra/lol.cpp:573
+#: engines/kyra/lol.cpp:479
msgid "Attack 2"
msgstr ""
-#: engines/kyra/lol.cpp:574
+#: engines/kyra/lol.cpp:480
msgid "Attack 3"
msgstr ""
-#: engines/kyra/lol.cpp:575
+#: engines/kyra/lol.cpp:481
msgid "Move Forward"
msgstr ""
-#: engines/kyra/lol.cpp:576
+#: engines/kyra/lol.cpp:482
msgid "Move Back"
msgstr ""
-#: engines/kyra/lol.cpp:577
+#: engines/kyra/lol.cpp:483
msgid "Slide Left"
msgstr ""
-#: engines/kyra/lol.cpp:578
+#: engines/kyra/lol.cpp:484
#, fuzzy
msgid "Slide Right"
msgstr "Hјyre"
-#: engines/kyra/lol.cpp:579
+#: engines/kyra/lol.cpp:485
#, fuzzy
msgid "Turn Left"
msgstr "Slх av"
-#: engines/kyra/lol.cpp:580
+#: engines/kyra/lol.cpp:486
#, fuzzy
msgid "Turn Right"
msgstr "Peker hјyre"
-#: engines/kyra/lol.cpp:581
+#: engines/kyra/lol.cpp:487
#, fuzzy
msgid "Rest"
msgstr "Gjenopprett"
-#: engines/kyra/lol.cpp:582
+#: engines/kyra/lol.cpp:488
#, fuzzy
msgid "Options"
msgstr "~V~alg"
-#: engines/kyra/lol.cpp:583
+#: engines/kyra/lol.cpp:489
#, fuzzy
msgid "Choose Spell"
msgstr "Velg"
@@ -2087,15 +2092,15 @@ msgid ""
"Please (re)download it from www.scummvm.org"
msgstr ""
-#: engines/sword1/animation.cpp:345 engines/sword2/animation.cpp:379
+#: engines/sword1/animation.cpp:449 engines/sword2/animation.cpp:379
msgid "DXA cutscenes found but ScummVM has been built without zlib support"
msgstr ""
-#: engines/sword1/animation.cpp:355 engines/sword2/animation.cpp:389
+#: engines/sword1/animation.cpp:459 engines/sword2/animation.cpp:389
msgid "MPEG2 cutscenes are no longer supported"
msgstr ""
-#: engines/sword1/animation.cpp:360 engines/sword2/animation.cpp:397
+#: engines/sword1/animation.cpp:464 engines/sword2/animation.cpp:397
#, c-format
msgid "Cutscene '%s' not found"
msgstr ""
@@ -2230,12 +2235,12 @@ msgstr "Apple II GS Emulator (IKKE IMPLEMENTERT)"
msgid "C64 Audio Emulator"
msgstr "C64 Lydemulator"
-#: audio/softsynth/mt32.cpp:329
+#: audio/softsynth/mt32.cpp:293
#, fuzzy
msgid "Initializing MT-32 Emulator"
msgstr "Initialiserer MT-32-Emulator"
-#: audio/softsynth/mt32.cpp:543
+#: audio/softsynth/mt32.cpp:512
msgid "MT-32 Emulator"
msgstr "MT-32 Emulator"
@@ -2251,15 +2256,20 @@ msgstr "IBM PCjr Emulator"
msgid "Keymap:"
msgstr "Tastkobling:"
-#: backends/keymapper/remap-dialog.cpp:64
+#: backends/keymapper/remap-dialog.cpp:66
+#, fuzzy
+msgid " (Effective)"
+msgstr " (Aktiv)"
+
+#: backends/keymapper/remap-dialog.cpp:106
msgid " (Active)"
msgstr " (Aktiv)"
-#: backends/keymapper/remap-dialog.cpp:98
+#: backends/keymapper/remap-dialog.cpp:116
msgid " (Global)"
msgstr " (Global)"
-#: backends/keymapper/remap-dialog.cpp:108
+#: backends/keymapper/remap-dialog.cpp:126
msgid " (Game)"
msgstr " (Spill)"
@@ -2357,28 +2367,51 @@ msgstr "Touchpad-modus aktivert."
msgid "Touchpad mode disabled."
msgstr "Touchpad-modus deaktivert."
-#: backends/platform/sdl/macosx/appmenu_osx.mm:67
+#: backends/platform/maemo/maemo.cpp:178
+msgid "Click Mode"
+msgstr ""
+
+#: backends/platform/maemo/maemo.cpp:184
+#: backends/platform/symbian/src/SymbianActions.cpp:42
+#: backends/platform/wince/CEActionsPocket.cpp:60
+#: backends/platform/wince/CEActionsSmartphone.cpp:43
+#: backends/platform/bada/form.cpp:281
+msgid "Left Click"
+msgstr "Venstreklikk"
+
+#: backends/platform/maemo/maemo.cpp:187
+#, fuzzy
+msgid "Middle Click"
+msgstr "Midtre venstre gjenstand"
+
+#: backends/platform/maemo/maemo.cpp:190
+#: backends/platform/symbian/src/SymbianActions.cpp:43
+#: backends/platform/wince/CEActionsSmartphone.cpp:44
+#: backends/platform/bada/form.cpp:273
+msgid "Right Click"
+msgstr "Hјyreklikk"
+
+#: backends/platform/sdl/macosx/appmenu_osx.mm:78
#, fuzzy
msgid "Hide ScummVM"
-msgstr "Avslutt ScummVM"
+msgstr "Skjul ScummVM"
-#: backends/platform/sdl/macosx/appmenu_osx.mm:70
+#: backends/platform/sdl/macosx/appmenu_osx.mm:83
msgid "Hide Others"
-msgstr ""
+msgstr "Skjul andre"
-#: backends/platform/sdl/macosx/appmenu_osx.mm:74
+#: backends/platform/sdl/macosx/appmenu_osx.mm:88
msgid "Show All"
-msgstr ""
+msgstr "Vis alle"
-#: backends/platform/sdl/macosx/appmenu_osx.mm:92
-#: backends/platform/sdl/macosx/appmenu_osx.mm:99
-#, fuzzy
+#: backends/platform/sdl/macosx/appmenu_osx.mm:110
+#: backends/platform/sdl/macosx/appmenu_osx.mm:121
msgid "Window"
-msgstr "Windows MIDI"
+msgstr "Vindu"
-#: backends/platform/sdl/macosx/appmenu_osx.mm:95
+#: backends/platform/sdl/macosx/appmenu_osx.mm:115
msgid "Minimize"
-msgstr ""
+msgstr "Minimer"
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:45
msgid "Normal (no scaling)"
@@ -2390,13 +2423,13 @@ msgid "Normal (no scaling)"
msgstr "Normal (ingen skalering)"
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2147
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:537
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:533
#, fuzzy
msgid "Enabled aspect ratio correction"
msgstr "Veksle aspekt-rate korrigering"
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2153
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:542
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:538
#, fuzzy
msgid "Disabled aspect ratio correction"
msgstr "Veksle aspekt-rate korrigering"
@@ -2407,7 +2440,7 @@ msgid "Active graphics filter:"
msgstr "Bytt grafikkfiltre"
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2250
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:481
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:477
#, fuzzy
msgid "Windowed mode"
msgstr "Tegnemodus:"
@@ -2433,11 +2466,11 @@ msgstr "Nхvцrende videomodus:"
msgid "Current scale"
msgstr ""
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:562
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:558
msgid "Active filter mode: Linear"
msgstr ""
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:564
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:560
msgid "Active filter mode: Nearest"
msgstr ""
@@ -2461,19 +2494,6 @@ msgstr "Venstre"
msgid "Right"
msgstr "Hјyre"
-#: backends/platform/symbian/src/SymbianActions.cpp:42
-#: backends/platform/wince/CEActionsPocket.cpp:60
-#: backends/platform/wince/CEActionsSmartphone.cpp:43
-#: backends/platform/bada/form.cpp:281
-msgid "Left Click"
-msgstr "Venstreklikk"
-
-#: backends/platform/symbian/src/SymbianActions.cpp:43
-#: backends/platform/wince/CEActionsSmartphone.cpp:44
-#: backends/platform/bada/form.cpp:273
-msgid "Right Click"
-msgstr "Hјyreklikk"
-
#: backends/platform/symbian/src/SymbianActions.cpp:46
#: backends/platform/wince/CEActionsSmartphone.cpp:47
msgid "Zone"
@@ -2849,11 +2869,11 @@ msgstr "Vis tastatur"
msgid "Control Mouse"
msgstr ""
-#: backends/events/maemosdl/maemosdl-events.cpp:129
+#: backends/events/maemosdl/maemosdl-events.cpp:192
msgid "Clicking Enabled"
msgstr ""
-#: backends/events/maemosdl/maemosdl-events.cpp:129
+#: backends/events/maemosdl/maemosdl-events.cpp:192
msgid "Clicking Disabled"
msgstr ""
diff --git a/po/nn_NO.po b/po/nn_NO.po
index 613e01e684..7865d6c504 100644
--- a/po/nn_NO.po
+++ b/po/nn_NO.po
@@ -2,12 +2,12 @@
# Copyright (C) 2010-2012 ScummVM Team
# This file is distributed under the same license as the ScummVM package.
# Einar Johan T. Sјmхen <einarjohants@gmail.com>, 2010.
-#
+#
msgid ""
msgstr ""
"Project-Id-Version: ScummVM 1.3.0svn\n"
"Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n"
-"POT-Creation-Date: 2011-12-26 15:26+0100\n"
+"POT-Creation-Date: 2012-02-16 12:32+0200\n"
"PO-Revision-Date: 2011-04-25 23:07+0100\n"
"Last-Translator: Einar Johan T. Sјmхen <einarjohants@gmail.com>\n"
"Language-Team: somaen <einarjohants@gmail.com>\n"
@@ -49,7 +49,7 @@ msgstr "Gх tilbake"
#: gui/browser.cpp:69 gui/chooser.cpp:45 gui/KeysDialog.cpp:43
#: gui/launcher.cpp:319 gui/massadd.cpp:94 gui/options.cpp:1221
#: gui/saveload.cpp:63 gui/saveload.cpp:155 gui/themebrowser.cpp:54
-#: engines/engine.cpp:436 engines/scumm/dialogs.cpp:190
+#: engines/engine.cpp:438 engines/scumm/dialogs.cpp:190
#: engines/sword1/control.cpp:865 engines/parallaction/saveload.cpp:281
#: backends/platform/wii/options.cpp:48
#: backends/events/default/default-events.cpp:222
@@ -61,25 +61,30 @@ msgstr "Avbryt"
msgid "Choose"
msgstr "Vel"
-#: gui/gui-manager.cpp:116 engines/scumm/help.cpp:125
+#: gui/gui-manager.cpp:115 engines/scumm/help.cpp:125
#: engines/scumm/help.cpp:140 engines/scumm/help.cpp:165
#: engines/scumm/help.cpp:191 engines/scumm/help.cpp:209
#: backends/keymapper/remap-dialog.cpp:52
msgid "Close"
msgstr "Steng"
-#: gui/gui-manager.cpp:119
+#: gui/gui-manager.cpp:118
msgid "Mouse click"
msgstr "Musklikk"
-#: gui/gui-manager.cpp:122 base/main.cpp:283
+#: gui/gui-manager.cpp:121 base/main.cpp:289
msgid "Display keyboard"
msgstr "Syn Tastatur"
-#: gui/gui-manager.cpp:125 base/main.cpp:286
+#: gui/gui-manager.cpp:124 base/main.cpp:292
msgid "Remap keys"
msgstr "Omkople tastar"
+#: gui/gui-manager.cpp:127 base/main.cpp:295
+#, fuzzy
+msgid "Toggle FullScreen"
+msgstr "Veksle fullskjerm"
+
#: gui/KeysDialog.h:36 gui/KeysDialog.cpp:145
msgid "Choose an action to map"
msgstr "Vel ei handling for kopling:"
@@ -90,11 +95,11 @@ msgstr "Kople"
#: gui/KeysDialog.cpp:42 gui/launcher.cpp:320 gui/launcher.cpp:959
#: gui/launcher.cpp:963 gui/massadd.cpp:91 gui/options.cpp:1222
-#: engines/engine.cpp:359 engines/engine.cpp:370 engines/scumm/dialogs.cpp:192
-#: engines/scumm/scumm.cpp:1784 engines/agos/animation.cpp:551
+#: engines/engine.cpp:361 engines/engine.cpp:372 engines/scumm/dialogs.cpp:192
+#: engines/scumm/scumm.cpp:1775 engines/agos/animation.cpp:551
#: engines/groovie/script.cpp:420 engines/sky/compact.cpp:131
-#: engines/sky/compact.cpp:141 engines/sword1/animation.cpp:345
-#: engines/sword1/animation.cpp:355 engines/sword1/animation.cpp:361
+#: engines/sky/compact.cpp:141 engines/sword1/animation.cpp:449
+#: engines/sword1/animation.cpp:459 engines/sword1/animation.cpp:465
#: engines/sword1/control.cpp:865 engines/sword1/logic.cpp:1633
#: engines/sword2/animation.cpp:379 engines/sword2/animation.cpp:389
#: engines/sword2/animation.cpp:398 engines/parallaction/saveload.cpp:281
@@ -349,7 +354,7 @@ msgstr ""
msgid "~Q~uit"
msgstr "~A~vslutt"
-#: gui/launcher.cpp:578 backends/platform/sdl/macosx/appmenu_osx.mm:80
+#: gui/launcher.cpp:578 backends/platform/sdl/macosx/appmenu_osx.mm:96
msgid "Quit ScummVM"
msgstr "Avslutt ScummVM"
@@ -357,7 +362,7 @@ msgstr "Avslutt ScummVM"
msgid "A~b~out..."
msgstr "~O~m..."
-#: gui/launcher.cpp:579 backends/platform/sdl/macosx/appmenu_osx.mm:61
+#: gui/launcher.cpp:579 backends/platform/sdl/macosx/appmenu_osx.mm:70
msgid "About ScummVM"
msgstr "Om ScummVM"
@@ -600,7 +605,7 @@ msgstr "Spesielle dithering-modus som stјttast av nokre spel"
#: gui/options.cpp:761
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2248
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:476
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:472
msgid "Fullscreen mode"
msgstr "Fullskjermsmodus"
@@ -957,28 +962,28 @@ msgstr "Ikkje navngjeven speltilstand"
msgid "Select a Theme"
msgstr "Vel eit tema"
-#: gui/ThemeEngine.cpp:329
+#: gui/ThemeEngine.cpp:333
msgid "Disabled GFX"
msgstr "Deaktivert GFX"
-#: gui/ThemeEngine.cpp:329
+#: gui/ThemeEngine.cpp:333
msgctxt "lowres"
msgid "Disabled GFX"
msgstr "Deaktivert GFX"
-#: gui/ThemeEngine.cpp:330
+#: gui/ThemeEngine.cpp:334
msgid "Standard Renderer (16bpp)"
msgstr "Standard Teiknar (16bpp)"
-#: gui/ThemeEngine.cpp:330
+#: gui/ThemeEngine.cpp:334
msgid "Standard (16bpp)"
msgstr "Standard (16bpp)"
-#: gui/ThemeEngine.cpp:332
+#: gui/ThemeEngine.cpp:336
msgid "Antialiased Renderer (16bpp)"
msgstr "Antialiased Teiknar (16bpp)"
-#: gui/ThemeEngine.cpp:332
+#: gui/ThemeEngine.cpp:336
msgid "Antialiased (16bpp)"
msgstr "Antialiased (16bpp)"
@@ -991,30 +996,30 @@ msgstr "Tјm verdi"
msgid "Engine does not support debug level '%s'"
msgstr "Motoren stјttar ikkje debug-nivх '%s'"
-#: base/main.cpp:271
+#: base/main.cpp:277
msgid "Menu"
msgstr "Meny"
-#: base/main.cpp:274 backends/platform/symbian/src/SymbianActions.cpp:45
+#: base/main.cpp:280 backends/platform/symbian/src/SymbianActions.cpp:45
#: backends/platform/wince/CEActionsPocket.cpp:45
#: backends/platform/wince/CEActionsSmartphone.cpp:46
msgid "Skip"
msgstr "Hopp over"
-#: base/main.cpp:277 backends/platform/symbian/src/SymbianActions.cpp:50
+#: base/main.cpp:283 backends/platform/symbian/src/SymbianActions.cpp:50
#: backends/platform/wince/CEActionsPocket.cpp:42
msgid "Pause"
msgstr "Pause"
-#: base/main.cpp:280
+#: base/main.cpp:286
msgid "Skip line"
msgstr "Hopp over linje"
-#: base/main.cpp:439
+#: base/main.cpp:455
msgid "Error running game:"
msgstr "Feil under kјyring av spel:"
-#: base/main.cpp:463
+#: base/main.cpp:479
msgid "Could not find any engine capable of running the selected game"
msgstr "Kunne ikkje finne nokon motor som kunne kјyre det velde spelet."
@@ -1186,25 +1191,25 @@ msgstr "~A~vbryt"
msgid "~K~eys"
msgstr "~T~astar"
-#: engines/engine.cpp:233
+#: engines/engine.cpp:235
msgid "Could not initialize color format."
msgstr ""
-#: engines/engine.cpp:241
+#: engines/engine.cpp:243
#, fuzzy
msgid "Could not switch to video mode: '"
msgstr "Gjeldende videomodus:"
-#: engines/engine.cpp:250
+#: engines/engine.cpp:252
#, fuzzy
msgid "Could not apply aspect ratio setting."
msgstr "Veksle aspekt-korrigering"
-#: engines/engine.cpp:255
+#: engines/engine.cpp:257
msgid "Could not apply fullscreen setting."
msgstr ""
-#: engines/engine.cpp:355
+#: engines/engine.cpp:357
msgid ""
"You appear to be playing this game directly\n"
"from the CD. This is known to cause problems,\n"
@@ -1213,7 +1218,7 @@ msgid ""
"See the README file for details."
msgstr ""
-#: engines/engine.cpp:366
+#: engines/engine.cpp:368
msgid ""
"This game has audio tracks in its disk. These\n"
"tracks need to be ripped from the disk using\n"
@@ -1222,14 +1227,14 @@ msgid ""
"See the README file for details."
msgstr ""
-#: engines/engine.cpp:433
+#: engines/engine.cpp:435
msgid ""
"WARNING: The game you are about to start is not yet fully supported by "
"ScummVM. As such, it is likely to be unstable, and any saves you make might "
"not work in future versions of ScummVM."
msgstr ""
-#: engines/engine.cpp:436
+#: engines/engine.cpp:438
msgid "Start anyway"
msgstr ""
@@ -1889,14 +1894,14 @@ msgstr "Fly til hјgre"
msgid "Fly to lower right"
msgstr "Fly til nedre hјgre"
-#: engines/scumm/scumm.cpp:1782
+#: engines/scumm/scumm.cpp:1773
#, c-format
msgid ""
"Native MIDI support requires the Roland Upgrade from LucasArts,\n"
"but %s is missing. Using AdLib instead."
msgstr ""
-#: engines/scumm/scumm.cpp:2272 engines/agos/saveload.cpp:189
+#: engines/scumm/scumm.cpp:2271 engines/agos/saveload.cpp:189
#, c-format
msgid ""
"Failed to save game state to file:\n"
@@ -1904,7 +1909,7 @@ msgid ""
"%s"
msgstr ""
-#: engines/scumm/scumm.cpp:2279 engines/agos/saveload.cpp:154
+#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:154
#, c-format
msgid ""
"Failed to load game state from file:\n"
@@ -1912,7 +1917,7 @@ msgid ""
"%s"
msgstr ""
-#: engines/scumm/scumm.cpp:2291 engines/agos/saveload.cpp:197
+#: engines/scumm/scumm.cpp:2290 engines/agos/saveload.cpp:197
#, c-format
msgid ""
"Successfully saved game state in file:\n"
@@ -1920,7 +1925,7 @@ msgid ""
"%s"
msgstr ""
-#: engines/scumm/scumm.cpp:2506
+#: engines/scumm/scumm.cpp:2505
msgid ""
"Usually, Maniac Mansion would start now. But ScummVM doesn't do that yet. To "
"play it, go to 'Add Game' in the ScummVM start menu and select the 'Maniac' "
@@ -1971,11 +1976,11 @@ msgid "Cutscene file '%s' not found!"
msgstr ""
#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1283
-#: engines/tinsel/saveload.cpp:482
+#: engines/tinsel/saveload.cpp:500
msgid "Failed to load game state from file."
msgstr ""
-#: engines/gob/inter_v2.cpp:1353 engines/tinsel/saveload.cpp:495
+#: engines/gob/inter_v2.cpp:1353 engines/tinsel/saveload.cpp:513
msgid "Failed to save game state to file."
msgstr ""
@@ -1988,56 +1993,56 @@ msgstr ""
msgid "Failed to save game"
msgstr "Full speltittel:"
-#: engines/kyra/lol.cpp:572
+#: engines/kyra/lol.cpp:478
msgid "Attack 1"
msgstr ""
-#: engines/kyra/lol.cpp:573
+#: engines/kyra/lol.cpp:479
msgid "Attack 2"
msgstr ""
-#: engines/kyra/lol.cpp:574
+#: engines/kyra/lol.cpp:480
msgid "Attack 3"
msgstr ""
-#: engines/kyra/lol.cpp:575
+#: engines/kyra/lol.cpp:481
msgid "Move Forward"
msgstr ""
-#: engines/kyra/lol.cpp:576
+#: engines/kyra/lol.cpp:482
msgid "Move Back"
msgstr ""
-#: engines/kyra/lol.cpp:577
+#: engines/kyra/lol.cpp:483
msgid "Slide Left"
msgstr ""
-#: engines/kyra/lol.cpp:578
+#: engines/kyra/lol.cpp:484
#, fuzzy
msgid "Slide Right"
msgstr "Hјgre"
-#: engines/kyra/lol.cpp:579
+#: engines/kyra/lol.cpp:485
#, fuzzy
msgid "Turn Left"
msgstr "Slх av"
-#: engines/kyra/lol.cpp:580
+#: engines/kyra/lol.cpp:486
#, fuzzy
msgid "Turn Right"
msgstr "Peikar hјgre"
-#: engines/kyra/lol.cpp:581
+#: engines/kyra/lol.cpp:487
#, fuzzy
msgid "Rest"
msgstr "Gjenopprett"
-#: engines/kyra/lol.cpp:582
+#: engines/kyra/lol.cpp:488
#, fuzzy
msgid "Options"
msgstr "~V~al"
-#: engines/kyra/lol.cpp:583
+#: engines/kyra/lol.cpp:489
#, fuzzy
msgid "Choose Spell"
msgstr "Vel"
@@ -2063,15 +2068,15 @@ msgid ""
"Please (re)download it from www.scummvm.org"
msgstr ""
-#: engines/sword1/animation.cpp:345 engines/sword2/animation.cpp:379
+#: engines/sword1/animation.cpp:449 engines/sword2/animation.cpp:379
msgid "DXA cutscenes found but ScummVM has been built without zlib support"
msgstr ""
-#: engines/sword1/animation.cpp:355 engines/sword2/animation.cpp:389
+#: engines/sword1/animation.cpp:459 engines/sword2/animation.cpp:389
msgid "MPEG2 cutscenes are no longer supported"
msgstr ""
-#: engines/sword1/animation.cpp:360 engines/sword2/animation.cpp:397
+#: engines/sword1/animation.cpp:464 engines/sword2/animation.cpp:397
#, c-format
msgid "Cutscene '%s' not found"
msgstr ""
@@ -2206,12 +2211,12 @@ msgstr "Apple II GS Emulator (IKKJE IMPLEMENTERT)"
msgid "C64 Audio Emulator"
msgstr "C64 Lydemulator"
-#: audio/softsynth/mt32.cpp:329
+#: audio/softsynth/mt32.cpp:293
#, fuzzy
msgid "Initializing MT-32 Emulator"
msgstr "Initialiserar MT-32-emulator"
-#: audio/softsynth/mt32.cpp:543
+#: audio/softsynth/mt32.cpp:512
msgid "MT-32 Emulator"
msgstr "MT-32 Emulator"
@@ -2227,15 +2232,20 @@ msgstr "IBM PCjr Emulator"
msgid "Keymap:"
msgstr "Tastkopling:"
-#: backends/keymapper/remap-dialog.cpp:64
+#: backends/keymapper/remap-dialog.cpp:66
+#, fuzzy
+msgid " (Effective)"
+msgstr " (Aktivt)"
+
+#: backends/keymapper/remap-dialog.cpp:106
msgid " (Active)"
msgstr " (Aktivt)"
-#: backends/keymapper/remap-dialog.cpp:98
+#: backends/keymapper/remap-dialog.cpp:116
msgid " (Global)"
msgstr " (Global)"
-#: backends/keymapper/remap-dialog.cpp:108
+#: backends/keymapper/remap-dialog.cpp:126
msgid " (Game)"
msgstr " (Spel)"
@@ -2331,26 +2341,49 @@ msgstr ""
msgid "Touchpad mode disabled."
msgstr ""
-#: backends/platform/sdl/macosx/appmenu_osx.mm:67
+#: backends/platform/maemo/maemo.cpp:178
+msgid "Click Mode"
+msgstr ""
+
+#: backends/platform/maemo/maemo.cpp:184
+#: backends/platform/symbian/src/SymbianActions.cpp:42
+#: backends/platform/wince/CEActionsPocket.cpp:60
+#: backends/platform/wince/CEActionsSmartphone.cpp:43
+#: backends/platform/bada/form.cpp:281
+msgid "Left Click"
+msgstr "Venstreklikk"
+
+#: backends/platform/maemo/maemo.cpp:187
+#, fuzzy
+msgid "Middle Click"
+msgstr "Midtre venstre gjenstand"
+
+#: backends/platform/maemo/maemo.cpp:190
+#: backends/platform/symbian/src/SymbianActions.cpp:43
+#: backends/platform/wince/CEActionsSmartphone.cpp:44
+#: backends/platform/bada/form.cpp:273
+msgid "Right Click"
+msgstr "Hјgreklikk"
+
+#: backends/platform/sdl/macosx/appmenu_osx.mm:78
#, fuzzy
msgid "Hide ScummVM"
msgstr "Avslutt ScummVM"
-#: backends/platform/sdl/macosx/appmenu_osx.mm:70
+#: backends/platform/sdl/macosx/appmenu_osx.mm:83
msgid "Hide Others"
msgstr ""
-#: backends/platform/sdl/macosx/appmenu_osx.mm:74
+#: backends/platform/sdl/macosx/appmenu_osx.mm:88
msgid "Show All"
msgstr ""
-#: backends/platform/sdl/macosx/appmenu_osx.mm:92
-#: backends/platform/sdl/macosx/appmenu_osx.mm:99
-#, fuzzy
+#: backends/platform/sdl/macosx/appmenu_osx.mm:110
+#: backends/platform/sdl/macosx/appmenu_osx.mm:121
msgid "Window"
-msgstr "Windows MIDI"
+msgstr ""
-#: backends/platform/sdl/macosx/appmenu_osx.mm:95
+#: backends/platform/sdl/macosx/appmenu_osx.mm:115
msgid "Minimize"
msgstr ""
@@ -2364,13 +2397,13 @@ msgid "Normal (no scaling)"
msgstr "Normal (inga skalering)"
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2147
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:537
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:533
#, fuzzy
msgid "Enabled aspect ratio correction"
msgstr "Veksle aspekt-korrigering"
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2153
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:542
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:538
#, fuzzy
msgid "Disabled aspect ratio correction"
msgstr "Veksle aspekt-korrigering"
@@ -2381,7 +2414,7 @@ msgid "Active graphics filter:"
msgstr "Veksle grafikkfiltre"
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2250
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:481
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:477
#, fuzzy
msgid "Windowed mode"
msgstr "Teiknemodus:"
@@ -2407,11 +2440,11 @@ msgstr "Gjeldende videomodus:"
msgid "Current scale"
msgstr ""
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:562
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:558
msgid "Active filter mode: Linear"
msgstr ""
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:564
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:560
msgid "Active filter mode: Nearest"
msgstr ""
@@ -2435,19 +2468,6 @@ msgstr "Venstre"
msgid "Right"
msgstr "Hјgre"
-#: backends/platform/symbian/src/SymbianActions.cpp:42
-#: backends/platform/wince/CEActionsPocket.cpp:60
-#: backends/platform/wince/CEActionsSmartphone.cpp:43
-#: backends/platform/bada/form.cpp:281
-msgid "Left Click"
-msgstr "Venstreklikk"
-
-#: backends/platform/symbian/src/SymbianActions.cpp:43
-#: backends/platform/wince/CEActionsSmartphone.cpp:44
-#: backends/platform/bada/form.cpp:273
-msgid "Right Click"
-msgstr "Hјgreklikk"
-
#: backends/platform/symbian/src/SymbianActions.cpp:46
#: backends/platform/wince/CEActionsSmartphone.cpp:47
msgid "Zone"
@@ -2820,11 +2840,11 @@ msgstr "Syn tastatur"
msgid "Control Mouse"
msgstr ""
-#: backends/events/maemosdl/maemosdl-events.cpp:129
+#: backends/events/maemosdl/maemosdl-events.cpp:192
msgid "Clicking Enabled"
msgstr ""
-#: backends/events/maemosdl/maemosdl-events.cpp:129
+#: backends/events/maemosdl/maemosdl-events.cpp:192
msgid "Clicking Disabled"
msgstr ""
diff --git a/po/pl_PL.po b/po/pl_PL.po
index dc6dbb3165..36aad63180 100644
--- a/po/pl_PL.po
+++ b/po/pl_PL.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ScummVM 1.3.0\n"
"Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n"
-"POT-Creation-Date: 2011-12-26 15:26+0100\n"
+"POT-Creation-Date: 2012-02-16 12:32+0200\n"
"PO-Revision-Date: 2011-10-24 21:14+0100\n"
"Last-Translator: MichaГ ZiБbkowski <mziab@o2.pl>\n"
"Language-Team: Grajpopolsku.pl <grajpopolsku@gmail.com>\n"
@@ -49,7 +49,7 @@ msgstr "W gѓrъ"
#: gui/browser.cpp:69 gui/chooser.cpp:45 gui/KeysDialog.cpp:43
#: gui/launcher.cpp:319 gui/massadd.cpp:94 gui/options.cpp:1221
#: gui/saveload.cpp:63 gui/saveload.cpp:155 gui/themebrowser.cpp:54
-#: engines/engine.cpp:436 engines/scumm/dialogs.cpp:190
+#: engines/engine.cpp:438 engines/scumm/dialogs.cpp:190
#: engines/sword1/control.cpp:865 engines/parallaction/saveload.cpp:281
#: backends/platform/wii/options.cpp:48
#: backends/events/default/default-events.cpp:222
@@ -61,25 +61,30 @@ msgstr "Anuluj"
msgid "Choose"
msgstr "Wybierz"
-#: gui/gui-manager.cpp:116 engines/scumm/help.cpp:125
+#: gui/gui-manager.cpp:115 engines/scumm/help.cpp:125
#: engines/scumm/help.cpp:140 engines/scumm/help.cpp:165
#: engines/scumm/help.cpp:191 engines/scumm/help.cpp:209
#: backends/keymapper/remap-dialog.cpp:52
msgid "Close"
msgstr "Zamknij"
-#: gui/gui-manager.cpp:119
+#: gui/gui-manager.cpp:118
msgid "Mouse click"
msgstr "Klikniъcie"
-#: gui/gui-manager.cpp:122 base/main.cpp:283
+#: gui/gui-manager.cpp:121 base/main.cpp:289
msgid "Display keyboard"
msgstr "WyЖwietl klawiaturъ"
-#: gui/gui-manager.cpp:125 base/main.cpp:286
+#: gui/gui-manager.cpp:124 base/main.cpp:292
msgid "Remap keys"
msgstr "Dostosuj klawisze"
+#: gui/gui-manager.cpp:127 base/main.cpp:295
+#, fuzzy
+msgid "Toggle FullScreen"
+msgstr "WГБcz/wyГБcz peГny ekran"
+
#: gui/KeysDialog.h:36 gui/KeysDialog.cpp:145
msgid "Choose an action to map"
msgstr "Wybierz akcjъ do przypisania"
@@ -90,11 +95,11 @@ msgstr "Przypisz"
#: gui/KeysDialog.cpp:42 gui/launcher.cpp:320 gui/launcher.cpp:959
#: gui/launcher.cpp:963 gui/massadd.cpp:91 gui/options.cpp:1222
-#: engines/engine.cpp:359 engines/engine.cpp:370 engines/scumm/dialogs.cpp:192
-#: engines/scumm/scumm.cpp:1784 engines/agos/animation.cpp:551
+#: engines/engine.cpp:361 engines/engine.cpp:372 engines/scumm/dialogs.cpp:192
+#: engines/scumm/scumm.cpp:1775 engines/agos/animation.cpp:551
#: engines/groovie/script.cpp:420 engines/sky/compact.cpp:131
-#: engines/sky/compact.cpp:141 engines/sword1/animation.cpp:345
-#: engines/sword1/animation.cpp:355 engines/sword1/animation.cpp:361
+#: engines/sky/compact.cpp:141 engines/sword1/animation.cpp:449
+#: engines/sword1/animation.cpp:459 engines/sword1/animation.cpp:465
#: engines/sword1/control.cpp:865 engines/sword1/logic.cpp:1633
#: engines/sword2/animation.cpp:379 engines/sword2/animation.cpp:389
#: engines/sword2/animation.cpp:398 engines/parallaction/saveload.cpp:281
@@ -347,7 +352,7 @@ msgstr "Identyfikator jest juП zajъty. Wybierz inny."
msgid "~Q~uit"
msgstr "~Z~akoёcz"
-#: gui/launcher.cpp:578 backends/platform/sdl/macosx/appmenu_osx.mm:80
+#: gui/launcher.cpp:578 backends/platform/sdl/macosx/appmenu_osx.mm:96
msgid "Quit ScummVM"
msgstr "Zakoёcz ScummVM"
@@ -355,9 +360,9 @@ msgstr "Zakoёcz ScummVM"
msgid "A~b~out..."
msgstr "I~n~formacje..."
-#: gui/launcher.cpp:579 backends/platform/sdl/macosx/appmenu_osx.mm:61
+#: gui/launcher.cpp:579 backends/platform/sdl/macosx/appmenu_osx.mm:70
msgid "About ScummVM"
-msgstr "O ScummVM"
+msgstr "KsiБПka ScummVM"
#: gui/launcher.cpp:580
msgid "~O~ptions..."
@@ -597,7 +602,7 @@ msgstr "Specjalne tryby ditheringu wspierane przez niektѓre gry"
#: gui/options.cpp:761
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2248
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:476
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:472
msgid "Fullscreen mode"
msgstr "PeГny ekran"
@@ -959,28 +964,28 @@ msgstr "Zapis bez nazwy"
msgid "Select a Theme"
msgstr "Wybierz styl"
-#: gui/ThemeEngine.cpp:329
+#: gui/ThemeEngine.cpp:333
msgid "Disabled GFX"
msgstr "WyГБczona grafika"
-#: gui/ThemeEngine.cpp:329
+#: gui/ThemeEngine.cpp:333
msgctxt "lowres"
msgid "Disabled GFX"
msgstr "WyГБczona grafika"
-#: gui/ThemeEngine.cpp:330
+#: gui/ThemeEngine.cpp:334
msgid "Standard Renderer (16bpp)"
msgstr "Standardowy renderer (16bpp)"
-#: gui/ThemeEngine.cpp:330
+#: gui/ThemeEngine.cpp:334
msgid "Standard (16bpp)"
msgstr "Standardowy (16bpp)"
-#: gui/ThemeEngine.cpp:332
+#: gui/ThemeEngine.cpp:336
msgid "Antialiased Renderer (16bpp)"
msgstr "WygГadzany renderer (16bpp)"
-#: gui/ThemeEngine.cpp:332
+#: gui/ThemeEngine.cpp:336
msgid "Antialiased (16bpp)"
msgstr "WygГadzany (16bpp)"
@@ -993,30 +998,30 @@ msgstr "WyczyЖц"
msgid "Engine does not support debug level '%s'"
msgstr "Silnik nie wspiera poziomu debugowania '%s'"
-#: base/main.cpp:271
+#: base/main.cpp:277
msgid "Menu"
msgstr "Menu"
-#: base/main.cpp:274 backends/platform/symbian/src/SymbianActions.cpp:45
+#: base/main.cpp:280 backends/platform/symbian/src/SymbianActions.cpp:45
#: backends/platform/wince/CEActionsPocket.cpp:45
#: backends/platform/wince/CEActionsSmartphone.cpp:46
msgid "Skip"
msgstr "Pomiё"
-#: base/main.cpp:277 backends/platform/symbian/src/SymbianActions.cpp:50
+#: base/main.cpp:283 backends/platform/symbian/src/SymbianActions.cpp:50
#: backends/platform/wince/CEActionsPocket.cpp:42
msgid "Pause"
msgstr "Wstrzymaj"
-#: base/main.cpp:280
+#: base/main.cpp:286
msgid "Skip line"
msgstr "Pomiё liniъ"
-#: base/main.cpp:439
+#: base/main.cpp:455
msgid "Error running game:"
msgstr "BГБd podczas uruchamiania gry:"
-#: base/main.cpp:463
+#: base/main.cpp:479
msgid "Could not find any engine capable of running the selected game"
msgstr "Nie udaГo siъ znaleМц silnika zdolnego do uruchomienia zaznaczonej gry"
@@ -1188,23 +1193,23 @@ msgstr "~A~nuluj"
msgid "~K~eys"
msgstr "~K~lawisze"
-#: engines/engine.cpp:233
+#: engines/engine.cpp:235
msgid "Could not initialize color format."
msgstr "Nie udaГo siъ zainicjalizowaц formatu kolorѓw."
-#: engines/engine.cpp:241
+#: engines/engine.cpp:243
msgid "Could not switch to video mode: '"
msgstr "Nie udaГo siъ przeГБczyц w tryb wideo: '"
-#: engines/engine.cpp:250
+#: engines/engine.cpp:252
msgid "Could not apply aspect ratio setting."
msgstr "Nie udaГo siъ zastosowaц ustawienia formatu obrazu."
-#: engines/engine.cpp:255
+#: engines/engine.cpp:257
msgid "Could not apply fullscreen setting."
msgstr "Nie udaГo siъ zastosowaц ustawienia peГnego ekranu."
-#: engines/engine.cpp:355
+#: engines/engine.cpp:357
msgid ""
"You appear to be playing this game directly\n"
"from the CD. This is known to cause problems,\n"
@@ -1216,7 +1221,7 @@ msgstr ""
"znane problemѓw. StБd zalecane jest skopiowanie plikѓw gry na twardy dysk.\n"
"Dalsze informacje sБ dostъpne w pliku README."
-#: engines/engine.cpp:366
+#: engines/engine.cpp:368
msgid ""
"This game has audio tracks in its disk. These\n"
"tracks need to be ripped from the disk using\n"
@@ -1228,7 +1233,7 @@ msgstr ""
"skopiowaц na dysk za pomocБ odpowiedniego rippera CD audio.\n"
"Dalsze informacje sБ dostъpne w pliku README."
-#: engines/engine.cpp:433
+#: engines/engine.cpp:435
msgid ""
"WARNING: The game you are about to start is not yet fully supported by "
"ScummVM. As such, it is likely to be unstable, and any saves you make might "
@@ -1238,7 +1243,7 @@ msgstr ""
"ScummVM. W zwiБzku z tym moПe byц ona niestabilna, a wszelkie zapisy, "
"ktѓrych dokonasz, mogБ byц nieobsГugiwane w przyszГych wersjach ScummVM."
-#: engines/engine.cpp:436
+#: engines/engine.cpp:438
msgid "Start anyway"
msgstr "WГБcz mimo tego"
@@ -1890,7 +1895,7 @@ msgstr "Leц w prawo"
msgid "Fly to lower right"
msgstr "Leц w dѓГ, w prawo"
-#: engines/scumm/scumm.cpp:1782
+#: engines/scumm/scumm.cpp:1773
#, c-format
msgid ""
"Native MIDI support requires the Roland Upgrade from LucasArts,\n"
@@ -1899,7 +1904,7 @@ msgstr ""
"Natywne wsparcie MIDI wymaga aktualizacji Rolanda od LucasArts,\n"
"ale brakuje %s. PrzeГБczam na tryb AdLib."
-#: engines/scumm/scumm.cpp:2272 engines/agos/saveload.cpp:189
+#: engines/scumm/scumm.cpp:2271 engines/agos/saveload.cpp:189
#, c-format
msgid ""
"Failed to save game state to file:\n"
@@ -1910,7 +1915,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2279 engines/agos/saveload.cpp:154
+#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:154
#, c-format
msgid ""
"Failed to load game state from file:\n"
@@ -1921,7 +1926,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2291 engines/agos/saveload.cpp:197
+#: engines/scumm/scumm.cpp:2290 engines/agos/saveload.cpp:197
#, c-format
msgid ""
"Successfully saved game state in file:\n"
@@ -1932,7 +1937,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2506
+#: engines/scumm/scumm.cpp:2505
msgid ""
"Usually, Maniac Mansion would start now. But ScummVM doesn't do that yet. To "
"play it, go to 'Add Game' in the ScummVM start menu and select the 'Maniac' "
@@ -1982,11 +1987,11 @@ msgid "Cutscene file '%s' not found!"
msgstr "Nie znaleziono pliku przerywnika '%s'!"
#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1283
-#: engines/tinsel/saveload.cpp:482
+#: engines/tinsel/saveload.cpp:500
msgid "Failed to load game state from file."
msgstr "Nie udaГo siъ wczytaц stanu gry z pliku."
-#: engines/gob/inter_v2.cpp:1353 engines/tinsel/saveload.cpp:495
+#: engines/gob/inter_v2.cpp:1353 engines/tinsel/saveload.cpp:513
msgid "Failed to save game state to file."
msgstr "Nie udaГo siъ zapisaц stanu gry do pliku."
@@ -1998,56 +2003,56 @@ msgstr "Nie udaГo siъ usunБц pliku."
msgid "Failed to save game"
msgstr "Nie udaГo siъ zapisaц stanu gry"
-#: engines/kyra/lol.cpp:572
+#: engines/kyra/lol.cpp:478
msgid "Attack 1"
msgstr ""
-#: engines/kyra/lol.cpp:573
+#: engines/kyra/lol.cpp:479
msgid "Attack 2"
msgstr ""
-#: engines/kyra/lol.cpp:574
+#: engines/kyra/lol.cpp:480
msgid "Attack 3"
msgstr ""
-#: engines/kyra/lol.cpp:575
+#: engines/kyra/lol.cpp:481
msgid "Move Forward"
msgstr ""
-#: engines/kyra/lol.cpp:576
+#: engines/kyra/lol.cpp:482
msgid "Move Back"
msgstr ""
-#: engines/kyra/lol.cpp:577
+#: engines/kyra/lol.cpp:483
msgid "Slide Left"
msgstr ""
-#: engines/kyra/lol.cpp:578
+#: engines/kyra/lol.cpp:484
#, fuzzy
msgid "Slide Right"
msgstr "W prawo"
-#: engines/kyra/lol.cpp:579
+#: engines/kyra/lol.cpp:485
#, fuzzy
msgid "Turn Left"
msgstr "WyГБcz"
-#: engines/kyra/lol.cpp:580
+#: engines/kyra/lol.cpp:486
#, fuzzy
msgid "Turn Right"
msgstr "Kursor w prawo"
-#: engines/kyra/lol.cpp:581
+#: engines/kyra/lol.cpp:487
#, fuzzy
msgid "Rest"
msgstr "Wznѓw"
-#: engines/kyra/lol.cpp:582
+#: engines/kyra/lol.cpp:488
#, fuzzy
msgid "Options"
msgstr "~O~pcje"
-#: engines/kyra/lol.cpp:583
+#: engines/kyra/lol.cpp:489
#, fuzzy
msgid "Choose Spell"
msgstr "Wybierz"
@@ -2081,17 +2086,17 @@ msgstr ""
"Plik \"sky.cpt\" ma nieprawidГowy rozmiar.\n"
"Pobierz go (ponownie) ze strony www.scummvm.org"
-#: engines/sword1/animation.cpp:345 engines/sword2/animation.cpp:379
+#: engines/sword1/animation.cpp:449 engines/sword2/animation.cpp:379
msgid "DXA cutscenes found but ScummVM has been built without zlib support"
msgstr ""
"Znaleziono przerywniki w formacie DXA, ale ScummVM jest skompilowany bez "
"obsГugi zlib"
-#: engines/sword1/animation.cpp:355 engines/sword2/animation.cpp:389
+#: engines/sword1/animation.cpp:459 engines/sword2/animation.cpp:389
msgid "MPEG2 cutscenes are no longer supported"
msgstr "Przerywniki w formacie MPEG2 nie sБ juП obsГugiwane"
-#: engines/sword1/animation.cpp:360 engines/sword2/animation.cpp:397
+#: engines/sword1/animation.cpp:464 engines/sword2/animation.cpp:397
#, c-format
msgid "Cutscene '%s' not found"
msgstr "Nie znaleziono przerywnika '%s'"
@@ -2253,11 +2258,11 @@ msgstr "Emulator Apple II GS (NIE ZAIMPLEMENTOWANY)"
msgid "C64 Audio Emulator"
msgstr "Emulator dМwiъku C64"
-#: audio/softsynth/mt32.cpp:329
+#: audio/softsynth/mt32.cpp:293
msgid "Initializing MT-32 Emulator"
msgstr "Inicjalizacja emulatora MT-32"
-#: audio/softsynth/mt32.cpp:543
+#: audio/softsynth/mt32.cpp:512
msgid "MT-32 Emulator"
msgstr "Emulator MT-32"
@@ -2273,15 +2278,20 @@ msgstr "Emulator IBM PCjr"
msgid "Keymap:"
msgstr "Klawisze:"
-#: backends/keymapper/remap-dialog.cpp:64
+#: backends/keymapper/remap-dialog.cpp:66
+#, fuzzy
+msgid " (Effective)"
+msgstr " (Aktywny)"
+
+#: backends/keymapper/remap-dialog.cpp:106
msgid " (Active)"
msgstr " (Aktywny)"
-#: backends/keymapper/remap-dialog.cpp:98
+#: backends/keymapper/remap-dialog.cpp:116
msgid " (Global)"
msgstr " (Globalny)"
-#: backends/keymapper/remap-dialog.cpp:108
+#: backends/keymapper/remap-dialog.cpp:126
msgid " (Game)"
msgstr " (Gra)"
@@ -2377,26 +2387,50 @@ msgstr "Tryb touchpada wГБczony."
msgid "Touchpad mode disabled."
msgstr "Tryb touchpada wyГБczony."
-#: backends/platform/sdl/macosx/appmenu_osx.mm:67
+#: backends/platform/maemo/maemo.cpp:178
+msgid "Click Mode"
+msgstr ""
+
+#: backends/platform/maemo/maemo.cpp:184
+#: backends/platform/symbian/src/SymbianActions.cpp:42
+#: backends/platform/wince/CEActionsPocket.cpp:60
+#: backends/platform/wince/CEActionsSmartphone.cpp:43
+#: backends/platform/bada/form.cpp:281
+msgid "Left Click"
+msgstr "Klikniъcie LPM"
+
+#: backends/platform/maemo/maemo.cpp:187
+#, fuzzy
+msgid "Middle Click"
+msgstr "Przedmiot na Жrodku, z lewej"
+
+#: backends/platform/maemo/maemo.cpp:190
+#: backends/platform/symbian/src/SymbianActions.cpp:43
+#: backends/platform/wince/CEActionsSmartphone.cpp:44
+#: backends/platform/bada/form.cpp:273
+msgid "Right Click"
+msgstr "Klikniъcie PPM"
+
+#: backends/platform/sdl/macosx/appmenu_osx.mm:78
msgid "Hide ScummVM"
-msgstr "Schowaj ScummVM"
+msgstr "Ukryj ScummVM"
-#: backends/platform/sdl/macosx/appmenu_osx.mm:70
+#: backends/platform/sdl/macosx/appmenu_osx.mm:83
msgid "Hide Others"
-msgstr "Schowaj pozostaГe"
+msgstr "Ukryj pozostaГe"
-#: backends/platform/sdl/macosx/appmenu_osx.mm:74
+#: backends/platform/sdl/macosx/appmenu_osx.mm:88
msgid "Show All"
msgstr "PokaП wszystkie"
-#: backends/platform/sdl/macosx/appmenu_osx.mm:92
-#: backends/platform/sdl/macosx/appmenu_osx.mm:99
+#: backends/platform/sdl/macosx/appmenu_osx.mm:110
+#: backends/platform/sdl/macosx/appmenu_osx.mm:121
msgid "Window"
msgstr "Okno"
-#: backends/platform/sdl/macosx/appmenu_osx.mm:95
+#: backends/platform/sdl/macosx/appmenu_osx.mm:115
msgid "Minimize"
-msgstr "Minimalizuj"
+msgstr "Miniaturka"
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:45
msgid "Normal (no scaling)"
@@ -2408,12 +2442,12 @@ msgid "Normal (no scaling)"
msgstr "ZwykГy (bez skalowania)"
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2147
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:537
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:533
msgid "Enabled aspect ratio correction"
msgstr "WГБczono korekcjъ formatu obrazu"
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2153
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:542
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:538
msgid "Disabled aspect ratio correction"
msgstr "WyГБczono korekcjъ formatu obrazu"
@@ -2422,7 +2456,7 @@ msgid "Active graphics filter:"
msgstr "Aktywny filtr graficzny:"
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2250
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:481
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:477
msgid "Windowed mode"
msgstr "Okno"
@@ -2446,11 +2480,11 @@ msgstr "Obecny tryb wideo"
msgid "Current scale"
msgstr "Aktualne powiъkszenie"
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:562
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:558
msgid "Active filter mode: Linear"
msgstr "Aktywny tryb filtru: dwuliniowy"
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:564
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:560
msgid "Active filter mode: Nearest"
msgstr "Aktywny tryb filtru: najbliПszy sБsiad"
@@ -2474,19 +2508,6 @@ msgstr "W lewo"
msgid "Right"
msgstr "W prawo"
-#: backends/platform/symbian/src/SymbianActions.cpp:42
-#: backends/platform/wince/CEActionsPocket.cpp:60
-#: backends/platform/wince/CEActionsSmartphone.cpp:43
-#: backends/platform/bada/form.cpp:281
-msgid "Left Click"
-msgstr "Klikniъcie LPM"
-
-#: backends/platform/symbian/src/SymbianActions.cpp:43
-#: backends/platform/wince/CEActionsSmartphone.cpp:44
-#: backends/platform/bada/form.cpp:273
-msgid "Right Click"
-msgstr "Klikniъcie PPM"
-
#: backends/platform/symbian/src/SymbianActions.cpp:46
#: backends/platform/wince/CEActionsSmartphone.cpp:47
msgid "Zone"
@@ -2847,11 +2868,11 @@ msgstr "PokaП klawiaturъ"
msgid "Control Mouse"
msgstr "Steruj myszkБ"
-#: backends/events/maemosdl/maemosdl-events.cpp:129
+#: backends/events/maemosdl/maemosdl-events.cpp:192
msgid "Clicking Enabled"
msgstr "Klikanie wГБczone"
-#: backends/events/maemosdl/maemosdl-events.cpp:129
+#: backends/events/maemosdl/maemosdl-events.cpp:192
msgid "Clicking Disabled"
msgstr "Klikanie wyГБczone"
diff --git a/po/pt_BR.po b/po/pt_BR.po
index 46eed0c553..34ce904f25 100644
--- a/po/pt_BR.po
+++ b/po/pt_BR.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ScummVM 1.3.0svn\n"
"Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n"
-"POT-Creation-Date: 2011-12-26 15:26+0100\n"
+"POT-Creation-Date: 2012-02-16 12:32+0200\n"
"PO-Revision-Date: 2011-10-21 21:30-0300\n"
"Last-Translator: Saulo Benigno <saulobenigno@gmail.com>\n"
"Language-Team: ScummBR (www.scummbr.com) <scummbr@yahoo.com.br>\n"
@@ -49,7 +49,7 @@ msgstr "Acima"
#: gui/browser.cpp:69 gui/chooser.cpp:45 gui/KeysDialog.cpp:43
#: gui/launcher.cpp:319 gui/massadd.cpp:94 gui/options.cpp:1221
#: gui/saveload.cpp:63 gui/saveload.cpp:155 gui/themebrowser.cpp:54
-#: engines/engine.cpp:436 engines/scumm/dialogs.cpp:190
+#: engines/engine.cpp:438 engines/scumm/dialogs.cpp:190
#: engines/sword1/control.cpp:865 engines/parallaction/saveload.cpp:281
#: backends/platform/wii/options.cpp:48
#: backends/events/default/default-events.cpp:222
@@ -61,25 +61,30 @@ msgstr "Cancelar"
msgid "Choose"
msgstr "Escolher"
-#: gui/gui-manager.cpp:116 engines/scumm/help.cpp:125
+#: gui/gui-manager.cpp:115 engines/scumm/help.cpp:125
#: engines/scumm/help.cpp:140 engines/scumm/help.cpp:165
#: engines/scumm/help.cpp:191 engines/scumm/help.cpp:209
#: backends/keymapper/remap-dialog.cpp:52
msgid "Close"
msgstr "Fechar"
-#: gui/gui-manager.cpp:119
+#: gui/gui-manager.cpp:118
msgid "Mouse click"
msgstr "Clique do mouse"
-#: gui/gui-manager.cpp:122 base/main.cpp:283
+#: gui/gui-manager.cpp:121 base/main.cpp:289
msgid "Display keyboard"
msgstr "Mostrar teclado"
-#: gui/gui-manager.cpp:125 base/main.cpp:286
+#: gui/gui-manager.cpp:124 base/main.cpp:292
msgid "Remap keys"
msgstr "Remapear teclas"
+#: gui/gui-manager.cpp:127 base/main.cpp:295
+#, fuzzy
+msgid "Toggle FullScreen"
+msgstr "Habilita Tela Cheia"
+
#: gui/KeysDialog.h:36 gui/KeysDialog.cpp:145
msgid "Choose an action to map"
msgstr "Selecione uma aчуo para mapear"
@@ -90,11 +95,11 @@ msgstr "Mapear"
#: gui/KeysDialog.cpp:42 gui/launcher.cpp:320 gui/launcher.cpp:959
#: gui/launcher.cpp:963 gui/massadd.cpp:91 gui/options.cpp:1222
-#: engines/engine.cpp:359 engines/engine.cpp:370 engines/scumm/dialogs.cpp:192
-#: engines/scumm/scumm.cpp:1784 engines/agos/animation.cpp:551
+#: engines/engine.cpp:361 engines/engine.cpp:372 engines/scumm/dialogs.cpp:192
+#: engines/scumm/scumm.cpp:1775 engines/agos/animation.cpp:551
#: engines/groovie/script.cpp:420 engines/sky/compact.cpp:131
-#: engines/sky/compact.cpp:141 engines/sword1/animation.cpp:345
-#: engines/sword1/animation.cpp:355 engines/sword1/animation.cpp:361
+#: engines/sky/compact.cpp:141 engines/sword1/animation.cpp:449
+#: engines/sword1/animation.cpp:459 engines/sword1/animation.cpp:465
#: engines/sword1/control.cpp:865 engines/sword1/logic.cpp:1633
#: engines/sword2/animation.cpp:379 engines/sword2/animation.cpp:389
#: engines/sword2/animation.cpp:398 engines/parallaction/saveload.cpp:281
@@ -347,7 +352,7 @@ msgstr "Este cѓdigo jс esta sendo utilizado. Por favor, escolha outro."
msgid "~Q~uit"
msgstr "~S~air"
-#: gui/launcher.cpp:578 backends/platform/sdl/macosx/appmenu_osx.mm:80
+#: gui/launcher.cpp:578 backends/platform/sdl/macosx/appmenu_osx.mm:96
msgid "Quit ScummVM"
msgstr "Sair do ScummVM"
@@ -355,7 +360,7 @@ msgstr "Sair do ScummVM"
msgid "A~b~out..."
msgstr "So~b~re..."
-#: gui/launcher.cpp:579 backends/platform/sdl/macosx/appmenu_osx.mm:61
+#: gui/launcher.cpp:579 backends/platform/sdl/macosx/appmenu_osx.mm:70
msgid "About ScummVM"
msgstr "Sobre o ScumnmVM"
@@ -605,7 +610,7 @@ msgstr "Modos especiais de dithering suportados por alguns jogos"
#: gui/options.cpp:761
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2248
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:476
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:472
msgid "Fullscreen mode"
msgstr "Modo Tela Cheia"
@@ -968,28 +973,28 @@ msgstr "Nуo-titulado arquivo de save"
msgid "Select a Theme"
msgstr "Selecione um Tema"
-#: gui/ThemeEngine.cpp:329
+#: gui/ThemeEngine.cpp:333
msgid "Disabled GFX"
msgstr "GFX desabilitado"
-#: gui/ThemeEngine.cpp:329
+#: gui/ThemeEngine.cpp:333
msgctxt "lowres"
msgid "Disabled GFX"
msgstr "GFX desabilitado"
-#: gui/ThemeEngine.cpp:330
+#: gui/ThemeEngine.cpp:334
msgid "Standard Renderer (16bpp)"
msgstr "Renderizador padrуo (16bpp)"
-#: gui/ThemeEngine.cpp:330
+#: gui/ThemeEngine.cpp:334
msgid "Standard (16bpp)"
msgstr "Padrуo (16bpp)"
-#: gui/ThemeEngine.cpp:332
+#: gui/ThemeEngine.cpp:336
msgid "Antialiased Renderer (16bpp)"
msgstr "Renderizador Anti-Serrilhamento (16bpp)"
-#: gui/ThemeEngine.cpp:332
+#: gui/ThemeEngine.cpp:336
msgid "Antialiased (16bpp)"
msgstr "Anti-Serrilhamento (16bpp)"
@@ -1002,30 +1007,30 @@ msgstr "Limpar valor"
msgid "Engine does not support debug level '%s'"
msgstr "Esse programa nуo suporta o nэvel de debug '%s'"
-#: base/main.cpp:271
+#: base/main.cpp:277
msgid "Menu"
msgstr "Menu"
-#: base/main.cpp:274 backends/platform/symbian/src/SymbianActions.cpp:45
+#: base/main.cpp:280 backends/platform/symbian/src/SymbianActions.cpp:45
#: backends/platform/wince/CEActionsPocket.cpp:45
#: backends/platform/wince/CEActionsSmartphone.cpp:46
msgid "Skip"
msgstr "Pular"
-#: base/main.cpp:277 backends/platform/symbian/src/SymbianActions.cpp:50
+#: base/main.cpp:283 backends/platform/symbian/src/SymbianActions.cpp:50
#: backends/platform/wince/CEActionsPocket.cpp:42
msgid "Pause"
msgstr "Pausar"
-#: base/main.cpp:280
+#: base/main.cpp:286
msgid "Skip line"
msgstr "Pula linha"
-#: base/main.cpp:439
+#: base/main.cpp:455
msgid "Error running game:"
msgstr "Erro ao executar o jogo:"
-#: base/main.cpp:463
+#: base/main.cpp:479
msgid "Could not find any engine capable of running the selected game"
msgstr ""
"Nуo foi possэvel encontrar qualquer programa capaz de rodar o jogo "
@@ -1200,23 +1205,23 @@ msgstr "~C~ancelar"
msgid "~K~eys"
msgstr "~T~eclas"
-#: engines/engine.cpp:233
+#: engines/engine.cpp:235
msgid "Could not initialize color format."
msgstr "Nуo foi possэvel inicializar o formato de cor."
-#: engines/engine.cpp:241
+#: engines/engine.cpp:243
msgid "Could not switch to video mode: '"
msgstr "Nуo foi possэvel alternar o modo de vэdeo atual:"
-#: engines/engine.cpp:250
+#: engines/engine.cpp:252
msgid "Could not apply aspect ratio setting."
msgstr "Nуo foi possэvel aplicar a correчуo de proporчуo"
-#: engines/engine.cpp:255
+#: engines/engine.cpp:257
msgid "Could not apply fullscreen setting."
msgstr "Nуo foi possэvel aplicar a configuraчуo de tela cheia."
-#: engines/engine.cpp:355
+#: engines/engine.cpp:357
msgid ""
"You appear to be playing this game directly\n"
"from the CD. This is known to cause problems,\n"
@@ -1230,7 +1235,7 @@ msgstr ""
"os arquivos de dados para o disco rэgido.\n"
"Consulte o arquivo README para mais detalhes."
-#: engines/engine.cpp:366
+#: engines/engine.cpp:368
msgid ""
"This game has audio tracks in its disk. These\n"
"tracks need to be ripped from the disk using\n"
@@ -1244,7 +1249,7 @@ msgstr ""
"para ouvir a mњsica do jogo.\n"
"Consulte o arquivo README para mais detalhes."
-#: engines/engine.cpp:433
+#: engines/engine.cpp:435
msgid ""
"WARNING: The game you are about to start is not yet fully supported by "
"ScummVM. As such, it is likely to be unstable, and any saves you make might "
@@ -1254,7 +1259,7 @@ msgstr ""
"suportado pelo ScummVM. Como tal, щ provсvel que seja instсvel, e qualquer "
"jogo salvo que vocъ fizer pode nуo funcionar em futuras versѕes do ScummVM."
-#: engines/engine.cpp:436
+#: engines/engine.cpp:438
msgid "Start anyway"
msgstr "Iniciar de qualquer maneira"
@@ -1906,7 +1911,7 @@ msgstr "Voar para direita"
msgid "Fly to lower right"
msgstr "Voar para direita inferior"
-#: engines/scumm/scumm.cpp:1782
+#: engines/scumm/scumm.cpp:1773
#, c-format
msgid ""
"Native MIDI support requires the Roland Upgrade from LucasArts,\n"
@@ -1916,7 +1921,7 @@ msgstr ""
"LucasArts,\n"
"mas %s estс faltando. Utilizando AdLib ao invщs."
-#: engines/scumm/scumm.cpp:2272 engines/agos/saveload.cpp:189
+#: engines/scumm/scumm.cpp:2271 engines/agos/saveload.cpp:189
#, c-format
msgid ""
"Failed to save game state to file:\n"
@@ -1927,7 +1932,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2279 engines/agos/saveload.cpp:154
+#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:154
#, c-format
msgid ""
"Failed to load game state from file:\n"
@@ -1938,7 +1943,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2291 engines/agos/saveload.cpp:197
+#: engines/scumm/scumm.cpp:2290 engines/agos/saveload.cpp:197
#, c-format
msgid ""
"Successfully saved game state in file:\n"
@@ -1949,7 +1954,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2506
+#: engines/scumm/scumm.cpp:2505
msgid ""
"Usually, Maniac Mansion would start now. But ScummVM doesn't do that yet. To "
"play it, go to 'Add Game' in the ScummVM start menu and select the 'Maniac' "
@@ -2000,14 +2005,14 @@ msgid "Cutscene file '%s' not found!"
msgstr "Arquivo de vэdeo '%s' nуo encontrado!"
#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1283
-#: engines/tinsel/saveload.cpp:482
+#: engines/tinsel/saveload.cpp:500
msgid "Failed to load game state from file."
msgstr ""
"Falha ao carregar o estado do jogo a partir do arquivo:\n"
"\n"
"%s"
-#: engines/gob/inter_v2.cpp:1353 engines/tinsel/saveload.cpp:495
+#: engines/gob/inter_v2.cpp:1353 engines/tinsel/saveload.cpp:513
msgid "Failed to save game state to file."
msgstr ""
"Falha ao salvar o estado do jogo para o arquivo:\n"
@@ -2022,56 +2027,56 @@ msgstr "Falha ao excluir arquivo."
msgid "Failed to save game"
msgstr "Falha ao salvar o jogo"
-#: engines/kyra/lol.cpp:572
+#: engines/kyra/lol.cpp:478
msgid "Attack 1"
msgstr ""
-#: engines/kyra/lol.cpp:573
+#: engines/kyra/lol.cpp:479
msgid "Attack 2"
msgstr ""
-#: engines/kyra/lol.cpp:574
+#: engines/kyra/lol.cpp:480
msgid "Attack 3"
msgstr ""
-#: engines/kyra/lol.cpp:575
+#: engines/kyra/lol.cpp:481
msgid "Move Forward"
msgstr ""
-#: engines/kyra/lol.cpp:576
+#: engines/kyra/lol.cpp:482
msgid "Move Back"
msgstr ""
-#: engines/kyra/lol.cpp:577
+#: engines/kyra/lol.cpp:483
msgid "Slide Left"
msgstr ""
-#: engines/kyra/lol.cpp:578
+#: engines/kyra/lol.cpp:484
#, fuzzy
msgid "Slide Right"
msgstr "Direita"
-#: engines/kyra/lol.cpp:579
+#: engines/kyra/lol.cpp:485
#, fuzzy
msgid "Turn Left"
msgstr "Desligar"
-#: engines/kyra/lol.cpp:580
+#: engines/kyra/lol.cpp:486
#, fuzzy
msgid "Turn Right"
msgstr "Cursor para a direita"
-#: engines/kyra/lol.cpp:581
+#: engines/kyra/lol.cpp:487
#, fuzzy
msgid "Rest"
msgstr "Restaurar"
-#: engines/kyra/lol.cpp:582
+#: engines/kyra/lol.cpp:488
#, fuzzy
msgid "Options"
msgstr "~O~pчѕes"
-#: engines/kyra/lol.cpp:583
+#: engines/kyra/lol.cpp:489
#, fuzzy
msgid "Choose Spell"
msgstr "Escolher"
@@ -2106,17 +2111,17 @@ msgstr ""
"O arquivo \"sky.cpt\" possui um tamanho incorreto.\n"
"Por favor, refaчa o download em www.scummvm.org"
-#: engines/sword1/animation.cpp:345 engines/sword2/animation.cpp:379
+#: engines/sword1/animation.cpp:449 engines/sword2/animation.cpp:379
msgid "DXA cutscenes found but ScummVM has been built without zlib support"
msgstr ""
"Vэdeos no formato DXA foram encontrados, mas o ScummVM foi compilado sem "
"suporte a zlib"
-#: engines/sword1/animation.cpp:355 engines/sword2/animation.cpp:389
+#: engines/sword1/animation.cpp:459 engines/sword2/animation.cpp:389
msgid "MPEG2 cutscenes are no longer supported"
msgstr "Vэdeos em MPEG2 nуo sуo mais suportados"
-#: engines/sword1/animation.cpp:360 engines/sword2/animation.cpp:397
+#: engines/sword1/animation.cpp:464 engines/sword2/animation.cpp:397
#, c-format
msgid "Cutscene '%s' not found"
msgstr "Vэdeo '%s' nуo encontrado"
@@ -2279,11 +2284,11 @@ msgstr "Emulador Apple II GS (NУO IMPLEMENTADO)"
msgid "C64 Audio Emulator"
msgstr "Emulador Som C64"
-#: audio/softsynth/mt32.cpp:329
+#: audio/softsynth/mt32.cpp:293
msgid "Initializing MT-32 Emulator"
msgstr "Inicializando Emulador MT-32"
-#: audio/softsynth/mt32.cpp:543
+#: audio/softsynth/mt32.cpp:512
msgid "MT-32 Emulator"
msgstr "Emulador MT-32"
@@ -2299,15 +2304,20 @@ msgstr "Emulador IBM PCjr"
msgid "Keymap:"
msgstr "Mapa de Teclas:"
-#: backends/keymapper/remap-dialog.cpp:64
+#: backends/keymapper/remap-dialog.cpp:66
+#, fuzzy
+msgid " (Effective)"
+msgstr "(Ativo)"
+
+#: backends/keymapper/remap-dialog.cpp:106
msgid " (Active)"
msgstr "(Ativo)"
-#: backends/keymapper/remap-dialog.cpp:98
+#: backends/keymapper/remap-dialog.cpp:116
msgid " (Global)"
msgstr "(Global)"
-#: backends/keymapper/remap-dialog.cpp:108
+#: backends/keymapper/remap-dialog.cpp:126
msgid " (Game)"
msgstr "(Jogo)"
@@ -2403,24 +2413,48 @@ msgstr "Modo Touchpad ligado."
msgid "Touchpad mode disabled."
msgstr "Modo Touchpad desligado."
-#: backends/platform/sdl/macosx/appmenu_osx.mm:67
+#: backends/platform/maemo/maemo.cpp:178
+msgid "Click Mode"
+msgstr ""
+
+#: backends/platform/maemo/maemo.cpp:184
+#: backends/platform/symbian/src/SymbianActions.cpp:42
+#: backends/platform/wince/CEActionsPocket.cpp:60
+#: backends/platform/wince/CEActionsSmartphone.cpp:43
+#: backends/platform/bada/form.cpp:281
+msgid "Left Click"
+msgstr "Clique com o botуo esquerdo"
+
+#: backends/platform/maemo/maemo.cpp:187
+#, fuzzy
+msgid "Middle Click"
+msgstr "Item do meio na esquerda"
+
+#: backends/platform/maemo/maemo.cpp:190
+#: backends/platform/symbian/src/SymbianActions.cpp:43
+#: backends/platform/wince/CEActionsSmartphone.cpp:44
+#: backends/platform/bada/form.cpp:273
+msgid "Right Click"
+msgstr "Clique com o botуo direito"
+
+#: backends/platform/sdl/macosx/appmenu_osx.mm:78
msgid "Hide ScummVM"
msgstr "Ocultar ScummVM"
-#: backends/platform/sdl/macosx/appmenu_osx.mm:70
+#: backends/platform/sdl/macosx/appmenu_osx.mm:83
msgid "Hide Others"
msgstr "Ocultar Outros"
-#: backends/platform/sdl/macosx/appmenu_osx.mm:74
+#: backends/platform/sdl/macosx/appmenu_osx.mm:88
msgid "Show All"
-msgstr "Exibir Todos"
+msgstr "Mostrar Tudo"
-#: backends/platform/sdl/macosx/appmenu_osx.mm:92
-#: backends/platform/sdl/macosx/appmenu_osx.mm:99
+#: backends/platform/sdl/macosx/appmenu_osx.mm:110
+#: backends/platform/sdl/macosx/appmenu_osx.mm:121
msgid "Window"
msgstr "Janela"
-#: backends/platform/sdl/macosx/appmenu_osx.mm:95
+#: backends/platform/sdl/macosx/appmenu_osx.mm:115
msgid "Minimize"
msgstr "Minimizar"
@@ -2434,12 +2468,12 @@ msgid "Normal (no scaling)"
msgstr "Normal (sem escala)"
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2147
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:537
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:533
msgid "Enabled aspect ratio correction"
msgstr "Correчуo de proporчуo habilitada"
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2153
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:542
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:538
msgid "Disabled aspect ratio correction"
msgstr "Correчуo de proporчуo desabilitada"
@@ -2448,7 +2482,7 @@ msgid "Active graphics filter:"
msgstr "Ativa os filtros grсficos"
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2250
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:481
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:477
msgid "Windowed mode"
msgstr "Modo janela"
@@ -2472,11 +2506,11 @@ msgstr "Modo de vэdeo atual"
msgid "Current scale"
msgstr "Escala atual"
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:562
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:558
msgid "Active filter mode: Linear"
msgstr "Filtro de imagem ativo: Linear"
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:564
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:560
msgid "Active filter mode: Nearest"
msgstr "Filtro de imagem ativo: Nearest"
@@ -2500,19 +2534,6 @@ msgstr "Esquerda"
msgid "Right"
msgstr "Direita"
-#: backends/platform/symbian/src/SymbianActions.cpp:42
-#: backends/platform/wince/CEActionsPocket.cpp:60
-#: backends/platform/wince/CEActionsSmartphone.cpp:43
-#: backends/platform/bada/form.cpp:281
-msgid "Left Click"
-msgstr "Clique com o botуo esquerdo"
-
-#: backends/platform/symbian/src/SymbianActions.cpp:43
-#: backends/platform/wince/CEActionsSmartphone.cpp:44
-#: backends/platform/bada/form.cpp:273
-msgid "Right Click"
-msgstr "Clique com o botуo direito"
-
#: backends/platform/symbian/src/SymbianActions.cpp:46
#: backends/platform/wince/CEActionsSmartphone.cpp:47
msgid "Zone"
@@ -2876,11 +2897,11 @@ msgstr "Mostrar teclado"
msgid "Control Mouse"
msgstr "Controle do Mouse"
-#: backends/events/maemosdl/maemosdl-events.cpp:129
+#: backends/events/maemosdl/maemosdl-events.cpp:192
msgid "Clicking Enabled"
msgstr "Clicando Habilitado"
-#: backends/events/maemosdl/maemosdl-events.cpp:129
+#: backends/events/maemosdl/maemosdl-events.cpp:192
msgid "Clicking Disabled"
msgstr "Clicando Desabilitado"
diff --git a/po/ru_RU.po b/po/ru_RU.po
index e97f4ca768..b14479069c 100644
--- a/po/ru_RU.po
+++ b/po/ru_RU.po
@@ -2,13 +2,13 @@
# Copyright (C) 2010-2012 ScummVM Team
# This file is distributed under the same license as the ScummVM package.
# Eugene Sandulenko <sev@scummvm.org>, 2010.
-#
+#
msgid ""
msgstr ""
"Project-Id-Version: ScummVM 1.3.0svn\n"
"Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n"
-"POT-Creation-Date: 2011-12-26 15:26+0100\n"
-"PO-Revision-Date: 2011-08-20 13:22+0200\n"
+"POT-Creation-Date: 2012-02-16 12:32+0200\n"
+"PO-Revision-Date: 2012-02-16 13:09+0200+0200\n"
"Last-Translator: Eugene Sandulenko <sev@scummvm.org>\n"
"Language-Team: Russian\n"
"Language: Russian\n"
@@ -47,7 +47,7 @@ msgstr "Вверх"
#: gui/browser.cpp:69 gui/chooser.cpp:45 gui/KeysDialog.cpp:43
#: gui/launcher.cpp:319 gui/massadd.cpp:94 gui/options.cpp:1221
#: gui/saveload.cpp:63 gui/saveload.cpp:155 gui/themebrowser.cpp:54
-#: engines/engine.cpp:436 engines/scumm/dialogs.cpp:190
+#: engines/engine.cpp:438 engines/scumm/dialogs.cpp:190
#: engines/sword1/control.cpp:865 engines/parallaction/saveload.cpp:281
#: backends/platform/wii/options.cpp:48
#: backends/events/default/default-events.cpp:222
@@ -59,25 +59,29 @@ msgstr "Отмена"
msgid "Choose"
msgstr "Выбрать"
-#: gui/gui-manager.cpp:116 engines/scumm/help.cpp:125
+#: gui/gui-manager.cpp:115 engines/scumm/help.cpp:125
#: engines/scumm/help.cpp:140 engines/scumm/help.cpp:165
#: engines/scumm/help.cpp:191 engines/scumm/help.cpp:209
#: backends/keymapper/remap-dialog.cpp:52
msgid "Close"
msgstr "Закрыть"
-#: gui/gui-manager.cpp:119
+#: gui/gui-manager.cpp:118
msgid "Mouse click"
msgstr "Клик мышью"
-#: gui/gui-manager.cpp:122 base/main.cpp:283
+#: gui/gui-manager.cpp:121 base/main.cpp:289
msgid "Display keyboard"
msgstr "Показать клавиатуру"
-#: gui/gui-manager.cpp:125 base/main.cpp:286
+#: gui/gui-manager.cpp:124 base/main.cpp:292
msgid "Remap keys"
msgstr "Переназначить клавиши"
+#: gui/gui-manager.cpp:127 base/main.cpp:295
+msgid "Toggle FullScreen"
+msgstr "Переключение на весь экран"
+
#: gui/KeysDialog.h:36 gui/KeysDialog.cpp:145
msgid "Choose an action to map"
msgstr "Выберите действие для назначения"
@@ -88,11 +92,11 @@ msgstr "Назначить"
#: gui/KeysDialog.cpp:42 gui/launcher.cpp:320 gui/launcher.cpp:959
#: gui/launcher.cpp:963 gui/massadd.cpp:91 gui/options.cpp:1222
-#: engines/engine.cpp:359 engines/engine.cpp:370 engines/scumm/dialogs.cpp:192
-#: engines/scumm/scumm.cpp:1784 engines/agos/animation.cpp:551
+#: engines/engine.cpp:361 engines/engine.cpp:372 engines/scumm/dialogs.cpp:192
+#: engines/scumm/scumm.cpp:1775 engines/agos/animation.cpp:551
#: engines/groovie/script.cpp:420 engines/sky/compact.cpp:131
-#: engines/sky/compact.cpp:141 engines/sword1/animation.cpp:345
-#: engines/sword1/animation.cpp:355 engines/sword1/animation.cpp:361
+#: engines/sky/compact.cpp:141 engines/sword1/animation.cpp:449
+#: engines/sword1/animation.cpp:459 engines/sword1/animation.cpp:465
#: engines/sword1/control.cpp:865 engines/sword1/logic.cpp:1633
#: engines/sword2/animation.cpp:379 engines/sword2/animation.cpp:389
#: engines/sword2/animation.cpp:398 engines/parallaction/saveload.cpp:281
@@ -346,15 +350,15 @@ msgstr "Этот ID игры уже используется. Пожалуйста, выберите другой."
msgid "~Q~uit"
msgstr "~В~ыход"
-#: gui/launcher.cpp:578 backends/platform/sdl/macosx/appmenu_osx.mm:80
+#: gui/launcher.cpp:578 backends/platform/sdl/macosx/appmenu_osx.mm:96
msgid "Quit ScummVM"
-msgstr "Выход из ScummVM"
+msgstr "Завершить ScummVM"
#: gui/launcher.cpp:579
msgid "A~b~out..."
msgstr "О п~р~ограмме..."
-#: gui/launcher.cpp:579 backends/platform/sdl/macosx/appmenu_osx.mm:61
+#: gui/launcher.cpp:579 backends/platform/sdl/macosx/appmenu_osx.mm:70
msgid "About ScummVM"
msgstr "О программе ScummVM"
@@ -597,7 +601,7 @@ msgstr "Специальные режимы рендеринга, поддерживаемые некоторыми играми"
#: gui/options.cpp:761
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2248
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:476
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:472
msgid "Fullscreen mode"
msgstr "Полноэкранный режим"
@@ -965,28 +969,28 @@ msgstr "Сохранение без имени"
msgid "Select a Theme"
msgstr "Выберите тему"
-#: gui/ThemeEngine.cpp:329
+#: gui/ThemeEngine.cpp:333
msgid "Disabled GFX"
msgstr "Без графики"
-#: gui/ThemeEngine.cpp:329
+#: gui/ThemeEngine.cpp:333
msgctxt "lowres"
msgid "Disabled GFX"
msgstr "Без графики"
-#: gui/ThemeEngine.cpp:330
+#: gui/ThemeEngine.cpp:334
msgid "Standard Renderer (16bpp)"
msgstr "Стандартный растеризатор (16bpp)"
-#: gui/ThemeEngine.cpp:330
+#: gui/ThemeEngine.cpp:334
msgid "Standard (16bpp)"
msgstr "Стандартный растеризатор (16bpp)"
-#: gui/ThemeEngine.cpp:332
+#: gui/ThemeEngine.cpp:336
msgid "Antialiased Renderer (16bpp)"
msgstr "Растеризатор со сглаживанием (16bpp)"
-#: gui/ThemeEngine.cpp:332
+#: gui/ThemeEngine.cpp:336
msgid "Antialiased (16bpp)"
msgstr "Растеризатор со сглаживанием (16bpp)"
@@ -999,30 +1003,30 @@ msgstr "Очистить значение"
msgid "Engine does not support debug level '%s'"
msgstr "Движок не поддерживает уровень отладки '%s'"
-#: base/main.cpp:271
+#: base/main.cpp:277
msgid "Menu"
msgstr "Меню"
-#: base/main.cpp:274 backends/platform/symbian/src/SymbianActions.cpp:45
+#: base/main.cpp:280 backends/platform/symbian/src/SymbianActions.cpp:45
#: backends/platform/wince/CEActionsPocket.cpp:45
#: backends/platform/wince/CEActionsSmartphone.cpp:46
msgid "Skip"
msgstr "Пропустить"
-#: base/main.cpp:277 backends/platform/symbian/src/SymbianActions.cpp:50
+#: base/main.cpp:283 backends/platform/symbian/src/SymbianActions.cpp:50
#: backends/platform/wince/CEActionsPocket.cpp:42
msgid "Pause"
msgstr "Пауза"
-#: base/main.cpp:280
+#: base/main.cpp:286
msgid "Skip line"
msgstr "Пропустить строку"
-#: base/main.cpp:439
+#: base/main.cpp:455
msgid "Error running game:"
msgstr "Ошибка запуска игры:"
-#: base/main.cpp:463
+#: base/main.cpp:479
msgid "Could not find any engine capable of running the selected game"
msgstr "Не могу найти движок для запуска выбранной игры"
@@ -1195,23 +1199,23 @@ msgstr "О~т~мена"
msgid "~K~eys"
msgstr "~К~лавиши"
-#: engines/engine.cpp:233
+#: engines/engine.cpp:235
msgid "Could not initialize color format."
msgstr "Не могу инициализировать формат цвета."
-#: engines/engine.cpp:241
+#: engines/engine.cpp:243
msgid "Could not switch to video mode: '"
msgstr "Не удалось переключить видеорежим: '"
-#: engines/engine.cpp:250
+#: engines/engine.cpp:252
msgid "Could not apply aspect ratio setting."
msgstr "Не удалось использовать коррекцию соотношения сторон."
-#: engines/engine.cpp:255
+#: engines/engine.cpp:257
msgid "Could not apply fullscreen setting."
msgstr "Не могу применить полноэкранный режим."
-#: engines/engine.cpp:355
+#: engines/engine.cpp:357
msgid ""
"You appear to be playing this game directly\n"
"from the CD. This is known to cause problems,\n"
@@ -1225,7 +1229,7 @@ msgstr ""
"на жёсткий диск. Подробности можно найти в\n"
"файле README."
-#: engines/engine.cpp:366
+#: engines/engine.cpp:368
msgid ""
"This game has audio tracks in its disk. These\n"
"tracks need to be ripped from the disk using\n"
@@ -1240,7 +1244,7 @@ msgstr ""
"появится музыка. Подробности можно найти в\n"
"файле README."
-#: engines/engine.cpp:433
+#: engines/engine.cpp:435
msgid ""
"WARNING: The game you are about to start is not yet fully supported by "
"ScummVM. As such, it is likely to be unstable, and any saves you make might "
@@ -1250,7 +1254,7 @@ msgstr ""
"ScummVM полностью. Она скорее всего не будет работать стабильно, и "
"сохранения игр могут не работать в будущих версиях ScummVM."
-#: engines/engine.cpp:436
+#: engines/engine.cpp:438
msgid "Start anyway"
msgstr "Всё равно запустить"
@@ -1370,24 +1374,23 @@ msgstr "Озвучка и текст"
#: engines/scumm/dialogs.cpp:653
msgid "Select a Proficiency Level."
-msgstr ""
+msgstr "Выберите уровень сложности."
#: engines/scumm/dialogs.cpp:655
msgid "Refer to your Loom(TM) manual for help."
-msgstr ""
+msgstr "За помощью обратитесь к инстукции Loom(TM)"
#: engines/scumm/dialogs.cpp:658
-#, fuzzy
msgid "Standard"
-msgstr "Стандартный растеризатор (16bpp)"
+msgstr "Стандартный"
#: engines/scumm/dialogs.cpp:659
msgid "Practice"
-msgstr ""
+msgstr "Практикант"
#: engines/scumm/dialogs.cpp:660
msgid "Expert"
-msgstr ""
+msgstr "Эксперт"
#: engines/scumm/help.cpp:73
msgid "Common keyboard commands:"
@@ -1902,7 +1905,7 @@ msgstr "Лететь вправо"
msgid "Fly to lower right"
msgstr "Лететь вправо-вниз"
-#: engines/scumm/scumm.cpp:1782
+#: engines/scumm/scumm.cpp:1773
#, c-format
msgid ""
"Native MIDI support requires the Roland Upgrade from LucasArts,\n"
@@ -1911,7 +1914,7 @@ msgstr ""
"Режим \"родного\" MIDI требует обновление Roland Upgrade от\n"
"LucasArts, но не хватает %s. Переключаюсь на AdLib."
-#: engines/scumm/scumm.cpp:2272 engines/agos/saveload.cpp:189
+#: engines/scumm/scumm.cpp:2271 engines/agos/saveload.cpp:189
#, c-format
msgid ""
"Failed to save game state to file:\n"
@@ -1922,7 +1925,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2279 engines/agos/saveload.cpp:154
+#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:154
#, c-format
msgid ""
"Failed to load game state from file:\n"
@@ -1933,7 +1936,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2291 engines/agos/saveload.cpp:197
+#: engines/scumm/scumm.cpp:2290 engines/agos/saveload.cpp:197
#, c-format
msgid ""
"Successfully saved game state in file:\n"
@@ -1944,7 +1947,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2506
+#: engines/scumm/scumm.cpp:2505
msgid ""
"Usually, Maniac Mansion would start now. But ScummVM doesn't do that yet. To "
"play it, go to 'Add Game' in the ScummVM start menu and select the 'Maniac' "
@@ -1994,11 +1997,11 @@ msgid "Cutscene file '%s' not found!"
msgstr "Файл заставки '%s' не найден!"
#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1283
-#: engines/tinsel/saveload.cpp:482
+#: engines/tinsel/saveload.cpp:500
msgid "Failed to load game state from file."
msgstr "Не удалось загрузить сохранённую игру из файла."
-#: engines/gob/inter_v2.cpp:1353 engines/tinsel/saveload.cpp:495
+#: engines/gob/inter_v2.cpp:1353 engines/tinsel/saveload.cpp:513
msgid "Failed to save game state to file."
msgstr "Не удалось сохранить игру в файл."
@@ -2010,59 +2013,53 @@ msgstr "Не удалось удалить файл."
msgid "Failed to save game"
msgstr "Не удалось сохранить игру"
-#: engines/kyra/lol.cpp:572
+#: engines/kyra/lol.cpp:478
msgid "Attack 1"
-msgstr ""
+msgstr "Атака 1"
-#: engines/kyra/lol.cpp:573
+#: engines/kyra/lol.cpp:479
msgid "Attack 2"
-msgstr ""
+msgstr "Атака 2"
-#: engines/kyra/lol.cpp:574
+#: engines/kyra/lol.cpp:480
msgid "Attack 3"
-msgstr ""
+msgstr "Атака 3"
-#: engines/kyra/lol.cpp:575
+#: engines/kyra/lol.cpp:481
msgid "Move Forward"
-msgstr ""
+msgstr "Идти вперёд"
-#: engines/kyra/lol.cpp:576
+#: engines/kyra/lol.cpp:482
msgid "Move Back"
-msgstr ""
+msgstr "Идти назад"
-#: engines/kyra/lol.cpp:577
+#: engines/kyra/lol.cpp:483
msgid "Slide Left"
-msgstr ""
+msgstr "Скользить влево"
-#: engines/kyra/lol.cpp:578
-#, fuzzy
+#: engines/kyra/lol.cpp:484
msgid "Slide Right"
-msgstr "Вправо"
+msgstr "Скользить вправо"
-#: engines/kyra/lol.cpp:579
-#, fuzzy
+#: engines/kyra/lol.cpp:485
msgid "Turn Left"
-msgstr "Выключить"
+msgstr "Поворот налево"
-#: engines/kyra/lol.cpp:580
-#, fuzzy
+#: engines/kyra/lol.cpp:486
msgid "Turn Right"
-msgstr "Курсор вправо"
+msgstr "Поворот направо"
-#: engines/kyra/lol.cpp:581
-#, fuzzy
+#: engines/kyra/lol.cpp:487
msgid "Rest"
-msgstr "Восствновить"
+msgstr "Отдохнуть"
-#: engines/kyra/lol.cpp:582
-#, fuzzy
+#: engines/kyra/lol.cpp:488
msgid "Options"
-msgstr "~О~пции"
+msgstr "Опции"
-#: engines/kyra/lol.cpp:583
-#, fuzzy
+#: engines/kyra/lol.cpp:489
msgid "Choose Spell"
-msgstr "Выбрать"
+msgstr "Выбрать заклинание"
#: engines/kyra/sound_midi.cpp:475
msgid ""
@@ -2095,16 +2092,16 @@ msgstr ""
"Файл sky.cpt имеет неверный размер.\n"
"Пожалуйста, скачайте его заново с www.scummvm.org"
-#: engines/sword1/animation.cpp:345 engines/sword2/animation.cpp:379
+#: engines/sword1/animation.cpp:449 engines/sword2/animation.cpp:379
msgid "DXA cutscenes found but ScummVM has been built without zlib support"
msgstr ""
"Найдены заставки в формате DXA, но ScummVM был собран без поддержки zlib"
-#: engines/sword1/animation.cpp:355 engines/sword2/animation.cpp:389
+#: engines/sword1/animation.cpp:459 engines/sword2/animation.cpp:389
msgid "MPEG2 cutscenes are no longer supported"
msgstr "Заставки в формате MPEG2 больше не поддерживаются"
-#: engines/sword1/animation.cpp:360 engines/sword2/animation.cpp:397
+#: engines/sword1/animation.cpp:464 engines/sword2/animation.cpp:397
#, c-format
msgid "Cutscene '%s' not found"
msgstr "Заставка '%s' не найдена"
@@ -2265,11 +2262,11 @@ msgstr "Эмулятор Apple II GS (отсутствует)"
msgid "C64 Audio Emulator"
msgstr "Эмулятор звука C64"
-#: audio/softsynth/mt32.cpp:329
+#: audio/softsynth/mt32.cpp:293
msgid "Initializing MT-32 Emulator"
msgstr "Настраиваю эмулятор MT-32"
-#: audio/softsynth/mt32.cpp:543
+#: audio/softsynth/mt32.cpp:512
msgid "MT-32 Emulator"
msgstr "Эмулятор MT-32"
@@ -2285,15 +2282,19 @@ msgstr "Эмулятор IBM PCjr"
msgid "Keymap:"
msgstr "Таблица клавиш:"
-#: backends/keymapper/remap-dialog.cpp:64
+#: backends/keymapper/remap-dialog.cpp:66
+msgid " (Effective)"
+msgstr " (Действующая)"
+
+#: backends/keymapper/remap-dialog.cpp:106
msgid " (Active)"
msgstr " (Активная)"
-#: backends/keymapper/remap-dialog.cpp:98
+#: backends/keymapper/remap-dialog.cpp:116
msgid " (Global)"
msgstr " (Глобальная)"
-#: backends/keymapper/remap-dialog.cpp:108
+#: backends/keymapper/remap-dialog.cpp:126
msgid " (Game)"
msgstr " (Игры)"
@@ -2389,26 +2390,49 @@ msgstr "Режим тачпада включен."
msgid "Touchpad mode disabled."
msgstr "Режим тачпада выключен."
-#: backends/platform/sdl/macosx/appmenu_osx.mm:67
+#: backends/platform/maemo/maemo.cpp:178
+msgid "Click Mode"
+msgstr "Режим щелчка"
+
+#: backends/platform/maemo/maemo.cpp:184
+#: backends/platform/symbian/src/SymbianActions.cpp:42
+#: backends/platform/wince/CEActionsPocket.cpp:60
+#: backends/platform/wince/CEActionsSmartphone.cpp:43
+#: backends/platform/bada/form.cpp:281
+msgid "Left Click"
+msgstr "Левый щелчок"
+
+#: backends/platform/maemo/maemo.cpp:187
+msgid "Middle Click"
+msgstr "Средний щелчок"
+
+#: backends/platform/maemo/maemo.cpp:190
+#: backends/platform/symbian/src/SymbianActions.cpp:43
+#: backends/platform/wince/CEActionsSmartphone.cpp:44
+#: backends/platform/bada/form.cpp:273
+msgid "Right Click"
+msgstr "Правый щелчок"
+
+#: backends/platform/sdl/macosx/appmenu_osx.mm:78
msgid "Hide ScummVM"
-msgstr "Спрятать ScummVM"
+msgstr "Скрыть ScummVM"
-#: backends/platform/sdl/macosx/appmenu_osx.mm:70
+#: backends/platform/sdl/macosx/appmenu_osx.mm:83
msgid "Hide Others"
-msgstr "Спрятать Другие"
+msgstr "Скрыть остальные"
-#: backends/platform/sdl/macosx/appmenu_osx.mm:74
+#: backends/platform/sdl/macosx/appmenu_osx.mm:88
msgid "Show All"
-msgstr "Показать всё"
+msgstr "Показать все"
-#: backends/platform/sdl/macosx/appmenu_osx.mm:92
-#: backends/platform/sdl/macosx/appmenu_osx.mm:99
+#: backends/platform/sdl/macosx/appmenu_osx.mm:110
+#: backends/platform/sdl/macosx/appmenu_osx.mm:121
msgid "Window"
msgstr "Окно"
-#: backends/platform/sdl/macosx/appmenu_osx.mm:95
+#: backends/platform/sdl/macosx/appmenu_osx.mm:115
msgid "Minimize"
-msgstr "Минимизировать"
+msgstr "Убрать в Dock"
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:45
msgid "Normal (no scaling)"
@@ -2420,12 +2444,12 @@ msgid "Normal (no scaling)"
msgstr "Без увеличения"
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2147
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:537
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:533
msgid "Enabled aspect ratio correction"
msgstr "Коррекция соотношения сторон включена"
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2153
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:542
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:538
msgid "Disabled aspect ratio correction"
msgstr "Коррекция соотношения сторон выключена"
@@ -2434,7 +2458,7 @@ msgid "Active graphics filter:"
msgstr "Активный графический фильтр:"
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2250
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:481
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:477
msgid "Windowed mode"
msgstr "Оконный режим"
@@ -2458,11 +2482,11 @@ msgstr "Текущий видеорежим"
msgid "Current scale"
msgstr "Текущий масштаб"
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:562
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:558
msgid "Active filter mode: Linear"
msgstr "Активный режим фильтра: Линейный"
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:564
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:560
msgid "Active filter mode: Nearest"
msgstr "Активный режим фильтра: Ближайший"
@@ -2486,19 +2510,6 @@ msgstr "Влево"
msgid "Right"
msgstr "Вправо"
-#: backends/platform/symbian/src/SymbianActions.cpp:42
-#: backends/platform/wince/CEActionsPocket.cpp:60
-#: backends/platform/wince/CEActionsSmartphone.cpp:43
-#: backends/platform/bada/form.cpp:281
-msgid "Left Click"
-msgstr "Левый щелчок"
-
-#: backends/platform/symbian/src/SymbianActions.cpp:43
-#: backends/platform/wince/CEActionsSmartphone.cpp:44
-#: backends/platform/bada/form.cpp:273
-msgid "Right Click"
-msgstr "Правый щелчок"
-
#: backends/platform/symbian/src/SymbianActions.cpp:46
#: backends/platform/wince/CEActionsSmartphone.cpp:47
msgid "Zone"
@@ -2859,11 +2870,11 @@ msgstr "Показать клавиатуру"
msgid "Control Mouse"
msgstr "Управление мышью"
-#: backends/events/maemosdl/maemosdl-events.cpp:129
+#: backends/events/maemosdl/maemosdl-events.cpp:192
msgid "Clicking Enabled"
msgstr "Щелчки включены"
-#: backends/events/maemosdl/maemosdl-events.cpp:129
+#: backends/events/maemosdl/maemosdl-events.cpp:192
msgid "Clicking Disabled"
msgstr "Щелчки выключены"
diff --git a/po/scummvm.pot b/po/scummvm.pot
index 01d419da88..750d5fec1d 100644
--- a/po/scummvm.pot
+++ b/po/scummvm.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ScummVM 1.5.0git\n"
"Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n"
-"POT-Creation-Date: 2011-12-26 15:26+0100\n"
+"POT-Creation-Date: 2012-02-16 12:32+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -46,7 +46,7 @@ msgstr ""
#: gui/browser.cpp:69 gui/chooser.cpp:45 gui/KeysDialog.cpp:43
#: gui/launcher.cpp:319 gui/massadd.cpp:94 gui/options.cpp:1221
#: gui/saveload.cpp:63 gui/saveload.cpp:155 gui/themebrowser.cpp:54
-#: engines/engine.cpp:436 engines/scumm/dialogs.cpp:190
+#: engines/engine.cpp:438 engines/scumm/dialogs.cpp:190
#: engines/sword1/control.cpp:865 engines/parallaction/saveload.cpp:281
#: backends/platform/wii/options.cpp:48
#: backends/events/default/default-events.cpp:222
@@ -58,25 +58,29 @@ msgstr ""
msgid "Choose"
msgstr ""
-#: gui/gui-manager.cpp:116 engines/scumm/help.cpp:125
+#: gui/gui-manager.cpp:115 engines/scumm/help.cpp:125
#: engines/scumm/help.cpp:140 engines/scumm/help.cpp:165
#: engines/scumm/help.cpp:191 engines/scumm/help.cpp:209
#: backends/keymapper/remap-dialog.cpp:52
msgid "Close"
msgstr ""
-#: gui/gui-manager.cpp:119
+#: gui/gui-manager.cpp:118
msgid "Mouse click"
msgstr ""
-#: gui/gui-manager.cpp:122 base/main.cpp:283
+#: gui/gui-manager.cpp:121 base/main.cpp:289
msgid "Display keyboard"
msgstr ""
-#: gui/gui-manager.cpp:125 base/main.cpp:286
+#: gui/gui-manager.cpp:124 base/main.cpp:292
msgid "Remap keys"
msgstr ""
+#: gui/gui-manager.cpp:127 base/main.cpp:295
+msgid "Toggle FullScreen"
+msgstr ""
+
#: gui/KeysDialog.h:36 gui/KeysDialog.cpp:145
msgid "Choose an action to map"
msgstr ""
@@ -87,11 +91,11 @@ msgstr ""
#: gui/KeysDialog.cpp:42 gui/launcher.cpp:320 gui/launcher.cpp:959
#: gui/launcher.cpp:963 gui/massadd.cpp:91 gui/options.cpp:1222
-#: engines/engine.cpp:359 engines/engine.cpp:370 engines/scumm/dialogs.cpp:192
-#: engines/scumm/scumm.cpp:1784 engines/agos/animation.cpp:551
+#: engines/engine.cpp:361 engines/engine.cpp:372 engines/scumm/dialogs.cpp:192
+#: engines/scumm/scumm.cpp:1775 engines/agos/animation.cpp:551
#: engines/groovie/script.cpp:420 engines/sky/compact.cpp:131
-#: engines/sky/compact.cpp:141 engines/sword1/animation.cpp:345
-#: engines/sword1/animation.cpp:355 engines/sword1/animation.cpp:361
+#: engines/sky/compact.cpp:141 engines/sword1/animation.cpp:449
+#: engines/sword1/animation.cpp:459 engines/sword1/animation.cpp:465
#: engines/sword1/control.cpp:865 engines/sword1/logic.cpp:1633
#: engines/sword2/animation.cpp:379 engines/sword2/animation.cpp:389
#: engines/sword2/animation.cpp:398 engines/parallaction/saveload.cpp:281
@@ -342,7 +346,7 @@ msgstr ""
msgid "~Q~uit"
msgstr ""
-#: gui/launcher.cpp:578 backends/platform/sdl/macosx/appmenu_osx.mm:80
+#: gui/launcher.cpp:578 backends/platform/sdl/macosx/appmenu_osx.mm:96
msgid "Quit ScummVM"
msgstr ""
@@ -350,7 +354,7 @@ msgstr ""
msgid "A~b~out..."
msgstr ""
-#: gui/launcher.cpp:579 backends/platform/sdl/macosx/appmenu_osx.mm:61
+#: gui/launcher.cpp:579 backends/platform/sdl/macosx/appmenu_osx.mm:70
msgid "About ScummVM"
msgstr ""
@@ -591,7 +595,7 @@ msgstr ""
#: gui/options.cpp:761
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2248
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:476
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:472
msgid "Fullscreen mode"
msgstr ""
@@ -943,28 +947,28 @@ msgstr ""
msgid "Select a Theme"
msgstr ""
-#: gui/ThemeEngine.cpp:329
+#: gui/ThemeEngine.cpp:333
msgid "Disabled GFX"
msgstr ""
-#: gui/ThemeEngine.cpp:329
+#: gui/ThemeEngine.cpp:333
msgctxt "lowres"
msgid "Disabled GFX"
msgstr ""
-#: gui/ThemeEngine.cpp:330
+#: gui/ThemeEngine.cpp:334
msgid "Standard Renderer (16bpp)"
msgstr ""
-#: gui/ThemeEngine.cpp:330
+#: gui/ThemeEngine.cpp:334
msgid "Standard (16bpp)"
msgstr ""
-#: gui/ThemeEngine.cpp:332
+#: gui/ThemeEngine.cpp:336
msgid "Antialiased Renderer (16bpp)"
msgstr ""
-#: gui/ThemeEngine.cpp:332
+#: gui/ThemeEngine.cpp:336
msgid "Antialiased (16bpp)"
msgstr ""
@@ -977,30 +981,30 @@ msgstr ""
msgid "Engine does not support debug level '%s'"
msgstr ""
-#: base/main.cpp:271
+#: base/main.cpp:277
msgid "Menu"
msgstr ""
-#: base/main.cpp:274 backends/platform/symbian/src/SymbianActions.cpp:45
+#: base/main.cpp:280 backends/platform/symbian/src/SymbianActions.cpp:45
#: backends/platform/wince/CEActionsPocket.cpp:45
#: backends/platform/wince/CEActionsSmartphone.cpp:46
msgid "Skip"
msgstr ""
-#: base/main.cpp:277 backends/platform/symbian/src/SymbianActions.cpp:50
+#: base/main.cpp:283 backends/platform/symbian/src/SymbianActions.cpp:50
#: backends/platform/wince/CEActionsPocket.cpp:42
msgid "Pause"
msgstr ""
-#: base/main.cpp:280
+#: base/main.cpp:286
msgid "Skip line"
msgstr ""
-#: base/main.cpp:439
+#: base/main.cpp:455
msgid "Error running game:"
msgstr ""
-#: base/main.cpp:463
+#: base/main.cpp:479
msgid "Could not find any engine capable of running the selected game"
msgstr ""
@@ -1169,23 +1173,23 @@ msgstr ""
msgid "~K~eys"
msgstr ""
-#: engines/engine.cpp:233
+#: engines/engine.cpp:235
msgid "Could not initialize color format."
msgstr ""
-#: engines/engine.cpp:241
+#: engines/engine.cpp:243
msgid "Could not switch to video mode: '"
msgstr ""
-#: engines/engine.cpp:250
+#: engines/engine.cpp:252
msgid "Could not apply aspect ratio setting."
msgstr ""
-#: engines/engine.cpp:255
+#: engines/engine.cpp:257
msgid "Could not apply fullscreen setting."
msgstr ""
-#: engines/engine.cpp:355
+#: engines/engine.cpp:357
msgid ""
"You appear to be playing this game directly\n"
"from the CD. This is known to cause problems,\n"
@@ -1194,7 +1198,7 @@ msgid ""
"See the README file for details."
msgstr ""
-#: engines/engine.cpp:366
+#: engines/engine.cpp:368
msgid ""
"This game has audio tracks in its disk. These\n"
"tracks need to be ripped from the disk using\n"
@@ -1203,14 +1207,14 @@ msgid ""
"See the README file for details."
msgstr ""
-#: engines/engine.cpp:433
+#: engines/engine.cpp:435
msgid ""
"WARNING: The game you are about to start is not yet fully supported by "
"ScummVM. As such, it is likely to be unstable, and any saves you make might "
"not work in future versions of ScummVM."
msgstr ""
-#: engines/engine.cpp:436
+#: engines/engine.cpp:438
msgid "Start anyway"
msgstr ""
@@ -1861,14 +1865,14 @@ msgstr ""
msgid "Fly to lower right"
msgstr ""
-#: engines/scumm/scumm.cpp:1782
+#: engines/scumm/scumm.cpp:1773
#, c-format
msgid ""
"Native MIDI support requires the Roland Upgrade from LucasArts,\n"
"but %s is missing. Using AdLib instead."
msgstr ""
-#: engines/scumm/scumm.cpp:2272 engines/agos/saveload.cpp:189
+#: engines/scumm/scumm.cpp:2271 engines/agos/saveload.cpp:189
#, c-format
msgid ""
"Failed to save game state to file:\n"
@@ -1876,7 +1880,7 @@ msgid ""
"%s"
msgstr ""
-#: engines/scumm/scumm.cpp:2279 engines/agos/saveload.cpp:154
+#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:154
#, c-format
msgid ""
"Failed to load game state from file:\n"
@@ -1884,7 +1888,7 @@ msgid ""
"%s"
msgstr ""
-#: engines/scumm/scumm.cpp:2291 engines/agos/saveload.cpp:197
+#: engines/scumm/scumm.cpp:2290 engines/agos/saveload.cpp:197
#, c-format
msgid ""
"Successfully saved game state in file:\n"
@@ -1892,7 +1896,7 @@ msgid ""
"%s"
msgstr ""
-#: engines/scumm/scumm.cpp:2506
+#: engines/scumm/scumm.cpp:2505
msgid ""
"Usually, Maniac Mansion would start now. But ScummVM doesn't do that yet. To "
"play it, go to 'Add Game' in the ScummVM start menu and select the 'Maniac' "
@@ -1939,11 +1943,11 @@ msgid "Cutscene file '%s' not found!"
msgstr ""
#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1283
-#: engines/tinsel/saveload.cpp:482
+#: engines/tinsel/saveload.cpp:500
msgid "Failed to load game state from file."
msgstr ""
-#: engines/gob/inter_v2.cpp:1353 engines/tinsel/saveload.cpp:495
+#: engines/gob/inter_v2.cpp:1353 engines/tinsel/saveload.cpp:513
msgid "Failed to save game state to file."
msgstr ""
@@ -1955,51 +1959,51 @@ msgstr ""
msgid "Failed to save game"
msgstr ""
-#: engines/kyra/lol.cpp:572
+#: engines/kyra/lol.cpp:478
msgid "Attack 1"
msgstr ""
-#: engines/kyra/lol.cpp:573
+#: engines/kyra/lol.cpp:479
msgid "Attack 2"
msgstr ""
-#: engines/kyra/lol.cpp:574
+#: engines/kyra/lol.cpp:480
msgid "Attack 3"
msgstr ""
-#: engines/kyra/lol.cpp:575
+#: engines/kyra/lol.cpp:481
msgid "Move Forward"
msgstr ""
-#: engines/kyra/lol.cpp:576
+#: engines/kyra/lol.cpp:482
msgid "Move Back"
msgstr ""
-#: engines/kyra/lol.cpp:577
+#: engines/kyra/lol.cpp:483
msgid "Slide Left"
msgstr ""
-#: engines/kyra/lol.cpp:578
+#: engines/kyra/lol.cpp:484
msgid "Slide Right"
msgstr ""
-#: engines/kyra/lol.cpp:579
+#: engines/kyra/lol.cpp:485
msgid "Turn Left"
msgstr ""
-#: engines/kyra/lol.cpp:580
+#: engines/kyra/lol.cpp:486
msgid "Turn Right"
msgstr ""
-#: engines/kyra/lol.cpp:581
+#: engines/kyra/lol.cpp:487
msgid "Rest"
msgstr ""
-#: engines/kyra/lol.cpp:582
+#: engines/kyra/lol.cpp:488
msgid "Options"
msgstr ""
-#: engines/kyra/lol.cpp:583
+#: engines/kyra/lol.cpp:489
msgid "Choose Spell"
msgstr ""
@@ -2024,15 +2028,15 @@ msgid ""
"Please (re)download it from www.scummvm.org"
msgstr ""
-#: engines/sword1/animation.cpp:345 engines/sword2/animation.cpp:379
+#: engines/sword1/animation.cpp:449 engines/sword2/animation.cpp:379
msgid "DXA cutscenes found but ScummVM has been built without zlib support"
msgstr ""
-#: engines/sword1/animation.cpp:355 engines/sword2/animation.cpp:389
+#: engines/sword1/animation.cpp:459 engines/sword2/animation.cpp:389
msgid "MPEG2 cutscenes are no longer supported"
msgstr ""
-#: engines/sword1/animation.cpp:360 engines/sword2/animation.cpp:397
+#: engines/sword1/animation.cpp:464 engines/sword2/animation.cpp:397
#, c-format
msgid "Cutscene '%s' not found"
msgstr ""
@@ -2165,11 +2169,11 @@ msgstr ""
msgid "C64 Audio Emulator"
msgstr ""
-#: audio/softsynth/mt32.cpp:329
+#: audio/softsynth/mt32.cpp:293
msgid "Initializing MT-32 Emulator"
msgstr ""
-#: audio/softsynth/mt32.cpp:543
+#: audio/softsynth/mt32.cpp:512
msgid "MT-32 Emulator"
msgstr ""
@@ -2185,15 +2189,19 @@ msgstr ""
msgid "Keymap:"
msgstr ""
-#: backends/keymapper/remap-dialog.cpp:64
+#: backends/keymapper/remap-dialog.cpp:66
+msgid " (Effective)"
+msgstr ""
+
+#: backends/keymapper/remap-dialog.cpp:106
msgid " (Active)"
msgstr ""
-#: backends/keymapper/remap-dialog.cpp:98
+#: backends/keymapper/remap-dialog.cpp:116
msgid " (Global)"
msgstr ""
-#: backends/keymapper/remap-dialog.cpp:108
+#: backends/keymapper/remap-dialog.cpp:126
msgid " (Game)"
msgstr ""
@@ -2289,24 +2297,47 @@ msgstr ""
msgid "Touchpad mode disabled."
msgstr ""
-#: backends/platform/sdl/macosx/appmenu_osx.mm:67
+#: backends/platform/maemo/maemo.cpp:178
+msgid "Click Mode"
+msgstr ""
+
+#: backends/platform/maemo/maemo.cpp:184
+#: backends/platform/symbian/src/SymbianActions.cpp:42
+#: backends/platform/wince/CEActionsPocket.cpp:60
+#: backends/platform/wince/CEActionsSmartphone.cpp:43
+#: backends/platform/bada/form.cpp:281
+msgid "Left Click"
+msgstr ""
+
+#: backends/platform/maemo/maemo.cpp:187
+msgid "Middle Click"
+msgstr ""
+
+#: backends/platform/maemo/maemo.cpp:190
+#: backends/platform/symbian/src/SymbianActions.cpp:43
+#: backends/platform/wince/CEActionsSmartphone.cpp:44
+#: backends/platform/bada/form.cpp:273
+msgid "Right Click"
+msgstr ""
+
+#: backends/platform/sdl/macosx/appmenu_osx.mm:78
msgid "Hide ScummVM"
msgstr ""
-#: backends/platform/sdl/macosx/appmenu_osx.mm:70
+#: backends/platform/sdl/macosx/appmenu_osx.mm:83
msgid "Hide Others"
msgstr ""
-#: backends/platform/sdl/macosx/appmenu_osx.mm:74
+#: backends/platform/sdl/macosx/appmenu_osx.mm:88
msgid "Show All"
msgstr ""
-#: backends/platform/sdl/macosx/appmenu_osx.mm:92
-#: backends/platform/sdl/macosx/appmenu_osx.mm:99
+#: backends/platform/sdl/macosx/appmenu_osx.mm:110
+#: backends/platform/sdl/macosx/appmenu_osx.mm:121
msgid "Window"
msgstr ""
-#: backends/platform/sdl/macosx/appmenu_osx.mm:95
+#: backends/platform/sdl/macosx/appmenu_osx.mm:115
msgid "Minimize"
msgstr ""
@@ -2320,12 +2351,12 @@ msgid "Normal (no scaling)"
msgstr ""
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2147
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:537
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:533
msgid "Enabled aspect ratio correction"
msgstr ""
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2153
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:542
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:538
msgid "Disabled aspect ratio correction"
msgstr ""
@@ -2334,7 +2365,7 @@ msgid "Active graphics filter:"
msgstr ""
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2250
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:481
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:477
msgid "Windowed mode"
msgstr ""
@@ -2358,11 +2389,11 @@ msgstr ""
msgid "Current scale"
msgstr ""
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:562
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:558
msgid "Active filter mode: Linear"
msgstr ""
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:564
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:560
msgid "Active filter mode: Nearest"
msgstr ""
@@ -2386,19 +2417,6 @@ msgstr ""
msgid "Right"
msgstr ""
-#: backends/platform/symbian/src/SymbianActions.cpp:42
-#: backends/platform/wince/CEActionsPocket.cpp:60
-#: backends/platform/wince/CEActionsSmartphone.cpp:43
-#: backends/platform/bada/form.cpp:281
-msgid "Left Click"
-msgstr ""
-
-#: backends/platform/symbian/src/SymbianActions.cpp:43
-#: backends/platform/wince/CEActionsSmartphone.cpp:44
-#: backends/platform/bada/form.cpp:273
-msgid "Right Click"
-msgstr ""
-
#: backends/platform/symbian/src/SymbianActions.cpp:46
#: backends/platform/wince/CEActionsSmartphone.cpp:47
msgid "Zone"
@@ -2757,10 +2775,10 @@ msgstr ""
msgid "Control Mouse"
msgstr ""
-#: backends/events/maemosdl/maemosdl-events.cpp:129
+#: backends/events/maemosdl/maemosdl-events.cpp:192
msgid "Clicking Enabled"
msgstr ""
-#: backends/events/maemosdl/maemosdl-events.cpp:129
+#: backends/events/maemosdl/maemosdl-events.cpp:192
msgid "Clicking Disabled"
msgstr ""
diff --git a/po/se_SE.po b/po/se_SE.po
index 058e5ce371..41bda1dd8a 100644
--- a/po/se_SE.po
+++ b/po/se_SE.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ScummVM 1.3.0svn\n"
"Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n"
-"POT-Creation-Date: 2011-12-26 15:26+0100\n"
+"POT-Creation-Date: 2012-02-16 12:32+0200\n"
"PO-Revision-Date: 2011-11-27 19:00+0100\n"
"Last-Translator: Hampus Flink <hampus.flink@gmail.com>\n"
"Language-Team: \n"
@@ -49,7 +49,7 @@ msgstr "Uppхt"
#: gui/browser.cpp:69 gui/chooser.cpp:45 gui/KeysDialog.cpp:43
#: gui/launcher.cpp:319 gui/massadd.cpp:94 gui/options.cpp:1221
#: gui/saveload.cpp:63 gui/saveload.cpp:155 gui/themebrowser.cpp:54
-#: engines/engine.cpp:436 engines/scumm/dialogs.cpp:190
+#: engines/engine.cpp:438 engines/scumm/dialogs.cpp:190
#: engines/sword1/control.cpp:865 engines/parallaction/saveload.cpp:281
#: backends/platform/wii/options.cpp:48
#: backends/events/default/default-events.cpp:222
@@ -61,25 +61,30 @@ msgstr "Avbryt"
msgid "Choose"
msgstr "Vфlj"
-#: gui/gui-manager.cpp:116 engines/scumm/help.cpp:125
+#: gui/gui-manager.cpp:115 engines/scumm/help.cpp:125
#: engines/scumm/help.cpp:140 engines/scumm/help.cpp:165
#: engines/scumm/help.cpp:191 engines/scumm/help.cpp:209
#: backends/keymapper/remap-dialog.cpp:52
msgid "Close"
msgstr "Stфng"
-#: gui/gui-manager.cpp:119
+#: gui/gui-manager.cpp:118
msgid "Mouse click"
msgstr "Musklick"
-#: gui/gui-manager.cpp:122 base/main.cpp:283
+#: gui/gui-manager.cpp:121 base/main.cpp:289
msgid "Display keyboard"
msgstr "Visa tangentbord"
-#: gui/gui-manager.cpp:125 base/main.cpp:286
+#: gui/gui-manager.cpp:124 base/main.cpp:292
msgid "Remap keys"
msgstr "Stфll in tangenter"
+#: gui/gui-manager.cpp:127 base/main.cpp:295
+#, fuzzy
+msgid "Toggle FullScreen"
+msgstr "Fullskфrmslфge"
+
#: gui/KeysDialog.h:36 gui/KeysDialog.cpp:145
msgid "Choose an action to map"
msgstr "Vфlj en handling att stфlla in"
@@ -90,11 +95,11 @@ msgstr "Stфll in"
#: gui/KeysDialog.cpp:42 gui/launcher.cpp:320 gui/launcher.cpp:959
#: gui/launcher.cpp:963 gui/massadd.cpp:91 gui/options.cpp:1222
-#: engines/engine.cpp:359 engines/engine.cpp:370 engines/scumm/dialogs.cpp:192
-#: engines/scumm/scumm.cpp:1784 engines/agos/animation.cpp:551
+#: engines/engine.cpp:361 engines/engine.cpp:372 engines/scumm/dialogs.cpp:192
+#: engines/scumm/scumm.cpp:1775 engines/agos/animation.cpp:551
#: engines/groovie/script.cpp:420 engines/sky/compact.cpp:131
-#: engines/sky/compact.cpp:141 engines/sword1/animation.cpp:345
-#: engines/sword1/animation.cpp:355 engines/sword1/animation.cpp:361
+#: engines/sky/compact.cpp:141 engines/sword1/animation.cpp:449
+#: engines/sword1/animation.cpp:459 engines/sword1/animation.cpp:465
#: engines/sword1/control.cpp:865 engines/sword1/logic.cpp:1633
#: engines/sword2/animation.cpp:379 engines/sword2/animation.cpp:389
#: engines/sword2/animation.cpp:398 engines/parallaction/saveload.cpp:281
@@ -349,7 +354,7 @@ msgstr "Detta ID-namn фr upptaget. Var god vфlj ett annat."
msgid "~Q~uit"
msgstr "~A~vsluta"
-#: gui/launcher.cpp:578 backends/platform/sdl/macosx/appmenu_osx.mm:80
+#: gui/launcher.cpp:578 backends/platform/sdl/macosx/appmenu_osx.mm:96
msgid "Quit ScummVM"
msgstr "Avsluta ScummVM"
@@ -357,7 +362,7 @@ msgstr "Avsluta ScummVM"
msgid "A~b~out..."
msgstr "O~m~..."
-#: gui/launcher.cpp:579 backends/platform/sdl/macosx/appmenu_osx.mm:61
+#: gui/launcher.cpp:579 backends/platform/sdl/macosx/appmenu_osx.mm:70
msgid "About ScummVM"
msgstr "Om ScummVM"
@@ -601,7 +606,7 @@ msgstr "Speciella gitterlфgen stіdda av vissa spel"
#: gui/options.cpp:761
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2248
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:476
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:472
msgid "Fullscreen mode"
msgstr "Fullskфrmslфge"
@@ -963,28 +968,28 @@ msgstr "Namnlіs spardata"
msgid "Select a Theme"
msgstr "Vфlj ett tema"
-#: gui/ThemeEngine.cpp:329
+#: gui/ThemeEngine.cpp:333
msgid "Disabled GFX"
msgstr "Inaktiverad GFX"
-#: gui/ThemeEngine.cpp:329
+#: gui/ThemeEngine.cpp:333
msgctxt "lowres"
msgid "Disabled GFX"
msgstr "Inaktiverad GFX"
-#: gui/ThemeEngine.cpp:330
+#: gui/ThemeEngine.cpp:334
msgid "Standard Renderer (16bpp)"
msgstr "Standard rendering (16 bpp)"
-#: gui/ThemeEngine.cpp:330
+#: gui/ThemeEngine.cpp:334
msgid "Standard (16bpp)"
msgstr "Standard (16 bpp)"
-#: gui/ThemeEngine.cpp:332
+#: gui/ThemeEngine.cpp:336
msgid "Antialiased Renderer (16bpp)"
msgstr "Antialiserad rendering (16 bpp)"
-#: gui/ThemeEngine.cpp:332
+#: gui/ThemeEngine.cpp:336
msgid "Antialiased (16bpp)"
msgstr "Antialiserad (16 bpp)"
@@ -997,30 +1002,30 @@ msgstr "Tіm sіkfфltet"
msgid "Engine does not support debug level '%s'"
msgstr "Motorn stіder inte debug-nivх '%s'"
-#: base/main.cpp:271
+#: base/main.cpp:277
msgid "Menu"
msgstr "Meny"
-#: base/main.cpp:274 backends/platform/symbian/src/SymbianActions.cpp:45
+#: base/main.cpp:280 backends/platform/symbian/src/SymbianActions.cpp:45
#: backends/platform/wince/CEActionsPocket.cpp:45
#: backends/platform/wince/CEActionsSmartphone.cpp:46
msgid "Skip"
msgstr "Skippa"
-#: base/main.cpp:277 backends/platform/symbian/src/SymbianActions.cpp:50
+#: base/main.cpp:283 backends/platform/symbian/src/SymbianActions.cpp:50
#: backends/platform/wince/CEActionsPocket.cpp:42
msgid "Pause"
msgstr "Paus"
-#: base/main.cpp:280
+#: base/main.cpp:286
msgid "Skip line"
msgstr "Skippa rad"
-#: base/main.cpp:439
+#: base/main.cpp:455
msgid "Error running game:"
msgstr "Fel under kіrning av spel:"
-#: base/main.cpp:463
+#: base/main.cpp:479
msgid "Could not find any engine capable of running the selected game"
msgstr "Kunde inte hitta en motor kapabel till att kіra det valda spelet"
@@ -1193,23 +1198,23 @@ msgstr "A~v~bryt"
msgid "~K~eys"
msgstr "~T~angenter"
-#: engines/engine.cpp:233
+#: engines/engine.cpp:235
msgid "Could not initialize color format."
msgstr "Kunde inte initialisera fфrgformat."
-#: engines/engine.cpp:241
+#: engines/engine.cpp:243
msgid "Could not switch to video mode: '"
msgstr "Kunde inte byta till videolфget: '"
-#: engines/engine.cpp:250
+#: engines/engine.cpp:252
msgid "Could not apply aspect ratio setting."
msgstr "Kunde inte фndra instфllningen fіr bildfіrhхllanden."
-#: engines/engine.cpp:255
+#: engines/engine.cpp:257
msgid "Could not apply fullscreen setting."
msgstr "Kunde inte applicera fullskфrmsinstфllning."
-#: engines/engine.cpp:355
+#: engines/engine.cpp:357
msgid ""
"You appear to be playing this game directly\n"
"from the CD. This is known to cause problems,\n"
@@ -1223,7 +1228,7 @@ msgstr ""
"datafilerna till din hхrddisk istфllet.\n"
"Se README-filen fіr detaljer."
-#: engines/engine.cpp:366
+#: engines/engine.cpp:368
msgid ""
"This game has audio tracks in its disk. These\n"
"tracks need to be ripped from the disk using\n"
@@ -1237,7 +1242,7 @@ msgstr ""
"fіr att kunna lyssna pх spelets musik.\n"
"Se README-filen fіr detaljer."
-#: engines/engine.cpp:433
+#: engines/engine.cpp:435
msgid ""
"WARNING: The game you are about to start is not yet fully supported by "
"ScummVM. As such, it is likely to be unstable, and any saves you make might "
@@ -1247,7 +1252,7 @@ msgstr ""
"ScummVM. Dфrfіr фr det troligtvis instabilt och om du skapar spardata kan de "
"mіjligtvis vara inkompatibla med framtida versioner av ScummVM."
-#: engines/engine.cpp:436
+#: engines/engine.cpp:438
msgid "Start anyway"
msgstr "Starta фndх"
@@ -1899,7 +1904,7 @@ msgstr "Flyg хt hіger"
msgid "Fly to lower right"
msgstr "Flyg хt nedre hіger"
-#: engines/scumm/scumm.cpp:1782
+#: engines/scumm/scumm.cpp:1773
#, c-format
msgid ""
"Native MIDI support requires the Roland Upgrade from LucasArts,\n"
@@ -1908,7 +1913,7 @@ msgstr ""
"Stіd fіr Native MIDI krфver Roland-uppdateringen frхn LucasArts,\n"
"men %s saknas. Anvфnder AdLib istфllet."
-#: engines/scumm/scumm.cpp:2272 engines/agos/saveload.cpp:189
+#: engines/scumm/scumm.cpp:2271 engines/agos/saveload.cpp:189
#, c-format
msgid ""
"Failed to save game state to file:\n"
@@ -1919,7 +1924,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2279 engines/agos/saveload.cpp:154
+#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:154
#, c-format
msgid ""
"Failed to load game state from file:\n"
@@ -1930,7 +1935,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2291 engines/agos/saveload.cpp:197
+#: engines/scumm/scumm.cpp:2290 engines/agos/saveload.cpp:197
#, c-format
msgid ""
"Successfully saved game state in file:\n"
@@ -1941,7 +1946,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2506
+#: engines/scumm/scumm.cpp:2505
msgid ""
"Usually, Maniac Mansion would start now. But ScummVM doesn't do that yet. To "
"play it, go to 'Add Game' in the ScummVM start menu and select the 'Maniac' "
@@ -1991,11 +1996,11 @@ msgid "Cutscene file '%s' not found!"
msgstr "Filmscensfilen '%s' hittades ej!"
#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1283
-#: engines/tinsel/saveload.cpp:482
+#: engines/tinsel/saveload.cpp:500
msgid "Failed to load game state from file."
msgstr "Kunde inte lфsa spardata frхn filen"
-#: engines/gob/inter_v2.cpp:1353 engines/tinsel/saveload.cpp:495
+#: engines/gob/inter_v2.cpp:1353 engines/tinsel/saveload.cpp:513
msgid "Failed to save game state to file."
msgstr "Kunde inte skriva spardata till filen."
@@ -2007,51 +2012,51 @@ msgstr "Kunde inte radera filen."
msgid "Failed to save game"
msgstr "Kunde inte spara spelet."
-#: engines/kyra/lol.cpp:572
+#: engines/kyra/lol.cpp:478
msgid "Attack 1"
msgstr "Attack 1"
-#: engines/kyra/lol.cpp:573
+#: engines/kyra/lol.cpp:479
msgid "Attack 2"
msgstr "Attack 2"
-#: engines/kyra/lol.cpp:574
+#: engines/kyra/lol.cpp:480
msgid "Attack 3"
msgstr "Attack 3"
-#: engines/kyra/lol.cpp:575
+#: engines/kyra/lol.cpp:481
msgid "Move Forward"
msgstr "Steg framхt"
-#: engines/kyra/lol.cpp:576
+#: engines/kyra/lol.cpp:482
msgid "Move Back"
msgstr "Steg bakхt"
-#: engines/kyra/lol.cpp:577
+#: engines/kyra/lol.cpp:483
msgid "Slide Left"
msgstr "Glid vфnster"
-#: engines/kyra/lol.cpp:578
+#: engines/kyra/lol.cpp:484
msgid "Slide Right"
msgstr "Glid hіger"
-#: engines/kyra/lol.cpp:579
+#: engines/kyra/lol.cpp:485
msgid "Turn Left"
msgstr "Svфng vфnster"
-#: engines/kyra/lol.cpp:580
+#: engines/kyra/lol.cpp:486
msgid "Turn Right"
msgstr "Svфng hіger"
-#: engines/kyra/lol.cpp:581
+#: engines/kyra/lol.cpp:487
msgid "Rest"
msgstr "Vila"
-#: engines/kyra/lol.cpp:582
+#: engines/kyra/lol.cpp:488
msgid "Options"
msgstr "Instфllningar"
-#: engines/kyra/lol.cpp:583
+#: engines/kyra/lol.cpp:489
msgid "Choose Spell"
msgstr "Vфlj trollformel"
@@ -2085,15 +2090,15 @@ msgstr ""
"Filen \"sky.cpt\" har inkorrekt filstorlek.\n"
"Var god ladda hem den igen frхn www.scummvm.org"
-#: engines/sword1/animation.cpp:345 engines/sword2/animation.cpp:379
+#: engines/sword1/animation.cpp:449 engines/sword2/animation.cpp:379
msgid "DXA cutscenes found but ScummVM has been built without zlib support"
msgstr "DXA filmscener hittades men ScummVM har byggts utan stіd fіr zlib"
-#: engines/sword1/animation.cpp:355 engines/sword2/animation.cpp:389
+#: engines/sword1/animation.cpp:459 engines/sword2/animation.cpp:389
msgid "MPEG2 cutscenes are no longer supported"
msgstr "MPEG2 filmscener stіds inte lфngre"
-#: engines/sword1/animation.cpp:360 engines/sword2/animation.cpp:397
+#: engines/sword1/animation.cpp:464 engines/sword2/animation.cpp:397
#, c-format
msgid "Cutscene '%s' not found"
msgstr "Filmscenen '%s' hittades ej"
@@ -2256,11 +2261,11 @@ msgstr "Apple II GS-emulator (INTE IMPLEMENTERAD)"
msgid "C64 Audio Emulator"
msgstr "C64 ljudemulator"
-#: audio/softsynth/mt32.cpp:329
+#: audio/softsynth/mt32.cpp:293
msgid "Initializing MT-32 Emulator"
msgstr "Initialiserar MT-32 emulator"
-#: audio/softsynth/mt32.cpp:543
+#: audio/softsynth/mt32.cpp:512
msgid "MT-32 Emulator"
msgstr "MT-32 emulator"
@@ -2276,15 +2281,20 @@ msgstr "IBM PCjr-emulator"
msgid "Keymap:"
msgstr "Tangenter:"
-#: backends/keymapper/remap-dialog.cpp:64
+#: backends/keymapper/remap-dialog.cpp:66
+#, fuzzy
+msgid " (Effective)"
+msgstr "(Aktiv)"
+
+#: backends/keymapper/remap-dialog.cpp:106
msgid " (Active)"
msgstr "(Aktiv)"
-#: backends/keymapper/remap-dialog.cpp:98
+#: backends/keymapper/remap-dialog.cpp:116
msgid " (Global)"
msgstr "(Global)"
-#: backends/keymapper/remap-dialog.cpp:108
+#: backends/keymapper/remap-dialog.cpp:126
msgid " (Game)"
msgstr "(Spel)"
@@ -2380,24 +2390,48 @@ msgstr "Touchpad-lфge aktiverat."
msgid "Touchpad mode disabled."
msgstr "Touchpad-lфge inaktiverat."
-#: backends/platform/sdl/macosx/appmenu_osx.mm:67
+#: backends/platform/maemo/maemo.cpp:178
+msgid "Click Mode"
+msgstr ""
+
+#: backends/platform/maemo/maemo.cpp:184
+#: backends/platform/symbian/src/SymbianActions.cpp:42
+#: backends/platform/wince/CEActionsPocket.cpp:60
+#: backends/platform/wince/CEActionsSmartphone.cpp:43
+#: backends/platform/bada/form.cpp:281
+msgid "Left Click"
+msgstr "Vфnsterklick"
+
+#: backends/platform/maemo/maemo.cpp:187
+#, fuzzy
+msgid "Middle Click"
+msgstr "Mellersta vфnstra fіremхlet"
+
+#: backends/platform/maemo/maemo.cpp:190
+#: backends/platform/symbian/src/SymbianActions.cpp:43
+#: backends/platform/wince/CEActionsSmartphone.cpp:44
+#: backends/platform/bada/form.cpp:273
+msgid "Right Click"
+msgstr "Hіgerklick"
+
+#: backends/platform/sdl/macosx/appmenu_osx.mm:78
msgid "Hide ScummVM"
-msgstr "Dіlj ScummVM"
+msgstr "Gіm ScummVM"
-#: backends/platform/sdl/macosx/appmenu_osx.mm:70
+#: backends/platform/sdl/macosx/appmenu_osx.mm:83
msgid "Hide Others"
-msgstr "Dіlj іvriga"
+msgstr "Gіm іvriga"
-#: backends/platform/sdl/macosx/appmenu_osx.mm:74
+#: backends/platform/sdl/macosx/appmenu_osx.mm:88
msgid "Show All"
msgstr "Visa alla"
-#: backends/platform/sdl/macosx/appmenu_osx.mm:92
-#: backends/platform/sdl/macosx/appmenu_osx.mm:99
+#: backends/platform/sdl/macosx/appmenu_osx.mm:110
+#: backends/platform/sdl/macosx/appmenu_osx.mm:121
msgid "Window"
msgstr "Fіnster"
-#: backends/platform/sdl/macosx/appmenu_osx.mm:95
+#: backends/platform/sdl/macosx/appmenu_osx.mm:115
msgid "Minimize"
msgstr "Minimera"
@@ -2411,12 +2445,12 @@ msgid "Normal (no scaling)"
msgstr "Normalt (ingen skalning)"
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2147
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:537
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:533
msgid "Enabled aspect ratio correction"
msgstr "Korrektion av bildfіrhхllande pх"
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2153
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:542
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:538
msgid "Disabled aspect ratio correction"
msgstr "Korrektion av bildfіrhхllande av"
@@ -2425,7 +2459,7 @@ msgid "Active graphics filter:"
msgstr "Aktivt grafikfilter:"
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2250
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:481
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:477
msgid "Windowed mode"
msgstr "Fіnsterlфge"
@@ -2449,11 +2483,11 @@ msgstr "Nuvarande visningslфge"
msgid "Current scale"
msgstr "Nuvarande skala"
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:562
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:558
msgid "Active filter mode: Linear"
msgstr "Aktivt filterlфge: Linjфrt"
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:564
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:560
msgid "Active filter mode: Nearest"
msgstr "Aktivt filterlфge: Nфrmast"
@@ -2477,19 +2511,6 @@ msgstr "Vфnster"
msgid "Right"
msgstr "Hіger"
-#: backends/platform/symbian/src/SymbianActions.cpp:42
-#: backends/platform/wince/CEActionsPocket.cpp:60
-#: backends/platform/wince/CEActionsSmartphone.cpp:43
-#: backends/platform/bada/form.cpp:281
-msgid "Left Click"
-msgstr "Vфnsterklick"
-
-#: backends/platform/symbian/src/SymbianActions.cpp:43
-#: backends/platform/wince/CEActionsSmartphone.cpp:44
-#: backends/platform/bada/form.cpp:273
-msgid "Right Click"
-msgstr "Hіgerklick"
-
#: backends/platform/symbian/src/SymbianActions.cpp:46
#: backends/platform/wince/CEActionsSmartphone.cpp:47
msgid "Zone"
@@ -2853,11 +2874,11 @@ msgstr "Visa tangentbord"
msgid "Control Mouse"
msgstr "Kontrollera musen"
-#: backends/events/maemosdl/maemosdl-events.cpp:129
+#: backends/events/maemosdl/maemosdl-events.cpp:192
msgid "Clicking Enabled"
msgstr "Klickning aktiverad"
-#: backends/events/maemosdl/maemosdl-events.cpp:129
+#: backends/events/maemosdl/maemosdl-events.cpp:192
msgid "Clicking Disabled"
msgstr "Klickning deaktiverad"
diff --git a/po/uk_UA.po b/po/uk_UA.po
index 0fd9015af5..db0c7153a6 100644
--- a/po/uk_UA.po
+++ b/po/uk_UA.po
@@ -2,13 +2,13 @@
# Copyright (C) 2010-2012 ScummVM Team
# This file is distributed under the same license as the ScummVM package.
# Lubomyr Lisen, 2010.
-#
+#
msgid ""
msgstr ""
"Project-Id-Version: ScummVM 1.3.0svn\n"
"Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n"
-"POT-Creation-Date: 2011-12-26 15:26+0100\n"
-"PO-Revision-Date: 2011-08-20 13:30+0200\n"
+"POT-Creation-Date: 2012-02-16 12:32+0200\n"
+"PO-Revision-Date: 2012-02-16 13:09+0200\n"
"Last-Translator: Eugene Sandulenko\n"
"Language-Team: Ukrainian\n"
"Language: Ukrainian\n"
@@ -47,7 +47,7 @@ msgstr "Вгору"
#: gui/browser.cpp:69 gui/chooser.cpp:45 gui/KeysDialog.cpp:43
#: gui/launcher.cpp:319 gui/massadd.cpp:94 gui/options.cpp:1221
#: gui/saveload.cpp:63 gui/saveload.cpp:155 gui/themebrowser.cpp:54
-#: engines/engine.cpp:436 engines/scumm/dialogs.cpp:190
+#: engines/engine.cpp:438 engines/scumm/dialogs.cpp:190
#: engines/sword1/control.cpp:865 engines/parallaction/saveload.cpp:281
#: backends/platform/wii/options.cpp:48
#: backends/events/default/default-events.cpp:222
@@ -59,25 +59,29 @@ msgstr "Відміна"
msgid "Choose"
msgstr "Вибрати"
-#: gui/gui-manager.cpp:116 engines/scumm/help.cpp:125
+#: gui/gui-manager.cpp:115 engines/scumm/help.cpp:125
#: engines/scumm/help.cpp:140 engines/scumm/help.cpp:165
#: engines/scumm/help.cpp:191 engines/scumm/help.cpp:209
#: backends/keymapper/remap-dialog.cpp:52
msgid "Close"
msgstr "Закрити"
-#: gui/gui-manager.cpp:119
+#: gui/gui-manager.cpp:118
msgid "Mouse click"
msgstr "Клік мишкою"
-#: gui/gui-manager.cpp:122 base/main.cpp:283
+#: gui/gui-manager.cpp:121 base/main.cpp:289
msgid "Display keyboard"
msgstr "Показати клавіатуру"
-#: gui/gui-manager.cpp:125 base/main.cpp:286
+#: gui/gui-manager.cpp:124 base/main.cpp:292
msgid "Remap keys"
msgstr "Перепризначити клавіші"
+#: gui/gui-manager.cpp:127 base/main.cpp:295
+msgid "Toggle FullScreen"
+msgstr "Перемкнути повноекранний режим"
+
#: gui/KeysDialog.h:36 gui/KeysDialog.cpp:145
msgid "Choose an action to map"
msgstr "Виберіть дію для призначення"
@@ -88,11 +92,11 @@ msgstr "Призначити"
#: gui/KeysDialog.cpp:42 gui/launcher.cpp:320 gui/launcher.cpp:959
#: gui/launcher.cpp:963 gui/massadd.cpp:91 gui/options.cpp:1222
-#: engines/engine.cpp:359 engines/engine.cpp:370 engines/scumm/dialogs.cpp:192
-#: engines/scumm/scumm.cpp:1784 engines/agos/animation.cpp:551
+#: engines/engine.cpp:361 engines/engine.cpp:372 engines/scumm/dialogs.cpp:192
+#: engines/scumm/scumm.cpp:1775 engines/agos/animation.cpp:551
#: engines/groovie/script.cpp:420 engines/sky/compact.cpp:131
-#: engines/sky/compact.cpp:141 engines/sword1/animation.cpp:345
-#: engines/sword1/animation.cpp:355 engines/sword1/animation.cpp:361
+#: engines/sky/compact.cpp:141 engines/sword1/animation.cpp:449
+#: engines/sword1/animation.cpp:459 engines/sword1/animation.cpp:465
#: engines/sword1/control.cpp:865 engines/sword1/logic.cpp:1633
#: engines/sword2/animation.cpp:379 engines/sword2/animation.cpp:389
#: engines/sword2/animation.cpp:398 engines/parallaction/saveload.cpp:281
@@ -347,7 +351,7 @@ msgstr "Цей ID гри вже використовується. Будь ласка, виберіть інший."
msgid "~Q~uit"
msgstr "~В~ихід"
-#: gui/launcher.cpp:578 backends/platform/sdl/macosx/appmenu_osx.mm:80
+#: gui/launcher.cpp:578 backends/platform/sdl/macosx/appmenu_osx.mm:96
msgid "Quit ScummVM"
msgstr "Вихід зі ScummVM"
@@ -355,7 +359,7 @@ msgstr "Вихід зі ScummVM"
msgid "A~b~out..."
msgstr "Про п~р~ограму..."
-#: gui/launcher.cpp:579 backends/platform/sdl/macosx/appmenu_osx.mm:61
+#: gui/launcher.cpp:579 backends/platform/sdl/macosx/appmenu_osx.mm:70
msgid "About ScummVM"
msgstr "Про ScummVM"
@@ -598,7 +602,7 @@ msgstr "Спеціальні режими растрування, які підтримують деякі ігри"
#: gui/options.cpp:761
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2248
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:476
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:472
msgid "Fullscreen mode"
msgstr "Повноекранний режим"
@@ -962,28 +966,28 @@ msgstr "Збереження без імені"
msgid "Select a Theme"
msgstr "Виберіть тему"
-#: gui/ThemeEngine.cpp:329
+#: gui/ThemeEngine.cpp:333
msgid "Disabled GFX"
msgstr "Без графіки"
-#: gui/ThemeEngine.cpp:329
+#: gui/ThemeEngine.cpp:333
msgctxt "lowres"
msgid "Disabled GFX"
msgstr "Без графіки"
-#: gui/ThemeEngine.cpp:330
+#: gui/ThemeEngine.cpp:334
msgid "Standard Renderer (16bpp)"
msgstr "Стандартний растеризатор (16bpp)"
-#: gui/ThemeEngine.cpp:330
+#: gui/ThemeEngine.cpp:334
msgid "Standard (16bpp)"
msgstr "Стандартний растеризатор (16bpp)"
-#: gui/ThemeEngine.cpp:332
+#: gui/ThemeEngine.cpp:336
msgid "Antialiased Renderer (16bpp)"
msgstr "Растеризатор зі згладжуванням (16bpp)"
-#: gui/ThemeEngine.cpp:332
+#: gui/ThemeEngine.cpp:336
msgid "Antialiased (16bpp)"
msgstr "Растеризатор зі згладжуванням (16bpp)"
@@ -996,30 +1000,30 @@ msgstr "Очистити значення"
msgid "Engine does not support debug level '%s'"
msgstr "Движок не підтримує рівень відладки '%s'"
-#: base/main.cpp:271
+#: base/main.cpp:277
msgid "Menu"
msgstr "Меню"
-#: base/main.cpp:274 backends/platform/symbian/src/SymbianActions.cpp:45
+#: base/main.cpp:280 backends/platform/symbian/src/SymbianActions.cpp:45
#: backends/platform/wince/CEActionsPocket.cpp:45
#: backends/platform/wince/CEActionsSmartphone.cpp:46
msgid "Skip"
msgstr "Пропустити"
-#: base/main.cpp:277 backends/platform/symbian/src/SymbianActions.cpp:50
+#: base/main.cpp:283 backends/platform/symbian/src/SymbianActions.cpp:50
#: backends/platform/wince/CEActionsPocket.cpp:42
msgid "Pause"
msgstr "Пауза"
-#: base/main.cpp:280
+#: base/main.cpp:286
msgid "Skip line"
msgstr "Пропустити рядок"
-#: base/main.cpp:439
+#: base/main.cpp:455
msgid "Error running game:"
msgstr "Помилка запуску гри:"
-#: base/main.cpp:463
+#: base/main.cpp:479
msgid "Could not find any engine capable of running the selected game"
msgstr "Не можу знайти движок для запуску вибраної гри"
@@ -1191,23 +1195,23 @@ msgstr "Ві~д~міна"
msgid "~K~eys"
msgstr "~К~лавіші"
-#: engines/engine.cpp:233
+#: engines/engine.cpp:235
msgid "Could not initialize color format."
msgstr "Не можу налаштувати формат кольору."
-#: engines/engine.cpp:241
+#: engines/engine.cpp:243
msgid "Could not switch to video mode: '"
msgstr "Не вдалося переключити відеорежим: '"
-#: engines/engine.cpp:250
+#: engines/engine.cpp:252
msgid "Could not apply aspect ratio setting."
msgstr "Не вдалося застосувати корекцію співвідношення сторін."
-#: engines/engine.cpp:255
+#: engines/engine.cpp:257
msgid "Could not apply fullscreen setting."
msgstr "Не вдалося застосувати повноекранний режим."
-#: engines/engine.cpp:355
+#: engines/engine.cpp:357
msgid ""
"You appear to be playing this game directly\n"
"from the CD. This is known to cause problems,\n"
@@ -1221,7 +1225,7 @@ msgstr ""
"гри на жорсткий диск.\n"
"Дивіться файл README для подальших інструкцій."
-#: engines/engine.cpp:366
+#: engines/engine.cpp:368
msgid ""
"This game has audio tracks in its disk. These\n"
"tracks need to be ripped from the disk using\n"
@@ -1235,7 +1239,7 @@ msgstr ""
"того, щоб можна було слухати музику у грі.\n"
"Дивіться файл README для подальших інструкцій."
-#: engines/engine.cpp:433
+#: engines/engine.cpp:435
msgid ""
"WARNING: The game you are about to start is not yet fully supported by "
"ScummVM. As such, it is likely to be unstable, and any saves you make might "
@@ -1245,7 +1249,7 @@ msgstr ""
"ScummVM. Скорше за все вона не буде працювати стабільно, і збереження ігор, "
"які ви зробите, можуть не працювати у подальших версіях ScummVM."
-#: engines/engine.cpp:436
+#: engines/engine.cpp:438
msgid "Start anyway"
msgstr "Все одно запустити"
@@ -1365,24 +1369,23 @@ msgstr "Озвучка та текст"
#: engines/scumm/dialogs.cpp:653
msgid "Select a Proficiency Level."
-msgstr ""
+msgstr "Оберіть режим складності."
#: engines/scumm/dialogs.cpp:655
msgid "Refer to your Loom(TM) manual for help."
-msgstr ""
+msgstr "За допомогою звертайтеся до інструкції Loom(TM)."
#: engines/scumm/dialogs.cpp:658
-#, fuzzy
msgid "Standard"
-msgstr "Стандартний растеризатор (16bpp)"
+msgstr "Стандартний"
#: engines/scumm/dialogs.cpp:659
msgid "Practice"
-msgstr ""
+msgstr "Практика"
#: engines/scumm/dialogs.cpp:660
msgid "Expert"
-msgstr ""
+msgstr "Експерт"
#: engines/scumm/help.cpp:73
msgid "Common keyboard commands:"
@@ -1897,7 +1900,7 @@ msgstr "Летіти направо"
msgid "Fly to lower right"
msgstr "Летіти донизу направо"
-#: engines/scumm/scumm.cpp:1782
+#: engines/scumm/scumm.cpp:1773
#, c-format
msgid ""
"Native MIDI support requires the Roland Upgrade from LucasArts,\n"
@@ -1906,7 +1909,7 @@ msgstr ""
"Режим \"рідного\" MIDI потребує поновлення Roland Upgrade від\n"
"LucasArts, проте %s відсутній. Перемикаюсь на AdLib."
-#: engines/scumm/scumm.cpp:2272 engines/agos/saveload.cpp:189
+#: engines/scumm/scumm.cpp:2271 engines/agos/saveload.cpp:189
#, c-format
msgid ""
"Failed to save game state to file:\n"
@@ -1917,7 +1920,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2279 engines/agos/saveload.cpp:154
+#: engines/scumm/scumm.cpp:2278 engines/agos/saveload.cpp:154
#, c-format
msgid ""
"Failed to load game state from file:\n"
@@ -1928,7 +1931,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2291 engines/agos/saveload.cpp:197
+#: engines/scumm/scumm.cpp:2290 engines/agos/saveload.cpp:197
#, c-format
msgid ""
"Successfully saved game state in file:\n"
@@ -1939,7 +1942,7 @@ msgstr ""
"\n"
"%s"
-#: engines/scumm/scumm.cpp:2506
+#: engines/scumm/scumm.cpp:2505
msgid ""
"Usually, Maniac Mansion would start now. But ScummVM doesn't do that yet. To "
"play it, go to 'Add Game' in the ScummVM start menu and select the 'Maniac' "
@@ -1989,11 +1992,11 @@ msgid "Cutscene file '%s' not found!"
msgstr "Файл заставки '%s' не знайдено!"
#: engines/gob/inter_playtoons.cpp:256 engines/gob/inter_v2.cpp:1283
-#: engines/tinsel/saveload.cpp:482
+#: engines/tinsel/saveload.cpp:500
msgid "Failed to load game state from file."
msgstr "Не вдалося завантажити стан гри з файлу."
-#: engines/gob/inter_v2.cpp:1353 engines/tinsel/saveload.cpp:495
+#: engines/gob/inter_v2.cpp:1353 engines/tinsel/saveload.cpp:513
msgid "Failed to save game state to file."
msgstr "Не вдалося зберегти стан гри у файл."
@@ -2005,59 +2008,53 @@ msgstr "Не вдалося видалити файл."
msgid "Failed to save game"
msgstr "Не вдалося записати гру"
-#: engines/kyra/lol.cpp:572
+#: engines/kyra/lol.cpp:478
msgid "Attack 1"
-msgstr ""
+msgstr "Атака 1"
-#: engines/kyra/lol.cpp:573
+#: engines/kyra/lol.cpp:479
msgid "Attack 2"
-msgstr ""
+msgstr "Атака 2"
-#: engines/kyra/lol.cpp:574
+#: engines/kyra/lol.cpp:480
msgid "Attack 3"
-msgstr ""
+msgstr "Атака 3"
-#: engines/kyra/lol.cpp:575
+#: engines/kyra/lol.cpp:481
msgid "Move Forward"
-msgstr ""
+msgstr "Рухатись уперед"
-#: engines/kyra/lol.cpp:576
+#: engines/kyra/lol.cpp:482
msgid "Move Back"
-msgstr ""
+msgstr "Рухатись назад"
-#: engines/kyra/lol.cpp:577
+#: engines/kyra/lol.cpp:483
msgid "Slide Left"
-msgstr ""
+msgstr "Ковзати наліво"
-#: engines/kyra/lol.cpp:578
-#, fuzzy
+#: engines/kyra/lol.cpp:484
msgid "Slide Right"
-msgstr "Направо"
+msgstr "Ковзати направо"
-#: engines/kyra/lol.cpp:579
-#, fuzzy
+#: engines/kyra/lol.cpp:485
msgid "Turn Left"
-msgstr "Вимкнути"
+msgstr "Повернутися наліво"
-#: engines/kyra/lol.cpp:580
-#, fuzzy
+#: engines/kyra/lol.cpp:486
msgid "Turn Right"
-msgstr "Курсор направо"
+msgstr "Повернутися направо"
-#: engines/kyra/lol.cpp:581
-#, fuzzy
+#: engines/kyra/lol.cpp:487
msgid "Rest"
-msgstr "Відновити"
+msgstr "Відпочити"
-#: engines/kyra/lol.cpp:582
-#, fuzzy
+#: engines/kyra/lol.cpp:488
msgid "Options"
-msgstr "~Н~алаштування"
+msgstr "Налаштування"
-#: engines/kyra/lol.cpp:583
-#, fuzzy
+#: engines/kyra/lol.cpp:489
msgid "Choose Spell"
-msgstr "Вибрати"
+msgstr "Вибрати закляття"
#: engines/kyra/sound_midi.cpp:475
msgid ""
@@ -2089,15 +2086,15 @@ msgstr ""
"Файл sky.cpt має невірний розмір.\n"
"Будь ласка, (пере)завантажте його з www.scummvm.org"
-#: engines/sword1/animation.cpp:345 engines/sword2/animation.cpp:379
+#: engines/sword1/animation.cpp:449 engines/sword2/animation.cpp:379
msgid "DXA cutscenes found but ScummVM has been built without zlib support"
msgstr "Знайдено заставки DXA, але ScummVM був побудований без підтримки zlib"
-#: engines/sword1/animation.cpp:355 engines/sword2/animation.cpp:389
+#: engines/sword1/animation.cpp:459 engines/sword2/animation.cpp:389
msgid "MPEG2 cutscenes are no longer supported"
msgstr "Заставки MPEG2 більше не підтримуються"
-#: engines/sword1/animation.cpp:360 engines/sword2/animation.cpp:397
+#: engines/sword1/animation.cpp:464 engines/sword2/animation.cpp:397
#, c-format
msgid "Cutscene '%s' not found"
msgstr "Заставку '%s' не знайдено"
@@ -2258,11 +2255,11 @@ msgstr "Apple II GS Емулятор (НЕ РЕАЛІЗОВАНО)"
msgid "C64 Audio Emulator"
msgstr "C64 Аудіо Емулятор"
-#: audio/softsynth/mt32.cpp:329
+#: audio/softsynth/mt32.cpp:293
msgid "Initializing MT-32 Emulator"
msgstr "Налаштовую емулятор MT-32"
-#: audio/softsynth/mt32.cpp:543
+#: audio/softsynth/mt32.cpp:512
msgid "MT-32 Emulator"
msgstr "Емулятор MT-32"
@@ -2278,15 +2275,19 @@ msgstr "Емулятор IBM PCjr"
msgid "Keymap:"
msgstr "Мапа клавіш:"
-#: backends/keymapper/remap-dialog.cpp:64
+#: backends/keymapper/remap-dialog.cpp:66
+msgid " (Effective)"
+msgstr " (Ефективна)"
+
+#: backends/keymapper/remap-dialog.cpp:106
msgid " (Active)"
msgstr " (Активна)"
-#: backends/keymapper/remap-dialog.cpp:98
+#: backends/keymapper/remap-dialog.cpp:116
msgid " (Global)"
msgstr " (Глобальна)"
-#: backends/keymapper/remap-dialog.cpp:108
+#: backends/keymapper/remap-dialog.cpp:126
msgid " (Game)"
msgstr " (Ігри)"
@@ -2382,24 +2383,47 @@ msgstr "Режим тачпаду увімкнено."
msgid "Touchpad mode disabled."
msgstr "Режим тачпаду вимкнено."
-#: backends/platform/sdl/macosx/appmenu_osx.mm:67
+#: backends/platform/maemo/maemo.cpp:178
+msgid "Click Mode"
+msgstr "Режим кліків"
+
+#: backends/platform/maemo/maemo.cpp:184
+#: backends/platform/symbian/src/SymbianActions.cpp:42
+#: backends/platform/wince/CEActionsPocket.cpp:60
+#: backends/platform/wince/CEActionsSmartphone.cpp:43
+#: backends/platform/bada/form.cpp:281
+msgid "Left Click"
+msgstr "Лівий клік"
+
+#: backends/platform/maemo/maemo.cpp:187
+msgid "Middle Click"
+msgstr "Середній клік"
+
+#: backends/platform/maemo/maemo.cpp:190
+#: backends/platform/symbian/src/SymbianActions.cpp:43
+#: backends/platform/wince/CEActionsSmartphone.cpp:44
+#: backends/platform/bada/form.cpp:273
+msgid "Right Click"
+msgstr "Правий клік"
+
+#: backends/platform/sdl/macosx/appmenu_osx.mm:78
msgid "Hide ScummVM"
msgstr "Сховати ScummVM"
-#: backends/platform/sdl/macosx/appmenu_osx.mm:70
+#: backends/platform/sdl/macosx/appmenu_osx.mm:83
msgid "Hide Others"
msgstr "Сховати Інші"
-#: backends/platform/sdl/macosx/appmenu_osx.mm:74
+#: backends/platform/sdl/macosx/appmenu_osx.mm:88
msgid "Show All"
msgstr "Показати Все"
-#: backends/platform/sdl/macosx/appmenu_osx.mm:92
-#: backends/platform/sdl/macosx/appmenu_osx.mm:99
+#: backends/platform/sdl/macosx/appmenu_osx.mm:110
+#: backends/platform/sdl/macosx/appmenu_osx.mm:121
msgid "Window"
msgstr "Вікно"
-#: backends/platform/sdl/macosx/appmenu_osx.mm:95
+#: backends/platform/sdl/macosx/appmenu_osx.mm:115
msgid "Minimize"
msgstr "Мінімізувати"
@@ -2413,12 +2437,12 @@ msgid "Normal (no scaling)"
msgstr "Без збільшення"
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2147
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:537
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:533
msgid "Enabled aspect ratio correction"
msgstr "Корекцію співвідношення сторін увімкнено"
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2153
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:542
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:538
msgid "Disabled aspect ratio correction"
msgstr "Корекцію співвідношення сторін вимкнено"
@@ -2427,7 +2451,7 @@ msgid "Active graphics filter:"
msgstr "Поточний графічний фільтр:"
#: backends/graphics/surfacesdl/surfacesdl-graphics.cpp:2250
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:481
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:477
msgid "Windowed mode"
msgstr "Віконний режим"
@@ -2451,11 +2475,11 @@ msgstr "Поточний відеорежим"
msgid "Current scale"
msgstr "Поточний масштаб"
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:562
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:558
msgid "Active filter mode: Linear"
msgstr "Активний режим фільтрації: Лінійний"
-#: backends/graphics/openglsdl/openglsdl-graphics.cpp:564
+#: backends/graphics/openglsdl/openglsdl-graphics.cpp:560
msgid "Active filter mode: Nearest"
msgstr "Активний режим фільтрації: Найближче"
@@ -2479,19 +2503,6 @@ msgstr "Наліво"
msgid "Right"
msgstr "Направо"
-#: backends/platform/symbian/src/SymbianActions.cpp:42
-#: backends/platform/wince/CEActionsPocket.cpp:60
-#: backends/platform/wince/CEActionsSmartphone.cpp:43
-#: backends/platform/bada/form.cpp:281
-msgid "Left Click"
-msgstr "Лівий клік"
-
-#: backends/platform/symbian/src/SymbianActions.cpp:43
-#: backends/platform/wince/CEActionsSmartphone.cpp:44
-#: backends/platform/bada/form.cpp:273
-msgid "Right Click"
-msgstr "Правий клік"
-
#: backends/platform/symbian/src/SymbianActions.cpp:46
#: backends/platform/wince/CEActionsSmartphone.cpp:47
msgid "Zone"
@@ -2854,11 +2865,11 @@ msgstr "Показати клавіатуру"
msgid "Control Mouse"
msgstr "Управління мишею"
-#: backends/events/maemosdl/maemosdl-events.cpp:129
+#: backends/events/maemosdl/maemosdl-events.cpp:192
msgid "Clicking Enabled"
msgstr "Кліки увімкнено"
-#: backends/events/maemosdl/maemosdl-events.cpp:129
+#: backends/events/maemosdl/maemosdl-events.cpp:192
msgid "Clicking Disabled"
msgstr "Кліки вимкнено"
diff --git a/ports.mk b/ports.mk
index 5f63d560ef..419b91581a 100644
--- a/ports.mk
+++ b/ports.mk
@@ -110,7 +110,7 @@ OSX_STATIC_LIBS += $(STATICLIBPATH)/lib/libfaad.a
endif
ifdef USE_ZLIB
-OSX_ZLIB ?= -lz
+OSX_ZLIB ?= $(STATICLIBPATH)/lib/libz.a
endif
ifdef USE_SPARKLE
@@ -165,10 +165,10 @@ osxsnap: bundle
mkdir ScummVM-snapshot/doc/it
cp $(srcdir)/doc/it/GuidaRapida ./ScummVM-snapshot/doc/it/GuidaRapida
mkdir ScummVM-snapshot/doc/no-nb
- cp $(srcdir)doc/no-nb/HurtigStart ./ScummVM-snapshot/doc/no-nb/HurtigStart
+ cp $(srcdir)/doc/no-nb/HurtigStart ./ScummVM-snapshot/doc/no-nb/HurtigStart
mkdir ScummVM-snapshot/doc/se
- cp $(srcdir)doc/se/LasMig ./ScummVM-snapshot/doc/se/LasMig
- cp $(srcdir)doc/se/Snabbstart ./ScummVM-snapshot/doc/se/Snabbstart
+ cp $(srcdir)/doc/se/LasMig ./ScummVM-snapshot/doc/se/LasMig
+ cp $(srcdir)/doc/se/Snabbstart ./ScummVM-snapshot/doc/se/Snabbstart
/Developer/Tools/SetFile -t ttro -c ttxt ./ScummVM-snapshot/*
xattr -w "com.apple.TextEncoding" "utf-8;134217984" ./ScummVM-snapshot/doc/cz/*
xattr -w "com.apple.TextEncoding" "utf-8;134217984" ./ScummVM-snapshot/doc/de/*
@@ -215,6 +215,7 @@ endif
cp $(srcdir)/AUTHORS $(WIN32PATH)/AUTHORS.txt
cp $(srcdir)/COPYING $(WIN32PATH)/COPYING.txt
cp $(srcdir)/COPYING.LGPL $(WIN32PATH)/COPYING.LGPL.txt
+ cp $(srcdir)/COPYING.FREEFONT $(WIN32PATH)/COPYING.FREEFONT.txt
cp $(srcdir)/COPYRIGHT $(WIN32PATH)/COPYRIGHT.txt
cp $(srcdir)/NEWS $(WIN32PATH)/NEWS.txt
cp $(srcdir)/doc/cz/PrectiMe $(WIN32PATH)/doc/cz/PrectiMe.txt
@@ -233,6 +234,8 @@ endif
cp /usr/local/bin/SDL.dll $(WIN32PATH)
cp $(srcdir)/dists/win32/graphics/left.bmp $(WIN32PATH)/graphics
cp $(srcdir)/dists/win32/graphics/scummvm-install.ico $(WIN32PATH)/graphics
+ cp $(srcdir)/dists/win32/migration.bat $(WIN32PATH)
+ cp $(srcdir)/dists/win32/migration.txt $(WIN32PATH)
cp $(srcdir)/dists/win32/ScummVM.iss $(WIN32PATH)
unix2dos $(WIN32PATH)/*.txt
unix2dos $(WIN32PATH)/doc/*.txt
diff --git a/test/common/fixedstack.h b/test/common/fixedstack.h
index 9aa00b4680..9d4cceb2e6 100644
--- a/test/common/fixedstack.h
+++ b/test/common/fixedstack.h
@@ -18,18 +18,20 @@ public:
}
void test_size() {
- Common::FixedStack<int> stack;
- TS_ASSERT_EQUALS(stack.size(), 0);
+ typedef Common::FixedStack<int> Stack;
+
+ Stack stack;
+ TS_ASSERT_EQUALS(stack.size(), (Stack::size_type)0);
stack.push(5);
- TS_ASSERT_EQUALS(stack.size(), 1);
+ TS_ASSERT_EQUALS(stack.size(), (Stack::size_type)1);
stack.push(9);
stack.push(0);
- TS_ASSERT_EQUALS(stack.size(), 3);
+ TS_ASSERT_EQUALS(stack.size(), (Stack::size_type)3);
stack.pop();
- TS_ASSERT_EQUALS(stack.size(), 2);
+ TS_ASSERT_EQUALS(stack.size(), (Stack::size_type)2);
}
void test_top_pop() {
@@ -44,7 +46,7 @@ public:
stack[0] = -23;
stack.top() = 42;
TS_ASSERT_EQUALS(stack[0], -23);
- TS_ASSERT_EQUALS(stack.top(), 42);
+ TS_ASSERT_EQUALS(stack.top(), 42);
stack.pop();
TS_ASSERT_EQUALS(stack[0], -23);
diff --git a/test/common/pack.h b/test/common/pack.h
index 724457f838..f62b31e9dc 100644
--- a/test/common/pack.h
+++ b/test/common/pack.h
@@ -15,7 +15,7 @@ struct TestStruct {
#include <common/pack-end.h> // END STRUCT PACKING
-#define OFFS(type,item) (((ptrdiff_t)(&((type*)42)->type::item))-42)
+#define OFFS(type,item) (((ptrdiff_t)(&((type *)42)->type::item))-42)
class PackTestSuite : public CxxTest::TestSuite
{
diff --git a/test/common/stack.h b/test/common/stack.h
index 0b1bcee350..ed32ec6496 100644
--- a/test/common/stack.h
+++ b/test/common/stack.h
@@ -18,18 +18,20 @@ public:
}
void test_size() {
- Common::Stack<int> stack;
- TS_ASSERT_EQUALS(stack.size(), 0);
+ typedef Common::Stack<int> Stack;
+
+ Stack stack;
+ TS_ASSERT_EQUALS(stack.size(), (Stack::size_type)0);
stack.push(5);
- TS_ASSERT_EQUALS(stack.size(), 1);
+ TS_ASSERT_EQUALS(stack.size(), (Stack::size_type)1);
stack.push(9);
stack.push(0);
- TS_ASSERT_EQUALS(stack.size(), 3);
+ TS_ASSERT_EQUALS(stack.size(), (Stack::size_type)3);
stack.pop();
- TS_ASSERT_EQUALS(stack.size(), 2);
+ TS_ASSERT_EQUALS(stack.size(), (Stack::size_type)2);
}
void test_top_pop() {
diff --git a/test/cxxtest/cxxtest/ValueTraits.h b/test/cxxtest/cxxtest/ValueTraits.h
index 339a345029..45b2ea39c1 100644
--- a/test/cxxtest/cxxtest/ValueTraits.h
+++ b/test/cxxtest/cxxtest/ValueTraits.h
@@ -70,7 +70,7 @@ namespace CxxTest
//
// The default ValueTraits class dumps up to 8 bytes as hex values
//
- template <class T>
+ template<class T>
class ValueTraits
{
enum { MAX_BYTES = 8 };
@@ -85,7 +85,7 @@ namespace CxxTest
// traits( T t )
// Creates an object of type ValueTraits<T>
//
- template <class T>
+ template<class T>
inline ValueTraits<T> traits( T t )
{
return ValueTraits<T>( t );
diff --git a/video/bink_decoder.cpp b/video/bink_decoder.cpp
index 46ac8ac386..884ca69f17 100644
--- a/video/bink_decoder.cpp
+++ b/video/bink_decoder.cpp
@@ -113,23 +113,33 @@ BinkDecoder::BinkDecoder() {
}
_audioStream = 0;
- _audioStarted = false;
}
-BinkDecoder::~BinkDecoder() {
- close();
-}
+void BinkDecoder::startAudio() {
+ if (_audioTrack < _audioTracks.size()) {
+ const AudioTrack &audio = _audioTracks[_audioTrack];
-void BinkDecoder::close() {
- reset();
+ _audioStream = Audio::makeQueuingAudioStream(audio.outSampleRate, audio.outChannels == 2);
+ g_system->getMixer()->playStream(Audio::Mixer::kPlainSoundType, &_audioHandle, _audioStream);
+ } // else no audio
+}
+void BinkDecoder::stopAudio() {
if (_audioStream) {
- // Stop audio
g_system->getMixer()->stopHandle(_audioHandle);
_audioStream = 0;
}
+}
+
+BinkDecoder::~BinkDecoder() {
+ close();
+}
- _audioStarted = false;
+void BinkDecoder::close() {
+ reset();
+
+ // Stop audio
+ stopAudio();
for (int i = 0; i < 4; i++) {
delete[] _curPlanes[i]; _curPlanes[i] = 0;
@@ -173,7 +183,7 @@ void BinkDecoder::close() {
uint32 BinkDecoder::getElapsedTime() const {
if (_audioStream && g_system->getMixer()->isSoundHandleActive(_audioHandle))
- return g_system->getMixer()->getSoundElapsedTime(_audioHandle);
+ return g_system->getMixer()->getSoundElapsedTime(_audioHandle) + _audioStartOffset;
return g_system->getMillis() - _startTime;
}
@@ -241,11 +251,6 @@ const Graphics::Surface *BinkDecoder::decodeNextFrame() {
if (_curFrame == 0)
_startTime = g_system->getMillis();
- if (!_audioStarted && _audioStream) {
- _audioStarted = true;
- g_system->getMixer()->playStream(Audio::Mixer::kPlainSoundType, &_audioHandle, _audioStream);
- }
-
return &_surface;
}
@@ -510,6 +515,11 @@ void BinkDecoder::mergeHuffmanSymbols(VideoFrame &video, byte *dst, const byte *
}
bool BinkDecoder::loadStream(Common::SeekableReadStream *stream) {
+ Graphics::PixelFormat format = g_system->getScreenFormat();
+ return loadStream(stream, format);
+}
+
+bool BinkDecoder::loadStream(Common::SeekableReadStream *stream, const Graphics::PixelFormat &format) {
close();
_id = stream->readUint32BE();
@@ -589,7 +599,6 @@ bool BinkDecoder::loadStream(Common::SeekableReadStream *stream) {
_hasAlpha = _videoFlags & kVideoFlagAlpha;
_swapPlanes = (_id == kBIKhID) || (_id == kBIKiID); // BIKh and BIKi swap the chroma planes
- Graphics::PixelFormat format = g_system->getScreenFormat();
_surface.create(width, height, format);
// Give the planes a bit extra space
@@ -618,11 +627,8 @@ bool BinkDecoder::loadStream(Common::SeekableReadStream *stream) {
initBundles();
initHuffman();
- if (_audioTrack < _audioTracks.size()) {
- const AudioTrack &audio = _audioTracks[_audioTrack];
-
- _audioStream = Audio::makeQueuingAudioStream(audio.outSampleRate, audio.outChannels == 2);
- }
+ startAudio();
+ _audioStartOffset = 0;
return true;
}
@@ -711,15 +717,15 @@ void BinkDecoder::initBundles() {
for (int i = 0; i < 2; i++) {
int width = MAX<uint32>(cw[i], 8);
- _bundles[kSourceBlockTypes ].countLengths[i] = Common::intLog2((width >> 3) + 511) + 1;
- _bundles[kSourceSubBlockTypes].countLengths[i] = Common::intLog2((width >> 4) + 511) + 1;
- _bundles[kSourceColors ].countLengths[i] = Common::intLog2((cbw[i] )*64 + 511) + 1;
- _bundles[kSourceIntraDC ].countLengths[i] = Common::intLog2((width >> 3) + 511) + 1;
- _bundles[kSourceInterDC ].countLengths[i] = Common::intLog2((width >> 3) + 511) + 1;
- _bundles[kSourceXOff ].countLengths[i] = Common::intLog2((width >> 3) + 511) + 1;
- _bundles[kSourceYOff ].countLengths[i] = Common::intLog2((width >> 3) + 511) + 1;
- _bundles[kSourcePattern ].countLengths[i] = Common::intLog2((cbw[i] << 3) + 511) + 1;
- _bundles[kSourceRun ].countLengths[i] = Common::intLog2((cbw[i] )*48 + 511) + 1;
+ _bundles[kSourceBlockTypes ].countLengths[i] = Common::intLog2((width >> 3) + 511) + 1;
+ _bundles[kSourceSubBlockTypes].countLengths[i] = Common::intLog2(((width + 7) >> 4) + 511) + 1;
+ _bundles[kSourceColors ].countLengths[i] = Common::intLog2((cbw[i]) * 64 + 511) + 1;
+ _bundles[kSourceIntraDC ].countLengths[i] = Common::intLog2((width >> 3) + 511) + 1;
+ _bundles[kSourceInterDC ].countLengths[i] = Common::intLog2((width >> 3) + 511) + 1;
+ _bundles[kSourceXOff ].countLengths[i] = Common::intLog2((width >> 3) + 511) + 1;
+ _bundles[kSourceYOff ].countLengths[i] = Common::intLog2((width >> 3) + 511) + 1;
+ _bundles[kSourcePattern ].countLengths[i] = Common::intLog2((cbw[i] << 3) + 511) + 1;
+ _bundles[kSourceRun ].countLengths[i] = Common::intLog2((cbw[i]) * 48 + 511) + 1;
}
}
diff --git a/video/bink_decoder.h b/video/bink_decoder.h
index dd1b7ca67d..3d5e882dd7 100644
--- a/video/bink_decoder.h
+++ b/video/bink_decoder.h
@@ -76,7 +76,9 @@ public:
// FixedRateVideoDecoder
Common::Rational getFrameRate() const { return _frameRate; }
-private:
+ // Bink specific
+ bool loadStream(Common::SeekableReadStream *stream, const Graphics::PixelFormat &format);
+protected:
static const int kAudioChannelsMax = 2;
static const int kAudioBlockSizeMax = (kAudioChannelsMax << 11);
@@ -221,15 +223,13 @@ private:
Audio::SoundHandle _audioHandle;
Audio::QueuingAudioStream *_audioStream;
- bool _audioStarted;
+ int32 _audioStartOffset;
uint32 _videoFlags; ///< Video frame features.
bool _hasAlpha; ///< Do video frames have alpha?
bool _swapPlanes; ///< Are the planes ordered (A)YVU instead of (A)YUV?
- uint32 _audioFrame;
-
Common::Array<AudioTrack> _audioTracks; ///< All audio tracks.
Common::Array<VideoFrame> _frames; ///< All video frames.
@@ -259,7 +259,7 @@ private:
/** Decode an audio packet. */
void audioPacket(AudioTrack &audio);
/** Decode a video packet. */
- void videoPacket(VideoFrame &video);
+ virtual void videoPacket(VideoFrame &video);
/** Decode a plane. */
void decodePlane(VideoFrame &video, int planeIdx, bool isChroma);
@@ -327,6 +327,11 @@ private:
void IDCT(int16 *block);
void IDCTPut(DecodeContext &ctx, int16 *block);
void IDCTAdd(DecodeContext &ctx, int16 *block);
+
+ /** Start playing the audio track */
+ void startAudio();
+ /** Stop playing the audio track */
+ void stopAudio();
};
} // End of namespace Video
diff --git a/video/dxa_decoder.cpp b/video/dxa_decoder.cpp
index ca62228178..7d1112a59c 100644
--- a/video/dxa_decoder.cpp
+++ b/video/dxa_decoder.cpp
@@ -318,7 +318,7 @@ void DXADecoder::decode13(int size) {
for (uint32 by = 0; by < _curHeight; by += BLOCKH) {
for (uint32 bx = 0; bx < _width; bx += BLOCKW) {
uint8 type = *codeBuf++;
- uint8 *b2 = (uint8*)_frameBuffer1 + bx + by * _width;
+ uint8 *b2 = (uint8 *)_frameBuffer1 + bx + by * _width;
switch (type) {
case 0:
@@ -369,7 +369,7 @@ void DXADecoder::decode13(int size) {
if (mbyte & 0x08)
my = -my;
- uint8 *b1 = (uint8*)_frameBuffer2 + (bx+mx) + (by+my) * _width;
+ uint8 *b1 = (uint8 *)_frameBuffer2 + (bx+mx) + (by+my) * _width;
for (int yc = 0; yc < BLOCKH; yc++) {
memcpy(b2, b1, BLOCKW);
b1 += _width;
@@ -385,7 +385,7 @@ void DXADecoder::decode13(int size) {
for (int subBlock = 0; subBlock < 4; subBlock++) {
int sx = bx + subX[subBlock], sy = by + subY[subBlock];
- b2 = (uint8*)_frameBuffer1 + sx + sy * _width;
+ b2 = (uint8 *)_frameBuffer1 + sx + sy * _width;
switch (subMask & 0xC0) {
// 00: skip
case 0x00:
@@ -413,7 +413,7 @@ void DXADecoder::decode13(int size) {
if (mbyte & 0x08)
my = -my;
- uint8 *b1 = (uint8*)_frameBuffer2 + (sx+mx) + (sy+my) * _width;
+ uint8 *b1 = (uint8 *)_frameBuffer2 + (sx+mx) + (sy+my) * _width;
for (int yc = 0; yc < BLOCKH / 2; yc++) {
memcpy(b2, b1, BLOCKW / 2);
b1 += _width;
diff --git a/video/qt_decoder.cpp b/video/qt_decoder.cpp
index 4a57ac405d..959e3c4fc7 100644
--- a/video/qt_decoder.cpp
+++ b/video/qt_decoder.cpp
@@ -113,7 +113,6 @@ void QuickTimeDecoder::pauseVideoIntern(bool pause) {
QuickTimeDecoder::VideoTrackHandler *QuickTimeDecoder::findNextVideoTrack() const {
VideoTrackHandler *bestTrack = 0;
- int32 num;
uint32 bestTime = 0xffffffff;
for (uint32 i = 0; i < _handlers.size(); i++) {
@@ -124,7 +123,6 @@ QuickTimeDecoder::VideoTrackHandler *QuickTimeDecoder::findNextVideoTrack() cons
if (time < bestTime) {
bestTime = time;
bestTrack = track;
- num = i;
}
}
}